1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-14 05:53:01 +01:00

A couple small fixes

This commit is contained in:
jfreegman 2020-05-19 21:44:35 -04:00
parent dcf3baf60f
commit f012007cc4
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 12 additions and 8 deletions

View File

@ -308,7 +308,9 @@ void sort_friendlist_index(void)
}
}
qsort(Friends.index, Friends.num_friends, sizeof(uint32_t), index_name_cmp);
if (Friends.num_friends > 0) {
qsort(Friends.index, Friends.num_friends, sizeof(uint32_t), index_name_cmp);
}
}
static int index_name_cmp_block(const void *n1, const void *n2)

View File

@ -235,6 +235,7 @@ void cb_toxcore_logger(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t l
if (user_data) {
FILE *fp = (FILE *)user_data;
fprintf(fp, "[%d] %u:%s() - %s\n", level, line, func, message);
fflush(fp);
} else {
fprintf(stderr, "[%d] %u:%s() - %s\n", level, line, func, message);
}
@ -354,17 +355,18 @@ static void load_friendlist(Tox *m)
sort_friendlist_index();
}
static void load_groups(Tox *m)
static void load_conferences(Tox *m)
{
size_t i;
size_t num_chats = tox_conference_get_chatlist_size(m);
uint32_t chatlist[num_chats];
if (num_chats) {
tox_conference_get_chatlist(m, chatlist);
if (num_chats == 0) {
return;
}
for (i = 0; i < num_chats; ++i) {
uint32_t chatlist[num_chats];
tox_conference_get_chatlist(m, chatlist);
for (size_t i = 0; i < num_chats; ++i) {
uint32_t groupnum = chatlist[i];
if (get_num_active_windows() >= MAX_WINDOWS_NUM) {
@ -1371,7 +1373,7 @@ int main(int argc, char **argv)
prompt = init_windows(m);
prompt_init_statusbar(prompt, m, !datafile_exists);
load_groups(m);
load_conferences(m);
/* thread for ncurses stuff */
if (pthread_mutex_init(&Winthread.lock, NULL) != 0) {