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 OSX
This commit is contained in:
sketch 2010-08-10 20:26:36 +00:00
parent 016bd9620a
commit 8f0f152656
11 changed files with 650 additions and 111 deletions

View file

@ -1,8 +1,8 @@
# $NetBSD: Makefile,v 1.30 2010/05/18 21:38:49 sketch Exp $
# $NetBSD: Makefile,v 1.31 2010/08/10 20:26:36 sketch Exp $
#
DISTNAME= irssi-icb-0.14
PKGREVISION= 17
PKGREVISION= 18
CATEGORIES= chat
MASTER_SITES= http://www.irssi.org/files/plugins/icb/
DISTFILES= ${DISTNAME}.tar.gz ${IRSSI_DISTFILE}

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.17 2010/05/18 21:38:49 sketch Exp $
$NetBSD: distinfo,v 1.18 2010/08/10 20:26:36 sketch Exp $
SHA1 (irssi-0.8.15.tar.bz2) = b79ce8c2c98a76b004f63706e7868cd363000d89
RMD160 (irssi-0.8.15.tar.bz2) = 0c8fba8cf3409621f6c1883127e14538a58c3359
@ -6,11 +6,16 @@ Size (irssi-0.8.15.tar.bz2) = 948847 bytes
SHA1 (irssi-icb-0.14.tar.gz) = 31d7a5d04a896e0e19db44b4d76b7ac85af1a5d4
RMD160 (irssi-icb-0.14.tar.gz) = dd104925ece6eabd0112b86b9eb6898846ba8f52
Size (irssi-icb-0.14.tar.gz) = 172647 bytes
SHA1 (patch-aa) = 8249c9ae3e5ae8b6110db030ee4280aa53ca1192
SHA1 (patch-ab) = 768826fbd30ed66fff6ce45b7ca492b69c0c7437
SHA1 (patch-aa) = b94bae58a59f4d96a107ad123a6abe7ac0ca375a
SHA1 (patch-ab) = 6ca4512785b91e7a05cccd8806dbcab969e91cca
SHA1 (patch-ac) = 68409b392f3212a8da9a79c2dfcc4dc265504d98
SHA1 (patch-ad) = f5cf3b9294a1a8a450f8c380ff41bbaafd425337
SHA1 (patch-ae) = ee3ed714e2f1d136562b87cfd82bc4b58b7d80df
SHA1 (patch-af) = 8f68dadd44acd870b3e84fd561edbd5958305ef3
SHA1 (patch-ag) = 4b0df5a1f59397455963888fbda1a57d56f90757
SHA1 (patch-af) = 169f32783892241133df73b25817c562531c69c9
SHA1 (patch-ag) = 2823b763c76c37e4f382cc09456cccb56f1007fc
SHA1 (patch-ah) = 097bab1ebd959372a0266fa5d9a99c78c3a2c1fe
SHA1 (patch-ai) = 42ce6c309957c3e46c638e2599b932b6ea4065ee
SHA1 (patch-aj) = 3a46a61b0bd5763f78e85d6a0bff1d1223e8da39
SHA1 (patch-al) = 2a190b803f00beb83c123bc3416e23ec7c7edc69
SHA1 (patch-am) = 832aa40a84afbfff303e6080bf420ca2ceec289f
SHA1 (patch-an) = 0a936cbdb49f9a1bf65d5e92da5d37de65238d27

View file

@ -1,14 +1,13 @@
$NetBSD: patch-aa,v 1.1 2003/12/04 10:48:09 veego Exp $
$NetBSD: patch-aa,v 1.2 2010/08/10 20:26:36 sketch Exp $
--- src/fe-common/Makefile.in.orig 2002-11-24 14:18:08.000000000 +0100
+++ src/fe-common/Makefile.in 2003-11-27 11:59:57.000000000 +0100
@@ -103,7 +103,8 @@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
-libfe_icb_la_LIBADD =
+libfe_icb_la_LIBADD = $(top_srcdir)/src/core/libicb_core.la
+libfe_icb_la_DEPENDENCIES = $(top_srcdir)/src/core/libicb_core.la
libfe_icb_la_OBJECTS = fe-icb.lo module-formats.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--- src/fe-common/Makefile.in.orig 2002-11-24 13:18:08.000000000 +0000
+++ src/fe-common/Makefile.in 2010-08-10 20:57:17.000000000 +0100
@@ -83,7 +83,7 @@
moduledir = $(libdir)/irssi/modules
module_LTLIBRARIES = libfe_icb.la
-libfe_icb_la_LDFLAGS = -avoid-version
+libfe_icb_la_LDFLAGS = -module -avoid-version
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

View file

@ -1,8 +1,8 @@
$NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $
$NetBSD: patch-ab,v 1.3 2010/08/10 20:26:36 sketch Exp $
--- src/fe-common/fe-icb.c.orig 2002-04-27 21:56:18.000000000 +0100
+++ src/fe-common/fe-icb.c 2010-05-17 20:52:23.000000000 +0100
@@ -18,12 +18,15 @@
--- src/fe-common/fe-icb.c (revision 5174)
+++ src/fe-common/fe-icb.c (working copy)
@@ -18,33 +18,73 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@ -18,19 +18,29 @@ $NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $
#include "icb.h"
#include "icb-servers.h"
@@ -33,16 +36,84 @@
#include "icb-channels.h"
+#include "icb-nicklist.h"
#include "icb-protocol.h"
#include "printtext.h"
#include "themes.h"
+static void icb_channel_change_topic(ICB_SERVER_REC *server,
+ const char *topic, const char *setby,
+ time_t settime)
+{
-static void event_status(ICB_SERVER_REC *server, const char *data)
+static void icb_change_topic(ICB_SERVER_REC *server, const char *topic,
+ const char *setby, time_t settime)
{
- char **args;
+ if (topic != NULL) {
+ g_free_not_null(server->group->topic);
+ server->group->topic = g_strdup(topic);
+ }
+
- /* FIXME: status messages should probably divided into their own
- signals so irssi could track joins, parts, etc. */
- args = icb_split(data, 2);
- printformat(server, server->group->name, MSGLEVEL_CRAP,
- ICBTXT_STATUS, args[0], args[1]);
- icb_split_free(args);
+ if (setby != NULL) {
+ g_free_not_null(server->group->topic_by);
+ server->group->topic_by = g_strdup(setby);
@ -39,72 +49,42 @@ $NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $
+ server->group->topic_time = settime;
+
+ signal_emit("channel topic changed", 1, server->group);
+}
+
static void event_status(ICB_SERVER_REC *server, const char *data)
{
char **args;
+ int len;
+ char *oldnick, *newnick;
+ char *topic, *setby, *p1, *p2;
/* FIXME: status messages should probably divided into their own
signals so irssi could track joins, parts, etc. */
args = icb_split(data, 2);
printformat(server, server->group->name, MSGLEVEL_CRAP,
ICBTXT_STATUS, args[0], args[1]);
- icb_split_free(args);
+
+ len = strlen("Name");
+ if (strncmp(args[0],"Name",len) == 0) {
+ oldnick = g_strdup(args[1]);
+ p2 = strchr(oldnick, ' ');
+ if (p2 != NULL) {
+ *p2 = '\0';
+ /* make sure it's me changing the nick */
+ if (strcmp(oldnick, server->connrec->nick) == 0) {
+ newnick = strrchr(args[1], ' ');
+ if (newnick != NULL) {
+ newnick++; /* skip the space */
+ server_change_nick(SERVER(server), newnick);
+ nicklist_rename(SERVER(server), server->connrec->nick, newnick);
+ g_free(server->connrec->nick);
+ server->connrec->nick = g_strdup(newnick);
+ }
+ }
+ }
+ g_free(oldnick);
+ }
+
+ /* sample topic msg: nick changed the topic to \"test 1\" */
+ len = strlen("Topic");
+ if (strncmp(args[0],"Topic",len) == 0) {
+ p1 = strchr(args[1], '"');
+ p2 = strrchr(args[1], '"');
+
+ /* make sure there's something between those quotes */
+ if (p1) {
+ p1++;
+ topic = g_strdup(p1);
+ p2 = strrchr(topic, '"');
+ *p2 = '\0';
+
+ setby = g_strdup(args[1]);
+ p2 = strchr(setby, ' ');
+ *p2 = '\0';
+
+ icb_channel_change_topic(server, topic, setby, time(NULL));
+
+ g_free(topic);
+ g_free(setby);
+ }
+ }
+
+ icb_split_free(args);
}
+/*
+ * ICB makes it hard to keep track of nicks:
+ *
+ * - moderators can come and go, and even return with a different nick, while
+ * still retaining their moderator status
+ *
+ * - group moderator can change at any time, if the moderator is off-group
+ * while changing nick
+ *
+ * - users can be moderator of multiple groups simultaneously, but can only
+ * be in one group at a time
+ *
+ * So for now we don't bother to track the moderator, just the group nicks
+ */
+static void icb_update_nicklist(ICB_SERVER_REC *server)
+{
+ /*
+ * In theory we should be able to just send '/who <group>' and parse,
+ * but the problem is that ICB does not send any kind of end-of-who
+ * marker when only listing one group, and sending a separate command
+ * isn't guaranteed to come back in the right order.
+ *
+ * So we're forced do perform a full /who and then match against our
+ * groupname. A full /who is terminated with a 'Total: ' line which we
+ * can use as EOF>
+ */
+ server->silentwho = TRUE;
+ icb_command(server, "w", "", NULL);
+}
+
static void event_error(ICB_SERVER_REC *server, const char *data)
@@ -84,12 +155,67 @@
{
printformat(server, NULL, MSGLEVEL_CRAP, ICBTXT_ERROR, data);
@@ -84,15 +124,351 @@
icb_split_free(args);
}
@ -131,6 +111,77 @@ $NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $
+ snprintf(buf, bufsize, " %2ds", (int)idle);
+}
+
+static void cmdout_co(ICB_SERVER_REC *server, char **args)
+{
+ char *p, *group, *topic;
+ int len;
+
+ static const char match_group[] = "Group: ";
+ static const char match_topic[] = "Topic: ";
+ static const char match_topicunset[] = "(None)";
+ static const char match_topicis[] = "The topic is";
+ static const char match_total[] = "Total: ";
+
+ /*
+ * Use 'co' as the marker to denote wl lines have finished, so
+ * reset the nick updates
+ */
+ server->updatenicks = FALSE;
+
+ /* If we're running in silent mode, parse the output for nicks/topic */
+ if (server->silentwho) {
+
+ /* Match group lines */
+ len = strlen(match_group);
+ if (strncmp(args[0], match_group, len) == 0) {
+
+ group = g_strdup(args[0] + len);
+ p = strchr(group, ' ');
+ *p = '\0';
+
+ /* Check for our particular group */
+ len = strlen(group);
+ if (g_ascii_strncasecmp(group, server->group->name, len) == 0) {
+
+ /* Start matching nicks */
+ server->updatenicks = TRUE;
+
+ p = strstr(args[0], match_topic);
+ if (p != NULL && p != args[0]) {
+ topic = p + strlen(match_topic);
+ if (topic != NULL) {
+ len = strlen(match_topicunset);
+ if (strncmp(topic,
+ match_topicunset,
+ len) != 0) {
+
+ /* No way to find who set the topic, mark as unknown */
+ icb_change_topic(server, topic, "unknown", time(NULL));
+ }
+ }
+ }
+ }
+ g_free(group);
+ }
+
+ /*
+ * End of /who output, stop silent mode and signal front-end
+ * to display /names list
+ */
+ len = strlen(match_total);
+ if (strncmp(args[0], match_total, len) == 0) {
+ server->silentwho = FALSE;
+ signal_emit("channel joined", 1, server->group);
+ }
+ } else {
+ /* Now that /topic works correctly, ignore server output */
+ len = strlen(match_topicis);
+ if (strncmp(args[0], match_topicis, len) != 0) {
+ printtext(server, NULL, MSGLEVEL_CRAP, "%s", args[0]);
+ }
+ }
+}
+
+static void cmdout_wl(ICB_SERVER_REC *server, char **args)
+{
+ struct tm *logintime;
@ -138,6 +189,7 @@ $NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $
+ char idlebuf[20];
+ char line[255];
+ time_t temptime;
+ int op;
+
+ /* "wl" : In a who listing, a line of output listing a user. Has the following format:
+
@ -157,10 +209,25 @@ $NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $
+ temptime = strtol(args[2], NULL, 10);
+ idle_time(idlebuf, sizeof(idlebuf), temptime);
+
+ snprintf(line, sizeof(line), "*** %c%-14.14s %6.6s %12.12s %s@%s %s",
+ args[0][0] == ' '?' ':'*', args[1], idlebuf, logbuf, args[5],
+ args[6], args[7]);
+ printtext(server, NULL, MSGLEVEL_CRAP, line);
+ /* Update nicklist */
+ if (server->updatenicks) {
+ op = FALSE;
+#ifdef NO_MOD_SUPPORT_YET
+ switch(args[0][0]) {
+ case '*':
+ case 'm':
+ op = TRUE;
+ break;
+ }
+#endif
+ icb_nicklist_insert(server->group, args[1], op);
+ }
+ if (!server->silentwho) {
+ snprintf(line, sizeof(line), "*** %c%-14.14s %6.6s %12.12s %s@%s %s",
+ args[0][0] == ' '?' ':'*', args[1], idlebuf, logbuf, args[5],
+ args[6], args[7]);
+ printtext(server, NULL, MSGLEVEL_CRAP, line);
+ }
+}
+
static void cmdout_default(ICB_SERVER_REC *server, char **args)
@ -169,23 +236,254 @@ $NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $
data = g_strjoinv(" ", args+1);
- printtext(server, server->group->name, MSGLEVEL_CRAP, "%s", data);
+ printtext(server, NULL, MSGLEVEL_CRAP, "%s", data);
+ if (!server->silentwho) {
+ printtext(server, NULL, MSGLEVEL_CRAP, "%s", data);
+ }
g_free(data);
}
@@ -115,6 +241,7 @@
+/*
+ * args0 = "Arrive"
+ * args0 = "<nickname> (<user>@<host>) entered group"
+ */
+static void status_arrive(ICB_SERVER_REC *server, char **args)
+{
+ char *nick, *p;
+
+ nick = g_strdup(args[1]);
+ p = strchr(nick, ' ');
+ *p = '\0';
+ /* XXX: new arrivals can still be moderator */
+ icb_nicklist_insert(server->group, nick, FALSE);
+ g_free(nick);
+
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
+/*
+ * args0 = "Depart"
+ * args1 = "<nickname> (<user>@<host>) just left"
+ */
+static void status_depart(ICB_SERVER_REC *server, char **args)
+{
+ NICK_REC *nickrec;
+ char *nick, *p;
+
+ nick = g_strdup(args[1]);
+ p = strchr(nick, ' ');
+ *p = '\0';
+
+ nickrec = nicklist_find(CHANNEL(server->group), nick);
+ if (nickrec != NULL) {
+ nicklist_remove(CHANNEL(server->group), nickrec);
+ }
+ g_free(nick);
+
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
+/*
+ * args0 = "Sign-on"
+ * args1 = "<nickname> (<user>@<host>) entered group"
+ */
+static void status_signon(ICB_SERVER_REC *server, char **args)
+{
+ char *nick, *p;
+
+ nick = g_strdup(args[1]);
+ p = strchr(nick, ' ');
+ *p = '\0';
+
+ icb_nicklist_insert(server->group, nick, FALSE);
+
+ g_free(nick);
+
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
+/*
+ * args0 = "Sign-off"
+ * args1 = "<nickname> (<user>@<host>) has signed off."
+ */
+static void status_signoff(ICB_SERVER_REC *server, char **args)
+{
+ NICK_REC *nickrec;
+ char *nick, *p;
+
+ nick = g_strdup(args[1]);
+ p = strchr(nick, ' ');
+ *p = '\0';
+
+ nickrec = nicklist_find(CHANNEL(server->group), nick);
+ if (nickrec != NULL) {
+ nicklist_remove(CHANNEL(server->group), nickrec);
+ }
+ g_free(nick);
+
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
+/*
+ * In theory should be status_status() but that's just silly :-)
+ *
+ * args0 = "Status"
+ * args0 = "You are now in group <group>[ as moderator]"
+ */
+static void status_join(ICB_SERVER_REC *server, char **args)
+{
+ icb_update_nicklist(server);
+
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
+/*
+ * args0 = "Name"
+ * args1 = "<oldnick> changed nickname to <newnick>"
+ */
+static void status_name(ICB_SERVER_REC *server, char **args)
+{
+ NICK_REC *nickrec;
+ char *oldnick, *newnick, *p;
+
+ oldnick = g_strdup(args[1]);
+ p = strchr(oldnick, ' ');
+ if (p != NULL) *p = '\0';
+
+ p = g_strdup(args[1]);
+ newnick = strrchr(p, ' ');
+ if (newnick != NULL)
+ newnick++;
+
+ nickrec = nicklist_find(CHANNEL(server->group), oldnick);
+ if (nickrec != NULL)
+ nicklist_rename(SERVER(server), oldnick, newnick);
+
+ /* Update our own nick */
+ if (strcmp(oldnick, server->connrec->nick) == 0) {
+ server_change_nick(SERVER(server), newnick);
+ g_free(server->connrec->nick);
+ server->connrec->nick = g_strdup(newnick);
+ }
+
+ g_free(oldnick);
+ g_free(p);
+
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
+/*
+ * args0 = "Topic"
+ * args1 = "<nickname> changed the topic to "<topic>"
+ */
+static void status_topic(ICB_SERVER_REC *server, char **args)
+{
+ char *topic, *setby, *p1, *p2;
+
+ p1 = strchr(args[1], '"');
+ p2 = strrchr(args[1], '"');
+
+ if (p1++) {
+ topic = g_strdup(p1);
+ p2 = strrchr(topic, '"');
+ *p2 = '\0';
+
+ setby = g_strdup(args[1]);
+ p2 = strchr(setby, ' ');
+ *p2 = '\0';
+
+ icb_change_topic(server, topic, setby, time(NULL));
+
+ g_free(topic);
+ g_free(setby);
+ }
+
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
+/*
+ * args0 = "Pass"
+ * args1 = "<nickname> just passed you moderation of group <group>"
+ * args1 = "<nickname> has passed moderation to <nickname>"
+ * args1 = "<nickname> is now mod."
+ *
+ * If the moderator signs off and you are passed moderation, then the third
+ * args1 is used.
+ *
+ */
+static void status_pass(ICB_SERVER_REC *server, char **args)
+{
+ /*
+ * Eventually we might want to track this, for now just print status
+ * to the group window
+ */
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
+static void status_default(ICB_SERVER_REC *server, char **args)
+{
+ /* Send messages to the group window by default */
+ printformat(server, server->group->name, MSGLEVEL_CRAP,
+ ICBTXT_STATUS, args[0], args[1]);
+}
+
static void sig_server_add_fill(SERVER_SETUP_REC *rec,
GHashTable *optlist)
{
@@ -109,13 +485,23 @@
{
theme_register(fecommon_icb_formats);
- signal_add("icb event status", (SIGNAL_FUNC) event_status);
signal_add("icb event error", (SIGNAL_FUNC) event_error);
signal_add("icb event important", (SIGNAL_FUNC) event_important);
signal_add("icb event beep", (SIGNAL_FUNC) event_beep);
signal_add("icb event open", (SIGNAL_FUNC) event_open);
signal_add("icb event personal", (SIGNAL_FUNC) event_personal);
+ signal_add("icb cmdout co", (SIGNAL_FUNC) cmdout_co);
+ signal_add("icb cmdout wl", (SIGNAL_FUNC) cmdout_wl);
signal_add("default icb cmdout", (SIGNAL_FUNC) cmdout_default);
+ signal_add("icb status arrive", (SIGNAL_FUNC) status_arrive);
+ signal_add("icb status depart", (SIGNAL_FUNC) status_depart);
+ signal_add("icb status sign-on", (SIGNAL_FUNC) status_signon);
+ signal_add("icb status sign-off", (SIGNAL_FUNC) status_signoff);
+ signal_add("icb status status", (SIGNAL_FUNC) status_join);
+ signal_add("icb status topic", (SIGNAL_FUNC) status_topic);
+ signal_add("icb status name", (SIGNAL_FUNC) status_name);
+ signal_add("icb status pass", (SIGNAL_FUNC) status_pass);
+ signal_add("default icb status", (SIGNAL_FUNC) status_default);
signal_add("server add fill", (SIGNAL_FUNC) sig_server_add_fill);
@@ -131,6 +258,7 @@
command_set_options("server add", "-icbnet");
@@ -125,13 +511,23 @@
void fe_icb_deinit(void)
{
- signal_remove("icb event status", (SIGNAL_FUNC) event_status);
signal_remove("icb event error", (SIGNAL_FUNC) event_error);
signal_remove("icb event important", (SIGNAL_FUNC) event_important);
signal_remove("icb event beep", (SIGNAL_FUNC) event_beep);
signal_remove("icb event open", (SIGNAL_FUNC) event_open);
signal_remove("icb event personal", (SIGNAL_FUNC) event_personal);
+ signal_remove("icb cmdout co", (SIGNAL_FUNC) cmdout_co);
+ signal_remove("icb cmdout wl", (SIGNAL_FUNC) cmdout_wl);
signal_remove("default icb cmdout", (SIGNAL_FUNC) cmdout_default);
+ signal_remove("icb status arrive", (SIGNAL_FUNC) status_arrive);
+ signal_remove("icb status depart", (SIGNAL_FUNC) status_depart);
+ signal_remove("icb status sign-on", (SIGNAL_FUNC) status_signon);
+ signal_remove("icb status sign-off", (SIGNAL_FUNC) status_signoff);
+ signal_remove("icb status status", (SIGNAL_FUNC) status_join);
+ signal_remove("icb status topic", (SIGNAL_FUNC) status_topic);
+ signal_remove("icb status name", (SIGNAL_FUNC) status_name);
+ signal_remove("icb status pass", (SIGNAL_FUNC) status_pass);
+ signal_remove("default icb status", (SIGNAL_FUNC) status_default);
signal_remove("server add fill", (SIGNAL_FUNC) sig_server_add_fill);
}

View file

@ -1,6 +1,41 @@
--- src/core/icb-protocol.c.orig 2010-05-18 21:09:43.000000000 +0100
+++ src/core/icb-protocol.c 2010-05-18 22:32:50.000000000 +0100
@@ -121,7 +121,91 @@
$NetBSD: patch-af,v 1.2 2010/08/10 20:26:36 sketch Exp $
--- src/core/icb-protocol.c (revision 5174)
+++ src/core/icb-protocol.c (working copy)
@@ -27,19 +27,19 @@
#include "icb-servers.h"
static char *signal_names[] = {
- "login",
- "open",
- "personal",
- "status",
- "error",
- "important",
- "exit",
- "command",
- "cmdout",
- "protocol",
- "beep",
- "ping",
- "pong"
+ "login", /* a */
+ "open", /* b */
+ "personal", /* c */
+ "status", /* d */
+ "error", /* e */
+ "important", /* f */
+ "exit", /* g */
+ "command", /* h */
+ "cmdout", /* i */
+ "protocol", /* j */
+ "beep", /* k */
+ "ping", /* l */
+ "pong" /* m */
};
#define SIGNAL_FIRST 'a'
@@ -121,9 +121,93 @@
void icb_send_open_msg(ICB_SERVER_REC *server, const char *text)
{
@ -42,8 +77,8 @@
+ icb_send_cmd(server, 'b', sendbuf, NULL);
+ text += len > copylen ? copylen : len;
+ }
+}
+
}
+void icb_send_private_msg(ICB_SERVER_REC *server, const char *target,
+ const char *text)
+{
@ -90,6 +125,43 @@
+ icb_send_cmd(server, 'h', "m", sendbuf, NULL);
+ text += len > copylen ? copylen : len;
+ }
+}
+
void icb_command(ICB_SERVER_REC *server, const char *cmd,
const char *args, const char *id)
{
@@ -293,6 +377,20 @@
g_strfreev(args);
}
void icb_command(ICB_SERVER_REC *server, const char *cmd,
+static void event_status(ICB_SERVER_REC *server, const char *data)
+{
+ char **args, *event;
+
+ args = g_strsplit(data, "\001", -1);
+ if (args[0] != NULL) {
+ event = g_strdup_printf("icb status %s", g_ascii_strdown(args[0], strlen(args[0])));
+ if (!signal_emit(event, 2, server, args))
+ signal_emit("default icb status", 2, server, args);
+ g_free(event);
+ }
+ g_strfreev(args);
+}
+
void icb_protocol_init(void)
{
signal_add("server connected", (SIGNAL_FUNC) sig_server_connected);
@@ -300,6 +398,7 @@
signal_add("icb event login", (SIGNAL_FUNC) event_login);
signal_add("icb event ping", (SIGNAL_FUNC) event_ping);
signal_add("icb event cmdout", (SIGNAL_FUNC) event_cmdout);
+ signal_add("icb event status", (SIGNAL_FUNC) event_status);
}
void icb_protocol_deinit(void)
@@ -309,4 +408,5 @@
signal_remove("icb event login", (SIGNAL_FUNC) event_login);
signal_remove("icb event ping", (SIGNAL_FUNC) event_ping);
signal_remove("icb event cmdout", (SIGNAL_FUNC) event_cmdout);
+ signal_remove("icb event status", (SIGNAL_FUNC) event_status);
}

View file

@ -1,8 +1,18 @@
$NetBSD: patch-ag,v 1.1 2010/05/18 21:38:49 sketch Exp $
$NetBSD: patch-ag,v 1.2 2010/08/10 20:26:36 sketch Exp $
--- src/core/icb-servers.c.orig 2010-05-18 21:25:22.000000000 +0100
+++ src/core/icb-servers.c 2010-05-18 21:24:58.000000000 +0100
@@ -113,7 +113,6 @@
--- src/core/icb-servers.c (revision 5174)
+++ src/core/icb-servers.c (working copy)
@@ -39,6 +39,9 @@
server = g_new0(ICB_SERVER_REC, 1);
server->chat_type = ICB_PROTOCOL;
+ server->silentwho = FALSE;
+ server->updatenicks = FALSE;
+
server->recvbuf_size = 256;
server->recvbuf = g_malloc(server->recvbuf_size);
@@ -113,7 +116,6 @@
const char *msg, int target_type)
{
ICB_SERVER_REC *icbserver;
@ -10,7 +20,7 @@ $NetBSD: patch-ag,v 1.1 2010/05/18 21:38:49 sketch Exp $
icbserver = ICB_SERVER(server);
g_return_if_fail(server != NULL);
@@ -125,9 +124,7 @@
@@ -125,9 +127,7 @@
icb_send_open_msg(icbserver, msg);
} else {
/* private message */

View file

@ -0,0 +1,13 @@
$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 }
};

View file

@ -0,0 +1,41 @@
$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 \

View file

@ -0,0 +1,14 @@
$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;

View file

@ -0,0 +1,49 @@
$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;
+}

View file

@ -0,0 +1,38 @@
$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