Back to index

d-push  2.0
Public Member Functions | Private Attributes
PHPWrapper Class Reference

This is the PHP wrapper which strips MAPI information from the import interface of ICS. More...

List of all members.

Public Member Functions

 PHPWrapper ($session, $store, $importer)
 Constructor of the PHPWrapper.
 ConfigContentParameters ($contentparameters)
 Configures additional parameters used for content synchronization.
 Config ($stream, $flags=0)
 Implement MAPI interface.
 GetLastError ($hresult, $ulflags, &$lpmapierror)
 UpdateState ($stream)
 ImportMessageChange ($props, $flags, &$retmapimessage)
 Imports a single message.
 ImportMessageDeletion ($flags, $sourcekeys)
 Imports a list of messages to be deleted.
 ImportPerUserReadStateChange ($readstates)
 Imports a list of messages to be deleted.
 ImportMessageMove ($sourcekeysrcfolder, $sourcekeysrcmessage, $message, $sourcekeydestmessage, $changenumdestmessage)
 Imports a message move this is never called by ICS.
 ImportFolderChange ($props)
 Imports a single folder change.
 ImportFolderDeletion ($flags, $sourcekeys)
 Imports a list of folders which are to be deleted.

Private Attributes

 $importer
 $mapiprovider
 $store
 $contentparameters

Detailed Description

This is the PHP wrapper which strips MAPI information from the import interface of ICS.

We get all the information about messages from MAPI here which are sent to the next importer, which will convert the data into WBXML which is streamed to the PDA

Definition at line 57 of file mapiphpwrapper.php.


Member Function Documentation

PHPWrapper::Config ( stream,
flags = 0 
)

Implement MAPI interface.

Definition at line 96 of file mapiphpwrapper.php.

{}
PHPWrapper::ConfigContentParameters ( contentparameters)

Configures additional parameters used for content synchronization.

Parameters:
ContentParameters$contentparameterspublic
Returns:
boolean
Exceptions:
StatusException

Definition at line 89 of file mapiphpwrapper.php.

                                                                {
        $this->contentparameters = $contentparameters;
    }
PHPWrapper::GetLastError ( hresult,
ulflags,
&$  lpmapierror 
)

Definition at line 97 of file mapiphpwrapper.php.

{}

Imports a single folder change.

Parameters:
mixed$propssourcekey of the changed folder

public

Returns:

Definition at line 197 of file mapiphpwrapper.php.

                                        {
        $sourcekey = $props[PR_SOURCE_KEY];
        $entryid = mapi_msgstore_entryidfromsourcekey($this->store, $sourcekey);
        $mapifolder = mapi_msgstore_openentry($this->store, $entryid);
        $folder = $this->mapiprovider->GetFolder($mapifolder);

        // do not import folder if there is something "wrong" with it
        if ($folder === false)
            return 0;

        $this->importer->ImportFolderChange($folder);
        return 0;
    }
PHPWrapper::ImportFolderDeletion ( flags,
sourcekeys 
)

Imports a list of folders which are to be deleted.

Parameters:
long$flags
mixed$sourcekeysarray with sourcekeys

public

Returns:

Definition at line 220 of file mapiphpwrapper.php.

                                                       {
        foreach ($sourcekeys as $sourcekey) {
            $this->importer->ImportFolderDeletion(bin2hex($sourcekey));
        }
        return 0;
    }
PHPWrapper::ImportMessageChange ( props,
flags,
&$  retmapimessage 
)

Imports a single message.

Parameters:
array$props
long$flags
object$retmapimessagepublic
Returns:
long

Definition at line 110 of file mapiphpwrapper.php.

                                                                          {
        $sourcekey = $props[PR_SOURCE_KEY];
        $parentsourcekey = $props[PR_PARENT_SOURCE_KEY];
        $entryid = mapi_msgstore_entryidfromsourcekey($this->store, $parentsourcekey, $sourcekey);

        if(!$entryid)
            return SYNC_E_IGNORE;

        $mapimessage = mapi_msgstore_openentry($this->store, $entryid);
        try {
            $message = $this->mapiprovider->GetMessage($mapimessage, $this->contentparameters);
        }
        catch (SyncObjectBrokenException $mbe) {
            $brokenSO = $mbe->GetSyncObject();
            if (!$brokenSO) {
                ZLog::Write(LOGLEVEL_ERROR, sprintf("PHPWrapper->ImportMessageChange(): Catched SyncObjectBrokenException but broken SyncObject available"));
            }
            else {
                if (!isset($brokenSO->id)) {
                    $brokenSO->id = "Unknown ID";
                    ZLog::Write(LOGLEVEL_ERROR, sprintf("PHPWrapper->ImportMessageChange(): Catched SyncObjectBrokenException but no ID of object set"));
                }
                ZPush::GetDeviceManager()->AnnounceIgnoredMessage(false, $brokenSO->id, $brokenSO);
            }
            // tell MAPI to ignore the message
            return SYNC_E_IGNORE;
        }


        // substitute the MAPI SYNC_NEW_MESSAGE flag by a z-push proprietary flag
        if ($flags == SYNC_NEW_MESSAGE) $message->flags = SYNC_NEWMESSAGE;
        else $message->flags = $flags;

        $this->importer->ImportMessageChange(bin2hex($sourcekey), $message);

        // Tell MAPI it doesn't need to do anything itself, as we've done all the work already.
        return SYNC_E_IGNORE;
    }

Here is the call graph for this function:

PHPWrapper::ImportMessageDeletion ( flags,
sourcekeys 
)

Imports a list of messages to be deleted.

Parameters:
long$flags
array$sourcekeysarray with sourcekeys

public

Returns:

Definition at line 158 of file mapiphpwrapper.php.

                                                               {
        foreach($sourcekeys as $sourcekey) {
            $this->importer->ImportMessageDeletion(bin2hex($sourcekey));
        }
    }
PHPWrapper::ImportMessageMove ( sourcekeysrcfolder,
sourcekeysrcmessage,
message,
sourcekeydestmessage,
changenumdestmessage 
)

Imports a message move this is never called by ICS.

public

Returns:

Definition at line 185 of file mapiphpwrapper.php.

                                                                                                                                         {
        // Never called
    }

Imports a list of messages to be deleted.

Parameters:
mixed$readstatessourcekeys and message flags

public

Returns:

Definition at line 172 of file mapiphpwrapper.php.

                                                              {
        foreach($readstates as $readstate) {
            $this->importer->ImportMessageReadFlag(bin2hex($readstate["sourcekey"]), $readstate["flags"] & MSGFLAG_READ);
        }
    }
PHPWrapper::PHPWrapper ( session,
store,
importer 
)

Constructor of the PHPWrapper.

Parameters:
ressource$session
ressource$store
IImportChanges$importerincoming changes from ICS are forwarded here

public

Returns:

Definition at line 74 of file mapiphpwrapper.php.

                                                            {
        $this->importer = &$importer;
        $this->store = $store;
        $this->mapiprovider = new MAPIProvider($session, $this->store);
    }
PHPWrapper::UpdateState ( stream)

Definition at line 98 of file mapiphpwrapper.php.

{ }

Member Data Documentation

Definition at line 61 of file mapiphpwrapper.php.

Definition at line 58 of file mapiphpwrapper.php.

Definition at line 59 of file mapiphpwrapper.php.

PHPWrapper::$store [private]

Definition at line 60 of file mapiphpwrapper.php.


The documentation for this class was generated from the following file: