summaryrefslogtreecommitdiff
path: root/src/fe-common/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r--src/fe-common/irc/fe-events.c34
-rw-r--r--src/fe-common/irc/module-formats.c4
-rw-r--r--src/fe-common/irc/module-formats.h2
3 files changed, 39 insertions, 1 deletions
diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c
index 19086b40..fb811638 100644
--- a/src/fe-common/irc/fe-events.c
+++ b/src/fe-common/irc/fe-events.c
@@ -193,6 +193,38 @@ static void event_kick(const char *data, IRC_SERVER_REC *server,
g_free(params);
}
+static void event_kill(const char *data, IRC_SERVER_REC *server,
+ const char *nick, const char *addr)
+{
+ char *params, *path, *reason;
+
+ g_return_if_fail(data != NULL);
+
+ params = event_get_params(data, 2 | PARAM_FLAG_GETREST,
+ NULL, &path);
+ reason = strstr(path, " (");
+ if (reason == NULL || reason[strlen(reason)-1] != ')') {
+ /* weird server, maybe it didn't give path */
+ reason = path;
+ path = "";
+ } else {
+ /* reason inside (...) */
+ *reason = '\0';
+ reason += 2;
+ reason[strlen(reason)-1] = '\0';
+ }
+
+ if (addr != NULL) {
+ printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_KILL,
+ nick, addr, reason, path);
+ } else {
+ printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_KILL_SERVER,
+ nick, reason, path);
+ }
+
+ g_free(params);
+}
+
static void event_nick(const char *data, IRC_SERVER_REC *server,
const char *sender, const char *addr)
{
@@ -453,6 +485,7 @@ void fe_events_init(void)
signal_add("event part", (SIGNAL_FUNC) event_part);
signal_add("event quit", (SIGNAL_FUNC) event_quit);
signal_add("event kick", (SIGNAL_FUNC) event_kick);
+ signal_add("event kill", (SIGNAL_FUNC) event_kill);
signal_add("event nick", (SIGNAL_FUNC) event_nick);
signal_add("event mode", (SIGNAL_FUNC) event_mode);
signal_add("event pong", (SIGNAL_FUNC) event_pong);
@@ -482,6 +515,7 @@ void fe_events_deinit(void)
signal_remove("event part", (SIGNAL_FUNC) event_part);
signal_remove("event quit", (SIGNAL_FUNC) event_quit);
signal_remove("event kick", (SIGNAL_FUNC) event_kick);
+ signal_remove("event kill", (SIGNAL_FUNC) event_kill);
signal_remove("event nick", (SIGNAL_FUNC) event_nick);
signal_remove("event mode", (SIGNAL_FUNC) event_mode);
signal_remove("event pong", (SIGNAL_FUNC) event_pong);
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index 8e4c401b..578cea16 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -147,7 +147,9 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "pong", "PONG received from $0: $1", 2, { 0, 0 } },
{ "wallops", "{wallop WALLOP {wallop_nick $0}} $1", 2, { 0, 0 } },
{ "action_wallops", "{wallop WALLOP {wallop_action $0}} $1", 2, { 0, 0 } },
- { "error", "{hilight ERROR} $0", 1, { 0 } },
+ { "kill", "You were {error killed} by {nick $0} {nickhost $1} {reason $2} [Path: $3]", 4, { 0, 0, 0, 0 } },
+ { "kill_server", "You were {error killed} by {server $0} {reason $1} [Path: $2]", 3, { 0, 0, 0 } },
+ { "error", "{error ERROR} $0", 1, { 0 } },
{ "unknown_mode", "Unknown mode character $0", 1, { 0 } },
{ "not_chanop", "You're not channel operator in {channel $0}", 1, { 0 } },
diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h
index c1ad6d9d..48df0aa2 100644
--- a/src/fe-common/irc/module-formats.h
+++ b/src/fe-common/irc/module-formats.h
@@ -118,6 +118,8 @@ enum {
IRCTXT_PONG,
IRCTXT_WALLOPS,
IRCTXT_ACTION_WALLOPS,
+ IRCTXT_KILL,
+ IRCTXT_KILL_SERVER,
IRCTXT_ERROR,
IRCTXT_UNKNOWN_MODE,
IRCTXT_NOT_CHANOP,