summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-07-14 16:10:12 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-07-14 16:10:12 +0200
commit04ece67c3d8534f74a3d75ec77378cb57a9c044e (patch)
tree41db09412bfd539c977500c93b5ddc2d210be344
parent173bc63cb59bbf19e73d1b823e3e9423c9f79860 (diff)
Rename UserMembList to Channel::MemberMap, switch all code to use it
-rw-r--r--include/channels.h10
-rw-r--r--src/coremods/core_who.cpp2
-rw-r--r--src/mode.cpp2
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_auditorium.cpp4
-rw-r--r--src/modules/m_channames.cpp4
-rw-r--r--src/modules/m_check.cpp2
-rw-r--r--src/modules/m_clearchan.cpp6
-rw-r--r--src/modules/m_deaf.cpp2
-rw-r--r--src/modules/m_delayjoin.cpp4
-rw-r--r--src/modules/m_delaymsg.cpp2
-rw-r--r--src/modules/m_hostcycle.cpp4
-rw-r--r--src/modules/m_httpd_stats.cpp2
-rw-r--r--src/modules/m_ircv3.cpp8
-rw-r--r--src/modules/m_repeat.cpp2
-rw-r--r--src/modules/m_silence.cpp2
-rw-r--r--src/modules/m_spanningtree/netburst.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp2
-rw-r--r--src/modules/m_sslmodes.cpp2
-rw-r--r--src/users.cpp8
20 files changed, 39 insertions, 33 deletions
diff --git a/include/channels.h b/include/channels.h
index 37f0eb431..95c516a05 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -36,6 +36,12 @@
*/
class CoreExport Channel : public Extensible, public InviteBase<Channel>
{
+ public:
+ /** A map of Memberships on a channel keyed by User pointers
+ */
+ typedef std::map<User*, Membership*> MemberMap;
+
+ private:
/** Set default modes for the channel on creation
*/
void SetDefaultModes();
@@ -84,7 +90,7 @@ class CoreExport Channel : public Extensible, public InviteBase<Channel>
/** User list.
*/
- UserMembList userlist;
+ MemberMap userlist;
/** Channel topic.
* If this is an empty string, no channel topic is set.
@@ -166,7 +172,7 @@ class CoreExport Channel : public Extensible, public InviteBase<Channel>
*
* @return This function returns pointer to a map of User pointers (CUList*).
*/
- const UserMembList& GetUsers() const { return userlist; }
+ const MemberMap& GetUsers() const { return userlist; }
/** Returns true if the user given is on the given channel.
* @param user The user to look for
diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp
index d39c07520..6014401d8 100644
--- a/src/coremods/core_who.cpp
+++ b/src/coremods/core_who.cpp
@@ -325,7 +325,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
bool inside = ch->HasUser(user);
/* who on a channel. */
- const UserMembList& cu = ch->GetUsers();
+ const Channel::MemberMap& cu = ch->GetUsers();
for (UserMembCIter i = cu.begin(); i != cu.end(); ++i)
{
/* None of this applies if we WHO ourselves */
diff --git a/src/mode.cpp b/src/mode.cpp
index 52d7d4fb5..daf7c5021 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -915,7 +915,7 @@ void ModeHandler::RemoveMode(Channel* channel, irc::modestacker& stack)
void PrefixMode::RemoveMode(Channel* chan, irc::modestacker& stack)
{
- const UserMembList& userlist = chan->GetUsers();
+ const Channel::MemberMap& userlist = chan->GetUsers();
for (UserMembCIter i = userlist.begin(); i != userlist.end(); ++i)
{
if (i->second->hasMode(this->GetModeChar()))
diff --git a/src/modules.cpp b/src/modules.cpp
index 62bdedcfd..f29ab6bbb 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -391,7 +391,7 @@ void ModuleManager::DoSafeUnload(Module* mod)
++c;
mod->OnCleanup(TYPE_CHANNEL, chan);
chan->doUnhookExtensions(items);
- const UserMembList& users = chan->GetUsers();
+ const Channel::MemberMap& users = chan->GetUsers();
for (UserMembCIter mi = users.begin(); mi != users.end(); ++mi)
mi->second->doUnhookExtensions(items);
}
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index 40226d002..70f17e908 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -103,7 +103,7 @@ class ModuleAuditorium : public Module
if (IsVisible(memb))
return;
- const UserMembList& users = memb->chan->GetUsers();
+ const Channel::MemberMap& users = memb->chan->GetUsers();
for (UserMembCIter i = users.begin(); i != users.end(); ++i)
{
if (IS_LOCAL(i->first) && !CanSee(i->first, memb))
@@ -140,7 +140,7 @@ class ModuleAuditorium : public Module
// this channel should not be considered when listing my neighbors
i = include.erase(i);
// however, that might hide me from ops that can see me...
- const UserMembList& users = memb->chan->GetUsers();
+ const Channel::MemberMap& users = memb->chan->GetUsers();
for(UserMembCIter j = users.begin(); j != users.end(); ++j)
{
if (IS_LOCAL(j->first) && CanSee(j->first, memb))
diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp
index 1eb080ada..b4266e63b 100644
--- a/src/modules/m_channames.cpp
+++ b/src/modules/m_channames.cpp
@@ -82,7 +82,7 @@ class ModuleChannelNames : public Module
ServerInstance->Modes->Process(modes, ServerInstance->FakeClient);
}
- UserMembList& users = c->userlist;
+ Channel::MemberMap& users = c->userlist;
for (UserMembIter j = users.begin(); j != users.end(); )
{
if (IS_LOCAL(j->first))
@@ -132,7 +132,7 @@ class ModuleChannelNames : public Module
{
if (badchan)
{
- const UserMembList& users = memb->chan->GetUsers();
+ const Channel::MemberMap& users = memb->chan->GetUsers();
for (UserMembCIter i = users.begin(); i != users.end(); ++i)
if (i->first != memb->user)
except_list.insert(i->first);
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index a2c0b2e2c..ce576baf1 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -224,7 +224,7 @@ class CommandCheck : public Command
/* now the ugly bit, spool current members of a channel. :| */
- const UserMembList& ulist = targchan->GetUsers();
+ const Channel::MemberMap& ulist = targchan->GetUsers();
/* note that unlike /names, we do NOT check +i vs in the channel */
for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i)
diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp
index 69ae00800..e23cd66c2 100644
--- a/src/modules/m_clearchan.cpp
+++ b/src/modules/m_clearchan.cpp
@@ -93,7 +93,7 @@ class CommandClearChan : public Command
std::string mask;
// Now remove all local non-opers from the channel
- UserMembList& users = chan->userlist;
+ Channel::MemberMap& users = chan->userlist;
for (UserMembIter i = users.begin(); i != users.end(); )
{
User* curr = i->first;
@@ -170,7 +170,7 @@ class ModuleClearChan : public Module
}
}
- const UserMembList& users = cmd.activechan->GetUsers();
+ const Channel::MemberMap& users = cmd.activechan->GetUsers();
for (UserMembCIter i = users.begin(); i != users.end(); ++i)
{
LocalUser* curr = IS_LOCAL(i->first);
@@ -200,7 +200,7 @@ class ModuleClearChan : public Module
{
// Hide the KICK from all non-opers
User* leaving = memb->user;
- const UserMembList& users = memb->chan->GetUsers();
+ const Channel::MemberMap& users = memb->chan->GetUsers();
for (UserMembCIter i = users.begin(); i != users.end(); ++i)
{
User* curr = i->first;
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index 5c4f7b2b6..aaca6c049 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -76,7 +76,7 @@ class ModuleDeaf : public Module
if (!deaf_bypasschars_uline.empty() && is_bypasschar)
return MOD_RES_PASSTHRU;
- const UserMembList& ulist = chan->GetUsers();
+ const Channel::MemberMap& ulist = chan->GetUsers();
for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i)
{
/* not +d ? */
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index f830daf4b..d9884297f 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -66,7 +66,7 @@ ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channe
* Make all users visible, as +D is being removed. If we don't do this,
* they remain permanently invisible on this channel!
*/
- const UserMembList& users = channel->GetUsers();
+ const Channel::MemberMap& users = channel->GetUsers();
for (UserMembCIter n = users.begin(); n != users.end(); ++n)
creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty);
}
@@ -94,7 +94,7 @@ ModResult ModuleDelayJoin::OnNamesListItem(User* issuer, Membership* memb, std::
static void populate(CUList& except, Membership* memb)
{
- const UserMembList& users = memb->chan->GetUsers();
+ const Channel::MemberMap& users = memb->chan->GetUsers();
for (UserMembCIter i = users.begin(); i != users.end(); ++i)
{
if (i->first == memb->user || !IS_LOCAL(i->first))
diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp
index 3384e1107..e782b807a 100644
--- a/src/modules/m_delaymsg.cpp
+++ b/src/modules/m_delaymsg.cpp
@@ -73,7 +73,7 @@ void DelayMsgMode::OnUnset(User* source, Channel* chan)
/*
* Clean up metadata
*/
- const UserMembList& users = chan->GetUsers();
+ const Channel::MemberMap& users = chan->GetUsers();
for (UserMembCIter n = users.begin(); n != users.end(); ++n)
jointime.set(n->second, 0);
}
diff --git a/src/modules/m_hostcycle.cpp b/src/modules/m_hostcycle.cpp
index 87f05a9ee..e8a0abbf1 100644
--- a/src/modules/m_hostcycle.cpp
+++ b/src/modules/m_hostcycle.cpp
@@ -72,8 +72,8 @@ class ModuleHostCycle : public Module
modeline.append(" ").append(user->nick);
}
- const UserMembList& ulist = c->GetUsers();
- for (UserMembList::const_iterator j = ulist.begin(); j != ulist.end(); ++j)
+ const Channel::MemberMap& ulist = c->GetUsers();
+ for (Channel::MemberMap::const_iterator j = ulist.begin(); j != ulist.end(); ++j)
{
LocalUser* u = IS_LOCAL(j->first);
if (u == NULL || u == user)
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index b160159fb..acf5c66a7 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -163,7 +163,7 @@ class ModuleHttpStats : public Module
data << "</channeltopic>";
data << "<channelmodes>" << Sanitize(c->ChanModes(true)) << "</channelmodes>";
- const UserMembList& ulist = c->GetUsers();
+ const Channel::MemberMap& ulist = c->GetUsers();
for (UserMembCIter x = ulist.begin(); x != ulist.end(); ++x)
{
Membership* memb = x->second;
diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp
index 17572423d..65fb7ddb5 100644
--- a/src/modules/m_ircv3.cpp
+++ b/src/modules/m_ircv3.cpp
@@ -50,8 +50,8 @@ class ModuleIRCv3 : public Module
std::set<User*> already_sent;
for (IncludeChanList::const_iterator i = chans.begin(); i != chans.end(); ++i)
{
- const UserMembList& userlist = (*i)->chan->GetUsers();
- for (UserMembList::const_iterator m = userlist.begin(); m != userlist.end(); ++m)
+ const Channel::MemberMap& userlist = (*i)->chan->GetUsers();
+ for (Channel::MemberMap::const_iterator m = userlist.begin(); m != userlist.end(); ++m)
{
/*
* Send the line if the channel member in question meets all of the following criteria:
@@ -134,7 +134,7 @@ class ModuleIRCv3 : public Module
std::string line;
std::string mode;
- const UserMembList& userlist = memb->chan->GetUsers();
+ const Channel::MemberMap& userlist = memb->chan->GetUsers();
for (UserMembCIter it = userlist.begin(); it != userlist.end(); ++it)
{
// Send the extended join line if the current member is local, has the extended-join cap and isn't excepted
@@ -208,7 +208,7 @@ class ModuleIRCv3 : public Module
std::string line = ":" + memb->user->GetFullHost() + " AWAY :" + memb->user->awaymsg;
- const UserMembList& userlist = memb->chan->GetUsers();
+ const Channel::MemberMap& userlist = memb->chan->GetUsers();
for (UserMembCIter it = userlist.begin(); it != userlist.end(); ++it)
{
// Send the away notify line if the current member is local, has the away-notify cap and isn't excepted
diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp
index 6ad3a6aa7..d55a141da 100644
--- a/src/modules/m_repeat.cpp
+++ b/src/modules/m_repeat.cpp
@@ -129,7 +129,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
void OnUnset(User* source, Channel* chan)
{
// Unset the per-membership extension when the mode is removed
- const UserMembList& users = chan->GetUsers();
+ const Channel::MemberMap& users = chan->GetUsers();
for (UserMembCIter i = users.begin(); i != users.end(); ++i)
MemberInfoExt.unset(i->second);
}
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 6ba748d2f..7fd46d632 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -316,7 +316,7 @@ class ModuleSilence : public Module
{
int public_silence = (message_type == MSG_PRIVMSG ? SILENCE_CHANNEL : SILENCE_CNOTICE);
- const UserMembList& ulist = chan->GetUsers();
+ const Channel::MemberMap& ulist = chan->GetUsers();
for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i)
{
if (IS_LOCAL(i->first))
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index f583a9d8f..3eaaaf720 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -168,7 +168,7 @@ void TreeSocket::SendFJoins(Channel* c)
{
CommandFJoin::Builder fjoin(c);
- const UserMembList& ulist = c->GetUsers();
+ const Channel::MemberMap& ulist = c->GetUsers();
for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i)
{
Membership* memb = i->second;
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 254b50dcc..1fa150741 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -166,7 +166,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet
minrank = mh->GetPrefixRank();
}
- const UserMembList& ulist = c->GetUsers();
+ const Channel::MemberMap& ulist = c->GetUsers();
for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i)
{
if (IS_LOCAL(i->first))
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index 5f3fc9215..af79ecab4 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -48,7 +48,7 @@ class SSLMode : public ModeHandler
if (!API)
return MODEACTION_DENY;
- const UserMembList& userlist = channel->GetUsers();
+ const Channel::MemberMap& userlist = channel->GetUsers();
for (UserMembCIter i = userlist.begin(); i != userlist.end(); ++i)
{
ssl_cert* cert = API->GetCertificate(i->first);
diff --git a/src/users.cpp b/src/users.cpp
index 039fdce57..8dbacde64 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -891,8 +891,8 @@ void User::WriteCommonRaw(const std::string &line, bool include_self)
for (IncludeChanList::const_iterator v = include_c.begin(); v != include_c.end(); ++v)
{
Channel* c = (*v)->chan;
- const UserMembList& ulist = c->GetUsers();
- for (UserMembList::const_iterator i = ulist.begin(); i != ulist.end(); ++i)
+ const Channel::MemberMap& ulist = c->GetUsers();
+ for (Channel::MemberMap::const_iterator i = ulist.begin(); i != ulist.end(); ++i)
{
LocalUser* u = IS_LOCAL(i->first);
if (u && u->already_sent != LocalUser::already_sent_id)
@@ -931,8 +931,8 @@ void User::WriteCommonQuit(const std::string &normal_text, const std::string &op
}
for (IncludeChanList::const_iterator v = include_c.begin(); v != include_c.end(); ++v)
{
- const UserMembList& ulist = (*v)->chan->GetUsers();
- for (UserMembList::const_iterator i = ulist.begin(); i != ulist.end(); i++)
+ const Channel::MemberMap& ulist = (*v)->chan->GetUsers();
+ for (Channel::MemberMap::const_iterator i = ulist.begin(); i != ulist.end(); i++)
{
LocalUser* u = IS_LOCAL(i->first);
if (u && (u->already_sent != uniq_id))