summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-07-14 16:19:34 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-07-14 16:19:34 +0200
commit63601e946e77f11835cf9cbb87c55fe41e0b12bb (patch)
treea4bd98d877d85b45697389af5ace84a301be8399
parentfb8cb2114483689c5a52f951e301c31bdd2a60a2 (diff)
Remove typedef UserMembIter, use Channel::MemberMap::iterator instead
Remove the now unused UserMembList typedef too
-rw-r--r--include/channels.h8
-rw-r--r--include/typedefs.h5
-rw-r--r--src/channels.cpp20
-rw-r--r--src/coremods/core_channel/cmd_kick.cpp2
-rw-r--r--src/modules/m_channames.cpp4
-rw-r--r--src/modules/m_clearchan.cpp4
6 files changed, 19 insertions, 24 deletions
diff --git a/include/channels.h b/include/channels.h
index 95c516a05..eeb2501fa 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -57,9 +57,9 @@ class CoreExport Channel : public Extensible, public InviteBase<Channel>
* This function does not remove the channel from User::chanlist.
* Since the parameter is an iterator to the target, the complexity
* of this function is constant.
- * @param membiter The UserMembIter to remove, must be valid
+ * @param membiter The MemberMap iterator to remove, must be valid
*/
- void DelUser(const UserMembIter& membiter);
+ void DelUser(const MemberMap::iterator& membiter);
public:
/** Creates a channel record and initialises it with default values
@@ -187,7 +187,7 @@ class CoreExport Channel : public Extensible, public InviteBase<Channel>
* @param victimiter Iterator to the user being kicked, must be valid
* @param reason The reason for the kick
*/
- void KickUser(User* src, const UserMembIter& victimiter, const std::string& reason);
+ void KickUser(User* src, const MemberMap::iterator& victimiter, const std::string& reason);
/** Make src kick user from this channel with the given reason.
* @param src The source of the kick
@@ -196,7 +196,7 @@ class CoreExport Channel : public Extensible, public InviteBase<Channel>
*/
void KickUser(User* src, User* user, const std::string& reason)
{
- UserMembIter it = userlist.find(user);
+ MemberMap::iterator it = userlist.find(user);
if (it != userlist.end())
KickUser(src, it, reason);
}
diff --git a/include/typedefs.h b/include/typedefs.h
index a99f44fa2..640c70cab 100644
--- a/include/typedefs.h
+++ b/include/typedefs.h
@@ -100,11 +100,6 @@ typedef std::map<std::string, reference<OperInfo> > OperIndex;
/** Files read by the configuration */
typedef std::map<std::string, file_cache> ConfigFileCache;
-/** Membership list of a channel */
-typedef std::map<User*, Membership*> UserMembList;
-/** Iterator of UserMembList */
-typedef UserMembList::iterator UserMembIter;
-
/** Generic user list, used for exceptions */
typedef std::set<User*> CUList;
diff --git a/src/channels.cpp b/src/channels.cpp
index f49d359cd..13595c4c3 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -71,7 +71,7 @@ Membership* Channel::AddUser(User* user)
void Channel::DelUser(User* user)
{
- UserMembIter it = userlist.find(user);
+ MemberMap::iterator it = userlist.find(user);
if (it != userlist.end())
DelUser(it);
}
@@ -98,7 +98,7 @@ void Channel::CheckDestroy()
ServerInstance->GlobalCulls.AddItem(this);
}
-void Channel::DelUser(const UserMembIter& membiter)
+void Channel::DelUser(const MemberMap::iterator& membiter)
{
Membership* memb = membiter->second;
memb->cull();
@@ -111,7 +111,7 @@ void Channel::DelUser(const UserMembIter& membiter)
Membership* Channel::GetUser(User* user)
{
- UserMembIter i = userlist.find(user);
+ MemberMap::iterator i = userlist.find(user);
if (i == userlist.end())
return NULL;
return i->second;
@@ -426,7 +426,7 @@ ModResult Channel::GetExtBanStatus(User *user, char type)
*/
void Channel::PartUser(User *user, std::string &reason)
{
- UserMembIter membiter = userlist.find(user);
+ MemberMap::iterator membiter = userlist.find(user);
if (membiter != userlist.end())
{
@@ -443,7 +443,7 @@ void Channel::PartUser(User *user, std::string &reason)
}
}
-void Channel::KickUser(User* src, const UserMembIter& victimiter, const std::string& reason)
+void Channel::KickUser(User* src, const MemberMap::iterator& victimiter, const std::string& reason)
{
Membership* memb = victimiter->second;
CUList except_list;
@@ -467,7 +467,7 @@ void Channel::WriteChannel(User* user, const std::string &text)
{
const std::string message = ":" + user->GetFullHost() + " " + text;
- for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
+ for (MemberMap::iterator i = userlist.begin(); i != userlist.end(); i++)
{
if (IS_LOCAL(i->first))
i->first->Write(message);
@@ -485,7 +485,7 @@ void Channel::WriteChannelWithServ(const std::string& ServName, const std::strin
{
const std::string message = ":" + (ServName.empty() ? ServerInstance->Config->ServerName : ServName) + " " + text;
- for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
+ for (MemberMap::iterator i = userlist.begin(); i != userlist.end(); i++)
{
if (IS_LOCAL(i->first))
i->first->Write(message);
@@ -524,7 +524,7 @@ void Channel::RawWriteAllExcept(User* user, bool serversource, char status, CULi
if (mh)
minrank = mh->GetPrefixRank();
}
- for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
+ for (MemberMap::iterator i = userlist.begin(); i != userlist.end(); i++)
{
if (IS_LOCAL(i->first) && (except_list.find(i->first) == except_list.end()))
{
@@ -594,7 +594,7 @@ void Channel::UserList(User* user, bool has_user)
const size_t maxlen = ServerInstance->Config->Limits.MaxLine - 10 - ServerInstance->Config->ServerName.size();
std::string prefixlist;
std::string nick;
- for (UserMembIter i = userlist.begin(); i != userlist.end(); ++i)
+ for (MemberMap::iterator i = userlist.begin(); i != userlist.end(); ++i)
{
if ((!has_user) && (i->first->IsModeSet(invisiblemode)) && (!has_privs))
{
@@ -691,7 +691,7 @@ const char* Membership::GetAllPrefixChars() const
unsigned int Channel::GetPrefixValue(User* user)
{
- UserMembIter m = userlist.find(user);
+ MemberMap::iterator m = userlist.find(user);
if (m == userlist.end())
return 0;
return m->second->getRank();
diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp
index 051cc2678..e2fdd7877 100644
--- a/src/coremods/core_channel/cmd_kick.cpp
+++ b/src/coremods/core_channel/cmd_kick.cpp
@@ -65,7 +65,7 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User
}
}
- const UserMembIter victimiter = c->userlist.find(u);
+ const Channel::MemberMap::iterator victimiter = c->userlist.find(u);
if (victimiter == c->userlist.end())
{
user->WriteNumeric(ERR_USERNOTINCHANNEL, "%s %s :They are not on that channel", u->nick.c_str(), c->name.c_str());
diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp
index 1483d8cd7..1fb5b2a40 100644
--- a/src/modules/m_channames.cpp
+++ b/src/modules/m_channames.cpp
@@ -83,12 +83,12 @@ class ModuleChannelNames : public Module
ServerInstance->Modes->Process(modes, ServerInstance->FakeClient);
}
Channel::MemberMap& users = c->userlist;
- for (UserMembIter j = users.begin(); j != users.end(); )
+ for (Channel::MemberMap::iterator j = users.begin(); j != users.end(); )
{
if (IS_LOCAL(j->first))
{
// KickUser invalidates the iterator
- UserMembIter it = j++;
+ Channel::MemberMap::iterator it = j++;
c->KickUser(ServerInstance->FakeClient, it, "Channel name no longer valid");
}
else
diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp
index 6238b7fdf..5fcec36f1 100644
--- a/src/modules/m_clearchan.cpp
+++ b/src/modules/m_clearchan.cpp
@@ -94,10 +94,10 @@ class CommandClearChan : public Command
std::string mask;
// Now remove all local non-opers from the channel
Channel::MemberMap& users = chan->userlist;
- for (UserMembIter i = users.begin(); i != users.end(); )
+ for (Channel::MemberMap::iterator i = users.begin(); i != users.end(); )
{
User* curr = i->first;
- const UserMembIter currit = i;
+ const Channel::MemberMap::iterator currit = i;
++i;
if (!IS_LOCAL(curr) || curr->IsOper())