Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
cweimer #1
Member since Aug 2008 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: error getting Items from a pubsub Event
Hi,

First, version info:
agsXMPP 1.00
server: Openfire 3.5.2 (Windows)

I have been experimenting with pubsub for use in a client that I am developing.  I have been successful in creating a new pubsub node on the server, subscibing to that node, publishing items to the node, and receiving the corresponding notification through the OnMessage event.  However, I have an issue while parsing the received event.  The @event.Event.Items property is always returning null.

When I receive an OnMessage event, I check to see if the message is a pubsub event using:
agsXMPP.protocol.extensions.pubsub.@event.Event pubSubEvent =
   message.SelectSingleElement ( typeof (
      agsXMPP.protocol.extensions.pubsub.@event.Event ) ) as
   agsXMPP.protocol.extensions.pubsub.@event.Event;

If pubSubEvent is not null, I have a pubsub event, and I then try to extract the "items" from the event using:
agsXMPP.protocol.extensions.pubsub.@event.Items eventItems =
   pubSubEvent.Items;

It is at this point, where eventItems is always null.

Looking into this some more, it seems that the "items" tag that is received by the server is being changed to "item" within agsXMPP.  When I add handlers for OnReadSocketData and OnReadXml I see the following data:

Socket Read:
<message from="pubsub.laptop02" to="scm@laptop02" id="pubsub_test__scm@laptop02__7s0GX"><event xmlns="http://jabber.org/protocol/pubsub#event"><items node="pubsub_test"><item id="68RpEHF4MnqkM6X"><entry xmlns="http://jabber.org/protocol/pubsub">client5:Available</entry></item></items></event><headers xmlns="http://jabber.org/protocol/shim"><header name="pubsub#subid">74tU1D0gOR21DvUykpm8I4813dSesrKI37BcVXGO</header></headers></message>


XML Read:
<message xmlns="jabber:client" from="pubsub.laptop02" to="scm@laptop02" id="pubsub_test__scm@laptop02__7s0GX"><event xmlns="http://jabber.org/protocol/pubsub#event"><item node="pubsub_test"><item id="68RpEHF4MnqkM6X"><entry xmlns="http://jabber.org/protocol/pubsub">client5:Available</entry></item></item></event><header xmlns="http://jabber.org/protocol/shim"><headers name="pubsub#subid">74tU1D0gOR21DvUykpm8I4813dSesrKI37BcVXGO</headers></header></message>


I have tried fixing the Items by using pubSubEvent.FirstChild.TagName = "items", but I still don't get the @event.Event.Items property to work as would expect.  Am I using something incorrectly, or do you think that it might be a bug in the code?

Thanks,
Chris
Avatar
Alex #2
Member since Feb 2003 · 4288 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi Chris,

i found an error in the ElementFactory for @event.Items.
I fixed this bug and checked in a new version to SVN.

Regards,
Alex
This post was edited on 2012-01-31, 20:01 by Alex.
Avatar
cweimer #3
Member since Aug 2008 · 3 posts
Group memberships: Members
Show profile · Link to this post
Alex,

I took a look at the diff and made the same change in my local code.  I can now parse the received pubsub events correctly.  Thank you for your quick reply to this!

Chris
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