use account-notify capability

This commit is contained in:
ailin-nemui 2019-08-13 03:36:40 +02:00
commit 44d480ca99
9 changed files with 75 additions and 3 deletions

View file

@ -465,6 +465,26 @@ static void sig_message_host_changed(SERVER_REC *server, const char *nick,
);
}
static void sig_message_account_changed(SERVER_REC *server, const char *nick,
const char *address, const char *account)
{
gboolean logged_in;
int txt;
logged_in = g_strcmp0("*", account) != 0;
txt = logged_in ? TXT_LOGGED_IN : TXT_LOGGED_OUT;
spread_server_message_to_windows(
server,
settings_get_bool("show_quit_once"),
TRUE,
MSGLEVEL_MODES,
txt, txt,
nick, address, account,
"account"
);
}
static void sig_message_quit(SERVER_REC *server, const char *nick,
const char *address, const char *reason)
{
@ -771,6 +791,7 @@ void fe_messages_init(void)
signal_add_last("message own_private", (SIGNAL_FUNC) sig_message_own_private);
signal_add_last("message join", (SIGNAL_FUNC) sig_message_join);
signal_add_last("message host_changed", (SIGNAL_FUNC) sig_message_host_changed);
signal_add_last("message account_changed", (SIGNAL_FUNC) sig_message_account_changed);
signal_add_last("message part", (SIGNAL_FUNC) sig_message_part);
signal_add_last("message quit", (SIGNAL_FUNC) sig_message_quit);
signal_add_last("message kick", (SIGNAL_FUNC) sig_message_kick);
@ -799,6 +820,7 @@ void fe_messages_deinit(void)
signal_remove("message own_private", (SIGNAL_FUNC) sig_message_own_private);
signal_remove("message join", (SIGNAL_FUNC) sig_message_join);
signal_remove("message host_changed", (SIGNAL_FUNC) sig_message_host_changed);
signal_remove("message account_changed", (SIGNAL_FUNC) sig_message_account_changed);
signal_remove("message part", (SIGNAL_FUNC) sig_message_part);
signal_remove("message quit", (SIGNAL_FUNC) sig_message_quit);
signal_remove("message kick", (SIGNAL_FUNC) sig_message_kick);

View file

@ -96,6 +96,8 @@ FORMAT_REC fecommon_core_formats[] = {
{ "join", "{channick_hilight $0} {chanhost_hilight $1} has joined {channel $2}", 5, { 0, 0, 0, 0, 0 } },
{ "host_changed", "{channick_hilight $0} {chanhost_hilight $1} has changed host", 4, { 0, 0, 0, 0 } },
{ "logged_out", "{channick $0} {chanhost $1} has logged out of their account", 4, { 0, 0, 0, 0 } },
{ "logged_in", "{channick_hilight $0} {chanhost_hilight $1} has logged in to account {hilight $2}", 4, { 0, 0, 0, 0 } },
{ "part", "{channick $0} {chanhost $1} has left {channel $2} {reason $3}", 4, { 0, 0, 0, 0 } },
{ "kick", "{channick $0} was kicked from {channel $1} by {nick $2} {reason $3}", 5, { 0, 0, 0, 0, 0 } },
{ "quit", "{channick $0} {chanhost $1} has quit {reason $2}", 4, { 0, 0, 0, 0 } },

View file

@ -72,6 +72,8 @@ enum {
TXT_JOIN,
TXT_HOST_CHANGED,
TXT_LOGGED_OUT,
TXT_LOGGED_IN,
TXT_PART,
TXT_KICK,
TXT_QUIT,