1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Updated Campfire adapter to be able to post sound messages and paste messages.

Test Plan: Ran the bot with a handler that sends sound commands.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4922
This commit is contained in:
indiefan 2013-02-12 11:30:14 -08:00 committed by epriestley
parent edaff9e2a3
commit eb942f3e1e

View file

@ -129,11 +129,23 @@ extends PhabricatorBaseProtocolAdapter {
public function writeMessage(PhabricatorBotMessage $message) { public function writeMessage(PhabricatorBotMessage $message) {
switch ($message->getCommand()) { switch ($message->getCommand()) {
case 'MESSAGE': case 'MESSAGE':
$this->speak( $this->speak(
$message->getBody(), $message->getBody(),
$message->getTarget()); $message->getTarget());
break; break;
case 'SOUND':
$this->speak(
$message->getBody(),
$message->getTarget(),
'SoundMessage');
break;
case 'PASTE':
$this->speak(
$message->getBody(),
$message->getTarget(),
'PasteMessage');
break;
} }
} }
@ -147,12 +159,12 @@ extends PhabricatorBaseProtocolAdapter {
unset($this->inRooms[$room_id]); unset($this->inRooms[$room_id]);
} }
private function speak($message, $room_id) { private function speak($message, $room_id, $type='TextMessage') {
$this->performPost( $this->performPost(
"/room/{$room_id}/speak.json", "/room/{$room_id}/speak.json",
array( array(
'message' => array( 'message' => array(
'type' => 'TextMessage', 'type' => $type,
'body' => $message))); 'body' => $message)));
} }