*\r
* @return string Name of service\r
*/\r
- function getDisplayName() {\r
+ public function getDisplayName() {\r
return _m('MSN');\r
}\r
\r
* @param string $screenname screenname to normalize\r
* @return string an equivalent screenname in normalized form\r
*/\r
- function normalize($screenname) {\r
+ public function normalize($screenname) {\r
$screenname = str_replace(" ","", $screenname);\r
return strtolower($screenname);\r
}\r
*\r
* @return string Screenname\r
*/\r
- function daemon_screenname() {\r
+ public function daemon_screenname() {\r
return $this->user;\r
}\r
\r
* Validate (ensure the validity of) a screenname\r
*\r
* @param string $screenname screenname to validate\r
- *\r
* @return boolean\r
*/\r
- function validate($screenname) {\r
- //TODO Correct this for MSN screennames\r
- //if(preg_match('/^[a-z]\w{2,15}$/i', $screenname)) {\r
- return true;\r
+ public function validate($screenname) {\r
+ // RFC 2822 (simplified) regexp\r
+ if(preg_match('/[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i', $screenname)) {\r
+ return true;\r
+ } else {\r
+ return false;\r
+ }\r
}\r
\r
/**\r
* Load related modules when needed\r
*\r
* @param string $cls Name of the class to be loaded\r
- *\r
* @return boolean hook value; true means continue processing, false means stop.\r
*/\r
public function onAutoload($cls) {\r
/**\r
* Initialize plugin\r
*\r
- * @return void\r
+ * @return boolean\r
*/\r
public function initialize() {\r
if (!isset($this->user)) {\r
return true;\r
}\r
\r
- function onPluginVersion(&$versions) {\r
+ /**\r
+ * Get plugin information\r
+ * \r
+ * @param array $versions array to insert information into\r
+ * @return void\r
+ */\r
+ public function onPluginVersion(&$versions) {\r
$versions[] = array(\r
'name' => 'MSN',\r
'version' => STATUSNET_VERSION,\r
* Passes it back to the queuing system\r
*\r
* @param array $data Data\r
+ * @return void\r
*/\r
private function handle_msn_message($data) {\r
$this->plugin->enqueue_incoming_raw($data);\r
* Called by callback to log failure during connect\r
*\r
* @param void $data Not used (there to keep callback happy)\r
+ * @return void\r
*/\r
function handle_connect_failed($data) {\r
common_log(LOG_NOTICE, 'MSN connect failed, retrying');\r
* Called by callback to log reconnection\r
*\r
* @param void $data Not used (there to keep callback happy)\r
+ * @return void\r
*/\r
function handle_reconnect($data) {\r
common_log(LOG_NOTICE, 'MSN reconnecting');\r