summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-02 23:53:29 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-02 23:53:29 +0000
commit57608fe351cff19679b1d78fb5cbfb7cad89dfc1 (patch)
treed88625afe327da2794cd34bd4d723d87df251cb7 /src/mode.cpp
parent80959555778404b7f0cdd4bd171ea7e1fe6116e9 (diff)
Fixes for bug #493, tidyups to clearing of channel modes on losing FJOIN. Module unloads may also be tidied at a future date but it means reordering some loops in mode.cpp. See around the comment added.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9283 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 9b90599ce..83aff70cf 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -776,6 +776,9 @@ bool ModeParser::DelMode(ModeHandler* mh)
if (!modehandlers[pos])
return false;
+ /* Note: We can't stack here, as we have modes potentially being removed across many different channels.
+ * To stack here we have to make the algorithm slower. Discuss.
+ */
switch (mh->GetModeType())
{
case MODETYPE_USER:
@@ -1048,30 +1051,44 @@ bool ModeParser::DelModeWatcher(ModeWatcher* mw)
/** This default implementation can remove simple user modes
*/
-void ModeHandler::RemoveMode(User* user)
+void ModeHandler::RemoveMode(User* user, irc::modestacker* stack)
{
char moderemove[MAXBUF];
const char* parameters[] = { user->nick, moderemove };
if (user->IsModeSet(this->GetModeChar()))
{
- sprintf(moderemove,"-%c",this->GetModeChar());
- ServerInstance->Parser->CallHandler("MODE", parameters, 2, user);
+ if (stack)
+ {
+ stack->Push(this->GetModeChar());
+ }
+ else
+ {
+ sprintf(moderemove,"-%c",this->GetModeChar());
+ ServerInstance->Parser->CallHandler("MODE", parameters, 2, user);
+ }
}
}
/** This default implementation can remove simple channel modes
* (no parameters)
*/
-void ModeHandler::RemoveMode(Channel* channel)
+void ModeHandler::RemoveMode(Channel* channel, irc::modestacker* stack)
{
char moderemove[MAXBUF];
const char* parameters[] = { channel->name, moderemove };
if (channel->IsModeSet(this->GetModeChar()))
{
- sprintf(moderemove,"-%c",this->GetModeChar());
- ServerInstance->SendMode(parameters, 2, ServerInstance->FakeClient);
+ if (stack)
+ {
+ stack->Push(this->GetModeChar());
+ }
+ else
+ {
+ sprintf(moderemove,"-%c",this->GetModeChar());
+ ServerInstance->SendMode(parameters, 2, ServerInstance->FakeClient);
+ }
}
}