diff options
Diffstat (limited to 'xmpp-vala')
-rw-r--r-- | xmpp-vala/src/module/message/module.vala | 5 | ||||
-rw-r--r-- | xmpp-vala/tests/stanza.vala | 28 |
2 files changed, 17 insertions, 16 deletions
diff --git a/xmpp-vala/src/module/message/module.vala b/xmpp-vala/src/module/message/module.vala index 2ca06dc4..afa3f005 100644 --- a/xmpp-vala/src/module/message/module.vala +++ b/xmpp-vala/src/module/message/module.vala @@ -15,8 +15,9 @@ namespace Xmpp.Message { public signal void received_message(XmppStream stream, Message.Stanza message); public void send_message(XmppStream stream, Message.Stanza message) { - send_pipeline.run.begin(stream, message); - stream.write(message.stanza); + send_pipeline.run.begin(stream, message, (obj, res) => { + stream.write(message.stanza); + }); } public async void received_message_stanza_async(XmppStream stream, StanzaNode node) { diff --git a/xmpp-vala/tests/stanza.vala b/xmpp-vala/tests/stanza.vala index 1662c9bc..40b54a38 100644 --- a/xmpp-vala/tests/stanza.vala +++ b/xmpp-vala/tests/stanza.vala @@ -6,12 +6,12 @@ class StanzaTest : Gee.TestCase { public StanzaTest() { base("Stanza"); - add_test("node_one", test_node_one); - add_test("typical_stream", test_typical_stream); - add_test("ack_stream", test_ack_stream); + add_test("node_one", () => { test_node_one.begin(); }); + add_test("typical_stream", () => { test_typical_stream.begin(); }); + add_test("ack_stream", () => { test_ack_stream.begin(); }); } - private void test_node_one() { + private async void test_node_one() { var node1 = new StanzaNode.build("test", "ns1_uri") .add_self_xmlns() .put_attribute("ns2", "ns2_uri", XMLNS_URI) @@ -22,12 +22,12 @@ class StanzaTest : Gee.TestCase { .add_self_xmlns()); var xml1 = node1.to_xml(); - var node2 = new StanzaReader.for_string(xml1).read_node(); + var node2 = yield new StanzaReader.for_string(xml1).read_node(); fail_if_not(node1.equals(node2)); fail_if_not_eq_str(node1.to_string(), node2.to_string()); } - private void test_typical_stream() { + private async void test_typical_stream() { var stream = """ <?xml version='1.0' encoding='UTF-8'?> <stream:stream @@ -55,13 +55,13 @@ class StanzaTest : Gee.TestCase { .put_node(new StanzaNode.text("I'll send a friar with speed, to Mantua, with my letters to thy lord."))); var reader = new StanzaReader.for_string(stream); - fail_if_not_eq_node(root_node_cmp, reader.read_root_node()); - fail_if_not_eq_node(node_cmp, reader.read_node()); - reader.read_node(); + fail_if_not_eq_node(root_node_cmp, yield reader.read_root_node()); + fail_if_not_eq_node(node_cmp, yield reader.read_node()); + yield reader.read_node(); fail_if_not_error_code(() => reader.read_node(), 3, "end of stream should be reached"); } - private void test_ack_stream() { + private async void test_ack_stream() { var stream = """ <?xml version='1.0' encoding='UTF-8'?> <stream:stream @@ -93,10 +93,10 @@ class StanzaTest : Gee.TestCase { var node2_cmp = new StanzaNode.build("r", "http://jabber.org/protocol/ack"); var reader = new StanzaReader.for_string(stream); - fail_if_not_eq_node(root_node_cmp, reader.read_root_node()); - fail_if_not_eq_node(node_cmp, reader.read_node()); - fail_if_not_eq_node(node2_cmp, reader.read_node()); - reader.read_node(); + fail_if_not_eq_node(root_node_cmp, yield reader.read_root_node()); + fail_if_not_eq_node(node_cmp, yield reader.read_node()); + fail_if_not_eq_node(node2_cmp, yield reader.read_node()); + yield reader.read_node(); fail_if_not_error_code(() => reader.read_node(), 3, "end of stream should be reached"); } |