aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet_chat_handle_intern.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnunet_chat_handle_intern.c')
-rw-r--r--src/gnunet_chat_handle_intern.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c
index 63758a8..e278eaf 100644
--- a/src/gnunet_chat_handle_intern.c
+++ b/src/gnunet_chat_handle_intern.c
@@ -219,12 +219,12 @@ notify_handle_fs_progress(void* cls,
219void 219void
220on_handle_gnunet_identity(void *cls, 220on_handle_gnunet_identity(void *cls,
221 struct GNUNET_IDENTITY_Ego *ego, 221 struct GNUNET_IDENTITY_Ego *ego,
222 GNUNET_UNUSED void **ctx, 222 void **ctx,
223 const char *name) 223 const char *name)
224{ 224{
225 struct GNUNET_CHAT_Handle* handle = cls; 225 struct GNUNET_CHAT_Handle* handle = cls;
226 226
227 if (!name) 227 if (!ctx)
228 return; 228 return;
229 229
230 if (!ego) 230 if (!ego)
@@ -241,9 +241,22 @@ on_handle_gnunet_identity(void *cls,
241 goto check_matching_name; 241 goto check_matching_name;
242 242
243 if (name) 243 if (name)
244 {
244 util_set_name_field(name, &(accounts->account->name)); 245 util_set_name_field(name, &(accounts->account->name));
246
247 if (handle->current == accounts->account)
248 handle_send_internal_message(
249 handle,
250 NULL,
251 GNUNET_CHAT_FLAG_LOGIN,
252 NULL
253 );
254 }
245 else 255 else
246 { 256 {
257 if (handle->current == accounts->account)
258 handle_disconnect(handle);
259
247 account_destroy(accounts->account); 260 account_destroy(accounts->account);
248 261
249 GNUNET_CONTAINER_DLL_remove( 262 GNUNET_CONTAINER_DLL_remove(
@@ -269,6 +282,9 @@ skip_account:
269 accounts = accounts->next; 282 accounts = accounts->next;
270 } 283 }
271 284
285 if (!name)
286 return;
287
272 accounts = GNUNET_new(struct GNUNET_CHAT_InternalAccounts); 288 accounts = GNUNET_new(struct GNUNET_CHAT_InternalAccounts);
273 accounts->account = account_create_from_ego(ego, name); 289 accounts->account = account_create_from_ego(ego, name);
274 290