mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Refactor Clientlist::Voiced to std::vector
This commit is contained in:
parent
f185257415
commit
981d3e6b60
@ -615,45 +615,29 @@ bool ChatChannel::IsModerator(std::string Moderator)
|
||||
return std::find(std::begin(Moderators), std::end(Moderators), Moderator) != std::end(Moderators);
|
||||
}
|
||||
|
||||
void ChatChannel::AddVoice(std::string inVoiced) {
|
||||
|
||||
if(!HasVoice(inVoiced)) {
|
||||
|
||||
void ChatChannel::AddVoice(const std::string &inVoiced)
|
||||
{
|
||||
if (!HasVoice(inVoiced)) {
|
||||
Voiced.push_back(inVoiced);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::RemoveVoice(std::string inVoiced) {
|
||||
void ChatChannel::RemoveVoice(const std::string &inVoiced)
|
||||
{
|
||||
auto it = std::find(std::begin(Voiced), std::end(Voiced), inVoiced);
|
||||
|
||||
std::list<std::string>::iterator Iterator;
|
||||
if (it != std::end(Voiced)) {
|
||||
Voiced.erase(it);
|
||||
|
||||
for(Iterator = Voiced.begin(); Iterator != Voiced.end(); ++Iterator) {
|
||||
|
||||
if((*Iterator) == inVoiced) {
|
||||
|
||||
Voiced.erase(Iterator);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatChannel::HasVoice(std::string inVoiced) {
|
||||
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Voiced.begin(); Iterator != Voiced.end(); ++Iterator) {
|
||||
|
||||
if((*Iterator) == inVoiced)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
bool ChatChannel::HasVoice(std::string inVoiced)
|
||||
{
|
||||
return std::find(std::begin(Voiced), std::end(Voiced), inVoiced) != std::end(Voiced);
|
||||
}
|
||||
|
||||
std::string CapitaliseName(std::string inString) {
|
||||
|
||||
@ -38,8 +38,8 @@ public:
|
||||
void AddModerator(const std::string &Moderator);
|
||||
void RemoveModerator(const std::string &Moderator);
|
||||
bool IsModerator(std::string Moderator);
|
||||
void AddVoice(std::string Voiced);
|
||||
void RemoveVoice(std::string Voiced);
|
||||
void AddVoice(const std::string &Voiced);
|
||||
void RemoveVoice(const std::string &Voiced);
|
||||
bool HasVoice(std::string Voiced);
|
||||
inline bool IsModerated() { return Moderated; }
|
||||
void SetModerated(bool inModerated);
|
||||
@ -63,7 +63,7 @@ private:
|
||||
|
||||
std::vector<std::string> Moderators;
|
||||
std::vector<std::string> Invitees;
|
||||
std::list<std::string> Voiced;
|
||||
std::vector<std::string> Voiced;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user