Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
gdahilig #1
Member since Jun 2006 · 19 posts · Location: Pasadena,CA
Group memberships: Members
Show profile · Link to this post
Subject: OnPresence Event handler not being called
Hello,

In my application, I don't appear to be getting OnPresence events.  Here what I have done so far:

  • Searched the forum for any Presence-related threads.  I found one item that seemed relevant:  it said to make sure that my app is signed on to the server, otherwise no presence event would be sent.

  • I am sending my presence on start up:
    m_connection.Show = ShowType.NONE;
    m_connection.Status = "Online";
    m_connection.SendMyPresence();

  • I am subsribing to the event like so:
    m_connection.OnPresence += new agsXMPP.XmppClientConnection.PresenceHandler(this.OnPresenceHandler);

  • I have verified that my app is "online" using a third-party IMs(Gaim, Miranda, & Mini-client) and the Wildfire server admin console.  They all correctly show my app as "Online."

  • I have verified that the mini client works correctly.  I have traced thru and, as far as presence is concered, I've done everything that I'm supposed to.  

But my OnPresenceHandler() never gets called.  Is there something I'm doing wrong or something else that I should do?

Gene
This post was edited on 2006-08-10, 23:01 by gdahilig.
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Gene,

what do you mean by sending presence on startup?
You should send it when you are authenticated to the server. This is normally in the OnLogin event.

You subscribe correct to the OnPresence event. You should get the event until you remove the subscription or the XmppClientConnection object gets disposed for some reason.

Alex
Avatar
gdahilig #3
Member since Jun 2006 · 19 posts · Location: Pasadena,CA
Group memberships: Members
Show profile · Link to this post
Alex,

Thanks for your quick reply.....

what do you mean by sending presence on startup?
Sorry.  Yes, I send my presence after authentication.

Where should I look in the XMPP library for the code that raises the presence events?


Gene
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

look in XmppClientConnection
public override void StreamParserOnStreamElement(object sender, Node e)

if you post your code or attach a example then we can look at the code.

Alex
Avatar
gdahilig #5
Member since Jun 2006 · 19 posts · Location: Pasadena,CA
Group memberships: Members
Show profile · Link to this post
Alex,

re: post code

I inherited a rather large library built on top of your xmpp libaries.  I'm sure it's a bug in there, but I'm still looking.  Just short of sending you the whole mess, is there something specific I can show you?

I put a breakpoint in StreamParserOnStreamElement() and it looks like it never gets called with a presence node type.  Under what conditions would that happen?  I does however get called for other node types (i.e. "iq").

gene
This post was edited on 2006-08-11, 00:14 by gdahilig.
Avatar
Alex #6
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hello,

this happens if you never receive a presence node. Reasons for that could be that there is really no presene sent from the server. Or the presence packet could not be build in the xml parser. This could happen if the server is not namespace correct. You can look in the ElementFactory under which conditions presence packets are build.

AddElementType("presence", Uri.CLIENT, typeof(agsXMPP.protocol.client.Presence));
AddElementType("presence", Uri.ACCEPT, typeof(agsXMPP.protocol.component.Presence));

Alex
Avatar
gdahilig #7
Member since Jun 2006 · 19 posts · Location: Pasadena,CA
Group memberships: Members
Show profile · Link to this post
Alex,

re: AddElementType()
I found those two lines of code and they do get executed.  Other than that, I can't tell if anything is awry.

re: if the server is" not namespace correct"
I'm using the Wildfire server.  Also, the other clients I have running in this test (Gaim, MiniClient, and Miranda) all seem to pick up presence ok.  That tells me the server is probably doing the right thing. 

Any other suggestions?

gene
Avatar
Alex #8
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

its hard to find the problem if we don't see the code. If MiniClient works correct then there is no problem in agsXMPP.
Could you at least send a XML Debug of your session and mark the point where you would expect presence packets?

Alex
Avatar
gdahilig #9
Member since Jun 2006 · 19 posts · Location: Pasadena,CA
Group memberships: Members
Show profile · Link to this post
Alex,

I agree that the xmpp library is most likely working correctly.  I'm definitely think it usage is suspect.  I can send you snippets, I just need to know what to send.  The original develper abstracted the use of your library so we could use a single (abstracted) interface for different protocols, which  means I'll need to dig a little to find the right piece of code to show.  My earlier posts show the lines where it subscribes to the event. 

I'll generate a debug XML trace for us to look at....


quick question:

In FireOnReadXml() does the code

OnReadXml(sender, xml);

call all delegates that have been subscribed? I'm used to seeing a loop that enumerates thru each one to make the notifications.  Or does it do it automatically? 

gene
This post was edited on 2006-08-11, 01:43 by gdahilig.
Avatar
Jabberer #10
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Hello,

as Alex said it is hard for us to figure out a problem without source code.
FireOnReadXML() fires the OnReadXml() handler. This is to show your all incoming XML after its processed in the agsXMPP StreamParser.

Please give us more info about your application. A XML Debug (in & out) would be helpful.

  • Do other people see you online when you login with your application?
  • Do you login with the same account in your application which doesnt work and the otehr apps like MiniClient which work?
Software Developer
AG-Software
This post was edited on 2006-08-11, 13:26 by Jabberer.
Avatar
jhuerta #11
Member since Oct 2007 · 7 posts
Group memberships: Members
Show profile · Link to this post
Hi,
In my case, i was getting a similar problem.
After userA was being authenticated, userB was sending to userA  presence/subscribe packet.

userA was not getting the presence packet.

It turned out that I was not calling  " m_connection.SendMyPresence(); " after being authenticated.

That fixed the problem.

thanks for your comments in this thread. It puts an end to several hours of debugging :D

- Juan
Avatar
Alex #12
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes, we see that many people have this problem.
We should add this to the FAQs or send the presence automatically to the server in XmppClientConnection after successful authentication.

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