sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit f5da43d1484c535a57c7bbd5577790480d9575c0
parent 37042049f1746230f39325d6df0399c1563e2dc1
Author: Evan Gates <evan.gates@gmail.com>
Date:   Tue, 13 Jul 2010 09:40:16 -0700

some bug fixes for the ii patches
move add_channel() before fopen(outfile) to avoid race condition with pcw
if PART message is about us, don't print it, that reopens the channel
Diffstat:
Mtools.suckless.org/ii/patches/ii-1.4-autojoin.diff | 17+++++++++++++----
Mtools.suckless.org/ii/patches/ii-1.4-joinuser.diff | 17+++++++++++++----
2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/tools.suckless.org/ii/patches/ii-1.4-autojoin.diff b/tools.suckless.org/ii/patches/ii-1.4-autojoin.diff @@ -1,11 +1,20 @@ diff -r d93eaacde742 ii.c --- a/ii.c Fri Jun 25 10:55:05 2010 +0200 -+++ b/ii.c Fri Jun 25 10:59:35 2010 -0700 -@@ -211,6 +211,7 @@ ++++ b/ii.c Tue Jul 13 02:19:27 2010 -0700 +@@ -210,6 +210,7 @@ + if(channel) snprintf(server, sizeof(server), "-!- %s", channel); if(strstr(buf, server)) channel=""; create_filepath(outfile, sizeof(outfile), channel, "out"); - if(!(out = fopen(outfile, "a"))) return; + if(channel && channel[0]) add_channel(channel); + if(!(out = fopen(outfile, "a"))) return; strftime(buft, sizeof(buft), "%F %R", localtime(&t)); - fprintf(out, "%s %s\n", buft, buf); +@@ -357,6 +358,8 @@ + argv[TOK_CHAN] = argv[TOK_TEXT]; + snprintf(message, PIPE_BUF, "-!- %s(%s) has joined %s", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_TEXT]); + } else if(!strncmp("PART", argv[TOK_CMD], 5)) { ++ if (!strcmp(nick, argv[TOK_NICKSRV])) ++ return; + snprintf(message, PIPE_BUF, "-!- %s(%s) has left %s", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_CHAN]); + } else if(!strncmp("MODE", argv[TOK_CMD], 5)) + 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] : ""); diff --git a/tools.suckless.org/ii/patches/ii-1.4-joinuser.diff b/tools.suckless.org/ii/patches/ii-1.4-joinuser.diff @@ -1,6 +1,6 @@ diff -r d93eaacde742 ii.c --- a/ii.c Fri Jun 25 10:55:05 2010 +0200 -+++ b/ii.c Thu Jul 08 00:55:27 2010 -0700 ++++ b/ii.c Tue Jul 13 09:29:23 2010 -0700 @@ -105,6 +105,7 @@ return open(infile, O_RDONLY | O_NONBLOCK, 0); } @@ -22,14 +22,14 @@ diff -r d93eaacde742 ii.c } static void rm_channel(Channel *c) { -@@ -211,6 +218,7 @@ +@@ -210,6 +217,7 @@ + if(channel) snprintf(server, sizeof(server), "-!- %s", channel); if(strstr(buf, server)) channel=""; create_filepath(outfile, sizeof(outfile), channel, "out"); - if(!(out = fopen(outfile, "a"))) return; + if(channel && channel[0]) add_channel(channel); + if(!(out = fopen(outfile, "a"))) return; strftime(buft, sizeof(buft), "%F %R", localtime(&t)); - fprintf(out, "%s %s\n", buft, buf); @@ -237,17 +245,14 @@ case 'j': p = strchr(&buf[3], ' '); @@ -52,3 +52,12 @@ diff -r d93eaacde742 ii.c } break; case 't': +@@ -357,6 +362,8 @@ + argv[TOK_CHAN] = argv[TOK_TEXT]; + snprintf(message, PIPE_BUF, "-!- %s(%s) has joined %s", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_TEXT]); + } else if(!strncmp("PART", argv[TOK_CMD], 5)) { ++ if (!strcmp(nick, argv[TOK_NICKSRV])) ++ return; + snprintf(message, PIPE_BUF, "-!- %s(%s) has left %s", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_CHAN]); + } else if(!strncmp("MODE", argv[TOK_CMD], 5)) + 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] : "");