aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/message
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-11-11 21:29:13 +0100
committerfiaxh <git@mx.ax.lt>2017-11-16 17:43:00 +0100
commit3f531d6b91edab6c79fa232143db828bad13853c (patch)
tree1083046c94e0b4a43cf16ac4a388fcea8ef91e84 /xmpp-vala/src/module/message
parent1d0745177e7a116455811dfd26e07b848cb89b75 (diff)
downloaddino-3f531d6b91edab6c79fa232143db828bad13853c.tar.gz
dino-3f531d6b91edab6c79fa232143db828bad13853c.zip
Read+(write) stream async
Diffstat (limited to 'xmpp-vala/src/module/message')
-rw-r--r--xmpp-vala/src/module/message/module.vala17
1 files changed, 10 insertions, 7 deletions
diff --git a/xmpp-vala/src/module/message/module.vala b/xmpp-vala/src/module/message/module.vala
index f7038ef8..2ca06dc4 100644
--- a/xmpp-vala/src/module/message/module.vala
+++ b/xmpp-vala/src/module/message/module.vala
@@ -8,24 +8,27 @@ namespace Xmpp.Message {
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "message_module");
- public signal void pre_send_message(XmppStream stream, Message.Stanza message);
+ public StanzaListenerHolder<Message.Stanza> received_pipeline = new StanzaListenerHolder<Message.Stanza>();
+ public StanzaListenerHolder<Message.Stanza> send_pipeline = new StanzaListenerHolder<Message.Stanza>();
+
public signal void pre_received_message(XmppStream stream, Message.Stanza message);
public signal void received_message(XmppStream stream, Message.Stanza message);
public void send_message(XmppStream stream, Message.Stanza message) {
- pre_send_message(stream, message);
+ send_pipeline.run.begin(stream, message);
stream.write(message.stanza);
}
- public void received_message_stanza(XmppStream stream, StanzaNode node) {
+ public async void received_message_stanza_async(XmppStream stream, StanzaNode node) {
Message.Stanza message = new Message.Stanza.from_stanza(node, stream.get_flag(Bind.Flag.IDENTITY).my_jid);
- do {
- message.rerun_parsing = false;
- pre_received_message(stream, message);
- } while(message.rerun_parsing);
+ yield received_pipeline.run(stream, message);
received_message(stream, message);
}
+ private void received_message_stanza(XmppStream stream, StanzaNode node) {
+ received_message_stanza_async.begin(stream, node);
+ }
+
public override void attach(XmppStream stream) {
stream.received_message_stanza.connect(received_message_stanza);
}