summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-06-28 11:24:19 -0400
committerAdam <Adam@anope.org>2010-06-28 11:24:19 -0400
commitf1cb4b86b7b89430ee87cfb301f143e1e57c1b2d (patch)
treefc8c5f3fcee5fc7beea880be7b3bc4366e7a50b4 /src
parent4502038e3da0e176e194aabfd64c85544bb0aa23 (diff)
Delete all users when we disconnect from the uplink
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp10
-rw-r--r--src/servers.cpp3
-rw-r--r--src/users.cpp7
3 files changed, 13 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index e1b3c1ee3..f5eb3c915 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -551,6 +551,16 @@ int main(int ac, char **av, char **envp)
unsigned j = 0;
for (; j < (Config.MaxRetries ? Config.MaxRetries : j + 1); ++j)
{
+ /* Clear all of our users, but not our bots */
+ for (user_map::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; )
+ {
+ User *u = it->second;
+ ++it;
+
+ if (!findbot(u->nick))
+ delete u;
+ }
+
Alog() << "Disconnected from the server, retrying in " << Config.RetryWait << " seconds";
sleep(Config.RetryWait);
diff --git a/src/servers.cpp b/src/servers.cpp
index b5c7e4f7a..d1f094dbb 100644
--- a/src/servers.cpp
+++ b/src/servers.cpp
@@ -105,9 +105,6 @@ Server::~Server()
na->last_quit = (!QReason.empty() ? sstrdup(QReason.c_str()) : NULL);
}
- if (Config.LimitSessions && !u->server->IsULined())
- del_session(u->host);
-
delete u;
}
}
diff --git a/src/users.cpp b/src/users.cpp
index cc97152a1..887929c76 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -221,6 +221,9 @@ User::~User()
while (!this->chans.empty())
this->chans.front()->chan->DeleteUser(this);
+
+ if (Config.LimitSessions && !this->server->IsULined())
+ del_session(this->host);
UserListByNick.erase(this->nick.c_str());
if (!this->uid.empty())
@@ -939,8 +942,6 @@ void do_quit(const char *source, int ac, const char **av)
delete [] na->last_quit;
na->last_quit = *av[0] ? sstrdup(av[0]) : NULL;
}
- if (Config.LimitSessions && !user->server->IsULined())
- del_session(user->host);
FOREACH_MOD(I_OnUserQuit, OnUserQuit(user, *av[0] ? av[0] : ""));
delete user;
}
@@ -971,8 +972,6 @@ void do_kill(const std::string &nick, const std::string &msg)
delete [] na->last_quit;
na->last_quit = !msg.empty() ? sstrdup(msg.c_str()) : NULL;
}
- if (Config.LimitSessions && !user->server->IsULined())
- del_session(user->host);
delete user;
}