EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LSCChannel.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24 */
25 
26 #ifndef __LSCCHANNEL_H_INCL__
27 #define __LSCCHANNEL_H_INCL__
28 
29 #include "EntityList.h"
30 #include "EVE_LSC.h"
31 #include "packets/LSCPkts.h"
32 
33 class PyRep;
34 class LSCService;
35 class LSCChannel;
36 
38 public:
39  LSCChannelChar(LSCChannel *chan, uint32 corpID, uint32 charID, std::string charName, uint32 allianceID, uint32 warFactionID, int64 role, uint32 extra, LSC::Mode mode) :
40  m_parent(chan),
41  m_corpID(corpID),
42  m_charID(charID),
43  m_charName(charName),
44  m_allianceID(allianceID),
45  m_warFactionID(warFactionID),
46  m_role(role),
47  m_extra(extra),
48  m_mode(mode) { }
49 
51  PyRep *Encode() const;
52 
53 protected:
57  std::string m_charName;
63 };
64 
66 public:
67  LSCChannelMod(LSCChannel * chan, uint32 accessor, int64 untilWhen, uint32 originalMode, std::string admin, std::string reason, LSC::Mode mode) :
68  m_parent(chan),
69  m_accessor(accessor),
70  m_mode(mode),
71  m_untilWhen(untilWhen),
72  m_originalMode(originalMode),
73  m_admin(admin),
74  m_reason(reason) { }
75 
77  PyRep * Encode();
78 
79 protected:
80  LSCChannel * m_parent; // we do not own this
85  std::string m_admin;
86  std::string m_reason;
87 };
88 
89 class LSCChannel {
90 public:
91  LSCChannel(
92  LSCService* svc, int32 channelID, LSC::Type type, uint32 ownerID, const char* displayName, const char* comparisonKey, std::string motd,
93  bool memberless, const char* password, bool mailingList, uint32 cspa, bool temporary, bool languageRestriction, int32 groupMessageID, int32 channelMessageID
94  );
95  ~LSCChannel();
96 
97  PyRep *EncodeID();
103 
104  const char *GetTypeString();
105  bool JoinChannel(Client *pClient);
106  void LeaveChannel(Client* pClient);
107  bool IsJoined(uint32 charID);
108 
109  // this is used for updating joined clients when channel config is changed.
110  void UpdateConfig();
111 
112  void Evacuate(Client * c);
113  void SendMessage(Client * c, const char * message, bool self = false);
114  void SendServerMOTD(Client* pClient);
115 
116  void GetChannelInfo(int32 * channelID, uint32 * ownerID, std::string &displayName, std::string &motd, std::string &comparisonKey,
117  bool * memberless, std::string &password, bool * mailingList, uint32 * cspa, uint32 * temporary);
118 
119  static OnLSC_SenderInfo *_MakeSenderInfo(Client *from);
120 
121  void SetDisplayName(std::string displayName) { m_displayName = displayName; }
122  void SetMOTD(std::string motd) { m_motd = motd; }
123  void SetMemberless(bool memberless) { m_memberless = memberless; }
124  void SetPassword(std::string password) { m_password = password; }
125 
126 
127  bool GetMemberless() { return m_memberless; }
128  bool GetMailingList() { return m_mailingList; }
129  bool GetTemporary() { return m_temporary; }
132  uint16 GetCSPA() { return m_cspa; }
135  uint32 GetMemberCount() { return (uint32)m_chars.size(); }
136  LSC::Type GetType() { return m_type; }
137  LSC::Mode GetMode() { return m_mode; }
138  std::string GetDisplayName() { return m_displayName; }
139  std::string GetMOTD() { return m_motd; }
140  std::string GetComparisonKey() { return m_comparisonKey; }
141  std::string GetPassword() { return m_password; }
142 
143 protected:
144  LSCService *const m_service; //we do not own this
145 
148  // memberless - true = estimate member count, send estimatedMemberCount in packet. false = actual memberList.count() (5m refresh in client)
149  // non-npc corp, fleet, and k-space local are always memberless=false
158  int32 m_channelID; // ids < 0 are automatic conversationalist mode (or creator) and invite only (per client)
159  std::string m_displayName;
160  std::string m_motd;
161  std::string m_comparisonKey;
162  std::string m_password;
163 
164  std::map<uint32, LSCChannelMod> m_mods;
165  std::map<uint32, LSCChannelChar> m_chars;
166 
167  OnLSC_SenderInfo *_FakeSenderInfo();
168 };
169 
170 #endif
Base Python wire object.
Definition: PyRep.h:66
uint32 m_originalMode
Definition: LSCChannel.h:84
uint16 GetCSPA()
Definition: LSCChannel.h:132
LSCChannelChar(LSCChannel *chan, uint32 corpID, uint32 charID, std::string charName, uint32 allianceID, uint32 warFactionID, int64 role, uint32 extra, LSC::Mode mode)
Definition: LSCChannel.h:39
int32 GetChannelID()
Definition: LSCChannel.h:134
uint32 GetOwnerID()
Definition: LSCChannel.h:133
LSCService *const m_service
Definition: LSCChannel.h:144
PyRep * EncodeChannelChars()
Definition: LSCChannel.cpp:365
static OnLSC_SenderInfo * _MakeSenderInfo(Client *from)
Definition: LSCChannel.cpp:261
int64 m_untilWhen
Definition: LSCChannel.h:83
bool GetMailingList()
Definition: LSCChannel.h:128
PyRep * Encode() const
Definition: LSCChannel.cpp:35
void SetMemberless(bool memberless)
Definition: LSCChannel.h:123
LSC::Mode m_mode
Definition: LSCChannel.h:62
std::map< uint32, LSCChannelMod > m_mods
Definition: LSCChannel.h:164
void SetPassword(std::string password)
Definition: LSCChannel.h:124
void GetChannelInfo(int32 *channelID, uint32 *ownerID, std::string &displayName, std::string &motd, std::string &comparisonKey, bool *memberless, std::string &password, bool *mailingList, uint32 *cspa, uint32 *temporary)
Definition: LSCChannel.cpp:98
LSCChannel * m_parent
Definition: LSCChannel.h:80
uint16 m_cspa
Definition: LSCChannel.h:156
LSC::Type m_type
Definition: LSCChannel.h:146
bool GetMemberless()
Definition: LSCChannel.h:127
bool m_temporary
Definition: LSCChannel.h:152
std::string m_displayName
Definition: LSCChannel.h:159
PyRep * EncodeStaticChannel(uint32 charID)
Definition: LSCChannel.cpp:311
std::string GetPassword()
Definition: LSCChannel.h:141
std::string m_motd
Definition: LSCChannel.h:160
bool m_languageRestriction
Definition: LSCChannel.h:153
OnLSC_SenderInfo * _FakeSenderInfo()
Definition: LSCChannel.cpp:272
signed __int32 int32
Definition: eve-compat.h:49
bool IsJoined(uint32 charID)
Definition: LSCChannel.cpp:247
uint32 m_allianceID
Definition: LSCChannel.h:58
void UpdateConfig()
Definition: LSCChannel.cpp:251
LSCChannelMod(LSCChannel *chan, uint32 accessor, int64 untilWhen, uint32 originalMode, std::string admin, std::string reason, LSC::Mode mode)
Definition: LSCChannel.h:67
PyRep * EncodeDynamicChannel(uint32 charID)
Definition: LSCChannel.cpp:333
bool m_memberless
Definition: LSCChannel.h:150
uint32 m_ownerID
Definition: LSCChannel.h:157
LSC::Type GetType()
Definition: LSCChannel.h:136
uint32 m_extra
Definition: LSCChannel.h:61
uint32 GetMemberCount()
Definition: LSCChannel.h:135
void Evacuate(Client *c)
Definition: LSCChannel.cpp:175
LSCChannel(LSCService *svc, int32 channelID, LSC::Type type, uint32 ownerID, const char *displayName, const char *comparisonKey, std::string motd, bool memberless, const char *password, bool mailingList, uint32 cspa, bool temporary, bool languageRestriction, int32 groupMessageID, int32 channelMessageID)
Definition: LSCChannel.cpp:72
PyRep * EncodeEmptyChannelChars()
Definition: LSCChannel.cpp:390
std::string GetDisplayName()
Definition: LSCChannel.h:138
std::string GetMOTD()
Definition: LSCChannel.h:139
LSC::Mode m_mode
Definition: LSCChannel.h:147
PyRep * EncodeID()
Definition: LSCChannel.cpp:283
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
Definition: Client.h:66
bool GetTemporary()
Definition: LSCChannel.h:129
void LeaveChannel(Client *pClient)
Definition: LSCChannel.cpp:140
bool JoinChannel(Client *pClient)
Definition: LSCChannel.cpp:112
LSCChannel * m_parent
Definition: LSCChannel.h:54
void SetMOTD(std::string motd)
Definition: LSCChannel.h:122
unsigned __int32 uint32
Definition: eve-compat.h:50
Type
Definition: EVE_LSC.h:71
void SetDisplayName(std::string displayName)
Definition: LSCChannel.h:121
uint32 m_accessor
Definition: LSCChannel.h:81
int32 m_groupMessageID
Definition: LSCChannel.h:154
const char * GetTypeString()
Definition: LSCChannel.cpp:396
bool m_mailingList
Definition: LSCChannel.h:151
int32 GetChMsgID()
Definition: LSCChannel.h:131
signed __int64 int64
Definition: eve-compat.h:51
std::string m_charName
Definition: LSCChannel.h:57
void SendServerMOTD(Client *pClient)
Definition: LSCChannel.cpp:215
const int cspa
Definition: LSCService.cpp:132
std::string m_admin
Definition: LSCChannel.h:85
void SendMessage(Client *c, const char *message, bool self=false)
Definition: LSCChannel.cpp:193
std::string GetComparisonKey()
Definition: LSCChannel.h:140
LSC::Mode GetMode()
Definition: LSCChannel.h:137
uint32 m_charID
Definition: LSCChannel.h:56
PyRep * Encode()
Definition: LSCChannel.cpp:59
int32 GetGrpMsgID()
Definition: LSCChannel.h:130
LSC::Mode m_mode
Definition: LSCChannel.h:82
uint32 m_corpID
Definition: LSCChannel.h:55
int32 m_channelMessageID
Definition: LSCChannel.h:155
std::string m_comparisonKey
Definition: LSCChannel.h:161
unsigned __int16 uint16
Definition: eve-compat.h:48
uint32 m_warFactionID
Definition: LSCChannel.h:59
Mode
Definition: EVE_LSC.h:91
std::string m_password
Definition: LSCChannel.h:162
int32 m_channelID
Definition: LSCChannel.h:158
PyRep * EncodeChannelMods()
Definition: LSCChannel.cpp:355
std::string m_reason
Definition: LSCChannel.h:86