summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/channels.cpp3
-rw-r--r--src/userprocess.cpp12
-rw-r--r--src/users.cpp14
3 files changed, 19 insertions, 10 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 3f9391bea..8a857f4af 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -369,6 +369,9 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, con
Ptr->AddUser(user);
user->ModChannelCount(1);
+ /* Just in case they have no permissions */
+ user->chans[Ptr] = 0;
+
for (std::string::const_iterator x = privs.begin(); x != privs.end(); x++)
{
const char status = *x;
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index 815663ad8..6389d996e 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -112,7 +112,7 @@ void InspIRCd::ProcessUser(userrec* cu)
{
this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
this->SNO->WriteToSnoMask('f',"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
- userrec::QuitUser(this, current,"Excess flood");
+ current->SetWriteError("Excess flood");
return;
}
else
@@ -136,7 +136,7 @@ void InspIRCd::ProcessUser(userrec* cu)
{
if (current->registered == REG_ALL)
{
- userrec::QuitUser(this, current,"RecvQ exceeded");
+ current->SetWriteError("RecvQ exceeded");
}
else
{
@@ -162,7 +162,7 @@ void InspIRCd::ProcessUser(userrec* cu)
{
this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
this->SNO->WriteToSnoMask('f',"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
- userrec::QuitUser(this, current,"Excess flood");
+ current->SetWriteError("Excess flood");
return;
}
@@ -172,7 +172,7 @@ void InspIRCd::ProcessUser(userrec* cu)
{
this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
SNO->WriteToSnoMask('f',"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
- userrec::QuitUser(this, current,"Excess flood");
+ current->SetWriteError("Excess flood");
}
else
{
@@ -211,7 +211,7 @@ void InspIRCd::ProcessUser(userrec* cu)
if ((result == -1) && (errno != EAGAIN) && (errno != EINTR))
{
this->Log(DEBUG,"killing: %s",cu->nick);
- userrec::QuitUser(this,cu,strerror(errno));
+ cu->SetWriteError(strerror(errno));
return;
}
}
@@ -223,7 +223,7 @@ void InspIRCd::ProcessUser(userrec* cu)
}
else if (result == 0)
{
- userrec::QuitUser(this,cu,"Client exited");
+ cu->SetWriteError("Client exited");
this->Log(DEBUG,"Bailing from client exit");
return;
}
diff --git a/src/users.cpp b/src/users.cpp
index 2f1916391..033cd227f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -786,8 +786,12 @@ void userrec::QuitUser(InspIRCd* Instance, userrec *user, const std::string &qui
if (user->registered == REG_ALL)
{
user->PurgeEmptyChannels();
- FOREACH_MOD_I(Instance,I_OnUserQuit,OnUserQuit(user,reason));
user->WriteCommonExcept("QUIT :%s",reason.c_str());
+ FOREACH_MOD_I(Instance,I_OnUserQuit,OnUserQuit(user,reason));
+ }
+ else
+ {
+ Instance->Log(DEBUG,"FULL'O'FAIL! user->registered is %d, REG_ALL is %d", user->registered, REG_ALL);
}
FOREACH_MOD_I(Instance,I_OnUserDisconnect,OnUserDisconnect(user));
@@ -1331,7 +1335,6 @@ int userrec::GetPort()
}
break;
default:
- ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
break;
}
return 0;
@@ -1381,7 +1384,6 @@ const char* userrec::GetIPString()
}
break;
default:
- ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
break;
}
return "";
@@ -1424,7 +1426,6 @@ const char* userrec::GetIPString(char* buf)
break;
default:
- ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
break;
}
return "";
@@ -1961,11 +1962,13 @@ ConnectClass& userrec::GetClass()
void userrec::PurgeEmptyChannels()
{
+ ServerInstance->Log(DEBUG,"In PurgeEmptyChannels");
std::vector<chanrec*> to_delete;
// firstly decrement the count on each channel
for (UCListIter f = this->chans.begin(); f != this->chans.end(); f++)
{
+ ServerInstance->Log(DEBUG,"Iterate channel %s", f->first->name);
f->first->RemoveAllPrefixes(this);
if (f->first->DelUser(this) == 0)
{
@@ -2053,6 +2056,9 @@ void userrec::HandleEvent(EventType et, int errornum)
/* If the user has raised an error whilst being processed, quit them now we're safe to */
if (!WriteError.empty())
+ {
+ ServerInstance->Log(DEBUG,"Write error is set, quitting user with error '%s'", GetWriteError());
userrec::QuitUser(ServerInstance, this, GetWriteError());
+ }
}