diff options
author | Diogo Sousa <diogogsousa@gmail.com> | 2013-06-22 23:48:17 +0100 |
---|---|---|
committer | Diogo Sousa <diogogsousa@gmail.com> | 2013-06-28 16:04:32 +0100 |
commit | d1725e3f443f0133c113f417b6a594f79c6831e7 (patch) | |
tree | c6f720d97fd809f3a7b40139acff0f31d69d9931 | |
parent | 42da8fe3efb3d6bb7e3fb14169e7cc362e21921a (diff) |
server-time for all numerical messages.
-rw-r--r-- | src/common/inbound.c | 75 | ||||
-rw-r--r-- | src/common/inbound.h | 36 | ||||
-rw-r--r-- | src/common/modes.c | 2 | ||||
-rw-r--r-- | src/common/modes.h | 2 | ||||
-rw-r--r-- | src/common/notify.c | 42 | ||||
-rw-r--r-- | src/common/notify.h | 13 | ||||
-rw-r--r-- | src/common/outbound.c | 5 | ||||
-rw-r--r-- | src/common/proto-irc.c | 199 | ||||
-rw-r--r-- | src/common/text.c | 14 | ||||
-rw-r--r-- | src/common/text.h | 1 | ||||
-rw-r--r-- | src/common/userlist.c | 5 | ||||
-rw-r--r-- | src/common/userlist.h | 4 |
12 files changed, 247 insertions, 151 deletions
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 <time.h> +#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); |