1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 /* $ModDesc: Provides the UNINVITE command which lets users un-invite other users from channels (!) */
20 #include "configreader.h"
24 class cmd_uninvite : public command_t
27 cmd_uninvite (InspIRCd* Instance) : command_t(Instance,"UNINVITE", 0, 2)
29 this->source = "m_uninvite.so";
30 syntax = "<nick> <channel>";
33 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
35 userrec* u = ServerInstance->FindNick(parameters[0]);
36 chanrec* c = ServerInstance->FindChan(parameters[1]);
42 user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[1]);
46 user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
52 if (c->modes[CM_INVITEONLY])
54 if (c->GetStatus(user) < STATUS_HOP)
56 user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, c->name);
61 irc::string xname(c->name);
63 if (!u->IsInvited(xname))
65 user->WriteServ("491 %s %s %s :Is not invited to channel %s",user->nick,u->nick,c->name,c->name);
68 if (!c->HasUser(user))
70 user->WriteServ("492 %s %s :You're not on that channel!",user->nick, c->name);
74 u->RemoveInvite(xname);
75 user->WriteServ("494 %s %s %s :Uninvited",user->nick,c->name,u->nick);
76 u->WriteServ("493 %s :You were uninvited from %s by %s",u->nick,c->name,user->nick);
77 c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s uninvited %s.", c->name, user->nick, u->nick);
83 class ModuleUninvite : public Module
85 cmd_uninvite *mycommand;
89 ModuleUninvite(InspIRCd* Me) : Module(Me)
92 mycommand = new cmd_uninvite(ServerInstance);
93 ServerInstance->AddCommand(mycommand);
96 virtual ~ModuleUninvite()
100 virtual Version GetVersion()
102 return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
107 class ModuleUninviteFactory : public ModuleFactory
110 ModuleUninviteFactory()
114 ~ModuleUninviteFactory()
118 virtual Module * CreateModule(InspIRCd* Me)
120 return new ModuleUninvite(Me);
126 extern "C" DllExport void * init_module( void )
128 return new ModuleUninviteFactory;