aboutsummaryrefslogtreecommitdiff
path: root/src/chat/messenger.c
diff options
context:
space:
mode:
authorJacki <jacki@thejackimonster.de>2024-02-10 05:04:49 +0100
committerJacki <jacki@thejackimonster.de>2024-02-10 05:04:49 +0100
commit9f5f98ea13aafc08c3444585b788789ade61bb1f (patch)
treec373a2df1ba135f7c22116952e74f712aecce804 /src/chat/messenger.c
parent5dc6434881b15973742d403cd7ca0cd11f2ade28 (diff)
downloadmessenger-gtk-9f5f98ea13aafc08c3444585b788789ade61bb1f.tar.gz
messenger-gtk-9f5f98ea13aafc08c3444585b788789ade61bb1f.zip
Handle logout of account
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'src/chat/messenger.c')
-rw-r--r--src/chat/messenger.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/chat/messenger.c b/src/chat/messenger.c
index 0e8bcb6..1d6fa33 100644
--- a/src/chat/messenger.c
+++ b/src/chat/messenger.c
@@ -24,20 +24,9 @@
24 24
25#include "messenger.h" 25#include "messenger.h"
26 26
27#include "../contact.h"
28#include "../event.h" 27#include "../event.h"
29#include <gnunet/gnunet_chat_lib.h> 28#include <gnunet/gnunet_chat_lib.h>
30 29
31int
32_chat_messenger_destroy_contacts(UNUSED void *cls,
33 UNUSED struct GNUNET_CHAT_Handle *handle,
34 struct GNUNET_CHAT_Contact *contact)
35{
36 if (contact)
37 contact_destroy_info(contact);
38 return GNUNET_YES;
39}
40
41static void 30static void
42_chat_messenger_quit(void *cls) 31_chat_messenger_quit(void *cls)
43{ 32{
@@ -52,13 +41,7 @@ _chat_messenger_quit(void *cls)
52 if (received < 0) 41 if (received < 0)
53 signal = MESSENGER_FAIL; 42 signal = MESSENGER_FAIL;
54 43
55 // Free contact infos 44 GNUNET_CHAT_disconnect(app->chat.messenger.handle);
56 GNUNET_CHAT_iterate_contacts(
57 app->chat.messenger.handle,
58 _chat_messenger_destroy_contacts,
59 NULL
60 );
61
62 GNUNET_CHAT_stop(app->chat.messenger.handle); 45 GNUNET_CHAT_stop(app->chat.messenger.handle);
63 app->chat.messenger.handle = NULL; 46 app->chat.messenger.handle = NULL;
64 47
@@ -111,6 +94,11 @@ _chat_messenger_message(void *cls,
111 application_call_event(app, event_update_profile); 94 application_call_event(app, event_update_profile);
112 break; 95 break;
113 } 96 }
97 case GNUNET_CHAT_KIND_LOGOUT:
98 {
99 application_call_event(app, event_cleanup_profile);
100 break;
101 }
114 case GNUNET_CHAT_KIND_UPDATE: 102 case GNUNET_CHAT_KIND_UPDATE:
115 { 103 {
116 application_call_message_event( 104 application_call_message_event(