From 2fe8489d368a371aefbfbe66e74621a8df14cdc2 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 10 Mar 2017 17:01:45 +0100 Subject: Rename vala-xmpp library to xmpp-vala --- xmpp-vala/src/core/stanza_writer.vala | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 xmpp-vala/src/core/stanza_writer.vala (limited to 'xmpp-vala/src/core/stanza_writer.vala') diff --git a/xmpp-vala/src/core/stanza_writer.vala b/xmpp-vala/src/core/stanza_writer.vala new file mode 100644 index 00000000..26524d7b --- /dev/null +++ b/xmpp-vala/src/core/stanza_writer.vala @@ -0,0 +1,27 @@ +namespace Xmpp.Core { +public class StanzaWriter { + private OutputStream output; + + public StanzaWriter.for_stream(OutputStream output) { + this.output = output; + } + + public void write_node(StanzaNode node) throws XmlError { + try { + lock(output) { + output.write_all(node.to_xml().data, null); + } + } catch (GLib.IOError e) { + throw new XmlError.IO_ERROR(@"IOError in GLib: $(e.message)"); + } + } + + public async void write(string s) throws XmlError { + try { + output.write_all(s.data, null); + } catch (GLib.IOError e) { + throw new XmlError.IO_ERROR(@"IOError in GLib: $(e.message)"); + } + } +} +} \ No newline at end of file -- cgit v1.2.3-70-g09d2