Fix compiler warnings

This commit is contained in:
fiaxh 2020-05-28 00:27:06 +02:00
parent 71be2abb6a
commit d01af5b520
8 changed files with 16 additions and 16 deletions

View file

@ -54,7 +54,7 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
public Gee.List<Jid>? get_typing_jids(Conversation conversation) { public Gee.List<Jid>? get_typing_jids(Conversation conversation) {
if (stream_interactor.connection_manager.get_state(conversation.account) != ConnectionManager.ConnectionState.CONNECTED) return null; 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<Jid>(); var jids = new ArrayList<Jid>();
foreach (Jid jid in typing_since[conversation].keys) { foreach (Jid jid in typing_since[conversation].keys) {
@ -65,7 +65,7 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
private void on_account_added(Account account) { 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) => { 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) => { stream_interactor.module_manager.get_module(account, Xep.MessageDeliveryReceipts.Module.IDENTITY).receipt_received.connect((stream, jid, id) => {
on_receipt_received(account, 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) { 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); typing_since[conversation].unset(jid);
received_state(conversation, Xmpp.Xep.ChatStateNotifications.STATE_ACTIVE); 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) { private void clear_all_chat_states(Account account) {
foreach (Conversation conversation in typing_since.keys) { foreach (Conversation conversation in typing_since.keys) {
if (conversation.account.equals(account)) { 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(); 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? 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); 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; conversation.read_up_to_item = content_item.id;
} else { } else {
// We can't currently handle chat markers in MUCs // We can't currently handle chat markers in MUCs

View file

@ -194,11 +194,11 @@ public class Database : Qlite.Database {
public Column<string> entity = new Column.Text("entity"); public Column<string> entity = new Column.Text("entity");
public Column<string> category = new Column.Text("category"); public Column<string> category = new Column.Text("category");
public Column<string> type = new Column.Text("type"); public Column<string> type = new Column.Text("type");
public Column<string> name = new Column.Text("name"); public Column<string> entity_name = new Column.Text("name");
internal EntityIdentityTable(Database db) { internal EntityIdentityTable(Database db) {
base(db, "entity_identity"); base(db, "entity_identity");
init({entity, category, name, type}); init({entity, category, entity_name, type});
unique({entity, category, type}, "IGNORE"); unique({entity, category, type}, "IGNORE");
index("entity_identity_idx", {entity}); index("entity_identity_idx", {entity});
} }

View file

@ -33,7 +33,7 @@ public class EntityCapabilitiesStorage : Xep.EntityCapabilities.Storage, Object
.value(db.entity_identity.entity, entity) .value(db.entity_identity.entity, entity)
.value(db.entity_identity.category, identity.category) .value(db.entity_identity.category, identity.category)
.value(db.entity_identity.type, identity.type_) .value(db.entity_identity.type, identity.type_)
.value(db.entity_identity.name, identity.name) .value(db.entity_identity.entity_name, identity.name)
.perform(); .perform();
return; 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(); RowOption row = db.entity_identity.select().with(db.entity_identity.entity, "=", entity).single().row();
if (row.is_present()) { 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; identity_cache[entity] = identity;
return identity; return identity;

View file

@ -106,7 +106,7 @@ public class MucManager : StreamInteractionModule, Object {
// Check if this would be a valid nick // Check if this would be a valid nick
try { try {
Jid jid = conversation.counterpart.with_resource(new_nick); conversation.counterpart.with_resource(new_nick);
} catch (InvalidJidError error) { return; } } catch (InvalidJidError error) { return; }
stream.get_module(Xep.Muc.Module.IDENTITY).change_nick(stream, conversation.counterpart, new_nick); stream.get_module(Xep.Muc.Module.IDENTITY).change_nick(stream, conversation.counterpart, new_nick);

View file

@ -11,7 +11,6 @@ protected class AddGroupchatDialog : Gtk.Dialog {
[GtkChild] private Stack accounts_stack; [GtkChild] private Stack accounts_stack;
[GtkChild] private AccountComboBox account_combobox; [GtkChild] private AccountComboBox account_combobox;
[GtkChild] private Label account_label;
[GtkChild] private Button ok_button; [GtkChild] private Button ok_button;
[GtkChild] private Button cancel_button; [GtkChild] private Button cancel_button;
[GtkChild] private Entry jid_entry; [GtkChild] private Entry jid_entry;

View file

@ -167,7 +167,7 @@ public class ChatInputController : Object {
} }
private void update_moderated_input_status(Account account, Xmpp.Jid? jid = null) { 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); Xmpp.Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
if (own_jid == null) return; if (own_jid == null) return;
if (stream_interactor.get_module(MucManager.IDENTITY).is_moderated_room(conversation.account, conversation.counterpart) && if (stream_interactor.get_module(MucManager.IDENTITY).is_moderated_room(conversation.account, conversation.counterpart) &&

View file

@ -567,7 +567,11 @@ public class ReceivedPipelineListener : StanzaListener<MessageStanza> {
string? var_ = field_node.get_attribute("var"); string? var_ = field_node.get_attribute("var");
if (var_ == "muc#jid"){ if (var_ == "muc#jid"){
StanzaNode? value_node = field_node.get_subnode("value", DataForms.NS_URI); 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"){ else if (var_ == "muc#roomnick"){
StanzaNode? value_node = field_node.get_subnode("value", DataForms.NS_URI); StanzaNode? value_node = field_node.get_subnode("value", DataForms.NS_URI);

View file

@ -11,7 +11,6 @@ public class Module : XmppStreamNegotiationModule {
StanzaNode query_node = new StanzaNode.build("query", NS_URI).add_self_xmlns(); 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 }; Iq.Stanza request_form_iq = new Iq.Stanza.get(query_node) { to=jid };
request_form_iq.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); 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); return new Form.from_node(stream, iq_result);