powered by Jive Software

AddBuddy in xiff 2.0.0b4

Hi, I got some problems with adding buddy and granting subscritptions.

I’'m doing a a simple client that grant subscription automatically.

This is the addBuddy Function :

public function addBuddy(jid:String){

var realJID = jid.split("/")[0]; // remove /xiff from JID

this.buddyRoster.addContact(realJID,realJID , null, false);

this.buddyRoster.grantSubscription(realJID, true);

}

and this is the “subscriptionRequest” handler:

public function onSubscriptionRequest(evt){

this.buddyRoster.grantSubscription(evt.jid, false);

this.buddyRoster.fetchRoster();

}

All seem work well, except that I’'ve to do a fetchRoster after granting subscription to se the new contact in the roster.

When I do so, the new contact “show” value is always unavailable.

This doesn’'t seems a subscription problem, because if I log out and then log in, the new contact status is “normal”.

Any idea?

Thanks in advance

Marco Nava

Ok, I think I’'ve solved the fetchRoster problem, and all seems working flawlessly now.

I’'ve changed this line in Roster.as (near line: 527):

case RosterExtension.NS:


var tempIQ:IQ = eventObj.data; <----

var ext:RosterExtension = tempIQ.getAllExtensionsByNS( RosterExtension.NS )[0];

var rosterItem = ext.getAllItems()[0];

with

case RosterExtension.NS:

//var tempIQ:IQ = eventObj.data;

var tempIQ:IQ = eventObj.iq;

var ext:RosterExtension = tempIQ.getAllExtensionsByNS( RosterExtension.NS )[0];

var rosterItem = ext.getAllItems()[0];

Because i think eventObj.data is not of type==IQ.

All seems to work now.

Am I wrong?

Bye

Marco