src/twc-profile.c

This commit is contained in:
emdee@spm.plastiras.org 2024-04-30 08:51:38 +00:00
parent 1a18e112a7
commit 1941bdcd64

View File

@ -575,26 +575,34 @@ twc_profile_set_online_status(struct t_twc_profile *profile, bool status)
if (!(profile)) { if (!(profile)) {
weechat_printf(profile->buffer, "%sno profile", weechat_printf(profile->buffer, "%sno profile",
weechat_prefix("network")); weechat_prefix("network"));
} else if (profile->tox_online ^ status) { return;
TOX_CONNECTION connection = tox_self_get_connection_status(profile->tox); }
/* failsafe - called while exiting! */
if (!(profile->tox)) {
weechat_printf(profile->buffer, "%sno tox",
weechat_prefix("network"));
return;
}
if (profile->tox_online ^ status) {
TOX_CONNECTION connection = tox_self_get_connection_status(profile->tox);
profile->tox_online = status; profile->tox_online = status;
twc_profile_refresh_online_status(); twc_profile_refresh_online_status();
if (connection == TOX_CONNECTION_TCP) if (connection == TOX_CONNECTION_TCP)
{ {
weechat_printf(profile->buffer, "%sprofile %s TCP", weechat_printf(profile->buffer, "%sprofile %s TCP",
weechat_prefix("network"), profile->name); weechat_prefix("network"), profile->name);
} }
else if (connection == TOX_CONNECTION_UDP) else if (connection == TOX_CONNECTION_UDP)
{ {
weechat_printf(profile->buffer, "%sprofile %s UDP", weechat_printf(profile->buffer, "%sprofile %s UDP",
weechat_prefix("network"), profile->name); weechat_prefix("network"), profile->name);
} }
else else
{ {
weechat_printf(profile->buffer, "%sprofile %s disconnected", weechat_printf(profile->buffer, "%sprofile %s disconnected",
weechat_prefix("network"), profile->name); weechat_prefix("network"), profile->name);
} }
} }
} }