summaryrefslogtreecommitdiff
path: root/src/messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/messages.cpp')
-rw-r--r--src/messages.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/messages.cpp b/src/messages.cpp
index f9dc81c85..dc11b99b4 100644
--- a/src/messages.cpp
+++ b/src/messages.cpp
@@ -1,6 +1,6 @@
/* Common message handlers
*
- * (C) 2003-2012 Anope Team
+ * (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -62,16 +62,15 @@ void Join::Run(MessageSource &source, const std::vector<Anope::string> &params)
/* Special case for /join 0 */
if (channel == "0")
{
- for (UChannelList::iterator it = user->chans.begin(), it_end = user->chans.end(); it != it_end; )
+ for (User::ChanUserList::iterator it = user->chans.begin(), it_end = user->chans.end(); it != it_end; )
{
- ChannelContainer *cc = *it++;
+ ChanUserContainer *cc = *it++;
Anope::string channame = cc->chan->name;
FOREACH_MOD(I_OnPrePartChannel, OnPrePartChannel(user, cc->chan));
cc->chan->DeleteUser(user);
FOREACH_MOD(I_OnPartChannel, OnPartChannel(user, Channel::Find(channame), channame, ""));
}
- user->chans.clear();
continue;
}
@@ -91,7 +90,7 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co
if (!c)
{
c = new Channel(chan, ts ? ts : Anope::CurTime);
- c->SetFlag(CH_SYNCING);
+ c->Extend("SYNCING");
}
/* Some IRCds do not include a TS */
else if (!ts)
@@ -108,7 +107,10 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co
/* Update the modes for the channel */
if (keep_their_modes && !modes.empty())
- c->SetModesInternal(source, modes);
+ /* If we are syncing, mlock is checked later in Channel::Sync. It is important to not check it here
+ * so that Channel::SetCorrectModes can correctly detect the presence of channel mode +r.
+ */
+ c->SetModesInternal(source, modes, ts, !c->HasExt("SYNCING"));
for (std::list<SJoinUser>::const_iterator it = users.begin(), it_end = users.end(); it != it_end; ++it)
{
@@ -119,10 +121,10 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co
FOREACH_RESULT(I_OnPreJoinChannel, OnPreJoinChannel(u, c));
/* Add the user to the channel */
- UserContainer *cc = c->JoinUser(u);
+ ChanUserContainer *cc = c->JoinUser(u);
/* Update their status internally on the channel */
- *cc->status = status;
+ cc->status = status;
/* Set whatever modes the user should have, and remove any that
* they aren't allowed to have (secureops etc).
@@ -140,9 +142,9 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co
}
/* Channel is done syncing */
- if (c->HasFlag(CH_SYNCING))
+ if (c->HasExt("SYNCING"))
{
- c->UnsetFlag(CH_SYNCING);
+ c->Shrink("SYNCING");
/* Sync the channel (mode lock, topic, etc) */
c->Sync();
}
@@ -190,8 +192,8 @@ void Kill::Run(MessageSource &source, const std::vector<Anope::string> &params)
IRCD->SendClientIntroduction(bi);
bi->introduced = true;
- for (UChannelList::const_iterator cit = bi->chans.begin(), cit_end = bi->chans.end(); cit != cit_end; ++cit)
- IRCD->SendJoin(bi, (*cit)->chan, (*cit)->status);
+ for (User::ChanUserList::const_iterator cit = bi->chans.begin(), cit_end = bi->chans.end(); cit != cit_end; ++cit)
+ IRCD->SendJoin(bi, (*cit)->chan, &(*cit)->status);
}
else
u->KillInternal(source.GetSource(), params[1]);
@@ -346,13 +348,13 @@ void Quit::Run(MessageSource &source, const std::vector<Anope::string> &params)
Log(user, "quit") << "quit (Reason: " << (!reason.empty() ? reason : "no reason") << ")";
NickAlias *na = NickAlias::Find(user->nick);
- if (na && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || user->IsIdentified(true)))
+ if (na && !na->nc->HasExt("SUSPENDED") && (user->IsRecognized() || user->IsIdentified(true)))
{
na->last_seen = Anope::CurTime;
na->last_quit = reason;
}
FOREACH_MOD(I_OnUserQuit, OnUserQuit(user, reason));
- delete user;
+ user->Quit(reason);
return;
}
@@ -381,7 +383,7 @@ void Stats::Run(MessageSource &source, const std::vector<Anope::string> &params)
switch (params[0][0])
{
case 'l':
- if (u->HasMode(UMODE_OPER))
+ if (u->HasMode("OPER"))
{
IRCD->SendNumeric(211, source.GetSource(), "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime");
IRCD->SendNumeric(211, source.GetSource(), "%s %d %d %d %d %d %d %ld", Config->Uplinks[Anope::CurrentUplink]->host.c_str(), UplinkSock->WriteBufferLen(), TotalWritten, -1, UplinkSock->ReadBufferLen(), TotalRead, -1, static_cast<long>(Anope::CurTime - Anope::StartTime));
@@ -392,7 +394,7 @@ void Stats::Run(MessageSource &source, const std::vector<Anope::string> &params)
case 'o':
case 'O':
/* Check whether the user is an operator */
- if (!u->HasMode(UMODE_OPER) && Config->HideStatsO)
+ if (!u->HasMode("OPER") && Config->HideStatsO)
IRCD->SendNumeric(219, source.GetSource(), "%c :End of /STATS report.", params[0][0]);
else
{