forked from GNUsocial/gnu-social
Twitter-compatible API - hooked in command interpreter
darcs-hash:20081005030915-462f3-0c0541f062020ee958f1df0361e27f44d6c35e95.gz
This commit is contained in:
parent
06a80c829b
commit
2c2821799d
@ -331,6 +331,23 @@ class TwitapistatusesAction extends TwitterapiAction {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for commands
|
||||
$inter = new CommandInterpreter();
|
||||
$cmd = $inter->handle_command($user, $status);
|
||||
|
||||
if ($cmd) {
|
||||
|
||||
if ($this->supported($cmd)) {
|
||||
$cmd->execute(new Channel());
|
||||
}
|
||||
|
||||
// cmd not supported? Twitter just returns your latest status.
|
||||
// And, it returns your last status whether the cmd was successful
|
||||
// or not!
|
||||
$n = $user->getCurrentNotice();
|
||||
$apidata['api_arg'] = $n->id;
|
||||
} else {
|
||||
|
||||
$reply_to = NULL;
|
||||
|
||||
if ($in_reply_to_status_id) {
|
||||
@ -354,16 +371,10 @@ class TwitapistatusesAction extends TwitterapiAction {
|
||||
}
|
||||
|
||||
common_broadcast_notice($notice);
|
||||
|
||||
// FIXME: Bad Hack
|
||||
// I should be able to just sent this notice off for display,
|
||||
// but $notice->created does not contain a string at this
|
||||
// point and I don't know how to convert it to one here. So
|
||||
// I'm forced to have DBObject pull the notice back out of the
|
||||
// DB before printing. --Zach
|
||||
$apidata['api_arg'] = $notice->id;
|
||||
$this->show($args, $apidata);
|
||||
}
|
||||
|
||||
$this->show($args, $apidata);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -688,5 +699,17 @@ class TwitapistatusesAction extends TwitterapiAction {
|
||||
return User::staticGet('nickname', $id);
|
||||
}
|
||||
}
|
||||
|
||||
function supported($cmd) {
|
||||
|
||||
$cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', 'FavCommand');
|
||||
|
||||
if (in_array(get_class($cmd), $cmdlist)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user