summaryrefslogtreecommitdiff
path: root/src/fe-common/irc/fe-ctcp.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-02-13 15:31:57 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-02-13 15:31:57 +0000
commit926342839bb02bc949252ad3507c5fdf39c978cf (patch)
tree4b7b6863eb20612b34eb101e6a1b958de5ae206d /src/fe-common/irc/fe-ctcp.c
parent264e172abf272caa07f93790b45f61d472b51470 (diff)
downloadirssi-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/irc/fe-ctcp.c')
-rw-r--r--src/fe-common/irc/fe-ctcp.c38
1 files changed, 22 insertions, 16 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,