diff options
author | Timo Sirainen <cras@irssi.org> | 2002-02-13 15:31:57 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-02-13 15:31:57 +0000 |
commit | 926342839bb02bc949252ad3507c5fdf39c978cf (patch) | |
tree | 4b7b6863eb20612b34eb101e6a1b958de5ae206d /src/fe-common | |
parent | 264e172abf272caa07f93790b45f61d472b51470 (diff) | |
download | irssi-926342839bb02bc949252ad3507c5fdf39c978cf.zip |
Separated ctcp command/data in "message irc ctcp" signal and format. Added
/FORMAT ctcp_requestd_unknown.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2438 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/irc/fe-ctcp.c | 38 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-messages.c | 8 | ||||
-rw-r--r-- | src/fe-common/irc/module-formats.c | 3 | ||||
-rw-r--r-- | src/fe-common/irc/module-formats.h | 1 |
4 files changed, 29 insertions, 21 deletions
diff --git a/src/fe-common/irc/fe-ctcp.c b/src/fe-common/irc/fe-ctcp.c index f8f9c554..064097de 100644 --- a/src/fe-common/irc/fe-ctcp.c +++ b/src/fe-common/irc/fe-ctcp.c @@ -33,44 +33,50 @@ #include "window-items.h" #include "printtext.h" -static void ctcp_print(IRC_SERVER_REC *server, - const char *prefix, const char *data, - const char *nick, const char *addr, const char *target) -{ - char *str; - - str = *data == '\0' ? g_strdup(prefix) : - g_strconcat(prefix, " ", data, NULL); - signal_emit("message irc ctcp", 5, server, str, nick, addr, target); - g_free(str); -} - static void ctcp_default_msg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr, const char *target) { - ctcp_print(server, "unknown CTCP", data, nick, addr, target); + const char *p; + char *cmd; + + p = strchr(data, ' '); + if (p == NULL) { + cmd = g_strdup(data); + data = ""; + } else { + cmd = g_strndup(data, (int) (p-data)); + data = p+1; + } + + printformat(server, ischannel(*target) ? target : nick, MSGLEVEL_CTCPS, + IRCTXT_CTCP_REQUESTED_UNKNOWN, + nick, addr, cmd, data, target); + g_free(cmd); } static void ctcp_ping_msg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr, const char *target) { - ctcp_print(server, "CTCP PING", data, nick, addr, target); + signal_emit("message irc ctcp", 6, server, "PING", + data, nick, addr, target); } static void ctcp_version_msg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr, const char *target) { - ctcp_print(server, "CTCP VERSION", data, nick, addr, target); + signal_emit("message irc ctcp", 6, server, "VERSION", + data, nick, addr, target); } static void ctcp_time_msg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr, const char *target) { - ctcp_print(server, "CTCP TIME", data, nick, addr, target); + signal_emit("message irc ctcp", 6, server, "TIME", + data, nick, addr, target); } static void ctcp_default_reply(IRC_SERVER_REC *server, const char *data, diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index b22f5cea..79823864 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -229,12 +229,12 @@ static void sig_message_own_ctcp(IRC_SERVER_REC *server, const char *cmd, IRCTXT_OWN_CTCP, target, cmd, data); } -static void sig_message_irc_ctcp(IRC_SERVER_REC *server, const char *msg, - const char *nick, const char *addr, - const char *target) +static void sig_message_irc_ctcp(IRC_SERVER_REC *server, const char *cmd, + const char *data, const char *nick, + const char *addr, const char *target) { printformat(server, ischannel(*target) ? target : nick, MSGLEVEL_CTCPS, - IRCTXT_CTCP_REQUESTED, nick, addr, msg, target); + IRCTXT_CTCP_REQUESTED, nick, addr, cmd, data, target); } void fe_irc_messages_init(void) diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c index 6a650b1f..b40e7004 100644 --- a/src/fe-common/irc/module-formats.c +++ b/src/fe-common/irc/module-formats.c @@ -138,7 +138,8 @@ FORMAT_REC fecommon_irc_formats[] = { { "ctcp_reply", "CTCP {hilight $0} reply from {nick $1}: $2", 3, { 0, 0, 0 } }, { "ctcp_reply_channel", "CTCP {hilight $0} reply from {nick $1} in channel {channel $3}: $2", 4, { 0, 0, 0, 0 } }, { "ctcp_ping_reply", "CTCP {hilight PING} reply from {nick $0}: $1.$[-3.0]2 seconds", 3, { 0, 2, 2 } }, - { "ctcp_requested", "{ctcp {hilight $0} {comment $1} requested {hilight $2} from {nick $3}}", 4, { 0, 0, 0, 0 } }, + { "ctcp_requested", "{ctcp {hilight $0} {comment $1} requested CTCP {hilight $2} from {nick $4}}: $3", 5, { 0, 0, 0, 0, 0 } }, + { "ctcp_requested_unknown", "{ctcp {hilight $0} {comment $1} requested unknown CTCP {hilight $2} from {nick $4}}: $3", 5, { 0, 0, 0, 0, 0 } }, /* ---- */ { NULL, "Other server events", 0 }, diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h index 2c29a560..90179a1b 100644 --- a/src/fe-common/irc/module-formats.h +++ b/src/fe-common/irc/module-formats.h @@ -111,6 +111,7 @@ enum { IRCTXT_CTCP_REPLY_CHANNEL, IRCTXT_CTCP_PING_REPLY, IRCTXT_CTCP_REQUESTED, + IRCTXT_CTCP_REQUESTED_UNKNOWN, IRCTXT_FILL_10, |