Add another bunch of patches, including: - implement commands via irssi signals - detect /topic on join - support /names, including on join - build correctly as .so on OSXdiff -r1.30 -r1.31 pkgsrc/chat/irssi-icb/Makefile
(sketch)
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | # $NetBSD: Makefile,v 1.30 2010/05/18 21:38:49 sketch Exp $ | 1 | # $NetBSD: Makefile,v 1.31 2010/08/10 20:26:36 sketch Exp $ | |
2 | # | 2 | # | |
3 | 3 | |||
4 | DISTNAME= irssi-icb-0.14 | 4 | DISTNAME= irssi-icb-0.14 | |
5 | PKGREVISION= 17 | 5 | PKGREVISION= 18 | |
6 | CATEGORIES= chat | 6 | CATEGORIES= chat | |
7 | MASTER_SITES= http://www.irssi.org/files/plugins/icb/ | 7 | MASTER_SITES= http://www.irssi.org/files/plugins/icb/ | |
8 | DISTFILES= ${DISTNAME}.tar.gz ${IRSSI_DISTFILE} | 8 | DISTFILES= ${DISTNAME}.tar.gz ${IRSSI_DISTFILE} | |
9 | 9 | |||
10 | MAINTAINER= pkgsrc-users@NetBSD.org | 10 | MAINTAINER= pkgsrc-users@NetBSD.org | |
11 | HOMEPAGE= http://www.irssi.org/ | 11 | HOMEPAGE= http://www.irssi.org/ | |
12 | COMMENT= Irssi plugin to access ICB networks | 12 | COMMENT= Irssi plugin to access ICB networks | |
13 | LICENSE= gnu-gpl-v2 | 13 | LICENSE= gnu-gpl-v2 | |
14 | 14 | |||
15 | PKG_DESTDIR_SUPPORT= user-destdir | 15 | PKG_DESTDIR_SUPPORT= user-destdir | |
16 | 16 | |||
17 | .include "../../mk/bsd.prefs.mk" | 17 | .include "../../mk/bsd.prefs.mk" | |
18 | .include "../../chat/irssi/Makefile.common" | 18 | .include "../../chat/irssi/Makefile.common" |
@@ -1,16 +1,21 @@ | @@ -1,16 +1,21 @@ | |||
1 | $NetBSD: distinfo,v 1.17 2010/05/18 21:38:49 sketch Exp $ | 1 | $NetBSD: distinfo,v 1.18 2010/08/10 20:26:36 sketch Exp $ | |
2 | 2 | |||
3 | SHA1 (irssi-0.8.15.tar.bz2) = b79ce8c2c98a76b004f63706e7868cd363000d89 | 3 | SHA1 (irssi-0.8.15.tar.bz2) = b79ce8c2c98a76b004f63706e7868cd363000d89 | |
4 | RMD160 (irssi-0.8.15.tar.bz2) = 0c8fba8cf3409621f6c1883127e14538a58c3359 | 4 | RMD160 (irssi-0.8.15.tar.bz2) = 0c8fba8cf3409621f6c1883127e14538a58c3359 | |
5 | Size (irssi-0.8.15.tar.bz2) = 948847 bytes | 5 | Size (irssi-0.8.15.tar.bz2) = 948847 bytes | |
6 | SHA1 (irssi-icb-0.14.tar.gz) = 31d7a5d04a896e0e19db44b4d76b7ac85af1a5d4 | 6 | SHA1 (irssi-icb-0.14.tar.gz) = 31d7a5d04a896e0e19db44b4d76b7ac85af1a5d4 | |
7 | RMD160 (irssi-icb-0.14.tar.gz) = dd104925ece6eabd0112b86b9eb6898846ba8f52 | 7 | RMD160 (irssi-icb-0.14.tar.gz) = dd104925ece6eabd0112b86b9eb6898846ba8f52 | |
8 | Size (irssi-icb-0.14.tar.gz) = 172647 bytes | 8 | Size (irssi-icb-0.14.tar.gz) = 172647 bytes | |
9 | SHA1 (patch-aa) = 8249c9ae3e5ae8b6110db030ee4280aa53ca1192 | 9 | SHA1 (patch-aa) = b94bae58a59f4d96a107ad123a6abe7ac0ca375a | |
10 | SHA1 (patch-ab) = 768826fbd30ed66fff6ce45b7ca492b69c0c7437 | 10 | SHA1 (patch-ab) = 6ca4512785b91e7a05cccd8806dbcab969e91cca | |
11 | SHA1 (patch-ac) = 68409b392f3212a8da9a79c2dfcc4dc265504d98 | 11 | SHA1 (patch-ac) = 68409b392f3212a8da9a79c2dfcc4dc265504d98 | |
12 | SHA1 (patch-ad) = f5cf3b9294a1a8a450f8c380ff41bbaafd425337 | 12 | SHA1 (patch-ad) = f5cf3b9294a1a8a450f8c380ff41bbaafd425337 | |
13 | SHA1 (patch-ae) = ee3ed714e2f1d136562b87cfd82bc4b58b7d80df | 13 | SHA1 (patch-ae) = ee3ed714e2f1d136562b87cfd82bc4b58b7d80df | |
14 | SHA1 (patch-af) = 8f68dadd44acd870b3e84fd561edbd5958305ef3 | 14 | SHA1 (patch-af) = 169f32783892241133df73b25817c562531c69c9 | |
15 | SHA1 (patch-ag) = 4b0df5a1f59397455963888fbda1a57d56f90757 | 15 | SHA1 (patch-ag) = 2823b763c76c37e4f382cc09456cccb56f1007fc | |
16 | SHA1 (patch-ah) = 097bab1ebd959372a0266fa5d9a99c78c3a2c1fe | 16 | SHA1 (patch-ah) = 097bab1ebd959372a0266fa5d9a99c78c3a2c1fe | |
17 | SHA1 (patch-ai) = 42ce6c309957c3e46c638e2599b932b6ea4065ee | |||
18 | SHA1 (patch-aj) = 3a46a61b0bd5763f78e85d6a0bff1d1223e8da39 | |||
19 | SHA1 (patch-al) = 2a190b803f00beb83c123bc3416e23ec7c7edc69 | |||
20 | SHA1 (patch-am) = 832aa40a84afbfff303e6080bf420ca2ceec289f | |||
21 | SHA1 (patch-an) = 0a936cbdb49f9a1bf65d5e92da5d37de65238d27 |
@@ -1,14 +1,13 @@ | @@ -1,14 +1,13 @@ | |||
1 | $NetBSD: patch-aa,v 1.1 2003/12/04 10:48:09 veego Exp $ | 1 | $NetBSD: patch-aa,v 1.2 2010/08/10 20:26:36 sketch Exp $ | |
2 | 2 | |||
3 | --- src/fe-common/Makefile.in.orig 2002-11-24 14:18:08.000000000 +0100 | 3 | --- src/fe-common/Makefile.in.orig 2002-11-24 13:18:08.000000000 +0000 | |
4 | +++ src/fe-common/Makefile.in 2003-11-27 11:59:57.000000000 +0100 | 4 | +++ src/fe-common/Makefile.in 2010-08-10 20:57:17.000000000 +0100 | |
5 | @@ -103,7 +103,8 @@ | 5 | @@ -83,7 +83,7 @@ | |
6 | CPPFLAGS = @CPPFLAGS@ | 6 | moduledir = $(libdir)/irssi/modules | |
7 | LDFLAGS = @LDFLAGS@ | 7 | ||
8 | LIBS = @LIBS@ | 8 | module_LTLIBRARIES = libfe_icb.la | |
9 | -libfe_icb_la_LIBADD = | 9 | -libfe_icb_la_LDFLAGS = -avoid-version | |
10 | +libfe_icb_la_LIBADD = $(top_srcdir)/src/core/libicb_core.la | 10 | +libfe_icb_la_LDFLAGS = -module -avoid-version | |
11 | +libfe_icb_la_DEPENDENCIES = $(top_srcdir)/src/core/libicb_core.la | 11 | ||
12 | libfe_icb_la_OBJECTS = fe-icb.lo module-formats.lo | 12 | INCLUDES = $(GLIB_CFLAGS) -I$(IRSSI_INCLUDE) -I$(IRSSI_INCLUDE)/src -I$(IRSSI_INCLUDE)/src/core -I$(IRSSI_INCLUDE)/src/fe-common/core -I$(top_srcdir)/src/core | |
13 | CFLAGS = @CFLAGS@ | 13 | ||
14 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
@@ -1,16 +1,51 @@ | @@ -1,16 +1,51 @@ | |||
1 | --- src/core/icb-protocol.c.orig 2010-05-18 21:09:43.000000000 +0100 | 1 | $NetBSD: patch-af,v 1.2 2010/08/10 20:26:36 sketch Exp $ | |
2 | +++ src/core/icb-protocol.c 2010-05-18 22:32:50.000000000 +0100 | 2 | ||
3 | @@ -121,7 +121,91 @@ | 3 | --- src/core/icb-protocol.c (revision 5174) | |
4 | +++ src/core/icb-protocol.c (working copy) | |||
5 | @@ -27,19 +27,19 @@ | |||
6 | #include "icb-servers.h" | |||
7 | ||||
8 | static char *signal_names[] = { | |||
9 | - "login", | |||
10 | - "open", | |||
11 | - "personal", | |||
12 | - "status", | |||
13 | - "error", | |||
14 | - "important", | |||
15 | - "exit", | |||
16 | - "command", | |||
17 | - "cmdout", | |||
18 | - "protocol", | |||
19 | - "beep", | |||
20 | - "ping", | |||
21 | - "pong" | |||
22 | + "login", /* a */ | |||
23 | + "open", /* b */ | |||
24 | + "personal", /* c */ | |||
25 | + "status", /* d */ | |||
26 | + "error", /* e */ | |||
27 | + "important", /* f */ | |||
28 | + "exit", /* g */ | |||
29 | + "command", /* h */ | |||
30 | + "cmdout", /* i */ | |||
31 | + "protocol", /* j */ | |||
32 | + "beep", /* k */ | |||
33 | + "ping", /* l */ | |||
34 | + "pong" /* m */ | |||
35 | }; | |||
36 | ||||
37 | #define SIGNAL_FIRST 'a' | |||
38 | @@ -121,9 +121,93 @@ | |||
4 | 39 | |||
5 | void icb_send_open_msg(ICB_SERVER_REC *server, const char *text) | 40 | void icb_send_open_msg(ICB_SERVER_REC *server, const char *text) | |
6 | { | 41 | { | |
7 | - icb_send_cmd(server, 'b', text, NULL); | 42 | - icb_send_cmd(server, 'b', text, NULL); | |
8 | + size_t remain; | 43 | + size_t remain; | |
9 | + | 44 | + | |
10 | + /* | 45 | + /* | |
11 | + * ICB has 255 byte line length limit, and public messages are sent | 46 | + * ICB has 255 byte line length limit, and public messages are sent | |
12 | + * out with our nickname, so split text accordingly. | 47 | + * out with our nickname, so split text accordingly. | |
13 | + * | 48 | + * | |
14 | + * 250 = 255 - 'b' - 1 space after nick - ^A - nul - extra | 49 | + * 250 = 255 - 'b' - 1 space after nick - ^A - nul - extra | |
15 | + * | 50 | + * | |
16 | + * Taken from ircII's icb.c, thanks phone :-) | 51 | + * Taken from ircII's icb.c, thanks phone :-) | |
@@ -32,28 +67,28 @@ | @@ -32,28 +67,28 @@ | |||
32 | + copylen -= i - 1; | 67 | + copylen -= i - 1; | |
33 | + break; | 68 | + break; | |
34 | + } | 69 | + } | |
35 | + } | 70 | + } | |
36 | + strncpy(buf, text, copylen); | 71 | + strncpy(buf, text, copylen); | |
37 | + buf[copylen] = 0; | 72 | + buf[copylen] = 0; | |
38 | + sendbuf = buf; | 73 | + sendbuf = buf; | |
39 | + } else { | 74 | + } else { | |
40 | + sendbuf = (char *)text; | 75 | + sendbuf = (char *)text; | |
41 | + } | 76 | + } | |
42 | + icb_send_cmd(server, 'b', sendbuf, NULL); | 77 | + icb_send_cmd(server, 'b', sendbuf, NULL); | |
43 | + text += len > copylen ? copylen : len; | 78 | + text += len > copylen ? copylen : len; | |
44 | + } | 79 | + } | |
45 | +} | 80 | } | |
46 | + | 81 | ||
47 | +void icb_send_private_msg(ICB_SERVER_REC *server, const char *target, | 82 | +void icb_send_private_msg(ICB_SERVER_REC *server, const char *target, | |
48 | + const char *text) | 83 | + const char *text) | |
49 | +{ | 84 | +{ | |
50 | + size_t mylen, targlen, remain; | 85 | + size_t mylen, targlen, remain; | |
51 | + | 86 | + | |
52 | + /* | 87 | + /* | |
53 | + * ICB has 255 byte line length limit. Private messages are sent | 88 | + * ICB has 255 byte line length limit. Private messages are sent | |
54 | + * out with our nickname, but received with the target nickname, | 89 | + * out with our nickname, but received with the target nickname, | |
55 | + * so deduct the larger of the two in addition to other parts. | 90 | + * so deduct the larger of the two in addition to other parts. | |
56 | + * | 91 | + * | |
57 | + * 248 = 255 - 'hm' - 1 space after nick - ^A's - nul - extra | 92 | + * 248 = 255 - 'hm' - 1 space after nick - ^A's - nul - extra | |
58 | + * | 93 | + * | |
59 | + * Taken from ircII's icb.c, thanks phone :-) | 94 | + * Taken from ircII's icb.c, thanks phone :-) | |
@@ -80,16 +115,53 @@ | @@ -80,16 +115,53 @@ | |||
80 | + copylen -= i - 1; | 115 | + copylen -= i - 1; | |
81 | + break; | 116 | + break; | |
82 | + } | 117 | + } | |
83 | + } | 118 | + } | |
84 | + strncpy(buf, text, copylen); | 119 | + strncpy(buf, text, copylen); | |
85 | + buf[copylen] = 0; | 120 | + buf[copylen] = 0; | |
86 | + sendbuf = g_strconcat(target, " ", buf, NULL); | 121 | + sendbuf = g_strconcat(target, " ", buf, NULL); | |
87 | + } else { | 122 | + } else { | |
88 | + sendbuf = g_strconcat(target, " ", text, NULL); | 123 | + sendbuf = g_strconcat(target, " ", text, NULL); | |
89 | + } | 124 | + } | |
90 | + icb_send_cmd(server, 'h', "m", sendbuf, NULL); | 125 | + icb_send_cmd(server, 'h', "m", sendbuf, NULL); | |
91 | + text += len > copylen ? copylen : len; | 126 | + text += len > copylen ? copylen : len; | |
92 | + } | 127 | + } | |
128 | +} | |||
129 | + | |||
130 | void icb_command(ICB_SERVER_REC *server, const char *cmd, | |||
131 | const char *args, const char *id) | |||
132 | { | |||
133 | @@ -293,6 +377,20 @@ | |||
134 | g_strfreev(args); | |||
135 | } | |||
136 | ||||
137 | +static void event_status(ICB_SERVER_REC *server, const char *data) | |||
138 | +{ | |||
139 | + char **args, *event; | |||
140 | + | |||
141 | + args = g_strsplit(data, "\001", -1); | |||
142 | + if (args[0] != NULL) { | |||
143 | + event = g_strdup_printf("icb status %s", g_ascii_strdown(args[0], strlen(args[0]))); | |||
144 | + if (!signal_emit(event, 2, server, args)) | |||
145 | + signal_emit("default icb status", 2, server, args); | |||
146 | + g_free(event); | |||
147 | + } | |||
148 | + g_strfreev(args); | |||
149 | +} | |||
150 | + | |||
151 | void icb_protocol_init(void) | |||
152 | { | |||
153 | signal_add("server connected", (SIGNAL_FUNC) sig_server_connected); | |||
154 | @@ -300,6 +398,7 @@ | |||
155 | signal_add("icb event login", (SIGNAL_FUNC) event_login); | |||
156 | signal_add("icb event ping", (SIGNAL_FUNC) event_ping); | |||
157 | signal_add("icb event cmdout", (SIGNAL_FUNC) event_cmdout); | |||
158 | + signal_add("icb event status", (SIGNAL_FUNC) event_status); | |||
93 | } | 159 | } | |
94 | 160 | |||
95 | void icb_command(ICB_SERVER_REC *server, const char *cmd, | 161 | void icb_protocol_deinit(void) | |
162 | @@ -309,4 +408,5 @@ | |||
163 | signal_remove("icb event login", (SIGNAL_FUNC) event_login); | |||
164 | signal_remove("icb event ping", (SIGNAL_FUNC) event_ping); | |||
165 | signal_remove("icb event cmdout", (SIGNAL_FUNC) event_cmdout); | |||
166 | + signal_remove("icb event status", (SIGNAL_FUNC) event_status); | |||
167 | } |
@@ -1,23 +1,33 @@ | @@ -1,23 +1,33 @@ | |||
1 | $NetBSD: patch-ag,v 1.1 2010/05/18 21:38:49 sketch Exp $ | 1 | $NetBSD: patch-ag,v 1.2 2010/08/10 20:26:36 sketch Exp $ | |
2 | 2 | |||
3 | --- src/core/icb-servers.c.orig 2010-05-18 21:25:22.000000000 +0100 | 3 | --- src/core/icb-servers.c (revision 5174) | |
4 | +++ src/core/icb-servers.c 2010-05-18 21:24:58.000000000 +0100 | 4 | +++ src/core/icb-servers.c (working copy) | |
5 | @@ -113,7 +113,6 @@ | 5 | @@ -39,6 +39,9 @@ | |
6 | server = g_new0(ICB_SERVER_REC, 1); | |||
7 | server->chat_type = ICB_PROTOCOL; | |||
8 | ||||
9 | + server->silentwho = FALSE; | |||
10 | + server->updatenicks = FALSE; | |||
11 | + | |||
12 | server->recvbuf_size = 256; | |||
13 | server->recvbuf = g_malloc(server->recvbuf_size); | |||
14 | ||||
15 | @@ -113,7 +116,6 @@ | |||
6 | const char *msg, int target_type) | 16 | const char *msg, int target_type) | |
7 | { | 17 | { | |
8 | ICB_SERVER_REC *icbserver; | 18 | ICB_SERVER_REC *icbserver; | |
9 | - char *str; | 19 | - char *str; | |
10 | 20 | |||
11 | icbserver = ICB_SERVER(server); | 21 | icbserver = ICB_SERVER(server); | |
12 | g_return_if_fail(server != NULL); | 22 | g_return_if_fail(server != NULL); | |
13 | @@ -125,9 +124,7 @@ | 23 | @@ -125,9 +127,7 @@ | |
14 | icb_send_open_msg(icbserver, msg); | 24 | icb_send_open_msg(icbserver, msg); | |
15 | } else { | 25 | } else { | |
16 | /* private message */ | 26 | /* private message */ | |
17 | - str = g_strconcat(target, " ", msg, NULL); | 27 | - str = g_strconcat(target, " ", msg, NULL); | |
18 | - icb_command(icbserver, "m", str, NULL); | 28 | - icb_command(icbserver, "m", str, NULL); | |
19 | - g_free(str); | 29 | - g_free(str); | |
20 | + icb_send_private_msg(icbserver, target, msg); | 30 | + icb_send_private_msg(icbserver, target, msg); | |
21 | } | 31 | } | |
22 | } | 32 | } | |
23 | 33 |
@@ -1,191 +1,489 @@ | @@ -1,191 +1,489 @@ | |||
1 | $NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $ | 1 | $NetBSD: patch-ab,v 1.3 2010/08/10 20:26:36 sketch Exp $ | |
2 | 2 | |||
3 | --- src/fe-common/fe-icb.c.orig 2002-04-27 21:56:18.000000000 +0100 | 3 | --- src/fe-common/fe-icb.c (revision 5174) | |
4 | +++ src/fe-common/fe-icb.c 2010-05-17 20:52:23.000000000 +0100 | 4 | +++ src/fe-common/fe-icb.c (working copy) | |
5 | @@ -18,12 +18,15 @@ | 5 | @@ -18,33 +18,73 @@ | |
6 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 6 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
7 | */ | 7 | */ | |
8 | 8 | |||
9 | +#include <time.h> | 9 | +#include <time.h> | |
10 | + | 10 | + | |
11 | #include "module.h" | 11 | #include "module.h" | |
12 | #include "module-formats.h" | 12 | #include "module-formats.h" | |
13 | #include "signals.h" | 13 | #include "signals.h" | |
14 | #include "commands.h" | 14 | #include "commands.h" | |
15 | #include "servers-setup.h" | 15 | #include "servers-setup.h" | |
16 | #include "levels.h" | 16 | #include "levels.h" | |
17 | +#include "nicklist.h" | 17 | +#include "nicklist.h" | |
18 | 18 | |||
19 | #include "icb.h" | 19 | #include "icb.h" | |
20 | #include "icb-servers.h" | 20 | #include "icb-servers.h" | |
21 | @@ -33,16 +36,84 @@ | 21 | #include "icb-channels.h" | |
22 | +#include "icb-nicklist.h" | |||
23 | #include "icb-protocol.h" | |||
24 | ||||
22 | #include "printtext.h" | 25 | #include "printtext.h" | |
23 | #include "themes.h" | 26 | #include "themes.h" | |
24 | 27 | |||
25 | +static void icb_channel_change_topic(ICB_SERVER_REC *server, | 28 | -static void event_status(ICB_SERVER_REC *server, const char *data) | |
26 | + const char *topic, const char *setby, | 29 | +static void icb_change_topic(ICB_SERVER_REC *server, const char *topic, | |
27 | + time_t settime) | 30 | + const char *setby, time_t settime) | |
28 | +{ | 31 | { | |
32 | - char **args; | |||
29 | + if (topic != NULL) { | 33 | + if (topic != NULL) { | |
30 | + g_free_not_null(server->group->topic); | 34 | + g_free_not_null(server->group->topic); | |
31 | + server->group->topic = g_strdup(topic); | 35 | + server->group->topic = g_strdup(topic); | |
32 | + } | 36 | + } | |
33 | + | 37 | ||
38 | - /* FIXME: status messages should probably divided into their own | |||
39 | - signals so irssi could track joins, parts, etc. */ | |||
40 | - args = icb_split(data, 2); | |||
41 | - printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
42 | - ICBTXT_STATUS, args[0], args[1]); | |||
43 | - icb_split_free(args); | |||
34 | + if (setby != NULL) { | 44 | + if (setby != NULL) { | |
35 | + g_free_not_null(server->group->topic_by); | 45 | + g_free_not_null(server->group->topic_by); | |
36 | + server->group->topic_by = g_strdup(setby); | 46 | + server->group->topic_by = g_strdup(setby); | |
37 | + } | 47 | + } | |
38 | + | 48 | + | |
39 | + server->group->topic_time = settime; | 49 | + server->group->topic_time = settime; | |
40 | + | 50 | + | |
41 | + signal_emit("channel topic changed", 1, server->group); | 51 | + signal_emit("channel topic changed", 1, server->group); | |
42 | +} | |||
43 | + | |||
44 | static void event_status(ICB_SERVER_REC *server, const char *data) | |||
45 | { | |||
46 | char **args; | |||
47 | + int len; | |||
48 | + char *oldnick, *newnick; | |||
49 | + char *topic, *setby, *p1, *p2; | |||
50 | ||||
51 | /* FIXME: status messages should probably divided into their own | |||
52 | signals so irssi could track joins, parts, etc. */ | |||
53 | args = icb_split(data, 2); | |||
54 | printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
55 | ICBTXT_STATUS, args[0], args[1]); | |||
56 | - icb_split_free(args); | |||
57 | + | |||
58 | + len = strlen("Name"); | |||
59 | + if (strncmp(args[0],"Name",len) == 0) { | |||
60 | + oldnick = g_strdup(args[1]); | |||
61 | + p2 = strchr(oldnick, ' '); | |||
62 | + if (p2 != NULL) { | |||
63 | + *p2 = '\0'; | |||
64 | + /* make sure it's me changing the nick */ | |||
65 | + if (strcmp(oldnick, server->connrec->nick) == 0) { | |||
66 | + newnick = strrchr(args[1], ' '); | |||
67 | + if (newnick != NULL) { | |||
68 | + newnick++; /* skip the space */ | |||
69 | + server_change_nick(SERVER(server), newnick); | |||
70 | + nicklist_rename(SERVER(server), server->connrec->nick, newnick); | |||
71 | + g_free(server->connrec->nick); | |||
72 | + server->connrec->nick = g_strdup(newnick); | |||
73 | + } | |||
74 | + } | |||
75 | + } | |||
76 | + g_free(oldnick); | |||
77 | + } | |||
78 | + | |||
79 | + /* sample topic msg: nick changed the topic to \"test 1\" */ | |||
80 | + len = strlen("Topic"); | |||
81 | + if (strncmp(args[0],"Topic",len) == 0) { | |||
82 | + p1 = strchr(args[1], '"'); | |||
83 | + p2 = strrchr(args[1], '"'); | |||
84 | + | |||
85 | + /* make sure there's something between those quotes */ | |||
86 | + if (p1) { | |||
87 | + p1++; | |||
88 | + topic = g_strdup(p1); | |||
89 | + p2 = strrchr(topic, '"'); | |||
90 | + *p2 = '\0'; | |||
91 | + | |||
92 | + setby = g_strdup(args[1]); | |||
93 | + p2 = strchr(setby, ' '); | |||
94 | + *p2 = '\0'; | |||
95 | + | |||
96 | + icb_channel_change_topic(server, topic, setby, time(NULL)); | |||
97 | + | |||
98 | + g_free(topic); | |||
99 | + g_free(setby); | |||
100 | + } | |||
101 | + } | |||
102 | + | |||
103 | + icb_split_free(args); | |||
104 | } | 52 | } | |
105 | 53 | |||
54 | +/* | |||
55 | + * ICB makes it hard to keep track of nicks: | |||
56 | + * | |||
57 | + * - moderators can come and go, and even return with a different nick, while | |||
58 | + * still retaining their moderator status | |||
59 | + * | |||
60 | + * - group moderator can change at any time, if the moderator is off-group | |||
61 | + * while changing nick | |||
62 | + * | |||
63 | + * - users can be moderator of multiple groups simultaneously, but can only | |||
64 | + * be in one group at a time | |||
65 | + * | |||
66 | + * So for now we don't bother to track the moderator, just the group nicks | |||
67 | + */ | |||
68 | +static void icb_update_nicklist(ICB_SERVER_REC *server) | |||
69 | +{ | |||
70 | + /* | |||
71 | + * In theory we should be able to just send '/who <group>' and parse, | |||
72 | + * but the problem is that ICB does not send any kind of end-of-who | |||
73 | + * marker when only listing one group, and sending a separate command | |||
74 | + * isn't guaranteed to come back in the right order. | |||
75 | + * | |||
76 | + * So we're forced do perform a full /who and then match against our | |||
77 | + * groupname. A full /who is terminated with a 'Total: ' line which we | |||
78 | + * can use as EOF> | |||
79 | + */ | |||
80 | + server->silentwho = TRUE; | |||
81 | + icb_command(server, "w", "", NULL); | |||
82 | +} | |||
83 | + | |||
106 | static void event_error(ICB_SERVER_REC *server, const char *data) | 84 | static void event_error(ICB_SERVER_REC *server, const char *data) | |
107 | @@ -84,12 +155,67 @@ | 85 | { | |
86 | printformat(server, NULL, MSGLEVEL_CRAP, ICBTXT_ERROR, data); | |||
87 | @@ -84,15 +124,351 @@ | |||
108 | icb_split_free(args); | 88 | icb_split_free(args); | |
109 | } | 89 | } | |
110 | 90 | |||
111 | +static void idle_time(char *buf, size_t bufsize, time_t idle) | 91 | +static void idle_time(char *buf, size_t bufsize, time_t idle) | |
112 | +{ | 92 | +{ | |
113 | +#define MIN_LEN 60UL | 93 | +#define MIN_LEN 60UL | |
114 | +#define HOUR_LEN 3600UL | 94 | +#define HOUR_LEN 3600UL | |
115 | +#define DAY_LEN 86400UL | 95 | +#define DAY_LEN 86400UL | |
116 | +#define WEEK_LEN 604800UL | 96 | +#define WEEK_LEN 604800UL | |
117 | + | 97 | + | |
118 | + if (idle >= WEEK_LEN) | 98 | + if (idle >= WEEK_LEN) | |
119 | + snprintf(buf, bufsize, "%2dw%2dd", | 99 | + snprintf(buf, bufsize, "%2dw%2dd", | |
120 | + (int)(idle/WEEK_LEN), (int)((idle%WEEK_LEN)/DAY_LEN)); | 100 | + (int)(idle/WEEK_LEN), (int)((idle%WEEK_LEN)/DAY_LEN)); | |
121 | + else if (idle >= DAY_LEN) | 101 | + else if (idle >= DAY_LEN) | |
122 | + snprintf(buf, bufsize, "%2dd%2dh", | 102 | + snprintf(buf, bufsize, "%2dd%2dh", | |
123 | + (int)(idle/DAY_LEN), (int)((idle%DAY_LEN)/HOUR_LEN)); | 103 | + (int)(idle/DAY_LEN), (int)((idle%DAY_LEN)/HOUR_LEN)); | |
124 | + else if (idle >= HOUR_LEN) | 104 | + else if (idle >= HOUR_LEN) | |
125 | + snprintf(buf, bufsize, "%2dh%2dm", | 105 | + snprintf(buf, bufsize, "%2dh%2dm", | |
126 | + (int)(idle/HOUR_LEN), (int)((idle%HOUR_LEN)/MIN_LEN)); | 106 | + (int)(idle/HOUR_LEN), (int)((idle%HOUR_LEN)/MIN_LEN)); | |
127 | + else if (idle >= MIN_LEN) | 107 | + else if (idle >= MIN_LEN) | |
128 | + snprintf(buf, bufsize, "%2dm%2ds", | 108 | + snprintf(buf, bufsize, "%2dm%2ds", | |
129 | + (int)(idle/MIN_LEN), (int)(idle%MIN_LEN)); | 109 | + (int)(idle/MIN_LEN), (int)(idle%MIN_LEN)); | |
130 | + else | 110 | + else | |
131 | + snprintf(buf, bufsize, " %2ds", (int)idle); | 111 | + snprintf(buf, bufsize, " %2ds", (int)idle); | |
132 | +} | 112 | +} | |
133 | + | 113 | + | |
114 | +static void cmdout_co(ICB_SERVER_REC *server, char **args) | |||
115 | +{ | |||
116 | + char *p, *group, *topic; | |||
117 | + int len; | |||
118 | + | |||
119 | + static const char match_group[] = "Group: "; | |||
120 | + static const char match_topic[] = "Topic: "; | |||
121 | + static const char match_topicunset[] = "(None)"; | |||
122 | + static const char match_topicis[] = "The topic is"; | |||
123 | + static const char match_total[] = "Total: "; | |||
124 | + | |||
125 | + /* | |||
126 | + * Use 'co' as the marker to denote wl lines have finished, so | |||
127 | + * reset the nick updates | |||
128 | + */ | |||
129 | + server->updatenicks = FALSE; | |||
130 | + | |||
131 | + /* If we're running in silent mode, parse the output for nicks/topic */ | |||
132 | + if (server->silentwho) { | |||
133 | + | |||
134 | + /* Match group lines */ | |||
135 | + len = strlen(match_group); | |||
136 | + if (strncmp(args[0], match_group, len) == 0) { | |||
137 | + | |||
138 | + group = g_strdup(args[0] + len); | |||
139 | + p = strchr(group, ' '); | |||
140 | + *p = '\0'; | |||
141 | + | |||
142 | + /* Check for our particular group */ | |||
143 | + len = strlen(group); | |||
144 | + if (g_ascii_strncasecmp(group, server->group->name, len) == 0) { | |||
145 | + | |||
146 | + /* Start matching nicks */ | |||
147 | + server->updatenicks = TRUE; | |||
148 | + | |||
149 | + p = strstr(args[0], match_topic); | |||
150 | + if (p != NULL && p != args[0]) { | |||
151 | + topic = p + strlen(match_topic); | |||
152 | + if (topic != NULL) { | |||
153 | + len = strlen(match_topicunset); | |||
154 | + if (strncmp(topic, | |||
155 | + match_topicunset, | |||
156 | + len) != 0) { | |||
157 | + | |||
158 | + /* No way to find who set the topic, mark as unknown */ | |||
159 | + icb_change_topic(server, topic, "unknown", time(NULL)); | |||
160 | + } | |||
161 | + } | |||
162 | + } | |||
163 | + } | |||
164 | + g_free(group); | |||
165 | + } | |||
166 | + | |||
167 | + /* | |||
168 | + * End of /who output, stop silent mode and signal front-end | |||
169 | + * to display /names list | |||
170 | + */ | |||
171 | + len = strlen(match_total); | |||
172 | + if (strncmp(args[0], match_total, len) == 0) { | |||
173 | + server->silentwho = FALSE; | |||
174 | + signal_emit("channel joined", 1, server->group); | |||
175 | + } | |||
176 | + } else { | |||
177 | + /* Now that /topic works correctly, ignore server output */ | |||
178 | + len = strlen(match_topicis); | |||
179 | + if (strncmp(args[0], match_topicis, len) != 0) { | |||
180 | + printtext(server, NULL, MSGLEVEL_CRAP, "%s", args[0]); | |||
181 | + } | |||
182 | + } | |||
183 | +} | |||
184 | + | |||
134 | +static void cmdout_wl(ICB_SERVER_REC *server, char **args) | 185 | +static void cmdout_wl(ICB_SERVER_REC *server, char **args) | |
135 | +{ | 186 | +{ | |
136 | + struct tm *logintime; | 187 | + struct tm *logintime; | |
137 | + char logbuf[20]; | 188 | + char logbuf[20]; | |
138 | + char idlebuf[20]; | 189 | + char idlebuf[20]; | |
139 | + char line[255]; | 190 | + char line[255]; | |
140 | + time_t temptime; | 191 | + time_t temptime; | |
192 | + int op; | |||
141 | + | 193 | + | |
142 | + /* "wl" : In a who listing, a line of output listing a user. Has the following format: | 194 | + /* "wl" : In a who listing, a line of output listing a user. Has the following format: | |
143 | + | 195 | + | |
144 | + * Field 1: String indicating whether user is moderator or not. Usually "*" for | 196 | + * Field 1: String indicating whether user is moderator or not. Usually "*" for | |
145 | + * moderator, and " " for not. | 197 | + * moderator, and " " for not. | |
146 | + * Field 2: Nickname of user. | 198 | + * Field 2: Nickname of user. | |
147 | + * Field 3: Number of seconds user has been idle. | 199 | + * Field 3: Number of seconds user has been idle. | |
148 | + * Field 4: Response Time. No longer in use. | 200 | + * Field 4: Response Time. No longer in use. | |
149 | + * Field 5: Login Time. Unix time_t format. Seconds since Jan. 1, 1970 GMT. | 201 | + * Field 5: Login Time. Unix time_t format. Seconds since Jan. 1, 1970 GMT. | |
150 | + * Field 6: Username of user. | 202 | + * Field 6: Username of user. | |
151 | + * Field 7: Hostname of user. | 203 | + * Field 7: Hostname of user. | |
152 | + * Field 8: Registration status. | 204 | + * Field 8: Registration status. | |
153 | + */ | 205 | + */ | |
154 | + temptime = strtol(args[4], NULL, 10); | 206 | + temptime = strtol(args[4], NULL, 10); | |
155 | + logintime = gmtime(&temptime); | 207 | + logintime = gmtime(&temptime); | |
156 | + strftime(logbuf, sizeof(logbuf), "%b %e %H:%M", logintime); | 208 | + strftime(logbuf, sizeof(logbuf), "%b %e %H:%M", logintime); | |
157 | + temptime = strtol(args[2], NULL, 10); | 209 | + temptime = strtol(args[2], NULL, 10); | |
158 | + idle_time(idlebuf, sizeof(idlebuf), temptime); | 210 | + idle_time(idlebuf, sizeof(idlebuf), temptime); | |
159 | + | 211 | + | |
160 | + snprintf(line, sizeof(line), "*** %c%-14.14s %6.6s %12.12s %s@%s %s", | 212 | + /* Update nicklist */ | |
161 | + args[0][0] == ' '?' ':'*', args[1], idlebuf, logbuf, args[5], | 213 | + if (server->updatenicks) { | |
162 | + args[6], args[7]); | 214 | + op = FALSE; | |
163 | + printtext(server, NULL, MSGLEVEL_CRAP, line); | 215 | +#ifdef NO_MOD_SUPPORT_YET | |
216 | + switch(args[0][0]) { | |||
217 | + case '*': | |||
218 | + case 'm': | |||
219 | + op = TRUE; | |||
220 | + break; | |||
221 | + } | |||
222 | +#endif | |||
223 | + icb_nicklist_insert(server->group, args[1], op); | |||
224 | + } | |||
225 | + if (!server->silentwho) { | |||
226 | + snprintf(line, sizeof(line), "*** %c%-14.14s %6.6s %12.12s %s@%s %s", | |||
227 | + args[0][0] == ' '?' ':'*', args[1], idlebuf, logbuf, args[5], | |||
228 | + args[6], args[7]); | |||
229 | + printtext(server, NULL, MSGLEVEL_CRAP, line); | |||
230 | + } | |||
164 | +} | 231 | +} | |
165 | + | 232 | + | |
166 | static void cmdout_default(ICB_SERVER_REC *server, char **args) | 233 | static void cmdout_default(ICB_SERVER_REC *server, char **args) | |
167 | { | 234 | { | |
168 | char *data; | 235 | char *data; | |
169 | 236 | |||
170 | data = g_strjoinv(" ", args+1); | 237 | data = g_strjoinv(" ", args+1); | |
171 | - printtext(server, server->group->name, MSGLEVEL_CRAP, "%s", data); | 238 | - printtext(server, server->group->name, MSGLEVEL_CRAP, "%s", data); | |
172 | + printtext(server, NULL, MSGLEVEL_CRAP, "%s", data); | 239 | + if (!server->silentwho) { | |
240 | + printtext(server, NULL, MSGLEVEL_CRAP, "%s", data); | |||
241 | + } | |||
173 | g_free(data); | 242 | g_free(data); | |
174 | } | 243 | } | |
175 | 244 | |||
176 | @@ -115,6 +241,7 @@ | 245 | +/* | |
246 | + * args0 = "Arrive" | |||
247 | + * args0 = "<nickname> (<user>@<host>) entered group" | |||
248 | + */ | |||
249 | +static void status_arrive(ICB_SERVER_REC *server, char **args) | |||
250 | +{ | |||
251 | + char *nick, *p; | |||
252 | + | |||
253 | + nick = g_strdup(args[1]); | |||
254 | + p = strchr(nick, ' '); | |||
255 | + *p = '\0'; | |||
256 | + /* XXX: new arrivals can still be moderator */ | |||
257 | + icb_nicklist_insert(server->group, nick, FALSE); | |||
258 | + g_free(nick); | |||
259 | + | |||
260 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
261 | + ICBTXT_STATUS, args[0], args[1]); | |||
262 | +} | |||
263 | + | |||
264 | +/* | |||
265 | + * args0 = "Depart" | |||
266 | + * args1 = "<nickname> (<user>@<host>) just left" | |||
267 | + */ | |||
268 | +static void status_depart(ICB_SERVER_REC *server, char **args) | |||
269 | +{ | |||
270 | + NICK_REC *nickrec; | |||
271 | + char *nick, *p; | |||
272 | + | |||
273 | + nick = g_strdup(args[1]); | |||
274 | + p = strchr(nick, ' '); | |||
275 | + *p = '\0'; | |||
276 | + | |||
277 | + nickrec = nicklist_find(CHANNEL(server->group), nick); | |||
278 | + if (nickrec != NULL) { | |||
279 | + nicklist_remove(CHANNEL(server->group), nickrec); | |||
280 | + } | |||
281 | + g_free(nick); | |||
282 | + | |||
283 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
284 | + ICBTXT_STATUS, args[0], args[1]); | |||
285 | +} | |||
286 | + | |||
287 | +/* | |||
288 | + * args0 = "Sign-on" | |||
289 | + * args1 = "<nickname> (<user>@<host>) entered group" | |||
290 | + */ | |||
291 | +static void status_signon(ICB_SERVER_REC *server, char **args) | |||
292 | +{ | |||
293 | + char *nick, *p; | |||
294 | + | |||
295 | + nick = g_strdup(args[1]); | |||
296 | + p = strchr(nick, ' '); | |||
297 | + *p = '\0'; | |||
298 | + | |||
299 | + icb_nicklist_insert(server->group, nick, FALSE); | |||
300 | + | |||
301 | + g_free(nick); | |||
302 | + | |||
303 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
304 | + ICBTXT_STATUS, args[0], args[1]); | |||
305 | +} | |||
306 | + | |||
307 | +/* | |||
308 | + * args0 = "Sign-off" | |||
309 | + * args1 = "<nickname> (<user>@<host>) has signed off." | |||
310 | + */ | |||
311 | +static void status_signoff(ICB_SERVER_REC *server, char **args) | |||
312 | +{ | |||
313 | + NICK_REC *nickrec; | |||
314 | + char *nick, *p; | |||
315 | + | |||
316 | + nick = g_strdup(args[1]); | |||
317 | + p = strchr(nick, ' '); | |||
318 | + *p = '\0'; | |||
319 | + | |||
320 | + nickrec = nicklist_find(CHANNEL(server->group), nick); | |||
321 | + if (nickrec != NULL) { | |||
322 | + nicklist_remove(CHANNEL(server->group), nickrec); | |||
323 | + } | |||
324 | + g_free(nick); | |||
325 | + | |||
326 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
327 | + ICBTXT_STATUS, args[0], args[1]); | |||
328 | +} | |||
329 | + | |||
330 | +/* | |||
331 | + * In theory should be status_status() but that's just silly :-) | |||
332 | + * | |||
333 | + * args0 = "Status" | |||
334 | + * args0 = "You are now in group <group>[ as moderator]" | |||
335 | + */ | |||
336 | +static void status_join(ICB_SERVER_REC *server, char **args) | |||
337 | +{ | |||
338 | + icb_update_nicklist(server); | |||
339 | + | |||
340 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
341 | + ICBTXT_STATUS, args[0], args[1]); | |||
342 | +} | |||
343 | + | |||
344 | +/* | |||
345 | + * args0 = "Name" | |||
346 | + * args1 = "<oldnick> changed nickname to <newnick>" | |||
347 | + */ | |||
348 | +static void status_name(ICB_SERVER_REC *server, char **args) | |||
349 | +{ | |||
350 | + NICK_REC *nickrec; | |||
351 | + char *oldnick, *newnick, *p; | |||
352 | + | |||
353 | + oldnick = g_strdup(args[1]); | |||
354 | + p = strchr(oldnick, ' '); | |||
355 | + if (p != NULL) *p = '\0'; | |||
356 | + | |||
357 | + p = g_strdup(args[1]); | |||
358 | + newnick = strrchr(p, ' '); | |||
359 | + if (newnick != NULL) | |||
360 | + newnick++; | |||
361 | + | |||
362 | + nickrec = nicklist_find(CHANNEL(server->group), oldnick); | |||
363 | + if (nickrec != NULL) | |||
364 | + nicklist_rename(SERVER(server), oldnick, newnick); | |||
365 | + | |||
366 | + /* Update our own nick */ | |||
367 | + if (strcmp(oldnick, server->connrec->nick) == 0) { | |||
368 | + server_change_nick(SERVER(server), newnick); | |||
369 | + g_free(server->connrec->nick); | |||
370 | + server->connrec->nick = g_strdup(newnick); | |||
371 | + } | |||
372 | + | |||
373 | + g_free(oldnick); | |||
374 | + g_free(p); | |||
375 | + | |||
376 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
377 | + ICBTXT_STATUS, args[0], args[1]); | |||
378 | +} | |||
379 | + | |||
380 | +/* | |||
381 | + * args0 = "Topic" | |||
382 | + * args1 = "<nickname> changed the topic to "<topic>" | |||
383 | + */ | |||
384 | +static void status_topic(ICB_SERVER_REC *server, char **args) | |||
385 | +{ | |||
386 | + char *topic, *setby, *p1, *p2; | |||
387 | + | |||
388 | + p1 = strchr(args[1], '"'); | |||
389 | + p2 = strrchr(args[1], '"'); | |||
390 | + | |||
391 | + if (p1++) { | |||
392 | + topic = g_strdup(p1); | |||
393 | + p2 = strrchr(topic, '"'); | |||
394 | + *p2 = '\0'; | |||
395 | + | |||
396 | + setby = g_strdup(args[1]); | |||
397 | + p2 = strchr(setby, ' '); | |||
398 | + *p2 = '\0'; | |||
399 | + | |||
400 | + icb_change_topic(server, topic, setby, time(NULL)); | |||
401 | + | |||
402 | + g_free(topic); | |||
403 | + g_free(setby); | |||
404 | + } | |||
405 | + | |||
406 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
407 | + ICBTXT_STATUS, args[0], args[1]); | |||
408 | +} | |||
409 | + | |||
410 | +/* | |||
411 | + * args0 = "Pass" | |||
412 | + * args1 = "<nickname> just passed you moderation of group <group>" | |||
413 | + * args1 = "<nickname> has passed moderation to <nickname>" | |||
414 | + * args1 = "<nickname> is now mod." | |||
415 | + * | |||
416 | + * If the moderator signs off and you are passed moderation, then the third | |||
417 | + * args1 is used. | |||
418 | + * | |||
419 | + */ | |||
420 | +static void status_pass(ICB_SERVER_REC *server, char **args) | |||
421 | +{ | |||
422 | + /* | |||
423 | + * Eventually we might want to track this, for now just print status | |||
424 | + * to the group window | |||
425 | + */ | |||
426 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
427 | + ICBTXT_STATUS, args[0], args[1]); | |||
428 | +} | |||
429 | + | |||
430 | +static void status_default(ICB_SERVER_REC *server, char **args) | |||
431 | +{ | |||
432 | + /* Send messages to the group window by default */ | |||
433 | + printformat(server, server->group->name, MSGLEVEL_CRAP, | |||
434 | + ICBTXT_STATUS, args[0], args[1]); | |||
435 | +} | |||
436 | + | |||
437 | static void sig_server_add_fill(SERVER_SETUP_REC *rec, | |||
438 | GHashTable *optlist) | |||
439 | { | |||
440 | @@ -109,13 +485,23 @@ | |||
441 | { | |||
442 | theme_register(fecommon_icb_formats); | |||
443 | ||||
444 | - signal_add("icb event status", (SIGNAL_FUNC) event_status); | |||
445 | signal_add("icb event error", (SIGNAL_FUNC) event_error); | |||
446 | signal_add("icb event important", (SIGNAL_FUNC) event_important); | |||
177 | signal_add("icb event beep", (SIGNAL_FUNC) event_beep); | 447 | signal_add("icb event beep", (SIGNAL_FUNC) event_beep); | |
178 | signal_add("icb event open", (SIGNAL_FUNC) event_open); | 448 | signal_add("icb event open", (SIGNAL_FUNC) event_open); | |
179 | signal_add("icb event personal", (SIGNAL_FUNC) event_personal); | 449 | signal_add("icb event personal", (SIGNAL_FUNC) event_personal); | |
450 | + signal_add("icb cmdout co", (SIGNAL_FUNC) cmdout_co); | |||
180 | + signal_add("icb cmdout wl", (SIGNAL_FUNC) cmdout_wl); | 451 | + signal_add("icb cmdout wl", (SIGNAL_FUNC) cmdout_wl); | |
181 | signal_add("default icb cmdout", (SIGNAL_FUNC) cmdout_default); | 452 | signal_add("default icb cmdout", (SIGNAL_FUNC) cmdout_default); | |
453 | + signal_add("icb status arrive", (SIGNAL_FUNC) status_arrive); | |||
454 | + signal_add("icb status depart", (SIGNAL_FUNC) status_depart); | |||
455 | + signal_add("icb status sign-on", (SIGNAL_FUNC) status_signon); | |||
456 | + signal_add("icb status sign-off", (SIGNAL_FUNC) status_signoff); | |||
457 | + signal_add("icb status status", (SIGNAL_FUNC) status_join); | |||
458 | + signal_add("icb status topic", (SIGNAL_FUNC) status_topic); | |||
459 | + signal_add("icb status name", (SIGNAL_FUNC) status_name); | |||
460 | + signal_add("icb status pass", (SIGNAL_FUNC) status_pass); | |||
461 | + signal_add("default icb status", (SIGNAL_FUNC) status_default); | |||
182 | 462 | |||
183 | signal_add("server add fill", (SIGNAL_FUNC) sig_server_add_fill); | 463 | signal_add("server add fill", (SIGNAL_FUNC) sig_server_add_fill); | |
184 | @@ -131,6 +258,7 @@ | 464 | command_set_options("server add", "-icbnet"); | |
465 | @@ -125,13 +511,23 @@ | |||
466 | ||||
467 | void fe_icb_deinit(void) | |||
468 | { | |||
469 | - signal_remove("icb event status", (SIGNAL_FUNC) event_status); | |||
470 | signal_remove("icb event error", (SIGNAL_FUNC) event_error); | |||
471 | signal_remove("icb event important", (SIGNAL_FUNC) event_important); | |||
185 | signal_remove("icb event beep", (SIGNAL_FUNC) event_beep); | 472 | signal_remove("icb event beep", (SIGNAL_FUNC) event_beep); | |
186 | signal_remove("icb event open", (SIGNAL_FUNC) event_open); | 473 | signal_remove("icb event open", (SIGNAL_FUNC) event_open); | |
187 | signal_remove("icb event personal", (SIGNAL_FUNC) event_personal); | 474 | signal_remove("icb event personal", (SIGNAL_FUNC) event_personal); | |
475 | + signal_remove("icb cmdout co", (SIGNAL_FUNC) cmdout_co); | |||
188 | + signal_remove("icb cmdout wl", (SIGNAL_FUNC) cmdout_wl); | 476 | + signal_remove("icb cmdout wl", (SIGNAL_FUNC) cmdout_wl); | |
189 | signal_remove("default icb cmdout", (SIGNAL_FUNC) cmdout_default); | 477 | signal_remove("default icb cmdout", (SIGNAL_FUNC) cmdout_default); | |
478 | + signal_remove("icb status arrive", (SIGNAL_FUNC) status_arrive); | |||
479 | + signal_remove("icb status depart", (SIGNAL_FUNC) status_depart); | |||
480 | + signal_remove("icb status sign-on", (SIGNAL_FUNC) status_signon); | |||
481 | + signal_remove("icb status sign-off", (SIGNAL_FUNC) status_signoff); | |||
482 | + signal_remove("icb status status", (SIGNAL_FUNC) status_join); | |||
483 | + signal_remove("icb status topic", (SIGNAL_FUNC) status_topic); | |||
484 | + signal_remove("icb status name", (SIGNAL_FUNC) status_name); | |||
485 | + signal_remove("icb status pass", (SIGNAL_FUNC) status_pass); | |||
486 | + signal_remove("default icb status", (SIGNAL_FUNC) status_default); | |||
190 | 487 | |||
191 | signal_remove("server add fill", (SIGNAL_FUNC) sig_server_add_fill); | 488 | signal_remove("server add fill", (SIGNAL_FUNC) sig_server_add_fill); | |
489 | } |
$NetBSD: patch-ai,v 1.1 2010/08/10 20:26:36 sketch Exp $
--- src/fe-common/module-formats.c (revision 5174)
+++ src/fe-common/module-formats.c (working copy)
@@ -30,7 +30,7 @@
{ "status", "[$0] $1", 2, { 0, 0 } },
{ "important", "[$0!] $1", 2, { 0, 0 } },
{ "status", "{error [Error]} $0", 1, { 0 } },
- { "beep", "[beep] $1 beeps you", 1, { 0 } },
+ { "beep", "[Beep] $1 beeps you", 1, { 0 } },
{ NULL, NULL, 0 }
};
$NetBSD: patch-aj,v 1.1 2010/08/10 20:26:36 sketch Exp $
--- src/core/Makefile.in.orig 2002-11-24 13:18:08.000000000 +0000
+++ src/core/Makefile.in 2010-08-10 21:10:22.000000000 +0100
@@ -83,15 +83,15 @@
moduledir = $(libdir)/irssi/modules
module_LTLIBRARIES = libicb_core.la
-libicb_core_la_LDFLAGS = -avoid-version
+libicb_core_la_LDFLAGS = -module -avoid-version
INCLUDES = $(GLIB_CFLAGS) -I$(IRSSI_INCLUDE) -I$(IRSSI_INCLUDE)/src -I$(IRSSI_INCLUDE)/src/core
-libicb_core_la_SOURCES = icb-channels.c icb-commands.c icb-core.c icb-queries.c icb-servers-reconnect.c icb-protocol.c icb-servers.c icb-session.c
+libicb_core_la_SOURCES = icb-channels.c icb-commands.c icb-core.c icb-nicklist.c icb-queries.c icb-servers-reconnect.c icb-protocol.c icb-servers.c icb-session.c
-noinst_HEADERS = icb.h icb-channels.h icb-commands.h icb-protocol.h icb-queries.h icb-servers.h module.h
+noinst_HEADERS = icb.h icb-channels.h icb-commands.h icb-nicklist.h icb-protocol.h icb-queries.h icb-servers.h module.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config-plugin.h
@@ -106,7 +106,7 @@
libicb_core_la_LIBADD =
libicb_core_la_OBJECTS = icb-channels.lo icb-commands.lo icb-core.lo \
icb-queries.lo icb-servers-reconnect.lo icb-protocol.lo icb-servers.lo \
-icb-session.lo
+icb-session.lo icb-nicklist.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -257,6 +257,8 @@
icb-commands.h icb-servers.h icb-channels.h icb-protocol.h
icb-core.lo icb-core.o : icb-core.c module.h icb.h icb-commands.h \
icb-servers.h icb-channels.h icb-queries.h icb-protocol.h
+icb-nicklist.lo icb-nicklist.o : icb-nicklist.c module.h \
+ icb-channels.h icb-nicklist.h
icb-protocol.lo icb-protocol.o : icb-protocol.c module.h icb.h \
icb-servers.h
icb-queries.lo icb-queries.o : icb-queries.c module.h icb.h \
$NetBSD: patch-al,v 1.1 2010/08/10 20:26:36 sketch Exp $
--- src/core/icb-servers.h (revision 5174)
+++ src/core/icb-servers.h (working copy)
@@ -31,6 +31,9 @@
unsigned char *sendbuf;
int sendbuf_size;
+ int silentwho; /* silence /who output when updating nicks */
+ int updatenicks; /* parse /who output for topic/nicks */
+
unsigned char *recvbuf;
int recvbuf_size, recvbuf_pos;
int recvbuf_next_packet;
$NetBSD: patch-am,v 1.1 2010/08/10 20:26:36 sketch Exp $
--- /dev/null 2009-11-03 03:54:19.098165668 +0100
+++ src/core/icb-nicklist.c 2010-05-21 13:03:14.227283420 +0200
@@ -0,0 +1,44 @@
+/*
+ icb-nicklist.c : irssi
+
+ Copyright (C) 2010 Jonathan Perkin
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "module.h"
+#include "signals.h"
+
+#include "icb-channels.h"
+#include "icb-nicklist.h"
+
+/* Add new nick to list*/
+NICK_REC *icb_nicklist_insert(ICB_CHANNEL_REC *channel, const char *nick,
+ int mod)
+{
+ NICK_REC *rec;
+
+ g_return_val_if_fail(IS_ICB_CHANNEL(channel), NULL);
+ g_return_val_if_fail(nick != NULL, NULL);
+
+ rec = g_new0(NICK_REC, 1);
+ rec->nick = g_strdup(nick);
+
+ /* Just use existing 'op' for moderator */
+ if (mod) rec->op = TRUE;
+
+ nicklist_insert(CHANNEL(channel), rec);
+ return rec;
+}
$NetBSD: patch-an,v 1.1 2010/08/10 20:26:36 sketch Exp $
--- /dev/null 2009-11-03 03:54:19.098165668 +0100
+++ src/core/icb-nicklist.h 2010-05-21 13:03:14.236221682 +0200
@@ -0,0 +1,33 @@
+/*
+ icb-nicklist.h : irssi
+
+ Copyright (C) 2010 Jonathan Perkin
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef __ICB_NICKLIST_H
+#define __ICB_NICKLIST_H
+
+#include "nicklist.h"
+
+/* Add new nick to list */
+NICK_REC *icb_nicklist_insert(ICB_CHANNEL_REC *channel, const char *nick,
+ int mod);
+
+void icb_nicklist_init(void);
+void icb_nicklist_deinit(void);
+
+#endif