1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-26 11:12:19 -05:00

server-time supported in most named messages.

This commit is contained in:
Diogo Sousa 2013-06-22 15:32:50 +01:00
parent 179747a7bc
commit 6a0240aa18
7 changed files with 246 additions and 135 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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

View File

@ -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;

View File

@ -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: