Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
Kanekis #1
Member since Mar 2015 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: OnPresence and OnRosterList idle
Currently, I am able to be connected to the server, and I was able to set my "status" and my presence. However, I am unable to get my "friends/buddies/contacts" to come up.

  1. xmpp = new XmppClientConnection();
  2. xmpp.ConnectServer =
  3. xmpp.UseSSL = true;
  4. xmpp.Port = 5223;
  5.  
  6. xmpp.Server =
  7. xmpp.Resource =
  8.  
  9. xmpp.UseSSL = true;
  10. xmpp.Port = 5223;
  11.  
  12. xmpp.Username = username;
  13. xmpp.Password = password;
  14. xmpp.SocketConnectionType = SocketConnectionType.Direct;
  15. xmpp.AutoRoster = true;
  16. xmpp.AutoPresence = true;
  17. xmpp.AutoResolveConnectServer = false;
  18. xmpp.AutoAgents = false;
  19. xmpp.RegisterAccount = false;
  20. xmpp.UseCompression = false;
  21.  
  22. xmpp.OnReadXml += new XmlHandler(OnReadXml);
  23. xmpp.OnWriteXml += new XmlHandler(OnWriteXml);
  24.  
  25. xmpp.OnStreamError += new XmppElementHandler(OnStreamError);
  26. xmpp.OnSocketError += new ErrorHandler(OnSocketError);
  27. xmpp.ClientSocket.OnValidateCertificate += new RemoteCertificateValidationCallback(ClientSocket_OnValidateCertificate);
  28.  
  29. xmpp.OnIq += new IqHandler(OnIq);
  30. xmpp.OnRosterStart += new ObjectHandler(OnRosterStart);
  31. xmpp.OnRosterItem += new agsXMPP.XmppClientConnection.RosterHandler(OnRosterItem);
  32. xmpp.OnRosterEnd += new ObjectHandler(OnRosterEnd);
  33.  
  34. xmpp.OnPresence += new PresenceHandler(OnPresence);
  35. xmpp.OnMessage += new MessageHandler(OnMessage);
  36. xmpp.OnError += new ErrorHandler(OnError);
  37. xmpp.OnLogin += new ObjectHandler(OnLogin);
  38. xmpp.OnAuthError += new XmppElementHandler(OnAuthError);
  39. xmpp.OnClose += new ObjectHandler(OnClose);
  40. xmpp.OnSaslStart += new agsXMPP.sasl.SaslEventHandler(OnSaslStart);
  41.  
  42. try { xmpp.Open(); }
  43. catch {  }
  44.  
  45. do { Thread.Sleep(300); }
  46. while (!xmpp.Authenticated);
  47.  
  48. for (bool IsBinding = false; IsBinding == false; Thread.Sleep(1000))
  49.    if (xmpp.XmppConnectionState.ToString().CompareTo("Binding") != 0)
  50.        IsBinding = true;

And for my OnPresence and OnRosterList I have (unfortunately, none of the following works.):
  1. private void OnRosterStart(object sender)
  2. {
  3.     Console.WriteLine("Roster has started.");
  4. }
  5.  
  6. private void OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item)
  7. {
  8.     messenger.AddToRoster(item.Name);
  9.     messenger.AddToRoster(item.Jid.User);
  10. }
  11. private void OnRosterEnd(object sender)
  12. {
  13.     Console.WriteLine("Roster has ended.");
  14. }
  15.  
  16. private void OnPresence(object sender, Presence pres)
  17. {
  18.     MessageBox.Show("Hello");
  19.     Console.WriteLine("Here are your contacts: ");
  20.     Console.WriteLine("{0}@{1}  {2}", pres.From.User, pres.From.Server, pres.Type);
  21. }
[Image: http://puu.sh/gr73T/a8595b59aa.png]

Thanks,

-
Kanekis
This post was edited on 2015-03-10, 14:11 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
please post the complete Xml log as text, I cannot see a lot in the screenshot of your console.

I see you not receiving the contact list. It looks to me like you send out a presence packet to the server to early.
Also your presence includes lots of encoded text, is that by intention?

Alex
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