diff options
Diffstat (limited to 'xmpp-vala/src')
| -rw-r--r-- | xmpp-vala/src/module/xep/0198_stream_management.vala | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/xmpp-vala/src/module/xep/0198_stream_management.vala b/xmpp-vala/src/module/xep/0198_stream_management.vala index 68eee8ae..db362e33 100644 --- a/xmpp-vala/src/module/xep/0198_stream_management.vala +++ b/xmpp-vala/src/module/xep/0198_stream_management.vala @@ -7,6 +7,8 @@ public const string NS_URI = "urn:xmpp:sm:3"; public class Module : XmppStreamNegotiationModule, WriteNodeFunc { public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0198_stream_management"); + public signal void got_session_id(string session_id); + public int h_inbound = 0; public int h_outbound = 0; @@ -127,11 +129,12 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc { h_inbound++; } - private void check_resume(XmppStream stream) { + public void check_resume(XmppStream stream) { if (stream_has_sm_feature(stream) && session_id != null) { StanzaNode node = new StanzaNode.build("resume", NS_URI).add_self_xmlns() .put_attribute("h", h_inbound.to_string()) .put_attribute("previd", session_id); + session_id = null; write_node.begin(stream, node); stream.add_flag(new Flag()); } @@ -158,6 +161,8 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc { if (node.name == "enabled") { h_inbound = 0; session_id = node.get_attribute("id", NS_URI); + print(@"this=%p, new session_id=$(session_id)\n", this); + got_session_id(session_id); flags = stream.flags; ((IoXmppStream)stream).write_obj = this; } else if (node.name == "resumed") { @@ -219,6 +224,13 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc { } private bool stream_has_sm_feature(XmppStream stream) { + print("stream=%p\n", stream); + if (session_id != null) { + print(@"session_id=$(session_id)\n"); + } + if (stream.features.get_subnode("sm", NS_URI) != null) { + print(@"stream.features.get_subnode=$(stream.features.get_subnode("sm", NS_URI))\n"); + } return stream.features.get_subnode("sm", NS_URI) != null; } } |
