Adaptation of library almost complete.

Bot now signs in correctly when launched using startdaemons.sh
This commit is contained in:
Luke Fitzgerald 2010-06-15 20:51:04 +01:00
parent 0a4738a806
commit 27e8cfd360
3 changed files with 871 additions and 927 deletions

View File

@ -91,11 +91,8 @@ class MsnPlugin extends ImPlugin {
*/ */
function validate($screenname) { function validate($screenname) {
//TODO Correct this for MSN screennames //TODO Correct this for MSN screennames
if(preg_match('/^[a-z]\w{2,15}$/i', $screenname)) { //if(preg_match('/^[a-z]\w{2,15}$/i', $screenname)) {
return true; return true;
}else{
return false;
}
} }
/** /**
@ -109,7 +106,7 @@ class MsnPlugin extends ImPlugin {
$dir = dirname(__FILE__); $dir = dirname(__FILE__);
switch ($cls) { switch ($cls) {
case 'Msn': case 'MSN':
require_once(INSTALLDIR.'/plugins/Msn/extlib/phpmsnclass/msn.class.php'); require_once(INSTALLDIR.'/plugins/Msn/extlib/phpmsnclass/msn.class.php');
return false; return false;
case 'MsnManager': case 'MsnManager':
@ -179,12 +176,14 @@ class MsnPlugin extends ImPlugin {
} }
function onPluginVersion(&$versions) { function onPluginVersion(&$versions) {
$versions[] = array('name' => 'MSN', $versions[] = array(
'name' => 'MSN',
'version' => STATUSNET_VERSION, 'version' => STATUSNET_VERSION,
'author' => 'Luke Fitzgerald', 'author' => 'Luke Fitzgerald',
'homepage' => 'http://status.net/wiki/Plugin:MSN', 'homepage' => 'http://status.net/wiki/Plugin:MSN',
'rawdescription' => 'rawdescription' =>
_m('The MSN plugin allows users to send and receive notices over the MSN network.')); _m('The MSN plugin allows users to send and receive notices over the MSN network.')
);
return true; return true;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -95,11 +95,15 @@ class MsnManager extends ImManager {
*/ */
function connect() { function connect() {
if (!$this->conn) { if (!$this->conn) {
$this->conn = new MSN(array('user' => $this->plugin->user, $this->conn = new MSN(
array(
'user' => $this->plugin->user,
'password' => $this->plugin->password, 'password' => $this->plugin->password,
'alias' => $this->plugin->nickname, 'alias' => $this->plugin->nickname,
'psm' => 'Send me a message to post a notice', 'psm' => 'Send me a message to post a notice',
'debug' => true)); 'debug' => true
)
);
$this->conn->registerHandler("IMIn", array($this, 'handle_msn_message')); $this->conn->registerHandler("IMIn", array($this, 'handle_msn_message'));
$this->conn->registerHandler('Pong', array($this, 'update_ping_time')); $this->conn->registerHandler('Pong', array($this, 'update_ping_time'));
$this->conn->registerHandler('ConnectFailed', array($this, 'handle_connect_failed')); $this->conn->registerHandler('ConnectFailed', array($this, 'handle_connect_failed'));
@ -124,6 +128,7 @@ class MsnManager extends ImManager {
$this->conn->sendPing(); $this->conn->sendPing();
$this->lastping = time(); $this->lastping = time();
$this->pingInterval = 50;
return true; return true;
} }