diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala index 04c7d1a5..01687083 100644 --- a/libdino/src/service/message_processor.vala +++ b/libdino/src/service/message_processor.vala @@ -472,8 +472,7 @@ public class MessageProcessor : StreamInteractionModule, Object { string fallback = FallbackBody.get_quoted_fallback_body(content_item); - long fallback_length = fallback.length; - var fallback_location = new Xep.FallbackIndication.FallbackLocation(0, (int)fallback_length); + var fallback_location = new Xep.FallbackIndication.FallbackLocation(0, (int)fallback.char_count()); Xep.FallbackIndication.set_fallback(new_stanza, new Xep.FallbackIndication.Fallback(Xep.Replies.NS_URI, new Xep.FallbackIndication.FallbackLocation[] { fallback_location })); return fallback; diff --git a/libdino/src/service/replies.vala b/libdino/src/service/replies.vala index 2bb10e0b..58d44b37 100644 --- a/libdino/src/service/replies.vala +++ b/libdino/src/service/replies.vala @@ -105,7 +105,8 @@ namespace Dino { string body = message.body; foreach (var fallback in message.get_fallbacks()) { if (fallback.ns_uri == Xep.Replies.NS_URI && message.quoted_item_id > 0) { - body = body[0:fallback.locations[0].from_char] + body[fallback.locations[0].to_char:body.length]; + body = body[0:body.index_of_nth_char(fallback.locations[0].from_char)] + + body[body.index_of_nth_char(fallback.locations[0].to_char):body.length]; } } return body; diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 9a48bb4e..abcf01ba 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -17,9 +17,7 @@ find_packages(MAIN_PACKAGES REQUIRED set(RESOURCE_LIST dino-conversation-list-placeholder-arrow.svg - icons/scalable/actions/dino-account-plus-symbolic.svg icons/scalable/actions/dino-emoticon-add-symbolic.svg - icons/scalable/actions/dino-emoticon-symbolic.svg icons/scalable/actions/dino-qr-code-symbolic.svg icons/scalable/apps/im.dino.Dino.svg @@ -42,8 +40,6 @@ set(RESOURCE_LIST icons/scalable/mimetypes/dino-file-video-symbolic.svg icons/scalable/status/dino-double-tick-symbolic.svg - icons/scalable/status/dino-microphone-off-symbolic.svg - icons/scalable/status/dino-microphone-symbolic.svg icons/scalable/status/dino-party-popper-symbolic.svg icons/scalable/status/dino-security-high-symbolic.svg icons/scalable/status/dino-status-away.svg @@ -71,6 +67,7 @@ set(RESOURCE_LIST file_default_widget.ui file_send_overlay.ui global_search.ui + gtk/help-overlay.ui conversation_content_view/item_metadata_header.ui conversation_content_view/view.ui manage_accounts/account_row.ui @@ -86,7 +83,6 @@ set(RESOURCE_LIST quote.ui search_autocomplete.ui settings_dialog.ui - shortcuts.ui unified_main_content.ui unified_window_placeholder.ui diff --git a/main/data/chat_input.ui b/main/data/chat_input.ui index 5e84c360..cde00b22 100644 --- a/main/data/chat_input.ui +++ b/main/data/chat_input.ui @@ -51,7 +51,7 @@ - dino-emoticon-symbolic + emoji-people-symbolic False 2 start @@ -85,6 +85,7 @@ 3 14 14 + True diff --git a/main/data/file_default_widget.ui b/main/data/file_default_widget.ui index 77ddebd1..bc89df1b 100644 --- a/main/data/file_default_widget.ui +++ b/main/data/file_default_widget.ui @@ -80,7 +80,7 @@ - open-menu-symbolic + view-more-symbolic 0 False @@ -90,4 +90,4 @@ - \ No newline at end of file + diff --git a/main/data/gresource.xml b/main/data/gresource.xml index 6d9febab..656defc4 100644 --- a/main/data/gresource.xml +++ b/main/data/gresource.xml @@ -20,9 +20,8 @@ file_default_widget.ui file_send_overlay.ui global_search.ui - icons/scalable/actions/dino-account-plus-symbolic.svg + gtk/help-overlay.ui icons/scalable/actions/dino-emoticon-add-symbolic.svg - icons/scalable/actions/dino-emoticon-symbolic.svg icons/scalable/actions/dino-qr-code-symbolic.svg icons/scalable/apps/im.dino.Dino-symbolic.svg icons/scalable/apps/im.dino.Dino.svg @@ -41,8 +40,6 @@ icons/scalable/mimetypes/dino-file-table-symbolic.svg icons/scalable/mimetypes/dino-file-video-symbolic.svg icons/scalable/status/dino-double-tick-symbolic.svg - icons/scalable/status/dino-microphone-off-symbolic.svg - icons/scalable/status/dino-microphone-symbolic.svg icons/scalable/status/dino-party-popper-symbolic.svg icons/scalable/status/dino-security-high-symbolic.svg icons/scalable/status/dino-status-away.svg @@ -65,7 +62,6 @@ quote.ui search_autocomplete.ui settings_dialog.ui - shortcuts.ui style-dark.css style.css unified_main_content.ui diff --git a/main/data/shortcuts.ui b/main/data/gtk/help-overlay.ui similarity index 88% rename from main/data/shortcuts.ui rename to main/data/gtk/help-overlay.ui index 30b5ab83..17b0555c 100644 --- a/main/data/shortcuts.ui +++ b/main/data/gtk/help-overlay.ui @@ -1,6 +1,6 @@ - + True @@ -20,6 +20,12 @@ Join Channel + + + <ctrl>question + Keyboard shortcuts + + diff --git a/main/data/icons/scalable/actions/dino-account-plus-symbolic.svg b/main/data/icons/scalable/actions/dino-account-plus-symbolic.svg deleted file mode 100644 index cf743afa..00000000 --- a/main/data/icons/scalable/actions/dino-account-plus-symbolic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/main/data/icons/scalable/actions/dino-emoticon-add-symbolic.svg b/main/data/icons/scalable/actions/dino-emoticon-add-symbolic.svg index 51cc75c6..649bd9de 100644 --- a/main/data/icons/scalable/actions/dino-emoticon-add-symbolic.svg +++ b/main/data/icons/scalable/actions/dino-emoticon-add-symbolic.svg @@ -1,5 +1,8 @@ - - - + + + + + + diff --git a/main/data/icons/scalable/actions/dino-emoticon-symbolic.svg b/main/data/icons/scalable/actions/dino-emoticon-symbolic.svg deleted file mode 100644 index 5656303d..00000000 --- a/main/data/icons/scalable/actions/dino-emoticon-symbolic.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/main/data/icons/scalable/devices/dino-phone-hangup-symbolic.svg b/main/data/icons/scalable/devices/dino-phone-hangup-symbolic.svg index ecd230ac..542533ba 100644 --- a/main/data/icons/scalable/devices/dino-phone-hangup-symbolic.svg +++ b/main/data/icons/scalable/devices/dino-phone-hangup-symbolic.svg @@ -1 +1,38 @@ - \ No newline at end of file + + + + + + + + diff --git a/main/data/icons/scalable/devices/dino-phone-in-talk-symbolic.svg b/main/data/icons/scalable/devices/dino-phone-in-talk-symbolic.svg index 351035da..905eb1ac 100644 --- a/main/data/icons/scalable/devices/dino-phone-in-talk-symbolic.svg +++ b/main/data/icons/scalable/devices/dino-phone-in-talk-symbolic.svg @@ -1 +1,6 @@ - \ No newline at end of file + + + + + + diff --git a/main/data/icons/scalable/devices/dino-phone-missed-symbolic.svg b/main/data/icons/scalable/devices/dino-phone-missed-symbolic.svg index 228f073e..ca8e6978 100644 --- a/main/data/icons/scalable/devices/dino-phone-missed-symbolic.svg +++ b/main/data/icons/scalable/devices/dino-phone-missed-symbolic.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + diff --git a/main/data/icons/scalable/devices/dino-phone-ring-symbolic.svg b/main/data/icons/scalable/devices/dino-phone-ring-symbolic.svg index 06b8dcbf..13b32842 100644 --- a/main/data/icons/scalable/devices/dino-phone-ring-symbolic.svg +++ b/main/data/icons/scalable/devices/dino-phone-ring-symbolic.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/main/data/icons/scalable/devices/dino-phone-symbolic.svg b/main/data/icons/scalable/devices/dino-phone-symbolic.svg index 0020dddc..14c2225b 100644 --- a/main/data/icons/scalable/devices/dino-phone-symbolic.svg +++ b/main/data/icons/scalable/devices/dino-phone-symbolic.svg @@ -1 +1,8 @@ - \ No newline at end of file + + + + + + + + diff --git a/main/data/icons/scalable/status/dino-microphone-off-symbolic.svg b/main/data/icons/scalable/status/dino-microphone-off-symbolic.svg deleted file mode 100644 index 7e5b853d..00000000 --- a/main/data/icons/scalable/status/dino-microphone-off-symbolic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/main/data/icons/scalable/status/dino-microphone-symbolic.svg b/main/data/icons/scalable/status/dino-microphone-symbolic.svg deleted file mode 100644 index fbf0784a..00000000 --- a/main/data/icons/scalable/status/dino-microphone-symbolic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/main/data/icons/scalable/status/dino-video-off-symbolic.svg b/main/data/icons/scalable/status/dino-video-off-symbolic.svg index d438e065..6bfa690a 100644 --- a/main/data/icons/scalable/status/dino-video-off-symbolic.svg +++ b/main/data/icons/scalable/status/dino-video-off-symbolic.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + diff --git a/main/data/icons/scalable/status/dino-video-symbolic.svg b/main/data/icons/scalable/status/dino-video-symbolic.svg index 60a1c742..2896c22d 100644 --- a/main/data/icons/scalable/status/dino-video-symbolic.svg +++ b/main/data/icons/scalable/status/dino-video-symbolic.svg @@ -1 +1,5 @@ - \ No newline at end of file + + + + + diff --git a/main/data/im.dino.Dino.desktop b/main/data/im.dino.Dino.desktop index 8c04dc34..647783b2 100644 --- a/main/data/im.dino.Dino.desktop +++ b/main/data/im.dino.Dino.desktop @@ -11,3 +11,4 @@ Type=Application Categories=GTK;Network;Chat;InstantMessaging; X-GNOME-UsesNotifications=true MimeType=x-scheme-handler/xmpp; +X-Purism-FormFactor=Workstation;Mobile; diff --git a/main/data/menu_app.ui b/main/data/menu_app.ui index f269e219..bb33ff65 100644 --- a/main/data/menu_app.ui +++ b/main/data/menu_app.ui @@ -13,7 +13,7 @@ Preferences - app.open_shortcuts + win.show-help-overlay Keyboard Shortcuts diff --git a/main/data/message_item_widget_edit_mode.ui b/main/data/message_item_widget_edit_mode.ui index 907dbbf0..e1ca4bc4 100644 --- a/main/data/message_item_widget_edit_mode.ui +++ b/main/data/message_item_widget_edit_mode.ui @@ -27,7 +27,7 @@ - dino-emoticon-symbolic + emoji-people-symbolic 1 diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 36f08f60..2e785224 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -194,19 +194,6 @@ public class Dino.Ui.Application : Adw.Application, Dino.Application { add_action(loop_conversations_bw_action); set_accels_for_action("app.loop_conversations_bw", KEY_COMBINATION_LOOP_CONVERSATIONS_REV); - SimpleAction open_shortcuts_action = new SimpleAction("open_shortcuts", null); - open_shortcuts_action.activate.connect((variant) => { - Builder builder = new Builder.from_resource("/im/dino/Dino/shortcuts.ui"); - ShortcutsWindow dialog = (ShortcutsWindow) builder.get_object("shortcuts-window"); - if (!use_csd()) { - dialog.set_titlebar(null); - } - dialog.title = _("Keyboard Shortcuts"); - dialog.set_transient_for(get_active_window()); - dialog.present(); - }); - add_action(open_shortcuts_action); - SimpleAction accept_call_action = new SimpleAction("accept-call", new VariantType.tuple(new VariantType[]{VariantType.INT32, VariantType.INT32})); accept_call_action.activate.connect((variant) => { int conversation_id = variant.get_child_value(0).get_int32(); diff --git a/main/src/ui/call_window/call_bottom_bar.vala b/main/src/ui/call_window/call_bottom_bar.vala index dfa2e4c6..641a4def 100644 --- a/main/src/ui/call_window/call_bottom_bar.vala +++ b/main/src/ui/call_window/call_bottom_bar.vala @@ -113,11 +113,11 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { public void on_audio_enabled_changed() { if (audio_enabled) { - audio_image.icon_name = "dino-microphone-symbolic"; + audio_image.icon_name = "audio-input-microphone-symbolic"; audio_button.add_css_class("white-button"); audio_button.remove_css_class("transparent-white-button"); } else { - audio_image.icon_name = "dino-microphone-off-symbolic"; + audio_image.icon_name = "microphone-disabled-symbolic"; audio_button.remove_css_class("white-button"); audio_button.add_css_class("transparent-white-button"); } @@ -145,4 +145,4 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { return (video_settings_button.popover != null && video_settings_button.popover.visible) || (audio_settings_button.popover != null && audio_settings_button.popover.visible); } -} \ No newline at end of file +} diff --git a/main/src/ui/call_window/participant_widget.vala b/main/src/ui/call_window/participant_widget.vala index bed64c30..0940bc9e 100644 --- a/main/src/ui/call_window/participant_widget.vala +++ b/main/src/ui/call_window/participant_widget.vala @@ -17,8 +17,8 @@ namespace Dino.Ui { public Box title_box = new Box(Orientation.VERTICAL, 0) { valign=Align.CENTER, hexpand=true }; public MenuButton encryption_button = new MenuButton() { opacity=0, has_frame=false, height_request=30, width_request=30, margin_end=5 }; public CallEncryptionButtonController encryption_button_controller; - public MenuButton menu_button = new MenuButton() { icon_name="open-menu-symbolic", has_frame=false }; - public Button invite_button = new Button.from_icon_name("dino-account-plus") { has_frame=false }; + public MenuButton menu_button = new MenuButton() { icon_name="view-more-symbolic", has_frame=false }; + public Button invite_button = new Button.from_icon_name("contact-new-symbolic") { has_frame=false }; public bool shows_video = false; public string? participant_name; @@ -140,4 +140,4 @@ namespace Dino.Ui { invite_button.visible = may_show_invite_button && is_highest_row && is_start_row; } } -} \ No newline at end of file +} diff --git a/main/src/ui/chat_input/chat_text_view.vala b/main/src/ui/chat_input/chat_text_view.vala index 3752a1cf..72ebc845 100644 --- a/main/src/ui/chat_input/chat_text_view.vala +++ b/main/src/ui/chat_input/chat_text_view.vala @@ -94,8 +94,13 @@ public class ChatTextView : Box { } } - private bool on_text_input_key_press(uint keyval, uint keycode, Gdk.ModifierType state) { + private bool on_text_input_key_press(EventControllerKey controller, uint keyval, uint keycode, Gdk.ModifierType state) { if (keyval in new uint[]{ Key.Return, Key.KP_Enter }) { + // Allow the text view to process the event. Needed for IME. + if (text_view.im_context_filter_keypress(controller.get_current_event())) { + return true; + } + if ((state & ModifierType.SHIFT_MASK) > 0) { text_view.buffer.insert_at_cursor("\n", 1); } else if (text_view.buffer.text.strip() != "") { diff --git a/main/src/ui/conversation_content_view/conversation_view.vala b/main/src/ui/conversation_content_view/conversation_view.vala index badc6c65..cc63037f 100644 --- a/main/src/ui/conversation_content_view/conversation_view.vala +++ b/main/src/ui/conversation_content_view/conversation_view.vala @@ -95,7 +95,6 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug EventControllerMotion main_wrap_motion_events = new EventControllerMotion(); main_wrap_box.add_controller(main_wrap_motion_events); main_wrap_motion_events.leave.connect(on_leave_notify_event); - main_wrap_motion_events.enter.connect(update_highlight); // The buttons of the overlaying message_menu_box may partially overlap the adjacent // conversation items. We connect to the main_event_box directly to avoid emitting // the pointer motion events as long as the pointer is above the message menu. diff --git a/main/src/ui/conversation_content_view/file_image_widget.vala b/main/src/ui/conversation_content_view/file_image_widget.vala index c8eaaec5..4d81d762 100644 --- a/main/src/ui/conversation_content_view/file_image_widget.vala +++ b/main/src/ui/conversation_content_view/file_image_widget.vala @@ -48,7 +48,7 @@ public class FileImageWidget : Box { string? mime_type = Dino.Util.get_content_type(file_info); MenuButton button = new MenuButton(); - button.icon_name = "open-menu"; + button.icon_name = "view-more"; Menu menu_model = new Menu(); menu_model.append(_("Open"), "file.open"); menu_model.append(_("Save as…"), "file.save_as"); diff --git a/main/src/ui/conversation_titlebar/menu_entry.vala b/main/src/ui/conversation_titlebar/menu_entry.vala index 7b484219..d0b9fbcd 100644 --- a/main/src/ui/conversation_titlebar/menu_entry.vala +++ b/main/src/ui/conversation_titlebar/menu_entry.vala @@ -11,7 +11,7 @@ class MenuEntry : Plugins.ConversationTitlebarEntry, Object { StreamInteractor stream_interactor; private Conversation? conversation; - Button button = new Button() { icon_name="open-menu-symbolic" }; + Button button = new Button() { icon_name="view-more-symbolic" }; public MenuEntry(StreamInteractor stream_interactor) { this.stream_interactor = stream_interactor; diff --git a/main/src/ui/main_window.vala b/main/src/ui/main_window.vala index 9121b91e..dd54052e 100644 --- a/main/src/ui/main_window.vala +++ b/main/src/ui/main_window.vala @@ -6,7 +6,7 @@ using Dino.Entities; namespace Dino.Ui { -public class MainWindow : Adw.Window { +public class MainWindow : Adw.ApplicationWindow { public signal void conversation_selected(Conversation conversation); diff --git a/plugins/ice/src/dtls_srtp.vala b/plugins/ice/src/dtls_srtp.vala index 298c0061..c9813b7e 100644 --- a/plugins/ice/src/dtls_srtp.vala +++ b/plugins/ice/src/dtls_srtp.vala @@ -38,7 +38,11 @@ public class Handler { } public uint8[]? process_incoming_data(uint component_id, uint8[] data) throws Crypto.Error { - if (srtp_session.has_decrypt) { + if (data[0] >= 128) { + if (!srtp_session.has_decrypt) { + debug("Received data before SRTP session is ready, dropping."); + return null; + } if (component_id == 1) { if (data.length >= 2 && data[1] >= 192 && data[1] < 224) { return srtp_session.decrypt_rtcp(data); @@ -46,9 +50,12 @@ public class Handler { return srtp_session.decrypt_rtp(data); } if (component_id == 2) return srtp_session.decrypt_rtcp(data); - } else if (component_id == 1) { - on_data_rec(data); } + if (component_id == 1 && data.length >= 1 && (data[0] >= 20 && data[0] < 64)) { + on_data_rec(data); + return null; + } + debug("Dropping unknown data from component %u", component_id); return null; } @@ -79,7 +86,7 @@ public class Handler { err = private_key.generate(PKAlgorithm.ECDSA, 256); throw_if_error(err); - var start_time = new DateTime.now_local().add_days(1); + var start_time = new DateTime.now_local().add_days(-1); var end_time = start_time.add_days(2); X509.Certificate cert = X509.Certificate.create(); diff --git a/plugins/rtp/src/video_widget.vala b/plugins/rtp/src/video_widget.vala index 20123c68..f69a2ba7 100644 --- a/plugins/rtp/src/video_widget.vala +++ b/plugins/rtp/src/video_widget.vala @@ -197,7 +197,11 @@ public class Dino.Plugins.Rtp.VideoWidget : Gtk.Widget, Dino.Plugins.VideoCallWi caps.get_structure(0).get_int("width", out width); caps.get_structure(0).get_int("height", out height); debug("Input resolution changed: %ix%i", width, height); - resolution_changed(width, height); + // Invoke signal on GTK main loop as recipients are likely to use it for doing GTK operations + Idle.add(() => { + resolution_changed(width, height); + return Source.REMOVE; + }); last_input_caps = caps; } diff --git a/xmpp-vala/src/core/stanza_node.vala b/xmpp-vala/src/core/stanza_node.vala index 502717c8..44a70d8d 100644 --- a/xmpp-vala/src/core/stanza_node.vala +++ b/xmpp-vala/src/core/stanza_node.vala @@ -336,7 +336,7 @@ public class StanzaNode : StanzaEntry { if (((!)val).length > 1000) { return indent + "[... retracted for brevity ...]\n"; } - return indent + ((!)val).replace("\n", indent + "\n") + "\n"; + return indent + ((!)val).replace("\n", "\n" + indent) + "\n"; } var sb = new StringBuilder(); if (no_ns) {