diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-07-14 16:04:38 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-07-14 16:04:38 +0200 |
commit | 173bc63cb59bbf19e73d1b823e3e9423c9f79860 (patch) | |
tree | 7af13bf029e8f5c7d2792de0e55c2b1168c549fb /src/modules | |
parent | 7045a0d4ce7b4f2752c5496851a6319ea04137b6 (diff) |
Change return type of Channel::GetUsers() to reference from pointer as it is never NULL
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_auditorium.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_channames.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_check.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_clearchan.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_deaf.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_delayjoin.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_delaymsg.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_hostcycle.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_ircv3.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_repeat.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_silence.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_sslmodes.cpp | 4 |
15 files changed, 41 insertions, 42 deletions
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 60bdd2582..40226d002 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -103,8 +103,8 @@ class ModuleAuditorium : public Module if (IsVisible(memb)) return; - const UserMembList* users = memb->chan->GetUsers(); - for(UserMembCIter i = users->begin(); i != users->end(); i++) + const UserMembList& users = memb->chan->GetUsers(); + for (UserMembCIter i = users.begin(); i != users.end(); ++i) { if (IS_LOCAL(i->first) && !CanSee(i->first, memb)) excepts.insert(i->first); @@ -140,8 +140,8 @@ 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(); - for(UserMembCIter j = users->begin(); j != users->end(); j++) + const UserMembList& users = memb->chan->GetUsers(); + for(UserMembCIter j = users.begin(); j != users.end(); ++j) { if (IS_LOCAL(j->first) && CanSee(j->first, memb)) exception[j->first] = true; diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index 3a27cab73..1eb080ada 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -132,8 +132,8 @@ class ModuleChannelNames : public Module { if (badchan) { - const UserMembList* users = memb->chan->GetUsers(); - for(UserMembCIter i = users->begin(); i != users->end(); i++) + const UserMembList& 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 35901f8d5..a2c0b2e2c 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -224,10 +224,10 @@ class CommandCheck : public Command /* now the ugly bit, spool current members of a channel. :| */ - const UserMembList *ulist= targchan->GetUsers(); + const UserMembList& 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++) + for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i) { /* * Unlike Asuka, I define a clone as coming from the same host. --w00t diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp index d7dceaf95..69ae00800 100644 --- a/src/modules/m_clearchan.cpp +++ b/src/modules/m_clearchan.cpp @@ -170,8 +170,8 @@ class ModuleClearChan : public Module } } - const UserMembList* users = cmd.activechan->GetUsers(); - for (UserMembCIter i = users->begin(); i != users->end(); ++i) + const UserMembList& users = cmd.activechan->GetUsers(); + for (UserMembCIter i = users.begin(); i != users.end(); ++i) { LocalUser* curr = IS_LOCAL(i->first); if (!curr) @@ -200,8 +200,8 @@ class ModuleClearChan : public Module { // Hide the KICK from all non-opers User* leaving = memb->user; - const UserMembList* users = memb->chan->GetUsers(); - for (UserMembCIter i = users->begin(); i != users->end(); ++i) + const UserMembList& users = memb->chan->GetUsers(); + for (UserMembCIter i = users.begin(); i != users.end(); ++i) { User* curr = i->first; if ((IS_LOCAL(curr)) && (!curr->IsOper()) && (curr != leaving)) diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index 9800b32a9..5c4f7b2b6 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -66,7 +66,6 @@ class ModuleDeaf : public Module return MOD_RES_PASSTHRU; Channel* chan = static_cast<Channel*>(dest); - const UserMembList *ulist = chan->GetUsers(); bool is_bypasschar = (deaf_bypasschars.find(text[0]) != std::string::npos); bool is_bypasschar_uline = (deaf_bypasschars_uline.find(text[0]) != std::string::npos); @@ -77,7 +76,8 @@ class ModuleDeaf : public Module if (!deaf_bypasschars_uline.empty() && is_bypasschar) return MOD_RES_PASSTHRU; - for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++) + const UserMembList& ulist = chan->GetUsers(); + for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i) { /* not +d ? */ if (!i->first->IsModeSet(m1)) diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 0a883265f..f830daf4b 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -66,8 +66,8 @@ 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* names = channel->GetUsers(); - for (UserMembCIter n = names->begin(); n != names->end(); ++n) + const UserMembList& users = channel->GetUsers(); + for (UserMembCIter n = users.begin(); n != users.end(); ++n) creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty); } channel->SetMode(this, adding); @@ -94,8 +94,8 @@ ModResult ModuleDelayJoin::OnNamesListItem(User* issuer, Membership* memb, std:: static void populate(CUList& except, Membership* memb) { - const UserMembList* users = memb->chan->GetUsers(); - for(UserMembCIter i = users->begin(); i != users->end(); i++) + const UserMembList& users = memb->chan->GetUsers(); + for (UserMembCIter i = users.begin(); i != users.end(); ++i) { if (i->first == memb->user || !IS_LOCAL(i->first)) continue; diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index 1730663c5..3384e1107 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -73,8 +73,8 @@ void DelayMsgMode::OnUnset(User* source, Channel* chan) /* * Clean up metadata */ - const UserMembList* names = chan->GetUsers(); - for (UserMembCIter n = names->begin(); n != names->end(); ++n) + const UserMembList& 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 d3646e899..87f05a9ee 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 UserMembList& ulist = c->GetUsers(); + for (UserMembList::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 008c3f2cd..b160159fb 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -155,16 +155,16 @@ class ModuleHttpStats : public Module Channel* c = i->second; data << "<channel>"; - data << "<usercount>" << c->GetUsers()->size() << "</usercount><channelname>" << Sanitize(c->name) << "</channelname>"; + data << "<usercount>" << c->GetUsers().size() << "</usercount><channelname>" << Sanitize(c->name) << "</channelname>"; data << "<channeltopic>"; data << "<topictext>" << Sanitize(c->topic) << "</topictext>"; data << "<setby>" << Sanitize(c->setby) << "</setby>"; data << "<settime>" << c->topicset << "</settime>"; data << "</channeltopic>"; data << "<channelmodes>" << Sanitize(c->ChanModes(true)) << "</channelmodes>"; - const UserMembList* ulist = c->GetUsers(); - for (UserMembCIter x = ulist->begin(); x != ulist->end(); ++x) + const UserMembList& ulist = c->GetUsers(); + for (UserMembCIter x = ulist.begin(); x != ulist.end(); ++x) { Membership* memb = x->second; data << "<channelmember><uid>" << memb->user->uuid << "</uid><privs>" diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp index 5cb2ab6b1..17572423d 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 UserMembList& userlist = (*i)->chan->GetUsers(); + for (UserMembList::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,8 +134,8 @@ class ModuleIRCv3 : public Module std::string line; std::string mode; - const UserMembList* userlist = memb->chan->GetUsers(); - for (UserMembCIter it = userlist->begin(); it != userlist->end(); ++it) + const UserMembList& 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 User* member = IS_LOCAL(it->first); @@ -208,8 +208,8 @@ class ModuleIRCv3 : public Module std::string line = ":" + memb->user->GetFullHost() + " AWAY :" + memb->user->awaymsg; - const UserMembList* userlist = memb->chan->GetUsers(); - for (UserMembCIter it = userlist->begin(); it != userlist->end(); ++it) + const UserMembList& 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 User* member = IS_LOCAL(it->first); diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index d8fccbffc..6ad3a6aa7 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -129,8 +129,8 @@ 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(); - for (UserMembCIter i = users->begin(); i != users->end(); ++i) + const UserMembList& 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 5e157420e..6ba748d2f 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -315,9 +315,9 @@ class ModuleSilence : public Module void OnBuildExemptList(MessageType message_type, Channel* chan, User* sender, char status, CUList &exempt_list, const std::string &text) { int public_silence = (message_type == MSG_PRIVMSG ? SILENCE_CHANNEL : SILENCE_CNOTICE); - const UserMembList *ulist = chan->GetUsers(); - for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++) + const UserMembList& 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 f96e47d60..f583a9d8f 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -167,9 +167,9 @@ void TreeSocket::SendServers(TreeServer* Current, TreeServer* s) void TreeSocket::SendFJoins(Channel* c) { CommandFJoin::Builder fjoin(c); - const UserMembList *ulist = c->GetUsers(); - for (UserMembCIter i = ulist->begin(); i != ulist->end(); ++i) + const UserMembList& ulist = c->GetUsers(); + for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i) { Membership* memb = i->second; if (!fjoin.has_room(memb)) diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index d6dccba14..254b50dcc 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -166,9 +166,8 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet minrank = mh->GetPrefixRank(); } - const UserMembList *ulist = c->GetUsers(); - - for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++) + const UserMembList& ulist = c->GetUsers(); + for (UserMembCIter i = ulist.begin(); i != ulist.end(); ++i) { if (IS_LOCAL(i->first)) continue; diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 6ac07434f..5f3fc9215 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -48,8 +48,8 @@ class SSLMode : public ModeHandler if (!API) return MODEACTION_DENY; - const UserMembList* userlist = channel->GetUsers(); - for(UserMembCIter i = userlist->begin(); i != userlist->end(); i++) + const UserMembList& userlist = channel->GetUsers(); + for (UserMembCIter i = userlist.begin(); i != userlist.end(); ++i) { ssl_cert* cert = API->GetCertificate(i->first); if (!cert && !i->first->server->IsULine()) |