shithub: ircs

Download patch

ref: 3d67aef1674ebfcc63bac043711f14ddd4765c94
parent: 1b2249dec883624e892a6c2c6187f553adfb3364
author: kemal <[email protected]>
date: Fri May 13 16:34:08 EDT 2022

ircs: no need to extern mynick

--- a/dat.h
+++ b/dat.h
@@ -47,4 +47,4 @@
 	int	depth;
 };
 
-extern char *logdir, *mynick;
+extern char *logdir;
--- a/ircfmt.c
+++ b/ircfmt.c
@@ -130,8 +130,6 @@
 	n = strlen(irc->trail);
 	if(irc->trail[n-1] == 1)
 		irc->trail[n-1] = 0;
-	if(irc->nick == nil)
-		irc->nick = mynick;
 
 	if(logdir != nil && ircischan(irc->par[0]))
 		snprint(buf, bufsize,
--- a/main.c
+++ b/main.c
@@ -45,12 +45,13 @@
 };
 
 int mainstacksize = Stacksize;
-char *logdir, *mynick;
+char *logdir;
 
 static char *service = "ircs";
 
 static char *post;
 static char *file;
+static char *mynick;
 static char *user;
 static char *addr;
 
@@ -553,9 +554,10 @@
 	target = nil;
 
 	if(strcmp(irc.cmd, "PRIVMSG") == 0){
-		if(strncmp(irc.trail, "\1ACTION ", 8) == 0)
-			fmt = ircfmtaction; /* /me */
-		else
+		if(strncmp(irc.trail, "\1ACTION ", 8) == 0){ /* /me */
+			fmt = ircfmtaction;
+			irc.nick = mynick;
+		}else
 			fmt = ircfmtpriv;
 		target = irc.par[0];
 	} else if(strcmp(irc.cmd, "QUIT") == 0){