aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/message_processor.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-10-22 02:43:04 +0200
committerfiaxh <git@mx.ax.lt>2017-10-22 18:26:31 +0200
commit555187deb9a5ce1af94d241868de6babdd6166b6 (patch)
tree0c2e238b06ec458e9c05f578ea6d495cf61c23ed /libdino/src/service/message_processor.vala
parente49fc134ddf4c1b4e22603b60ea44f59eec496a5 (diff)
downloaddino-555187deb9a5ce1af94d241868de6babdd6166b6.tar.gz
dino-555187deb9a5ce1af94d241868de6babdd6166b6.zip
Offline messages for MUCs
fixes #187
Diffstat (limited to 'libdino/src/service/message_processor.vala')
-rw-r--r--libdino/src/service/message_processor.vala22
1 files changed, 11 insertions, 11 deletions
diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala
index 25e8f91a..3ba3320c 100644
--- a/libdino/src/service/message_processor.vala
+++ b/libdino/src/service/message_processor.vala
@@ -40,6 +40,16 @@ public class MessageProcessor : StreamInteractionModule, Object {
message_sent(message, conversation);
}
+ public void send_unsent_messages(Account account, Jid? jid = null) {
+ Gee.List<Entities.Message> unsend_messages = db.get_unsend_messages(account, jid);
+ foreach (Entities.Message message in unsend_messages) {
+ Conversation? msg_conv = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(message.counterpart, account);
+ if (msg_conv != null) {
+ send_xmpp_message(message, msg_conv, true);
+ }
+ }
+ }
+
private void on_account_added(Account account) {
stream_interactor.module_manager.get_module(account, Xmpp.Message.Module.IDENTITY).received_message.connect( (stream, message) => {
on_message_received(account, message);
@@ -50,16 +60,6 @@ public class MessageProcessor : StreamInteractionModule, Object {
});
}
- private void send_unsent_messages(Account account) {
- Gee.List<Entities.Message> unsend_messages = db.get_unsend_messages(account);
- foreach (Entities.Message message in unsend_messages) {
- Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(message.counterpart, account);
- if (conversation != null) {
- send_xmpp_message(message, conversation, true);
- }
- }
- }
-
private void on_message_received(Account account, Xmpp.Message.Stanza message) {
if (message.body == null) return;
@@ -168,7 +168,7 @@ public class MessageProcessor : StreamInteractionModule, Object {
message.direction = Entities.Message.DIRECTION_SENT;
message.counterpart = conversation.counterpart;
if (conversation.type_ in new Conversation.Type[]{Conversation.Type.GROUPCHAT, Conversation.Type.GROUPCHAT_PM}) {
- message.ourpart = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
+ message.ourpart = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account) ?? conversation.account.bare_jid;
message.real_jid = conversation.account.bare_jid;
} else {
message.ourpart = new Jid.with_resource(conversation.account.bare_jid.to_string(), conversation.account.resourcepart);