GOG GALAXY SDK Documentation
IChat.h
Go to the documentation of this file.
1 #ifndef GALAXY_I_CHAT_H
2 #define GALAXY_I_CHAT_H
3 
10 #include "IListenerRegistrar.h"
11 #include "GalaxyID.h"
12 
13 namespace galaxy
14 {
15  namespace api
16  {
25  typedef uint64_t ChatRoomID;
26 
30  typedef uint64_t ChatMessageID;
31 
36  {
40  };
41 
45  class IChatRoomWithUserRetrieveListener : public GalaxyTypeAwareListener<CHAT_ROOM_WITH_USER_RETRIEVE_LISTENER>
46  {
47  public:
48 
55  virtual void OnChatRoomWithUserRetrieveSuccess(GalaxyID userID, ChatRoomID chatRoomID) = 0;
56 
61  {
65  };
66 
73  virtual void OnChatRoomWithUserRetrieveFailure(GalaxyID userID, FailureReason failureReason) = 0;
74  };
75 
80 
84  class IChatRoomMessageSendListener : public GalaxyTypeAwareListener<CHAT_ROOM_MESSAGE_SEND_LISTENER>
85  {
86  public:
87 
96  virtual void OnChatRoomMessageSendSuccess(ChatRoomID chatRoomID, uint32_t sentMessageIndex, ChatMessageID messageID, uint32_t sendTime) = 0;
97 
102  {
106  };
107 
115  virtual void OnChatRoomMessageSendFailure(ChatRoomID chatRoomID, uint32_t sentMessageIndex, FailureReason failureReason) = 0;
116  };
117 
122 
126  class IChatRoomMessagesListener : public GalaxyTypeAwareListener<CHAT_ROOM_MESSAGES_LISTENER>
127  {
128  public:
129 
143  virtual void OnChatRoomMessagesReceived(ChatRoomID chatRoomID, uint32_t messageCount, uint32_t longestMessageLenght) = 0;
144  };
145 
150 
154  class IChatRoomMessagesRetrieveListener : public GalaxyTypeAwareListener<CHAT_ROOM_MESSAGES_RETRIEVE_LISTENER>
155  {
156  public:
157 
167  virtual void OnChatRoomMessagesRetrieveSuccess(ChatRoomID chatRoomID, uint32_t messageCount, uint32_t longestMessageLenght) = 0;
168 
173  {
177  };
178 
185  virtual void OnChatRoomMessagesRetrieveFailure(ChatRoomID chatRoomID, FailureReason failureReason) = 0;
186  };
187 
192 
196  class IChat
197  {
198  public:
199 
200  virtual ~IChat()
201  {
202  }
203 
214  virtual void RequestChatRoomWithUser(GalaxyID userID, IChatRoomWithUserRetrieveListener* const listener = NULL) = 0;
215 
231  virtual void RequestChatRoomMessages(ChatRoomID chatRoomID, uint32_t limit, ChatMessageID referenceMessageID = 0, IChatRoomMessagesRetrieveListener* const listener = NULL) = 0;
232 
251  virtual uint32_t SendChatRoomMessage(ChatRoomID chatRoomID, const char* msg, IChatRoomMessageSendListener* const listener = NULL) = 0;
252 
275  virtual uint32_t GetChatRoomMessageByIndex(uint32_t index, ChatMessageID& messageID, ChatMessageType& messageType, GalaxyID& senderID, uint32_t& sendTime, char* buffer, uint32_t bufferLength) = 0;
276 
283  virtual uint32_t GetChatRoomMemberCount(ChatRoomID chatRoomID) = 0;
284 
294  virtual GalaxyID GetChatRoomMemberUserIDByIndex(ChatRoomID chatRoomID, uint32_t index) = 0;
295 
304  virtual uint32_t GetChatRoomUnreadMessageCount(ChatRoomID chatRoomID) = 0;
305 
315  virtual void MarkChatRoomAsRead(ChatRoomID chatRoomID) = 0;
316  };
317 
319  }
320 }
321 
322 #endif
Contains GalaxyID, which is the class that represents the ID of an entity used by Galaxy Peer.
Contains data structures and interfaces related to callback listeners.
Represents the ID of an entity used by Galaxy Peer.
Definition: GalaxyID.h:30
The class that is inherited by all specific callback listeners and provides a static method that retu...
Definition: IListenerRegistrar.h:117
Listener for the event of sending a chat room message.
Definition: IChat.h:85
FailureReason
The reason of a failure in sending a message to a chat room.
Definition: IChat.h:102
@ FAILURE_REASON_FORBIDDEN
Sending messages to the chat room is forbidden for the user.
Definition: IChat.h:104
@ FAILURE_REASON_UNDEFINED
Unspecified error.
Definition: IChat.h:103
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IChat.h:105
virtual void OnChatRoomMessageSendSuccess(ChatRoomID chatRoomID, uint32_t sentMessageIndex, ChatMessageID messageID, uint32_t sendTime)=0
Notification for the event of sending a chat room message.
virtual void OnChatRoomMessageSendFailure(ChatRoomID chatRoomID, uint32_t sentMessageIndex, FailureReason failureReason)=0
Notification for the event of a failure in sending a message to a chat room.
Listener for the event of receiving chat room messages.
Definition: IChat.h:127
virtual void OnChatRoomMessagesReceived(ChatRoomID chatRoomID, uint32_t messageCount, uint32_t longestMessageLenght)=0
Notification for the event of receiving chat room messages.
Listener for the event of retrieving chat room messages in a specified chat room.
Definition: IChat.h:155
FailureReason
The reason of a failure in retrieving chat room messages in a specified chat room.
Definition: IChat.h:173
@ FAILURE_REASON_FORBIDDEN
Retrieving messages from the chat room is forbidden for the user.
Definition: IChat.h:175
@ FAILURE_REASON_UNDEFINED
Unspecified error.
Definition: IChat.h:174
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IChat.h:176
virtual void OnChatRoomMessagesRetrieveFailure(ChatRoomID chatRoomID, FailureReason failureReason)=0
Notification for the event of a failure in retrieving chat room messages in a specified chat room.
virtual void OnChatRoomMessagesRetrieveSuccess(ChatRoomID chatRoomID, uint32_t messageCount, uint32_t longestMessageLenght)=0
Notification for the event of retrieving chat room messages in a specified chat room.
Listener for the event of retrieving a chat room with a specified user.
Definition: IChat.h:46
virtual void OnChatRoomWithUserRetrieveSuccess(GalaxyID userID, ChatRoomID chatRoomID)=0
Notification for the event of retrieving a chat room with a specified user.
FailureReason
The reason of a failure in retrieving a chat room with a specified user.
Definition: IChat.h:61
@ FAILURE_REASON_FORBIDDEN
Communication with a specified user is not allowed.
Definition: IChat.h:63
@ FAILURE_REASON_UNDEFINED
Unspecified error.
Definition: IChat.h:62
@ FAILURE_REASON_CONNECTION_FAILURE
Unable to communicate with backend services.
Definition: IChat.h:64
virtual void OnChatRoomWithUserRetrieveFailure(GalaxyID userID, FailureReason failureReason)=0
Notification for the event of a failure in retrieving a chat room with a specified user.
The interface for chat communication with other Galaxy Users.
Definition: IChat.h:197
virtual uint32_t SendChatRoomMessage(ChatRoomID chatRoomID, const char *msg, IChatRoomMessageSendListener *const listener=NULL)=0
Sends a message to a chat room.
virtual void MarkChatRoomAsRead(ChatRoomID chatRoomID)=0
Marks a specified chat room as read.
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.
virtual uint32_t GetChatRoomMemberCount(ChatRoomID chatRoomID)=0
Returns the number of users in a specified chat room.
virtual GalaxyID GetChatRoomMemberUserIDByIndex(ChatRoomID chatRoomID, uint32_t index)=0
Returns the GalaxyID of a user in a specified chat room.
virtual void RequestChatRoomMessages(ChatRoomID chatRoomID, uint32_t limit, ChatMessageID referenceMessageID=0, IChatRoomMessagesRetrieveListener *const listener=NULL)=0
Retrieves historical messages in a specified chat room.
virtual uint32_t GetChatRoomUnreadMessageCount(ChatRoomID chatRoomID)=0
Returns the number of unread messages in a specified chat room.
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.
The class that is inherited by the self-registering versions of all specific callback listeners.
Definition: IListenerRegistrar.h:211
SelfRegisteringListener< IChatRoomMessageSendListener > GlobalChatRoomMessageSendListener
Globally self-registering version of IChatRoomMessageSendListener.
Definition: IChat.h:121
SelfRegisteringListener< IChatRoomMessagesRetrieveListener > GlobalChatRoomMessagesRetrieveListener
Globally self-registering version of IChatRoomMessagesRetrieveListener.
Definition: IChat.h:191
uint64_t ChatMessageID
Global ID of a chat message.
Definition: IChat.h:30
uint64_t ChatRoomID
The ID of a chat room.
Definition: IChat.h:25
SelfRegisteringListener< IChatRoomWithUserRetrieveListener > GlobalChatRoomWithUserRetrieveListener
Globally self-registering version of IChatRoomWithUserRetrieveListener.
Definition: IChat.h:79
SelfRegisteringListener< IChatRoomMessagesListener > GlobalChatRoomMessagesListener
Globally self-registering version of IChatRoomMessagesListener.
Definition: IChat.h:149
ChatMessageType
The type of a chat message.
Definition: IChat.h:36
@ CHAT_MESSAGE_TYPE_GAME_INVITATION
Game invitation.
Definition: IChat.h:39
@ CHAT_MESSAGE_TYPE_CHAT_MESSAGE
Chat message.
Definition: IChat.h:38
@ CHAT_MESSAGE_TYPE_UNKNOWN
Unknown message type.
Definition: IChat.h:37