1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22:41 +01: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) {
switch ($message->getCommand()) {
case 'MESSAGE':
$this->speak(
$message->getBody(),
$message->getTarget());
break;
case 'MESSAGE':
$this->speak(
$message->getBody(),
$message->getTarget());
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]);
}
private function speak($message, $room_id) {
private function speak($message, $room_id, $type='TextMessage') {
$this->performPost(
"/room/{$room_id}/speak.json",
array(
'message' => array(
'type' => 'TextMessage',
'type' => $type,
'body' => $message)));
}