From 94186f7888d5a730e52e433a21698154dfcc4e2e Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Sat, 22 Jun 2013 00:13:36 +0100 Subject: First step towards message tags extension support (see http://ircv3.atheme.org/specification/message-tags-3.2). In particular this commit implements a (very) dummy implementation sketch of the server-time extension (see http://ircv3.atheme.org/specification/message-tags-3.2 and #499). --- src/common/outbound.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/common/outbound.c') diff --git a/src/common/outbound.c b/src/common/outbound.c index 120bb241..d02c88a5 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2755,7 +2755,7 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) while ((split_text = split_up_text (sess, msg + offset, cmd_length, split_text))) { inbound_chanmsg (newsess->server, NULL, newsess->channel, - newsess->server->nick, split_text, TRUE, FALSE); + newsess->server->nick, split_text, TRUE, FALSE, 0); if (*split_text) offset += strlen(split_text); @@ -2763,7 +2763,7 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) g_free(split_text); } inbound_chanmsg (newsess->server, NULL, newsess->channel, - newsess->server->nick, msg + offset, TRUE, FALSE); + newsess->server->nick, msg + offset, TRUE, FALSE, 0); } else { @@ -3700,7 +3700,7 @@ cmd_wallchan (struct session *sess, char *tbuf, char *word[], if (sess->type == SESS_CHANNEL) { inbound_chanmsg (sess->server, NULL, sess->channel, - sess->server->nick, word_eol[2], TRUE, FALSE); + sess->server->nick, word_eol[2], TRUE, FALSE, 0); sess->server->p_message (sess->server, sess->channel, word_eol[2]); } list = list->next; @@ -4396,7 +4396,7 @@ handle_say (session *sess, char *text, int check_spch) if (dcc) { inbound_chanmsg (sess->server, NULL, sess->channel, - sess->server->nick, text, TRUE, FALSE); + sess->server->nick, text, TRUE, FALSE, 0); set_topic (sess, net_ip (dcc->addr), net_ip (dcc->addr)); goto xit; } @@ -4411,7 +4411,7 @@ handle_say (session *sess, char *text, int check_spch) while ((split_text = split_up_text (sess, text + offset, cmd_length, split_text))) { inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick, - split_text, TRUE, FALSE); + split_text, TRUE, FALSE, 0); sess->server->p_message (sess->server, sess->channel, split_text); if (*split_text) @@ -4421,7 +4421,7 @@ handle_say (session *sess, char *text, int check_spch) } inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick, - text + offset, TRUE, FALSE); + text + offset, TRUE, FALSE, 0); sess->server->p_message (sess->server, sess->channel, text + offset); } else { -- cgit 1.4.1 From 6a0240aa181656dff00e664fd8cc60931b618a50 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Sat, 22 Jun 2013 15:32:50 +0100 Subject: server-time supported in most named messages. --- src/common/dcc.c | 4 +- src/common/inbound.c | 129 +++++++++++++++++++++++++++++++------------------ src/common/inbound.h | 54 ++++++++++++++------- src/common/modes.c | 84 +++++++++++++++++++++----------- src/common/modes.h | 5 +- src/common/outbound.c | 6 ++- src/common/proto-irc.c | 99 ++++++++++++++++++++++--------------- 7 files changed, 246 insertions(+), 135 deletions(-) (limited to 'src/common/outbound.c') diff --git a/src/common/dcc.c b/src/common/dcc.c index 4980cabc..3eeb81bd 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -509,6 +509,8 @@ dcc_chat_line (struct DCC *dcc, char *line) int len; gsize utf_len; char portbuf[32]; + message_tags_data tags_data_ = MESSAGE_TAGS_DATA_INIT; /* TODO: this will be an argument */ + const message_tags_data *tags_data = &tags_data_; len = strlen (line); if (dcc->serv->using_cp1255) @@ -579,7 +581,7 @@ dcc_chat_line (struct DCC *dcc, char *line) inbound_action (sess, dcc->serv->nick, dcc->nick, "", line + 8, FALSE, FALSE); } else { - inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE); + inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, tags_data); } if (utf) g_free (utf); diff --git a/src/common/inbound.c b/src/common/inbound.c index 55a4005c..54c59ae4 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -152,14 +152,13 @@ inbound_make_idtext (server *serv, char *idtext, int max, int id) } void -inbound_privmsg (server *serv, char *from, char *ip, char *text, int id) +inbound_privmsg (server *serv, char *from, char *ip, char *text, int id, + const message_tags_data *tags_data) { session *sess; struct User *user; char idtext[64]; gboolean nodiag = FALSE; - message_tags_data tags_data_ = MESSAGE_TAGS_DATA_INIT; /* TODO: this will be an argument */ - const message_tags_data const *tags_data = &tags_data_; sess = find_dialog (serv, from); @@ -210,9 +209,11 @@ inbound_privmsg (server *serv, char *from, char *ip, char *text, int id) inbound_make_idtext (serv, idtext, sizeof (idtext), id); if (sess->type == SESS_DIALOG && !nodiag) - EMIT_SIGNAL (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0, + tags_data->timestamp); else - EMIT_SIGNAL (XP_TE_PRIVMSG, sess, from, text, idtext, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_PRIVMSG, sess, from, text, idtext, NULL, 0, + tags_data->timestamp); } /* used for Alerts section. Masks can be separated by commas and spaces. */ @@ -414,7 +415,7 @@ inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int void inbound_chanmsg (server *serv, session *sess, char *chan, char *from, char *text, char fromme, int id, - const message_tags_data const *tags_data) + const message_tags_data *tags_data) { struct User *user; int hilight = FALSE; @@ -477,7 +478,8 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from, } void -inbound_newnick (server *serv, char *nick, char *newnick, int quiet) +inbound_newnick (server *serv, char *nick, char *newnick, int quiet, + const message_tags_data *tags_data) { int me = FALSE; session *sess; @@ -499,11 +501,12 @@ inbound_newnick (server *serv, char *nick, char *newnick, int quiet) if (!quiet) { if (me) - EMIT_SIGNAL (XP_TE_UCHANGENICK, sess, nick, newnick, NULL, - NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_UCHANGENICK, sess, nick, + newnick, NULL, NULL, 0, + tags_data->timestamp); else - EMIT_SIGNAL (XP_TE_CHANGENICK, sess, nick, newnick, NULL, - NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANGENICK, sess, nick, + newnick, NULL, NULL, 0, tags_data->timestamp); } } if (sess->type == SESS_DIALOG && !serv->p_cmp (sess->channel, nick)) @@ -561,7 +564,8 @@ find_session_from_waitchannel (char *chan, struct server *serv) } void -inbound_ujoin (server *serv, char *chan, char *nick, char *ip) +inbound_ujoin (server *serv, char *chan, char *nick, char *ip, + const message_tags_data *tags_data) { session *sess; @@ -599,7 +603,8 @@ inbound_ujoin (server *serv, char *chan, char *nick, char *ip) /* sends a MODE */ serv->p_join_info (sess->server, chan); - EMIT_SIGNAL (XP_TE_UJOIN, sess, nick, chan, ip, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_UJOIN, sess, nick, chan, ip, NULL, 0, + tags_data->timestamp); if (prefs.hex_irc_who_join) { @@ -610,12 +615,14 @@ inbound_ujoin (server *serv, char *chan, char *nick, char *ip) } void -inbound_ukick (server *serv, char *chan, char *kicker, char *reason) +inbound_ukick (server *serv, char *chan, char *kicker, char *reason, + const message_tags_data *tags_data) { session *sess = find_channel (serv, chan); if (sess) { - EMIT_SIGNAL (XP_TE_UKICK, sess, serv->nick, chan, kicker, reason, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_UKICK, sess, serv->nick, chan, kicker, + reason, 0, tags_data->timestamp); clear_channel (sess); if (prefs.hex_irc_auto_rejoin) { @@ -626,16 +633,18 @@ inbound_ukick (server *serv, char *chan, char *kicker, char *reason) } void -inbound_upart (server *serv, char *chan, char *ip, char *reason) +inbound_upart (server *serv, char *chan, char *ip, char *reason, + const message_tags_data *tags_data) { session *sess = find_channel (serv, chan); if (sess) { if (*reason) - EMIT_SIGNAL (XP_TE_UPARTREASON, sess, serv->nick, ip, chan, reason, - 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_UPARTREASON, sess, serv->nick, ip, chan, + reason, 0, tags_data->timestamp); else - EMIT_SIGNAL (XP_TE_UPART, sess, serv->nick, ip, chan, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_UPART, sess, serv->nick, ip, chan, NULL, + 0, tags_data->timestamp); clear_channel (sess); } } @@ -704,7 +713,8 @@ inbound_topic (server *serv, char *chan, char *topic_text) } void -inbound_topicnew (server *serv, char *nick, char *chan, char *topic) +inbound_topicnew (server *serv, char *nick, char *chan, char *topic, + const message_tags_data *tags_data) { session *sess; char *stripped_topic; @@ -712,7 +722,8 @@ inbound_topicnew (server *serv, char *nick, char *chan, char *topic) sess = find_channel (serv, chan); if (sess) { - EMIT_SIGNAL (XP_TE_NEWTOPIC, sess, nick, topic, chan, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NEWTOPIC, sess, nick, topic, chan, NULL, 0, + tags_data->timestamp); stripped_topic = strip_color (topic, -1, STRIP_ALL); set_topic (sess, topic, stripped_topic); g_free (stripped_topic); @@ -720,37 +731,44 @@ inbound_topicnew (server *serv, char *nick, char *chan, char *topic) } void -inbound_join (server *serv, char *chan, char *user, char *ip, char *account, char *realname) +inbound_join (server *serv, char *chan, char *user, char *ip, char *account, + char *realname, const message_tags_data *tags_data) { session *sess = find_channel (serv, chan); if (sess) { - EMIT_SIGNAL (XP_TE_JOIN, sess, user, chan, ip, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_JOIN, sess, user, chan, ip, NULL, 0, + tags_data->timestamp); userlist_add (sess, user, ip, account, realname); } } void -inbound_kick (server *serv, char *chan, char *user, char *kicker, char *reason) +inbound_kick (server *serv, char *chan, char *user, char *kicker, char *reason, + const message_tags_data *tags_data) { session *sess = find_channel (serv, chan); if (sess) { - EMIT_SIGNAL (XP_TE_KICK, sess, kicker, user, chan, reason, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_KICK, sess, kicker, user, chan, reason, 0, + tags_data->timestamp); userlist_remove (sess, user); } } void -inbound_part (server *serv, char *chan, char *user, char *ip, char *reason) +inbound_part (server *serv, char *chan, char *user, char *ip, char *reason, + const message_tags_data *tags_data) { session *sess = find_channel (serv, chan); if (sess) { if (*reason) - EMIT_SIGNAL (XP_TE_PARTREASON, sess, user, ip, chan, reason, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_PARTREASON, sess, user, ip, chan, reason, + 0, tags_data->timestamp); else - EMIT_SIGNAL (XP_TE_PART, sess, user, ip, chan, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_PART, sess, user, ip, chan, NULL, 0, + tags_data->timestamp); userlist_remove (sess, user); } } @@ -769,7 +787,8 @@ inbound_topictime (server *serv, char *chan, char *nick, time_t stamp) } void -inbound_quit (server *serv, char *nick, char *ip, char *reason) +inbound_quit (server *serv, char *nick, char *ip, char *reason, + const message_tags_data *tags_data) { GSList *list = sess_list; session *sess; @@ -785,11 +804,13 @@ inbound_quit (server *serv, char *nick, char *ip, char *reason) was_on_front_session = TRUE; if ((user = userlist_find (sess, nick))) { - EMIT_SIGNAL (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0, + tags_data->timestamp); userlist_remove_user (sess, user); } else if (sess->type == SESS_DIALOG && !serv->p_cmp (sess->channel, nick)) { - EMIT_SIGNAL (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0, + tags_data->timestamp); } } list = list->next; @@ -799,7 +820,8 @@ inbound_quit (server *serv, char *nick, char *ip, char *reason) } void -inbound_account (server *serv, char *nick, char *account) +inbound_account (server *serv, char *nick, char *account, + const message_tags_data *tags_data) { session *sess = NULL; GSList *list; @@ -815,7 +837,8 @@ inbound_account (server *serv, char *nick, char *account) } void -inbound_ping_reply (session *sess, char *timestring, char *from) +inbound_ping_reply (session *sess, char *timestring, char *from, + const message_tags_data *tags_data) { unsigned long tim, nowtim, dif; int lag = 0; @@ -846,11 +869,13 @@ inbound_ping_reply (session *sess, char *timestring, char *from) if (sess->server->lag_sent) sess->server->lag_sent = 0; else - EMIT_SIGNAL (XP_TE_PINGREP, sess, from, "?", NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_PINGREP, sess, from, "?", NULL, NULL, 0, + tags_data->timestamp); } else { snprintf (outbuf, sizeof (outbuf), "%ld.%ld%ld", dif / 1000000, (dif / 100000) % 10, dif % 10); - EMIT_SIGNAL (XP_TE_PINGREP, sess, from, outbuf, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_PINGREP, sess, from, outbuf, NULL, NULL, 0, + tags_data->timestamp); } } @@ -870,7 +895,8 @@ find_session_from_type (int type, server *serv) } void -inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id) +inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id, + const message_tags_data *tags_data) { char *po,*ptr=to; session *sess = 0; @@ -961,7 +987,7 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id) msg++; if (!strncmp (msg, "PING", 4)) { - inbound_ping_reply (sess, msg + 5, nick); + inbound_ping_reply (sess, msg + 5, nick, tags_data); return; } } @@ -970,15 +996,19 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id) po[0] = 0; if (server_notice) - EMIT_SIGNAL (XP_TE_SERVNOTICE, sess, msg, nick, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVNOTICE, sess, msg, nick, NULL, NULL, 0, + tags_data->timestamp); else if (ptr) - EMIT_SIGNAL (XP_TE_CHANNOTICE, sess, nick, to, msg, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANNOTICE, sess, nick, to, msg, NULL, 0, + tags_data->timestamp); else - EMIT_SIGNAL (XP_TE_NOTICE, sess, nick, msg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTICE, sess, nick, msg, NULL, NULL, 0, + tags_data->timestamp); } void -inbound_away (server *serv, char *nick, char *msg) +inbound_away (server *serv, char *nick, char *msg, + const message_tags_data *tags_data) { struct away_msg *away = server_away_find_message (serv, nick); session *sess = NULL; @@ -1005,7 +1035,8 @@ inbound_away (server *serv, char *nick, char *msg) /* possibly hide the output */ if (!serv->inside_whois || !serv->skip_next_whois) - EMIT_SIGNAL (XP_TE_WHOIS5, sess, nick, msg, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS5, sess, nick, msg, NULL, NULL, 0, + tags_data->timestamp); list = sess_list; while (list) @@ -1018,7 +1049,8 @@ inbound_away (server *serv, char *nick, char *msg) } void -inbound_away_notify (server *serv, char *nick, char *reason) +inbound_away_notify (server *serv, char *nick, char *reason, + const message_tags_data *tags_data) { session *sess = NULL; GSList *list; @@ -1033,9 +1065,11 @@ inbound_away_notify (server *serv, char *nick, char *reason) if (sess == serv->front_session && notify_is_in_list (serv, nick)) { if (reason) - EMIT_SIGNAL (XP_TE_NOTIFYAWAY, sess, nick, reason, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTIFYAWAY, sess, nick, reason, NULL, + NULL, 0, tags_data->timestamp); else - EMIT_SIGNAL (XP_TE_NOTIFYBACK, sess, nick, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTIFYBACK, sess, nick, NULL, NULL, + NULL, 0, tags_data->timestamp); } } list = list->next; @@ -1234,9 +1268,10 @@ set_default_modes (server *serv) } void -inbound_login_start (session *sess, char *nick, char *servname) +inbound_login_start (session *sess, char *nick, char *servname, + const message_tags_data *tags_data) { - inbound_newnick (sess->server, sess->server->nick, nick, TRUE); + inbound_newnick (sess->server, sess->server->nick, nick, TRUE, tags_data); server_set_name (sess->server, servname); if (sess->type == SESS_SERVER) log_open_or_close (sess); diff --git a/src/common/inbound.h b/src/common/inbound.h index 41a927a2..19820e78 100644 --- a/src/common/inbound.h +++ b/src/common/inbound.h @@ -25,36 +25,54 @@ void inbound_next_nick (session *sess, char *nick, int error); void inbound_uback (server *serv); void inbound_uaway (server *serv); -void inbound_account (server *serv, char *nick, char *account); -void inbound_part (server *serv, char *chan, char *user, char *ip, char *reason); -void inbound_upart (server *serv, char *chan, char *ip, char *reason); -void inbound_ukick (server *serv, char *chan, char *kicker, char *reason); -void inbound_kick (server *serv, char *chan, char *user, char *kicker, char *reason); -void inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id); -void inbound_quit (server *serv, char *nick, char *ip, char *reason); -void inbound_topicnew (server *serv, char *nick, char *chan, char *topic); -void inbound_join (server *serv, char *chan, char *user, char *ip, char *account, char *realname); -void inbound_ujoin (server *serv, char *chan, char *nick, char *ip); +void inbound_account (server *serv, char *nick, char *account, + const message_tags_data *tags_data); +void inbound_part (server *serv, char *chan, char *user, char *ip, char *reason, + const message_tags_data *tags_data); +void inbound_upart (server *serv, char *chan, char *ip, char *reason, + const message_tags_data *tags_data); +void inbound_ukick (server *serv, char *chan, char *kicker, char *reason, + const message_tags_data *tags_data); +void inbound_kick (server *serv, char *chan, char *user, char *kicker, + char *reason, const message_tags_data *tags_data); +void inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, + int id, const message_tags_data *tags_data); +void inbound_quit (server *serv, char *nick, char *ip, char *reason, + const message_tags_data *tags_data); +void inbound_topicnew (server *serv, char *nick, char *chan, char *topic, + const message_tags_data *tags_data); +void inbound_join (server *serv, char *chan, char *user, char *ip, + char *account, char *realname, + const message_tags_data *tags_data); +void inbound_ujoin (server *serv, char *chan, char *nick, char *ip, + const message_tags_data *tags_data); void inbound_topictime (server *serv, char *chan, char *nick, time_t stamp); void inbound_topic (server *serv, char *chan, char *topic_text); void inbound_user_info_start (session *sess, char *nick); void inbound_user_info (session *sess, char *chan, char *user, char *host, char *servname, char *nick, char *realname, char *account, unsigned int away); void inbound_foundip (session *sess, char *ip); int inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *banner, int is_exemption); -void inbound_ping_reply (session *sess, char *timestring, char *from); +void inbound_ping_reply (session *sess, char *timestring, char *from, + const message_tags_data *tags_data); void inbound_nameslist (server *serv, char *chan, char *names); int inbound_nameslist_end (server *serv, char *chan); -void inbound_away (server *serv, char *nick, char *msg); -void inbound_away_notify (server *serv, char *nick, char *reason); -void inbound_login_start (session *sess, char *nick, char *servname); +void inbound_away (server *serv, char *nick, char *msg, + const message_tags_data *tags_data); +void inbound_away_notify (server *serv, char *nick, char *reason, + const message_tags_data *tags_data); +void inbound_login_start (session *sess, char *nick, char *servname, + const message_tags_data *tags_data); void inbound_login_end (session *sess, char *text); -void inbound_chanmsg (server *serv, session *sess, char *chan, char *from, char *text, char fromme, int id, - const message_tags_data const *tags_data); +void inbound_chanmsg (server *serv, session *sess, char *chan, char *from, + char *text, char fromme, int id, + const message_tags_data *tags_data); void clear_channel (session *sess); void set_topic (session *sess, char *topic, char *stripped_topic); -void inbound_privmsg (server *serv, char *from, char *ip, char *text, int id); +void inbound_privmsg (server *serv, char *from, char *ip, char *text, int id, + const message_tags_data *tags_data); void inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int fromme, int id); -void inbound_newnick (server *serv, char *nick, char *newnick, int quiet); +void inbound_newnick (server *serv, char *nick, char *newnick, int quiet, + const message_tags_data *tags_data); void do_dns (session *sess, char *nick, char *host); void inbound_identified (server *serv); gboolean alert_match_word (char *word, char *masks); 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 */ diff --git a/src/common/modes.h b/src/common/modes.h index e55ec911..c3256cb7 100644 --- a/src/common/modes.h +++ b/src/common/modes.h @@ -17,6 +17,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "proto-irc.h" + #ifndef HEXCHAT_MODES_H #define HEXCHAT_MODES_H @@ -25,7 +27,8 @@ char get_nick_prefix (server *serv, unsigned int access); unsigned int nick_access (server *serv, char *nick, int *modechars); int mode_access (server *serv, char mode, char *prefix); void inbound_005 (server *serv, char *word[]); -void handle_mode (server *serv, char *word[], char *word_eol[], char *nick, int numeric_324); +void handle_mode (server *serv, char *word[], char *word_eol[], char *nick, + int numeric_324, const message_tags_data *tags_data); void send_channel_modes (session *sess, char *tbuf, char *word[], int start, int end, char sign, char mode, int modes_per_line); #endif diff --git a/src/common/outbound.c b/src/common/outbound.c index d02c88a5..c32f81b4 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2825,7 +2825,11 @@ cmd_nick (struct session *sess, char *tbuf, char *word[], char *word_eol[]) if (sess->server->connected) sess->server->p_change_nick (sess->server, nick); else - inbound_newnick (sess->server, sess->server->nick, nick, TRUE); + { + message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; + inbound_newnick (sess->server, sess->server->nick, nick, TRUE, + &no_tags); + } return TRUE; } return FALSE; diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 017b9674..4b8c755c 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -454,7 +454,8 @@ channel_date (session *sess, char *chan, char *timestr) static void process_numeric (session * sess, int n, - char *word[], char *word_eol[], char *text) + char *word[], char *word_eol[], char *text, + const message_tags_data *tags_data) { server *serv = sess->server; /* show whois is the server tab */ @@ -469,7 +470,7 @@ process_numeric (session * sess, int n, switch (n) { case 1: - inbound_login_start (sess, word[3], word[1]); + inbound_login_start (sess, word[3], word[1], tags_data); /* if network is PTnet then you must get your IP address from "001" server message */ if ((strncmp(word[7], "PTnet", 5) == 0) && @@ -514,7 +515,8 @@ process_numeric (session * sess, int n, case 301: inbound_away (serv, word[4], - (word_eol[5][0] == ':') ? word_eol[5] + 1 : word_eol[5]); + (word_eol[5][0] == ':') ? word_eol[5] + 1 : word_eol[5], + tags_data); break; case 302: @@ -660,7 +662,7 @@ process_numeric (session * sess, int n, fe_update_mode_buttons (sess, 'm', '-'); fe_update_mode_buttons (sess, 'l', '-'); fe_update_mode_buttons (sess, 'k', '-'); - handle_mode (serv, word, word_eol, "", TRUE); + handle_mode (serv, word, word_eol, "", TRUE, tags_data); break; case 329: @@ -961,7 +963,7 @@ process_numeric (session * sess, int n, static void process_named_msg (session *sess, char *type, char *word[], char *word_eol[], - const message_tags_data const *tags_data) + const message_tags_data *tags_data) { server *serv = sess->server; char ip[128], nick[NICKLEN]; @@ -999,9 +1001,10 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], if (*chan == ':') chan++; if (!serv->p_cmp (nick, serv->nick)) - inbound_ujoin (serv, chan, nick, ip); + inbound_ujoin (serv, chan, nick, ip, tags_data); else - inbound_join (serv, chan, nick, ip, account, realname); + inbound_join (serv, chan, nick, ip, account, realname, + tags_data); } return; @@ -1014,24 +1017,26 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], if (*reason == ':') reason++; if (!strcmp (kicked, serv->nick)) - inbound_ukick (serv, word[3], nick, reason); + inbound_ukick (serv, word[3], nick, reason, tags_data); else - inbound_kick (serv, word[3], kicked, nick, reason); + inbound_kick (serv, word[3], kicked, nick, reason, tags_data); } } return; case WORDL('K','I','L','L'): - EMIT_SIGNAL (XP_TE_KILL, sess, nick, word_eol[5], NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_KILL, sess, nick, word_eol[5], NULL, NULL, + 0, tags_data->timestamp); return; case WORDL('M','O','D','E'): - handle_mode (serv, word, word_eol, nick, FALSE); /* modes.c */ + handle_mode (serv, word, word_eol, nick, FALSE, tags_data); /* modes.c */ return; case WORDL('N','I','C','K'): - inbound_newnick (serv, nick, (word_eol[3][0] == ':') - ? word_eol[3] + 1 : word_eol[3], FALSE); + inbound_newnick (serv, nick, + (word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3], + FALSE, tags_data); return; case WORDL('P','A','R','T'): @@ -1044,25 +1049,28 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], if (*reason == ':') reason++; if (!strcmp (nick, serv->nick)) - inbound_upart (serv, chan, ip, reason); + inbound_upart (serv, chan, ip, reason, tags_data); else - inbound_part (serv, chan, nick, ip, reason); + inbound_part (serv, chan, nick, ip, reason, tags_data); } return; case WORDL('P','O','N','G'): inbound_ping_reply (serv->server_session, - (word[4][0] == ':') ? word[4] + 1 : word[4], word[3]); + (word[4][0] == ':') ? word[4] + 1 : word[4], + word[3], tags_data); return; case WORDL('Q','U','I','T'): inbound_quit (serv, nick, ip, - (word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3]); + (word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3], + tags_data); return; case WORDL('A','W','A','Y'): inbound_away_notify (serv, nick, - (word_eol[3][0] == ':') ? word_eol[3] + 1 : NULL); + (word_eol[3][0] == ':') ? word_eol[3] + 1 : NULL, + tags_data); return; } @@ -1079,7 +1087,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], { case WORDL('A','C','C','O'): - inbound_account (serv, nick, word[3]); + inbound_account (serv, nick, word[3], tags_data); return; case WORDL('I','N','V','I'): @@ -1087,11 +1095,13 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], return; if (word[4][0] == ':') - EMIT_SIGNAL (XP_TE_INVITED, sess, word[4] + 1, nick, - serv->servername, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_INVITED, sess, word[4] + 1, nick, + serv->servername, NULL, 0, + tags_data->timestamp); else - EMIT_SIGNAL (XP_TE_INVITED, sess, word[4], nick, - serv->servername, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_INVITED, sess, word[4], nick, + serv->servername, NULL, 0, + tags_data->timestamp); return; @@ -1131,7 +1141,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], } if (!ignore_check (word[1], IG_NOTI)) - inbound_notice (serv, word[3], nick, text, ip, id); + inbound_notice (serv, word[3], nick, text, ip, id, tags_data); } return; @@ -1180,7 +1190,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], { if (ignore_check (word[1], IG_PRIV)) return; - inbound_privmsg (serv, nick, ip, text, id); + inbound_privmsg (serv, nick, ip, text, id, tags_data); } } } @@ -1189,14 +1199,16 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], case WORDL('T','O','P','I'): inbound_topicnew (serv, nick, word[3], - (word_eol[4][0] == ':') ? word_eol[4] + 1 : word_eol[4]); + (word_eol[4][0] == ':') ? word_eol[4] + 1 : word_eol[4], + tags_data); return; case WORDL('W','A','L','L'): text = word_eol[3]; if (*text == ':') text++; - EMIT_SIGNAL (XP_TE_WALLOPS, sess, nick, text, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WALLOPS, sess, nick, text, NULL, NULL, 0, + tags_data->timestamp); return; } } @@ -1215,7 +1227,10 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], case WORDL('C','A','P','\0'): if (strncasecmp (word[4], "ACK", 3) == 0) { - EMIT_SIGNAL (XP_TE_CAPACK, sess->server->server_session, word[1], word[5][0]==':' ? ++word_eol[5] : word_eol[5], NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPACK, sess->server->server_session, + word[1], word[5][0]==':' ? ++word_eol[5] : word_eol[5], + NULL, NULL, 0, + tags_data->timestamp); if (strstr (word_eol[5], "identify-msg") != 0) { @@ -1245,7 +1260,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], if (strstr (word_eol[5], "sasl") != 0) { serv->have_sasl = TRUE; - EMIT_SIGNAL + EMIT_SIGNAL_TIMESTAMP ( XP_TE_SASLAUTH, serv->server_session, @@ -1253,7 +1268,8 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], NULL, NULL, NULL, - 0 + 0, + tags_data->timestamp ); tcp_send_len (serv, "AUTHENTICATE PLAIN\r\n", 20); @@ -1268,7 +1284,10 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], } else if (strncasecmp (word[4], "LS", 2) == 0) { - EMIT_SIGNAL (XP_TE_CAPLIST, serv->server_session, word[1], word[5][0]==':' ? ++word_eol[5] : word_eol[5], NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPLIST, serv->server_session, word[1], + word[5][0]==':' ? ++word_eol[5] : word_eol[5], + NULL, NULL, 0, + tags_data->timestamp); want_cap = 0; want_sasl = 0; @@ -1310,7 +1329,9 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], if (want_cap) { /* buffer + 9 = emit buffer without "CAP REQ :" */ - EMIT_SIGNAL (XP_TE_CAPREQ, sess->server->server_session, buffer + 9, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPREQ, sess->server->server_session, + buffer + 9, NULL, NULL, NULL, 0, + tags_data->timestamp); tcp_sendf (serv, "%s\r\n", buffer); } if (!want_sasl) @@ -1325,7 +1346,9 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], } else if (strncasecmp (word[4], "LIST", 4) == 0) { - EMIT_SIGNAL (XP_TE_CAPACK, sess->server->server_session, word[1], word[5][0]==':' ? ++word_eol[5] : word_eol[5], NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPACK, sess->server->server_session, + word[1], word[5][0]==':' ? ++word_eol[5] : word_eol[5], + NULL, NULL, 0, tags_data->timestamp); } return; @@ -1378,7 +1401,7 @@ process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol * See http://ircv3.atheme.org/extensions/server-time-3.2 */ static void -handle_message_tag_time (const char const *time, message_tags_data *tags_data) +handle_message_tag_time (const char *time, message_tags_data *tags_data) { /* The time format defined in the ircv3.2 specification is * YYYY-MM-DDThh:mm:ss.sssZ @@ -1430,7 +1453,7 @@ handle_message_tag_time (const char const *time, message_tags_data *tags_data) */ /* TODO: we should ignore capabilities not enabled! */ static void -handle_message_tags (const char const *tags_str, message_tags_data *tags_data) +handle_message_tags (const char *tags_str, message_tags_data *tags_data) { char **tags; int i; @@ -1528,7 +1551,7 @@ irc_inline (server *serv, char *buf, int len) if (buf[0] != ':') { - process_named_servermsg (sess, buf, word[0], word_eol); + process_named_servermsg (sess, buf, word[0], word_eol); // TODO (data tags) goto xit; } @@ -1539,10 +1562,10 @@ irc_inline (server *serv, char *buf, int len) if (*text == ':') text++; - process_numeric (sess, atoi (word[2]), word, word_eol, text); + process_numeric (sess, atoi (word[2]), word, word_eol, text, &tags_data); // TODO (data tags) } else { - process_named_msg (sess, type, word, word_eol, &tags_data); + process_named_msg (sess, type, word, word_eol, &tags_data); // TODO (data tags) } xit: -- cgit 1.4.1 From d1725e3f443f0133c113f417b6a594f79c6831e7 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Sat, 22 Jun 2013 23:48:17 +0100 Subject: server-time for all numerical messages. --- src/common/inbound.c | 75 ++++++++++++------- src/common/inbound.h | 36 ++++++--- src/common/modes.c | 2 +- src/common/modes.h | 2 +- src/common/notify.c | 42 ++++++----- src/common/notify.h | 13 +++- src/common/outbound.c | 5 +- src/common/proto-irc.c | 199 ++++++++++++++++++++++++++++--------------------- src/common/text.c | 14 ++++ src/common/text.h | 1 + src/common/userlist.c | 5 +- src/common/userlist.h | 4 +- 12 files changed, 247 insertions(+), 151 deletions(-) (limited to 'src/common/outbound.c') diff --git a/src/common/inbound.c b/src/common/inbound.c index cac37b32..a37ca31b 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -650,7 +650,8 @@ inbound_upart (server *serv, char *chan, char *ip, char *reason, } void -inbound_nameslist (server *serv, char *chan, char *names) +inbound_nameslist (server *serv, char *chan, char *names, + const message_tags_data *tags_data) { session *sess; char name[NICKLEN]; @@ -679,12 +680,12 @@ inbound_nameslist (server *serv, char *chan, char *names) case 0: name[pos] = 0; if (pos != 0) - userlist_add (sess, name, 0, NULL, NULL); + userlist_add (sess, name, 0, NULL, NULL, tags_data); return; case ' ': name[pos] = 0; pos = 0; - userlist_add (sess, name, 0, NULL, NULL); + userlist_add (sess, name, 0, NULL, NULL, tags_data); break; default: name[pos] = *names; @@ -696,7 +697,8 @@ inbound_nameslist (server *serv, char *chan, char *names) } void -inbound_topic (server *serv, char *chan, char *topic_text) +inbound_topic (server *serv, char *chan, char *topic_text, + const message_tags_data *tags_data) { session *sess = find_channel (serv, chan); char *stripped_topic; @@ -709,7 +711,8 @@ inbound_topic (server *serv, char *chan, char *topic_text) } else sess = serv->server_session; - EMIT_SIGNAL (XP_TE_TOPIC, sess, chan, topic_text, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_TOPIC, sess, chan, topic_text, NULL, NULL, 0, + tags_data->timestamp); } void @@ -739,7 +742,7 @@ inbound_join (server *serv, char *chan, char *user, char *ip, char *account, { EMIT_SIGNAL_TIMESTAMP (XP_TE_JOIN, sess, user, chan, ip, NULL, 0, tags_data->timestamp); - userlist_add (sess, user, ip, account, realname); + userlist_add (sess, user, ip, account, realname, tags_data); } } @@ -774,7 +777,8 @@ inbound_part (server *serv, char *chan, char *user, char *ip, char *reason, } void -inbound_topictime (server *serv, char *chan, char *nick, time_t stamp) +inbound_topictime (server *serv, char *chan, char *nick, time_t stamp, + const message_tags_data *tags_data) { char *tim = ctime (&stamp); session *sess = find_channel (serv, chan); @@ -783,7 +787,8 @@ inbound_topictime (server *serv, char *chan, char *nick, time_t stamp) sess = serv->server_session; tim[24] = 0; /* get rid of the \n */ - EMIT_SIGNAL (XP_TE_TOPICDATE, sess, chan, nick, tim, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_TOPICDATE, sess, chan, nick, tim, NULL, 0, + tags_data->timestamp); } void @@ -816,7 +821,7 @@ inbound_quit (server *serv, char *nick, char *ip, char *reason, list = list->next; } - notify_set_offline (serv, nick, was_on_front_session); + notify_set_offline (serv, nick, was_on_front_session, tags_data); } void @@ -1077,7 +1082,8 @@ inbound_away_notify (server *serv, char *nick, char *reason, } int -inbound_nameslist_end (server *serv, char *chan) +inbound_nameslist_end (server *serv, char *chan, + const message_tags_data *tags_data) { session *sess; GSList *list; @@ -1186,7 +1192,8 @@ check_autojoin_channels (server *serv) } void -inbound_next_nick (session *sess, char *nick, int error) +inbound_next_nick (session *sess, char *nick, int error, + const message_tags_data *tags_data) { char *newnick; server *serv = sess->server; @@ -1207,11 +1214,13 @@ inbound_next_nick (session *sess, char *nick, int error) serv->p_change_nick (serv, newnick); if (error) { - EMIT_SIGNAL (XP_TE_NICKERROR, sess, nick, newnick, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NICKERROR, sess, nick, newnick, NULL, NULL, + 0, tags_data->timestamp); } else { - EMIT_SIGNAL (XP_TE_NICKCLASH, sess, nick, newnick, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NICKCLASH, sess, nick, newnick, NULL, NULL, + 0, tags_data->timestamp); } break; @@ -1219,16 +1228,18 @@ inbound_next_nick (session *sess, char *nick, int error) serv->p_change_nick (serv, prefs.hex_irc_nick3); if (error) { - EMIT_SIGNAL (XP_TE_NICKERROR, sess, nick, prefs.hex_irc_nick3, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NICKERROR, sess, nick, prefs.hex_irc_nick3, + NULL, NULL, 0, tags_data->timestamp); } else { - EMIT_SIGNAL (XP_TE_NICKCLASH, sess, nick, prefs.hex_irc_nick3, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NICKCLASH, sess, nick, prefs.hex_irc_nick3, + NULL, NULL, 0, tags_data->timestamp); } break; default: - EMIT_SIGNAL (XP_TE_NICKFAIL, sess, NULL, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NICKFAIL, sess, NULL, NULL, NULL, NULL, 0); } } @@ -1300,7 +1311,7 @@ inbound_set_all_away_status (server *serv, char *nick, unsigned int status) } void -inbound_uaway (server *serv) +inbound_uaway (server *serv, const message_tags_data *tags_data) { serv->is_away = TRUE; serv->away_time = time (NULL); @@ -1310,7 +1321,7 @@ inbound_uaway (server *serv) } void -inbound_uback (server *serv) +inbound_uback (server *serv, const message_tags_data *tags_data) { serv->is_away = FALSE; serv->reconnect_away = FALSE; @@ -1320,7 +1331,7 @@ inbound_uback (server *serv) } void -inbound_foundip (session *sess, char *ip) +inbound_foundip (session *sess, char *ip, const message_tags_data *tags_data) { struct hostent *HostAddr; @@ -1328,14 +1339,15 @@ inbound_foundip (session *sess, char *ip) if (HostAddr) { prefs.dcc_ip = ((struct in_addr *) HostAddr->h_addr)->s_addr; - EMIT_SIGNAL (XP_TE_FOUNDIP, sess->server->server_session, - inet_ntoa (*((struct in_addr *) HostAddr->h_addr)), - NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_FOUNDIP, sess->server->server_session, + inet_ntoa (*((struct in_addr *) HostAddr->h_addr)), + NULL, NULL, NULL, 0, tags_data->timestamp); } } void -inbound_user_info_start (session *sess, char *nick) +inbound_user_info_start (session *sess, char *nick, + const message_tags_data *tags_data) { /* set away to FALSE now, 301 may turn it back on */ inbound_set_all_away_status (sess->server, nick, 0); @@ -1347,7 +1359,8 @@ inbound_user_info_start (session *sess, char *nick) void inbound_user_info (session *sess, char *chan, char *user, char *host, char *servname, char *nick, char *realname, - char *account, unsigned int away) + char *account, unsigned int away, + const message_tags_data *tags_data) { server *serv = sess->server; session *who_sess; @@ -1388,7 +1401,8 @@ inbound_user_info (session *sess, char *chan, char *user, char *host, } int -inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *banner, int rplcode) +inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, + char *banner, int rplcode, const message_tags_data *tags_data) { char *time_str = ctime (&stamp); server *serv = sess->server; @@ -1410,7 +1424,8 @@ inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *bann { nowindow: - EMIT_SIGNAL (XP_TE_BANLIST, sess, chan, mask, banner, time_str, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_BANLIST, sess, chan, mask, banner, time_str, + 0, tags_data->timestamp); return TRUE; } @@ -1447,7 +1462,7 @@ inbound_nickserv_login (server *serv) } void -inbound_login_end (session *sess, char *text) +inbound_login_end (session *sess, char *text, const message_tags_data *tags_data) { GSList *cmdlist; commandentry *cmd; @@ -1504,11 +1519,13 @@ inbound_login_end (session *sess, char *text) if (prefs.hex_irc_skip_motd && !serv->motd_skipped) { serv->motd_skipped = TRUE; - EMIT_SIGNAL (XP_TE_MOTDSKIP, serv->server_session, NULL, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_MOTDSKIP, serv->server_session, NULL, NULL, + NULL, NULL, 0, tags_data->timestamp); return; } - EMIT_SIGNAL (XP_TE_MOTD, serv->server_session, text, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_MOTD, serv->server_session, text, NULL, NULL, + NULL, 0, tags_data->timestamp); } void diff --git a/src/common/inbound.h b/src/common/inbound.h index 5525f3ff..742152ea 100644 --- a/src/common/inbound.h +++ b/src/common/inbound.h @@ -22,9 +22,10 @@ #ifndef HEXCHAT_INBOUND_H #define HEXCHAT_INBOUND_H -void inbound_next_nick (session *sess, char *nick, int error); -void inbound_uback (server *serv); -void inbound_uaway (server *serv); +void inbound_next_nick (session *sess, char *nick, int error, + const message_tags_data *tags_data); +void inbound_uback (server *serv, const message_tags_data *tags_data); +void inbound_uaway (server *serv, const message_tags_data *tags_data); void inbound_account (server *serv, char *nick, char *account, const message_tags_data *tags_data); void inbound_part (server *serv, char *chan, char *user, char *ip, char *reason, @@ -46,23 +47,34 @@ void inbound_join (server *serv, char *chan, char *user, char *ip, const message_tags_data *tags_data); void inbound_ujoin (server *serv, char *chan, char *nick, char *ip, const message_tags_data *tags_data); -void inbound_topictime (server *serv, char *chan, char *nick, time_t stamp); -void inbound_topic (server *serv, char *chan, char *topic_text); -void inbound_user_info_start (session *sess, char *nick); -void inbound_user_info (session *sess, char *chan, char *user, char *host, char *servname, char *nick, char *realname, char *account, unsigned int away); -void inbound_foundip (session *sess, char *ip); -int inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *banner, int is_exemption); +void inbound_topictime (server *serv, char *chan, char *nick, time_t stamp, + const message_tags_data *tags_data); +void inbound_topic (server *serv, char *chan, char *topic_text, + const message_tags_data *tags_data); +void inbound_user_info_start (session *sess, char *nick, + const message_tags_data *tags_data); +void inbound_user_info (session *sess, char *chan, char *user, char *host, + char *servname, char *nick, char *realname, char *account, + unsigned int away, const message_tags_data *tags_data); +void inbound_foundip (session *sess, char *ip, + const message_tags_data *tags_data); +int inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, + char *banner, int is_exemption, + const message_tags_data *tags_data); void inbound_ping_reply (session *sess, char *timestring, char *from, const message_tags_data *tags_data); -void inbound_nameslist (server *serv, char *chan, char *names); -int inbound_nameslist_end (server *serv, char *chan); +void inbound_nameslist (server *serv, char *chan, char *names, + const message_tags_data *tags_data); +int inbound_nameslist_end (server *serv, char *chan, + const message_tags_data *tags_data); void inbound_away (server *serv, char *nick, char *msg, const message_tags_data *tags_data); void inbound_away_notify (server *serv, char *nick, char *reason, const message_tags_data *tags_data); void inbound_login_start (session *sess, char *nick, char *servname, const message_tags_data *tags_data); -void inbound_login_end (session *sess, char *text); +void inbound_login_end (session *sess, char *text, + const message_tags_data *tags_data); void inbound_chanmsg (server *serv, session *sess, char *chan, char *from, char *text, char fromme, int id, const message_tags_data *tags_data); diff --git a/src/common/modes.c b/src/common/modes.c index 1aa84514..420f3e8c 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -786,7 +786,7 @@ handle_mode (server * serv, char *word[], char *word_eol[], /* handle the 005 numeric */ void -inbound_005 (server * serv, char *word[]) +inbound_005 (server * serv, char *word[], const message_tags_data *tags_data) { int w; char *pre; diff --git a/src/common/modes.h b/src/common/modes.h index c3256cb7..7e13c7df 100644 --- a/src/common/modes.h +++ b/src/common/modes.h @@ -26,7 +26,7 @@ int is_channel (server *serv, char *chan); char get_nick_prefix (server *serv, unsigned int access); unsigned int nick_access (server *serv, char *nick, int *modechars); int mode_access (server *serv, char mode, char *prefix); -void inbound_005 (server *serv, char *word[]); +void inbound_005 (server *serv, char *word[], const message_tags_data *tags_data); void handle_mode (server *serv, char *word[], char *word_eol[], char *nick, int numeric_324, const message_tags_data *tags_data); void send_channel_modes (session *sess, char *tbuf, char *word[], int start, int end, char sign, char mode, int modes_per_line); diff --git a/src/common/notify.c b/src/common/notify.c index 301bb393..96b3a097 100644 --- a/src/common/notify.c +++ b/src/common/notify.c @@ -205,7 +205,8 @@ notify_find (server *serv, char *nick) static void notify_announce_offline (server * serv, struct notify_per_server *servnot, - char *nick, int quiet) + char *nick, int quiet, + const message_tags_data *tags_data) { session *sess; @@ -214,15 +215,16 @@ notify_announce_offline (server * serv, struct notify_per_server *servnot, servnot->ison = FALSE; servnot->lastoff = time (0); if (!quiet) - EMIT_SIGNAL (XP_TE_NOTIFYOFFLINE, sess, nick, serv->servername, - server_get_network (serv, TRUE), NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTIFYOFFLINE, sess, nick, serv->servername, + server_get_network (serv, TRUE), NULL, 0, + tags_data->timestamp); fe_notify_update (nick); fe_notify_update (0); } static void notify_announce_online (server * serv, struct notify_per_server *servnot, - char *nick) + char *nick, const message_tags_data *tags_data) { session *sess; @@ -234,8 +236,9 @@ notify_announce_online (server * serv, struct notify_per_server *servnot, servnot->ison = TRUE; servnot->laston = time (0); - EMIT_SIGNAL (XP_TE_NOTIFYONLINE, sess, nick, serv->servername, - server_get_network (serv, TRUE), NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTIFYONLINE, sess, nick, serv->servername, + server_get_network (serv, TRUE), NULL, 0, + tags_data->timestamp); fe_notify_update (nick); fe_notify_update (0); @@ -254,7 +257,8 @@ notify_announce_online (server * serv, struct notify_per_server *servnot, /* handles numeric 601 */ void -notify_set_offline (server * serv, char *nick, int quiet) +notify_set_offline (server * serv, char *nick, int quiet, + const message_tags_data *tags_data) { struct notify_per_server *servnot; @@ -262,13 +266,14 @@ notify_set_offline (server * serv, char *nick, int quiet) if (!servnot) return; - notify_announce_offline (serv, servnot, nick, quiet); + notify_announce_offline (serv, servnot, nick, quiet, tags_data); } /* handles numeric 604 and 600 */ void -notify_set_online (server * serv, char *nick) +notify_set_online (server * serv, char *nick, + const message_tags_data *tags_data) { struct notify_per_server *servnot; @@ -276,7 +281,7 @@ notify_set_online (server * serv, char *nick) if (!servnot) return; - notify_announce_online (serv, servnot, nick); + notify_announce_online (serv, servnot, nick, tags_data); } static void @@ -369,7 +374,7 @@ notify_send_watches (server * serv) /* called when receiving a ISON 303 - should this func go? */ void -notify_markonline (server *serv, char *word[]) +notify_markonline (server *serv, char *word[], const message_tags_data *tags_data) { struct notify *notify; struct notify_per_server *servnot; @@ -392,7 +397,7 @@ notify_markonline (server *serv, char *word[]) if (!serv->p_cmp (notify->name, word[i])) { seen = TRUE; - notify_announce_online (serv, servnot, notify->name); + notify_announce_online (serv, servnot, notify->name, tags_data); break; } i++; @@ -406,7 +411,7 @@ notify_markonline (server *serv, char *word[]) } if (!seen && servnot->ison) { - notify_announce_offline (serv, servnot, notify->name, FALSE); + notify_announce_offline (serv, servnot, notify->name, FALSE, tags_data); } list = list->next; } @@ -467,7 +472,7 @@ notify_checklist (void) /* check ISON list */ } void -notify_showlist (struct session *sess) +notify_showlist (struct session *sess, const message_tags_data *tags_data) { char outbuf[256]; struct notify *notify; @@ -475,7 +480,8 @@ notify_showlist (struct session *sess) struct notify_per_server *servnot; int i = 0; - EMIT_SIGNAL (XP_TE_NOTIFYHEAD, sess, NULL, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTIFYHEAD, sess, NULL, NULL, NULL, NULL, 0, + tags_data->timestamp); while (list) { i++; @@ -491,9 +497,11 @@ notify_showlist (struct session *sess) if (i) { sprintf (outbuf, "%d", i); - EMIT_SIGNAL (XP_TE_NOTIFYNUMBER, sess, outbuf, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTIFYNUMBER, sess, outbuf, NULL, NULL, NULL, + 0, tags_data->timestamp); } else - EMIT_SIGNAL (XP_TE_NOTIFYEMPTY, sess, NULL, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTIFYEMPTY, sess, NULL, NULL, NULL, NULL, 0, + tags_data->timestamp); } int diff --git a/src/common/notify.h b/src/common/notify.h index 8e513d5f..4a6ffb35 100644 --- a/src/common/notify.h +++ b/src/common/notify.h @@ -17,6 +17,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "proto-irc.h" + #ifndef HEXCHAT_NOTIFY_H #define HEXCHAT_NOTIFY_H @@ -41,8 +43,10 @@ extern GSList *notify_list; extern int notify_tag; /* the WATCH stuff */ -void notify_set_online (server * serv, char *nick); -void notify_set_offline (server * serv, char *nick, int quiet); +void notify_set_online (server * serv, char *nick, + const message_tags_data *tags_data); +void notify_set_offline (server * serv, char *nick, int quiet, + const message_tags_data *tags_data); void notify_send_watches (server * serv); /* the general stuff */ @@ -51,13 +55,14 @@ int notify_deluser (char *name); void notify_cleanup (void); void notify_load (void); void notify_save (void); -void notify_showlist (session *sess); +void notify_showlist (session *sess, const message_tags_data *tags_data); gboolean notify_is_in_list (server *serv, char *name); int notify_isnotify (session *sess, char *name); struct notify_per_server *notify_find_server_entry (struct notify *notify, struct server *serv); /* the old ISON stuff - remove me? */ -void notify_markonline (server *serv, char *word[]); +void notify_markonline (server *serv, char *word[], + const message_tags_data *tags_data); int notify_checklist (void); #endif diff --git a/src/common/outbound.c b/src/common/outbound.c index c32f81b4..d3e0ff56 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2898,7 +2898,10 @@ cmd_notify (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } } } else - notify_showlist (sess); + { + message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; + notify_showlist (sess, &no_tags); + } return TRUE; } diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index d111bd22..3c9a63e5 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -444,12 +444,14 @@ irc_raw (server *serv, char *raw) static void -channel_date (session *sess, char *chan, char *timestr) +channel_date (session *sess, char *chan, char *timestr, + const message_tags_data *tags_data) { time_t timestamp = (time_t) atol (timestr); char *tim = ctime (×tamp); tim[24] = 0; /* get rid of the \n */ - EMIT_SIGNAL (XP_TE_CHANDATE, sess, chan, tim, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANDATE, sess, chan, tim, NULL, NULL, 0, + tags_data->timestamp); } static void @@ -480,7 +482,7 @@ process_numeric (session * sess, int n, { serv->use_who = FALSE; if (prefs.hex_dcc_ip_from_server) - inbound_foundip (sess, strrchr(word[10], '@')+1); + inbound_foundip (sess, strrchr(word[10], '@')+1, tags_data); } goto def; @@ -502,7 +504,7 @@ process_numeric (session * sess, int n, goto def; case 5: - inbound_005 (serv, word); + inbound_005 (serv, word, tags_data); goto def; case 263: /*Server load is temporarily too heavy */ @@ -530,7 +532,7 @@ process_numeric (session * sess, int n, { char *at = strrchr (eq + 1, '@'); if (at) - inbound_foundip (sess, at + 1); + inbound_foundip (sess, at + 1, tags_data); } } @@ -541,39 +543,42 @@ process_numeric (session * sess, int n, case 303: word[4]++; - notify_markonline (serv, word); + notify_markonline (serv, word, tags_data); break; case 305: - inbound_uback (serv); + inbound_uback (serv, tags_data); goto def; case 306: - inbound_uaway (serv); + inbound_uaway (serv, tags_data); goto def; case 312: if (!serv->skip_next_whois) - EMIT_SIGNAL (XP_TE_WHOIS3, whois_sess, word[4], word_eol[5], NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS3, whois_sess, word[4], word_eol[5], + NULL, NULL, 0, tags_data->timestamp); else - inbound_user_info (sess, NULL, NULL, NULL, word[5], word[4], NULL, NULL, 0xff); + inbound_user_info (sess, NULL, NULL, NULL, word[5], word[4], NULL, NULL, + 0xff, tags_data); break; case 311: /* WHOIS 1st line */ serv->inside_whois = 1; - inbound_user_info_start (sess, word[4]); + inbound_user_info_start (sess, word[4], tags_data); if (!serv->skip_next_whois) - EMIT_SIGNAL (XP_TE_WHOIS1, whois_sess, word[4], word[5], - word[6], word_eol[8] + 1, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS1, whois_sess, word[4], word[5], + word[6], word_eol[8] + 1, 0, tags_data->timestamp); else inbound_user_info (sess, NULL, word[5], word[6], NULL, word[4], - word_eol[8][0] == ':' ? word_eol[8] + 1 : word_eol[8], NULL, 0xff); + word_eol[8][0] == ':' ? word_eol[8] + 1 : word_eol[8], + NULL, 0xff, tags_data); break; case 314: /* WHOWAS */ - inbound_user_info_start (sess, word[4]); - EMIT_SIGNAL (XP_TE_WHOIS1, whois_sess, word[4], word[5], - word[6], word_eol[8] + 1, 0); + inbound_user_info_start (sess, word[4], tags_data); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS1, whois_sess, word[4], word[5], + word[6], word_eol[8] + 1, 0, tags_data->timestamp); break; case 317: @@ -588,22 +593,22 @@ process_numeric (session * sess, int n, "%02ld:%02ld:%02ld", idle / 3600, (idle / 60) % 60, idle % 60); if (timestamp == 0) - EMIT_SIGNAL (XP_TE_WHOIS4, whois_sess, word[4], - outbuf, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS4, whois_sess, word[4], + outbuf, NULL, NULL, 0, tags_data->timestamp); else { tim = ctime (×tamp); tim[19] = 0; /* get rid of the \n */ - EMIT_SIGNAL (XP_TE_WHOIS4T, whois_sess, word[4], - outbuf, tim, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS4T, whois_sess, word[4], + outbuf, tim, NULL, 0, tags_data->timestamp); } } break; case 318: /* END OF WHOIS */ if (!serv->skip_next_whois) - EMIT_SIGNAL (XP_TE_WHOIS6, whois_sess, word[4], NULL, - NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS6, whois_sess, word[4], NULL, + NULL, NULL, 0, tags_data->timestamp); serv->skip_next_whois = 0; serv->inside_whois = 0; break; @@ -611,20 +616,23 @@ process_numeric (session * sess, int n, case 313: case 319: if (!serv->skip_next_whois) - EMIT_SIGNAL (XP_TE_WHOIS2, whois_sess, word[4], - word_eol[5] + 1, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS2, whois_sess, word[4], + word_eol[5] + 1, NULL, NULL, 0, + tags_data->timestamp); break; case 307: /* dalnet version */ case 320: /* :is an identified user */ if (!serv->skip_next_whois) - EMIT_SIGNAL (XP_TE_WHOIS_ID, whois_sess, word[4], - word_eol[5] + 1, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS_ID, whois_sess, word[4], + word_eol[5] + 1, NULL, NULL, 0, + tags_data->timestamp); break; case 321: if (!fe_is_chanwindow (sess->server)) - EMIT_SIGNAL (XP_TE_CHANLISTHEAD, serv->server_session, NULL, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANLISTHEAD, serv->server_session, NULL, + NULL, NULL, NULL, 0, tags_data->timestamp); break; case 322: @@ -633,14 +641,16 @@ process_numeric (session * sess, int n, fe_add_chan_list (sess->server, word[4], word[5], word_eol[6] + 1); } else { - PrintTextf (serv->server_session, "%-16s %-7d %s\017\n", - word[4], atoi (word[5]), word_eol[6] + 1); + PrintTextTimeStampf (serv->server_session, tags_data->timestamp, + "%-16s %-7d %s\017\n", word[4], atoi (word[5]), + word_eol[6] + 1); } break; case 323: if (!fe_is_chanwindow (sess->server)) - EMIT_SIGNAL (XP_TE_SERVTEXT, serv->server_session, text, word[1], word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, text, + word[1], word[2], NULL, 0, tags_data->timestamp); else fe_chan_list_end (sess->server); break; @@ -652,8 +662,8 @@ process_numeric (session * sess, int n, if (sess->ignore_mode) sess->ignore_mode = FALSE; else - EMIT_SIGNAL (XP_TE_CHANMODES, sess, word[4], word_eol[5], - NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMODES, sess, word[4], word_eol[5], + NULL, NULL, 0, tags_data->timestamp); fe_update_mode_buttons (sess, 't', '-'); fe_update_mode_buttons (sess, 'n', '-'); fe_update_mode_buttons (sess, 's', '-'); @@ -672,36 +682,40 @@ process_numeric (session * sess, int n, if (sess->ignore_date) sess->ignore_date = FALSE; else - channel_date (sess, word[4], word[5]); + channel_date (sess, word[4], word[5], tags_data); } break; case 330: if (!serv->skip_next_whois) - EMIT_SIGNAL (XP_TE_WHOIS_AUTH, whois_sess, word[4], - word_eol[6] + 1, word[5], NULL, 0); - inbound_user_info (sess, NULL, NULL, NULL, NULL, word[4], NULL, word[5], 0xff); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS_AUTH, whois_sess, word[4], + word_eol[6] + 1, word[5], NULL, 0, + tags_data->timestamp); + inbound_user_info (sess, NULL, NULL, NULL, NULL, word[4], NULL, word[5], + 0xff, tags_data); break; case 332: inbound_topic (serv, word[4], - (word_eol[5][0] == ':') ? word_eol[5] + 1 : word_eol[5]); + (word_eol[5][0] == ':') ? word_eol[5] + 1 : word_eol[5], + tags_data); break; case 333: - inbound_topictime (serv, word[4], word[5], atol (word[6])); + inbound_topictime (serv, word[4], word[5], atol (word[6]), tags_data); break; #if 0 case 338: /* Undernet Real user@host, Real IP */ - EMIT_SIGNAL (XP_TE_WHOIS_REALHOST, sess, word[4], word[5], word[6], - (word_eol[7][0]==':') ? word_eol[7]+1 : word_eol[7], 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS_REALHOST, sess, word[4], word[5], word[6], + (word_eol[7][0]==':') ? word_eol[7]+1 : word_eol[7], + 0, tags_data->timestamp); break; #endif case 341: /* INVITE ACK */ - EMIT_SIGNAL (XP_TE_UINVITE, sess, word[4], word[5], serv->servername, - NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_UINVITE, sess, word[4], word[5], + serv->servername, NULL, 0, tags_data->timestamp); break; case 352: /* WHO */ @@ -713,12 +727,13 @@ process_numeric (session * sess, int n, away = 1; inbound_user_info (sess, word[4], word[5], word[6], word[7], - word[8], word_eol[11], NULL, away); + word[8], word_eol[11], NULL, away, + tags_data); /* try to show only user initiated whos */ if (!who_sess || !who_sess->doing_who) - EMIT_SIGNAL (XP_TE_SERVTEXT, serv->server_session, text, word[1], - word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, text, word[1], + word[2], NULL, 0, tags_data->timestamp); } break; @@ -737,12 +752,14 @@ process_numeric (session * sess, int n, /* :server 354 yournick 152 #channel ~ident host servname nick H account :realname */ inbound_user_info (sess, word[5], word[6], word[7], word[8], - word[9], word_eol[12]+1, word[11], away); + word[9], word_eol[12]+1, word[11], away, + tags_data); /* try to show only user initiated whos */ if (!who_sess || !who_sess->doing_who) - EMIT_SIGNAL (XP_TE_SERVTEXT, serv->server_session, text, - word[1], word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, text, + word[1], word[2], NULL, 0, + tags_data->timestamp); } else goto def; } @@ -755,21 +772,23 @@ process_numeric (session * sess, int n, if (who_sess) { if (!who_sess->doing_who) - EMIT_SIGNAL (XP_TE_SERVTEXT, serv->server_session, text, - word[1], word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, text, + word[1], word[2], NULL, 0, + tags_data->timestamp); who_sess->doing_who = FALSE; } else { if (!serv->doing_dns) - EMIT_SIGNAL (XP_TE_SERVTEXT, serv->server_session, text, - word[1], word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, text, + word[1], word[2], NULL, 0, tags_data->timestamp); serv->doing_dns = FALSE; } } break; case 346: /* +I-list entry */ - if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 346)) + if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 346, + tags_data)) goto def; break; @@ -779,7 +798,8 @@ process_numeric (session * sess, int n, break; case 348: /* +e-list entry */ - if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 348)) + if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 348, + tags_data)) goto def; break; @@ -796,16 +816,18 @@ process_numeric (session * sess, int n, case 353: /* NAMES */ inbound_nameslist (serv, word[5], - (word_eol[6][0] == ':') ? word_eol[6] + 1 : word_eol[6]); + (word_eol[6][0] == ':') ? word_eol[6] + 1 : word_eol[6], + tags_data); break; case 366: - if (!inbound_nameslist_end (serv, word[4])) + if (!inbound_nameslist_end (serv, word[4], tags_data)) goto def; break; case 367: /* banlist entry */ - if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 367)) + if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 367, + tags_data)) goto def; break; @@ -822,20 +844,21 @@ process_numeric (session * sess, int n, case 369: /* WHOWAS end */ case 406: /* WHOWAS error */ - EMIT_SIGNAL (XP_TE_SERVTEXT, whois_sess, text, word[1], word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, whois_sess, text, word[1], word[2], + NULL, 0, tags_data->timestamp); serv->inside_whois = 0; break; case 372: /* motd text */ case 375: /* motd start */ if (!prefs.hex_irc_skip_motd || serv->motd_skipped) - EMIT_SIGNAL (XP_TE_MOTD, serv->server_session, text, NULL, NULL, - NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_MOTD, serv->server_session, text, NULL, + NULL, NULL, 0, tags_data->timestamp); break; case 376: /* end of motd */ case 422: /* motd file is missing */ - inbound_login_end (sess, text); + inbound_login_end (sess, text, tags_data); break; case 432: /* erroneous nickname */ @@ -843,7 +866,7 @@ process_numeric (session * sess, int n, { goto def; } - inbound_next_nick (sess, word[4], 1); + inbound_next_nick (sess, word[4], 1, tags_data); break; case 433: /* nickname in use */ @@ -851,48 +874,53 @@ process_numeric (session * sess, int n, { goto def; } - inbound_next_nick (sess, word[4], 0); + inbound_next_nick (sess, word[4], 0, tags_data); break; case 437: if (serv->end_of_motd || is_channel (serv, word[4])) goto def; - inbound_next_nick (sess, word[4], 0); + inbound_next_nick (sess, word[4], 0, tags_data); break; case 471: - EMIT_SIGNAL (XP_TE_USERLIMIT, sess, word[4], NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_USERLIMIT, sess, word[4], NULL, NULL, NULL, 0, + tags_data->timestamp); break; case 473: - EMIT_SIGNAL (XP_TE_INVITE, sess, word[4], NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_INVITE, sess, word[4], NULL, NULL, NULL, 0, + tags_data->timestamp); break; case 474: - EMIT_SIGNAL (XP_TE_BANNED, sess, word[4], NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_BANNED, sess, word[4], NULL, NULL, NULL, 0, + tags_data->timestamp); break; case 475: - EMIT_SIGNAL (XP_TE_KEYWORD, sess, word[4], NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_KEYWORD, sess, word[4], NULL, NULL, NULL, 0, + tags_data->timestamp); break; case 601: - notify_set_offline (serv, word[4], FALSE); + notify_set_offline (serv, word[4], FALSE, tags_data); break; case 605: - notify_set_offline (serv, word[4], TRUE); + notify_set_offline (serv, word[4], TRUE, tags_data); break; case 600: case 604: - notify_set_online (serv, word[4]); + notify_set_online (serv, word[4], tags_data); break; case 728: /* +q-list entry */ /* NOTE: FREENODE returns these results inconsistent with e.g. +b */ /* Who else has imlemented MODE_QUIET, I wonder? */ - if (!inbound_banlist (sess, atol (word[8]), word[4], word[6], word[7], 728)) + if (!inbound_banlist (sess, atol (word[8]), word[4], word[6], word[7], 728, + tags_data)) goto def; break; @@ -905,25 +933,29 @@ process_numeric (session * sess, int n, ex = strchr (word[4], '!'); /* only send the nick */ if (ex) ex[0] = 0; - notify_set_online (serv, word[4] + 1); + notify_set_online (serv, word[4] + 1, tags_data); break; case 731: /* RPL_MONOFFLINE */ ex = strchr (word[4], '!'); /* only send the nick */ if (ex) ex[0] = 0; - notify_set_offline (serv, word[4] + 1, FALSE); + notify_set_offline (serv, word[4] + 1, FALSE, tags_data); break; case 900: /* successful SASL 'logged in as ' */ - EMIT_SIGNAL (XP_TE_SERVTEXT, serv->server_session, word_eol[6]+1, word[1], word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, + word_eol[6]+1, word[1], word[2], NULL, 0, + tags_data->timestamp); break; case 903: /* successful SASL auth */ case 904: /* aborted SASL auth */ case 905: /* failed SASL auth */ case 906: /* registration completes before SASL auth */ case 907: /* attempting to re-auth after a successful auth */ - EMIT_SIGNAL (XP_TE_SASLRESPONSE, serv->server_session, word[1], word[2], word[3], ++word_eol[4], 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SASLRESPONSE, serv->server_session, word[1], + word[2], word[3], ++word_eol[4], 0, + tags_data->timestamp); tcp_send_len (serv, "CAP END\r\n", 9); break; @@ -933,9 +965,9 @@ process_numeric (session * sess, int n, { /* some unknown WHOIS reply, ircd coders make them up weekly */ if (!serv->skip_next_whois) - EMIT_SIGNAL (XP_TE_WHOIS_SPECIAL, whois_sess, word[4], - (word_eol[5][0] == ':') ? word_eol[5] + 1 : word_eol[5], - word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS_SPECIAL, whois_sess, word[4], + (word_eol[5][0] == ':') ? word_eol[5] + 1 : word_eol[5], + word[2], NULL, 0, tags_data->timestamp); return; } @@ -954,7 +986,8 @@ process_numeric (session * sess, int n, else sess=serv->server_session; - EMIT_SIGNAL (XP_TE_SERVTEXT, sess, text, word[1], word[2], NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, sess, text, word[1], word[2], + NULL, 0, tags_data->timestamp); } } } @@ -1351,7 +1384,7 @@ handle_message_tag_time (const char *time, message_tags_data *tags_data) * * See http://ircv3.atheme.org/specification/message-tags-3.2 */ -/* TODO: we should ignore capabilities not enabled! */ +/* TODO:orium: we should ignore capabilities not enabled! */ static void handle_message_tags (const char *tags_str, message_tags_data *tags_data) { @@ -1462,7 +1495,7 @@ irc_inline (server *serv, char *buf, int len) if (*text == ':') text++; - process_numeric (sess, atoi (word[2]), word, word_eol, text, &tags_data); // TODO (data tags) + process_numeric (sess, atoi (word[2]), word, word_eol, text, &tags_data); // TODO:orium (data tags) } else { process_named_msg (sess, type, word, word_eol, &tags_data); diff --git a/src/common/text.c b/src/common/text.c index dc81feeb..05a20230 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -916,6 +916,20 @@ PrintTextf (session *sess, char *format, ...) g_free (buf); } +void +PrintTextTimeStampf (session *sess, time_t timestamp, char *format, ...) +{ + va_list args; + char *buf; + + va_start (args, format); + buf = g_strdup_vprintf (format, args); + va_end (args); + + PrintTextTimeStamp (sess, buf, timestamp); + g_free (buf); +} + /* Print Events stuff here --AGL */ /* Consider the following a NOTES file: diff --git a/src/common/text.h b/src/common/text.h index dc5e5f72..27848616 100644 --- a/src/common/text.h +++ b/src/common/text.h @@ -43,6 +43,7 @@ void scrollback_load (session *sess); int text_word_check (char *word, int len); void PrintText (session *sess, char *text); void PrintTextf (session *sess, char *format, ...); +void PrintTextTimeStampf (session *sess, time_t timestamp, char *format, ...); void log_close (session *sess); void log_open_or_close (session *sess); void load_text_events (void); diff --git a/src/common/userlist.c b/src/common/userlist.c index 5e53be2a..c6c806bd 100644 --- a/src/common/userlist.c +++ b/src/common/userlist.c @@ -383,7 +383,8 @@ userlist_remove_user (struct session *sess, struct User *user) } void -userlist_add (struct session *sess, char *name, char *hostname, char *account, char *realname) +userlist_add (struct session *sess, char *name, char *hostname, + char *account, char *realname, const message_tags_data *tags_data) { struct User *user; int row, prefix_chars; @@ -391,7 +392,7 @@ userlist_add (struct session *sess, char *name, char *hostname, char *account, c acc = nick_access (sess->server, name, &prefix_chars); - notify_set_online (sess->server, name + prefix_chars); + notify_set_online (sess->server, name + prefix_chars, tags_data); user = malloc (sizeof (struct User)); memset (user, 0, sizeof (struct User)); diff --git a/src/common/userlist.h b/src/common/userlist.h index 777d61ea..ebf95606 100644 --- a/src/common/userlist.h +++ b/src/common/userlist.h @@ -18,6 +18,7 @@ */ #include +#include "proto-irc.h" #ifndef HEXCHAT_USERLIST_H #define HEXCHAT_USERLIST_H @@ -51,7 +52,8 @@ struct User *userlist_find (session *sess, const char *name); struct User *userlist_find_global (server *serv, char *name); void userlist_clear (session *sess); void userlist_free (session *sess); -void userlist_add (session *sess, char *name, char *hostname, char *account, char *realname); +void userlist_add (session *sess, char *name, char *hostname, char *account, + char *realname, const message_tags_data *tags_data); int userlist_remove (session *sess, char *name); void userlist_remove_user (session *sess, struct User *user); int userlist_change (session *sess, char *oldname, char *newname); -- cgit 1.4.1 From ce6fef3d0ab8b70a88eaf83decb5a596a7f0e246 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Sun, 23 Jun 2013 19:53:41 +0100 Subject: A few messages missing regarding server-time. --- src/common/ctcp.c | 4 ++-- src/common/dcc.c | 17 +++++++++------ src/common/dcc.h | 4 +++- src/common/inbound.c | 58 ++++++++++++++++++++++++++++++-------------------- src/common/inbound.h | 7 ++++-- src/common/notify.c | 2 +- src/common/outbound.c | 14 ++++++++---- src/common/proto-irc.c | 2 +- src/common/text.c | 6 +++--- src/common/text.h | 1 + 10 files changed, 71 insertions(+), 44 deletions(-) (limited to 'src/common/outbound.c') diff --git a/src/common/ctcp.c b/src/common/ctcp.c index 7045c08a..b4fb55b7 100644 --- a/src/common/ctcp.c +++ b/src/common/ctcp.c @@ -104,7 +104,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip, if (!ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset)) { if (!ignore_check (word[1], IG_DCC)) - handle_dcc (sess, nick, word, word_eol); + handle_dcc (sess, nick, word, word_eol, tags_data); } return; } @@ -129,7 +129,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip, if (ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset)) goto generic; - inbound_action (sess, to, nick, ip, msg + 7, FALSE, id); + inbound_action (sess, to, nick, ip, msg + 7, FALSE, id, tags_data); return; } diff --git a/src/common/dcc.c b/src/common/dcc.c index afdf67a5..c0527510 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -577,7 +577,8 @@ dcc_chat_line (struct DCC *dcc, char *line) po = strchr (line + 8, '\001'); if (po) po[0] = 0; - inbound_action (sess, dcc->serv->nick, dcc->nick, "", line + 8, FALSE, FALSE); + inbound_action (sess, dcc->serv->nick, dcc->nick, "", line + 8, FALSE, + FALSE, &no_tags); } else { inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, &no_tags); @@ -2376,8 +2377,8 @@ dcc_add_file (session *sess, char *file, DCC_SIZE size, int port, char *nick, gu } void -handle_dcc (struct session *sess, char *nick, char *word[], - char *word_eol[]) +handle_dcc (struct session *sess, char *nick, char *word[], char *word_eol[], + const message_tags_data *tags_data) { char tbuf[512]; struct DCC *dcc; @@ -2473,8 +2474,9 @@ handle_dcc (struct session *sess, char *nick, char *word[], dcc->serv->p_ctcp (dcc->serv, dcc->nick, tbuf); } sprintf (tbuf, "%"DCC_SFMT, dcc->pos); - EMIT_SIGNAL (XP_TE_DCCRESUMEREQUEST, sess, nick, - file_part (dcc->file), tbuf, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_DCCRESUMEREQUEST, sess, nick, + file_part (dcc->file), tbuf, NULL, 0, + tags_data->timestamp); } return; } @@ -2544,8 +2546,9 @@ handle_dcc (struct session *sess, char *nick, char *word[], } else { - EMIT_SIGNAL (XP_TE_DCCGENERICOFFER, sess->server->front_session, - word_eol[4] + 2, nick, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_DCCGENERICOFFER, sess->server->front_session, + word_eol[4] + 2, nick, NULL, NULL, 0, + tags_data->timestamp); } } diff --git a/src/common/dcc.h b/src/common/dcc.h index 32d0ed5f..e3163c8a 100644 --- a/src/common/dcc.h +++ b/src/common/dcc.h @@ -20,6 +20,7 @@ /* dcc.h */ #include /* for time_t */ +#include "proto-irc.h" #ifndef HEXCHAT_DCC_H #define HEXCHAT_DCC_H @@ -127,7 +128,8 @@ void dcc_send (struct session *sess, char *to, char *file, int maxcps, int passi struct DCC *find_dcc (char *nick, char *file, int type); void dcc_get_nick (struct session *sess, char *nick); void dcc_chat (session *sess, char *nick, int passive); -void handle_dcc (session *sess, char *nick, char *word[], char *word_eol[]); +void handle_dcc (session *sess, char *nick, char *word[], char *word_eol[], + const message_tags_data *tags_data); void dcc_show_list (session *sess); guint32 dcc_get_my_address (void); void dcc_get_with_destfile (struct DCC *dcc, char *utf8file); diff --git a/src/common/inbound.c b/src/common/inbound.c index 82f5826a..8547a70a 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -122,13 +122,15 @@ find_session_from_nick (char *nick, server *serv) } static session * -inbound_open_dialog (server *serv, char *from) +inbound_open_dialog (server *serv, char *from, + const message_tags_data *tags_data) { session *sess; sess = new_ircwindow (serv, from, SESS_DIALOG, 0); /* for playing sounds */ - EMIT_SIGNAL (XP_TE_OPENDIALOG, sess, NULL, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_OPENDIALOG, sess, NULL, NULL, NULL, NULL, 0, + tags_data->timestamp); return sess; } @@ -169,7 +171,7 @@ inbound_privmsg (server *serv, char *from, char *ip, char *text, int id, { if (flood_check (from, ip, serv, current_sess, 1)) /* Create a dialog session */ - sess = inbound_open_dialog (serv, from); + sess = inbound_open_dialog (serv, from, tags_data); else sess = serv->server_session; if (!sess) @@ -326,7 +328,8 @@ is_hilight (char *from, char *text, session *sess, server *serv) } void -inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int fromme, int id) +inbound_action (session *sess, char *chan, char *from, char *ip, char *text, + int fromme, int id, const message_tags_data *tags_data) { session *def = sess; server *serv = sess->server; @@ -351,7 +354,7 @@ inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int { /* but only if it wouldn't flood */ if (flood_check (from, ip, serv, current_sess, 1)) - sess = inbound_open_dialog (serv, from); + sess = inbound_open_dialog (serv, from, tags_data); else sess = serv->server_session; } @@ -397,19 +400,24 @@ inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int { if (is_hilight (from, text, sess, serv)) { - EMIT_SIGNAL (XP_TE_HCHANACTION, sess, from, text, nickchar, idtext, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANACTION, sess, from, text, nickchar, + idtext, 0, tags_data->timestamp); return; } } if (fromme) - EMIT_SIGNAL (XP_TE_UACTION, sess, from, text, nickchar, idtext, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_UACTION, sess, from, text, nickchar, idtext, + 0, tags_data->timestamp); else if (!privaction) - EMIT_SIGNAL (XP_TE_CHANACTION, sess, from, text, nickchar, idtext, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANACTION, sess, from, text, nickchar, + idtext, 0, tags_data->timestamp); else if (sess->type == SESS_DIALOG) - EMIT_SIGNAL (XP_TE_DPRIVACTION, sess, from, text, idtext, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVACTION, sess, from, text, idtext, NULL, + 0, tags_data->timestamp); else - EMIT_SIGNAL (XP_TE_PRIVACTION, sess, from, text, idtext, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_PRIVACTION, sess, from, text, idtext, NULL, 0, + tags_data->timestamp); } void @@ -457,7 +465,8 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from, { if (prefs.hex_away_auto_unmark && serv->is_away) sess->server->p_set_back (sess->server); - EMIT_SIGNAL (XP_TE_UCHANMSG, sess, from, text, nickchar, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_UCHANMSG, sess, from, text, nickchar, NULL, + 0, tags_data->timestamp); return; } @@ -467,14 +476,14 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from, hilight = TRUE; if (sess->type == SESS_DIALOG) - EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text, - idtext, NULL, 0, tags_data->timestamp); + EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0, + tags_data->timestamp); else if (hilight) - EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANMSG, sess, from, text, - nickchar, idtext, 0, tags_data->timestamp); + EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANMSG, sess, from, text, nickchar, idtext, + 0, tags_data->timestamp); else - EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMSG, sess, from, text, - nickchar, idtext, 0, tags_data->timestamp); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMSG, sess, from, text, nickchar, idtext, + 0, tags_data->timestamp); } void @@ -660,12 +669,13 @@ inbound_nameslist (server *serv, char *chan, char *names, sess = find_channel (serv, chan); if (!sess) { - EMIT_SIGNAL (XP_TE_USERSONCHAN, serv->server_session, chan, names, NULL, - NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_USERSONCHAN, serv->server_session, chan, + names, NULL, NULL, 0, tags_data->timestamp); return; } if (!sess->ignore_names) - EMIT_SIGNAL (XP_TE_USERSONCHAN, sess, chan, names, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_USERSONCHAN, sess, chan, names, NULL, NULL, + 0, tags_data->timestamp); if (sess->end_of_names) { @@ -1245,7 +1255,8 @@ inbound_next_nick (session *sess, char *nick, int error, } void -do_dns (session *sess, char *nick, char *host) +do_dns (session *sess, char *nick, char *host, + const message_tags_data *tags_data) { char *po; char tbuf[1024]; @@ -1253,7 +1264,8 @@ do_dns (session *sess, char *nick, char *host) po = strrchr (host, '@'); if (po) host = po + 1; - EMIT_SIGNAL (XP_TE_RESOLVINGUSER, sess, nick, host, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_RESOLVINGUSER, sess, nick, host, NULL, NULL, 0, + tags_data->timestamp); snprintf (tbuf, sizeof (tbuf), "exec -d %s %s", prefs.hex_dnsprogram, host); handle_command (sess, tbuf, FALSE); } @@ -1382,7 +1394,7 @@ inbound_user_info (session *sess, char *chan, char *user, char *host, else { if (serv->doing_dns && nick && host) - do_dns (sess, nick, host); + do_dns (sess, nick, host, tags_data); } } else diff --git a/src/common/inbound.h b/src/common/inbound.h index 742152ea..cbb04890 100644 --- a/src/common/inbound.h +++ b/src/common/inbound.h @@ -82,7 +82,9 @@ void clear_channel (session *sess); void set_topic (session *sess, char *topic, char *stripped_topic); void inbound_privmsg (server *serv, char *from, char *ip, char *text, int id, const message_tags_data *tags_data); -void inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int fromme, int id); +void inbound_action (session *sess, char *chan, char *from, char *ip, + char *text, int fromme, int id, + const message_tags_data *tags_data); void inbound_newnick (server *serv, char *nick, char *newnick, int quiet, const message_tags_data *tags_data); void inbound_identified (server *serv); @@ -93,7 +95,8 @@ void inbound_cap_ls (server *serv, char *nick, char *extensions, void inbound_cap_nak (server *serv, const message_tags_data *tags_data); void inbound_cap_list (server *serv, char *nick, char *extensions, const message_tags_data *tags_data); -void do_dns (session *sess, char *nick, char *host); +void do_dns (session *sess, char *nick, char *host, + const message_tags_data *tags_data); gboolean alert_match_word (char *word, char *masks); gboolean alert_match_text (char *text, char *masks); diff --git a/src/common/notify.c b/src/common/notify.c index 96b3a097..944d826c 100644 --- a/src/common/notify.c +++ b/src/common/notify.c @@ -491,7 +491,7 @@ notify_showlist (struct session *sess, const message_tags_data *tags_data) snprintf (outbuf, sizeof (outbuf), _(" %-20s online\n"), notify->name); else snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name); - PrintText (sess, outbuf); + PrintTextTimeStamp (sess, outbuf, tags_data->timestamp); list = list->next; } if (i) diff --git a/src/common/outbound.c b/src/common/outbound.c index d3e0ff56..5e840769 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -1419,7 +1419,8 @@ cmd_dns (struct session *sess, char *tbuf, char *word[], char *word_eol[]) user = userlist_find (sess, nick); if (user && user->hostname) { - do_dns (sess, user->nick, user->hostname); + message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; + do_dns (sess, user->nick, user->hostname, &no_tags); } else { sess->server->p_get_ip (sess->server, nick); @@ -2606,6 +2607,7 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[]) char *split_text = NULL; int cmd_length = 22; /* " PRIVMSG ", " ", :, \001ACTION, " ", \001, \r, \n */ int offset = 0; + message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; if (!(*act)) return FALSE; @@ -2621,7 +2623,8 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[]) if (dcc_write_chat (sess->channel, tbuf)) { /* print it to screen */ - inbound_action (sess, sess->channel, sess->server->nick, "", act, TRUE, FALSE); + inbound_action (sess, sess->channel, sess->server->nick, "", act, TRUE, FALSE, + &no_tags); } else { /* DCC CHAT failed, try through server */ @@ -2631,7 +2634,9 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[]) { sess->server->p_action (sess->server, sess->channel, split_text); /* print it to screen */ - inbound_action (sess, sess->channel, sess->server->nick, "", split_text, TRUE, FALSE); + inbound_action (sess, sess->channel, sess->server->nick, "", + split_text, TRUE, FALSE, + &no_tags); if (*split_text) offset += strlen(split_text); @@ -2641,7 +2646,8 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[]) sess->server->p_action (sess->server, sess->channel, act + offset); /* print it to screen */ - inbound_action (sess, sess->channel, sess->server->nick, "", act + offset, TRUE, FALSE); + inbound_action (sess, sess->channel, sess->server->nick, "", + act + offset, TRUE, FALSE, &no_tags); } else { notc_msg (sess); diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 875247e7..204fccda 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -1285,7 +1285,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], garbage: /* unknown message */ - PrintTextf (sess, "GARBAGE: %s\n", word_eol[1]); + PrintTextTimeStampf (sess, tags_data->timestamp, "GARBAGE: %s\n", word_eol[1]); } /* handle named messages that DON'T start with a ':' */ diff --git a/src/common/text.c b/src/common/text.c index 05a20230..a0e860ce 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -865,7 +865,7 @@ text_validate (char **text, int *len) return utf; } -static void +void PrintTextTimeStamp (session *sess, char *text, time_t timestamp) { char *conv; @@ -1857,7 +1857,7 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig static void display_event (session *sess, int event, char **args, - unsigned int stripcolor_args, time_t timestamp) + unsigned int stripcolor_args, time_t timestamp) { char o[4096]; format_event (sess, event, args, o, sizeof (o), stripcolor_args); @@ -2064,7 +2064,7 @@ text_color_of (char *name) void text_emit (int index, session *sess, char *a, char *b, char *c, char *d, - time_t timestamp) + time_t timestamp) { char *word[PDIWORDS]; int i; diff --git a/src/common/text.h b/src/common/text.h index 27848616..5a51c894 100644 --- a/src/common/text.h +++ b/src/common/text.h @@ -42,6 +42,7 @@ void scrollback_load (session *sess); int text_word_check (char *word, int len); void PrintText (session *sess, char *text); +void PrintTextTimeStamp (session *sess, char *text, time_t timestamp); void PrintTextf (session *sess, char *format, ...); void PrintTextTimeStampf (session *sess, time_t timestamp, char *format, ...); void log_close (session *sess); -- cgit 1.4.1 From aef9e3922e6f6557b156ba6c1fc9e2b0a03db316 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Sun, 23 Jun 2013 21:31:09 +0100 Subject: Fixed a few null pointer derefs caused by dummy code that somehow I forgot about. --- src/common/outbound.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/common/outbound.c') diff --git a/src/common/outbound.c b/src/common/outbound.c index 5e840769..3709ce96 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2707,7 +2707,6 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) char *nick = word[2]; char *msg = word_eol[3]; struct session *newsess; - char *split_text = NULL; int cmd_length = 13; /* " PRIVMSG ", " ", :, \r, \n */ int offset = 0; @@ -2758,10 +2757,13 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) newsess = find_channel (sess->server, nick); if (newsess) { + message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; + while ((split_text = split_up_text (sess, msg + offset, cmd_length, split_text))) { inbound_chanmsg (newsess->server, NULL, newsess->channel, - newsess->server->nick, split_text, TRUE, FALSE, 0); + newsess->server->nick, split_text, TRUE, FALSE, + &no_tags); if (*split_text) offset += strlen(split_text); @@ -2769,7 +2771,8 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) g_free(split_text); } inbound_chanmsg (newsess->server, NULL, newsess->channel, - newsess->server->nick, msg + offset, TRUE, FALSE, 0); + newsess->server->nick, msg + offset, TRUE, FALSE, + &no_tags); } else { @@ -3712,8 +3715,11 @@ cmd_wallchan (struct session *sess, char *tbuf, char *word[], sess = list->data; if (sess->type == SESS_CHANNEL) { + message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; + inbound_chanmsg (sess->server, NULL, sess->channel, - sess->server->nick, word_eol[2], TRUE, FALSE, 0); + sess->server->nick, word_eol[2], TRUE, FALSE, + &no_tags); sess->server->p_message (sess->server, sess->channel, word_eol[2]); } list = list->next; @@ -4357,6 +4363,7 @@ handle_say (session *sess, char *text, int check_spch) char *newcmd = newcmd_static; int len; int newcmdlen = sizeof newcmd_static; + message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; if (strcmp (sess->channel, "(lastlog)") == 0) { @@ -4409,7 +4416,7 @@ handle_say (session *sess, char *text, int check_spch) if (dcc) { inbound_chanmsg (sess->server, NULL, sess->channel, - sess->server->nick, text, TRUE, FALSE, 0); + sess->server->nick, text, TRUE, FALSE, &no_tags); set_topic (sess, net_ip (dcc->addr), net_ip (dcc->addr)); goto xit; } @@ -4424,7 +4431,7 @@ handle_say (session *sess, char *text, int check_spch) while ((split_text = split_up_text (sess, text + offset, cmd_length, split_text))) { inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick, - split_text, TRUE, FALSE, 0); + split_text, TRUE, FALSE, &no_tags); sess->server->p_message (sess->server, sess->channel, split_text); if (*split_text) @@ -4434,7 +4441,7 @@ handle_say (session *sess, char *text, int check_spch) } inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick, - text + offset, TRUE, FALSE, 0); + text + offset, TRUE, FALSE, &no_tags); sess->server->p_message (sess->server, sess->channel, text + offset); } else { -- cgit 1.4.1