Changeset 12590

Show
Ignore:
Timestamp:
09/30/07 01:46:01 (1 year ago)
Author:
w_i
Message:

Applied some fixing to gmail library

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/com.magnettechnologies.contactgrabber/lib/gmail/libgmailer.php

    r12001 r12590  
    88  * Credits: Janak Prajapati, Pravin Shukla, Tapan Moharana  
    99  * Copyright (C) 2007 
    10  
     10  * 
    1111  * This program is free software; you can redistribute it and/or 
    1212  * modify it under the terms of the GNU General Public License 
    1313  * as published by the Free Software Foundation; either version 2 
    1414  * of the License, or (at your option) any later version. 
    15  
     15  * 
    1616  * This program is distributed in the hope that it will be useful, 
    1717  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1818  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1919  * GNU General Public License for more details. 
    20  
     20  * 
    2121  * You should have received a copy of the GNU General Public License 
    2222  * along with this program; if not, write to the Free Software 
     
    4141 * @var bool 
    4242 */ 
    43 define("GM_USE_LIB_AS_MODULE",      false); // Normal operation 
     43define("GM_USE_LIB_AS_MODULE",      true); // Normal operation 
    4444 
    4545/**#@+  
     
    324324                    "action"        => "constructing GMailer object", 
    325325                    "status"        => "failed", 
    326                     "message"       => "libgmailer: Using a multithread server. Ensure php_curl.dll has been enabled (uncommented) in your php.ini." 
     326                    "message"       => "Using a multithread server. Ensure php_curl.dll has been enabled (uncommented) in your php.ini." 
    327327                ); 
    328328                array_unshift($this->return_status, $a); 
     
    334334                        "action"        => "constructing GMailer object", 
    335335                        "status"        => "failed", 
    336                         "message"       => "libgmailer: unable to load curl extension." 
     336                        "message"       => "unable to load curl extension." 
    337337                    ); 
    338338                    array_unshift($this->return_status, $a); 
     
    345345                "action"        => "constructing GMailer object", 
    346346                "status"        => "failed", 
    347                 "message"       => "libgmailer: No curl." 
     347                "message"       => "No curl found." 
    348348            ); 
    349349            array_unshift($this->return_status, $a); 
     
    361361                "action"        => "constructing GMailer object", 
    362362                "status"        => "success", 
    363                 "message"       => "libgmailer: Constructing completed." 
     363                "message"       => "Constructing completed." 
    364364            ); 
    365365            array_unshift($this->return_status, $a); 
     
    384384            "action"        => "set login info", 
    385385            "status"        => "success", 
    386             "message"       => "libgmailer: LoginInfo set." 
     386            "message"       => "LoginInfo set." 
    387387        ); 
    388388        array_unshift($this->return_status, $a); 
     
    401401            $a = array( 
    402402                "action"        => "set hosted domain info", 
    403                 "status"        => "sucess", 
    404                 "message"       => "libgmailer: Using the default gmail/googlemail domain." 
     403                "status"        => "success", 
     404                "message"       => "Using the default gmail/googlemail domain." 
    405405            ); 
    406406            array_unshift($this->return_status, $a); 
     
    412412                "action"        => "set hosted domain info", 
    413413                "status"        => "failed", 
    414                 "message"       => "libgmailer: cannot use \"$my_domain\" as a hosted domain.  The default gmail.com or googlemail.com will be used." 
     414                "message"       => "cannot use \"$my_domain\" as a hosted domain.  The default gmail.com or googlemail.com will be used." 
    415415            ); 
    416416            array_unshift($this->return_status, $a); 
     
    432432            "action"        => "set hosted domain info", 
    433433            "status"        => "success", 
    434             "message"       => "libgmailer: Domain set." 
     434            "message"       => "Domain set." 
    435435        ); 
    436436        array_unshift($this->return_status, $a); 
     
    465465                "action"        => "set proxy", 
    466466                "status"        => "success", 
    467                 "message"       => "libgmailer: Proxy set." 
     467                "message"       => "Proxy set." 
    468468            ); 
    469469            array_unshift($this->return_status, $a); 
     
    472472                "action"        => "set proxy", 
    473473                "status"        => "failed", 
    474                 "message"       => "libgmailer: no hostname supplied." 
     474                "message"       => "no hostname supplied." 
    475475            ); 
    476476            array_unshift($this->return_status, $a); 
     
    622622            $postdata .= "&service=mail"; 
    623623            $postdata .= "&rm=false"; 
    624             $postdata .= "&ltmpl=yj_blanco"; 
     624//            $postdata .= "&ltmpl=yj_blanco"; 
    625625            $postdata .= "&hl=en"; 
    626626            $postdata .= "&Email=".urlencode($this->login); 
     
    732732/*      Debugger::say("first phase: ".print_r($this->gmail_data,true)); */ 
    733733/*      exit; */ 
    734  
     734// var_dump($this, 1); 
     735// die('connect'); 
    735736        $a = array( 
    736737            "action"        => "connecting to Gmail (without cookie)", 
     
    770771                    "action"        => "sign in", 
    771772                    "status"        => "failed", 
    772                     "message"       => "Username and password do not match. (Did you mean ".$suggest." ?)", 
     773                    "message"       => "Username and password do not match. (Did you mean ".$suggest."?)", 
    773774                    "login_error"   => "userpass_suggest", 
    774775                    "login_suggest" => $suggest 
     
    840841                "action"        => "sign in", 
    841842                "status"        => "failed", 
    842                 "message"       => "Gmail: Invalid request. (libgmailer: Gmail seems to have changed the URL again.)", 
     843                "message"       => "Gmail: Invalid request. (Gmail seems to have changed the URL again.)", 
    843844                "login_error"   => "URL" 
    844845            ); 
     
    854855                "action"        => "sign in", 
    855856                "status"        => "failed", 
    856                 "message"       => "libgmailer: Phase one cookie not obtained. Gmail may be down.", 
     857                "message"       => "Phase one cookie not obtained. Gmail may be down.", 
    857858                "login_error"   => "cookie" 
    858859            ); 
     
    992993            "message"       => "Cookie: ".$data 
    993994        ); 
    994         array_unshift($this->return_status, $a);             
     995        array_unshift($this->return_status, $a); 
    995996         
    996997        return true; 
     
    16531654                "action"        => "message action", 
    16541655                "status"        => "failed", 
    1655                 "message"       => "libgmailer: not connected" 
     1656                "message"       => "not connected" 
    16561657            ); 
    16571658            array_unshift($this->return_status, $a); 
     
    19471948                "action"        => "invite", 
    19481949                "status"        => "failed", 
    1949                 "message"       => "libgmailer: feature not available for hosted domains" 
     1950                "message"       => "feature not available for hosted domains" 
    19501951            ); 
    19511952            array_unshift($this->return_status, $a); 
     
    19821983                "action"        => "invite", 
    19831984                "status"        => "failed", 
    1984                 "message"       => "libgmailer: not connected" 
     1985                "message"       => "not connected" 
    19851986            ); 
    19861987            array_unshift($this->return_status, $a); 
     
    20922093            else  
    20932094            { 
    2094                 die("Fail to connect because: ".$this->lastActionStatus()); 
     2095                debug_push_class(__CLASS__, __FUNCTION__); 
     2096                debug_add('Fail to connect because: ' . $this->lastActionStatus(), MIDCOM_ERRCRIT); 
     2097                debug_pop(); 
     2098                $_MIDCOM->uimessages->add( 
     2099                    $_MIDCOM->i18n->get_string('com.magnettechnologies.contactgrabber', 'com.magnettechnologies.contactgrabber'), 
     2100                    sprintf($_MIDCOM->i18n->get_string('Fail to connect! Reason: %s', 'com.magnettechnologies.contactgrabber'), $this->lastActionStatus()) 
     2101                ); 
     2102                return false; 
    20952103            } 
    20962104        }  
    20972105        else  
    20982106        { 
    2099             die("Failed to create GMailer because: ".$this->lastActionStatus()); 
     2107            debug_push_class(__CLASS__, __FUNCTION__); 
     2108            debug_add('Failed to create GMailer because: ' . $this->lastActionStatus(), MIDCOM_ERRCRIT); 
     2109            debug_pop(); 
     2110            $_MIDCOM->uimessages->add( 
     2111                $_MIDCOM->i18n->get_string('com.magnettechnologies.contactgrabber', 'com.magnettechnologies.contactgrabber'), 
     2112                sprintf($_MIDCOM->i18n->get_string('Fail to init GMailer library! Reason: %s', 'com.magnettechnologies.contactgrabber'), $this->lastActionStatus()) 
     2113            ); 
     2114            return false; 
    21002115        } 
    21012116        return $result; 
     
    33043319        // debugging cURL 
    33053320        if (GM_DEBUG_CURL) { 
    3306             $fd = fopen("debug_curl.txt", "a+"); 
     3321            debug_push_class(__CLASS__, __FUNCTION__); 
     3322            debug_add('Saved cURL debug log to /tmp/debug_curl.txt'); 
     3323            debug_pop(); 
     3324             
     3325            $fd = @fopen("/tmp/debug_curl.txt", "a+"); 
    33073326            curl_setopt($c, CURLOPT_VERBOSE, 1); 
    33083327            curl_setopt($c, CURLOPT_STDERR, $fd); 
  • trunk/midcom/com.magnettechnologies.contactgrabber/locale/default.en.txt

    r12589 r12590  
    22---VERSION 2.1.0 
    33---LANGUAGE en 
     4 
     5---STRING com.magnettechnologies.contactgrabber 
     6Contact grabber 
     7---STRINGEND 
    48 
    59---STRING enter login details to fetch your contacts