mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
irc: display ACCOUNT command in private buffers
This commit is contained in:
+1
-1
@@ -34,7 +34,7 @@ Bug fixes::
|
||||
* irc: fix display of TOPIC and QUIT messages with an empty trailing parameter (issue #1797)
|
||||
* irc: fix parsing of messages with trailing spaces and no trailing parameter (issue #1803)
|
||||
* irc: add missing tag "irc_numeric" in all numeric IRC commands (issue #1804)
|
||||
* irc: display CHGHOST command in private buffers
|
||||
* irc: display ACCOUNT and CHGHOST commands in private buffers
|
||||
* guile: fix function hdata_get_string
|
||||
* javascript: fix return of long value in functions infolist_time, hdata_long and hdata_time
|
||||
* php: fix function hdata_compare
|
||||
|
||||
@@ -437,41 +437,68 @@ IRC_PROTOCOL_CALLBACK(account)
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
ptr_nick = irc_nick_search (server, ptr_channel, nick);
|
||||
if (ptr_nick)
|
||||
switch (ptr_channel->type)
|
||||
{
|
||||
if (!ignored
|
||||
&& weechat_config_boolean (irc_config_look_display_account_message))
|
||||
{
|
||||
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))
|
||||
&& (weechat_config_boolean (irc_config_look_smart_filter_account))) ?
|
||||
irc_channel_nick_speaking_time_search (server, ptr_channel, nick, 1) : NULL;
|
||||
smart_filter = (!local_account
|
||||
&& weechat_config_boolean (irc_config_look_smart_filter)
|
||||
&& weechat_config_boolean (irc_config_look_smart_filter_account)
|
||||
&& !ptr_nick_speaking);
|
||||
case IRC_CHANNEL_TYPE_PRIVATE:
|
||||
if (!ignored
|
||||
&& weechat_config_boolean (irc_config_look_display_account_message)
|
||||
&& (irc_server_strcasecmp (server,
|
||||
ptr_channel->name, nick) == 0))
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (
|
||||
server, NULL, command, NULL, ptr_channel->buffer),
|
||||
date,
|
||||
irc_protocol_tags (
|
||||
command,
|
||||
tags,
|
||||
NULL,
|
||||
nick, address),
|
||||
(pos_account) ? _("%s%s%s%s has identified as %s") : _("%s%s%s%s has unidentified"),
|
||||
weechat_prefix ("network"),
|
||||
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
|
||||
nick,
|
||||
IRC_COLOR_MESSAGE_ACCOUNT,
|
||||
(pos_account) ? str_account : NULL);
|
||||
}
|
||||
break;
|
||||
case IRC_CHANNEL_TYPE_CHANNEL:
|
||||
ptr_nick = irc_nick_search (server, ptr_channel, nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
if (!ignored
|
||||
&& weechat_config_boolean (irc_config_look_display_account_message))
|
||||
{
|
||||
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))
|
||||
&& (weechat_config_boolean (irc_config_look_smart_filter_account))) ?
|
||||
irc_channel_nick_speaking_time_search (server, ptr_channel, nick, 1) : NULL;
|
||||
smart_filter = (!local_account
|
||||
&& weechat_config_boolean (irc_config_look_smart_filter)
|
||||
&& weechat_config_boolean (irc_config_look_smart_filter_account)
|
||||
&& !ptr_nick_speaking);
|
||||
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (
|
||||
server, NULL, command, NULL, ptr_channel->buffer),
|
||||
date,
|
||||
irc_protocol_tags (
|
||||
command,
|
||||
tags,
|
||||
smart_filter ? "irc_smart_filter" : NULL,
|
||||
nick, address),
|
||||
(pos_account) ? _("%s%s%s%s has identified as %s") : _("%s%s%s%s has unidentified"),
|
||||
weechat_prefix ("network"),
|
||||
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
|
||||
nick,
|
||||
IRC_COLOR_MESSAGE_ACCOUNT,
|
||||
(pos_account) ? str_account : NULL);
|
||||
}
|
||||
|
||||
if (ptr_nick->account)
|
||||
free (ptr_nick->account);
|
||||
ptr_nick->account = (cap_account_notify && pos_account) ?
|
||||
strdup (pos_account) : NULL;
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (
|
||||
server, NULL, command, NULL, ptr_channel->buffer),
|
||||
date,
|
||||
irc_protocol_tags (
|
||||
command,
|
||||
tags,
|
||||
(smart_filter) ? "irc_smart_filter" : NULL,
|
||||
nick, address),
|
||||
(pos_account) ? _("%s%s%s%s has identified as %s") : _("%s%s%s%s has unidentified"),
|
||||
weechat_prefix ("network"),
|
||||
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
|
||||
nick,
|
||||
IRC_COLOR_MESSAGE_ACCOUNT,
|
||||
(pos_account) ? str_account : NULL);
|
||||
}
|
||||
if (ptr_nick->account)
|
||||
free (ptr_nick->account);
|
||||
ptr_nick->account = (cap_account_notify && pos_account) ?
|
||||
strdup (pos_account) : NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1272,7 +1299,7 @@ IRC_PROTOCOL_CALLBACK(chghost)
|
||||
irc_protocol_tags (
|
||||
command,
|
||||
tags,
|
||||
smart_filter ? "irc_smart_filter" : NULL,
|
||||
(smart_filter) ? "irc_smart_filter" : NULL,
|
||||
nick, address),
|
||||
_("%s%s%s%s (%s%s%s)%s has changed host to %s%s"),
|
||||
weechat_prefix ("network"),
|
||||
@@ -1616,7 +1643,7 @@ IRC_PROTOCOL_CALLBACK(join)
|
||||
date,
|
||||
irc_protocol_tags (command,
|
||||
tags,
|
||||
smart_filter ? "irc_smart_filter" : NULL,
|
||||
(smart_filter) ? "irc_smart_filter" : NULL,
|
||||
nick, address),
|
||||
_("%s%s%s%s%s%s%s%s%s%s%s%s has joined %s%s%s"),
|
||||
weechat_prefix ("join"),
|
||||
@@ -3129,7 +3156,7 @@ IRC_PROTOCOL_CALLBACK(setname)
|
||||
irc_protocol_tags (
|
||||
command,
|
||||
tags,
|
||||
smart_filter ? "irc_smart_filter" : NULL,
|
||||
(smart_filter) ? "irc_smart_filter" : NULL,
|
||||
NULL,
|
||||
NULL),
|
||||
_("%s%s%s%s has changed real name to %s\"%s%s%s\"%s"),
|
||||
|
||||
@@ -662,32 +662,38 @@ TEST(IrcProtocolWithServer, account_without_account_notify_cap)
|
||||
{
|
||||
struct t_irc_nick *ptr_nick;
|
||||
|
||||
SRV_INIT_JOIN;
|
||||
SRV_INIT_JOIN2;
|
||||
|
||||
ptr_nick = ptr_server->channels->nicks;
|
||||
RECV(":bob!user@host PRIVMSG alice :hi Alice!");
|
||||
|
||||
ptr_nick = ptr_server->channels->last_nick;
|
||||
|
||||
POINTERS_EQUAL(NULL, ptr_nick->account);
|
||||
|
||||
/* not enough parameters */
|
||||
RECV(":alice!user@host ACCOUNT");
|
||||
RECV(":bob!user@host ACCOUNT");
|
||||
CHECK_ERROR_PARAMS("account", 0, 1);
|
||||
|
||||
POINTERS_EQUAL(NULL, ptr_nick->account);
|
||||
|
||||
RECV(":alice!user@host ACCOUNT *");
|
||||
CHECK_CHAN("-- alice has unidentified");
|
||||
RECV(":bob!user@host ACCOUNT *");
|
||||
CHECK_CHAN("-- bob has unidentified");
|
||||
CHECK_PV("bob", "-- bob has unidentified");
|
||||
POINTERS_EQUAL(NULL, ptr_nick->account);
|
||||
|
||||
RECV(":alice!user@host ACCOUNT :*");
|
||||
CHECK_CHAN("-- alice has unidentified");
|
||||
RECV(":bob!user@host ACCOUNT :*");
|
||||
CHECK_CHAN("-- bob has unidentified");
|
||||
CHECK_PV("bob", "-- bob has unidentified");
|
||||
POINTERS_EQUAL(NULL, ptr_nick->account);
|
||||
|
||||
RECV(":alice!user@host ACCOUNT new_account");
|
||||
CHECK_CHAN("-- alice has identified as new_account");
|
||||
RECV(":bob!user@host ACCOUNT new_account");
|
||||
CHECK_CHAN("-- bob has identified as new_account");
|
||||
CHECK_PV("bob", "-- bob has identified as new_account");
|
||||
POINTERS_EQUAL(NULL, ptr_nick->account);
|
||||
|
||||
RECV(":alice!user@host ACCOUNT :new_account");
|
||||
CHECK_CHAN("-- alice has identified as new_account");
|
||||
RECV(":bob!user@host ACCOUNT :new_account");
|
||||
CHECK_CHAN("-- bob has identified as new_account");
|
||||
CHECK_PV("bob", "-- bob has identified as new_account");
|
||||
POINTERS_EQUAL(NULL, ptr_nick->account);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user