From 058057c64d88134d396f1cb4e056c7e2941bc603 Mon Sep 17 00:00:00 2001 From: jfreegman Date: Mon, 27 Jun 2022 19:42:38 -0400 Subject: [PATCH] Fix style issues --- src/bootstrap.c | 2 ++ src/groupchats.c | 6 ++++-- src/toxic.c | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/bootstrap.c b/src/bootstrap.c index 40bcd44..d37e4d1 100644 --- a/src/bootstrap.c +++ b/src/bootstrap.c @@ -601,6 +601,7 @@ int load_DHT_nodeslist(void) Nodes.count = 2; #if 0 + if (thread_data.active) { return -1; } @@ -623,6 +624,7 @@ int load_DHT_nodeslist(void) thread_data.active = false; return -5; } + #endif return 0; diff --git a/src/groupchats.c b/src/groupchats.c index 016ee73..475749e 100644 --- a/src/groupchats.c +++ b/src/groupchats.c @@ -991,7 +991,9 @@ static void groupchat_onGroupPeerJoin(ToxWindow *self, Tox *m, uint32_t groupnum ++chat->max_idx; } - if (timed_out(chat->time_connected, 60) && user_settings->show_group_connection_msg == SHOW_GROUP_CONNECTION_MSG_ON) { /* ignore join messages when we first connect to the group */ + if (timed_out(chat->time_connected, 60) + && user_settings->show_group_connection_msg == + SHOW_GROUP_CONNECTION_MSG_ON) { /* ignore join messages when we first connect to the group */ line_info_add(self, true, peer->name, NULL, CONNECTION, 0, GREEN, "has joined the room"); write_to_log("has joined the room", peer->name, self->chatwin->log, true); @@ -1036,7 +1038,7 @@ void groupchat_onGroupPeerExit(ToxWindow *self, Tox *m, uint32_t groupnumber, ui if (user_settings->show_group_connection_msg == SHOW_GROUP_CONNECTION_MSG_ON) { write_to_log(log_str, name, self->chatwin->log, true); } - + sound_notify(self, silent, NT_WNDALERT_2, NULL); } diff --git a/src/toxic.c b/src/toxic.c index 47870d6..b3c1414 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -269,13 +269,20 @@ void cb_toxcore_logger(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t l } struct timeval tv; + gettimeofday(&tv, NULL); + struct tm tmp; + gmtime_r(&tv.tv_sec, &tmp); + char timestamp[200]; + strftime(timestamp, sizeof(timestamp), "%F %T", &tmp); - fprintf(fp, "%c %s.%06ld %s:%u(%s) - %s\n", tox_log_level_show(level)[0], timestamp, tv.tv_usec, file, line, func, message); + fprintf(fp, "%c %s.%06ld %s:%u(%s) - %s\n", tox_log_level_show(level)[0], timestamp, tv.tv_usec, file, line, func, + message); + fflush(fp); }