diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-02-18 22:54:21 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-02-18 22:54:21 +0100 |
commit | 6b71ae4702f4ee9bea58bb12b1d41d76974a078b (patch) | |
tree | f30d954cb0b4664961f0a627a38be0fe0745c368 | |
parent | 42066201e5b2476463ebc2de1480b027fbe4489f (diff) | |
download | messenger-gtk-6b71ae4702f4ee9bea58bb12b1d41d76974a078b.tar.gz messenger-gtk-6b71ae4702f4ee9bea58bb12b1d41d76974a078b.zip |
Implemented empty text message as silent
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | src/event.c | 7 | ||||
-rw-r--r-- | src/ui/chat.c | 30 | ||||
-rw-r--r-- | src/ui/messenger.c | 2 |
3 files changed, 19 insertions, 20 deletions
diff --git a/src/event.c b/src/event.c index f081e2f..9269b9b 100644 --- a/src/event.c +++ b/src/event.c | |||
@@ -427,6 +427,10 @@ event_receive_message(MESSENGER_Application *app, | |||
427 | return; | 427 | return; |
428 | 428 | ||
429 | const int sent = GNUNET_CHAT_message_is_sent(msg); | 429 | const int sent = GNUNET_CHAT_message_is_sent(msg); |
430 | const gchar *text = GNUNET_CHAT_message_get_text(msg); | ||
431 | |||
432 | if ((text) && (!(*text))) | ||
433 | goto skip_message; | ||
430 | 434 | ||
431 | const UI_MESSAGE_Type type = ( | 435 | const UI_MESSAGE_Type type = ( |
432 | GNUNET_YES == sent? UI_MESSAGE_SENT : UI_MESSAGE_DEFAULT | 436 | GNUNET_YES == sent? UI_MESSAGE_SENT : UI_MESSAGE_DEFAULT |
@@ -455,7 +459,6 @@ event_receive_message(MESSENGER_Application *app, | |||
455 | msg | 459 | msg |
456 | ); | 460 | ); |
457 | 461 | ||
458 | const gchar *text = GNUNET_CHAT_message_get_text(msg); | ||
459 | const gchar *time = GNUNET_STRINGS_absolute_time_to_string(timestamp); | 462 | const gchar *time = GNUNET_STRINGS_absolute_time_to_string(timestamp); |
460 | 463 | ||
461 | if ((!ui_messenger_is_context_active(&(app->ui.messenger), context)) && | 464 | if ((!ui_messenger_is_context_active(&(app->ui.messenger), context)) && |
@@ -472,6 +475,8 @@ event_receive_message(MESSENGER_Application *app, | |||
472 | gtk_label_set_text(message->timestamp_label, time? time : ""); | 475 | gtk_label_set_text(message->timestamp_label, time? time : ""); |
473 | 476 | ||
474 | ui_chat_add_message(handle->chat, app, message); | 477 | ui_chat_add_message(handle->chat, app, message); |
478 | |||
479 | skip_message: | ||
475 | ui_chat_entry_update(handle, app, context); | 480 | ui_chat_entry_update(handle, app, context); |
476 | } | 481 | } |
477 | 482 | ||
diff --git a/src/ui/chat.c b/src/ui/chat.c index 455e3c4..60a4697 100644 --- a/src/ui/chat.c +++ b/src/ui/chat.c | |||
@@ -815,9 +815,18 @@ ui_chat_update(UI_CHAT_Handle *handle, | |||
815 | if (!(handle->messages)) | 815 | if (!(handle->messages)) |
816 | return; | 816 | return; |
817 | 817 | ||
818 | UI_MESSAGE_Handle *message = ( | 818 | GList *list = handle->messages; |
819 | (UI_MESSAGE_Handle*) handle->messages->data | 819 | |
820 | ); | 820 | while (list) |
821 | { | ||
822 | ui_message_refresh((UI_MESSAGE_Handle*) list->data); | ||
823 | list = list->next; | ||
824 | } | ||
825 | |||
826 | UI_MESSAGE_Handle *message = (UI_MESSAGE_Handle*) (handle->messages->data); | ||
827 | |||
828 | if (!(message->timestamp_label)) | ||
829 | return; | ||
821 | 830 | ||
822 | const gchar *time = gtk_label_get_text(message->timestamp_label); | 831 | const gchar *time = gtk_label_get_text(message->timestamp_label); |
823 | 832 | ||
@@ -877,21 +886,6 @@ ui_chat_add_message(UI_CHAT_Handle *handle, | |||
877 | 886 | ||
878 | g_hash_table_insert(app->ui.bindings, row, message); | 887 | g_hash_table_insert(app->ui.bindings, row, message); |
879 | 888 | ||
880 | GList *list = handle->messages; | ||
881 | |||
882 | while (list) | ||
883 | { | ||
884 | UI_MESSAGE_Handle *msg_handle = (UI_MESSAGE_Handle*) list->data; | ||
885 | |||
886 | if (UI_MESSAGE_SENT == msg_handle->type) | ||
887 | { | ||
888 | ui_message_refresh(msg_handle); | ||
889 | break; | ||
890 | } | ||
891 | |||
892 | list = list->next; | ||
893 | } | ||
894 | |||
895 | handle->messages = g_list_prepend(handle->messages, message); | 889 | handle->messages = g_list_prepend(handle->messages, message); |
896 | 890 | ||
897 | gtk_list_box_invalidate_sort(handle->messages_listbox); | 891 | gtk_list_box_invalidate_sort(handle->messages_listbox); |
diff --git a/src/ui/messenger.c b/src/ui/messenger.c index c031b1b..612f568 100644 --- a/src/ui/messenger.c +++ b/src/ui/messenger.c | |||
@@ -232,7 +232,7 @@ handle_chats_listbox_filter_func(GtkListBoxRow *row, | |||
232 | handle->bindings, row | 232 | handle->bindings, row |
233 | ); | 233 | ); |
234 | 234 | ||
235 | if (!entry) | 235 | if ((!entry) || (!(entry->title_label))) |
236 | return FALSE; | 236 | return FALSE; |
237 | 237 | ||
238 | const gchar *title = gtk_label_get_text(entry->title_label); | 238 | const gchar *title = gtk_label_get_text(entry->title_label); |