]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Removed unnecessary else statement
authorLuke Fitzgerald <lw.fitzgerald@googlemail.com>
Wed, 16 Jun 2010 00:24:28 +0000 (01:24 +0100)
committerLuke Fitzgerald <lw.fitzgerald@googlemail.com>
Wed, 16 Jun 2010 00:24:28 +0000 (01:24 +0100)
plugins/Msn/extlib/phpmsnclass/msn.class.php

index 1e8d7e0f1f1178e6fea234cc88eec2605f634970..af9a45e49deb35c3a48b54c74ee4da4ffdec081d 100644 (file)
@@ -522,395 +522,395 @@ class MSN {
             $this->NSRetryWait($this->retry_wait);\r
             $this->signon();\r
             return;\r
-        } else {\r
-            switch (substr($data, 0, 3)) {\r
-                case 'SBS':\r
-                    // after 'USR {id} OK {user} {verify} 0' response, the server will send SBS and profile to us\r
-                    // NS: <<< SBS 0 null\r
-                    break;\r
+        }\r
+        \r
+        switch (substr($data, 0, 3)) {\r
+            case 'SBS':\r
+                // after 'USR {id} OK {user} {verify} 0' response, the server will send SBS and profile to us\r
+                // NS: <<< SBS 0 null\r
+                break;\r
 \r
-                case 'RFS':\r
-                    // FIXME:\r
-                    // NS: <<< RFS ???\r
-                    // refresh ADL, so we re-send it again\r
-                    if (is_array($this->aADL)) {\r
-                        foreach ($this->aADL as $str) {\r
-                            $len = strlen($str);\r
-                            // NS: >>> ADL {id} {size}\r
-                            $this->ns_writeln("ADL $this->id $len");\r
-                            $this->ns_writedata($str);\r
-                        }\r
+            case 'RFS':\r
+                // FIXME:\r
+                // NS: <<< RFS ???\r
+                // refresh ADL, so we re-send it again\r
+                if (is_array($this->aADL)) {\r
+                    foreach ($this->aADL as $str) {\r
+                        $len = strlen($str);\r
+                        // NS: >>> ADL {id} {size}\r
+                        $this->ns_writeln("ADL $this->id $len");\r
+                        $this->ns_writedata($str);\r
                     }\r
-                    break;\r
+                }\r
+                break;\r
 \r
-                case 'LST':\r
-                    // NS: <<< LST {email} {alias} 11 0\r
-                    @list(/* LST */, $email, /* alias */,) = @explode(' ', $data);\r
-                    @list($u_name, $u_domain) = @explode('@', $email);\r
-                    if (!isset($this->aContactList[$u_domain][$u_name][1])) {\r
-                        $this->aContactList[$u_domain][$u_name][1]['Allow'] = 'Allow';\r
-                        $this->debug_message("*** Added to contact list: $u_name@$u_domain");\r
-                    }\r
-                    break;\r
+            case 'LST':\r
+                // NS: <<< LST {email} {alias} 11 0\r
+                @list(/* LST */, $email, /* alias */,) = @explode(' ', $data);\r
+                @list($u_name, $u_domain) = @explode('@', $email);\r
+                if (!isset($this->aContactList[$u_domain][$u_name][1])) {\r
+                    $this->aContactList[$u_domain][$u_name][1]['Allow'] = 'Allow';\r
+                    $this->debug_message("*** Added to contact list: $u_name@$u_domain");\r
+                }\r
+                break;\r
 \r
-                case 'ADL':\r
-                    // randomly, we get ADL command, someone add us to their contact list for MSNP15\r
-                    // NS: <<< ADL 0 {size}\r
-                    @list(/* ADL */, /* 0 */, $size,) = @explode(' ', $data);\r
-                    if (is_numeric($size) && $size > 0) {\r
-                        $data = $this->ns_readdata($size);\r
-                        preg_match('#<ml><d n="([^"]+)"><c n="([^"]+)"(.*) t="(\d*)"(.*) /></d></ml>#', $data, $matches);\r
-                        if (is_array($matches) && count($matches) > 0) {\r
-                            $u_domain = $matches[1];\r
-                            $u_name = $matches[2];\r
-                            $network = $matches[4];\r
-                            if (isset($this->aContactList[$u_domain][$u_name][$network]))\r
-                                $this->debug_message("*** Someone (network: $network) added us to their list (but already in our list): $u_name@$u_domain");\r
-                            else {\r
-                                $re_login = false;\r
-                                $cnt = 0;\r
-                                foreach (array('Allow', 'Reverse') as $list) {\r
+            case 'ADL':\r
+                // randomly, we get ADL command, someone add us to their contact list for MSNP15\r
+                // NS: <<< ADL 0 {size}\r
+                @list(/* ADL */, /* 0 */, $size,) = @explode(' ', $data);\r
+                if (is_numeric($size) && $size > 0) {\r
+                    $data = $this->ns_readdata($size);\r
+                    preg_match('#<ml><d n="([^"]+)"><c n="([^"]+)"(.*) t="(\d*)"(.*) /></d></ml>#', $data, $matches);\r
+                    if (is_array($matches) && count($matches) > 0) {\r
+                        $u_domain = $matches[1];\r
+                        $u_name = $matches[2];\r
+                        $network = $matches[4];\r
+                        if (isset($this->aContactList[$u_domain][$u_name][$network]))\r
+                            $this->debug_message("*** Someone (network: $network) added us to their list (but already in our list): $u_name@$u_domain");\r
+                        else {\r
+                            $re_login = false;\r
+                            $cnt = 0;\r
+                            foreach (array('Allow', 'Reverse') as $list) {\r
+                                if (!$this->addMemberToList($u_name.'@'.$u_domain, $network, $list)) {\r
+                                    if ($re_login) {\r
+                                        $this->debug_message("*** Could not add $u_name@$u_domain (network: $network) to $list list");\r
+                                        continue;\r
+                                    }\r
+                                    $aTickets = $this->get_passport_ticket();\r
+                                    if (!$aTickets || !is_array($aTickets)) {\r
+                                        // failed to login? ignore it\r
+                                        $this->debug_message("*** Could not re-login, something wrong here");\r
+                                        $this->debug_message("*** Could not add $u_name@$u_domain (network: $network) to $list list");\r
+                                        continue;\r
+                                    }\r
+                                    $re_login = true;\r
+                                    $this->ticket = $aTickets;\r
+                                    $this->debug_message("**** Got new ticket, trying again");\r
                                     if (!$this->addMemberToList($u_name.'@'.$u_domain, $network, $list)) {\r
-                                        if ($re_login) {\r
-                                            $this->debug_message("*** Could not add $u_name@$u_domain (network: $network) to $list list");\r
-                                            continue;\r
-                                        }\r
-                                        $aTickets = $this->get_passport_ticket();\r
-                                        if (!$aTickets || !is_array($aTickets)) {\r
-                                            // failed to login? ignore it\r
-                                            $this->debug_message("*** Could not re-login, something wrong here");\r
-                                            $this->debug_message("*** Could not add $u_name@$u_domain (network: $network) to $list list");\r
-                                            continue;\r
-                                        }\r
-                                        $re_login = true;\r
-                                        $this->ticket = $aTickets;\r
-                                        $this->debug_message("**** Got new ticket, trying again");\r
-                                        if (!$this->addMemberToList($u_name.'@'.$u_domain, $network, $list)) {\r
-                                            $this->debug_message("*** Could not add $u_name@$u_domain (network: $network) to $list list");\r
-                                            continue;\r
-                                        }\r
+                                        $this->debug_message("*** Could not add $u_name@$u_domain (network: $network) to $list list");\r
+                                        continue;\r
                                     }\r
-                                    $this->aContactList[$u_domain][$u_name][$network][$list] = false;\r
-                                    $cnt++;\r
                                 }\r
-                                $this->debug_message("*** Someone (network: $network) added us to their list: $u_name@$u_domain");\r
+                                $this->aContactList[$u_domain][$u_name][$network][$list] = false;\r
+                                $cnt++;\r
                             }\r
-                            $str = '<ml l="1"><d n="'.$u_domain.'"><c n="'.$u_name.'" l="3" t="'.$network.'" /></d></ml>';\r
-                            $len = strlen($str);\r
-\r
-                            $this->callHandler('AddedToList', array('screenname' => $u_name.'@'.$u_domain, 'network' => $network));\r
+                            $this->debug_message("*** Someone (network: $network) added us to their list: $u_name@$u_domain");\r
                         }\r
-                        else\r
-                            $this->debug_message("*** Someone added us to their list: $data");\r
-                    }\r
-                    break;\r
+                        $str = '<ml l="1"><d n="'.$u_domain.'"><c n="'.$u_name.'" l="3" t="'.$network.'" /></d></ml>';\r
+                        $len = strlen($str);\r
 \r
-                case 'RML':\r
-                    // randomly, we get RML command, someome remove us to their contact list for MSNP15\r
-                    // NS: <<< RML 0 {size}\r
-                    @list(/* RML */, /* 0 */, $size,) = @explode(' ', $data);\r
-                    if (is_numeric($size) && $size > 0) {\r
-                        $data = $this->ns_readdata($size);\r
-                        preg_match('#<ml><d n="([^"]+)"><c n="([^"]+)"(.*) t="(\d*)"(.*) /></d></ml>#', $data, $matches);\r
-                        if (is_array($matches) && count($matches) > 0) {\r
-                            $u_domain = $matches[1];\r
-                            $u_name = $matches[2];\r
-                            $network = $matches[4];\r
-                            if (isset($this->aContactList[$u_domain][$u_name][$network])) {\r
-                                $aData = $this->aContactList[$u_domain][$u_name][$network];\r
-\r
-                                foreach ($aData as $list => $id)\r
-                                    $this->delMemberFromList($id, $u_name.'@'.$u_domain, $network, $list);\r
-\r
-                                unset($this->aContactList[$u_domain][$u_name][$network]);\r
-                                $this->debug_message("*** Someone (network: $network) removed us from their list: $u_name@$u_domain");\r
-                            }\r
-                            else\r
-                                $this->debug_message("*** Someone (network: $network) removed us from their list (but not in our list): $u_name@$u_domain");\r
+                        $this->callHandler('AddedToList', array('screenname' => $u_name.'@'.$u_domain, 'network' => $network));\r
+                    }\r
+                    else\r
+                        $this->debug_message("*** Someone added us to their list: $data");\r
+                }\r
+                break;\r
 \r
-                            $this->callHandler('RemovedFromList', array('screenname' => $u_name.'@'.$u_domain, 'network' => $network));\r
+            case 'RML':\r
+                // randomly, we get RML command, someome remove us to their contact list for MSNP15\r
+                // NS: <<< RML 0 {size}\r
+                @list(/* RML */, /* 0 */, $size,) = @explode(' ', $data);\r
+                if (is_numeric($size) && $size > 0) {\r
+                    $data = $this->ns_readdata($size);\r
+                    preg_match('#<ml><d n="([^"]+)"><c n="([^"]+)"(.*) t="(\d*)"(.*) /></d></ml>#', $data, $matches);\r
+                    if (is_array($matches) && count($matches) > 0) {\r
+                        $u_domain = $matches[1];\r
+                        $u_name = $matches[2];\r
+                        $network = $matches[4];\r
+                        if (isset($this->aContactList[$u_domain][$u_name][$network])) {\r
+                            $aData = $this->aContactList[$u_domain][$u_name][$network];\r
+\r
+                            foreach ($aData as $list => $id)\r
+                                $this->delMemberFromList($id, $u_name.'@'.$u_domain, $network, $list);\r
+\r
+                            unset($this->aContactList[$u_domain][$u_name][$network]);\r
+                            $this->debug_message("*** Someone (network: $network) removed us from their list: $u_name@$u_domain");\r
                         }\r
                         else\r
-                            $this->debug_message("*** Someone removed us from their list: $data");\r
+                            $this->debug_message("*** Someone (network: $network) removed us from their list (but not in our list): $u_name@$u_domain");\r
+\r
+                        $this->callHandler('RemovedFromList', array('screenname' => $u_name.'@'.$u_domain, 'network' => $network));\r
                     }\r
-                    break;\r
+                    else\r
+                        $this->debug_message("*** Someone removed us from their list: $data");\r
+                }\r
+                break;\r
 \r
-                case 'MSG':\r
-                    // randomly, we get MSG notification from server\r
-                    // NS: <<< MSG Hotmail Hotmail {size}\r
-                    @list(/* MSG */, /* Hotmail */, /* Hotmail */, $size,) = @explode(' ', $data);\r
-                    if (is_numeric($size) && $size > 0) {\r
-                        $data = $this->ns_readdata($size);\r
-                        $aLines = @explode("\n", $data);\r
-                        $header = true;\r
-                        $ignore = false;\r
-                        $maildata = '';\r
-                        foreach ($aLines as $line) {\r
-                            $line = rtrim($line);\r
-                            if ($header) {\r
-                                if ($line === '') {\r
-                                    $header = false;\r
-                                    continue;\r
-                                }\r
-                                if (strncasecmp($line, 'Content-Type:', 13) == 0) {\r
-                                    if (strpos($line, 'text/x-msmsgsinitialmdatanotification') === false && strpos($line, 'text/x-msmsgsoimnotification') === false) {\r
-                                        // we just need text/x-msmsgsinitialmdatanotification\r
-                                        // or text/x-msmsgsoimnotification\r
-                                        $ignore = true;\r
-                                        break;\r
-                                    }\r
-                                }\r
+            case 'MSG':\r
+                // randomly, we get MSG notification from server\r
+                // NS: <<< MSG Hotmail Hotmail {size}\r
+                @list(/* MSG */, /* Hotmail */, /* Hotmail */, $size,) = @explode(' ', $data);\r
+                if (is_numeric($size) && $size > 0) {\r
+                    $data = $this->ns_readdata($size);\r
+                    $aLines = @explode("\n", $data);\r
+                    $header = true;\r
+                    $ignore = false;\r
+                    $maildata = '';\r
+                    foreach ($aLines as $line) {\r
+                        $line = rtrim($line);\r
+                        if ($header) {\r
+                            if ($line === '') {\r
+                                $header = false;\r
                                 continue;\r
                             }\r
-                            if (strncasecmp($line, 'Mail-Data:', 10) == 0) {\r
-                                $maildata = trim(substr($line, 10));\r
-                                break;\r
+                            if (strncasecmp($line, 'Content-Type:', 13) == 0) {\r
+                                if (strpos($line, 'text/x-msmsgsinitialmdatanotification') === false && strpos($line, 'text/x-msmsgsoimnotification') === false) {\r
+                                    // we just need text/x-msmsgsinitialmdatanotification\r
+                                    // or text/x-msmsgsoimnotification\r
+                                    $ignore = true;\r
+                                    break;\r
+                                }\r
                             }\r
+                            continue;\r
                         }\r
-                        if ($ignore) {\r
-                            $this->debug_message("*** Ignoring MSG for: $line");\r
-                            break;\r
-                        }\r
-                        if ($maildata == '') {\r
-                            $this->debug_message("*** Ignoring MSG not for OIM");\r
+                        if (strncasecmp($line, 'Mail-Data:', 10) == 0) {\r
+                            $maildata = trim(substr($line, 10));\r
                             break;\r
                         }\r
-                        $re_login = false;\r
-                        if (strcasecmp($maildata, 'too-large') == 0) {\r
-                            $this->debug_message("*** Large mail-data, need to get the data via SOAP");\r
+                    }\r
+                    if ($ignore) {\r
+                        $this->debug_message("*** Ignoring MSG for: $line");\r
+                        break;\r
+                    }\r
+                    if ($maildata == '') {\r
+                        $this->debug_message("*** Ignoring MSG not for OIM");\r
+                        break;\r
+                    }\r
+                    $re_login = false;\r
+                    if (strcasecmp($maildata, 'too-large') == 0) {\r
+                        $this->debug_message("*** Large mail-data, need to get the data via SOAP");\r
+                        $maildata = $this->getOIM_maildata();\r
+                        if ($maildata === false) {\r
+                            $this->debug_message("*** Could not get mail-data via SOAP");\r
+\r
+                            // maybe we need to re-login again\r
+                            $aTickets = $this->get_passport_ticket();\r
+                            if (!$aTickets || !is_array($aTickets)) {\r
+                                // failed to login? ignore it\r
+                                $this->debug_message("*** Could not re-login, something wrong here, ignoring this OIM");\r
+                                break;\r
+                            }\r
+                            $re_login = true;\r
+                            $this->ticket = $aTickets;\r
+                            $this->debug_message("*** Got new ticket, trying again");\r
                             $maildata = $this->getOIM_maildata();\r
                             if ($maildata === false) {\r
-                                $this->debug_message("*** Could not get mail-data via SOAP");\r
-\r
-                                // maybe we need to re-login again\r
-                                $aTickets = $this->get_passport_ticket();\r
-                                if (!$aTickets || !is_array($aTickets)) {\r
-                                    // failed to login? ignore it\r
-                                    $this->debug_message("*** Could not re-login, something wrong here, ignoring this OIM");\r
-                                    break;\r
-                                }\r
-                                $re_login = true;\r
-                                $this->ticket = $aTickets;\r
-                                $this->debug_message("*** Got new ticket, trying again");\r
-                                $maildata = $this->getOIM_maildata();\r
-                                if ($maildata === false) {\r
-                                    $this->debug_message("*** Could not get mail-data via SOAP, and re-login already attempted, ignoring this OIM");\r
-                                    break;\r
-                                }\r
+                                $this->debug_message("*** Could not get mail-data via SOAP, and re-login already attempted, ignoring this OIM");\r
+                                break;\r
                             }\r
                         }\r
-                        // could be a lots of <M>...</M>, so we can't use preg_match here\r
-                        $p = $maildata;\r
-                        $aOIMs = array();\r
-                        while (1) {\r
-                            $start = strpos($p, '<M>');\r
-                            $end = strpos($p, '</M>');\r
-                            if ($start === false || $end === false || $start > $end) break;\r
-                            $end += 4;\r
-                            $sOIM = substr($p, $start, $end - $start);\r
-                            $aOIMs[] = $sOIM;\r
-                            $p = substr($p, $end);\r
+                    }\r
+                    // could be a lots of <M>...</M>, so we can't use preg_match here\r
+                    $p = $maildata;\r
+                    $aOIMs = array();\r
+                    while (1) {\r
+                        $start = strpos($p, '<M>');\r
+                        $end = strpos($p, '</M>');\r
+                        if ($start === false || $end === false || $start > $end) break;\r
+                        $end += 4;\r
+                        $sOIM = substr($p, $start, $end - $start);\r
+                        $aOIMs[] = $sOIM;\r
+                        $p = substr($p, $end);\r
+                    }\r
+                    if (count($aOIMs) == 0) {\r
+                        $this->debug_message("*** Ignoring empty OIM");\r
+                        break;\r
+                    }\r
+                    foreach ($aOIMs as $maildata) {\r
+                        // T: 11 for MSN, 13 for Yahoo\r
+                        // S: 6 for MSN, 7 for Yahoo\r
+                        // RT: the datetime received by server\r
+                        // RS: already read or not\r
+                        // SZ: size of message\r
+                        // E: sender\r
+                        // I: msgid\r
+                        // F: always 00000000-0000-0000-0000-000000000009\r
+                        // N: sender alias\r
+                        preg_match('#<T>(.*)</T>#', $maildata, $matches);\r
+                        if (count($matches) == 0) {\r
+                            $this->debug_message("*** Ignoring OIM maildata without <T>type</T>");\r
+                            continue;\r
                         }\r
-                        if (count($aOIMs) == 0) {\r
-                            $this->debug_message("*** Ignoring empty OIM");\r
-                            break;\r
+                        $oim_type = $matches[1];\r
+                        if ($oim_type = 13)\r
+                            $network = 32;\r
+                        else\r
+                            $network = 1;\r
+                        preg_match('#<E>(.*)</E>#', $maildata, $matches);\r
+                        if (count($matches) == 0) {\r
+                            $this->debug_message("*** Ignoring OIM maildata without <E>sender</E>");\r
+                            continue;\r
                         }\r
-                        foreach ($aOIMs as $maildata) {\r
-                            // T: 11 for MSN, 13 for Yahoo\r
-                            // S: 6 for MSN, 7 for Yahoo\r
-                            // RT: the datetime received by server\r
-                            // RS: already read or not\r
-                            // SZ: size of message\r
-                            // E: sender\r
-                            // I: msgid\r
-                            // F: always 00000000-0000-0000-0000-000000000009\r
-                            // N: sender alias\r
-                            preg_match('#<T>(.*)</T>#', $maildata, $matches);\r
-                            if (count($matches) == 0) {\r
-                                $this->debug_message("*** Ignoring OIM maildata without <T>type</T>");\r
-                                continue;\r
-                            }\r
-                            $oim_type = $matches[1];\r
-                            if ($oim_type = 13)\r
-                                $network = 32;\r
-                            else\r
-                                $network = 1;\r
-                            preg_match('#<E>(.*)</E>#', $maildata, $matches);\r
-                            if (count($matches) == 0) {\r
-                                $this->debug_message("*** Ignoring OIM maildata without <E>sender</E>");\r
+                        $oim_sender = $matches[1];\r
+                        preg_match('#<I>(.*)</I>#', $maildata, $matches);\r
+                        if (count($matches) == 0) {\r
+                            $this->debug_message("*** Ignoring OIM maildata without <I>msgid</I>");\r
+                            continue;\r
+                        }\r
+                        $oim_msgid = $matches[1];\r
+                        preg_match('#<SZ>(.*)</SZ>#', $maildata, $matches);\r
+                        $oim_size = (count($matches) == 0) ? 0 : $matches[1];\r
+                        preg_match('#<RT>(.*)</RT>#', $maildata, $matches);\r
+                        $oim_time = (count($matches) == 0) ? 0 : $matches[1];\r
+                        $this->debug_message("*** OIM received from $oim_sender, Time: $oim_time, MSGID: $oim_msgid, size: $oim_size");\r
+                        $sMsg = $this->getOIM_message($oim_msgid);\r
+                        if ($sMsg === false) {\r
+                            $this->debug_message("*** Could not get OIM, msgid = $oim_msgid");\r
+                            if ($re_login) {\r
+                                $this->debug_message("*** Could not get OIM via SOAP, and re-login already attempted, ignoring this OIM");\r
                                 continue;\r
                             }\r
-                            $oim_sender = $matches[1];\r
-                            preg_match('#<I>(.*)</I>#', $maildata, $matches);\r
-                            if (count($matches) == 0) {\r
-                                $this->debug_message("*** Ignoring OIM maildata without <I>msgid</I>");\r
+                            $aTickets = $this->get_passport_ticket();\r
+                            if (!$aTickets || !is_array($aTickets)) {\r
+                                // failed to login? ignore it\r
+                                $this->debug_message("*** Could not re-login, something wrong here, ignoring this OIM");\r
                                 continue;\r
                             }\r
-                            $oim_msgid = $matches[1];\r
-                            preg_match('#<SZ>(.*)</SZ>#', $maildata, $matches);\r
-                            $oim_size = (count($matches) == 0) ? 0 : $matches[1];\r
-                            preg_match('#<RT>(.*)</RT>#', $maildata, $matches);\r
-                            $oim_time = (count($matches) == 0) ? 0 : $matches[1];\r
-                            $this->debug_message("*** OIM received from $oim_sender, Time: $oim_time, MSGID: $oim_msgid, size: $oim_size");\r
+                            $re_login = true;\r
+                            $this->ticket = $aTickets;\r
+                            $this->debug_message("*** get new ticket, try it again");\r
                             $sMsg = $this->getOIM_message($oim_msgid);\r
                             if ($sMsg === false) {\r
-                                $this->debug_message("*** Could not get OIM, msgid = $oim_msgid");\r
-                                if ($re_login) {\r
-                                    $this->debug_message("*** Could not get OIM via SOAP, and re-login already attempted, ignoring this OIM");\r
-                                    continue;\r
-                                }\r
-                                $aTickets = $this->get_passport_ticket();\r
-                                if (!$aTickets || !is_array($aTickets)) {\r
-                                    // failed to login? ignore it\r
-                                    $this->debug_message("*** Could not re-login, something wrong here, ignoring this OIM");\r
-                                    continue;\r
-                                }\r
-                                $re_login = true;\r
-                                $this->ticket = $aTickets;\r
-                                $this->debug_message("*** get new ticket, try it again");\r
-                                $sMsg = $this->getOIM_message($oim_msgid);\r
-                                if ($sMsg === false) {\r
-                                    $this->debug_message("*** Could not get OIM via SOAP, and re-login already attempted, ignoring this OIM");\r
-                                    continue;\r
-                                }\r
+                                $this->debug_message("*** Could not get OIM via SOAP, and re-login already attempted, ignoring this OIM");\r
+                                continue;\r
                             }\r
-                            $this->debug_message("*** MSG (Offline) from $oim_sender (network: $network): $sMsg");\r
-                            $this->callHandler('IMin', array('sender' => $oim_sender, 'message' => $sMsg, 'network' => $network, 'offline' => true));\r
                         }\r
+                        $this->debug_message("*** MSG (Offline) from $oim_sender (network: $network): $sMsg");\r
+                        $this->callHandler('IMin', array('sender' => $oim_sender, 'message' => $sMsg, 'network' => $network, 'offline' => true));\r
                     }\r
-                    break;\r
+                }\r
+                break;\r
 \r
-                case 'UBM':\r
-                    // randomly, we get UBM, this is the message from other network, like Yahoo!\r
-                    // NS: <<< UBM {email} $network $type {size}\r
-                    @list(/* UBM */, $from_email, $network, $type, $size,) = @explode(' ', $data);\r
-                    if (is_numeric($size) && $size > 0) {\r
-                        $data = $this->ns_readdata($size);\r
-                        $aLines = @explode("\n", $data);\r
-                        $header = true;\r
-                        $ignore = false;\r
-                        $sMsg = '';\r
-                        foreach ($aLines as $line) {\r
-                            $line = rtrim($line);\r
-                            if ($header) {\r
-                                if ($line === '') {\r
-                                    $header = false;\r
-                                    continue;\r
-                                }\r
-                                if (strncasecmp($line, 'TypingUser:', 11) == 0) {\r
-                                    $ignore = true;\r
-                                    break;\r
-                                }\r
+            case 'UBM':\r
+                // randomly, we get UBM, this is the message from other network, like Yahoo!\r
+                // NS: <<< UBM {email} $network $type {size}\r
+                @list(/* UBM */, $from_email, $network, $type, $size,) = @explode(' ', $data);\r
+                if (is_numeric($size) && $size > 0) {\r
+                    $data = $this->ns_readdata($size);\r
+                    $aLines = @explode("\n", $data);\r
+                    $header = true;\r
+                    $ignore = false;\r
+                    $sMsg = '';\r
+                    foreach ($aLines as $line) {\r
+                        $line = rtrim($line);\r
+                        if ($header) {\r
+                            if ($line === '') {\r
+                                $header = false;\r
                                 continue;\r
                             }\r
-                            $aSubLines = @explode("\r", $line);\r
-                            foreach ($aSubLines as $str) {\r
-                                if ($sMsg !== '')\r
-                                $sMsg .= "\n";\r
-                                $sMsg .= $str;\r
+                            if (strncasecmp($line, 'TypingUser:', 11) == 0) {\r
+                                $ignore = true;\r
+                                break;\r
                             }\r
+                            continue;\r
                         }\r
-                        if ($ignore) {\r
-                            $this->debug_message("*** Ignoring message from $from_email: $line");\r
-                            break;\r
+                        $aSubLines = @explode("\r", $line);\r
+                        foreach ($aSubLines as $str) {\r
+                            if ($sMsg !== '')\r
+                            $sMsg .= "\n";\r
+                            $sMsg .= $str;\r
                         }\r
-                        $this->debug_message("*** MSG from $from_email (network: $network): $sMsg");\r
-                        $this->callHandler('IMin', array('sender' => $from_email, 'message' => $sMsg, 'network' => $network, 'offline' => false));\r
                     }\r
-                    break;\r
+                    if ($ignore) {\r
+                        $this->debug_message("*** Ignoring message from $from_email: $line");\r
+                        break;\r
+                    }\r
+                    $this->debug_message("*** MSG from $from_email (network: $network): $sMsg");\r
+                    $this->callHandler('IMin', array('sender' => $from_email, 'message' => $sMsg, 'network' => $network, 'offline' => false));\r
+                }\r
+                break;\r
 \r
-                case 'UBX':\r
-                    // randomly, we get UBX notification from server\r
-                    // NS: <<< UBX email {network} {size}\r
-                    @list(/* UBX */, /* email */, /* network */, $size,) = @explode(' ', $data);\r
-                    // we don't need the notification data, so just ignore it\r
-                    if (is_numeric($size) && $size > 0)\r
-                        $this->ns_readdata($size);\r
-                    break;\r
+            case 'UBX':\r
+                // randomly, we get UBX notification from server\r
+                // NS: <<< UBX email {network} {size}\r
+                @list(/* UBX */, /* email */, /* network */, $size,) = @explode(' ', $data);\r
+                // we don't need the notification data, so just ignore it\r
+                if (is_numeric($size) && $size > 0)\r
+                    $this->ns_readdata($size);\r
+                break;\r
 \r
-                case 'CHL':\r
-                    // randomly, we'll get challenge from server\r
-                    // NS: <<< CHL 0 {code}\r
-                    @list(/* CHL */, /* 0 */, $chl_code,) = @explode(' ', $data);\r
-                    $fingerprint = $this->getChallenge($chl_code);\r
-                    // NS: >>> QRY {id} {product_id} 32\r
-                    // NS: >>> fingerprint\r
-                    $this->ns_writeln("QRY $this->id ".PROD_ID.' 32');\r
-                    $this->ns_writedata($fingerprint);\r
-                    $this->ns_writeln("CHG $this->id NLN $this->clientid");\r
-                    if ($this->PhotoStickerFile !== false)\r
-                        $this->ns_writeln("CHG $this->id NLN $this->clientid ".rawurlencode($this->MsnObj($this->PhotoStickerFile)));\r
-                    break;\r
-                case 'CHG':\r
-                    // NS: <<< CHG {id} {status} {code}\r
-                    // ignore it\r
-                    // change our status to online first\r
-                    break;\r
+            case 'CHL':\r
+                // randomly, we'll get challenge from server\r
+                // NS: <<< CHL 0 {code}\r
+                @list(/* CHL */, /* 0 */, $chl_code,) = @explode(' ', $data);\r
+                $fingerprint = $this->getChallenge($chl_code);\r
+                // NS: >>> QRY {id} {product_id} 32\r
+                // NS: >>> fingerprint\r
+                $this->ns_writeln("QRY $this->id ".PROD_ID.' 32');\r
+                $this->ns_writedata($fingerprint);\r
+                $this->ns_writeln("CHG $this->id NLN $this->clientid");\r
+                if ($this->PhotoStickerFile !== false)\r
+                    $this->ns_writeln("CHG $this->id NLN $this->clientid ".rawurlencode($this->MsnObj($this->PhotoStickerFile)));\r
+                break;\r
+            case 'CHG':\r
+                // NS: <<< CHG {id} {status} {code}\r
+                // ignore it\r
+                // change our status to online first\r
+                break;\r
 \r
-                case 'XFR':\r
-                    // sometimes, NS will redirect to another NS\r
-                    // MSNP9\r
-                    // NS: <<< XFR {id} NS {server} 0 {server}\r
-                    // MSNP15\r
-                    // NS: <<< XFR {id} NS {server} U D\r
-                    // for normal switchboard XFR\r
-                    // NS: <<< XFR {id} SB {server} CKI {cki} U messenger.msn.com 0\r
-                    @list(/* XFR */, /* {id} */, $server_type, $server, /* CKI */, $cki_code, /* ... */) = @explode(' ', $data);\r
-                    @list($ip, $port) = @explode(':', $server);\r
-                    if ($server_type != 'SB') {\r
-                        // maybe exit?\r
-                        // this connection will close after XFR\r
-                        $this->nsLogout();\r
-                        continue;\r
-                    }\r
+            case 'XFR':\r
+                // sometimes, NS will redirect to another NS\r
+                // MSNP9\r
+                // NS: <<< XFR {id} NS {server} 0 {server}\r
+                // MSNP15\r
+                // NS: <<< XFR {id} NS {server} U D\r
+                // for normal switchboard XFR\r
+                // NS: <<< XFR {id} SB {server} CKI {cki} U messenger.msn.com 0\r
+                @list(/* XFR */, /* {id} */, $server_type, $server, /* CKI */, $cki_code, /* ... */) = @explode(' ', $data);\r
+                @list($ip, $port) = @explode(':', $server);\r
+                if ($server_type != 'SB') {\r
+                    // maybe exit?\r
+                    // this connection will close after XFR\r
+                    $this->nsLogout();\r
+                    continue;\r
+                }\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
-                    break;\r
-                case 'QNG':\r
-                    // NS: <<< QNG {time}\r
-                    @list(/* QNG */, $ping_wait) = @explode(' ', $data);\r
-                    $this->callHandler('Pong', $ping_wait);\r
-                    break;\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
+                break;\r
+            case 'QNG':\r
+                // NS: <<< QNG {time}\r
+                @list(/* QNG */, $ping_wait) = @explode(' ', $data);\r
+                $this->callHandler('Pong', $ping_wait);\r
+                break;\r
 \r
-                case 'RNG':\r
-                    if ($this->PhotoStickerFile !== false)\r
-                        $this->ns_writeln("CHG $this->id NLN $this->clientid ".rawurlencode($this->MsnObj($this->PhotoStickerFile)));\r
-                    else\r
-                        $this->ns_writeln("CHG $this->id NLN $this->clientid");\r
-                    // someone is trying to talk to us\r
-                    // NS: <<< RNG {session_id} {server} {auth_type} {ticket} {email} {alias} U {client} 0\r
-                    $this->debug_message("NS: <<< RNG $data");\r
-                    @list(/* RNG */, $sid, $server, /* auth_type */, $ticket, $email, $name, ) = @explode(' ', $data);\r
-                    @list($sb_ip, $sb_port) = @explode(':', $server);\r
-                    $this->debug_message("*** RING from $email, $sb_ip:$sb_port");\r
-                    $this->addContact($email, 1, $email, true);\r
-                    $this->connectToSBSession('Passive', $sb_ip, $sb_port, $email, array('sid' => $sid, 'ticket' => $ticket));\r
-                    break;\r
-                case 'OUT':\r
-                    // force logout from NS\r
-                    // NS: <<< OUT xxx\r
-                    $this->debug_message("*** LOGOUT from NS");\r
-                    return $this->nsLogout();\r
+            case 'RNG':\r
+                if ($this->PhotoStickerFile !== false)\r
+                    $this->ns_writeln("CHG $this->id NLN $this->clientid ".rawurlencode($this->MsnObj($this->PhotoStickerFile)));\r
+                else\r
+                    $this->ns_writeln("CHG $this->id NLN $this->clientid");\r
+                // someone is trying to talk to us\r
+                // NS: <<< RNG {session_id} {server} {auth_type} {ticket} {email} {alias} U {client} 0\r
+                $this->debug_message("NS: <<< RNG $data");\r
+                @list(/* RNG */, $sid, $server, /* auth_type */, $ticket, $email, $name, ) = @explode(' ', $data);\r
+                @list($sb_ip, $sb_port) = @explode(':', $server);\r
+                $this->debug_message("*** RING from $email, $sb_ip:$sb_port");\r
+                $this->addContact($email, 1, $email, true);\r
+                $this->connectToSBSession('Passive', $sb_ip, $sb_port, $email, array('sid' => $sid, 'ticket' => $ticket));\r
+                break;\r
+            case 'OUT':\r
+                // force logout from NS\r
+                // NS: <<< OUT xxx\r
+                $this->debug_message("*** LOGOUT from NS");\r
+                return $this->nsLogout();\r
 \r
-                default:\r
-                    $code = substr($data,0,3);\r
-                    if (is_numeric($code)) {\r
-                        $this->error = "Error code: $code, please check the detail information from: http://msnpiki.msnfanatic.com/index.php/Reference:Error_List";\r
-                        $this->debug_message("*** NS: $this->error");\r
+            default:\r
+                $code = substr($data,0,3);\r
+                if (is_numeric($code)) {\r
+                    $this->error = "Error code: $code, please check the detail information from: http://msnpiki.msnfanatic.com/index.php/Reference:Error_List";\r
+                    $this->debug_message("*** NS: $this->error");\r
 \r
-                        return $this->nsLogout();\r
-                    }\r
-                    break;\r
-            }\r
+                    return $this->nsLogout();\r
+                }\r
+                break;\r
         }\r
     }\r
 \r