mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Refactor ChatChannel::Invitees to std::vector
This commit is contained in:
parent
1a7a5aa8c8
commit
f185257415
@ -565,10 +565,9 @@ void ChatChannelList::Process() {
|
||||
}
|
||||
}
|
||||
|
||||
void ChatChannel::AddInvitee(std::string Invitee) {
|
||||
|
||||
if(!IsInvitee(Invitee)) {
|
||||
|
||||
void ChatChannel::AddInvitee(const std::string &Invitee)
|
||||
{
|
||||
if (!IsInvitee(Invitee)) {
|
||||
Invitees.push_back(Invitee);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||
@ -576,34 +575,19 @@ void ChatChannel::AddInvitee(std::string Invitee) {
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::RemoveInvitee(std::string Invitee) {
|
||||
void ChatChannel::RemoveInvitee(std::string Invitee)
|
||||
{
|
||||
auto it = std::find(std::begin(Invitees), std::end(Invitees), Invitee);
|
||||
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Invitees.begin(); Iterator != Invitees.end(); ++Iterator) {
|
||||
|
||||
if((*Iterator) == Invitee) {
|
||||
|
||||
Invitees.erase(Iterator);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
if(it != std::end(Invitees)) {
|
||||
Invitees.erase(it);
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatChannel::IsInvitee(std::string Invitee) {
|
||||
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Invitees.begin(); Iterator != Invitees.end(); ++Iterator) {
|
||||
|
||||
if((*Iterator) == Invitee)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
bool ChatChannel::IsInvitee(std::string Invitee)
|
||||
{
|
||||
return std::find(std::begin(Invitees), std::end(Invitees), Invitee) != std::end(Invitees);
|
||||
}
|
||||
|
||||
void ChatChannel::AddModerator(const std::string &Moderator)
|
||||
|
||||
@ -32,7 +32,7 @@ public:
|
||||
int GetMinStatus() { return MinimumStatus; }
|
||||
bool ReadyToDelete() { return DeleteTimer.Check(); }
|
||||
void SendOPList(Client *c);
|
||||
void AddInvitee(std::string Invitee);
|
||||
void AddInvitee(const std::string &Invitee);
|
||||
void RemoveInvitee(std::string Invitee);
|
||||
bool IsInvitee(std::string Invitee);
|
||||
void AddModerator(const std::string &Moderator);
|
||||
@ -62,7 +62,7 @@ private:
|
||||
LinkedList<Client*> ClientsInChannel;
|
||||
|
||||
std::vector<std::string> Moderators;
|
||||
std::list<std::string> Invitees;
|
||||
std::vector<std::string> Invitees;
|
||||
std::list<std::string> Voiced;
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user