mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 23:53:28 +01:00
fix bug where contacts would appear online twice in a row
This commit is contained in:
parent
4780cfeafc
commit
eaea68c33e
@ -332,7 +332,7 @@ static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num,
|
|||||||
|
|
||||||
if (connection_status == TOX_CONNECTION_NONE)
|
if (connection_status == TOX_CONNECTION_NONE)
|
||||||
--Friends.num_online;
|
--Friends.num_online;
|
||||||
else
|
else if (Friends.list[num].connection_status == TOX_CONNECTION_NONE)
|
||||||
++Friends.num_online;
|
++Friends.num_online;
|
||||||
|
|
||||||
Friends.list[num].connection_status = connection_status;
|
Friends.list[num].connection_status = connection_status;
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "toxic.h"
|
#include "toxic.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "prompt.h"
|
#include "prompt.h"
|
||||||
|
#include "friendlist.h"
|
||||||
#include "execute.h"
|
#include "execute.h"
|
||||||
#include "misc_tools.h"
|
#include "misc_tools.h"
|
||||||
#include "toxic_strings.h"
|
#include "toxic_strings.h"
|
||||||
@ -46,6 +47,7 @@ extern ToxWindow *prompt;
|
|||||||
extern struct user_settings *user_settings;
|
extern struct user_settings *user_settings;
|
||||||
extern struct Winthread Winthread;
|
extern struct Winthread Winthread;
|
||||||
|
|
||||||
|
extern FriendsList Friends;
|
||||||
FriendRequests FrndRequests;
|
FriendRequests FrndRequests;
|
||||||
|
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
@ -346,7 +348,7 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, uint32_t friendnu
|
|||||||
get_time_str(timefrmt, sizeof(timefrmt));
|
get_time_str(timefrmt, sizeof(timefrmt));
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
|
||||||
if (connection_status != TOX_CONNECTION_NONE) {
|
if (connection_status != TOX_CONNECTION_NONE && Friends.list[friendnum].connection_status == TOX_CONNECTION_NONE) {
|
||||||
msg = "has come online";
|
msg = "has come online";
|
||||||
line_info_add(self, timefrmt, nick, NULL, CONNECTION, 0, GREEN, msg);
|
line_info_add(self, timefrmt, nick, NULL, CONNECTION, 0, GREEN, msg);
|
||||||
write_to_log(msg, nick, ctx->log, true);
|
write_to_log(msg, nick, ctx->log, true);
|
||||||
@ -357,7 +359,8 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, uint32_t friendnu
|
|||||||
else
|
else
|
||||||
box_notify(self, user_log_in, NT_WNDALERT_2 | NT_NOTIFWND | NT_RESTOL, &self->active_box,
|
box_notify(self, user_log_in, NT_WNDALERT_2 | NT_NOTIFWND | NT_RESTOL, &self->active_box,
|
||||||
"Toxic", "%s has come online", nick );
|
"Toxic", "%s has come online", nick );
|
||||||
} else {
|
}
|
||||||
|
else if (connection_status == TOX_CONNECTION_NONE) {
|
||||||
msg = "has gone offline";
|
msg = "has gone offline";
|
||||||
line_info_add(self, timefrmt, nick, NULL, DISCONNECTION, 0, RED, msg);
|
line_info_add(self, timefrmt, nick, NULL, DISCONNECTION, 0, RED, msg);
|
||||||
write_to_log(msg, nick, ctx->log, true);
|
write_to_log(msg, nick, ctx->log, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user