GOG GALAXY SDK Documentation
IChat Class Referenceabstract

The interface for chat communication with other Galaxy Users. More...

#include <IChat.h>

Public Member Functions

virtual void RequestChatRoomWithUser (GalaxyID userID, IChatRoomWithUserRetrieveListener *const listener=NULL)=0
 Creates new, or retrieves already existing one-on-one chat room with a specified user. More...
 
virtual void RequestChatRoomMessages (ChatRoomID chatRoomID, uint32_t limit, ChatMessageID referenceMessageID=0, IChatRoomMessagesRetrieveListener *const listener=NULL)=0
 Retrieves historical messages in a specified chat room. More...
 
virtual uint32_t SendChatRoomMessage (ChatRoomID chatRoomID, const char *msg, IChatRoomMessageSendListener *const listener=NULL)=0
 Sends a message to a chat room. More...
 
virtual uint32_t GetChatRoomMessageByIndex (uint32_t index, ChatMessageID &messageID, ChatMessageType &messageType, GalaxyID &senderID, uint32_t &sendTime, char *buffer, uint32_t bufferLength)=0
 Reads an incoming chat room message by index. More...
 
virtual uint32_t GetChatRoomMemberCount (ChatRoomID chatRoomID)=0
 Returns the number of users in a specified chat room. More...
 
virtual GalaxyID GetChatRoomMemberUserIDByIndex (ChatRoomID chatRoomID, uint32_t index)=0
 Returns the GalaxyID of a user in a specified chat room. More...
 
virtual uint32_t GetChatRoomUnreadMessageCount (ChatRoomID chatRoomID)=0
 Returns the number of unread messages in a specified chat room. More...
 
virtual void MarkChatRoomAsRead (ChatRoomID chatRoomID)=0
 Marks a specified chat room as read. More...
 

Detailed Description

The interface for chat communication with other Galaxy Users.

Member Function Documentation

◆ GetChatRoomMemberCount()

virtual uint32_t GetChatRoomMemberCount ( ChatRoomID  chatRoomID)
pure virtual

Returns the number of users in a specified chat room.

Parameters
[in]chatRoomIDThe ID of the chat room.
Returns
The number of users in the specified chat room.

◆ GetChatRoomMemberUserIDByIndex()

virtual GalaxyID GetChatRoomMemberUserIDByIndex ( ChatRoomID  chatRoomID,
uint32_t  index 
)
pure virtual

Returns the GalaxyID of a user in a specified chat room.

Precondition
The user must be in the specified chat room in order to retrieve the room members.
Parameters
[in]chatRoomIDThe ID of the chat room.
[in]indexIndex as an integer in the range of [0, number of chat room members).
Returns
The ID of the chat room member.

◆ GetChatRoomMessageByIndex()

virtual uint32_t GetChatRoomMessageByIndex ( uint32_t  index,
ChatMessageID messageID,
ChatMessageType messageType,
GalaxyID senderID,
uint32_t &  sendTime,
char *  buffer,
uint32_t  bufferLength 
)
pure virtual

Reads an incoming chat room message by index.

This call is non-blocking and operates on the messages available in the IChatRoomMessagesListener, thus instantly finishes.

If the buffer that is supposed to take the message is too small, the message will be truncated to its size. The size of the longest message is provided in the notification about an incoming message from IChatRoomMessagesListener::OnChatRoomMessagesReceived().

Remarks
This method can be used only inside of IChatRoomMessagesListener::OnChatRoomMessagesReceived().
Parameters
[in]indexIndex of the incomming message as an integer in the range of [0, number of messages).
[out]messageIDGlobal ID of the message.
[out]messageTypeThe type of the message.
[out]senderIDThe ID of the sender of the message.
[out]sendTimeThe time when the message was sent.
[in,out]bufferThe output buffer.
[in]bufferLengthThe size of the output buffer.
Returns
Actual message size in bytes.

◆ GetChatRoomUnreadMessageCount()

virtual uint32_t GetChatRoomUnreadMessageCount ( ChatRoomID  chatRoomID)
pure virtual

Returns the number of unread messages in a specified chat room.

Precondition
The user must be in the specified chat room in order to retrieve the message count.
Parameters
[in]chatRoomIDThe ID of the chat room.
Returns
The number of unread messages in the chat room.

◆ MarkChatRoomAsRead()

virtual void MarkChatRoomAsRead ( ChatRoomID  chatRoomID)
pure virtual

Marks a specified chat room as read.

Marks all the messages in the specified chat room up to the one received last as read.

Remarks
The user should have read messages in the specified chat room in order to mark it as read.
Parameters
[in]chatRoomIDThe ID of the chat room.

◆ RequestChatRoomMessages()

virtual void RequestChatRoomMessages ( ChatRoomID  chatRoomID,
uint32_t  limit,
ChatMessageID  referenceMessageID = 0,
IChatRoomMessagesRetrieveListener *const  listener = NULL 
)
pure virtual

Retrieves historical messages in a specified chat room.

This call is asynchronous. Response comes to the IChatRoomMessagesRetrieveListener.

The list of retrieved messages contains a limited number of the latest messages that were sent prior to the one specified as the optional reference message.

Precondition
The user must be in the specified chat room in order to retrieve the messages.
Parameters
[in]chatRoomIDThe ID of the chat room.
[in]limitThe maximum number of messages to retrieve or 0 for using default.
[in]referenceMessageIDThe ID of the oldest of the messages that were already retrieved.
[in]listenerThe listener for specific operation.

◆ RequestChatRoomWithUser()

virtual void RequestChatRoomWithUser ( GalaxyID  userID,
IChatRoomWithUserRetrieveListener *const  listener = NULL 
)
pure virtual

Creates new, or retrieves already existing one-on-one chat room with a specified user.

This call is asynchronous. Response comes to the IChatRoomWithUserRetrieveListener, provided that the chat room was created successfully, in which case chat room data is immediately available.

Parameters
[in]userIDThe ID of the interlocutor user.
[in]listenerThe listener for specific operation.

◆ SendChatRoomMessage()

virtual uint32_t SendChatRoomMessage ( ChatRoomID  chatRoomID,
const char *  msg,
IChatRoomMessageSendListener *const  listener = NULL 
)
pure virtual

Sends a message to a chat room.

This call is asynchronous. Result of sending message comes to the IChatRoomMessageSendListener. If message was sent successfully, for all the members in the chat room there comes a notification to the IChatRoomMessagesListener.

Remarks
Internal message index returned by this method should only be used to identify sent messages in callbacks that come to the IChatRoomMessageSendListener.
Precondition
The user needs to be in the chat room in order to send a message to its members.
Parameters
[in]chatRoomIDThe ID of the chat room.
[in]msgThe message to send.
[in]listenerThe listener for specific operation.
Returns
Internal message index.