diff options
Diffstat (limited to 'src/gnunet_chat_lib_intern.c')
-rw-r--r-- | src/gnunet_chat_lib_intern.c | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/src/gnunet_chat_lib_intern.c b/src/gnunet_chat_lib_intern.c index c4f570b..b9806a9 100644 --- a/src/gnunet_chat_lib_intern.c +++ b/src/gnunet_chat_lib_intern.c @@ -31,50 +31,32 @@ task_handle_destruction (void *cls) struct GNUNET_CHAT_Handle *handle = (struct GNUNET_CHAT_Handle*) cls; - handle->destruction = NULL; - handle_destroy(handle); -} - -void -cb_account_creation (void *cls, - const struct GNUNET_IDENTITY_PrivateKey *key, - const char *emsg) -{ - GNUNET_assert(cls); - - struct GNUNET_CHAT_InternalAccounts *accounts = ( - (struct GNUNET_CHAT_InternalAccounts*) cls - ); - - struct GNUNET_CHAT_Handle *handle = accounts->handle; - - GNUNET_CONTAINER_DLL_remove( - handle->accounts_head, - handle->accounts_tail, - accounts - ); - - GNUNET_free(accounts); - - if (emsg) - handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_WARNING, emsg); - else if (key) - handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_REFRESH, NULL); -} - -void -cb_account_deletion (void *cls, - const char *emsg) -{ - GNUNET_assert(cls); + struct GNUNET_CHAT_InternalAccounts *accounts = handle->accounts_head; + while (accounts) + { + if ((accounts->op) && (accounts->account)) + break; - struct GNUNET_CHAT_Handle *handle = (struct GNUNET_CHAT_Handle*) cls; + accounts = accounts->next; + } - if (emsg) + if (accounts) { - handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_WARNING, emsg); + handle->destruction = GNUNET_SCHEDULER_add_at_with_priority( + GNUNET_TIME_absolute_add( + GNUNET_TIME_absolute_get(), + GNUNET_TIME_relative_get_second_() + ), + GNUNET_SCHEDULER_PRIORITY_IDLE, + task_handle_destruction, + handle + ); + return; } + + handle->destruction = NULL; + handle_destroy(handle); } void |