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 & aHandleIt 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 & aHandleIt is handle to the message.
TCbsMessage & aMessageIt will contain the message information.

GetMessage(TCbsTopicNumber, TInt, TCbsMessage &)

TInt GetMessage(TCbsTopicNumberaNumber,
TIntaIndex,
TCbsMessage &aMessage
)

Returns message information.

Parameters

TCbsTopicNumber aNumberTopic number
TInt aIndexIt is index to the message in topic.
TCbsMessage & aMessageIt will contain the message information.

GetMessageContents(const TCbsMessageHandle &, TDes &)

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

Returns the message contents.

Parameters

const TCbsMessageHandle & aHandleIt is handle to the message.
TDes & aBufferIt will contain the contents (as much as it fits).

GetMessageCount(TCbsTopicNumber, TInt &)

TInt GetMessageCount(TCbsTopicNumberaNumber,
TInt &aCount
)

Returns the total amount of messages the topic contains.

Parameters

TCbsTopicNumber aNumberTopic number.
TInt & aCountIt 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 & aHandleHandle of the message
TInt & aIndexReturn: index of the message in message topic

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

IMPORT_C TIntGetNextAndPrevMessageHandle(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 & aCurrentMsgHandleHandle that specifies the message whose surroundings are returned
TCbsMessageHandle & aPrevMsgHandleReturns: handle of message preceding the given message
TCbsMessageHandle & aNextMsgHandleReturns: handle of message succeeding the given topic
TInt & aPositionReturns: 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 & aHandleIt 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 & aServerIt is the cbs server.

ReadMessage(const TCbsMessageHandle &)

TInt ReadMessage(const TCbsMessageHandle &aHandle)

Sets the message as read.

Parameters

const TCbsMessageHandle & aHandleIt 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 & aHandleHandle to the message to be saved.