]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_map.cpp
Fix MySQL crash on module unload with empty query queue
[user/henk/code/inspircd.git] / src / commands / cmd_map.cpp
index 780caf081f5808cc73e40244388d2d8a3ff8fe52..39b0ed27fff254fb462a1bacd8b30273bbf90ec2 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
 
 #include "inspircd.h"
 
-#ifndef __CMD_MAP_H__
-#define __CMD_MAP_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /MAP. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
 class CommandMap : public Command
 {
  public:
        /** Constructor for map.
         */
-       CommandMap (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MAP",0,0,false,2) { }
+       CommandMap ( Module* parent) : Command(parent,"MAP",0,0) { Penalty=2; }
        /** Handle command.
         * @param parameters The parameters to the comamnd
         * @param pcnt The number of parameters passed to teh command
@@ -41,9 +28,6 @@ class CommandMap : public Command
        CmdResult Handle(const std::vector<std::string>& parameters, User *user);
 };
 
-#endif
-
-
 /** Handle /MAP
  */
 CmdResult CommandMap::Handle (const std::vector<std::string>&, User *user)
@@ -51,7 +35,14 @@ CmdResult CommandMap::Handle (const std::vector<std::string>&, User *user)
        // as with /LUSERS this does nothing without a linking
        // module to override its behaviour and display something
        // better.
-       user->WriteNumeric(006, "%s :%s",user->nick.c_str(),ServerInstance->Config->ServerName);
+
+       if (IS_OPER(user))
+       {
+               user->WriteNumeric(006, "%s :%s [%s]", user->nick.c_str(), ServerInstance->Config->ServerName.c_str(), ServerInstance->Config->GetSID().c_str());
+               user->WriteNumeric(007, "%s :End of /MAP", user->nick.c_str());
+               return CMD_SUCCESS;
+       }
+       user->WriteNumeric(006, "%s :%s",user->nick.c_str(),ServerInstance->Config->ServerName.c_str());
        user->WriteNumeric(007, "%s :End of /MAP",user->nick.c_str());
 
        return CMD_SUCCESS;