GotyeDelegate.h
13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/****************************************************************************
Copyright(c) 2013-2014, Shanghai AiLiao Information Technology Co.,Ltd
http://www.gotye.com.cn
@author: liugan
@date: 2014-06-20
@version: v3.0
@filename: Gotye.h
@description:
This header file provides the base class definition with all async callbacks.
Include "GotyeAPI.h" instead of this.
****************************************************************************/
#ifndef __GOTYE_DELEGATE_H__
#define __GOTYE_DELEGATE_H__
#include "Gotye.h"
#include "GotyeMessage.h"
#include "GotyeNotify.h"
#include "GotyeStatusCode.h"
#include "GotyeGroupMsgConfig.h"
NS_GOTYEAPI_BEGIN
/**
* @summary: collection of all async callbacks, inherit from
* this class and override callbacks which you are interested
* in if you wanna listen the callbacks from GotyeAPI.
* @note:
* All callbacks are called on main thread.
*/
class GotyeDelegate
{
public:
/**
* @summary: callback response to GotyeAPI::login
* @param code: status code
* @param user: your account
* @see GotyeStatusCode.h
*/
virtual void onLogin(GotyeStatusCode code, const GotyeLoginUser& user) Optional;
virtual void onReconnecting(GotyeStatusCode code, const GotyeLoginUser& user) Optional;
/**
* @summary: notification when api gets the login user details.
*/
virtual void onGetProfile(GotyeStatusCode code, const GotyeLoginUser& user) Optional;
virtual void onGetCustomerService(GotyeStatusCode code, const GotyeUser& cs, int onlineStatus, const std::string& tip) Optional;
/**
* @summary: callback response to GotyeAPI::logout
* @param code: status code, there are 2 possible values:
* GotyeStatusCodeOK - logout normally
* GotyeStatusCodeForceLogout - Your account is signing up on other devices.
*/
virtual void onLogout(GotyeStatusCode code) Optional;
/**
* @summary: callback response to GotyeAPI::reqModifyUserInfo
* @param user: your account detail information
*/
virtual void onModifyUserInfo(GotyeStatusCode code, const GotyeLoginUser& user) Optional;
/**
* @summary: callback response to GotyeAPI::reqSearchUserList
*/
virtual void onSearchUserList(GotyeStatusCode code, unsigned pageIndex, const std::vector<GotyeUser>& curPageList, const std::vector<GotyeUser>& allList) Optional;
/**
* @summary: callback response to GotyeAPI::getUserDetail
* @param code: status code
* @param user: user detail information for the account you passed to GotyeAPI.
*/
virtual void onGetUserDetail(GotyeStatusCode code, const GotyeUser& user) Optional;
/**
* @summary: callback response to GotyeAPI::reqFriendList
*/
virtual void onGetFriendList(GotyeStatusCode code, const std::vector<GotyeUser>& friendlist) Optional;
/**
* @summary: callback response to GotyeAPI::reqBlockedList
*/
virtual void onGetBlockedList(GotyeStatusCode code, const std::vector<GotyeUser>& blockedlist) Optional;
/**
* @summary: callback response to GotyeAPI::reqAddFriend
*/
virtual void onAddFriend(GotyeStatusCode code, const GotyeUser& user) Optional;
/**
* @summary: callback response to GotyeAPI::reqFriendList
*/
virtual void onAddBlocked(GotyeStatusCode code, const GotyeUser& user) Optional;
/**
* @summary: callback response to GotyeAPI::reqFriendList
*/
virtual void onRemoveFriend(GotyeStatusCode code, const GotyeUser& user) Optional;
/**
* @summary: callback response to GotyeAPI::reqFriendList
*/
virtual void onRemoveBlocked(GotyeStatusCode code, const GotyeUser& user) Optional;
/**
* @summary: callback response to GotyeAPI::reqRoomList
* @param pageIndex: page index passed in GotyeAPI::reqRoomList
* @param roomlist: room list you requested.
*/
virtual void onGetRoomList(GotyeStatusCode code, unsigned pageIndex, const std::vector<GotyeRoom>& curPageRoomList, const std::vector<GotyeRoom>& allRoomList) Optional;
/**
* @summary: callback response to GotyeAPI::enterRoom
* @param room: passed in GotyeAPI::enterRoom
* @param lastMsgID: the last message id in the room.
*/
virtual void onEnterRoom(GotyeStatusCode code, GotyeRoom& room) Optional;
/**
* @summary: callback response to GotyeAPI::leaveRoom
* @param room: passed in GotyeAPI::leaveRoom
*/
virtual void onLeaveRoom(GotyeStatusCode code, GotyeRoom& room) Optional;
/**
* @summary: callback response to GotyeAPI::reqRoomUserList
* @param room: the room passed in GotyeAPI::reqRoomUserList
* @param pageIndex: page index passed in GotyeAPI::reqRoomUserList
* @param userlist: member list you requested.
*/
virtual void onGetRoomMemberList(GotyeStatusCode code, GotyeRoom& room, unsigned pageIndex, const std::vector<GotyeUser>& curPageMemberList, const std::vector<GotyeUser>& allMemberList) Optional;
/**
* @summary: callback response to GotyeAPI::reqSearchGroup
* @param group: passed in GotyeAPI::reqSearchGroup
*/
virtual void onSearchGroupList(GotyeStatusCode code, unsigned pageIndex, const std::vector<GotyeGroup>& curPageList, const std::vector<GotyeGroup>& allList) Optional;
/**
* @summary: callback response to GotyeAPI::createGroup
* @param group: passed in GotyeAPI::createGroup
*/
virtual void onCreateGroup(GotyeStatusCode code, const GotyeGroup& group) Optional;
/**
* @summary: callback response to GotyeAPI::joinGroup
* @param groupID: passed in GotyeAPI::joinGroup
*/
virtual void onJoinGroup(GotyeStatusCode code, const GotyeGroup& group) Optional;
/**
* @summary: callback response to GotyeAPI::leaveGroup
* @param groupID: passed in GotyeAPI::leaveGroup
*/
virtual void onLeaveGroup(GotyeStatusCode code, const GotyeGroup& group) Optional;
/**
* @summary: callback response to GotyeAPI::dismissGroup
* @param groupID: passed in GotyeAPI::dismissGroup
*/
virtual void onDismissGroup(GotyeStatusCode code, const GotyeGroup& group) Optional;
/**
* @summary: callback response to GotyeAPI::kickoutUser
* @param groupID: passed in GotyeAPI::kickoutUser
*/
virtual void onKickoutGroupMember(GotyeStatusCode code, const GotyeGroup& group, const GotyeUser& user) Optional;
/**
* @summary: callback response to GotyeAPI::changeGroupOwner
* @param groupID: passed in GotyeAPI::changeGroupOwner
*/
virtual void onChangeGroupOwner(GotyeStatusCode code, const GotyeGroup& group, const GotyeUser& user) Optional;
/**
* @summary: notify when someone has joined in some group.
*/
virtual void onUserJoinGroup(const GotyeGroup& group, const GotyeUser& user) Optional;
/**
* @summary: notify when someone has left some group.
*/
virtual void onUserLeaveGroup(const GotyeGroup& group, const GotyeUser& user) Optional;
/**
* @summary: notify when the group owner has dismissed some group.
*/
virtual void onUserDismissGroup(const GotyeGroup& group, const GotyeUser& user) Optional;
/**
* @summary: notify when someone has been kicked out in some group.
*/
virtual void onUserKickedFromGroup(const GotyeGroup& group, const GotyeUser& kicked, const GotyeUser& actor) Optional;
/**
* @summary: callback response to GotyeAPI::reqGroupList
* @param pageIndex: page index passed in GotyeAPI::reqGroupList
* @param grouplist: group list you requested.
*/
virtual void onGetGroupList(GotyeStatusCode code, const std::vector<GotyeGroup>& grouplist) Optional;
/**
* @summary: callback response to GotyeAPI::reqModifyGroupInfo
*/
virtual void onModifyGroupInfo(GotyeStatusCode code, const GotyeGroup& group) Optional;
/**
* @summary: callback response to GotyeAPI::getGroupDetail
* @param code: status code
* @param groupID: group detail information for the groupID you passed to GotyeAPI.
*/
virtual void onGetGroupDetail(GotyeStatusCode code, const GotyeGroup& group) Optional;
/**
* @summary: callback response to GotyeAPI::reqGroupMemberList
* @param groupID: the group passed in GotyeAPI::reqGroupMemberList
* @param pageIndex: page index passed in GotyeAPI::reqGroupMemberList
* @param curPageMemberList: member list(current page) you requested.
* @param allMemberList: all member list.
*/
virtual void onGetGroupMemberList(GotyeStatusCode code, const GotyeGroup& group, unsigned pageIndex, const std::vector<GotyeUser>& curPageMemberList, const std::vector<GotyeUser>& allMemberList) Optional;
virtual void onSendNotify(GotyeStatusCode code, const GotyeNotify ¬ify) Optional;
/**
* @summary: notification when rececive notify
* @param notify: new arrived notify
*/
virtual void onReceiveNotify(const GotyeNotify ¬ify) Optional;
/**
* @summary: callback response to GotyeAPI::sendMessage
* @param message: message passed in GotyeAPI::sendMessage
*/
virtual void onSendMessage(GotyeStatusCode code, const GotyeMessage& message) Optional;
/**
* @summary: callback response to GotyeAPI::decodeAudioMessage
* @param message: message passed in GotyeAPI::sendMessage
*/
virtual void onDecodeMessage(GotyeStatusCode code, const GotyeMessage& message) Optional;
/**
* @summary: notification for receiving message
* @param message: new arrived message
* @param downloadMediaIfNeed: let *downloadMediaInfNeed be true if you wanna
* download media content in message automatically, default is false.
*/
virtual void onReceiveMessage(const GotyeMessage& message, bool* downloadMediaIfNeed) Optional;
/**
* @summary: callback response to GotyeAPI::report
* @param message: message you wanna report
*/
virtual void onReport(GotyeStatusCode code, const GotyeMessage& message) Optional;
/**
* @summary: callback response to GotyeAPI::downloadMediaInMessage
* @param message: media message passed in GotyeAPI::downloadMediaInMessage
*/
virtual void onDownloadMediaInMessage(GotyeStatusCode code, const GotyeMessage& message) Optional;
/**
* @summary: callback response to GotyeAPI::getMessageList
* @param msglist: history/offline message list you requested.
* @param downloadMediaIfNeed: let *downloadMediaIfNeed be true if you wanna download media contents for all messages
* automatically, the default value is false.
*/
virtual void onGetMessageList(GotyeStatusCode code, unsigned totalCount, bool* downloadMediaIfNeed) Optional;
/**
* @summary: callback response to GotyeAPI::startTalk
* @param target: with who.
* @param realtime: realtime or not.
*/
virtual void onStartTalk(GotyeStatusCode code, GotyeChatTarget target, bool realtime) Optional;
/**
* @summary: callback response to GotyeAPI::stopTalk
* @param message: the audio message api created for you(only for non-realtime)
* @param cancelSending: let *cancelSending be true if you wanna cancel sending operation, default is
* false, only for non-realtime.
*/
virtual void onStopTalk(GotyeStatusCode code, bool realtime, GotyeMessage& message, bool *cancelSending) Optional;
/**
* @summary: callback response to GotyeAPI::downloadMedia
* @param media: passed in GotyeAPI::downloadMedia
*/
virtual void onDownloadMedia(GotyeStatusCode code, GotyeMedia& media) Optional;
/**
* @summary: callback response to audio playback
* @param realtime: the audio data playback is realtime or not.
* @param source: if realtime is true, source represents a std::string pointer
* containing the userId who is currently talking; otherwise represents a
* GotyeMessage pointer which you passed into GotyeAPI::playMessage
* @param room: valid only when realtime is true.
*/
virtual void onPlayStart(GotyeStatusCode code, const GotyeMessage &message) Optional;
/**
* @summary: realtime playing start.
* @param speaker: who is currently speaking.
* @param room: in which room.
*/
virtual void onRealPlayStart(GotyeStatusCode code, const GotyeUser& speaker, const GotyeRoom& room) Optional;
/**
* @summary: callback response to audio playback.
* @param postion: current playing position(millisecond)
*/
virtual void onPlaying(long position) Optional;
/**
* @summary: playback stopped
*/
virtual void onPlayStop() Optional;
virtual void onSetGroupMsgConfig(GotyeStatusCode code, const GotyeGroup& group, const GotyeGroupMsgConfig config) Optional;
virtual void onGetGroupMsgConfig(GotyeStatusCode code, const GotyeGroup& group, const GotyeGroupMsgConfig config) Optional;
public:
virtual ~GotyeDelegate(){}///<dtor
};
NS_GOTYEAPI_END
#endif/* defined(__GOTYE_DELEGATE_H__) */