Added a data.json file for storing things.
For now, the file contains pending friend requests.
This commit is contained in:
parent
66b7f06002
commit
4dcc088e1d
6 changed files with 105 additions and 25 deletions
|
|
@ -174,9 +174,7 @@ tox_weechat_identity_new(const char *name)
|
|||
identity->buffer = NULL;
|
||||
identity->tox_do_timer = NULL;
|
||||
identity->chats = identity->last_chat = NULL;
|
||||
|
||||
// initialize friend requests
|
||||
tox_weechat_friend_request_init_identity(identity);;
|
||||
identity->friend_requests = identity->last_friend_request = NULL;
|
||||
|
||||
// set up config
|
||||
tox_weechat_config_init_identity(identity);
|
||||
|
|
@ -223,6 +221,13 @@ tox_weechat_identity_connect(struct t_tox_weechat_identity *identity)
|
|||
(uint8_t *)name, strlen(name));
|
||||
}
|
||||
|
||||
// initialize friend requests
|
||||
tox_weechat_friend_request_init_identity(identity);
|
||||
weechat_printf(identity->buffer,
|
||||
"%sYou have %d pending friend requests.",
|
||||
weechat_prefix("network"),
|
||||
identity->friend_request_count);
|
||||
|
||||
// bootstrap DHT
|
||||
int max_bootstrap_nodes = 5;
|
||||
int bootstrap_nodes = max_bootstrap_nodes > tox_weechat_bootstrap_count ?
|
||||
|
|
@ -322,6 +327,10 @@ tox_weechat_identity_for_buffer(struct t_gui_buffer *buffer)
|
|||
void
|
||||
tox_weechat_identity_free(struct t_tox_weechat_identity *identity)
|
||||
{
|
||||
// save friend requests
|
||||
tox_weechat_friend_request_save_identity(identity);
|
||||
tox_weechat_friend_request_free_identity(identity);
|
||||
|
||||
// disconnect
|
||||
tox_weechat_identity_disconnect(identity);
|
||||
|
||||
|
|
@ -337,10 +346,7 @@ tox_weechat_identity_free(struct t_tox_weechat_identity *identity)
|
|||
if (identity->next_identity)
|
||||
identity->next_identity->prev_identity = identity->prev_identity;
|
||||
|
||||
// save friend requests
|
||||
tox_weechat_friend_request_save_identity(identity);
|
||||
tox_weechat_friend_request_free_identity(identity);
|
||||
|
||||
// free remaining vars
|
||||
free(identity->name);
|
||||
free(identity);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue