Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Page:  1  2  next
Avatar
danny_cc #1
Member since Mar 2007 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to get registerinfo
Hello,

I'm writing code to register with a transport (XEP-0100).

I understand that after I send an IQ get, the server will reply with the registration requirements. Under which event do I recieve these?
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you will get the result in the OnIq events.
But it's much easier to use the IqGrabber class for that and define your own callback. The MiniClient is going that for Service Discovery and the the VCard. There you can look how it works.

Alex
Alexander Gnauck
AG-Software
Avatar
danny_cc #3
Member since Mar 2007 · 4 posts
Group memberships: Members
Show profile · Link to this post
Thank you! (I noticed I mistook the XEP for inband registration - oops)

I looked at the MiniClient but I'm not familiar with C# (using VB 2005 here) so it is not so clear. Do you mean something like this?

    Private Sub GetRegistrationFields()
        'create and send an IQ-GET to the selected service in the combobox
        Dim newiq As New agsXMPP.protocol.iq.register.RegisterIq
        newiq.Type = agsXMPP.protocol.client.IqType.get
        newiq.To = New Jid(cmbServices.Text)
        myconnection.IqGrabber.SendIq(newiq, New agsXMPP.IqCB(AddressOf OnRegisterFieldResult), Nothing)
    End Sub

    Private Sub OnRegisterFieldResult(ByVal sender As Object, ByVal iq As IQ, ByVal data As Object)
        'some code to handle the results
    End Sub

One more question - I'm not sure how to extract the list of fields requested by the server. I looked in agsXMPP.protocol.Iq.register.Register but couldn't find anything.

If you could clarify how to do this it would be great.
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

you code looks OK.

When you get the OnRegisterFieldResult you have to get the Register object which should contain all the properties you need(email, username, password etc...).

Some services send x-data registration fields. In this case you have to get the x-data object and show a x-data form in your user interface.

There are also services which send both. In this case its up to you which kind of registration you perform. But i would always prefer x-data, because this is the most recent protocol for that.

Alex
Alexander Gnauck
AG-Software
Avatar
danny_cc #5
Member since Mar 2007 · 4 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex, but I still have some problem here...

You know how not all the fields are required for registration. Like the transport I'm using for testing - looking at the debug XML, it only wants username & password, not email, name or other fields. So I'm looking for a way to know which fields it is requesting, and only create controls for the user to enter data in those fields. Is there an available method for this?
Avatar
Jabberer #6
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Look at the In-Band Registration XEP at:
http://www.xmpp.org/extensions/xep-0077.html

If your service supports data forms registration then it is possible.
If it does not support data forms then there is no way to find the required fields only.
Software Developer
AG-Software
Avatar
danny_cc #7
Member since Mar 2007 · 4 posts
Group memberships: Members
Show profile · Link to this post
Ahh, I see - thanks for the clarification!
Avatar
Koterpillar #8
Member since May 2007 · 32 posts · Location: Russia
Group memberships: Members
Show profile · Link to this post
Subject: x:data returns bad-request
I'm able to register on a transport using Register object, but not with x:data.
First, when I do the following...
  1. Data data;
  2. //...
  3. foreach(Field field in data.GetFields())
  4. {
  5.     field.SetValue(someValue); // or SetValueBool
  6. }
what I get something like is:
  1. <field type='text-single' label='Nickname' var='nick' value='someValue'>
  2.     <value />
  3. </field>
- the Field object ignores the <value /> inside. I have to use SetValues() instead with an array of one string.
But then, it doesn't help the registration: here's the XML log.
  1.     <iq xmlns="jabber:client" id="17" type="get" to="conference.im.flosoft.biz">
  2.         <query xmlns="jabber:iq:register" />
  3.     </iq>
  4.  
  5.  
  6.     <iq from='conference.im.flosoft.biz' to='jane@im.flosoft.biz/nebohodimo IM' id='17' type='result'>
  7.         <query xmlns='jabber:iq:register'>
  8.             <instructions>You need an x:data capable client to register nickname</instructions>
  9.             <x xmlns='jabber:x:data'>
  10.                 <title>Nickname Registration at conference.im.flosoft.biz</title>
  11.                 <instructions>Enter nickname you want to register</instructions>
  12.                 <field type='text-single' label='Nickname' var='nick'>
  13.                     <value></value>
  14.                 </field>
  15.             </x>
  16.         </query>
  17.     </iq>
  18.  
  19.  
  20.     <iq xmlns="jabber:client" type="set" id="18" from="jane@im.flosoft.biz/nebohodimo IM" to="conference.im.flosoft.biz">
  21.         <query xmlns="jabber:iq:register">
  22.             <instructions>You need an x:data capable client to register nickname</instructions>
  23.             <x xmlns="jabber:x:data">
  24.                 <title>Nickname Registration at conference.im.flosoft.biz</title>
  25.                 <instructions>Enter nickname you want to register</instructions>
  26.                 <field type="text-single" var="nick" label="Nickname">
  27.                     <value>Jarndyce</value>
  28.                 </field>
  29.             </x>
  30.         </query>
  31.     </iq>
  32.  
  33.  
  34.     <iq from='conference.im.flosoft.biz' to='jane@im.flosoft.biz/nebohodimo IM' type='error' xml:lang='en' id='18'>
  35.         <query xmlns='jabber:iq:register'>
  36.             <instructions>You need an x:data capable client to register nickname</instructions>
  37.             <x xmlns='jabber:x:data'>
  38.                 <title>Nickname Registration at conference.im.flosoft.biz</title>
  39.                 <instructions>Enter nickname you want to register</instructions>
  40.                 <field type='text-single' var='nick' label='Nickname'>
  41.                     <value>Jarndyce</value>
  42.                 </field>
  43.             </x>
  44.         </query>
  45.         <error code='400' type='modify'>
  46.             <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  47.         </error>
  48.     </iq>
What do I need to register with x:data?
nebohodimo IM developer
Avatar
Jabberer #9
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
i think we fixed the value bug in the SVN version. Can you check it out?

When you submit the form the xdata element must be of type="submit"

Example:
  1. <x xmlns='jabber:x:data' type='submit'>...</x>

Take also a look at the MiniClient. It has a working example of a xdata seach in the search form.
Software Developer
AG-Software
Avatar
Koterpillar #10
Member since May 2007 · 32 posts · Location: Russia
Group memberships: Members
Show profile · Link to this post
When I change the type of x:data to "submit", I don't receive response at all...
And I'm not trying to search, just registering with the IRC transport (or chat rooms).
BTW, is the testing (and hopefully 'right') server gone? I tried with im.flosoft.biz and jabber.ru...
An example:
  1.     <iq xmlns="jabber:client" type="result" id="14" from="skyalice@jabber.org/nebohodimo IM" to="conference.jabber.org">
  2.         <query xmlns="jabber:iq:register">
  3.             <instructions>You need an x:data capable client to register nickname</instructions>
  4.             <x xmlns="jabber:x:data" type="submit">
  5.                 <title>Nickname Registration at conference.jabber.org</title>
  6.                 <instructions>Enter nickname you want to register</instructions>
  7.                 <field type="text-single" var="nick" label="Nickname">
  8.                     <value>Jazeera</value>
  9.                 </field>
  10.             </x>
  11.         </query>
  12.     </iq>
Wait, shouldn't it be <iq type="set"...>?
nebohodimo IM developer
This post was edited 3 times, last on 2007-06-19, 13:11 by Koterpillar.
Avatar
Alex #11
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Koterpillar,

Quote by Koterpillar:
And I'm not trying to search, just registering with the IRC transport (or chat rooms).
search and register both make use of xdata. So the code is nearly the same. This is why Jabberer suggested to take a look at the MiniClient.

Quote by Koterpillar:
BTW, is the testing (and hopefully 'right') server gone? I tried with im.flosoft.biz and jabber.ru...
yes our test server is currently not available. And not sure if we bring it back. There were not many people using it.

Quote by Koterpillar:
Wait, shouldn't it be <iq type="set"...>?
yes it should.

Alex
Alexander Gnauck
AG-Software
Avatar
Koterpillar #12
Member since May 2007 · 32 posts · Location: Russia
Group memberships: Members
Show profile · Link to this post
Well, it turned out I was lazy.
  1.     iq.Type = IqType.set;
  2.     iq.GenerateId();
  3.     iq.SwitchDirection();
  4.     Client.SendIq(iq, new IqCB(OnRegisterResult), iq);
All this didn't remove fields like <instructions> or <registered>, so no server liked this.
nebohodimo IM developer
Avatar
Jabberer #13
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
oh ya, i remember. We had this problem before. Normally this extra fields shouldn't matter. But there are some servers which have problems with them.
I think Alex also updated some registration code in the MiniClient because of that.
Software Developer
AG-Software
Avatar
gab #14
Member since Jul 2007 · 4 posts
Group memberships: Members
Show profile · Link to this post
i looked at the miniclient example but couldn't figure out how in the first place the search service option populates the combo dropdown list.

i'd like to register to a transport and hope i can populate a dropdown list with the available transport services from my server. can anyone offer advice on how to do that?

i tried the following but it didn't work. VB.Net threw an exception...

   Private Sub GetRegistrationFields()
        'create and send an IQ-GET to the selected service in the combobox
        Dim newiq As New RegisterIq
        newiq.Type = IqType.get
        newiq.To = New Jid("msn.aregon") <--- ' I guess the service name to be "msn.<myservername>"
        XmppCon.IqGrabber.SendIq(newiq, New agsXMPP.IqCB(AddressOf OnRegisterFieldResult), Nothing)
    End Sub
Avatar
gab #15
Member since Jul 2007 · 4 posts
Group memberships: Members
Show profile · Link to this post
i've been trying for a number of hours to get the registration to transport working in vb.net but in vain.

has anyone done this and kind enough to share some code/shed some light in this?

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:
Page:  1  2  next
Forum: agsXMPP SDK Support RSS