private class SetStatus extends ScriptableFunctionBase {
protected Object execute(Object thiz, Object[] args) throws Exception {
final String status = (String) args[0];
final String statusMessage = (String) args[1];
final ScriptableFunction onComplete = (ScriptableFunction) args[2];
final int statusInt = BBMPlatformUser.statusToInt(status);
Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
protected void dispatch() {
boolean result;
try {
result = ((UserProfile) _presence).setStatus(statusInt, statusMessage);
} catch(Exception e) {
Util.logError("UserProfile#setStatus() threw " + e);
result = false;
}
try {
onComplete.invoke( null, new Object[] { new Boolean(result) });
} catch(Exception e) {
// do nothing
}
}
});