mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 23:36:37 +02:00
irc: display messages 730/731 even if command /notify was not used (closes #2049)
This commit is contained in:
@@ -671,6 +671,45 @@ irc_notify_send_signal (struct t_irc_notify *notify,
|
||||
free (data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display message about nick: "is connected", "is offline", "has connected",
|
||||
* "has quit".
|
||||
*
|
||||
* If "notify" is NULL, only "is connected" or "is offline" can be displayed.
|
||||
*/
|
||||
|
||||
void
|
||||
irc_notify_display_is_on (struct t_irc_server *server,
|
||||
const char *nick,
|
||||
const char *host,
|
||||
struct t_irc_notify *notify,
|
||||
int is_on_server)
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
server->buffer,
|
||||
0,
|
||||
irc_notify_get_tags (irc_config_look_notify_tags_ison,
|
||||
(is_on_server) ? "join" : "quit",
|
||||
nick),
|
||||
(!notify || (notify->is_on_server < 0)) ?
|
||||
((is_on_server) ?
|
||||
_("%snotify: %s%s%s%s%s%s%s%s%s is connected") :
|
||||
_("%snotify: %s%s%s%s%s%s%s%s%s is offline")) :
|
||||
((is_on_server) ?
|
||||
_("%snotify: %s%s%s%s%s%s%s%s%s has connected") :
|
||||
_("%snotify: %s%s%s%s%s%s%s%s%s has quit")),
|
||||
weechat_prefix ("network"),
|
||||
irc_nick_color_for_msg (server, 1, NULL, nick),
|
||||
nick,
|
||||
(host && host[0]) ? IRC_COLOR_CHAT_DELIMITERS : "",
|
||||
(host && host[0]) ? " (" : "",
|
||||
(host && host[0]) ? IRC_COLOR_CHAT_HOST : "",
|
||||
(host && host[0]) ? host : "",
|
||||
(host && host[0]) ? IRC_COLOR_CHAT_DELIMITERS : "",
|
||||
(host && host[0]) ? ")" : "",
|
||||
(is_on_server) ? IRC_COLOR_MESSAGE_JOIN : IRC_COLOR_MESSAGE_QUIT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets flag "is_on_server" for a notify and display message if user was not on
|
||||
* server.
|
||||
@@ -687,29 +726,9 @@ irc_notify_set_is_on_server (struct t_irc_notify *notify, const char *host,
|
||||
if (notify->is_on_server == is_on_server)
|
||||
return;
|
||||
|
||||
weechat_printf_date_tags (
|
||||
notify->server->buffer,
|
||||
0,
|
||||
irc_notify_get_tags (irc_config_look_notify_tags_ison,
|
||||
(is_on_server) ? "join" : "quit",
|
||||
notify->nick),
|
||||
(notify->is_on_server < 0) ?
|
||||
((is_on_server) ?
|
||||
_("%snotify: %s%s%s%s%s%s%s%s%s is connected") :
|
||||
_("%snotify: %s%s%s%s%s%s%s%s%s is offline")) :
|
||||
((is_on_server) ?
|
||||
_("%snotify: %s%s%s%s%s%s%s%s%s has connected") :
|
||||
_("%snotify: %s%s%s%s%s%s%s%s%s has quit")),
|
||||
weechat_prefix ("network"),
|
||||
irc_nick_color_for_msg (notify->server, 1, NULL, notify->nick),
|
||||
notify->nick,
|
||||
(host && host[0]) ? IRC_COLOR_CHAT_DELIMITERS : "",
|
||||
(host && host[0]) ? " (" : "",
|
||||
(host && host[0]) ? IRC_COLOR_CHAT_HOST : "",
|
||||
(host && host[0]) ? host : "",
|
||||
(host && host[0]) ? IRC_COLOR_CHAT_DELIMITERS : "",
|
||||
(host && host[0]) ? ")" : "",
|
||||
(is_on_server) ? IRC_COLOR_MESSAGE_JOIN : IRC_COLOR_MESSAGE_QUIT);
|
||||
irc_notify_display_is_on (notify->server, notify->nick, host,
|
||||
notify, is_on_server);
|
||||
|
||||
irc_notify_send_signal (notify, (is_on_server) ? "join" : "quit", NULL);
|
||||
|
||||
notify->is_on_server = is_on_server;
|
||||
|
||||
@@ -55,6 +55,11 @@ extern void irc_notify_new_for_server (struct t_irc_server *server);
|
||||
extern void irc_notify_new_for_all_servers ();
|
||||
extern void irc_notify_free (struct t_irc_server *server,
|
||||
struct t_irc_notify *notify, int remove_monitor);
|
||||
extern void irc_notify_display_is_on (struct t_irc_server *server,
|
||||
const char *nick,
|
||||
const char *host,
|
||||
struct t_irc_notify *notify,
|
||||
int is_on_server);
|
||||
extern void irc_notify_set_is_on_server (struct t_irc_notify *notify,
|
||||
const char *host, int is_on_server);
|
||||
extern void irc_notify_free_all (struct t_irc_server *server);
|
||||
|
||||
@@ -7640,7 +7640,17 @@ IRC_PROTOCOL_CALLBACK(730)
|
||||
monitor_host++;
|
||||
ptr_notify = irc_notify_search (ctxt->server, monitor_nick);
|
||||
if (ptr_notify)
|
||||
{
|
||||
irc_notify_set_is_on_server (ptr_notify, monitor_host, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_notify_display_is_on (ctxt->server,
|
||||
monitor_nick,
|
||||
monitor_host,
|
||||
NULL, /* notify */
|
||||
1);
|
||||
}
|
||||
}
|
||||
weechat_string_free_split (nicks);
|
||||
}
|
||||
@@ -7688,7 +7698,17 @@ IRC_PROTOCOL_CALLBACK(731)
|
||||
monitor_host++;
|
||||
ptr_notify = irc_notify_search (ctxt->server, monitor_nick);
|
||||
if (ptr_notify)
|
||||
{
|
||||
irc_notify_set_is_on_server (ptr_notify, monitor_host, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_notify_display_is_on (ctxt->server,
|
||||
monitor_nick,
|
||||
monitor_host,
|
||||
NULL, /* notify */
|
||||
0);
|
||||
}
|
||||
}
|
||||
weechat_string_free_split (nicks);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user