RCbsTopicMessages Class Reference

class RCbsTopicMessages : public RSubSessionBase

Inherits from

Constructor & Destructor Documentation

RCbsTopicMessages()

RCbsTopicMessages ( )

Constructor.

Member Functions Documentation

Close()

TInt Close ( )

Closes the subsession.

DeleteMessage(const TCbsMessageHandle &)

TInt DeleteMessage ( const TCbsMessageHandle & aHandle )

Deletes an existing message.

Note that it does not care a lot about the status of the message.

Check also the description of LockMessage method.

Parameters

const TCbsMessageHandle & aHandle It is handle to the message.

FindMessageByHandle(const TCbsMessageHandle &, TCbsMessage &)

TInt FindMessageByHandle ( const TCbsMessageHandle & aHandle,
TCbsMessage & aMessage
)

Finds a message by given handle.

Parameters

const TCbsMessageHandle & aHandle It is handle to the message.
TCbsMessage & aMessage It will contain the message information.

GetMessage(TCbsTopicNumber, TInt, TCbsMessage &)

TInt GetMessage ( TCbsTopicNumber aNumber,
TInt aIndex,
TCbsMessage & aMessage
)

Returns message information.

Parameters

TCbsTopicNumber aNumber Topic number
TInt aIndex It is index to the message in topic.
TCbsMessage & aMessage It will contain the message information.

GetMessageContents(const TCbsMessageHandle &, TDes &)

TInt GetMessageContents ( const TCbsMessageHandle & aHandle,
TDes & aBuffer
)

Returns the message contents.

Parameters

const TCbsMessageHandle & aHandle It is handle to the message.
TDes & aBuffer It will contain the contents (as much as it fits).

GetMessageCount(TCbsTopicNumber, TInt &)

TInt GetMessageCount ( TCbsTopicNumber aNumber,
TInt & aCount
)

Returns the total amount of messages the topic contains.

Parameters

TCbsTopicNumber aNumber Topic number.
TInt & aCount It will contain the total amount of messages.

GetMessageIndexByHandle(const TCbsMessageHandle &, TInt &)

TInt GetMessageIndexByHandle ( const TCbsMessageHandle & aHandle,
TInt & aIndex
)

Returns the index of a message with given handle in topic.

Result code KErrNotFound indicates that no message was found with the given handle.

Parameters

const TCbsMessageHandle & aHandle Handle of the message
TInt & aIndex Return: index of the message in message topic

GetNextAndPrevMessageHandle(const TCbsMessageHandle &, TCbsMessageHandle &, TCbsMessageHandle &, TInt &)

IMPORT_C TInt GetNextAndPrevMessageHandle ( const TCbsMessageHandle & aCurrentMsgHandle,
TCbsMessageHandle & aPrevMsgHandle,
TCbsMessageHandle & aNextMsgHandle,
TInt & aPosition
)

Returns the handles of messages that precede and succeed the given message in server-side list of topic messages.

Topic is resolved from the given message handle

If the given handle specifies the first message in topic, aPosition has ECbsHead bit up. If the given handle specifies the last message in topic, aPosition has ECbsTail bit up.

Return code values: KErrNone aPrevMsgHandle, aNextMsgHandle and aPosition contain valid values. KErrNotFound aCurrentMsgHandle specified a message that was not found.

Parameters

const TCbsMessageHandle & aCurrentMsgHandle Handle that specifies the message whose surroundings are returned
TCbsMessageHandle & aPrevMsgHandle Returns: handle of message preceding the given message
TCbsMessageHandle & aNextMsgHandle Returns: handle of message succeeding the given topic
TInt & aPosition Returns: position of current topic in list

LockMessage(const TCbsMessageHandle &)

TInt LockMessage ( const TCbsMessageHandle & aHandle )

Locks the message.

Note that a single topic messages subsession can have at most one locked message.

Message can be unlocked by trying to lock a null message. Locked message will also be automatically unlocked when subsession is closed. If a message is locked, then it will not be deleted from the database. Thus, deleting a message or trying to delete a topic that contains such a message will fail.

Locking a message does not prevent to save the message nor read the message.

Parameters

const TCbsMessageHandle & aHandle It is handle to the message to be locked.

Open(RCbs &)

TInt Open ( RCbs & aServer )

Creates a subsession to the server. Before using any other method it must be called.

Parameters

RCbs & aServer It is the cbs server.

ReadMessage(const TCbsMessageHandle &)

TInt ReadMessage ( const TCbsMessageHandle & aHandle )

Sets the message as read.

Parameters

const TCbsMessageHandle & aHandle It is handle to the message to be set read.

SaveMessage(const TCbsMessageHandle &)

TInt SaveMessage ( const TCbsMessageHandle & aHandle )

Saves a message (i.e., the saved message won't be deleted to make room for new messages).

Return codes: KErrNone Message is saved. KErrGeneral Message not saved -- total maximum of saved messages reached.

Parameters

const TCbsMessageHandle & aHandle Handle to the message to be saved.