public function receiveMessage(PhabricatorIRCMessage $message)
 {
     switch ($message->getCommand()) {
         case 'PRIVMSG':
             $reply_to = $message->getReplyTo();
             if (!$reply_to) {
                 break;
             }
             if (!$this->isChannelName($reply_to)) {
                 // Don't log private messages, although maybe we should for debugging?
                 break;
             }
             $logs = array(array('channel' => $reply_to, 'type' => 'mesg', 'epoch' => time(), 'author' => $message->getSenderNickname(), 'message' => $message->getMessageText()));
             $this->futures[] = $this->getConduit()->callMethod('chatlog.record', array('logs' => $logs));
             $prompts = array('/where is the (chat)?log\\?/i', '/where am i\\?/i', '/what year is (this|it)\\?/i');
             $tell = false;
             foreach ($prompts as $prompt) {
                 if (preg_match($prompt, $message->getMessageText())) {
                     $tell = true;
                     break;
                 }
             }
             if ($tell) {
                 $response = $this->getURI('/chatlog/channel/' . phutil_escape_uri($reply_to) . '/');
                 $this->write('PRIVMSG', "{$reply_to} :{$response}");
             }
             break;
     }
 }
 private function handleSymbols(PhabricatorIRCMessage $message)
 {
     $reply_to = $message->getReplyTo();
     $text = $message->getMessageText();
     $matches = null;
     if (!preg_match('/where(?: in the world)? is (\\S+?)\\?/i', $text, $matches)) {
         return;
     }
     $symbol = $matches[1];
     $results = $this->getConduit()->callMethodSynchronous('diffusion.findsymbols', array('name' => $symbol));
     $default_uri = $this->getURI('/diffusion/symbol/' . $symbol . '/');
     if (count($results) > 1) {
         $response = "Multiple symbols named '{$symbol}': {$default_uri}";
     } else {
         if (count($results) == 1) {
             $result = head($results);
             $response = $result['type'] . ' ' . $result['name'] . ' ' . '(' . $result['language'] . '): ' . nonempty($result['uri'], $default_uri);
         } else {
             $response = "No symbol '{$symbol}' found anywhere.";
         }
     }
     $this->write('PRIVMSG', "{$reply_to} :{$response}");
 }