diff options
Diffstat (limited to 'src/common/modes.c')
-rw-r--r-- | src/common/modes.c | 84 |
1 files changed, 55 insertions, 29 deletions
diff --git a/src/common/modes.c b/src/common/modes.c index f8b25fcd..1aa84514 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -46,9 +46,12 @@ typedef struct static int is_prefix_char (server * serv, char c); static void record_chan_mode (session *sess, char sign, char mode, char *arg); static char *mode_cat (char *str, char *addition); -static void handle_single_mode (mode_run *mr, char sign, char mode, char *nick, char *chan, char *arg, int quiet, int is_324); +static void handle_single_mode (mode_run *mr, char sign, char mode, char *nick, + char *chan, char *arg, int quiet, int is_324, + const message_tags_data *tags_data); static int mode_has_arg (server *serv, char sign, char mode); -static void mode_print_grouped (session *sess, char *nick, mode_run *mr); +static void mode_print_grouped (session *sess, char *nick, mode_run *mr, + const message_tags_data *tags_data); static int mode_chanmode_type (server * serv, char mode); @@ -387,7 +390,8 @@ mode_cat (char *str, char *addition) static void handle_single_mode (mode_run *mr, char sign, char mode, char *nick, - char *chan, char *arg, int quiet, int is_324) + char *chan, char *arg, int quiet, int is_324, + const message_tags_data *tags_data) { session *sess; server *serv = mr->serv; @@ -440,14 +444,16 @@ handle_single_mode (mode_run *mr, char sign, char mode, char *nick, fe_update_channel_key (sess); fe_update_mode_buttons (sess, mode, sign); if (!quiet) - EMIT_SIGNAL (XP_TE_CHANSETKEY, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANSETKEY, sess, nick, arg, NULL, + NULL, 0, tags_data->timestamp); return; case 'l': sess->limit = atoi (arg); fe_update_channel_limit (sess); fe_update_mode_buttons (sess, mode, sign); if (!quiet) - EMIT_SIGNAL (XP_TE_CHANSETLIMIT, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANSETLIMIT, sess, nick, arg, NULL, + NULL, 0, tags_data->timestamp); return; case 'o': if (!quiet) @@ -455,7 +461,8 @@ handle_single_mode (mode_run *mr, char sign, char mode, char *nick, return; case 'h': if (!quiet) - EMIT_SIGNAL (XP_TE_CHANHOP, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANHOP, sess, nick, arg, NULL, NULL, + 0, tags_data->timestamp); return; case 'v': if (!quiet) @@ -463,21 +470,25 @@ handle_single_mode (mode_run *mr, char sign, char mode, char *nick, return; case 'b': if (!quiet) - EMIT_SIGNAL (XP_TE_CHANBAN, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANBAN, sess, nick, arg, NULL, NULL, + 0, tags_data->timestamp); return; case 'e': if (!quiet) - EMIT_SIGNAL (XP_TE_CHANEXEMPT, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANEXEMPT, sess, nick, arg, NULL, + NULL, 0, tags_data->timestamp); return; case 'I': if (!quiet) - EMIT_SIGNAL (XP_TE_CHANINVITE, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANINVITE, sess, nick, arg, NULL, NULL, + 0, tags_data->timestamp); return; case 'q': if (!supportsq) break; /* +q is owner on this server */ if (!quiet) - EMIT_SIGNAL (XP_TE_CHANQUIET, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANQUIET, sess, nick, arg, NULL, NULL, 0, + tags_data->timestamp); return; } break; @@ -489,14 +500,16 @@ handle_single_mode (mode_run *mr, char sign, char mode, char *nick, fe_update_channel_key (sess); fe_update_mode_buttons (sess, mode, sign); if (!quiet) - EMIT_SIGNAL (XP_TE_CHANRMKEY, sess, nick, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANRMKEY, sess, nick, NULL, NULL, + NULL, 0, tags_data->timestamp); return; case 'l': sess->limit = 0; fe_update_channel_limit (sess); fe_update_mode_buttons (sess, mode, sign); if (!quiet) - EMIT_SIGNAL (XP_TE_CHANRMLIMIT, sess, nick, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANRMLIMIT, sess, nick, NULL, NULL, + NULL, 0, tags_data->timestamp); return; case 'o': if (!quiet) @@ -504,7 +517,8 @@ handle_single_mode (mode_run *mr, char sign, char mode, char *nick, return; case 'h': if (!quiet) - EMIT_SIGNAL (XP_TE_CHANDEHOP, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANDEHOP, sess, nick, arg, NULL, + NULL, 0, tags_data->timestamp); return; case 'v': if (!quiet) @@ -512,21 +526,25 @@ handle_single_mode (mode_run *mr, char sign, char mode, char *nick, return; case 'b': if (!quiet) - EMIT_SIGNAL (XP_TE_CHANUNBAN, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANUNBAN, sess, nick, arg, NULL, NULL, + 0, tags_data->timestamp); return; case 'e': if (!quiet) - EMIT_SIGNAL (XP_TE_CHANRMEXEMPT, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANRMEXEMPT, sess, nick, arg, NULL, + NULL, 0, tags_data->timestamp); return; case 'I': if (!quiet) - EMIT_SIGNAL (XP_TE_CHANRMINVITE, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANRMINVITE, sess, nick, arg, NULL, + NULL, 0, tags_data->timestamp); return; case 'q': if (!supportsq) break; /* -q is owner on this server */ if (!quiet) - EMIT_SIGNAL (XP_TE_CHANUNQUIET, sess, nick, arg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANUNQUIET, sess, nick, arg, NULL, + NULL, 0, tags_data->timestamp); return; } } @@ -544,10 +562,12 @@ handle_single_mode (mode_run *mr, char sign, char mode, char *nick, { char *buf = malloc (strlen (chan) + strlen (arg) + 2); sprintf (buf, "%s %s", chan, arg); - EMIT_SIGNAL (XP_TE_CHANMODEGEN, sess, nick, outbuf, outbuf + 2, buf, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMODEGEN, sess, nick, outbuf, + outbuf + 2, buf, 0, tags_data->timestamp); free (buf); } else - EMIT_SIGNAL (XP_TE_CHANMODEGEN, sess, nick, outbuf, outbuf + 2, chan, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMODEGEN, sess, nick, outbuf, + outbuf + 2, chan, 0, tags_data->timestamp); } } @@ -607,33 +627,38 @@ mode_chanmode_type (server * serv, char mode) } static void -mode_print_grouped (session *sess, char *nick, mode_run *mr) +mode_print_grouped (session *sess, char *nick, mode_run *mr, + const message_tags_data *tags_data) { /* print all the grouped Op/Deops */ if (mr->op) { - EMIT_SIGNAL (XP_TE_CHANOP, sess, nick, mr->op, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANOP, sess, nick, mr->op, NULL, NULL, 0, + tags_data->timestamp); free (mr->op); mr->op = NULL; } if (mr->deop) { - EMIT_SIGNAL (XP_TE_CHANDEOP, sess, nick, mr->deop, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANDEOP, sess, nick, mr->deop, NULL, NULL, + 0, tags_data->timestamp); free (mr->deop); mr->deop = NULL; } if (mr->voice) { - EMIT_SIGNAL (XP_TE_CHANVOICE, sess, nick, mr->voice, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANVOICE, sess, nick, mr->voice, NULL, NULL, + 0, tags_data->timestamp); free (mr->voice); mr->voice = NULL; } if (mr->devoice) { - EMIT_SIGNAL (XP_TE_CHANDEVOICE, sess, nick, mr->devoice, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANDEVOICE, sess, nick, mr->devoice, NULL, + NULL, 0, tags_data->timestamp); free (mr->devoice); mr->devoice = NULL; } @@ -644,7 +669,7 @@ mode_print_grouped (session *sess, char *nick, mode_run *mr) void handle_mode (server * serv, char *word[], char *word_eol[], - char *nick, int numeric_324) + char *nick, int numeric_324, const message_tags_data *tags_data) { session *sess; char *chan; @@ -687,7 +712,8 @@ handle_mode (server * serv, char *word[], char *word_eol[], word_eol[offset][len] = 0; if (prefs.hex_irc_raw_modes && !numeric_324) - EMIT_SIGNAL (XP_TE_RAWMODES, sess, nick, word_eol[offset], 0, 0, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_RAWMODES, sess, nick, word_eol[offset], 0, 0, 0, + tags_data->timestamp); if (numeric_324 && !using_front_tab) { @@ -731,7 +757,7 @@ handle_mode (server * serv, char *word[], char *word_eol[], case '-': case '+': /* print all the grouped Op/Deops */ - mode_print_grouped (sess, nick, &mr); + mode_print_grouped (sess, nick, &mr, tags_data); sign = *modes; break; default: @@ -743,7 +769,7 @@ handle_mode (server * serv, char *word[], char *word_eol[], } handle_single_mode (&mr, sign, *modes, nick, chan, argstr, numeric_324 || prefs.hex_irc_raw_modes, - numeric_324); + numeric_324, tags_data); } modes++; @@ -754,7 +780,7 @@ handle_mode (server * serv, char *word[], char *word_eol[], fe_set_title (sess); /* print all the grouped Op/Deops */ - mode_print_grouped (sess, nick, &mr); + mode_print_grouped (sess, nick, &mr, tags_data); } /* handle the 005 numeric */ |