Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
kevincw01 #1
Member since Oct 2007 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: c# OnPresence event not firing
After I connect and receive OnLogin event callback I register for OnPresence event with:
xmpp.OnPresence += new agsXMPP.protocol.client.PresenceHandler(xmpp_OnPresence);
I also send a test msg to another logged in user in this event, which is received.

In the OnPresence function I do:

MessageBox.Show("presence request");
if (pres.Type == agsXMPP.protocol.client.PresenceType.subscribe)
{
  agsXMPP.protocol.client.PresenceManager pm = new agsXMPP.protocol.client.PresenceManager(xmpp);
  pm.ApproveSubscriptionRequest(pres.From);
  MessageBox.Show("presence request approved");
}

The problem is that the function is never called.  I never get the first(or second) message box.  I know that another user is requesting presence subscribe because if I launch the miniclient and login, I instantly get a presence subscription.  I don't accept it on the miniclient because I want it to still be there for my test.  I can repeat this over and over again so I know the server still requests it.  Incidently, I'm also registered for the OnMessage event and that one never gets called either when I send myself a msg from another client.
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

did you send your own presence to the server?
If you don't send your own presence to the server you will receive no presence packets.
Look in the MiniClient for SendMyPresence(). This is where your own presence gets send to the server.

Alex
Avatar
kevincw01 #3
Member since Oct 2007 · 2 posts
Group memberships: Members
Show profile · Link to this post
that worked, 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 RSS