*/
function sendNotice($screenname, $notice)
{
- return $this->sendMessage($screenname, $this->format_notice($notice));
+ return $this->sendMessage($screenname, $this->formatNotice($notice));
}
/**
/**
* receive a raw message
* Raw IM data is taken from the incoming queue, and passed to this function.
- * It should parse the raw message and call handle_incoming()
+ * It should parse the raw message and call handleIncoming()
*
* Returning false may CAUSE REPROCESSING OF THE QUEUE ITEM, and should
* be used for temporary failures only. For permanent failures such as
*
* @param object $data
*/
- function enqueue_incoming_raw($data)
+ function enqueueIncomingRaw($data)
{
$qm = QueueManager::get();
$qm->enqueue($data, $this->transport . '-in');
*
* @return User user
*/
- function get_user($screenname)
+ function getUser($screenname)
{
- $user_im_prefs = $this->get_user_im_prefs_from_screenname($screenname);
+ $user_im_prefs = $this->getUserImPrefsFromScreenname($screenname);
if($user_im_prefs){
$user = User::staticGet('id', $user_im_prefs->user_id);
$user_im_prefs->free();
*
* @return User_im_prefs user_im_prefs
*/
- function get_user_im_prefs_from_screenname($screenname)
+ function getUserImPrefsFromScreenname($screenname)
{
$user_im_prefs = User_im_prefs::pkeyGet(
array('transport' => $this->transport,
*/
function get_screenname($user)
{
- $user_im_prefs = $this->get_user_im_prefs_from_user($user);
+ $user_im_prefs = $this->getUserImPrefsFromUser($user);
if ($user_im_prefs) {
return $user_im_prefs->screenname;
} else {
*
* @return User_im_prefs user_im_prefs of that user
*/
- function get_user_im_prefs_from_user($user)
+ function getUserImPrefsFromUser($user)
{
$user_im_prefs = User_im_prefs::pkeyGet(
array('transport' => $this->transport,
*
* @param boolean success
*/
- protected function send_from_site($screenname, $msg)
+ protected function sendFromSite($screenname, $msg)
{
$text = '['.common_config('site', 'name') . '] ' . $msg;
$this->sendMessage($screenname, $text);
*
* @return boolean success value
*/
- function send_confirmation_code($screenname, $code, $user)
+ function sendConfirmationCode($screenname, $code, $user)
{
$body = sprintf(_('User "%s" on %s has said that your %s screenname belongs to them. ' .
'If that\'s true, you can confirm by clicking on this URL: ' .
* @return boolean success flag
*/
- function public_notice($notice)
+ function publicNotice($notice)
{
// Now, users who want everything
* @return boolean success flag
*/
- function broadcast_notice($notice)
+ function broadcastNotice($notice)
{
$ni = $notice->whoGets();
// either not a local user, or just not found
continue;
}
- $user_im_prefs = $this->get_user_im_prefs_from_user($user);
+ $user_im_prefs = $this->getUserImPrefsFromUser($user);
if(!$user_im_prefs || !$user_im_prefs->notify){
continue;
}
* @return string plain-text version of the notice, with user nickname prefixed
*/
- function format_notice($notice)
+ function formatNotice($notice)
{
$profile = $notice->getProfile();
return $profile->nickname . ': ' . $notice->content . ' [' . $notice->id . ']';
* @param string $body message text
* @return boolean true if the message was a command and was executed, false if it was not a command
*/
- protected function handle_command($user, $body)
+ protected function handleCommand($user, $body)
{
$inter = new CommandInterpreter();
$cmd = $inter->handle_command($user, $body);
*
* @param boolean success
*/
- protected function handle_incoming($from, $notice_text)
+ protected function handleIncoming($from, $notice_text)
{
- $user = $this->get_user($from);
+ $user = $this->getUser($from);
// For common_current_user to work
global $_cur;
$_cur = $user;
if (!$user) {
- $this->send_from_site($from, 'Unknown user; go to ' .
+ $this->sendFromSite($from, 'Unknown user; go to ' .
common_local_url('imsettings') .
' to add your address to your account');
common_log(LOG_WARNING, 'Message from unknown user ' . $from);
return;
}
- if ($this->handle_command($user, $notice_text)) {
+ if ($this->handleCommand($user, $notice_text)) {
common_log(LOG_INFO, "Command message by $from handled.");
return;
} else if ($this->is_autoreply($notice_text)) {
common_log(LOG_INFO, 'Posting a notice from ' . $user->nickname);
- $this->add_notice($from, $user, $notice_text);
+ $this->addNotice($from, $user, $notice_text);
}
$user->free();
*
* @param boolean success
*/
- protected function add_notice($screenname, $user, $body)
+ protected function addNotice($screenname, $user, $body)
{
$body = trim(strip_tags($body));
$content_shortened = common_shorten_links($body);
if (Notice::contentTooLong($content_shortened)) {
- $this->send_from_site($screenname, sprintf(_('Message too long - maximum is %1$d characters, you sent %2$d.'),
+ $this->sendFromSite($screenname, sprintf(_('Message too long - maximum is %1$d characters, you sent %2$d.'),
Notice::maxContent(),
mb_strlen($content_shortened)));
return;
$notice = Notice::saveNew($user->id, $content_shortened, $this->transport);
} catch (Exception $e) {
common_log(LOG_ERR, $e->getMessage());
- $this->send_from_site($from, $e->getMessage());
+ $this->sendFromSite($from, $e->getMessage());
return;
}
{
if($transport == $this->transport)
{
- $this->send_confirmation_code($screenname, $code, $user);
+ $this->sendConfirmationCode($screenname, $code, $user);
return false;
}
}