powered by Jive Software

New Thread about existing bugs

I’ll explain AbstractJID#escapedNode(String) in specialty.

See the call stack trace

Main Thread (Suspended)
** org.jivesoftware.xiff.core::AbstractJID$/escapedNode
org.jivesoftware.xiff.core::EscapedJID
org.jivesoftware.xiff.data.im::RosterItem/get jid
org.jivesoftware.xiff.im::Roster/fetchRoster_result **
Function/http://adobe.com/AS3/2006/builtin::apply [no source]
org.jivesoftware.xiff.core::XMPPConnection/handleIQ
org.jivesoftware.xiff.core::XMPPSocketConnection/bSocketReceivedData
flash.events::EventDispatcher/dispatchEventFunction [no source]
flash.events::EventDispatcher/dispatchEvent [no source]
org.jivesoftware.xiff.util::SocketConn/onSockRead
org.jivesoftware.xiff.util::SocketConn/onRead

See Roster#fetchRoster_result( resultIQ:IQ ) line 396, it calls addRosterItem( new UnescapedJID(item.jid) …), and item.jid calls the constructor of EscapedJID(getNode().attributes.jid), in this situation, if the jid itself contains ‘\’ such as “aaaa\40msn.com@msn.s100”, then the constructor calls its parent’s method** AbstractJID#escapedNode**, this** **causes “aaaa\40msn.com@msn.s100” is escaped to “aaaa\5c40msn.com@msn.s100”.

In fact, I don’t think my code can sovle the problem by the roots. I guess development team should consider deeply in Roster#fetchRoster_result( resultIQ:IQ )

Roster.as

I saw this bug has beed reported by someone else in this community. But my solution is a little defferent, it doesn’t need to construct UnescapedJID but just replace item with rosterItemVO

thanks,

Index: src/org/jivesoftware/xiff/conference/Room.as

— src/org/jivesoftware/xiff/conference/Room.as (revision 10963)
+++ src/org/jivesoftware/xiff/conference/Room.as (working copy)
@@ -462,7 +462,7 @@
if( isActive ) {
var tempIQ:IQ = new IQ( roomJID.escaped, IQ.SET_TYPE, XMPPStanza.generateID(“voice_”) );
var ext:MUCAdminExtension = new MUCAdminExtension(tempIQ.getNode());

  •            ext.addItem(null, voice ? MUC.PARTICIPANT_ROLE : MUC.VISITOR_ROLE);
    
  •            ext.addItem(null, voice ? MUC.PARTICIPANT_ROLE : MUC.VISITOR_ROLE, occupantNick);
               tempIQ.addExtension(ext);
               myConnection.send( tempIQ );
           }
    

Index: src/org/jivesoftware/xiff/core/AbstractJID.as

— src/org/jivesoftware/xiff/core/AbstractJID.as (revision 10963)
+++ src/org/jivesoftware/xiff/core/AbstractJID.as (working copy)
@@ -44,7 +44,7 @@
n.indexOf("<") >= 0 ||
n.indexOf(">") >= 0))
{

  •            n = n.replace(/\\/g, "\\5c");
    

+// n = n.replace(/\/g, “\5c”);
n = n.replace(/@/g, “\40”);
n = n.replace(/ /g, “\20”);
n = n.replace(/&/g, “\26”);
Index: src/org/jivesoftware/xiff/data/Message.as

— src/org/jivesoftware/xiff/data/Message.as (revision 10963)
+++ src/org/jivesoftware/xiff/data/Message.as (working copy)
@@ -204,6 +204,9 @@
public function get subject():String
{
if (mySubjectNode == null) return null;

  •        if(mySubjectNode.firstChild == null) {
    
  •            return "";
    
  •        }
           return mySubjectNode.firstChild.nodeValue;
       }
    

Index: src/org/jivesoftware/xiff/im/Roster.as

— src/org/jivesoftware/xiff/im/Roster.as (revision 10963)
+++ src/org/jivesoftware/xiff/im/Roster.as (working copy)
@@ -458,7 +458,7 @@
{
case RosterExtension.SUBSCRIBE_TYPE_NONE:
ev = new RosterEvent(RosterEvent.SUBSCRIPTION_REVOCATION);

  •                                    ev.jid = item.jid;
    
  •                                    ev.jid = rosterItemVO.jid;
                                       dispatchEvent( ev );
                                       break;
    

@@ -470,7 +470,7 @@
}
//should be impossible for getItemIndex to return -1, since we just looked it up
ev.data = removeItemAt(getItemIndex(rosterItemVO));

  •                                    ev.jid = item.jid;
    
  •                                    ev.jid = rosterItemVO.jid;
                                       dispatchEvent(ev);
                                       break;
    

@@ -486,12 +486,12 @@
if( item.subscription.toLowerCase() != RosterExtension.SUBSCRIBE_TYPE_REMOVE && item.subscription.toLowerCase() != RosterExtension.SUBSCRIBE_TYPE_NONE)
{
// Add this item to the roster if it’s not there and if the subscription type is not equal to ‘remove’ or ‘none’

  •                                addRosterItem( item.jid, item.name, RosterExtension.SHOW_UNAVAILABLE, "Offline", groups, item.subscription.toLowerCase(), item.askType != null ? item.askType.toLowerCase() : RosterExtension.ASK_TYPE_NONE );
    
  •                                addRosterItem( rosterItemVO.jid, item.name, RosterExtension.SHOW_UNAVAILABLE, "Offline", groups, item.subscription.toLowerCase(), item.askType != null ? item.askType.toLowerCase() : RosterExtension.ASK_TYPE_NONE );
                               }
                               else if( (item.subscription.toLowerCase() == RosterExtension.SUBSCRIBE_TYPE_NONE || item.subscription.toLowerCase() == RosterExtension.SUBSCRIBE_TYPE_FROM) && item.askType == RosterExtension.ASK_TYPE_SUBSCRIBE )
                               {
                                   // A contact was added to the roster, and its authorization is still pending.
    
  •                                addRosterItem( item.jid, item.name, RosterExtension.SHOW_PENDING, "Pending", groups, item.subscription.toLowerCase(), item.askType != null ? item.askType.toLowerCase() : RosterExtension.ASK_TYPE_NONE );
    
  •                                addRosterItem( rosterItemVO.jid, item.name, RosterExtension.SHOW_PENDING, "Pending", groups, item.subscription.toLowerCase(), item.askType != null ? item.askType.toLowerCase() : RosterExtension.ASK_TYPE_NONE );
                               }
                           }
                       }