The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

m_botmode.cpp

Go to the documentation of this file.
00001 /*       +------------------------------------+
00002  *       | Inspire Internet Relay Chat Daemon |
00003  *       +------------------------------------+
00004  *
00005  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
00006  * See: http://www.inspircd.org/wiki/index.php/Credits
00007  *
00008  * This program is free but copyrighted software; see
00009  *            the file COPYING for details.
00010  *
00011  * ---------------------------------------------------
00012  */
00013 
00014 #include "inspircd.h"
00015 
00016 /* $ModDesc: Provides support for unreal-style umode +B */
00017 
00020 class BotMode : public SimpleUserModeHandler
00021 {
00022  public:
00023         BotMode(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'B') { }
00024 };
00025 
00026 class ModuleBotMode : public Module
00027 {
00028 
00029         BotMode* bm;
00030  public:
00031         ModuleBotMode(InspIRCd* Me)
00032                 : Module(Me)
00033         {
00034 
00035                 bm = new BotMode(ServerInstance);
00036                 if (!ServerInstance->Modes->AddMode(bm))
00037                         throw ModuleException("Could not add new modes!");
00038                 Implementation eventlist[] = { I_OnWhois };
00039                 ServerInstance->Modules->Attach(eventlist, this, 1);
00040         }
00041 
00042 
00043         virtual ~ModuleBotMode()
00044         {
00045                 ServerInstance->Modes->DelMode(bm);
00046                 delete bm;
00047         }
00048 
00049         virtual Version GetVersion()
00050         {
00051                 return Version("$Id: m_botmode.cpp 10291 2008-08-25 20:35:51Z w00t $",VF_COMMON|VF_VENDOR,API_VERSION);
00052         }
00053 
00054         virtual void OnWhois(User* src, User* dst)
00055         {
00056                 if (dst->IsModeSet('B'))
00057                 {
00058                         ServerInstance->SendWhoisLine(src, dst, 335, std::string(src->nick)+" "+std::string(dst->nick)+" :is a bot on "+ServerInstance->Config->Network);
00059                 }
00060         }
00061 
00062 };
00063 
00064 
00065 MODULE_INIT(ModuleBotMode)