commit a4077c8e82d238b491b820b263d3c732cc3c2ddf
parent b8fb60088bca5d3fa3445dd9600fe80173a7f587
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Fri, 9 May 2014 18:57:49 +0200
fix display for /mode and /umode events
Diffstat:
irctk.c | | | 35 | ++++++++++++++++++++++++++++------- |
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/irctk.c b/irctk.c
@@ -1440,11 +1440,6 @@ void manage_event (irc_session_t *session, const char *event, const char *origin
mprintf("[%s] <%s> /invite %s %s\n", params[1], output_nick(origin), params[0], params[1]);
if (args.event_to == MESSAGE)
mprintf("[%s] -!- %s invited %s to join %s\n", params[1], output_nick(origin), params[0], params[1]);
- } else if (!strcmp(event, "MODE")) {
- if (args.event_to == COMMAND)
- mprintf("[%s] <%s> /mode %s %s\n", params[0], output_nick(origin), params[1], params[0]);
- if (args.event_to == MESSAGE)
- mprintf("[%s] -!- %s mode %s on %s\n", params[0], output_nick(origin), params[1], params[0]);
}
if (count == 2) {
@@ -1462,6 +1457,32 @@ void manage_event (irc_session_t *session, const char *event, const char *origin
}
}
+// Manage a mode event
+void manage_mode_event (irc_session_t *session, const char *event, const char *origin,
+ const char **params, unsigned int count)
+{
+ manage_event (session, event, origin, params, count);
+
+ // now, specific processing
+ if (args.event_to == COMMAND)
+ mprintf("[%s] <%s> /mode %s %s\n", params[0], output_nick(origin), params[1], params[0]);
+ if (args.event_to == MESSAGE)
+ mprintf("[%s] -!- %s mode %s on %s\n", params[0], output_nick(origin), params[1], params[0]);
+}
+
+// Manage a umode event
+void manage_umode_event (irc_session_t *session, const char *event, const char *origin,
+ const char **params, unsigned int count)
+{
+ manage_event (session, event, origin, params, count);
+
+ // now, specific processing
+ if (args.event_to == COMMAND)
+ mprintf("[%s] <%s> /mode %s %s\n", args.nick, output_nick(origin), params[0], args.nick);
+ if (args.event_to == MESSAGE)
+ mprintf("[%s] -!- %s mode %s on %s\n", args.nick, output_nick(origin), params[0], args.nick);
+}
+
// Handle a nick event
void event_nick (irc_session_t *session, const char *event, const char *origin,
const char **params, unsigned int count)
@@ -1686,8 +1707,8 @@ irc_session_t* do_connect()
callbacks.event_quit = event_quit;
callbacks.event_join = event_join;
callbacks.event_part = event_part;
- callbacks.event_mode = manage_event;
- callbacks.event_umode = manage_event;
+ callbacks.event_mode = manage_mode_event;
+ callbacks.event_umode = manage_umode_event;
callbacks.event_topic = event_topic;
callbacks.event_kick = event_kick;
callbacks.event_channel = event_channel;