[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/felamimail/inc/ -> class.bocaching.inc.php (source)

   1  <?php
   2      /***************************************************************************\
   3      * eGroupWare - FeLaMiMail                                                   *
   4      * http://www.linux-at-work.de                                               *
   5      * http://www.phpgw.de                                                       *
   6      * http://www.egroupware.org                                                 *
   7      * Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
   8      * -------------------------------------------------                         *
   9      * This program is free software; you can redistribute it and/or modify it   *
  10      * under the terms of the GNU General Public License as published by the     *
  11      * Free Software Foundation; either version 2 of the License, or (at your    *
  12      * option) any later version.                                                *
  13      \***************************************************************************/
  14      /* $Id: class.bocaching.inc.php 19442 2005-10-18 05:21:02Z lkneschke $ */
  15  
  16      class bocaching
  17      {
  18          var $public_functions = array
  19          (
  20              'updateImapStatus'    => True,
  21              'action'    => True
  22          );
  23  
  24          var $hostname;        // the hostname of the imap server
  25          var $accountname;    // the accountname, used to connect to this imap server
  26          var $foldername;    // folder name
  27          var $accountid;        // phpgw accountid
  28          var $messages;        // the number of messages in the mailbox
  29          var $recent;        // the number of recent messages in the mailbox
  30          var $unseen;        // the number of recent messages in the mailbox
  31          var $uidnext;        // the next uid to be used in the mailbox
  32          var $uidvalidity;    // the next uid to be used in the mailbox
  33          
  34  		function bocaching($_hostname, $_accountname, $_foldername)
  35          {
  36              $this->hostname        = $_hostname;
  37              $this->accountname    = $_accountname;
  38              $this->foldername    = $_foldername;
  39              $this->accountid    = $GLOBALS['egw_info']['user']['account_id'];
  40              
  41              $this->socaching    =& CreateObject('felamimail.socaching',
  42                              $this->hostname, $this->accountname, $this->foldername, $this->accountid);
  43              
  44              $status = $this->socaching->getImapStatus();
  45              if ($status != 0)
  46              {
  47                  $this->messages        = $status['messages'];
  48                  $this->recent         = $status['recent'];
  49                  $this->unseen         = $status['unseen'];
  50                  $this->uidnext         = $status['uidnext'];
  51                  $this->uidvalidity     = $status['uidvalidity'];
  52              }
  53              else
  54              {
  55                  $this->messages        = 0;
  56                  $this->recent         = 0;
  57                  $this->unseen         = 0;
  58                  $this->uidnext         = 0;
  59                  $this->uidvalidity     = 0;
  60              }
  61              
  62          }
  63          
  64  		function addToCache($_data)
  65          {
  66              $search = array('[\016]','[\017]',
  67                      '[\020]','[\021]','[\022]','[\023]','[\024]','[\025]','[\026]','[\027]',
  68                      '[\030]','[\031]','[\032]','[\033]','[\034]','[\035]','[\036]','[\037]');
  69              $replace = '';
  70              
  71              $data = preg_replace($search,$replace,$_data);
  72              
  73              $this->socaching->addToCache($data);
  74          }
  75          
  76  		function clearCache($_folderName='')
  77          {
  78              $this->socaching->clearCache($_folderName);
  79          }
  80          
  81  		function debug()
  82          {
  83              print "Hostname: ".$this->hostname."<br>";
  84              print "Messages: ".$this->messages."<br>";
  85              print "Unseen: ".$this->unseen."<br>";
  86              print "Uidnext: ".$this->uidnext."<br>";
  87              print "Uidvalidity: ".$this->uidvalidity."<br>";
  88          }
  89          
  90  		function getHeaders($_firstMessage='', $_numberOfMessages='' ,$_sort='', $_filter='')
  91          {
  92              return $this->socaching->getHeaders($_firstMessage, $_numberOfMessages, $_sort, $_filter);
  93          }
  94          
  95  		function getImapStatus()
  96          {
  97              $retValue = array
  98              (
  99                  'messages'      => $this->messages,
 100                  'recent'        => $this->recent,
 101                  'unseen'        => $this->unseen,
 102                  'uidnext'       => $this->uidnext,
 103                  'uidvalidity'   => $this->uidvalidity
 104              );
 105              
 106              return $retValue;
 107  
 108          }
 109          
 110          // return the numbers of messages in cache currently
 111          // but use the use filter
 112  		function getMessageCounter($_filter=FALSE)
 113          {
 114              return $this->socaching->getMessageCounter($_filter);
 115          }
 116          
 117  		function getNextMessage($_uid, $_sort, $_filter)
 118          {
 119              return $this->socaching->getNextMessage($_uid, $_sort, $_filter);
 120          }
 121          
 122  		function removeFromCache($_uid)
 123          {
 124              $this->socaching->removeFromCache($_uid);
 125          }        
 126          
 127          // expects the result from imap_status ($mbox, "{".$imapServerAddress.":$imapPort}$mailbox", SA_ALL);
 128  		function updateImapStatus($_status)
 129          {
 130              // are we updating the first time
 131              #if ($this->uidnext == 0)
 132              #{
 133              #    $this->messages        = $_status->messages;
 134              #    $this->recent         = $_status->recent;
 135              #    $this->unseen         = $_status->unseen;
 136              #    $this->uidnext         = $_status->uidnext;
 137              #    $this->uidvalidity     = $_status->uidvalidity;
 138              #
 139              #    $this->socaching->updateImapStatus($_status,true);
 140              #}
 141              #else
 142              #{
 143                  $this->messages        = $_status->messages;
 144                  $this->recent         = $_status->recent;
 145                  $this->unseen         = $_status->unseen;
 146                  $this->uidnext         = $_status->uidnext;
 147                  $this->uidvalidity     = $_status->uidvalidity;
 148              
 149                  return $this->socaching->updateImapStatus($_status);
 150              #}
 151              
 152          }
 153          
 154      }
 155  
 156  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7