aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/conversation_manager.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-07-06 19:32:16 +0200
committerfiaxh <git@lightrise.org>2020-07-22 18:36:04 +0200
commitb104be4842c4f5c309055052bd7b9d2fc9337113 (patch)
tree4ce6329e9d058a91624f1b2a4cf78d67262bf38c /libdino/src/service/conversation_manager.vala
parentc887240fdcdbc8f76c6bdd37b1174b8154907c4c (diff)
downloaddino-b104be4842c4f5c309055052bd7b9d2fc9337113.tar.gz
dino-b104be4842c4f5c309055052bd7b9d2fc9337113.zip
Don't create a second message object for each typing notification
Diffstat (limited to 'libdino/src/service/conversation_manager.vala')
-rw-r--r--libdino/src/service/conversation_manager.vala11
1 files changed, 11 insertions, 0 deletions
diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala
index 18a362c6..dcb0ced4 100644
--- a/libdino/src/service/conversation_manager.vala
+++ b/libdino/src/service/conversation_manager.vala
@@ -84,6 +84,17 @@ public class ConversationManager : StreamInteractionModule, Object {
return null;
}
+ public Conversation? approx_conversation_for_stanza(Jid jid, Account account, string msg_ty) {
+ if (msg_ty == Xmpp.MessageStanza.TYPE_GROUPCHAT) {
+ return get_conversation(jid.bare_jid, account, Conversation.Type.GROUPCHAT);
+ } else if (msg_ty == Xmpp.MessageStanza.TYPE_CHAT && jid.is_full() &&
+ get_conversation(jid.bare_jid, account, Conversation.Type.GROUPCHAT) != null) {
+ var pm = get_conversation(jid, account, Conversation.Type.GROUPCHAT_PM);
+ if (pm != null) return pm;
+ }
+ return get_conversation(jid.bare_jid, account, Conversation.Type.CHAT);
+ }
+
public Conversation? get_conversation_by_id(int id) {
foreach (HashMap<Jid, Gee.List<Conversation>> hm in conversations.values) {
foreach (Gee.List<Conversation> hm2 in hm.values) {