From d01af5b520d112b00e4c18b16657f89d5afe7ad4 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 28 May 2020 00:27:06 +0200 Subject: [PATCH] Fix compiler warnings --- .../src/service/counterpart_interaction_manager.vala | 12 +++++------- libdino/src/service/database.vala | 4 ++-- libdino/src/service/entity_capabilities_storage.vala | 4 ++-- libdino/src/service/muc_manager.vala | 2 +- .../ui/add_conversation/add_groupchat_dialog.vala | 1 - main/src/ui/chat_input/chat_input_controller.vala | 2 +- xmpp-vala/src/module/xep/0045_muc/module.vala | 6 +++++- .../src/module/xep/0077_in_band_registration.vala | 1 - 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libdino/src/service/counterpart_interaction_manager.vala b/libdino/src/service/counterpart_interaction_manager.vala index 1e5fd0e2..7a98f0ff 100644 --- a/libdino/src/service/counterpart_interaction_manager.vala +++ b/libdino/src/service/counterpart_interaction_manager.vala @@ -54,7 +54,7 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object { public Gee.List? get_typing_jids(Conversation conversation) { if (stream_interactor.connection_manager.get_state(conversation.account) != ConnectionManager.ConnectionState.CONNECTED) return null; - if (!typing_since.contains(conversation) || typing_since[conversation].size == 0) return null; + if (!typing_since.has_key(conversation) || typing_since[conversation].size == 0) return null; var jids = new ArrayList(); foreach (Jid jid in typing_since[conversation].keys) { @@ -65,7 +65,7 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object { private void on_account_added(Account account) { stream_interactor.module_manager.get_module(account, Xep.ChatMarkers.Module.IDENTITY).marker_received.connect( (stream, jid, marker, id, message_stanza) => { - on_chat_marker_received(account, jid, marker, id, message_stanza); + on_chat_marker_received.begin(account, jid, marker, id, message_stanza); }); stream_interactor.module_manager.get_module(account, Xep.MessageDeliveryReceipts.Module.IDENTITY).receipt_received.connect((stream, jid, id) => { on_receipt_received(account, jid, id); @@ -76,7 +76,7 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object { } private void clear_chat_state(Conversation conversation, Jid jid) { - if (!(typing_since.contains(conversation) && typing_since[conversation].contains(jid))) return; + if (!(typing_since.has_key(conversation) && typing_since[conversation].has_key(jid))) return; typing_since[conversation].unset(jid); received_state(conversation, Xmpp.Xep.ChatStateNotifications.STATE_ACTIVE); @@ -85,9 +85,7 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object { private void clear_all_chat_states(Account account) { foreach (Conversation conversation in typing_since.keys) { if (conversation.account.equals(account)) { - foreach (Jid jid in typing_since[conversation].keys) { - received_state(conversation, Xmpp.Xep.ChatStateNotifications.STATE_ACTIVE); - } + received_state(conversation, Xmpp.Xep.ChatStateNotifications.STATE_ACTIVE); typing_since[conversation].clear(); } } @@ -155,7 +153,7 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object { ContentItem? content_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item(conversation, 1, message.id); ContentItem? read_up_to_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item_by_id(conversation, conversation.read_up_to_item); - if (read_up_to_item != null && read_up_to_item.sort_time.compare(content_item.sort_time) > 0) return; + if (read_up_to_item != null && read_up_to_item.compare(content_item) > 0) return; conversation.read_up_to_item = content_item.id; } else { // We can't currently handle chat markers in MUCs diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index a24822d2..841518d8 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -194,11 +194,11 @@ public class Database : Qlite.Database { public Column entity = new Column.Text("entity"); public Column category = new Column.Text("category"); public Column type = new Column.Text("type"); - public Column name = new Column.Text("name"); + public Column entity_name = new Column.Text("name"); internal EntityIdentityTable(Database db) { base(db, "entity_identity"); - init({entity, category, name, type}); + init({entity, category, entity_name, type}); unique({entity, category, type}, "IGNORE"); index("entity_identity_idx", {entity}); } diff --git a/libdino/src/service/entity_capabilities_storage.vala b/libdino/src/service/entity_capabilities_storage.vala index 12b5d022..e716101a 100644 --- a/libdino/src/service/entity_capabilities_storage.vala +++ b/libdino/src/service/entity_capabilities_storage.vala @@ -33,7 +33,7 @@ public class EntityCapabilitiesStorage : Xep.EntityCapabilities.Storage, Object .value(db.entity_identity.entity, entity) .value(db.entity_identity.category, identity.category) .value(db.entity_identity.type, identity.type_) - .value(db.entity_identity.name, identity.name) + .value(db.entity_identity.entity_name, identity.name) .perform(); return; } @@ -62,7 +62,7 @@ public class EntityCapabilitiesStorage : Xep.EntityCapabilities.Storage, Object RowOption row = db.entity_identity.select().with(db.entity_identity.entity, "=", entity).single().row(); if (row.is_present()) { - identity = new Identity(row[db.entity_identity.category], row[db.entity_identity.type], row[db.entity_identity.name]); + identity = new Identity(row[db.entity_identity.category], row[db.entity_identity.type], row[db.entity_identity.entity_name]); } identity_cache[entity] = identity; return identity; diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala index c4941b47..d96681ac 100644 --- a/libdino/src/service/muc_manager.vala +++ b/libdino/src/service/muc_manager.vala @@ -106,7 +106,7 @@ public class MucManager : StreamInteractionModule, Object { // Check if this would be a valid nick try { - Jid jid = conversation.counterpart.with_resource(new_nick); + conversation.counterpart.with_resource(new_nick); } catch (InvalidJidError error) { return; } stream.get_module(Xep.Muc.Module.IDENTITY).change_nick(stream, conversation.counterpart, new_nick); diff --git a/main/src/ui/add_conversation/add_groupchat_dialog.vala b/main/src/ui/add_conversation/add_groupchat_dialog.vala index 7563da7f..46298d81 100644 --- a/main/src/ui/add_conversation/add_groupchat_dialog.vala +++ b/main/src/ui/add_conversation/add_groupchat_dialog.vala @@ -11,7 +11,6 @@ protected class AddGroupchatDialog : Gtk.Dialog { [GtkChild] private Stack accounts_stack; [GtkChild] private AccountComboBox account_combobox; - [GtkChild] private Label account_label; [GtkChild] private Button ok_button; [GtkChild] private Button cancel_button; [GtkChild] private Entry jid_entry; diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala index 1ec7f3f8..533f6f0d 100644 --- a/main/src/ui/chat_input/chat_input_controller.vala +++ b/main/src/ui/chat_input/chat_input_controller.vala @@ -167,7 +167,7 @@ public class ChatInputController : Object { } private void update_moderated_input_status(Account account, Xmpp.Jid? jid = null) { - if (conversation.type_ == conversation.Type.GROUPCHAT){ + if (conversation != null && conversation.type_ == Conversation.Type.GROUPCHAT){ Xmpp.Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account); if (own_jid == null) return; if (stream_interactor.get_module(MucManager.IDENTITY).is_moderated_room(conversation.account, conversation.counterpart) && diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index 9734fdbc..e9da6657 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -567,7 +567,11 @@ public class ReceivedPipelineListener : StanzaListener { string? var_ = field_node.get_attribute("var"); if (var_ == "muc#jid"){ StanzaNode? value_node = field_node.get_subnode("value", DataForms.NS_URI); - if (value_node != null) from_jid = new Jid(value_node.get_string_content()); + try { + if (value_node != null) from_jid = new Jid(value_node.get_string_content()); + } catch (InvalidJidError e) { + return false; + } } else if (var_ == "muc#roomnick"){ StanzaNode? value_node = field_node.get_subnode("value", DataForms.NS_URI); diff --git a/xmpp-vala/src/module/xep/0077_in_band_registration.vala b/xmpp-vala/src/module/xep/0077_in_band_registration.vala index c67ef987..baaa4ee0 100644 --- a/xmpp-vala/src/module/xep/0077_in_band_registration.vala +++ b/xmpp-vala/src/module/xep/0077_in_band_registration.vala @@ -11,7 +11,6 @@ public class Module : XmppStreamNegotiationModule { StanzaNode query_node = new StanzaNode.build("query", NS_URI).add_self_xmlns(); Iq.Stanza request_form_iq = new Iq.Stanza.get(query_node) { to=jid }; request_form_iq.to = jid; - SourceFunc callback = get_from_server.callback; Iq.Stanza iq_result = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, request_form_iq); return new Form.from_node(stream, iq_result);