Details
Description
Below is a patch file for XMPPConnection.as, you can also read it from attachment. I'm sorry that I could not set background color for text.
As you can see, I want XMPPConnection not to fire error event when it meets a message with error type. Because I wish a message with error type has its own logic.
Thanks,
Index: H:/toybrick/xiff/src/org/jivesoftware/xiff/core/XMPPConnection.as
===================================================================
— H:/toybrick/xiff/src/org/jivesoftware/xiff/core/XMPPConnection.as (revision 10963)
+++ H:/toybrick/xiff/src/org/jivesoftware/xiff/core/XMPPConnection.as (working copy)
@@ -800,11 +800,11 @@
throw new SerializationException();
}
// ADDED in error handling for messages
- if( msg.type == Message.ERROR_TYPE ) { - var exts:Array = msg.getAllExtensions(); - dispatchError( msg.errorCondition, msg.errorMessage, msg.errorType, msg.errorCode, exts.length > 0 ? exts[0] : null); - }
- else
+// if( msg.type == Message.ERROR_TYPE ) { +// var exts:Array = msg.getAllExtensions(); +// dispatchError( msg.errorCondition, msg.errorMessage, msg.errorType, msg.errorCode, exts.length > 0 ? exts[0] : null); +// }+// else
{
var event:MessageEvent = new MessageEvent();
event.data = msg;
Here's a fix. I also fixed a minor bug in the logger.debug statement such that the stanza xml will be written out insteaf of "[object Message]"
Note that the XIFFError is still broadcasted for backwards compatability.
replace handleMessage() in XMPPConnection.as[794]
`{ protected function handleMessage( node:XMLNode ):Message
{0}{
var msg:Message = new Message();
logger.debug("MESSAGE:
", msg.getNode().toString()); //Typidee: write out message xml instead of just "[object Message]"
{ throw new SerializationException(); }// Populate with data
if( !msg.deserialize( node ) )
// ADDED in error handling for messages
{ var exts:Array = msg.getAllExtensions(); dispatchError( msg.errorCondition, msg.errorMessage, msg.errorType, msg.errorCode, exts.length > 0 ? exts[0] : null); }if( msg.type == Message.ERROR_TYPE )
//typidee.com: Don't suppress MessageEvent(s) of Message.ERROR_TYPE
var event:MessageEvent = new MessageEvent();
event.data = msg;
dispatchEvent( event );
return msg;
}`