Projects > GmAtom > GmAtom class

GmAtom class

Tags:  

This class does most of the work. It extends GmCurlConnection class.

Properties

Private

$_msgLimit - Max messages to process. This is used only as a fallback value if no $end parameter is specified for receive() method.

Public

$messages - This is where your messages will be stored. Each message is represented by a GmMessageInfo object.

Methods

GmAtom ($user=false, $pass=false)

Constructor initializes parent class.

Username and password params are optional, but you have to provide them later on using the setLoginInfo() method.

(public) setMsgLimit ($limit)

Sets the default message limit value.

(public) check ($forceRefresh=false)

Checks the inbox for new messages and returns the count.

To save some execution time, connection is executed only the first time, and later calls will test the cached result.

To check multiple accounts (or obtain the latest data), you can provide the optional $forceRefresh parameter - this will drop the result cache and re-execute the connection.

Note: this method returns (bool)false on error, new messages count otherwise. That can easily be 0, so be sure to test with '===' for success/failure.

(public) receive ($begin=0, $end=false, $getBody=false)

Recieves and populates the messages array.

The array is populated by messages between $begin and $end interval (both are optional), which may come in handy for paging. If not supplied, $begin will default to zero, $end to _msgLimit property.

By default, messages will be processed without body excerpt. If you wish to have the body available right away, set the optional $getBody parameter to (bool)true.

(public) receiveAll ($getBody=false)

Recieves and populates the messages array with all new messages.

(public) getMessage ($no=false)

Gets the full message info (including the body excerpt) for the specified message only.

(public) sortBy ($what, $reverse=false)

Sorts the message array by the speicified property.

All properties of GmMessageInfo class are allowed.

Optionally, the messages array can be sorted in reverse.

(private) _strCmpCallback ($a, $b)

Sort callback function.

No need to call it yourself.


0 Comments  Show recent to old
Post a comment


 RSS of this page