mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:33:02 +01:00
populate friends in toxic on startup
This commit is contained in:
parent
076ea43c07
commit
6df39d572b
21
main.c
21
main.c
@ -286,6 +286,15 @@ static void do_tox()
|
|||||||
doMessenger(m);
|
doMessenger(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void populate_friends()
|
||||||
|
{
|
||||||
|
wprintw(prompt->window, "Populating friends...\n");
|
||||||
|
for (int i = 0; i < m->numfriends; i++) {
|
||||||
|
wprintw(prompt->window, "Added friend %d\n", i);
|
||||||
|
friendlist_onFriendAdded(m, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store Messenger data to path
|
* Store Messenger data to path
|
||||||
* Return 0 Messenger stored successfully
|
* Return 0 Messenger stored successfully
|
||||||
@ -321,6 +330,8 @@ static int store_data(char *path)
|
|||||||
free(buf);
|
free(buf);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
|
||||||
|
wprintw(prompt->window, "Messenger stored\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +359,9 @@ static void load_data(char *path) {
|
|||||||
endwin();
|
endwin();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
Messenger_load(m, buf, len);
|
if (Messenger_load(m, buf, len) != 0) {
|
||||||
|
fprintf(stderr, "Problem while loading messenger");
|
||||||
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
} else {
|
} else {
|
||||||
@ -479,8 +492,10 @@ int main(int argc, char *argv[])
|
|||||||
init_windows();
|
init_windows();
|
||||||
init_window_status();
|
init_window_status();
|
||||||
|
|
||||||
if(f_loadfromfile)
|
if(f_loadfromfile) {
|
||||||
load_data(DATA_FILE);
|
load_data(DATA_FILE);
|
||||||
|
populate_friends();
|
||||||
|
}
|
||||||
|
|
||||||
if (f_flag == -1) {
|
if (f_flag == -1) {
|
||||||
attron(COLOR_PAIR(3) | A_BOLD);
|
attron(COLOR_PAIR(3) | A_BOLD);
|
||||||
|
Loading…
Reference in New Issue
Block a user