aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/core/io_xmpp_stream.vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/core/io_xmpp_stream.vala')
-rw-r--r--xmpp-vala/src/core/io_xmpp_stream.vala17
1 files changed, 11 insertions, 6 deletions
diff --git a/xmpp-vala/src/core/io_xmpp_stream.vala b/xmpp-vala/src/core/io_xmpp_stream.vala
index 1d9d061b..e13d1448 100644
--- a/xmpp-vala/src/core/io_xmpp_stream.vala
+++ b/xmpp-vala/src/core/io_xmpp_stream.vala
@@ -74,12 +74,7 @@ public abstract class Xmpp.IoXmppStream : XmppStream {
}
public override async void setup() throws IOError {
- StanzaNode outs = new StanzaNode.build("stream", "http://etherx.jabber.org/streams")
- .put_attribute("to", remote_name.to_string())
- .put_attribute("version", "1.0")
- .put_attribute("xmlns", "jabber:client")
- .put_attribute("stream", "http://etherx.jabber.org/streams", XMLNS_URI);
- outs.has_nodes = true;
+ StanzaNode outs = generate_root_node();
log.node("OUT ROOT", outs, this);
yield write_async(outs, Priority.HIGH, cancellable);
received_root_node(this, yield read_root());
@@ -87,6 +82,16 @@ public abstract class Xmpp.IoXmppStream : XmppStream {
setup_needed = false;
}
+ public virtual StanzaNode generate_root_node() {
+ StanzaNode root_node = new StanzaNode.build("stream", "http://etherx.jabber.org/streams")
+ .put_attribute("to", remote_name.to_string())
+ .put_attribute("version", "1.0")
+ .put_attribute("xmlns", "jabber:client")
+ .put_attribute("stream", "http://etherx.jabber.org/streams", XMLNS_URI);
+ root_node.has_nodes = true;
+ return root_node;
+ }
+
private async StanzaNode read_root() throws IOError {
StanzaReader? reader = this.reader;
if (reader == null) throw new IOError.NOT_CONNECTED("trying to read, but no stream open");