Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
trying to get the "digest" tag from iq-auth
Avatar
parthy #1
Member since Mar 2007 · 9 posts
Group memberships: Members
Show profile · Link to this post
Subject: getting a tag
Hi there,

I am new to agsxmpp. I am trying to use the same server to test how to get the tag for "digest" but I am running into problems. The result of getTag always returns null regardless of the tag name. Any ideas? thank you - parthy

        private void ProcessIQ(IQ iq)
        {
            if(iq.Query.GetType() == typeof(Auth))
            {
                Auth auth = iq.Query as Auth;
                switch(iq.Type)
                {
                    case IqType.get:
                        iq.SwitchDirection();
                        iq.Type = IqType.result;
                        auth.AddChild(new Element("password"));
                        auth.AddChild(new Element("digest"));
                        Send(iq);
                        break;
                    case IqType.set:
                        // Here we should verify the authentication credentials
                        iq.SwitchDirection();
                        iq.Type = IqType.result;
                        string digest = iq.GetTag("digest");
                        if(digest!=null) Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "+digest);
                        iq.Query = null;
                        Send(iq);
                        break;
                }
               
            }
            else if(iq.Query.GetType() == typeof(Roster))
            {
                ProcessRosterIQ(iq);
               
            }
           
        }
Avatar
parthy #2
Member since Mar 2007 · 9 posts
Group memberships: Members
Show profile · Link to this post
Ok, this works:

    string digest = iq.GetTag("digest", true);

although I wonder  iq.GetTag("digest"); didnt work because this tag has no children. I would have expected to work since digest tag has no children.

Any comments?

thank you,
parthy
Avatar
Jabberer #3
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Because GetTag without the second bool parameter set to true does not loop through the whole XML tree. It looks only at the children of a tag, not at the grand children etc...
And the <digest/> tag is no child of the <iq/> tag.
Software Developer
AG-Software
Avatar
parthy #4
Member since Mar 2007 · 9 posts
Group memberships: Members
Show profile · Link to this post
got it. thanks
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 SDK Support RSS