mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +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) {
|
void ChatChannel::AddInvitee(const std::string &Invitee)
|
||||||
|
{
|
||||||
if(!IsInvitee(Invitee)) {
|
if (!IsInvitee(Invitee)) {
|
||||||
|
|
||||||
Invitees.push_back(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());
|
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;
|
if(it != std::end(Invitees)) {
|
||||||
|
Invitees.erase(it);
|
||||||
for(Iterator = Invitees.begin(); Iterator != Invitees.end(); ++Iterator) {
|
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatChannel::IsInvitee(std::string Invitee) {
|
bool ChatChannel::IsInvitee(std::string Invitee)
|
||||||
|
{
|
||||||
std::list<std::string>::iterator Iterator;
|
return std::find(std::begin(Invitees), std::end(Invitees), Invitee) != std::end(Invitees);
|
||||||
|
|
||||||
for(Iterator = Invitees.begin(); Iterator != Invitees.end(); ++Iterator) {
|
|
||||||
|
|
||||||
if((*Iterator) == Invitee)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatChannel::AddModerator(const std::string &Moderator)
|
void ChatChannel::AddModerator(const std::string &Moderator)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public:
|
|||||||
int GetMinStatus() { return MinimumStatus; }
|
int GetMinStatus() { return MinimumStatus; }
|
||||||
bool ReadyToDelete() { return DeleteTimer.Check(); }
|
bool ReadyToDelete() { return DeleteTimer.Check(); }
|
||||||
void SendOPList(Client *c);
|
void SendOPList(Client *c);
|
||||||
void AddInvitee(std::string Invitee);
|
void AddInvitee(const std::string &Invitee);
|
||||||
void RemoveInvitee(std::string Invitee);
|
void RemoveInvitee(std::string Invitee);
|
||||||
bool IsInvitee(std::string Invitee);
|
bool IsInvitee(std::string Invitee);
|
||||||
void AddModerator(const std::string &Moderator);
|
void AddModerator(const std::string &Moderator);
|
||||||
@ -62,7 +62,7 @@ private:
|
|||||||
LinkedList<Client*> ClientsInChannel;
|
LinkedList<Client*> ClientsInChannel;
|
||||||
|
|
||||||
std::vector<std::string> Moderators;
|
std::vector<std::string> Moderators;
|
||||||
std::list<std::string> Invitees;
|
std::vector<std::string> Invitees;
|
||||||
std::list<std::string> Voiced;
|
std::list<std::string> Voiced;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user