*/
abstract function normalize($screenname);
-
/**
* validate (ensure the validity of) a screenname
*
/**
* 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
* unrecognized addresses, return true to indicate your processing has
*/
function microiduri($screenname)
{
- return $this->transport . ':' . $screenname;
+ return $this->transport . ':' . $screenname;
}
//========================UTILITY FUNCTIONS USEFUL TO IMPLEMENTATIONS - MISC ========================\
*
* @return User user
*/
- function get_user($screenname)
+ function getUser($screenname)
{
$user_im_prefs = $this->getUserImPrefsFromScreenname($screenname);
if($user_im_prefs){
}
}
-
/**
* given a screenname, get the User_im_prefs object for this transport
*
}
}
-
/**
* given a User, get their screenname
*
*
* @return string screenname of that user
*/
- function get_screenname($user)
+ function getScreenname($user)
{
$user_im_prefs = $this->getUserImPrefsFromUser($user);
if ($user_im_prefs) {
}
}
-
/**
* given a User, get their User_im_prefs
*
* @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();
* @param string $txt message text
* @return boolean true if autoreply
*/
- protected function is_autoreply($txt)
+ protected function isAutoreply($txt)
{
if (preg_match('/[\[\(]?[Aa]uto[-\s]?[Rr]e(ply|sponse)[\]\)]/', $txt)) {
return true;
* @param string $txt message text
* @return boolean true if OTR
*/
- protected function is_otr($txt)
+ protected function isOtr($txt)
{
if (preg_match('/^\?OTR/', $txt)) {
return true;
*
* @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 ($this->handleCommand($user, $notice_text)) {
common_log(LOG_INFO, "Command message by $from handled.");
return;
- } else if ($this->is_autoreply($notice_text)) {
+ } else if ($this->isAutoreply($notice_text)) {
common_log(LOG_INFO, 'Ignoring auto reply from ' . $from);
return;
- } else if ($this->is_otr($notice_text)) {
+ } else if ($this->isOtr($notice_text)) {
common_log(LOG_INFO, 'Ignoring OTR from ' . $from);
return;
} else {
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);
return;
}
- common_broadcast_notice($notice);
common_log(LOG_INFO,
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
$notice->free();
}
//========================EVENT HANDLERS========================\
-
+
/**
* Register notice queue handler
*