]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Lots of fixes for library. Almost have confirmation emails working
authorLuke Fitzgerald <lw.fitzgerald@googlemail.com>
Wed, 23 Jun 2010 03:26:23 +0000 (20:26 -0700)
committerLuke Fitzgerald <lw.fitzgerald@googlemail.com>
Wed, 23 Jun 2010 03:26:23 +0000 (20:26 -0700)
plugins/Msn/MsnPlugin.php
plugins/Msn/extlib/phpmsnclass/msn.class.php

index b62481f761b12703e40a2590d4a2167f2c23134a..8b2036713973a367f935f5b393e358f3b97555f1 100644 (file)
@@ -51,8 +51,8 @@ class MsnPlugin extends ImPlugin {
     public $user = null;\r
     public $password = null;\r
     public $nickname = null;\r
-    public $transport = 'msnim';\r
-\r
+    public $transport = 'msn';\r
+    \r
     /**\r
      * Get the internationalized/translated display name of this IM service\r
      *\r
index b8094721192f938c8119f6fa815937391f60f0cc..5c79b3126161414ebef8d645c00bb9c76d400c69 100644 (file)
@@ -870,15 +870,8 @@ class MSN {
                 }\r
 \r
                 $this->debug_message("NS: <<< XFR SB");\r
-                $user = array_shift($this->waitingForXFR);\r
-                $bSBresult = $this->switchboard_control($ip, $port, $cki_code, $User, $Message);\r
-                /*\r
-                 $bSBresult = $this->switchboard_control($ip, $port, $cki_code, $aMSNUsers[$nCurrentUser], $sMessage);\r
-                 if ($bSBresult === false) {\r
-                 // error for switchboard\r
-                 $this->debug_message("!!! error for sending message to ".$aMSNUsers[$nCurrentUser]);\r
-                 $aOfflineUsers[] = $aMSNUsers[$nCurrentUser];\r
-                 }*/\r
+                $session = array_shift($this->waitingForXFR);\r
+                $this->connectToSBSession('Active', $ip, $port, $session['to'], array('cki' => $cki_code));\r
                 break;\r
             case 'QNG':\r
                 // NS: <<< QNG {time}\r
@@ -963,7 +956,7 @@ class MSN {
                 // we don't need the data, just ignore it\r
                 // request user to join this switchboard\r
                 // SB: >>> CAL {id} {user}\r
-                $this->sb_writeln($socket, $id, "CAL $this->id $user");\r
+                $this->sb_writeln($socket, $id, "CAL $id ".$session['to']);\r
                 break;\r
             case 'CAL':\r
                 // SB: <<< CAL {id} RINGING {?}\r
@@ -1116,7 +1109,7 @@ class MSN {
                         $footer = pack("L", 0);\r
                         $message = "MIME-Version: 1.0\r\nContent-Type: application/x-msnmsgrp2p\r\nP2P-Dest: $from_email\r\n\r\n$hdr$footer";\r
                         $len = strlen($message);\r
-                        $this->sb_writeln($socket, $id, "MSG $this->id D $len");\r
+                        $this->sb_writeln($socket, $id, "MSG $id D $len");\r
                         $this->sb_writedata($socket, $message);\r
                         $this->debug_message("*** p2p: send display picture acknowledgement for $hdr_SessionID");\r
                         $this->debug_message("*** p2p: Invite ACK message:\n".$this->dump_binary($message));\r
@@ -1154,7 +1147,7 @@ class MSN {
                             "MIME-Version: 1.0\r\n".\r
                             "Content-Type: application/x-msnmsgrp2p\r\n".\r
                             "P2P-Dest: $from_email\r\n\r\n$hdr$MessagePayload$footer";\r
-                        $this->sb_writeln($socket, $id, "MSG $this->id D ".strlen($message));\r
+                        $this->sb_writeln($socket, $id, "MSG $id D ".strlen($message));\r
                         $this->sb_writedata($socket, $message);\r
                         $this->debug_message("*** p2p: dump 200 ok message:\n".$this->dump_binary($message));\r
                         $this->sb_readln($socket); // Read ACK;\r
@@ -1181,7 +1174,7 @@ class MSN {
                             "MIME-Version: 1.0\r\n".\r
                             "Content-Type: application/x-msnmsgrp2p\r\n".\r
                             "P2P-Dest: $from_email\r\n\r\n$hdr".pack('L', 0)."$footer";\r
-                        $this->sb_writeln($socket, $id, "MSG $this->id D ".strlen($message));\r
+                        $this->sb_writeln($socket, $id, "MSG $id D ".strlen($message));\r
                         $this->sb_writedata($socket, $message);\r
                         $this->debug_message("*** p2p: dump send Data preparation message:\n".$this->dump_binary($message));\r
                         $this->debug_message("*** p2p: Data Prepare Hdr:\n".$this->dump_binary($hdr));\r
@@ -1213,7 +1206,7 @@ class MSN {
                                     "MIME-Version: 1.0\r\n".\r
                                     "Content-Type: application/x-msnmsgrp2p\r\n".\r
                                     "P2P-Dest: $from_email\r\n\r\n$hdr$FileContent$footer";\r
-                                $this->sb_writeln($socket, $id, "MSG $this->id D ".strlen($message));\r
+                                $this->sb_writeln($socket, $id, "MSG $id D ".strlen($message));\r
                                 $this->sb_writedata($socket, $message);\r
                                 $this->debug_message("*** p2p: dump send Data Content message  $Offset / $FileSize :\n".$this->dump_binary($message));\r
                                 $this->debug_message("*** p2p: Data Content Hdr:\n".$this->dump_binary($hdr));\r
@@ -1319,7 +1312,7 @@ class MSN {
                 $this->callHandler('IMin', array('sender' => $from_email, 'message' => $sMsg, 'network' => $network, 'offline' => false));\r
                 break;\r
             case '217':\r
-                $this->debug_message("*** User $user is offline. Trying OIM.");\r
+                $this->debug_message('*** User '.$session['to'].' is offline. Trying OIM.');\r
                 $session['offline'] = true;\r
                 break;\r
             default:\r
@@ -1379,7 +1372,7 @@ class MSN {
             'offline' => false,\r
             'XFRReqTime' => time()\r
         );\r
-        $this->waitingForXFR[] = &$this->switchBoardSessions[$to];\r
+        $this->waitingForXFR[$to] = &$this->switchBoardSessions[$to];\r
     }\r
 \r
     /**\r
@@ -1413,12 +1406,12 @@ class MSN {
             'offline' => false,\r
             'XFRReqTime' => time()\r
         );\r
-\r
+        \r
         // Change the index of the session to the socket\r
         $intsocket = (int) $socket;\r
         $this->switchBoardSessions[$intsocket] = $this->switchBoardSessions[$to];\r
         unset($this->switchBoardSessions[$to]);\r
-\r
+        \r
         $id = &$this->switchBoardSessions[$intsocket]['id'];\r
 \r
         if ($mode == 'Active') {\r
@@ -1479,7 +1472,7 @@ class MSN {
 \r
         $id = &$this->switchBoardSessions[$intsocket]['id'];\r
 \r
-        $aMessage = $this->getMessage($Message);\r
+        $aMessage = $this->getMessage($message);\r
         // CheckEmotion...\r
         $MsnObjDefine = $this->GetMsnObjDefine($aMessage);\r
         if ($MsnObjDefine !== '') {\r
@@ -1495,7 +1488,7 @@ class MSN {
 \r
         if ($this->sb_writeln($socket, $id, "MSG $id N $len") === false ||\r
             $this->sb_writedata($socket, $aMessage) === false) {\r
-                return false;\r
+               return false;\r
             }\r
 \r
         // Don't close the SB session, we might as well leave it open\r
@@ -1533,16 +1526,17 @@ class MSN {
         if ($message != '') {\r
             list($name, $host, $network) = explode('@', $to);\r
             $network = $network == '' ? 1 : $network;\r
-            $recipient = $name.$host;\r
+            $recipient = $name.'@'.$host;\r
 \r
             if ($network === 1) {\r
-                if (!isset($this->switchBoardSessionLookup[$recipient]) && (!isset($this->switchBoardSessions[$recipient])\r
-                    || time() - $this->switchBoardSessions[$recipient]['XFRReqTime'] > $this->XFRReqTimeout)) {\r
-                    $this->debug_message("*** No existing SB session or request has timed out");\r
-                    $this->reqSBSession($recipient);\r
-                    return false;\r
+                if (!isset($this->switchBoardSessionLookup[$recipient])) {\r
+                       if (!isset($this->switchBoardSessions[$recipient]) || time() - $this->switchBoardSessions[$recipient]['XFRReqTime'] > $this->XFRReqTimeout) {\r
+                               $this->debug_message("*** No existing SB session or request has timed out");\r
+                           $this->reqSBSession($recipient);\r
+                       }\r
+                       return false;\r
                 } else {\r
-                    $socket = $this->switchBoardSessionLookup[$to];\r
+                    $socket = $this->switchBoardSessionLookup[$recipient];\r
                     if ($this->switchBoardSessions[(int) $socket]['offline']) {\r
                         $this->debug_message("*** Contact ($recipient) offline, sending OIM");\r
                         $this->endSBSession($socket);\r
@@ -1555,7 +1549,7 @@ class MSN {
                             return true;\r
                         } else {\r
                             $this->debug_message('*** Message sending failed, requesting new SB session');\r
-                            $this->reqSBSession($to);\r
+                            $this->reqSBSession($recipient);\r
                             return false;\r
                         }\r
                     }\r