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 09:29:23 2010 -0700
5 return open(infile, O_RDONLY | O_NONBLOCK, 0);
8 +static void print_out(char *channel, char *buf); // needs to be declared
9 static void add_channel(char *name) {
15 c->name = strdup(name);
17 + if(name[0] && !((name[0]=='#')||(name[0]=='&')||(name[0]=='+')||(name[0]=='!'))) {
19 + snprintf(msg, sizeof(msg), "-!- %s has joined %s", nick, name);
20 + print_out(name, msg);
24 static void rm_channel(Channel *c) {
26 if(channel) snprintf(server, sizeof(server), "-!- %s", channel);
27 if(strstr(buf, server)) channel="";
28 create_filepath(outfile, sizeof(outfile), channel, "out");
29 + if(channel && channel[0]) add_channel(channel);
30 if(!(out = fopen(outfile, "a"))) return;
32 strftime(buft, sizeof(buft), "%F %R", localtime(&t));
35 p = strchr(&buf[3], ' ');
37 + add_channel(&buf[3]);
38 if((buf[3]=='#')||(buf[3]=='&')||(buf[3]=='+')||(buf[3]=='!')){
39 if(p) snprintf(message, PIPE_BUF, "JOIN %s %s\r\n", &buf[3], p + 1); /* password protected channel */
40 else snprintf(message, PIPE_BUF, "JOIN %s\r\n", &buf[3]);
41 - add_channel(&buf[3]);
45 - add_channel(&buf[3]);
46 - proc_channels_privmsg(&buf[3], p + 1);
50 + proc_channels_privmsg(&buf[3], p + 1);
56 argv[TOK_CHAN] = argv[TOK_TEXT];
57 snprintf(message, PIPE_BUF, "-!- %s(%s) has joined %s", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_TEXT]);
58 } else if(!strncmp("PART", argv[TOK_CMD], 5)) {
59 + if (!strcmp(nick, argv[TOK_NICKSRV]))
61 snprintf(message, PIPE_BUF, "-!- %s(%s) has left %s", argv[TOK_NICKSRV], argv[TOK_USER], argv[TOK_CHAN]);
62 } else if(!strncmp("MODE", argv[TOK_CMD], 5))
63 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] : "");