mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-02 16:32:26 +00:00
- License was intended to be GPLv3 per earlier commit of GPLv3 LICENSE FILE - This is confirmed by the inclusion of libraries that are incompatible with GPLv2 - This is also confirmed by KLS and the agreement of KLS's predecessors - Added GPLv3 license headers to the compilable source files - Removed Folly licensing in strings.h since the string functions do not match the Folly functions and are standard functions - this must have been left over from previous implementations - Removed individual contributor license headers since the project has been under the "developer" mantle for many years - Removed comments on files that were previously automatically generated since they've been manually modified multiple times and there are no automatic scripts referencing them (removed in 2023)
121 lines
4.3 KiB
C++
121 lines
4.3 KiB
C++
/* EQEmu: EQEmulator
|
|
|
|
Copyright (C) 2001-2026 EQEmu Development Team
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#pragma once
|
|
|
|
#include "common/linked_list.h"
|
|
#include "common/timer.h"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class Client;
|
|
|
|
#define SYSTEM_OWNER std::string("*System*")
|
|
|
|
class ChatChannel {
|
|
|
|
public:
|
|
|
|
ChatChannel(const std::string& inName, const std::string& inOwner, const std::string& inPassword, bool inPermanent, int inMinimumStatus = 0);
|
|
~ChatChannel();
|
|
|
|
void AddClient(Client *c);
|
|
bool RemoveClient(Client *c);
|
|
bool IsClientInChannel(Client *c);
|
|
|
|
int MemberCount(int Status);
|
|
const std::string &GetName() { return m_name; }
|
|
void SendMessageToChannel(const std::string& Message, Client* Sender);
|
|
bool CheckPassword(const std::string& in_password) { return m_password.empty() || m_password == in_password; }
|
|
void SetPassword(const std::string& in_password);
|
|
bool IsOwner(const std::string& name) { return (m_owner == name); }
|
|
const std::string& GetPassword() { return m_password; }
|
|
void SetOwner(const std::string& in_owner);
|
|
std::string& GetOwnerName();
|
|
void SetTemporary();
|
|
void SetPermanent();
|
|
void SendChannelMembers(Client *c);
|
|
int GetMinStatus() { return m_minimum_status; }
|
|
bool ReadyToDelete() { return m_delete_timer.Check(); }
|
|
void SendOPList(Client *c);
|
|
void AddInvitee(const std::string &Invitee);
|
|
void RemoveInvitee(std::string Invitee);
|
|
bool IsInvitee(std::string Invitee);
|
|
void AddModerator(const std::string &Moderator);
|
|
void RemoveModerator(const std::string &Moderator);
|
|
bool IsModerator(std::string Moderator);
|
|
void AddVoice(const std::string &Voiced);
|
|
void RemoveVoice(const std::string &Voiced);
|
|
bool HasVoice(std::string Voiced);
|
|
inline bool IsModerated() { return m_moderated; }
|
|
void SetModerated(bool inModerated);
|
|
|
|
friend class ChatChannelList;
|
|
|
|
private:
|
|
|
|
std::string m_name;
|
|
std::string m_owner;
|
|
std::string m_password;
|
|
|
|
bool m_permanent;
|
|
bool m_moderated;
|
|
|
|
int m_minimum_status;
|
|
|
|
Timer m_delete_timer;
|
|
|
|
LinkedList<Client*> m_clients_in_channel;
|
|
|
|
std::vector<std::string> m_moderators;
|
|
std::vector<std::string> m_invitees;
|
|
std::vector<std::string> m_voiced;
|
|
|
|
};
|
|
|
|
class ChatChannelList {
|
|
|
|
public:
|
|
ChatChannel* CreateChannel(const std::string& name, const std::string& owner, const std::string& password, bool permanent, int minimum_status, bool save_to_database = false);
|
|
ChatChannel* FindChannel(const std::string& name);
|
|
ChatChannel* AddClientToChannel(std::string channel_name, Client* c, bool command_directed = false);
|
|
ChatChannel* RemoveClientFromChannel(const std::string& in_channel_name, Client* c, bool command_directed = false);
|
|
void RemoveChannel(ChatChannel *Channel);
|
|
void RemoveAllChannels();
|
|
void SendAllChannels(Client *c);
|
|
void Process();
|
|
static inline std::vector<std::string> GetBlockedChannelNames() { return m_blocked_channel_names; }
|
|
static inline std::vector<std::string> GetFilteredNames() { return m_filtered_names; }
|
|
static inline void ClearChannelBlockList() { m_blocked_channel_names.clear(); };
|
|
static inline void ClearFilteredNameList() { m_filtered_names.clear(); };
|
|
static void AddToChannelBlockList(const std::string& channel_name);
|
|
static void AddToFilteredNames(const std::string& name);
|
|
static bool IsOnChannelBlockList(const std::string& channel_name);
|
|
static bool IsOnFilteredNameList(const std::string& channel_name);
|
|
static inline void SetChannelBlockList(const std::vector<std::string>& new_list) { m_blocked_channel_names = new_list; }
|
|
static inline void SetFilteredNameList(const std::vector<std::string>& new_list) { m_filtered_names = new_list; }
|
|
private:
|
|
|
|
LinkedList<ChatChannel*> ChatChannels;
|
|
static inline std::vector<std::string> m_blocked_channel_names;
|
|
static inline std::vector<std::string> m_filtered_names;
|
|
|
|
};
|
|
|
|
std::string CapitaliseName(const std::string& inString);
|