sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

ii-1.4-autojoin.diff (1092B)


      1 diff -r d93eaacde742 ii.c
      2 --- a/ii.c	Fri Jun 25 10:55:05 2010 +0200
      3 +++ b/ii.c	Tue Jul 13 02:19:27 2010 -0700
      4 @@ -210,6 +210,7 @@
      5  	if(channel) snprintf(server, sizeof(server), "-!- %s", channel);
      6  	if(strstr(buf, server)) channel="";
      7  	create_filepath(outfile, sizeof(outfile), channel, "out");
      8 +	if(channel && channel[0]) add_channel(channel);
      9  	if(!(out = fopen(outfile, "a"))) return;
     10  
     11  	strftime(buft, sizeof(buft), "%F %R", localtime(&t));
     12 @@ -357,6 +358,8 @@
     13  		argv[TOK_CHAN] = argv[TOK_TEXT];
     14  		snprintf(message, PIPE_BUF, "-!- %s(%s) has joined %s", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_TEXT]);
     15  	} else if(!strncmp("PART", argv[TOK_CMD], 5)) {
     16 +		if (!strcmp(nick, argv[TOK_NICKSRV]))
     17 +			return;
     18  		snprintf(message, PIPE_BUF, "-!- %s(%s) has left %s", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_CHAN]);
     19  	} else if(!strncmp("MODE", argv[TOK_CMD], 5))
     20  		snprintf(message, PIPE_BUF, "-!- %s changed mode/%s -> %s %s", argv[TOK_NICKSRV], argv[TOK_CMD + 1] ? argv[TOK_CMD + 1] : "" , argv[TOK_CMD + 2]? argv[TOK_CMD + 2] : "", argv[TOK_CMD + 3] ? argv[TOK_CMD + 3] : "");