diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-16 14:02:29 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-16 14:02:29 +0100 |
commit | fbeb2aa851dee6cfb83cea0b044df609e029f46c (patch) | |
tree | c9827da973b218ab42001ac1da2f4cb39367ddf0 | |
parent | 0bd5ee192263caa91b13122a23e35f0f8a27d38e (diff) | |
download | messenger-gtk-fbeb2aa851dee6cfb83cea0b044df609e029f46c.tar.gz messenger-gtk-fbeb2aa851dee6cfb83cea0b044df609e029f46c.zip |
Fixed inconsistent user pointers of contacts and filtered contact lists to not include own accounts
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | src/event.c | 4 | ||||
-rw-r--r-- | src/ui/contacts.c | 23 | ||||
-rw-r--r-- | src/ui/new_group.c | 23 |
3 files changed, 9 insertions, 41 deletions
diff --git a/src/event.c b/src/event.c index 3eac66e..732d76c 100644 --- a/src/event.c +++ b/src/event.c | |||
@@ -147,11 +147,13 @@ event_update_profile(MESSENGER_Application *app) | |||
147 | void | 147 | void |
148 | event_update_chats(MESSENGER_Application *app, | 148 | event_update_chats(MESSENGER_Application *app, |
149 | struct GNUNET_CHAT_Context *context, | 149 | struct GNUNET_CHAT_Context *context, |
150 | UNUSED const struct GNUNET_CHAT_Message *msg) | 150 | const struct GNUNET_CHAT_Message *msg) |
151 | { | 151 | { |
152 | if (GNUNET_CHAT_context_get_user_pointer(context)) | 152 | if (GNUNET_CHAT_context_get_user_pointer(context)) |
153 | return; | 153 | return; |
154 | 154 | ||
155 | contact_create_info(GNUNET_CHAT_message_get_sender(msg)); | ||
156 | |||
155 | _add_new_chat_entry(app, context); | 157 | _add_new_chat_entry(app, context); |
156 | } | 158 | } |
157 | 159 | ||
diff --git a/src/ui/contacts.c b/src/ui/contacts.c index 2e445ba..f19c93f 100644 --- a/src/ui/contacts.c +++ b/src/ui/contacts.c | |||
@@ -90,24 +90,15 @@ handle_dialog_destroy(UNUSED GtkWidget *window, | |||
90 | } | 90 | } |
91 | 91 | ||
92 | static int | 92 | static int |
93 | _iterate_clear_contacts(UNUSED void *cls, | ||
94 | UNUSED struct GNUNET_CHAT_Handle *handle, | ||
95 | struct GNUNET_CHAT_Contact *contact) | ||
96 | { | ||
97 | GNUNET_CHAT_contact_set_user_pointer(contact, NULL); | ||
98 | return GNUNET_YES; | ||
99 | } | ||
100 | |||
101 | static int | ||
102 | _iterate_contacts(void *cls, | 93 | _iterate_contacts(void *cls, |
103 | UNUSED struct GNUNET_CHAT_Handle *handle, | 94 | UNUSED struct GNUNET_CHAT_Handle *handle, |
104 | struct GNUNET_CHAT_Contact *contact) | 95 | struct GNUNET_CHAT_Contact *contact) |
105 | { | 96 | { |
106 | MESSENGER_Application *app = (MESSENGER_Application*) cls; | 97 | if (GNUNET_YES == GNUNET_CHAT_contact_is_owned(contact)) |
107 | |||
108 | if (GNUNET_CHAT_contact_get_user_pointer(contact)) | ||
109 | return GNUNET_YES; | 98 | return GNUNET_YES; |
110 | 99 | ||
100 | MESSENGER_Application *app = (MESSENGER_Application*) cls; | ||
101 | |||
111 | const char *title; | 102 | const char *title; |
112 | title = GNUNET_CHAT_contact_get_name(contact); | 103 | title = GNUNET_CHAT_contact_get_name(contact); |
113 | 104 | ||
@@ -119,8 +110,6 @@ _iterate_contacts(void *cls, | |||
119 | entry->entry_box | 110 | entry->entry_box |
120 | ); | 111 | ); |
121 | 112 | ||
122 | GNUNET_CHAT_contact_set_user_pointer(contact, entry); | ||
123 | |||
124 | if (title) | 113 | if (title) |
125 | { | 114 | { |
126 | gtk_label_set_text(entry->title_label, title); | 115 | gtk_label_set_text(entry->title_label, title); |
@@ -201,12 +190,6 @@ ui_contacts_dialog_init(MESSENGER_Application *app, | |||
201 | 190 | ||
202 | GNUNET_CHAT_iterate_contacts( | 191 | GNUNET_CHAT_iterate_contacts( |
203 | app->chat.messenger.handle, | 192 | app->chat.messenger.handle, |
204 | _iterate_clear_contacts, | ||
205 | NULL | ||
206 | ); | ||
207 | |||
208 | GNUNET_CHAT_iterate_contacts( | ||
209 | app->chat.messenger.handle, | ||
210 | _iterate_contacts, | 193 | _iterate_contacts, |
211 | app | 194 | app |
212 | ); | 195 | ); |
diff --git a/src/ui/new_group.c b/src/ui/new_group.c index 6355fcd..3741768 100644 --- a/src/ui/new_group.c +++ b/src/ui/new_group.c | |||
@@ -149,24 +149,15 @@ handle_dialog_destroy(UNUSED GtkWidget *window, | |||
149 | } | 149 | } |
150 | 150 | ||
151 | static int | 151 | static int |
152 | _iterate_clear_contacts(UNUSED void *cls, | ||
153 | UNUSED struct GNUNET_CHAT_Handle *handle, | ||
154 | struct GNUNET_CHAT_Contact *contact) | ||
155 | { | ||
156 | GNUNET_CHAT_contact_set_user_pointer(contact, NULL); | ||
157 | return GNUNET_YES; | ||
158 | } | ||
159 | |||
160 | static int | ||
161 | _iterate_contacts(void *cls, | 152 | _iterate_contacts(void *cls, |
162 | UNUSED struct GNUNET_CHAT_Handle *handle, | 153 | UNUSED struct GNUNET_CHAT_Handle *handle, |
163 | struct GNUNET_CHAT_Contact *contact) | 154 | struct GNUNET_CHAT_Contact *contact) |
164 | { | 155 | { |
165 | MESSENGER_Application *app = (MESSENGER_Application*) cls; | 156 | if (GNUNET_YES == GNUNET_CHAT_contact_is_owned(contact)) |
166 | |||
167 | if (GNUNET_CHAT_contact_get_user_pointer(contact)) | ||
168 | return GNUNET_YES; | 157 | return GNUNET_YES; |
169 | 158 | ||
159 | MESSENGER_Application *app = (MESSENGER_Application*) cls; | ||
160 | |||
170 | const char *title; | 161 | const char *title; |
171 | title = GNUNET_CHAT_contact_get_name(contact); | 162 | title = GNUNET_CHAT_contact_get_name(contact); |
172 | 163 | ||
@@ -178,8 +169,6 @@ _iterate_contacts(void *cls, | |||
178 | entry->entry_box | 169 | entry->entry_box |
179 | ); | 170 | ); |
180 | 171 | ||
181 | GNUNET_CHAT_contact_set_user_pointer(contact, entry); | ||
182 | |||
183 | if (title) | 172 | if (title) |
184 | { | 173 | { |
185 | gtk_label_set_text(entry->title_label, title); | 174 | gtk_label_set_text(entry->title_label, title); |
@@ -324,12 +313,6 @@ ui_new_group_dialog_init(MESSENGER_Application *app, | |||
324 | 313 | ||
325 | GNUNET_CHAT_iterate_contacts( | 314 | GNUNET_CHAT_iterate_contacts( |
326 | app->chat.messenger.handle, | 315 | app->chat.messenger.handle, |
327 | _iterate_clear_contacts, | ||
328 | NULL | ||
329 | ); | ||
330 | |||
331 | GNUNET_CHAT_iterate_contacts( | ||
332 | app->chat.messenger.handle, | ||
333 | _iterate_contacts, | 316 | _iterate_contacts, |
334 | app | 317 | app |
335 | ); | 318 | ); |