summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-24 21:36:35 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-24 21:36:35 +0000
commit8a0825e03af56b5be0d150845fedafd83ee01636 (patch)
tree458b9a981e9fb13ee30b6c2779d5c96c64ad24a5
parent61e121fb7debd46ea391ab2cfca0df036cef5f07 (diff)
Fixed quit-bouncing issue when a user is g-lined
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@717 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd.h1
-rw-r--r--src/inspircd.cpp54
2 files changed, 53 insertions, 2 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 1d88b2aff..d8967afb7 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -114,6 +114,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool local);
void force_nickchange(userrec* user,const char* newnick);
void kill_link(userrec *user,const char* r);
+void kill_link_silent(userrec *user,const char* r);
int usercount(chanrec *c);
void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user);
long GetRevision();
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index f226f2af5..8f0958890 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -1840,6 +1840,56 @@ void kill_link(userrec *user,const char* r)
}
}
+void kill_link_silent(userrec *user,const char* r)
+{
+ user_hash::iterator iter = clientlist.find(user->nick);
+
+ char reason[MAXBUF];
+
+ strncpy(reason,r,MAXBUF);
+
+ if (strlen(reason)>MAXQUIT)
+ {
+ reason[MAXQUIT-1] = '\0';
+ }
+
+ log(DEBUG,"kill_link: %s '%s'",user->nick,reason);
+ Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason);
+ log(DEBUG,"closing fd %d",user->fd);
+
+ /* bugfix, cant close() a nonblocking socket (sux!) */
+ if (user->registered == 7) {
+ FOREACH_MOD OnUserQuit(user);
+ WriteCommonExcept(user,"QUIT :%s",reason);
+
+ // Q token must go to ALL servers!!!
+ char buffer[MAXBUF];
+ snprintf(buffer,MAXBUF,"Q %s :%s",user->nick,reason);
+ NetSendToAll(buffer);
+ }
+
+ /* push the socket on a stack of sockets due to be closed at the next opportunity
+ * 'Client exited' is an exception to this as it means the client side has already
+ * closed the socket, we don't need to do it.
+ */
+ fd_reap.push_back(user->fd);
+
+ bool do_purge = false;
+
+ if (iter != clientlist.end())
+ {
+ log(DEBUG,"deleting user hash value %d",iter->second);
+ if ((iter->second) && (user->registered == 7)) {
+ delete iter->second;
+ }
+ clientlist.erase(iter);
+ }
+
+ if (user->registered == 7) {
+ purge_empty_chans();
+ }
+}
+
// looks up a users password for their connection class (<ALLOW>/<DENY> tags)
@@ -2240,7 +2290,7 @@ void ConnectUser(userrec *user)
{
char reason[MAXBUF];
snprintf(reason,MAXBUF,"G-Lined: %s",r);
- kill_link(user,reason);
+ kill_link_silent(user,reason);
return;
}
@@ -2249,7 +2299,7 @@ void ConnectUser(userrec *user)
{
char reason[MAXBUF];
snprintf(reason,MAXBUF,"K-Lined: %s",r);
- kill_link(user,reason);
+ kill_link_silent(user,reason);
return;
}