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
This commit is contained in:
parent
b41a564feb
commit
a2dcbf939e
@ -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
|
||||
|
14
net/irssi-icb/patches/patch-README
Normal file
14
net/irssi-icb/patches/patch-README
Normal file
@ -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
|
32
net/irssi-icb/patches/patch-src_core_icb-commands_c
Normal file
32
net/irssi-icb/patches/patch-src_core_icb-commands_c
Normal file
@ -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);
|
168
net/irssi-icb/patches/patch-src_fe-common_fe-icb_c
Normal file
168
net/irssi-icb/patches/patch-src_fe-common_fe-icb_c
Normal file
@ -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,
|
14
net/irssi-icb/patches/patch-src_fe-common_module-formats_c
Normal file
14
net/irssi-icb/patches/patch-src_fe-common_module-formats_c
Normal file
@ -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 }
|
||||
};
|
14
net/irssi-icb/patches/patch-src_fe-common_module-formats_h
Normal file
14
net/irssi-icb/patches/patch-src_fe-common_module-formats_h
Normal file
@ -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[];
|
Loading…
Reference in New Issue
Block a user