"Fossies" - the Fresh Open Source Software Archive

Member "z-push/memimporter.php" (2 Aug 2013, 3460 Bytes) of package /linux/www/old/group-e_z-push_v3.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "memimporter.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 /***********************************************
    3 * File      :   memimporter.php
    4 * Project   :   Z-Push
    5 * Descr     :   Classes that collect changes
    6 *
    7 * Created   :   01.10.2007
    8 *
    9 *  Zarafa Deutschland GmbH, www.zarafaserver.de
   10 * This file is distributed under GPL v2.
   11 * Consult LICENSE file for details
   12 ************************************************/
   13 
   14 class ImportContentsChangesMem extends ImportContentsChanges {
   15     var $_changes;
   16     var $_deletions;
   17 
   18     function ImportContentsChangesMem() {
   19         $this->_changes = array();
   20         $this->_deletions = array();
   21         $this->_md5tosrvid = array();
   22     }
   23     
   24     function ImportMessageChange($id, $message) {
   25         // SMS Initial Sync deduplication of items
   26         if (isset($message->messageclass) &&
   27             strtolower($message->messageclass) == 'ipm.note.mobile.sms') {
   28 //          debugLog("ImportMessageChange Message: ".print_r($message,true));
   29             $md5msg = array('datereceived'      => (isset($message->datereceived)           ? strval($message->datereceived)            : ''),
   30                             'importance'        => (isset($message->importance)             ? strval($message->importance)              : ''),
   31                             'messageclass'      => (isset($message->messageclass)           ? strval($message->messageclass)            : ''),
   32                             'to'                => (isset($message->to)                     ? strval($message->to)                      : ''),
   33                             'cc'                => (isset($message->cc)                     ? strval($message->cc)                      : ''),
   34                             'from'              => (isset($message->from)                   ? strval($message->from)                    : ''),
   35                             'internetcpid'      => (isset($message->internetcpid)           ? strval($message->internetcpid)            : ''),
   36     //                      'conversationid'    => (isset($appdata->conversationid)         ? bin2hex($appdata->conversationid)     : ''),  
   37     //                      'conversationindex' => (isset($appdata->conversationindex)      ? bin2hex($appdata->conversationindex)  : ''),
   38                             'body'              => (isset($message->airsyncbasebody->data)  ? strval($message->airsyncbasebody->data)   : ''),
   39             );
   40             $this->_md5tosrvid[md5(serialize($md5msg))] = array('serverid'          => $id,
   41                                                                 'conversationid'    => $message->conversationid,
   42                                                                 'conversationindex' => $message->conversationindex,
   43                                                                 );
   44         }
   45         $this->_changes[] = $id; 
   46         return true;
   47     }
   48 
   49     function ImportMessageDeletion($id) { 
   50         $this->_deletions[] = $id;
   51         return true;
   52     }
   53 
   54     function ImportMessageReadFlag($message) { return true; }
   55 
   56     function ImportMessageMove($message) { return true; }
   57 
   58     function isDuplicate($md5) {
   59         if (!isset($this->_md5tosrvid[$md5]))
   60             return false;
   61         else
   62             return $this->_md5tosrvid[$md5];
   63     }
   64 
   65     function isChanged($id) {
   66         return in_array($id, $this->_changes);
   67     }
   68 
   69     function isDeleted($id) {
   70         return in_array($id, $this->_deletions);
   71     }
   72 
   73 };
   74 
   75 // This simply collects all changes so that they can be retrieved later, for
   76 // statistics gathering for example
   77 class ImportHierarchyChangesMem extends ImportHierarchyChanges {
   78     var $changed;
   79     var $deleted;
   80     var $count;
   81     
   82     function ImportHierarchyChangesMem() {
   83         $this->changed = array();
   84         $this->deleted = array();
   85         $this->count = 0;
   86         
   87         return true;
   88     }
   89     
   90     function ImportFolderChange($folder) {
   91         array_push($this->changed, $folder);
   92         
   93         $this->count++;
   94 
   95         return true;
   96     }
   97 
   98     function ImportFolderDeletion($id) {
   99         array_push($this->deleted, $id);
  100         
  101         $this->count++;
  102         
  103         return true;
  104     }
  105 };
  106 
  107 ?>