1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 02:03:13 +02:00

Improve option irc.look.notice_as_pv, new values: auto/never/always

This allows private chat with following nicks: nickserv/chanserv/memoserv.
This commit is contained in:
Sebastien Helleu
2009-06-14 18:50:43 +02:00
parent bf2b06bb03
commit 7d302429d2
13 changed files with 59 additions and 31 deletions
+4 -3
View File
@@ -1188,9 +1188,10 @@ irc_config_init ()
NULL, 1, 60*24*7, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_notice_as_pv = weechat_config_new_option (
irc_config_file, ptr_section,
"notice_as_pv", "boolean",
N_("display notices as private messages"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
"notice_as_pv", "integer",
N_("display notices as private messages (if auto, use private buffer "
"if found)"),
"auto|never|always", 0, 0, "auto", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_topic_strip_colors = weechat_config_new_option (
irc_config_file, ptr_section,
"topic_strip_colors", "boolean",
+7
View File
@@ -35,6 +35,13 @@ enum t_irc_config_look_item_display_server
IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME,
};
enum t_irc_config_look_notice_as_pv
{
IRC_CONFIG_LOOK_NOTICE_AS_PV_AUTO = 0,
IRC_CONFIG_LOOK_NOTICE_AS_PV_NEVER,
IRC_CONFIG_LOOK_NOTICE_AS_PV_ALWAYS,
};
enum t_irc_config_nick_completion
{
IRC_CONFIG_NICK_COMPLETION_SMART_OFF = 0,
+9 -4
View File
@@ -856,10 +856,12 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
notify_private = 1;
}
if (nick && weechat_config_boolean (irc_config_look_notice_as_pv))
ptr_channel = NULL;
if (nick && weechat_config_integer (irc_config_look_notice_as_pv) != IRC_CONFIG_LOOK_NOTICE_AS_PV_NEVER)
{
ptr_channel = irc_channel_search (server, nick);
if (!ptr_channel)
if (!ptr_channel
&& weechat_config_integer (irc_config_look_notice_as_pv) == IRC_CONFIG_LOOK_NOTICE_AS_PV_ALWAYS)
{
ptr_channel = irc_channel_new (server,
IRC_CHANNEL_TYPE_PRIVATE,
@@ -871,15 +873,18 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
"private buffer \"%s\""),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, nick);
return WEECHAT_RC_ERROR;
}
}
}
if (ptr_channel)
{
if (!ptr_channel->topic)
irc_channel_set_topic (ptr_channel, address);
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command,
(notify_private) ? "notify_private" : NULL),
"notify_private"),
"%s%s",
irc_nick_as_prefix (NULL, nick,
IRC_COLOR_CHAT_NICK_OTHER),