aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo/src/manager.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2018-01-19 22:37:02 +0100
committerfiaxh <git@mx.ax.lt>2018-01-28 13:37:53 +0100
commit57c72d2818dec6c713834cfbb8c4c566a1602907 (patch)
tree0f7102171049cce6f6732b658d005b3c57140271 /plugins/omemo/src/manager.vala
parentca331e85efe2a74a6b9b5a5ff0fbcd10a36758ce (diff)
downloaddino-57c72d2818dec6c713834cfbb8c4c566a1602907.tar.gz
dino-57c72d2818dec6c713834cfbb8c4c566a1602907.zip
Pipeline for incoming messages in libdino
Diffstat (limited to 'plugins/omemo/src/manager.vala')
-rw-r--r--plugins/omemo/src/manager.vala19
1 files changed, 14 insertions, 5 deletions
diff --git a/plugins/omemo/src/manager.vala b/plugins/omemo/src/manager.vala
index 6c8ce4ef..f4c5ed0f 100644
--- a/plugins/omemo/src/manager.vala
+++ b/plugins/omemo/src/manager.vala
@@ -13,6 +13,7 @@ public class Manager : StreamInteractionModule, Object {
private StreamInteractor stream_interactor;
private Database db;
private Map<Entities.Message, MessageState> message_states = new HashMap<Entities.Message, MessageState>(Entities.Message.hash_func, Entities.Message.equals_func);
+ private ReceivedMessageListener received_message_listener = new ReceivedMessageListener();
private class MessageState {
public Entities.Message msg { get; private set; }
@@ -65,14 +66,22 @@ public class Manager : StreamInteractionModule, Object {
stream_interactor.stream_negotiated.connect(on_stream_negotiated);
stream_interactor.account_added.connect(on_account_added);
- stream_interactor.get_module(MessageProcessor.IDENTITY).pre_message_received.connect(on_pre_message_received);
+ stream_interactor.get_module(MessageProcessor.IDENTITY).received_pipeline.connect(received_message_listener);
stream_interactor.get_module(MessageProcessor.IDENTITY).pre_message_send.connect(on_pre_message_send);
}
- private void on_pre_message_received(Entities.Message message, Xmpp.MessageStanza message_stanza, Conversation conversation) {
- MessageFlag? flag = MessageFlag.get_flag(message_stanza);
- if (flag != null && ((!)flag).decrypted) {
- message.encryption = Encryption.OMEMO;
+ private class ReceivedMessageListener : MessageListener {
+
+ public string[] after_actions_const = new string[]{ "" };
+ public override string action_group { get { return "DECRYPT"; } }
+ public override string[] after_actions { get { return after_actions_const; } }
+
+ public override async bool run(Entities.Message message, Xmpp.MessageStanza stanza, Conversation conversation) {
+ MessageFlag? flag = MessageFlag.get_flag(stanza);
+ if (flag != null && ((!)flag).decrypted) {
+ message.encryption = Encryption.OMEMO;
+ }
+ return false;
}
}