Blame view

LiveChat/SDK/include/gotye/GotyeChatTarget.h 2.87 KB
9f17d59e   陈明泉   no message
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
  /****************************************************************************
   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:	GotyeChatTarget.h
   @description:
   This header file provides definitions of chat target(friend/room).
   Include "GotyeAPI.h" instead of this.
  ****************************************************************************/
  
  #ifndef __GOTYE_CHATTARGET_H__
  #define __GOTYE_CHATTARGET_H__
  
  #include "GotyeMedia.h"
  
  NS_GOTYEAPI_BEGIN
      
  typedef enum
  {
      GotyeChatTargetTypeUser,    ///< friend
      GotyeChatTargetTypeRoom,    ///< room
      GotyeChatTargetTypeGroup,   ///< group
  }GotyeChatTargetType;   ///< enum chat target type
      
  typedef enum
  {
      GotyeUserGenderMale,    ///< male
      GotyeUserGenderFemale,  ///< female
      GotyeUserGenderNotSet   ///< not set
  }GotyeUserGender;   ///< enum user gender
  
  typedef enum {
      GotyeGroupTypePublic,
      GotyeGroupTypePrivate
  }GotyeGroupType;
  
  //base struct of GotyeUser&GotyeRoom&GotyeGroup
  struct GotyeChatTarget
  {
      GotyeChatTargetType type;   ///< chat target type
      
      long long id;    ///< the unique identifier
      std::string name;    ///< room/group name for GotyeRoom or username(UNIQUE) for GotyeUser.
      unsigned tag;   ///< reserved
      
      std::string info; ///< extra information
      bool hasGotDetail;
      
      GotyeMedia icon;    ///< the icon of GotyeRoom/GotyeUser. Using GotyeAPI::downloadMedia to download the image if needed.
      
      GotyeChatTarget();
      GotyeChatTarget(std::string username);
      GotyeChatTarget(const char* username);
      GotyeChatTarget(long long uid, GotyeChatTargetType t);
      
      bool operator==(const GotyeChatTarget& rTarget) const;
  
  };
      
  struct GotyeUser:public GotyeChatTarget
  {
      std::string nickname;
      GotyeUserGender gender;
  
      bool isBlocked;
      bool isFriend;
      
      GotyeUser();
      GotyeUser(const char* username); ///< recommended
      GotyeUser(std::string username); ///< recommended
      
      bool operator==(const GotyeUser& rUser) const;
  };
  
  typedef GotyeUser GotyeLoginUser;
  
      
  struct GotyeRoom:public GotyeChatTarget
  {
      bool isTop; ///< top or not
      
      unsigned capacity; ///< the maxinum member count
      unsigned onlineNumber;  ///< how many members currently online
      
      GotyeRoom();
      GotyeRoom(unsigned roomId);   ///<recommended
      
      bool operator==(const GotyeRoom& rRoom) const;
  };
  
  struct GotyeGroup:public GotyeChatTarget
  {
      GotyeGroupType ownerType; ///< public = 0 private = 1
      std::string ownerAccount; ///<owner account of this group
      bool needAuthentication;
      
      unsigned capacity; ///< the maxinum member count
      
      GotyeGroup();
      GotyeGroup(long long groupId); ///<recommended
      
      bool operator==(const GotyeGroup& rGroup) const;
  };
  
  NS_GOTYEAPI_END
  
  #endif/* defined(__GOTYE_CHATTARGET_H__) */