EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LSCChannel Class Reference

#include "LSCChannel.h"

Collaboration diagram for LSCChannel:

Public Member Functions

 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)
 
 ~LSCChannel ()
 
PyRepEncodeID ()
 
PyRepEncodeStaticChannel (uint32 charID)
 
PyRepEncodeDynamicChannel (uint32 charID)
 
PyRepEncodeChannelMods ()
 
PyRepEncodeChannelChars ()
 
PyRepEncodeEmptyChannelChars ()
 
const char * GetTypeString ()
 
bool JoinChannel (Client *pClient)
 
void LeaveChannel (Client *pClient)
 
bool IsJoined (uint32 charID)
 
void UpdateConfig ()
 
void Evacuate (Client *c)
 
void SendMessage (Client *c, const char *message, bool self=false)
 
void SendServerMOTD (Client *pClient)
 
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)
 
void SetDisplayName (std::string displayName)
 
void SetMOTD (std::string motd)
 
void SetMemberless (bool memberless)
 
void SetPassword (std::string password)
 
bool GetMemberless ()
 
bool GetMailingList ()
 
bool GetTemporary ()
 
int32 GetGrpMsgID ()
 
int32 GetChMsgID ()
 
uint16 GetCSPA ()
 
uint32 GetOwnerID ()
 
int32 GetChannelID ()
 
uint32 GetMemberCount ()
 
LSC::Type GetType ()
 
LSC::Mode GetMode ()
 
std::string GetDisplayName ()
 
std::string GetMOTD ()
 
std::string GetComparisonKey ()
 
std::string GetPassword ()
 

Static Public Member Functions

static OnLSC_SenderInfo * _MakeSenderInfo (Client *from)
 

Protected Member Functions

OnLSC_SenderInfo * _FakeSenderInfo ()
 

Protected Attributes

LSCService *const m_service
 
LSC::Type m_type
 
LSC::Mode m_mode
 
bool m_memberless
 
bool m_mailingList
 
bool m_temporary
 
bool m_languageRestriction
 
int32 m_groupMessageID
 
int32 m_channelMessageID
 
uint16 m_cspa
 
uint32 m_ownerID
 
int32 m_channelID
 
std::string m_displayName
 
std::string m_motd
 
std::string m_comparisonKey
 
std::string m_password
 
std::map< uint32, LSCChannelModm_mods
 
std::map< uint32, LSCChannelCharm_chars
 

Detailed Description

Definition at line 89 of file LSCChannel.h.

Constructor & Destructor Documentation

LSCChannel::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 at line 72 of file LSCChannel.cpp.

References _log, LSC::chConversationalist, m_channelID, m_comparisonKey, m_displayName, and m_mode.

74 : m_service(svc),
75  m_ownerID(ownerID),
76  m_channelID(channelID),
77  m_type(type),
78  m_motd(motd),
79  m_displayName(displayName==nullptr?"":displayName),
80  m_comparisonKey(comparisonKey==nullptr?"":comparisonKey),
81  m_memberless(memberless),
82  m_password(password==nullptr?"":password),
83  m_mailingList(mailingList),
84  m_cspa(cspa),
85  m_temporary(temporary),
86  m_languageRestriction(languageRestriction),
87  m_groupMessageID(groupMessageID),
88  m_channelMessageID(channelMessageID)
89 {
90  m_mode = LSC::Mode::chConversationalist; // default mode '3' for enabling all speakers (till i figure out how to correctly set/change later)
91  _log(LSC__CHANNELS, "Creating channel %u - \"%s\"", m_channelID, (m_displayName == "") ? ((m_comparisonKey == "") ? "null" : m_comparisonKey.c_str()) : m_displayName.c_str());
92 }
#define _log(type, fmt,...)
Definition: logsys.h:124
LSCService *const m_service
Definition: LSCChannel.h:144
uint16 m_cspa
Definition: LSCChannel.h:156
LSC::Type m_type
Definition: LSCChannel.h:146
bool m_temporary
Definition: LSCChannel.h:152
std::string m_displayName
Definition: LSCChannel.h:159
std::string m_motd
Definition: LSCChannel.h:160
bool m_languageRestriction
Definition: LSCChannel.h:153
bool m_memberless
Definition: LSCChannel.h:150
uint32 m_ownerID
Definition: LSCChannel.h:157
LSC::Mode m_mode
Definition: LSCChannel.h:147
int32 m_groupMessageID
Definition: LSCChannel.h:154
bool m_mailingList
Definition: LSCChannel.h:151
const int cspa
Definition: LSCService.cpp:132
int32 m_channelMessageID
Definition: LSCChannel.h:155
std::string m_comparisonKey
Definition: LSCChannel.h:161
std::string m_password
Definition: LSCChannel.h:162
int32 m_channelID
Definition: LSCChannel.h:158
LSCChannel::~LSCChannel ( )

Definition at line 94 of file LSCChannel.cpp.

References _log, m_channelID, m_comparisonKey, and m_displayName.

94  {
95  _log(LSC__CHANNELS, "Destroying channel %u - \"%s\"", m_channelID, (m_displayName == "") ? ((m_comparisonKey == "") ? "null" : m_comparisonKey.c_str()) : m_displayName.c_str());
96 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string m_displayName
Definition: LSCChannel.h:159
std::string m_comparisonKey
Definition: LSCChannel.h:161
int32 m_channelID
Definition: LSCChannel.h:158

Member Function Documentation

OnLSC_SenderInfo * LSCChannel::_FakeSenderInfo ( )
protected

Definition at line 272 of file LSCChannel.cpp.

Referenced by SendServerMOTD().

272  {
273  OnLSC_SenderInfo *sender = new OnLSC_SenderInfo();
274  sender->senderID = 1;
275  sender->senderName = "EVE System";
276  sender->senderType = 1;
277  sender->corpID = 1;
278  sender->role = 1;
279  sender->corp_role = 1;
280  return sender;
281 }

Here is the caller graph for this function:

OnLSC_SenderInfo * LSCChannel::_MakeSenderInfo ( Client from)
static

Definition at line 261 of file LSCChannel.cpp.

References Client::GetAccountRole(), Client::GetChar(), Client::GetCharacterID(), Client::GetCorporationID(), Client::GetCorpRole(), Client::GetName(), and InventoryItem::typeID().

Referenced by Evacuate(), JoinChannel(), LeaveChannel(), and SendMessage().

261  {
262  OnLSC_SenderInfo *sender = new OnLSC_SenderInfo;
263  sender->senderID = c->GetCharacterID();
264  sender->senderName = c->GetName();
265  sender->senderType = c->GetChar()->typeID();
266  sender->corpID = c->GetCorporationID();
267  sender->role = c->GetAccountRole();
268  sender->corp_role = c->GetCorpRole();
269  return sender;
270 }

Here is the call graph for this function:

Here is the caller graph for this function:

PyRep * LSCChannel::EncodeChannelChars ( )

Definition at line 365 of file LSCChannel.cpp.

References m_chars.

365  {
366  /*
367  [PyObjectData Name: util.Rowset]
368  [PyDict 3 kvp]
369  [PyString "header"]
370  [PyList 6 items]
371  [PyString "charID"]
372  [PyString "corpID"]
373  [PyString "allianceID"]
374  [PyString "warFactionID"]
375  [PyString "role"]
376  [PyString "extra"]
377  [PyString "RowClass"]
378  [PyToken util.Row]
379  [PyString "lines"]
380  [PyList 84 items]
381  */
382  ChannelJoinChannelChars info;
383  info.lines = new PyList();
384  std::map<uint32, LSCChannelChar>::iterator itr = m_chars.begin();
385  for(; itr != m_chars.end(); itr++)
386  info.lines->AddItem( itr->second.Encode() );
387  return info.Encode();
388 }
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
Python list.
Definition: PyRep.h:639
PyRep * LSCChannel::EncodeChannelMods ( )

Definition at line 355 of file LSCChannel.cpp.

References m_mods.

356 {
357  ChannelJoinChannelMods info;
358  info.lines = new PyList();
359  std::map<uint32, LSCChannelMod>::iterator itr = m_mods.begin();
360  for(; itr != m_mods.end(); itr++)
361  info.lines->AddItem( itr->second.Encode() );
362  return info.Encode();
363 }
std::map< uint32, LSCChannelMod > m_mods
Definition: LSCChannel.h:164
Python list.
Definition: PyRep.h:639
PyRep * LSCChannel::EncodeDynamicChannel ( uint32  charID)

Definition at line 333 of file LSCChannel.cpp.

References IsStaticChannel, m_channelID, m_channelMessageID, m_chars, m_comparisonKey, m_cspa, m_displayName, m_groupMessageID, m_languageRestriction, m_mailingList, m_memberless, m_mode, m_motd, m_ownerID, m_password, and m_temporary.

333  {
334  ChannelJoinChannelInfo info;
335  info.channelID = m_channelID;
336  info.comparisonKey = m_comparisonKey;
337  info.cspa = m_cspa;
338  info.displayName = m_displayName;
339  info.mailingList = m_mailingList;
340  info.memberless = m_memberless;
341  info.motd = m_motd;
342  info.ownerID = m_ownerID;
343  info.password = m_password;
344  //HACK auto-subscribe to system channels. TODO determine if calling char is subscribed to this channel
345  info.subscribed = IsStaticChannel(m_channelID);
346  info.temporary = m_temporary;
347  info.mode = (int8)m_mode; // determine calling char's mode for this channel
348  info.languageRestriction = m_languageRestriction;
349  info.groupMessageID = m_groupMessageID;
350  info.channelMessageID = m_channelMessageID;
351  info.estimatedMemberCount = m_chars.size();
352  return info.Encode();
353 }
uint16 m_cspa
Definition: LSCChannel.h:156
bool m_temporary
Definition: LSCChannel.h:152
std::string m_displayName
Definition: LSCChannel.h:159
std::string m_motd
Definition: LSCChannel.h:160
signed __int8 int8
Definition: eve-compat.h:45
bool m_languageRestriction
Definition: LSCChannel.h:153
bool m_memberless
Definition: LSCChannel.h:150
uint32 m_ownerID
Definition: LSCChannel.h:157
#define IsStaticChannel(itemID)
Definition: EVE_Defines.h:197
LSC::Mode m_mode
Definition: LSCChannel.h:147
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
int32 m_groupMessageID
Definition: LSCChannel.h:154
bool m_mailingList
Definition: LSCChannel.h:151
int32 m_channelMessageID
Definition: LSCChannel.h:155
std::string m_comparisonKey
Definition: LSCChannel.h:161
std::string m_password
Definition: LSCChannel.h:162
int32 m_channelID
Definition: LSCChannel.h:158
PyRep * LSCChannel::EncodeEmptyChannelChars ( )

Definition at line 390 of file LSCChannel.cpp.

390  {
391  ChannelJoinChannelChars info;
392  info.lines = new PyList();
393  return info.Encode();
394 }
Python list.
Definition: PyRep.h:639
PyRep * LSCChannel::EncodeID ( )

Definition at line 283 of file LSCChannel.cpp.

References LSC::alliance, LSC::character, LSC::constellation, LSC::corp, LSC::custom, LSC::fleet, GetTypeString(), LSC::global, LSC::incursion, m_channelID, m_type, LSC::normal, LSC::region, LSC::solarsystem, LSC::solarsystem2, LSC::squad, LSC::warfaction, and LSC::wing.

Referenced by Evacuate(), JoinChannel(), LeaveChannel(), SendMessage(), and SendServerMOTD().

283  {
284  switch (m_type) {
285  case LSC::Type::global:
286  case LSC::Type::corp:
287  case LSC::Type::region:
291  case LSC::Type::fleet:
292  case LSC::Type::wing:
293  case LSC::Type::squad: {
294  LSCChannelMultiDesc desc;
295  desc.type = GetTypeString();
296  desc.id = m_channelID;
297  return desc.Encode();
298  }
300  case LSC::Type::alliance:
303  case LSC::Type::normal:
304  case LSC::Type::custom: {
305  return new PyInt(m_channelID);
306  }
307  }
308  return new PyInt(m_channelID);
309 }
LSC::Type m_type
Definition: LSCChannel.h:146
Python integer.
Definition: PyRep.h:231
const char * GetTypeString()
Definition: LSCChannel.cpp:396
int32 m_channelID
Definition: LSCChannel.h:158

Here is the call graph for this function:

Here is the caller graph for this function:

PyRep * LSCChannel::EncodeStaticChannel ( uint32  charID)

Definition at line 311 of file LSCChannel.cpp.

References IsStaticChannel, m_channelID, m_channelMessageID, m_chars, m_comparisonKey, m_cspa, m_displayName, m_groupMessageID, m_languageRestriction, m_mailingList, m_memberless, m_mode, m_motd, m_ownerID, m_password, and m_temporary.

311  {
312  ChannelInfoLine line;
313  line.channelID = m_channelID;
314  line.ownerID = m_ownerID;
315  line.displayName = m_displayName;
316  line.motd = m_motd;
317  line.comparisonKey = m_comparisonKey;
318  line.memberless = m_memberless;
319  line.password = m_password;
320  line.mailingList = m_mailingList;
321  line.cspa = m_cspa;
322  line.temporary = m_temporary;
323  line.languageRestriction = m_languageRestriction;
324  line.mode = (int8)m_mode; // determine calling char's mode for this channel
325  //HACK auto-subscribe to system channels. TODO determine if calling char is subscribed to this channel
326  line.subscribed = IsStaticChannel(m_channelID);
327  line.groupMessageID = m_groupMessageID;
328  line.channelMessageID = m_channelMessageID;
329  line.estimatedMemberCount = m_chars.size();
330  return line.Encode();
331 }
uint16 m_cspa
Definition: LSCChannel.h:156
bool m_temporary
Definition: LSCChannel.h:152
std::string m_displayName
Definition: LSCChannel.h:159
std::string m_motd
Definition: LSCChannel.h:160
signed __int8 int8
Definition: eve-compat.h:45
bool m_languageRestriction
Definition: LSCChannel.h:153
bool m_memberless
Definition: LSCChannel.h:150
uint32 m_ownerID
Definition: LSCChannel.h:157
#define IsStaticChannel(itemID)
Definition: EVE_Defines.h:197
LSC::Mode m_mode
Definition: LSCChannel.h:147
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
int32 m_groupMessageID
Definition: LSCChannel.h:154
bool m_mailingList
Definition: LSCChannel.h:151
int32 m_channelMessageID
Definition: LSCChannel.h:155
std::string m_comparisonKey
Definition: LSCChannel.h:161
std::string m_password
Definition: LSCChannel.h:162
int32 m_channelID
Definition: LSCChannel.h:158
void LSCChannel::Evacuate ( Client c)

Definition at line 175 of file LSCChannel.cpp.

References _MakeSenderInfo(), MulticastTarget::characters, EncodeID(), GetTypeString(), m_chars, and sEntityList.

175  {
176  OnLSC_DestroyChannel dc;
177 
178  dc.channelID = EncodeID();
179  dc.member_count = 0;
180  dc.sender = _MakeSenderInfo(c);
181 
182  MulticastTarget mct;
183 
184  std::map<uint32, LSCChannelChar>::iterator cur;
185  cur = m_chars.begin();
186  for(; cur != m_chars.end(); cur++)
187  mct.characters.insert(cur->first);
188 
189  PyTuple *answer = dc.Encode();
190  sEntityList.Multicast("OnLSC", GetTypeString(), &answer, mct);
191 }
static OnLSC_SenderInfo * _MakeSenderInfo(Client *from)
Definition: LSCChannel.cpp:261
#define sEntityList
Definition: EntityList.h:208
Python tuple.
Definition: PyRep.h:567
PyRep * EncodeID()
Definition: LSCChannel.cpp:283
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
std::set< uint32 > characters
Definition: EntityList.h:58
const char * GetTypeString()
Definition: LSCChannel.cpp:396

Here is the call graph for this function:

int32 LSCChannel::GetChannelID ( )
inline

Definition at line 134 of file LSCChannel.h.

References m_channelID.

Referenced by LSCDB::UpdateChannelInfo().

134 { return m_channelID; }
int32 m_channelID
Definition: LSCChannel.h:158

Here is the caller graph for this function:

void LSCChannel::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 at line 98 of file LSCChannel.cpp.

References m_channelID, m_comparisonKey, m_cspa, m_displayName, m_mailingList, m_memberless, m_motd, m_ownerID, m_password, and m_temporary.

99 {
100  *channelID = m_channelID;
101  *ownerID = m_ownerID;
102  displayName = m_displayName;
103  motd = m_motd;
104  comparisonKey = m_comparisonKey;
105  *memberless = m_memberless;
106  password = m_password;
107  *mailingList = m_mailingList;
108  *cspa = m_cspa;
109  *temporary = m_temporary;
110 }
uint16 m_cspa
Definition: LSCChannel.h:156
bool m_temporary
Definition: LSCChannel.h:152
std::string m_displayName
Definition: LSCChannel.h:159
std::string m_motd
Definition: LSCChannel.h:160
bool m_memberless
Definition: LSCChannel.h:150
uint32 m_ownerID
Definition: LSCChannel.h:157
bool m_mailingList
Definition: LSCChannel.h:151
const int cspa
Definition: LSCService.cpp:132
std::string m_comparisonKey
Definition: LSCChannel.h:161
std::string m_password
Definition: LSCChannel.h:162
int32 m_channelID
Definition: LSCChannel.h:158
int32 LSCChannel::GetChMsgID ( )
inline

Definition at line 131 of file LSCChannel.h.

References m_channelMessageID.

131 { return m_channelMessageID; }
int32 m_channelMessageID
Definition: LSCChannel.h:155
std::string LSCChannel::GetComparisonKey ( )
inline

Definition at line 140 of file LSCChannel.h.

References m_comparisonKey.

Referenced by LSCDB::UpdateChannelInfo().

140 { return m_comparisonKey; }
std::string m_comparisonKey
Definition: LSCChannel.h:161

Here is the caller graph for this function:

uint16 LSCChannel::GetCSPA ( )
inline

Definition at line 132 of file LSCChannel.h.

References m_cspa.

Referenced by LSCDB::UpdateChannelInfo().

132 { return m_cspa; }
uint16 m_cspa
Definition: LSCChannel.h:156

Here is the caller graph for this function:

std::string LSCChannel::GetDisplayName ( )
inline

Definition at line 138 of file LSCChannel.h.

References m_displayName.

Referenced by LSCDB::UpdateChannelInfo().

138 { return m_displayName; }
std::string m_displayName
Definition: LSCChannel.h:159

Here is the caller graph for this function:

int32 LSCChannel::GetGrpMsgID ( )
inline

Definition at line 130 of file LSCChannel.h.

References m_groupMessageID.

130 { return m_groupMessageID; }
int32 m_groupMessageID
Definition: LSCChannel.h:154
bool LSCChannel::GetMailingList ( )
inline

Definition at line 128 of file LSCChannel.h.

References m_mailingList.

Referenced by LSCDB::UpdateChannelInfo().

128 { return m_mailingList; }
bool m_mailingList
Definition: LSCChannel.h:151

Here is the caller graph for this function:

uint32 LSCChannel::GetMemberCount ( )
inline

Definition at line 135 of file LSCChannel.h.

References m_chars.

135 { return (uint32)m_chars.size(); }
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
unsigned __int32 uint32
Definition: eve-compat.h:50
bool LSCChannel::GetMemberless ( )
inline

Definition at line 127 of file LSCChannel.h.

References m_memberless.

Referenced by LSCDB::UpdateChannelInfo().

127 { return m_memberless; }
bool m_memberless
Definition: LSCChannel.h:150

Here is the caller graph for this function:

LSC::Mode LSCChannel::GetMode ( )
inline

Definition at line 137 of file LSCChannel.h.

References m_mode.

137 { return m_mode; }
LSC::Mode m_mode
Definition: LSCChannel.h:147
std::string LSCChannel::GetMOTD ( )
inline

Definition at line 139 of file LSCChannel.h.

References m_motd.

Referenced by LSCDB::UpdateChannelInfo().

139 { return m_motd; }
std::string m_motd
Definition: LSCChannel.h:160

Here is the caller graph for this function:

uint32 LSCChannel::GetOwnerID ( )
inline

Definition at line 133 of file LSCChannel.h.

References m_ownerID.

Referenced by LSCDB::UpdateChannelInfo().

133 { return m_ownerID; }
uint32 m_ownerID
Definition: LSCChannel.h:157

Here is the caller graph for this function:

std::string LSCChannel::GetPassword ( )
inline

Definition at line 141 of file LSCChannel.h.

References m_password.

Referenced by LSCDB::UpdateChannelInfo().

141 { return m_password; }
std::string m_password
Definition: LSCChannel.h:162

Here is the caller graph for this function:

bool LSCChannel::GetTemporary ( )
inline

Definition at line 129 of file LSCChannel.h.

References m_temporary.

129 { return m_temporary; }
bool m_temporary
Definition: LSCChannel.h:152
LSC::Type LSCChannel::GetType ( )
inline

Definition at line 136 of file LSCChannel.h.

References m_type.

136 { return m_type; }
LSC::Type m_type
Definition: LSCChannel.h:146
const char * LSCChannel::GetTypeString ( )

Definition at line 396 of file LSCChannel.cpp.

References LSC::alliance, LSC::character, LSC::constellation, LSC::corp, LSC::custom, LSC::fleet, LSC::global, LSC::incursion, m_type, LSC::normal, LSC::region, LSC::solarsystem, LSC::solarsystem2, LSC::squad, LSC::warfaction, and LSC::wing.

Referenced by EncodeID(), Evacuate(), JoinChannel(), LeaveChannel(), SendMessage(), and SendServerMOTD().

396  {
397  switch(m_type) {
398  case LSC::Type::normal: return "normal";
399  case LSC::Type::custom: return "private";
400  case LSC::Type::corp: return "corpid";
401  case LSC::Type::solarsystem2: return "solarsystemid2";
402  case LSC::Type::region: return "regionid";
403  case LSC::Type::constellation: return "constellationid";
404  case LSC::Type::global: return "global";
405  case LSC::Type::alliance: return "allianceid";
406  case LSC::Type::fleet: return "fleetid";
407  case LSC::Type::squad: return "squadid";
408  case LSC::Type::wing: return "wingid";
409  case LSC::Type::warfaction: return "warfactionid";
410  case LSC::Type::character: return "charid";
411  case LSC::Type::solarsystem: return "solarsystemid";
412  case LSC::Type::incursion: return "incursion";
413  default: return "unknown";
414  }
415 }
LSC::Type m_type
Definition: LSCChannel.h:146

Here is the caller graph for this function:

bool LSCChannel::IsJoined ( uint32  charID)

Definition at line 247 of file LSCChannel.cpp.

References m_chars.

247  {
248  return (m_chars.find(charID) != m_chars.end());
249 }
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
bool LSCChannel::JoinChannel ( Client pClient)
Todo:
determine moderator/other rights for given char in this channel and set Mode accordingly

Definition at line 112 of file LSCChannel.cpp.

References _log, _MakeSenderInfo(), Client::ChannelJoined(), MulticastTarget::characters, LSC::chConversationalist, LSC::chCreator, EncodeID(), Client::GetAccountRole(), Client::GetAllianceID(), Client::GetCharacterID(), Client::GetCharName(), Client::GetCorporationID(), Client::GetName(), GetTypeString(), Client::GetWarFactionID(), m_channelID, m_chars, m_displayName, m_ownerID, and sEntityList.

112  {
114  m_chars.insert(
115  std::make_pair(
116  pClient->GetCharacterID(),
117  LSCChannelChar( this, pClient->GetCorporationID(), pClient->GetCharacterID(), pClient->GetCharName(), pClient->GetAllianceID(), pClient->GetWarFactionID(), pClient->GetAccountRole(), 0,\
119  )
120  );
121  pClient->ChannelJoined( this );
122 
123  OnLSC_JoinChannel join;
124  join.sender = _MakeSenderInfo(pClient);
125  join.member_count = (int32)m_chars.size();
126  join.channelID = EncodeID();
127 
128  MulticastTarget mct;
129  std::map<uint32, LSCChannelChar>::iterator cur;
130  cur = m_chars.begin();
131  for( ; cur != m_chars.end(); ++cur )
132  mct.characters.insert( cur->first );
133  PyTuple *answer = join.Encode();
134  sEntityList.Multicast( "OnLSC", GetTypeString(), &answer, mct );
135 
136  _log(LSC__CHANNELS, "%s Joined Channel %u - %s", pClient->GetName(), m_channelID, m_displayName.c_str());
137  return true;
138 }
int64 GetAccountRole() const
Definition: Client.h:118
#define _log(type, fmt,...)
Definition: logsys.h:124
static OnLSC_SenderInfo * _MakeSenderInfo(Client *from)
Definition: LSCChannel.cpp:261
int32 GetCharacterID() const
Definition: Client.h:113
int32 GetWarFactionID() const
Definition: Client.h:126
int32 GetCorporationID() const
Definition: Client.h:123
#define sEntityList
Definition: EntityList.h:208
std::string m_displayName
Definition: LSCChannel.h:159
Python tuple.
Definition: PyRep.h:567
int32 GetAllianceID() const
Definition: Client.h:125
signed __int32 int32
Definition: eve-compat.h:49
uint32 m_ownerID
Definition: LSCChannel.h:157
void ChannelJoined(LSCChannel *chan)
Definition: Client.cpp:1799
const char * GetName() const
Definition: Client.h:94
PyRep * EncodeID()
Definition: LSCChannel.cpp:283
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
std::set< uint32 > characters
Definition: EntityList.h:58
std::string GetCharName()
Definition: Client.h:165
const char * GetTypeString()
Definition: LSCChannel.cpp:396
int32 m_channelID
Definition: LSCChannel.h:158

Here is the call graph for this function:

void LSCChannel::LeaveChannel ( Client pClient)
Todo:
delete channel from system if non-static and empty

Definition at line 140 of file LSCChannel.cpp.

References _log, _MakeSenderInfo(), Client::ChannelLeft(), MulticastTarget::characters, EncodeID(), Client::GetCharacterID(), Client::GetName(), GetTypeString(), m_channelID, m_chars, m_displayName, sConsole, and sEntityList.

141 {
142  if (sConsole.IsShutdown())
143  return;
144 
145  if (m_chars.empty())
146  return;
147 
148  uint32 charID = pClient->GetCharacterID();
149  if (m_chars.find(charID) == m_chars.end())
150  return;
151 
152  m_chars.erase(charID);
153 
154  MulticastTarget mct;
155  std::map<uint32, LSCChannelChar>::iterator cur;
156  cur = m_chars.begin();
157  for(; cur != m_chars.end(); ++cur)
158  mct.characters.insert( cur->first );
159 
160  OnLSC_LeaveChannel leave;
161  leave.sender = _MakeSenderInfo(pClient);
162  leave.member_count = (int32)m_chars.size();
163  leave.channelID = EncodeID();
164 
165  PyTuple *answer = leave.Encode();
166  sEntityList.Multicast("OnLSC", GetTypeString(), &answer, mct);
167 
168  _log(LSC__CHANNELS, "%s Left Channel %u - %s", pClient->GetName(), m_channelID, m_displayName.c_str());
169 
170  pClient->ChannelLeft(this);
171 
173 }
void ChannelLeft(LSCChannel *chan)
Definition: Client.cpp:1803
#define _log(type, fmt,...)
Definition: logsys.h:124
#define sConsole
static OnLSC_SenderInfo * _MakeSenderInfo(Client *from)
Definition: LSCChannel.cpp:261
int32 GetCharacterID() const
Definition: Client.h:113
#define sEntityList
Definition: EntityList.h:208
std::string m_displayName
Definition: LSCChannel.h:159
Python tuple.
Definition: PyRep.h:567
signed __int32 int32
Definition: eve-compat.h:49
const char * GetName() const
Definition: Client.h:94
PyRep * EncodeID()
Definition: LSCChannel.cpp:283
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
unsigned __int32 uint32
Definition: eve-compat.h:50
std::set< uint32 > characters
Definition: EntityList.h:58
const char * GetTypeString()
Definition: LSCChannel.cpp:396
int32 m_channelID
Definition: LSCChannel.h:158

Here is the call graph for this function:

void LSCChannel::SendMessage ( Client c,
const char *  message,
bool  self = false 
)

Definition at line 193 of file LSCChannel.cpp.

References _MakeSenderInfo(), MulticastTarget::characters, EncodeID(), Client::GetCharacterID(), GetTypeString(), m_chars, and sEntityList.

193  {
194 // to send system msgs, senderID should be 1 (system owner)
195 
196  MulticastTarget mct;
197  if (self) {
198  mct.characters.insert(c->GetCharacterID());
199  } else {
200  std::map<uint32, LSCChannelChar>::iterator itr = m_chars.begin();
201  for(; itr != m_chars.end(); ++itr)
202  mct.characters.insert( itr->first );
203  }
204 
205  OnLSC_SendMessage sm;
206  sm.sender = _MakeSenderInfo(c);
207  sm.channelID = EncodeID();
208  sm.message = message;
209  sm.member_count = m_chars.size();
210 
211  PyTuple *answer = sm.Encode();
212  sEntityList.Multicast("OnLSC", GetTypeString(), &answer, mct);
213 }
static OnLSC_SenderInfo * _MakeSenderInfo(Client *from)
Definition: LSCChannel.cpp:261
int32 GetCharacterID() const
Definition: Client.h:113
#define sEntityList
Definition: EntityList.h:208
Python tuple.
Definition: PyRep.h:567
PyRep * EncodeID()
Definition: LSCChannel.cpp:283
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
std::set< uint32 > characters
Definition: EntityList.h:58
const char * GetTypeString()
Definition: LSCChannel.cpp:396

Here is the call graph for this function:

void LSCChannel::SendServerMOTD ( Client pClient)

Definition at line 215 of file LSCChannel.cpp.

References _FakeSenderInfo(), Client::AutoStop(), EncodeID(), EVEMU_BUILD_DATE, EVEMU_REVISION, GetTypeString(), m_chars, Client::SendNotification(), and sEntityList.

215  {
216  std::string uptime;
217  sEntityList.GetUpTime(uptime);
218  std::string msg = "<br>Welcome to EVEmu Server";
219  //msg += pClient->GetCharName();
220  msg += ".<br>Server Version: ";
221  msg += EVEMU_REVISION;
222  msg += "<br>Revision Date: ";
223  msg += EVEMU_BUILD_DATE;
224  msg += "<br>Uptime: ";
225  msg += uptime;
226  msg += "<br>Current Population: ";
227  msg += std::to_string(sEntityList.GetClientCount());
228  msg += "<br><br>Character Options:";
229  msg += "<br>Module AutoStop: ";
230  msg += (pClient->AutoStop() ? "On" : "Off");
231  msg += "<br>RAM Event: On";
232  //msg += (pClient->RAMEvent() ? "On" : "Off");
233  // check account roles for this one
234  msg += "<br>ShowAll: Off";
235  //msg += (pClient->ShowAll() ? "On" : "Off");
236 
237  OnLSC_SendMessage sm;
238  sm.sender = _FakeSenderInfo();
239  sm.channelID = EncodeID();
240  sm.message = msg;
241  sm.member_count = m_chars.size();
242 
243  PyTuple *answer = sm.Encode();
244  pClient->SendNotification("OnLSC", GetTypeString(), &answer);
245 }
void SendNotification(const PyAddress &dest, EVENotificationStream &noti, bool seq=true)
Definition: Client.cpp:2245
#define sEntityList
Definition: EntityList.h:208
Python tuple.
Definition: PyRep.h:567
OnLSC_SenderInfo * _FakeSenderInfo()
Definition: LSCChannel.cpp:272
PyRep * EncodeID()
Definition: LSCChannel.cpp:283
std::map< uint32, LSCChannelChar > m_chars
Definition: LSCChannel.h:165
const char * GetTypeString()
Definition: LSCChannel.cpp:396
static const char *const EVEMU_REVISION
Definition: EVEVersion.h:42
static const char *const EVEMU_BUILD_DATE
Definition: EVEVersion.h:43
bool AutoStop()
Definition: Client.h:274

Here is the call graph for this function:

void LSCChannel::SetDisplayName ( std::string  displayName)
inline

Definition at line 121 of file LSCChannel.h.

References m_displayName.

121 { m_displayName = displayName; }
std::string m_displayName
Definition: LSCChannel.h:159
void LSCChannel::SetMemberless ( bool  memberless)
inline

Definition at line 123 of file LSCChannel.h.

References m_memberless.

123 { m_memberless = memberless; }
bool m_memberless
Definition: LSCChannel.h:150
void LSCChannel::SetMOTD ( std::string  motd)
inline

Definition at line 122 of file LSCChannel.h.

References m_motd.

122 { m_motd = motd; }
std::string m_motd
Definition: LSCChannel.h:160
void LSCChannel::SetPassword ( std::string  password)
inline

Definition at line 124 of file LSCChannel.h.

References m_password.

124 { m_password = password; }
std::string m_password
Definition: LSCChannel.h:162
void LSCChannel::UpdateConfig ( )

Definition at line 251 of file LSCChannel.cpp.

252 {
253  // ********** TODO **********
254  // Figure out how to send a packet to all clients subscribed to this channel that contains all channel parameters
255  // so that their clients can update everything that has changed in this channel's access control.
256  // **************************
257 
258 }

Member Data Documentation

int32 LSCChannel::m_channelMessageID
protected

Definition at line 155 of file LSCChannel.h.

Referenced by EncodeDynamicChannel(), EncodeStaticChannel(), and GetChMsgID().

std::string LSCChannel::m_comparisonKey
protected
uint16 LSCChannel::m_cspa
protected

Definition at line 156 of file LSCChannel.h.

Referenced by EncodeDynamicChannel(), EncodeStaticChannel(), GetChannelInfo(), and GetCSPA().

std::string LSCChannel::m_displayName
protected
int32 LSCChannel::m_groupMessageID
protected

Definition at line 154 of file LSCChannel.h.

Referenced by EncodeDynamicChannel(), EncodeStaticChannel(), and GetGrpMsgID().

bool LSCChannel::m_languageRestriction
protected

Definition at line 153 of file LSCChannel.h.

Referenced by EncodeDynamicChannel(), and EncodeStaticChannel().

bool LSCChannel::m_mailingList
protected
bool LSCChannel::m_memberless
protected
LSC::Mode LSCChannel::m_mode
protected

Definition at line 147 of file LSCChannel.h.

Referenced by EncodeDynamicChannel(), EncodeStaticChannel(), GetMode(), and LSCChannel().

std::map<uint32, LSCChannelMod> LSCChannel::m_mods
protected

Definition at line 164 of file LSCChannel.h.

Referenced by EncodeChannelMods().

std::string LSCChannel::m_motd
protected
uint32 LSCChannel::m_ownerID
protected
std::string LSCChannel::m_password
protected
LSCService* const LSCChannel::m_service
protected

Definition at line 144 of file LSCChannel.h.

bool LSCChannel::m_temporary
protected
LSC::Type LSCChannel::m_type
protected

Definition at line 146 of file LSCChannel.h.

Referenced by EncodeID(), GetType(), and GetTypeString().


The documentation for this class was generated from the following files: