Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
cloud #1
Member since Jun 2010 · 2 posts · Location: Russia, Moscow
Group memberships: Members
Show profile · Link to this post
Subject: OnStreamStart callback not fired in StreamParser
Hello,

I am  trying to write a simple XMPP server and is testing it with an existing Jabber client. After successful authorization (server sent <success> tag in respond to <auth> tag), clients initiates a new stream, sending new <stream:stream> tag. Currently no callback is called in the StreamParser when this stream tag comes and server doesn't know when to send a reply.

Meanwhile I made the following path for my project, but not sure how it can affect other situation when StreamParser is used:
Index: StreamParser.cs
===================================================================
--- StreamParser.cs    (revision 96)
+++ StreamParser.cs    (working copy)
@@ -294,9 +294,6 @@
             if (m_root == null)
             {
                 m_root = newel;
-                //FireOnDocumentStart(m_root);
-                if (OnStreamStart!=null)
-                    OnStreamStart(this, m_root);
             }
             else
             {
@@ -304,6 +301,12 @@
                     current.AddChild(newel);
                 current = newel;
             }
+           
+            if (newel.GetType() == typeof(agsXMPP.protocol.Stream))
+            {
+                if (OnStreamStart!=null)
+                    OnStreamStart(this, newel);
+            }
         }
 
         private void EndTag(byte[] buf, int offset,    ContentToken ct, TOK tok)
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you have to reset the StreamParser when you expect a new stream on the same parser instance. There is a member for this.

Alex
Avatar
cloud #3
Member since Jun 2010 · 2 posts · Location: Russia, Moscow
Group memberships: Members
Show profile · Link to this post
Thanks, it solved my other issues too.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS