messenger-gtk

Gtk+3 graphical user interfaces for GNUnet Messenger
Log | Files | Refs | Submodules | README | LICENSE

commit 7dfbe3d2a461d119bed489635b8c52d9a0eff9f7
parent 65c96249c391e33c478b770c96dd82a660fcd0ff
Author: Jacki <jacki@thejackimonster.de>
Date:   Fri,  4 Jul 2025 16:03:42 +0200

Update invitation if necessary and adjust blocking during group creation

Signed-off-by: Jacki <jacki@thejackimonster.de>

Diffstat:
Msrc/event.c | 100+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Msrc/ui/new_group.c | 6++----
2 files changed, 61 insertions(+), 45 deletions(-)

diff --git a/src/event.c b/src/event.c @@ -689,61 +689,79 @@ event_invitation(MESSENGER_Application *app, if (!invitation) return; - if (app->settings.delete_invitations_delay > 0) - GNUNET_CHAT_message_delete( - msg, - app->settings.delete_invitations_delay - ); + UI_MESSAGE_Handle *message = GNUNET_CHAT_message_get_user_pointer(msg); + enum GNUNET_GenericReturnValue new_message = GNUNET_NO; - const int sent = GNUNET_CHAT_message_is_sent(msg); + if (!message) + { + if (app->settings.delete_invitations_delay > 0) + GNUNET_CHAT_message_delete( + msg, + app->settings.delete_invitations_delay + ); - if ((GNUNET_YES != sent) && (app->settings.send_read_receipts)) - GNUNET_CHAT_context_send_read_receipt(context, msg); + const enum GNUNET_GenericReturnValue sent = + GNUNET_CHAT_message_is_sent(msg); - UI_MESSAGE_Handle *message = ui_message_new(app, UI_MESSAGE_STATUS); - ui_message_update(message, app, msg); + if ((GNUNET_YES != sent) && (app->settings.send_read_receipts)) + GNUNET_CHAT_context_send_read_receipt(context, msg); - struct GNUNET_CHAT_Contact *sender = GNUNET_CHAT_message_get_sender( - msg - ); + message = ui_message_new(app, UI_MESSAGE_STATUS); - struct GNUNET_CHAT_Contact *recipient = GNUNET_CHAT_message_get_recipient( - msg - ); + GNUNET_CHAT_message_set_user_pointer(msg, message); - ui_message_set_contact(message, sender); + new_message = GNUNET_YES; + } - const char *invite_message = ( - GNUNET_YES != GNUNET_CHAT_invitation_is_direct(invitation) - )? _("invited %s to a chat") : _("requested %s to chat"); + if (!message) + return; - const char *recipient_name = ( - (recipient) && - (GNUNET_YES != GNUNET_CHAT_contact_is_owned(recipient)) - )? GNUNET_CHAT_contact_get_name(recipient) : _("you"); + ui_message_update(message, app, msg); - GString *message_string = g_string_new(NULL); - g_string_printf(message_string, invite_message, recipient_name); + if (GNUNET_YES == new_message) + { + struct GNUNET_CHAT_Contact *sender = GNUNET_CHAT_message_get_sender( + msg + ); - if ((!ui_messenger_is_context_active(&(app->ui.messenger), context)) && - (GNUNET_YES == GNUNET_CHAT_message_is_recent(msg))) - _show_notification( - app, - context, - sender, - message_string->str, - "mail-message-new-symbolic", - "im.received" + struct GNUNET_CHAT_Contact *recipient = GNUNET_CHAT_message_get_recipient( + msg ); - ui_label_set_text(message->text_label, message_string->str); - g_string_free(message_string, TRUE); + ui_message_set_contact(message, sender); + + const char *invite_message = ( + GNUNET_YES != GNUNET_CHAT_invitation_is_direct(invitation) + )? _("invited %s to a chat") : _("requested %s to chat"); + + const char *recipient_name = ( + (recipient) && + (GNUNET_YES != GNUNET_CHAT_contact_is_owned(recipient)) + )? GNUNET_CHAT_contact_get_name(recipient) : _("you"); + + GString *message_string = g_string_new(NULL); + g_string_printf(message_string, invite_message, recipient_name); + + if ((!ui_messenger_is_context_active(&(app->ui.messenger), context)) && + (GNUNET_YES == GNUNET_CHAT_message_is_recent(msg))) + _show_notification( + app, + context, + sender, + message_string->str, + "mail-message-new-symbolic", + "im.received" + ); - ui_message_set_status_callback( - message, _event_invitation_action, invitation - ); + ui_label_set_text(message->text_label, message_string->str); + g_string_free(message_string, TRUE); - ui_chat_add_message(handle->chat, app, message); + ui_message_set_status_callback( + message, _event_invitation_action, invitation + ); + + ui_chat_add_message(handle->chat, app, message); + } enqueue_chat_entry_update(handle); } diff --git a/src/ui/new_group.c b/src/ui/new_group.c @@ -47,8 +47,6 @@ _open_new_group(GtkEntry *entry, if ((name) && (strlen(name) > 0)) GNUNET_CHAT_group_set_name(group, name); - application_chat_unlock(app); - GList *selected = gtk_list_box_get_selected_rows(listbox); GList *item = selected; @@ -62,14 +60,14 @@ _open_new_group(GtkEntry *entry, g_object_get_qdata(G_OBJECT(row), app->quarks.data) ); - application_chat_lock(app); GNUNET_CHAT_group_invite_contact(group, contact); - application_chat_unlock(app); } item = item->next; } + application_chat_unlock(app); + if (selected) g_list_free(selected); }