Easemob Windows SDK
emchatconfigs.h
1 /************************************************************
2  * * EaseMob CONFIDENTIAL
3  * __________________
4  * Copyright (C) 2015 EaseMob Technologies. All rights reserved.
5  *
6  * NOTICE: All information contained herein is, and remains
7  * the property of EaseMob Technologies.
8  * Dissemination of this information or reproduction of this material
9  * is strictly forbidden unless prior written permission is obtained
10  * from EaseMob Technologies.
11  */
12 //
13 // emchatconfigs.h
14 // easemob
15 //
16 
17 #ifndef emchatconfigs_h
18 #define emchatconfigs_h
19 
20 #include <iostream>
21 #include <memory>
22 #include "emcallback.h"
23 
24 namespace easemob {
25 
30 class EMChatPrivateConfigs;
31 class EASEMOB_API EMChatConfigs {
32 public:
33  typedef enum
34  {
35  OS_IOS = 0,
36  OS_ANDROID = 1,
37  OS_LINUX = 2,
38  OS_OSX = 3,
39  OS_MSWIN = 4,
40  OS_OTHER = 16,
41  } OSType;
42 
43  typedef enum
44  {
45  DEBUG_LEVEL,
46  WARNING_LEVEL,
47  ERROR_LEVEL
48  } EMLogLevel;
49 
50  EMChatConfigs(const std::string &resourcePath, const std::string &workPath, const std::string &appkey, unsigned int deviceId = 0);
51  virtual ~EMChatConfigs();
52 
53  void setUsingHttps(bool usingHttps) { mIsUsingHttps = usingHttps;}
54 
55  bool getUsingHttps() { return mIsUsingHttps; }
56 
57  void setUseEncryption(bool useEncryption) { mUseEncryption = useEncryption; }
58 
59  bool getUseEncryption() { return mUseEncryption; }
60 
61  void setSortMessageByServerTime(bool sortByServerTime) { mSortByServerTime = sortByServerTime; }
62 
63  bool getSortMessageByServerTime() { return mSortByServerTime; }
64 
65  void setNetCallback(const EMNetCallbackPtr callback) {
66  mNetCallback = callback;
67  }
68 
69  EMNetCallbackPtr getNetCallback() {
70  return mNetCallback;
71  }
72 
79  const std::string& getResourcePath() const { return mResourcePath; }
80 
87  const std::string& getWorkPath() const {return mWorkPath; }
88 
96  void setLogPath(const std::string& path) { mLogPath = path; }
97 
98  const std::string& getLogPath() const { return mLogPath; }
99 
107  void setDownloadPath(const std::string& path) { mDownloadPath = path; }
108 
109  const std::string& getDownloadPath() const { return mDownloadPath; }
110 
117  void setAppKey(const std::string& appKey) { mAppKey = appKey; }
118 
119  const std::string& getAppKey() const {return mAppKey; }
120 
128  void setIsSandboxMode(bool b) { mIsSandboxMode = b; }
129 
136  bool getIsSandboxMode() const {return mIsSandboxMode; }
137 
145  void setEnableConsoleLog(bool b) { mEnableConsoleLog = b; }
146 
153  bool getEnableConsoleLog() const { return mEnableConsoleLog; }
154 
162  void setAutoAcceptFriend(bool b) {mAutoAcceptFriend = b; }
163 
170  bool getAutoAcceptFriend() const { return mAutoAcceptFriend; }
171 
179  void setAutoAcceptGroup(bool b) {mAutoAcceptGroup = b; }
180 
187  bool getAutoAcceptGroup() const { return mAutoAcceptGroup; }
188 
196  void setRequireReadAck(bool b) { mRequireReadAck = b; }
197 
204  bool getRequireReadAck() const {return mRequireReadAck; }
205 
213  void setRequireDeliveryAck(bool b) { mRequireDeliveryAck = b; }
214 
221  bool getRequireDeliveryAck() const {return mRequireDeliveryAck; }
222 
230  void setRequireServerAck(bool b) { mRequireServerAck = b; }
231 
238  bool getRequireServerAck() const { return mRequireServerAck; }
239 
247  void setAutoConversationLoaded(bool b) { mAutoConversationsLoaded = b; }
248 
255  bool getAutoConversationLoaded() const { return mAutoConversationsLoaded; }
256 
264  void setDeleteMessageAsExitGroup(bool b) { mDeleteMessagesAsExitGroup = b; }
265 
272  bool getDeleteMessageAsExitGroup() const { return mDeleteMessagesAsExitGroup; }
273 
281  void setIsChatroomOwnerLeaveAllowed(bool b) { mIsChatroomOwnerLeaveAllowed = b; }
282 
289  bool getIsChatroomOwnerLeaveAllowed() const {return mIsChatroomOwnerLeaveAllowed; }
290 
298  void setNumOfMessageLoaded(int n) { if(n > 0) mNumOfMessageLoaded = n; }
299 
307  int getNumOfMessageLoaded() const { return mNumOfMessageLoaded; }
308 
315  void setOs(const OSType os) { mOs = os; }
316 
323  OSType getOs() const {return mOs; }
324 
331  void setOsVersion(const std::string& version) { mOsVersion = version; }
332 
339  const std::string& getOsVersion() const {return mOsVersion; }
340 
347  void setSdkVersion(const std::string &version) { mSdkVersion = version; }
348 
355  const std::string& getSdkVersion() const {return mSdkVersion; }
356 
363  unsigned int getDeviceID() const {return mDeviceID; }
364 
370  void setClientResource(const std::string &resource) { mClientResource = resource; }
371 
377  const std::string& clientResource() { return mClientResource; }
378 
384  void setLogLevel(EMLogLevel level);
385 
386  EMChatPrivateConfigs& privateConfigs() { return *mPrivateConfigs; }
387 
388  void setDeleteMessageAsExitChatRoom(bool b){mDeleteMessagesAsExitChatRoom = b;}
389 
390  bool getDeleteMessageAsExitChatRoom(){return mDeleteMessagesAsExitChatRoom;}
391 
392 private:
394  EMChatConfigs& operator=(const EMChatConfigs&);
395 
396  std::string mResourcePath;
397  std::string mWorkPath;
398  std::string mLogPath;
399  std::string mDownloadPath;
400  std::string mAppKey;
401  unsigned int mDeviceID;
402  OSType mOs;
403  std::string mOsVersion;
404  std::string mSdkVersion;
405  std::string mClientResource;
406  EMChatPrivateConfigs *mPrivateConfigs;
407 
408  bool mEnableConsoleLog;
409  bool mIsSandboxMode;
410  bool mAutoAcceptFriend;
411  bool mAutoAcceptGroup;
412  bool mRequireReadAck;
413  bool mRequireDeliveryAck;
414  bool mRequireServerAck;
415  bool mAutoConversationsLoaded;
416  bool mDeleteMessagesAsExitGroup;
417  bool mIsChatroomOwnerLeaveAllowed;
418  bool mIsUsingHttps;
419  int mNumOfMessageLoaded;
420  bool mUseEncryption;
421  bool mDeleteMessagesAsExitChatRoom;
422  bool mSortByServerTime;
423  bool mCallSendPushNotificaitonIfOffline;
424  EMNetCallbackPtr mNetCallback;
425 };
426 
427 typedef std::shared_ptr<EMChatConfigs> EMChatConfigsPtr;
428 
429 } // namespace easemob
430 
431 
432 #endif /* emchatconfigs_h */
void setRequireReadAck(bool b)
set if need message read ack.
Definition: emchatconfigs.h:196
bool getIsChatroomOwnerLeaveAllowed() const
get if chatroom owner can leave.
Definition: emchatconfigs.h:289
int getNumOfMessageLoaded() const
get the number of message load at first time.
Definition: emchatconfigs.h:307
void setSdkVersion(const std::string &version)
set sdk version.
Definition: emchatconfigs.h:347
bool getDeleteMessageAsExitGroup() const
get if delete message when exit group.
Definition: emchatconfigs.h:272
bool getIsSandboxMode() const
get sandbox mode.
Definition: emchatconfigs.h:136
const std::string & getWorkPath() const
Get the work path.
Definition: emchatconfigs.h:87
void setEnableConsoleLog(bool b)
set if output the log to console.
Definition: emchatconfigs.h:145
void setAutoAcceptGroup(bool b)
set if auto accept group invitation.
Definition: emchatconfigs.h:179
bool getAutoAcceptFriend() const
get if auto accept friend invitation.
Definition: emchatconfigs.h:170
void setAutoAcceptFriend(bool b)
set if auto accept friend invitation.
Definition: emchatconfigs.h:162
bool getRequireReadAck() const
get if need message read ack.
Definition: emchatconfigs.h:204
bool getAutoConversationLoaded() const
get if load all conversation when login.
Definition: emchatconfigs.h:255
void setIsChatroomOwnerLeaveAllowed(bool b)
set if chatroom owner can leave.
Definition: emchatconfigs.h:281
bool getRequireServerAck() const
get if need message server receive ack.
Definition: emchatconfigs.h:238
OSType getOs() const
get os type.
Definition: emchatconfigs.h:323
void setNumOfMessageLoaded(int n)
set the number of message load at first time.
Definition: emchatconfigs.h:298
void setClientResource(const std::string &resource)
set client resource
Definition: emchatconfigs.h:370
void setLogPath(const std::string &path)
Set the log path.
Definition: emchatconfigs.h:96
unsigned int getDeviceID() const
get device unique id.
Definition: emchatconfigs.h:363
void setRequireServerAck(bool b)
set if need message server receive ack.
Definition: emchatconfigs.h:230
bool getEnableConsoleLog() const
get if output the log to console.
Definition: emchatconfigs.h:153
Definition: emattributevalue.h:28
void setDeleteMessageAsExitGroup(bool b)
set if delete message when exit group.
Definition: emchatconfigs.h:264
const std::string & getResourcePath() const
Get the resource path.
Definition: emchatconfigs.h:79
bool getAutoAcceptGroup() const
get if auto accept group invitation.
Definition: emchatconfigs.h:187
void setRequireDeliveryAck(bool b)
set if need message delivery ack.
Definition: emchatconfigs.h:213
void setOsVersion(const std::string &version)
set os version.
Definition: emchatconfigs.h:331
void setOs(const OSType os)
set os type.
Definition: emchatconfigs.h:315
const std::string & clientResource()
get client resource
Definition: emchatconfigs.h:377
void setAutoConversationLoaded(bool b)
set if need load all conversation when login.
Definition: emchatconfigs.h:247
const std::string & getOsVersion() const
get os version.
Definition: emchatconfigs.h:339
const std::string & getSdkVersion() const
get sdk version.
Definition: emchatconfigs.h:355
void setAppKey(const std::string &appKey)
Set the app key.
Definition: emchatconfigs.h:117
Definition: emchatconfigs.h:31
bool getRequireDeliveryAck() const
get if need message delivery ack.
Definition: emchatconfigs.h:221
void setDownloadPath(const std::string &path)
Set the download path.
Definition: emchatconfigs.h:107
void setIsSandboxMode(bool b)
set sandbox mode.
Definition: emchatconfigs.h:128