]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Fix multiple (useless) linefeeds on the end of ADDLINE in burst
[user/henk/code/inspircd.git] / src / users.cpp
index e3aeb299b8a8d2ea90e2a15a6248f5a794f369dd..aeb9852377fc865bee0042d86e7d05b9e69ac252 100644 (file)
@@ -73,6 +73,9 @@ std::string User::ProcessNoticeMasks(const char *sm)
                                                output += *c;
                                        }
                                }
+                               else
+                                       this->WriteServ("501 %s %c :is unknown snomask char to me", this->nick, *c);
+
                                oldadding = adding;
                        break;
                }
@@ -177,11 +180,11 @@ User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance
        *password = *nick = *ident = *host = *dhost = *fullname = *awaymsg = *oper = *uuid = 0;
        server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName);
        reset_due = ServerInstance->Time();
-       age = ServerInstance->Time(true);
+       age = ServerInstance->Time();
        Penalty = 0;
        lines_in = lastping = signon = idle_lastmsg = nping = registered = 0;
        ChannelCount = timeout = bytes_in = bytes_out = cmds_in = cmds_out = 0;
-       OverPenalty = ExemptFromPenalty = quitting = exempt = haspassed = dns_done = false;
+       quietquit = OverPenalty = ExemptFromPenalty = quitting = exempt = haspassed = dns_done = false;
        fd = -1;
        recvq.clear();
        sendq.clear();
@@ -692,7 +695,7 @@ void User::Oper(const std::string &opertype, const std::string &opername)
 
        catch (...)
        {
-               ServerInstance->Log(DEBUG,"Exception in User::Oper()");
+               ServerInstance->Logs->Log("OPER", DEBUG,"Exception in User::Oper()");
        }
 }
 
@@ -700,11 +703,27 @@ void User::UnOper()
 {
        if (IS_OPER(this))
        {
-               // unset their oper type (what IS_OPER checks), and remove +o
+               /* Remove all oper only modes from the user when the deoper - Bug #466*/
+               std::string moderemove("-");
+
+               for (unsigned char letter = 'A'; letter <= 'z'; letter++)
+               {
+                       if (letter != 'o')
+                       {
+                               ModeHandler* mh = ServerInstance->Modes->FindMode(letter, MODETYPE_USER);
+                               if (mh && mh->NeedsOper())
+                                       moderemove += letter;
+                       }
+               }
+
+               const char* parameters[] = { this->nick, moderemove.c_str() };
+               ServerInstance->Parser->CallHandler("MODE", parameters, 2, this);
+
+               /* unset their oper type (what IS_OPER checks), and remove +o */
                *this->oper = 0;
                this->modes[UM_OPERATOR] = 0;
                        
-               // remove the user from the oper list. Will remove multiple entries as a safeguard against bug #404
+               /* remove the user from the oper list. Will remove multiple entries as a safeguard against bug #404 */
                ServerInstance->Users->all_opers.remove(this);
 
                if (AllowedOperCommands)
@@ -958,7 +977,7 @@ void User::SetSockAddr(int protocol_family, const char* sip, int port)
                }
                break;
                default:
-                       ServerInstance->Log(DEBUG,"Uh oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
+                       ServerInstance->Logs->Log("USERS",DEBUG,"Uh oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
                break;
        }
 }
@@ -1070,7 +1089,7 @@ void User::Write(std::string text)
        }
        catch (...)
        {
-               ServerInstance->Log(DEBUG,"Exception in User::Write() std::string::append");
+               ServerInstance->Logs->Log("USEROUTPUT", DEBUG,"Exception in User::Write() std::string::append");
                return;
        }
 
@@ -1085,7 +1104,7 @@ void User::Write(std::string text)
                }
                catch (CoreException& modexcept)
                {
-                       ServerInstance->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+                       ServerInstance->Logs->Log("USEROUTPUT", DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
                }
        }
        else
@@ -1590,7 +1609,7 @@ ConnectClass* User::SetClass(const std::string &explicit_name)
                /* deny change if change will take class over the limit */
                if (found->limit && (found->RefCount + 1 >= found->limit))
                {
-                       ServerInstance->Log(DEBUG, "OOPS: Connect class limit (%u) hit, denying", found->limit);
+                       ServerInstance->Logs->Log("USERS", DEBUG, "OOPS: Connect class limit (%u) hit, denying", found->limit);
                        return this->MyClass;
                }
 
@@ -1600,12 +1619,12 @@ ConnectClass* User::SetClass(const std::string &explicit_name)
                        if (found == this->MyClass) // no point changing this shit :P
                                return this->MyClass;
                        this->MyClass->RefCount--;
-                       ServerInstance->Log(DEBUG, "Untying user from connect class -- refcount: %u", this->MyClass->RefCount);
+                       ServerInstance->Logs->Log("USERS", DEBUG, "Untying user from connect class -- refcount: %u", this->MyClass->RefCount);
                }
 
                this->MyClass = found;
                this->MyClass->RefCount++;
-               ServerInstance->Log(DEBUG, "User tied to new class -- connect refcount now: %u", this->MyClass->RefCount);
+               ServerInstance->Logs->Log("USERS", DEBUG, "User tied to new class -- connect refcount now: %u", this->MyClass->RefCount);
        }
 
        return this->MyClass;
@@ -1638,7 +1657,7 @@ void User::PurgeEmptyChannels()
                        }
                        catch (...)
                        {
-                               ServerInstance->Log(DEBUG,"Exception in User::PurgeEmptyChannels to_delete.push_back()");
+                               ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::PurgeEmptyChannels to_delete.push_back()");
                        }
                }
        }
@@ -1716,7 +1735,7 @@ void User::HandleEvent(EventType et, int errornum)
        }
        catch (...)
        {
-               ServerInstance->Log(DEBUG,"Exception in User::HandleEvent intercepted");
+               ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::HandleEvent intercepted");
        }
 
        /* If the user has raised an error whilst being processed, quit them now we're safe to */