Apply Matt Dunford's patch to track /nick change correctly, parse /topic

changes, and add a bunch of other commands.

Still needs to detect the topic when joining a group...
This commit is contained in:
sketch 2010-05-17 20:13:25 +00:00
parent 04daf99647
commit f9c6561792
4 changed files with 111 additions and 17 deletions

View file

@ -1,8 +1,8 @@
# $NetBSD: Makefile,v 1.28 2009/07/30 21:59:07 adrianp Exp $
# $NetBSD: Makefile,v 1.29 2010/05/17 20:13:25 sketch Exp $
#
DISTNAME= irssi-icb-0.14
PKGREVISION= 15
PKGREVISION= 16
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.15 2010/04/18 06:29:16 spz Exp $
$NetBSD: distinfo,v 1.16 2010/05/17 20:13:25 sketch Exp $
SHA1 (irssi-0.8.15.tar.bz2) = b79ce8c2c98a76b004f63706e7868cd363000d89
RMD160 (irssi-0.8.15.tar.bz2) = 0c8fba8cf3409621f6c1883127e14538a58c3359
@ -7,7 +7,7 @@ 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) = c270c35891164c9e42696e2ffc84d1e7ffaaaa2a
SHA1 (patch-ac) = 27f9148f68e2fb612dac51ac5d9401338e926d77
SHA1 (patch-ab) = 768826fbd30ed66fff6ce45b7ca492b69c0c7437
SHA1 (patch-ac) = 68409b392f3212a8da9a79c2dfcc4dc265504d98
SHA1 (patch-ad) = f5cf3b9294a1a8a450f8c380ff41bbaafd425337
SHA1 (patch-ae) = ee3ed714e2f1d136562b87cfd82bc4b58b7d80df

View file

@ -1,8 +1,8 @@
$NetBSD: patch-ab,v 1.1 2004/03/28 20:09:20 wiz Exp $
$NetBSD: patch-ab,v 1.2 2010/05/17 20:13:25 sketch Exp $
--- src/fe-common/fe-icb.c.orig Sat Apr 27 22:56:18 2002
+++ src/fe-common/fe-icb.c
@@ -18,6 +18,8 @@
--- 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 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@ -11,7 +11,100 @@ $NetBSD: patch-ab,v 1.1 2004/03/28 20:09:20 wiz Exp $
#include "module.h"
#include "module-formats.h"
#include "signals.h"
@@ -84,12 +86,67 @@ static void event_personal(ICB_SERVER_RE
#include "commands.h"
#include "servers-setup.h"
#include "levels.h"
+#include "nicklist.h"
#include "icb.h"
#include "icb-servers.h"
@@ -33,16 +36,84 @@
#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)
+{
+ if (topic != NULL) {
+ g_free_not_null(server->group->topic);
+ server->group->topic = g_strdup(topic);
+ }
+
+ if (setby != NULL) {
+ g_free_not_null(server->group->topic_by);
+ server->group->topic_by = g_strdup(setby);
+ }
+
+ 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);
}
static void event_error(ICB_SERVER_REC *server, const char *data)
@@ -84,12 +155,67 @@
icb_split_free(args);
}
@ -80,7 +173,7 @@ $NetBSD: patch-ab,v 1.1 2004/03/28 20:09:20 wiz Exp $
g_free(data);
}
@@ -115,6 +172,7 @@ void fe_icb_init(void)
@@ -115,6 +241,7 @@
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);
@ -88,7 +181,7 @@ $NetBSD: patch-ab,v 1.1 2004/03/28 20:09:20 wiz Exp $
signal_add("default icb cmdout", (SIGNAL_FUNC) cmdout_default);
signal_add("server add fill", (SIGNAL_FUNC) sig_server_add_fill);
@@ -131,6 +189,7 @@ void fe_icb_deinit(void)
@@ -131,6 +258,7 @@
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);

View file

@ -1,12 +1,13 @@
$NetBSD: patch-ac,v 1.2 2009/01/19 10:20:03 sketch Exp $
$NetBSD: patch-ac,v 1.3 2010/05/17 20:13:25 sketch Exp $
--- src/core/icb-commands.c.orig Sat May 4 18:21:43 2002
+++ src/core/icb-commands.c Mon Jan 19 10:16:27 2009
@@ -32,6 +32,7 @@
--- src/core/icb-commands.c.orig 2002-05-04 18:21:43.000000000 +0100
+++ src/core/icb-commands.c 2010-05-17 20:40:28.000000000 +0100
@@ -32,6 +32,8 @@
"invite", "v", "echoback", "name", "motd", "topic", "status",
"boot", "pass", "drop", "shutdown", "wall",
+ "whereis", "brick",
+ "whereis", "brick", "away", "noaway", "nobeep", "cancel",
+ "exclude", "news", "notify", "s_help", "shuttime", "talk", "hush",
NULL
};