Implement support for the IRCv3 account-tag specification. (#2572)
Co-authored-by: Patrick <tingping@tingping.se>
This commit is contained in:
@ -1010,6 +1010,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
||||
const message_tags_data *tags_data)
|
||||
{
|
||||
server *serv = sess->server;
|
||||
char *account;
|
||||
char ip[128], nick[NICKLEN];
|
||||
char *text, *ex;
|
||||
int len = strlen (type);
|
||||
@ -1028,6 +1029,14 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
||||
ex[0] = '!';
|
||||
}
|
||||
|
||||
|
||||
/** Update the account for this message's source. */
|
||||
if (serv->have_account_tag)
|
||||
{
|
||||
account = tags_data->account && *tags_data->account ? tags_data->account : "*";
|
||||
inbound_account (serv, nick, account, tags_data);
|
||||
}
|
||||
|
||||
if (len == 4)
|
||||
{
|
||||
guint32 t;
|
||||
@ -1522,6 +1531,9 @@ handle_message_tags (server *serv, const char *tags_str,
|
||||
*value = '\0';
|
||||
value++;
|
||||
|
||||
if (serv->have_account_tag && !strcmp (key, "account"))
|
||||
tags_data->account = g_strdup (value);
|
||||
|
||||
if (serv->have_server_time && !strcmp (key, "time"))
|
||||
handle_message_tag_time (value, tags_data);
|
||||
}
|
||||
@ -1619,9 +1631,16 @@ irc_inline (server *serv, char *buf, int len)
|
||||
}
|
||||
|
||||
xit:
|
||||
message_tags_data_free (&tags_data);
|
||||
g_free (pdibuf);
|
||||
}
|
||||
|
||||
void
|
||||
message_tags_data_free (message_tags_data *tags_data)
|
||||
{
|
||||
g_clear_pointer (&tags_data->account, g_free);
|
||||
}
|
||||
|
||||
void
|
||||
proto_fill_her_up (server *serv)
|
||||
{
|
||||
|
Reference in New Issue
Block a user