From a2dcbf939e4390ab143a42da22caac55ea46ff88 Mon Sep 17 00:00:00 2001 From: sthen Date: Mon, 21 Apr 2008 10:35:27 +0000 Subject: [PATCH] display changed topic and your /nick changes in the status bar, convert times in /who to readable format, display the correct user name when someone /beeps you, and add a note to the README. ok jasper --- net/irssi-icb/Makefile | 4 +- net/irssi-icb/patches/patch-README | 14 ++ .../patches/patch-src_core_icb-commands_c | 32 ++++ .../patches/patch-src_fe-common_fe-icb_c | 168 ++++++++++++++++++ .../patch-src_fe-common_module-formats_c | 14 ++ .../patch-src_fe-common_module-formats_h | 14 ++ 6 files changed, 244 insertions(+), 2 deletions(-) create mode 100644 net/irssi-icb/patches/patch-README create mode 100644 net/irssi-icb/patches/patch-src_core_icb-commands_c create mode 100644 net/irssi-icb/patches/patch-src_fe-common_fe-icb_c create mode 100644 net/irssi-icb/patches/patch-src_fe-common_module-formats_c create mode 100644 net/irssi-icb/patches/patch-src_fe-common_module-formats_h diff --git a/net/irssi-icb/Makefile b/net/irssi-icb/Makefile index 9b039ee260b..af1b706c507 100644 --- a/net/irssi-icb/Makefile +++ b/net/irssi-icb/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.15 2007/10/15 17:53:37 jasper Exp $ +# $OpenBSD: Makefile,v 1.16 2008/04/21 10:35:27 sthen Exp $ SHARED_ONLY= Yes COMMENT= ICB plugin for irssi DISTNAME= irssi-icb-0.14 -PKGNAME= ${DISTNAME}p1 +PKGNAME= ${DISTNAME}p2 MASTER_SITES= http://humppa.nl/distfiles/ CATEGORIES= net diff --git a/net/irssi-icb/patches/patch-README b/net/irssi-icb/patches/patch-README new file mode 100644 index 00000000000..63d5d325459 --- /dev/null +++ b/net/irssi-icb/patches/patch-README @@ -0,0 +1,14 @@ +$OpenBSD: patch-README,v 1.1 2008/04/21 10:35:27 sthen Exp $ +--- README.orig Sat Apr 27 21:56:18 2002 ++++ README Sun Oct 21 15:31:29 2007 +@@ -14,6 +14,10 @@ chatnets section: + + icbnet = { type = "ICB"; }; + ++You'll also need to add to your startup file: ++ ++ LOAD icb ++ + and then: + + /SERVER ADD -auto -icbnet icbnet default.icb.net diff --git a/net/irssi-icb/patches/patch-src_core_icb-commands_c b/net/irssi-icb/patches/patch-src_core_icb-commands_c new file mode 100644 index 00000000000..7a642630f62 --- /dev/null +++ b/net/irssi-icb/patches/patch-src_core_icb-commands_c @@ -0,0 +1,32 @@ +$OpenBSD: patch-src_core_icb-commands_c,v 1.1 2008/04/21 10:35:27 sthen Exp $ +--- src/core/icb-commands.c.orig Sat May 4 18:21:43 2002 ++++ src/core/icb-commands.c Sun Oct 21 15:31:29 2007 +@@ -29,9 +29,10 @@ static char *icb_commands[] = { + "whois", "p", "delete", "cp", "rname", + "phone", "addr", "email", "text", "www", + "read", "write", "secure", "nosecure", "info", "?", +- + "invite", "v", "echoback", "name", "motd", "topic", "status", +- "boot", "pass", "drop", "shutdown", "wall", ++ "boot", "pass", "drop", "shutdown", "wall", "away", "noaway", ++ "nobeep", "cancel", "exclude", "news", "notify", "s_help", ++ "shuttime", "whereis", "hush", "talk", + NULL + }; + +@@ -108,7 +109,6 @@ void icb_commands_init(void) + + /* adds also some aliases known to IRC users :) */ + command_bind_icb("quote", NULL, (SIGNAL_FUNC) cmd_quote); +- command_bind_icb("w", NULL, (SIGNAL_FUNC) cmd_who); + command_bind_icb("who", NULL, (SIGNAL_FUNC) cmd_who); + command_bind_icb("nick", NULL, (SIGNAL_FUNC) cmd_name); + command_bind_icb("kick", NULL, (SIGNAL_FUNC) cmd_boot); +@@ -126,7 +126,6 @@ void icb_commands_deinit(void) + command_unbind(*cmd, (SIGNAL_FUNC) cmd_self); + + command_unbind("quote", (SIGNAL_FUNC) cmd_quote); +- command_unbind("w", (SIGNAL_FUNC) cmd_who); + command_unbind("who", (SIGNAL_FUNC) cmd_who); + command_unbind("nick", (SIGNAL_FUNC) cmd_name); + command_unbind("kick", (SIGNAL_FUNC) cmd_boot); diff --git a/net/irssi-icb/patches/patch-src_fe-common_fe-icb_c b/net/irssi-icb/patches/patch-src_fe-common_fe-icb_c new file mode 100644 index 00000000000..d9c50c1be60 --- /dev/null +++ b/net/irssi-icb/patches/patch-src_fe-common_fe-icb_c @@ -0,0 +1,168 @@ +$OpenBSD: patch-src_fe-common_fe-icb_c,v 1.1 2008/04/21 10:35:27 sthen Exp $ +--- src/fe-common/fe-icb.c.orig Sat Apr 27 21:56:18 2002 ++++ src/fe-common/fe-icb.c Sun Oct 21 15:31:29 2007 +@@ -24,6 +24,7 @@ + #include "commands.h" + #include "servers-setup.h" + #include "levels.h" ++#include "nicklist.h" + + #include "icb.h" + #include "icb-servers.h" +@@ -36,15 +37,90 @@ + 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]); ++ ++ /* sample nick msg: oldnick changed nickname to newnick */ ++ 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 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_error(ICB_SERVER_REC *server, const char *data) + { + printformat(server, NULL, MSGLEVEL_CRAP, ICBTXT_ERROR, data); +@@ -62,7 +138,7 @@ static void event_important(ICB_SERVER_REC *server, co + + static void event_beep(ICB_SERVER_REC *server, const char *data) + { +- printformat(server, data, MSGLEVEL_CRAP, ICBTXT_BEEP, data); ++ printformat(server, data, MSGLEVEL_MSGS, ICBTXT_BEEP, data); + } + + static void event_open(ICB_SERVER_REC *server, const char *data) +@@ -84,13 +160,51 @@ static void event_personal(ICB_SERVER_REC *server, con + icb_split_free(args); + } + ++static char *icb_who_idle(char *line) ++{ ++ int idle = atoi(line); ++ static char lbuf[16]; ++ ++ if (idle > 99 * 60) ++ g_snprintf(lbuf, sizeof lbuf, "%5dm", idle / 60); ++ else ++ if (idle < 60) ++ g_snprintf(lbuf, sizeof lbuf, "%d sec", idle); ++ else ++ g_snprintf(lbuf, sizeof lbuf, "%d:%02ds", idle / 60, idle % 60); ++ lbuf[6] = 0; /* XXX see below */ ++ return (lbuf); ++} ++ ++static char *icb_who_signon(char *line) ++{ ++ time_t their_time = (time_t)atoi(line); ++ char *s = asctime(localtime(&their_time)); ++ ++ s[16] = '\0'; /* XXX */ ++ /* Tue Mar 2 05:10:10 1999J */ ++ /* <----------> */ ++ return (s + 4); ++} ++ + static void cmdout_default(ICB_SERVER_REC *server, char **args) + { +- char *data; +- +- data = g_strjoinv(" ", args+1); +- printtext(server, server->group->name, MSGLEVEL_CRAP, "%s", data); +- g_free(data); ++ if (args[0][0] == 'w') { ++ if (args[0][1] == 'h') ++ printformat(server, NULL, MSGLEVEL_CRAP, ICBTXT_WHO_HEADER); ++ else if (args[0][1] == 'l') { ++ char *arg1 = args[1][0] == 'm' ? "*" : " "; ++ printformat(server, NULL, MSGLEVEL_CRAP, ++ ICBTXT_WHO_LIST, arg1, args[2], ++ icb_who_idle(args[3]), ++ icb_who_signon(args[5]), ++ args[6], args[7], args[8]); ++ } ++ } else { ++ char *data = g_strjoinv(" ", args+1); ++ printtext(server, server->group->name, MSGLEVEL_CRAP, "%s", data); ++ g_free(data); ++ } + } + + static void sig_server_add_fill(SERVER_SETUP_REC *rec, diff --git a/net/irssi-icb/patches/patch-src_fe-common_module-formats_c b/net/irssi-icb/patches/patch-src_fe-common_module-formats_c new file mode 100644 index 00000000000..3ea3c876452 --- /dev/null +++ b/net/irssi-icb/patches/patch-src_fe-common_module-formats_c @@ -0,0 +1,14 @@ +$OpenBSD: patch-src_fe-common_module-formats_c,v 1.1 2008/04/21 10:35:27 sthen Exp $ +--- src/fe-common/module-formats.c.orig Sat Apr 27 21:56:18 2002 ++++ src/fe-common/module-formats.c Sun Oct 21 15:31:29 2007 +@@ -30,7 +30,9 @@ FORMAT_REC fecommon_icb_formats[] = { + { "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] $0 wants to annoy you.", 1, { 0 } }, ++ { "who_header", " Nickname Idle Sign-On Account", 0 }, ++ { "who_list", "$0$[13]1 $[-6]2 $[12]3 $4@$5 $6", 7, { 0, 0, 0, 0, 0, 0, 0 } }, + + { NULL, NULL, 0 } + }; diff --git a/net/irssi-icb/patches/patch-src_fe-common_module-formats_h b/net/irssi-icb/patches/patch-src_fe-common_module-formats_h new file mode 100644 index 00000000000..b79196a2792 --- /dev/null +++ b/net/irssi-icb/patches/patch-src_fe-common_module-formats_h @@ -0,0 +1,14 @@ +$OpenBSD: patch-src_fe-common_module-formats_h,v 1.1 2008/04/21 10:35:27 sthen Exp $ +--- src/fe-common/module-formats.h.orig Sat Apr 27 21:56:18 2002 ++++ src/fe-common/module-formats.h Sun Oct 21 15:31:29 2007 +@@ -8,7 +8,9 @@ enum { + ICBTXT_STATUS, + ICBTXT_IMPORTANT, + ICBTXT_ERROR, +- ICBTXT_BEEP ++ ICBTXT_BEEP, ++ ICBTXT_WHO_HEADER, ++ ICBTXT_WHO_LIST + }; + + extern FORMAT_REC fecommon_icb_formats[];