]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_oper.cpp
InspSocket -> BufferedSocket. Paves the way for a SimpleSocket class which ident...
[user/henk/code/inspircd.git] / src / cmd_oper.cpp
index 63c7dc3e3bdc1502bf262e33f7451d9debe40ed1..1af42fffaa98e0536fcd8d63b241d4d8cbd33734 100644 (file)
  */
 
 #include "inspircd.h"
-#include "configreader.h"
-#include "typedefs.h"
-#include "users.h"
-#include "modules.h"
 #include "wildcard.h"
 #include "commands/cmd_oper.h"
 #include "hashcomp.h"
@@ -34,12 +30,12 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
        return false;
 }
 
-extern "C" DllExport command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport Command* init_command(InspIRCd* Instance)
 {
        return new cmd_oper(Instance);
 }
 
-CmdResult cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_oper::Handle (const char** parameters, int pcnt, User *user)
 {
        char LoginName[MAXBUF];
        char Password[MAXBUF];
@@ -107,7 +103,7 @@ CmdResult cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
        {
                /* correct oper credentials */
                ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0]);
-               user->WriteServ("381 %s :You are now an IRC operator of type %s",user->nick,irc::Spacify(OperType));
+               user->WriteServ("381 %s :You are now %s %s",user->nick, strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType));
                if (!user->IsModeSet('o'))
                        user->Oper(OperType);
        }
@@ -122,10 +118,13 @@ CmdResult cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
                        std::string fields;
                        if (!match_login)
                                fields.append("login ");
-                       if (!match_pass)
-                               fields.append("password ");
-                       if (!match_hosts)
-                               fields.append("hosts");
+                       else
+                       {
+                               if (!match_pass)
+                                       fields.append("password ");
+                               if (!match_hosts)
+                                       fields.append("hosts");
+                       }
                        user->WriteServ("491 %s :Invalid oper credentials",user->nick);
                        
                        snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s",user->nick,user->ident,user->host, parameters[0], fields.c_str());