aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-04-23 13:53:44 +0200
committerfiaxh <git@lightrise.org>2020-04-24 14:18:24 +0200
commite7bc68ad4d02b8e5f6ba26c0e917abf4d9ab2ccc (patch)
treef1ef7e1d98723774a31374bfda7ab0804f38c6d4 /libdino/src/service
parent9661116d7814059fad7bf6a6ae5c0f684aed5bda (diff)
downloaddino-e7bc68ad4d02b8e5f6ba26c0e917abf4d9ab2ccc.tar.gz
dino-e7bc68ad4d02b8e5f6ba26c0e917abf4d9ab2ccc.zip
Handle entity hash in server features node, make ServiceDiscovery request_info/items async, add caching has_entity_feature
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/entity_capabilities_storage.vala2
-rw-r--r--libdino/src/service/message_processor.vala16
2 files changed, 8 insertions, 10 deletions
diff --git a/libdino/src/service/entity_capabilities_storage.vala b/libdino/src/service/entity_capabilities_storage.vala
index b1f5405b..12b5d022 100644
--- a/libdino/src/service/entity_capabilities_storage.vala
+++ b/libdino/src/service/entity_capabilities_storage.vala
@@ -16,6 +16,8 @@ public class EntityCapabilitiesStorage : Xep.EntityCapabilities.Storage, Object
}
public void store_features(string entity, Gee.List<string> features) {
+ if (features_cache.contains(entity)) return;
+
foreach (string feature in features) {
db.entity_feature.insert()
.value(db.entity_feature.entity, entity)
diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala
index 6bc4fc9e..266482ac 100644
--- a/libdino/src/service/message_processor.vala
+++ b/libdino/src/service/message_processor.vala
@@ -386,24 +386,20 @@ public class MessageProcessor : StreamInteractionModule, Object {
return Entities.Message.Type.GROUPCHAT_PM;
}
} else {
- SourceFunc callback = determine_message_type.callback;
XmppStream stream = stream_interactor.get_stream(account);
- if (stream != null) stream.get_module(Xep.ServiceDiscovery.Module.IDENTITY).get_entity_categories(stream, message.counterpart.bare_jid, (stream, identities) => {
+ if (stream != null) {
+ Gee.Set<Xep.ServiceDiscovery.Identity>? identities = yield stream.get_module(Xep.ServiceDiscovery.Module.IDENTITY).get_entity_identities(stream, message.counterpart.bare_jid);
if (identities == null) {
- message.type_ = Entities.Message.Type.CHAT;
- Idle.add((owned) callback);
- return;
+ return Entities.Message.Type.CHAT;
}
foreach (Xep.ServiceDiscovery.Identity identity in identities) {
if (identity.category == Xep.ServiceDiscovery.Identity.CATEGORY_CONFERENCE) {
- message.type_ = Entities.Message.Type.GROUPCHAT_PM;
+ return Entities.Message.Type.GROUPCHAT_PM;
} else {
- message.type_ = Entities.Message.Type.CHAT;
+ return Entities.Message.Type.CHAT;
}
}
- Idle.add((owned) callback);
- });
- yield;
+ }
}
}
return Entities.Message.Type.CHAT;