}
} // InviteToDownloadFunction
private class InviteToBBMConnFunction extends ScriptableFunctionBase {
protected Object execute(Object thiz, Object[] args) throws Exception {
final ScriptableFunction onComplete = (ScriptableFunction) args[0];
// Connection object is optional
final ConnectionObject connObj;
if(args.length >= 2) {
connObj = (ConnectionObject) args[1];
} else {
connObj = null;
}
// Invite from all open connections
if(connObj == null) {
Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
protected void dispatch() {
_uiService.inviteToBBM();
try {
onComplete.invoke(null, null);
} catch(Exception e) {
// do nothing
}
}
});
// Invite from a specific connection
} else {
final BBMPlatformConnection conn = ((ConnectionObject) connObj).getConnection();
Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
protected void dispatch() {
_uiService.inviteToBBM(conn);
try {
onComplete.invoke(null, null);
} catch(Exception e) {
// do nothing
}
}
});