powered by Jive Software

MessageEventManager question

Does the MessageEventManager keep track of what requests people have made, or do I need to do that?

I ask because a delivered event was sent to a user that did not request it. It is a headlines bot, and when it recieves the delivered event, it responds to me the way headline bots do when you send them a regular message (they send you a list of available feeds).

Does the MessageEventManager keep track of what

requests people have made, or do I need to do that?

What do you mean? As far as I understand the MessageEventManager, you can use it to send Events and hook up your own handlers. So it tracks requests other people do: See addMessageEventRequestListener. It doesn’‘t track “requests for events” from you, I think. If you are unsure if your message contains requests for events, try addNotificationsRequests(theMessage, false, false, false, false) - but I’'m not sure if you want that?

I ask because a delivered event was sent to a user

that did not request it. It is a headlines bot, and

when it recieves the delivered event, it responds to

me the way headline bots do when you send them a

regular message (they send you a list of available

feeds).

How is this connected to Smack? Is the bot written by you/with Smack? You could register a handler for delivered events and dispatch them…

If the client talking to the headline bot is written in smack and the real “problem”: See above: Try to remove all event requests from a message before you send it.

Could you provide some more details? I’'m rather new to smack so I might be completely wrong here.

I believe that MessageEventManager at least partly tracks who wants to receive what. If I watch the smack debug window, events are not sent to users who have not requested them yet, even if I don’'t track them myself.

However, events are sent to anyone regardless of who requests it.

The headlines bot is the standard rss feed bot that’‘s out there. The only thing it has to do with smack is that it’'s essentially just another jabber user out there. It sends me a message, smack sends it a .

Okay - now I got you.

You might want to look at

org.jivesoftware.smackx.DefaultMessageEventRequestListener.java

The header reads:

+Default implementation of the MessageEventRequestListener interface.

This class automatically sends a delivered notification to the sender of the message

if the sender has requested to be notified when the message is delivered.

But of course this handler should only be fired when the client asks for a delivered event. Looking at the MessageEventManager source I don’‘t see any obvious problem, but then again: I’'m still new to jive/smack…

And right now I’'m not sure where this DefaultMessageEventRequestListener is used anyway… scratch

Gato? What do you think?

Hey Adam,

I ask because a delivered event was sent to a user

that did not request it. It is a headlines bot, and

when it recieves the delivered event, it responds to

me the way headline bots do when you send them a

regular message (they send you a list of available

feeds).

It seems that you have two clients written in Smack. One is a bot and the other one is a “human” client. I guess that the “human” client has added to the MessageEventManager an instance of DefaultMessageEventRequestListener or a subclass of it. That would explain why you are observing that events are being sent automatically.

But the event should only be sent to clients that included in their message a jabber:x:event extension asking to be notified if the other client received the packet. For this reason, I suggest checking the message that the bot is sending to the “human” client because I guess that that message includes a jabber:x:event extension.

Moreever, I think that you could add an extra check to your bot to check that he is not reacting to a message that only contains events information. You will see that the automatic Message that Smack is sending saying that the message was delivered does not contain any body and only has a jabber:x:event extension.

Let me know if my guessing was incorrect. In that case, I would need to review the XML packets sent and received by each client.

Regards,

– Gato

Ok, this is the very first message I recieve from the headlines bot (which is not a smack bot):

<message from=''jivesoftware@headlines.jabber.razorsedge.org'' to=''synic@jbother.org'' type=''headline''><body>
not quite sure what''s causing this exception:
java.lang.NoSuchMethodException: http://www.jivesoftware.org/forums/thread.jspa?threadID=13974</body><subject>MessageEventManager Exception</subject><x xmlns=''jabber:x:oob''><url>http://www.jivesoftware.org/forums/thread.jspa?threadID=13974</url><desc>MessageEventManager Exception</desc></x></message>

And this is the message that smack sends back to it:

<message id="LNuqm-7" to="jivesoftware@headlines.jabber.razorsedge.org"><x xmlns="jabber:x:event"><delivered/><id>LNuqm-6</id></x></message>

The delivered is never requested?

Strange message is sending the bot.

Smack is actually responding that the message whose ID is “LNuqm-6” has been received. That ID does not correspond to the message the bot is sending so you must be receiving another message. Please, check in the debugger window the message whose ID is “LNuqm-6”. It seems that that message was also sent by the bot which is quite strange.

Regards,

– Gato

ok, here’‘s another one - I guess the headlines bot just plain isn’'t sending an ID with the first message.

<message from=''slashdot@headlines.jabber.razorsedge.org'' to=''synic@jbother.org'' type=''headline''><body>Browser Speed Comparisons http://slashdot.org/article.pl?sid=05/02/11/2016227&amp;from=rss</body><subject>Browser Speed Comparisons</subject><x xmlns=''jabber:x:oob''><url>http://slashdot.org/article.pl?sid=05/02/11/2016227&amp;from=rss</url><desc>Browser Speed Comparisons</desc></x></message>

and the response:

<message id="gIEY5-6" to="slashdot@headlines.jabber.razorsedge.org"><x xmlns="jabber:x:event"><delivered/><id>gIEY5-5</id></x></message>

Adam