3 Replies Last post: Dec 19, 2007 2:36 PM by hakan eryargi  
hakan eryargi Bronze 3 posts since
Dec 18, 2007
Currently Being Moderated

Dec 18, 2007 12:38 PM

initial message lost when chat is created

 

hello,

 

i'm new to smack so excuse me if this is a silly question.

 

 

 

when a new message is arrived to smack, ChatManagerListener.chatCreated method is called however MessageListener.processMessage is not called. so i cannot reach the first message in chat sequence. I'm adding MessageListener at the point chat is created.

 

 

 

how to handle this situation ?

 

 

 

thanks  in advance,

 

 

r a f t

 

 

 

 

below is the message sent from gaim to smack:

 

 

<message to="translator.bot@gmail.com/Smack4B4C3077" from="aptal.karga@gmail.com/Gaim13E2D651" type="chat">

  <body>hello</body>

  <x xmlns="jabber:x:event">

    <composing/>

  </x>

  <html xmlns="http://jabber.org/protocol/xhtml-im">

    &lt;body xmlns="http://www.w3.org/1999/xhtml">hello</body>

  &lt;/html&gt;

  &lt;x xmlns="google:nosave"/&gt;

  &lt;record xmlns="http://jabber.org/protocol/archive"/>

&lt;/message&gt;

 

 

 

 

Sabine Dinis Blochberger Gold 285 posts since
Oct 21, 2005
Currently Being Moderated
Dec 19, 2007 4:04 AM in response to: hakan eryargi
Re: initial message lost when chat is created

It should work the way you describe - add the listener before showing the message. I had a similar problem when I was adding synchronization (which wasn't necessary at all). You might have some other timeconsuming thing going on that causes the packet to get lost so to say.

Chris Ward Silver 100 posts since
Aug 16, 2005
Currently Being Moderated
Dec 19, 2007 10:35 AM in response to: hakan eryargi
Re: initial message lost when chat is created

One thing to remember too is that the chat manager is using weak references to store chat objects, so as specified in the JavaDoc you must manually keep a reference to the chat object when it gets created otherwise it could be garbage collected before the message is processed.  When a chat created callback is issued, I add the message listener and then put the chat into a hash map.  I then receive a callback for the first message.

 

Chris

More Like This

  • Retrieving data ...