Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
peternorman #1
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
Subject: OnRosterEnd is not called after registering a new account
Basically, if a new account is created through code the OnRosterEnd is never called. If I create the account via ejabberdctl.cmd and logon with RegisterNewAccount = false the OnRosterEnd event is called. Any ideas?


  1. xmppClient = new XmppClient();
  2. xmppClient.RegisterNewAccount = true;
  3. xmppClient.SetUsername(userName);
  4. xmppClient.SetXmppDomain(server);
  5. xmppClient.Password = password;
  6.  
  7. xmppClient.OnLogin += new EventHandler<Matrix.EventArgs>(OnLogin);
  8. xmppClient.OnError += new EventHandler<Matrix.ExceptionEventArgs>(OnError);
  9. xmppClient.OnRosterEnd += new EventHandler<Matrix.EventArgs>(OnRosterEnd);
  10. xmppClient.OnRegister += new EventHandler<Matrix.EventArgs>(OnRegister);
  11. xmppClient.OnRegisterInformation += new EventHandler<Matrix.Xmpp.Register.RegisterEventArgs>(OnRegisterInformation);
  12. xmppClient.OnRegisterError += new EventHandler<IqEventArgs>(OnRegisterError);
  13.  
  14.                    
  15. xmppClient.Open();
  16.  
  17. private void OnRegisterInformation(object sender, RegisterEventArgs e)
  18. {
  19.        e.Register.RemoveAll<Data>();
  20.  
  21.        e.Register.Username = client.Username;
  22.        e.Register.Password = client.Password;
  23. }
  24.  
  25. void OnRegister(object sender, Matrix.EventArgs e)
  26. {
  27.  
  28. }
  29.  
  30. private void OnRosterEnd(object sender, EventArgs e)
  31. {
  32.        pubSubManager = new PubSubManager(xmppClient);
  33.        discoManager = new DiscoManager(xmppClient);
  34.        rosterManager = new RosterManager(xmppClient);
  35. }
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
please post your complete Xml log when registering a new account.
Do you get the OnRegister event?
Avatar
peternorman #3
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
Yes, the OnRegisterInformation, OnRegister, and the OnLogin event are called.

  1. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="sg1" version="1.0" ><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="1381190069" from="sg1" version="1.0" xml:lang="en" ><stream:features xmlns:stream="http://etherx.jabber.org/streams">
  2.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  3.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  4.     <mechanism>PLAIN</mechanism>
  5.     <mechanism>DIGEST-MD5</mechanism>
  6.     <mechanism>SCRAM-SHA-1</mechanism>
  7.  </mechanisms>
  8.  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="wwrSvLFOLzC92POh074kJuEqYxE=" />
  9.  <register xmlns="http://jabber.org/features/iq-register" />
  10. </stream:features><iq id="MX_1" type="get" to="sg1" xmlns="jabber:client">
  11.  <query xmlns="jabber:iq:register" />
  12. </iq><iq from="sg1" id="MX_1" type="result" xmlns="jabber:client">
  13.  <query xmlns="jabber:iq:register">
  14.     <instructions>Choose a username and password to register with this server</instructions>
  15.     <username />
  16.     <password />
  17.  </query>
  18. </iq><iq type="set" to="sg1" id="MX_2" xmlns="jabber:client">
  19.  <query xmlns="jabber:iq:register">
  20.     <instructions>Choose a username and password to register with this server</instructions>
  21.     <username>boo</username>
  22.     <password>boo</password>
  23.  </query>
  24. </iq><iq from="sg1" id="MX_2" type="result" xmlns="jabber:client">
  25.  <query xmlns="jabber:iq:register">
  26.     <instructions>Choose a username and password to register with this server</instructions>
  27.     <username>boo</username>
  28.     <password>boo</password>
  29.  </query>
  30. </iq><auth mechanism="SCRAM-SHA-1" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">biwsbj1ib28scj15N3hiU2xSVzllSFlrM2dOYU5iczZMY0d4TmFwRlhOcA==</auth><challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cj15N3hiU2xSVzllSFlrM2dOYU5iczZMY0d4TmFwRlhOcGZHdDU5cFJjeHRwamlYZE9tbHlaa1E9PSxzPURBWnVhbFh6WFhGL1U2elhlLzVDNlE9PSxpPTQwOTY=</challenge><response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Yz1iaXdzLHI9eTd4YlNsUlc5ZUhZazNnTmFOYnM2TGNHeE5hcEZYTnBmR3Q1OXBSY3h0cGppWGRPbWx5WmtRPT0scD0vMzJBSUFWcXFWRDFYeEU2cWtaZllFVUJNYXc9</response><success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dj1Hc2dBdk5leGcwYmhIYjNNSmhqTG9CakxNWGs9</success><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="sg1" version="1.0" ><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="3154200605" from="sg1" version="1.0" lang="en" ><stream:features xmlns:stream="http://etherx.jabber.org/streams">
  31.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  32.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  33.  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="wwrSvLFOLzC92POh074kJuEqYxE=" />
  34.  <register xmlns="http://jabber.org/features/iq-register" />
  35. </stream:features><iq id="MX_3" type="get" to="sg1" xmlns="jabber:client">
  36.  <query xmlns="jabber:iq:register" />
  37. </iq>
This post was edited on 2013-06-03, 20:44 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
It looks like MatriX tries to register your account multiple times because your server offer the register feature again after authentication and registration. Normally there should be only the bind and session feature.

Try to set RegisterNewAccount to false in the OnRegister event.
When this works I try to add a workaround for this in the code.

Alex
Avatar
peternorman #5
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
That worked like a charm, Thanks Alex.

  1. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="sg1" version="1.0" ><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="3935017125" from="sg1" version="1.0" xml:lang="en" ><stream:features xmlns:stream="http://etherx.jabber.org/streams">
  2.   <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  3.   <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  4.     <mechanism>PLAIN</mechanism>
  5.     <mechanism>DIGEST-MD5</mechanism>
  6.     <mechanism>SCRAM-SHA-1</mechanism>
  7.   </mechanisms>
  8.   <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="wwrSvLFOLzC92POh074kJuEqYxE=" />
  9.   <register xmlns="http://jabber.org/features/iq-register" />
  10. </stream:features><iq id="MX_1" type="get" to="sg1" xmlns="jabber:client">
  11.   <query xmlns="jabber:iq:register" />
  12. </iq><iq from="sg1" id="MX_1" type="result" xmlns="jabber:client">
  13.   <query xmlns="jabber:iq:register">
  14.     <instructions>Choose a username and password to register with this server</instructions>
  15.     <username />
  16.     <password />
  17.   </query>
  18. </iq><iq type="set" to="sg1" id="MX_2" xmlns="jabber:client">
  19.   <query xmlns="jabber:iq:register">
  20.     <instructions>Choose a username and password to register with this server</instructions>
  21.     <username>boo</username>
  22.     <password>boo</password>
  23.   </query>
  24. </iq><iq from="sg1" id="MX_2" type="result" xmlns="jabber:client">
  25.   <query xmlns="jabber:iq:register">
  26.     <instructions>Choose a username and password to register with this server</instructions>
  27.     <username>boo</username>
  28.     <password>boo</password>
  29.   </query>
  30. </iq><auth mechanism="SCRAM-SHA-1" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">biwsbj1ib28scj00QlFIMVlodFJwYzZCU0FreElVTW9BL2VveTNESWVoTQ==</auth><challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cj00QlFIMVlodFJwYzZCU0FreElVTW9BL2VveTNESWVoTTlFclFyUnBvc29BT1gyKzUzVlFZV0E9PSxzPTB1MEZiVDJLV01qdFNBVUdiY3dLOXc9PSxpPTQwOTY=</challenge><response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Yz1iaXdzLHI9NEJRSDFZaHRScGM2QlNBa3hJVU1vQS9lb3kzREllaE05RXJRclJwb3NvQU9YMis1M1ZRWVdBPT0scD0vd253N0ZNQWpqa2lDa3BYNHNvdWFyR0MvZTg9</response><success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dj1CZ1Bad3FKbFhlaXo1ZG1RbjhzQzBqMFhaZGM9</success><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="sg1" version="1.0" ><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="746322175" from="sg1" version="1.0" lang="en" ><stream:features xmlns:stream="http://etherx.jabber.org/streams">
  31.   <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  32.   <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  33.   <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="wwrSvLFOLzC92POh074kJuEqYxE=" />
  34.   <register xmlns="http://jabber.org/features/iq-register" />
  35. </stream:features><iq id="MX_3" type="set" xmlns="jabber:client">
  36.   <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  37.     <resource>sg1</resource>
  38.   </bind>
  39. </iq><iq id="MX_3" type="result" xmlns="jabber:client">
  40.   <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  41.     <jid>boo@sg1/sg1</jid>
  42.   </bind>
  43. </iq><iq id="MX_4" type="set" xmlns="jabber:client">
  44.   <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  45. </iq><iq type="result" id="MX_4" xmlns="jabber:client">
  46.   <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  47. </iq><iq id="MX_5" type="get" xmlns="jabber:client">
  48.   <query xmlns="jabber:iq:roster" />
  49. </iq><iq from="boo@sg1" to="boo@sg1/sg1" id="MX_5" type="result" xmlns="jabber:client">
  50.   <query xmlns="jabber:iq:roster" />
  51. </iq><presence xmlns="jabber:client">
  52.   <status></status>
  53.   <priority>0</priority>
  54. </presence><message from="sg1" to="boo@sg1" type="normal" xmlns="jabber:client">
  55.   <subject>Welcome!</subject>
  56.   <body>Welcome to this Jabber server.</body>
  57.   <delay xmlns="urn:xmpp:delay" from="sg1" stamp="2013-06-03T17:52:33Z">Offline Storage</delay>
  58.   <x xmlns="jabber:x:delay" stamp="20130603T17:52:33" />
  59. </message><presence from="boo@sg1/sg1" to="boo@sg1/sg1" xmlns="jabber:client">
  60.   <status />
  61.   <priority>0</priority>
  62. </presence>
This post was edited on 2013-06-03, 21:01 by Alex.
Avatar
Alex #6
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
great. I'll add a hack for this ejabberd behavior for the next binary. Then you can remove this code again.

Alex
Avatar
Alex #7
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #4
I have added a fix and uploaded a new release for the full .NET version to the latest binaries.

Alex
Avatar
peternorman #8
Member since Feb 2013 · 19 posts
Group memberships: Members
Show profile · Link to this post
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: MatriX RSS