Not logged in. · Lost password · Register
Forum: agsXMPP RSS
<message xmlns="jabber:client" to="user1@gmail.com/Sharp Mess2530C034" type="error" from="user2@googlemail.com">
Avatar
Maciej #1
Member since Jul 2012 · 12 posts
Group memberships: Members
Show profile · Link to this post
Subject: Interpreting errors as messages and looping?
Hi Alex,

is it possible that there is a bug in the library?

As soon as I receive XML tag like the following (which is actually an error and not a message) the OnMessage event is fired and then my bot thinks it received an actual messages and is trying to respond with another message which causes the same issue. This scenario ends up in a loop of messages.

  1. <message xmlns="jabber:client" to="user1@gmail.com/Sharp Mess2530C034" type="error" from="user2@googlemail.com"><body>message</body><error type="modify" code="302"><gone xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></message>

Is it possible to detect the error somehow and not to interpret it as message?

I think this error occurs when you are using googlemail.com as domain instead of gmail.com. User 2 normally uses the e-mail address user2@gmail.com but if a customer makes a mistake and takes user2@googlemail.com as e-mail address then the issue occurs.

What do you think?
This post was edited 2 times, last on 2014-03-23, 17:44 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no that is no bug, it's normal behaviour. You have to check the message type in your code and react to it properly.

eg:
  1. if (msg.Type == msgtype.error)
  2.    // error message
  3. if (msg.Type == msgtype.chat)
  4.    // chat mesage
  5. if (msg.Type == msgtype.headline)
  6.    // headline message
  7.  
  8. // to continue

I think you are sending a message to a resource which is not available (went offline).

Alex
Avatar
Maciej #3
Member since Jul 2012 · 12 posts
Group memberships: Members
Show profile · Link to this post
That makes sense, thank you very much ;)
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