* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
+ * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
+ * E-mail:
+ * <brain@chatspike.net>
+ * <Craig@chatspike.net>
*
* Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
#include "users.h"
#include "channels.h"
#include "modules.h"
+#include "helperfuncs.h"
/* $ModDesc: Provides support for unreal-style SAPART command */
-Server *Srv;
+static Server *Srv;
class cmd_sapart : public command_t
{
cmd_sapart () : command_t("SAPART", 'o', 2)
{
this->source = "m_sapart.so";
+ syntax = "<nick> <channel>";
}
- void Handle (char **parameters, int pcnt, userrec *user)
+ void Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* dest = Srv->FindNick(std::string(parameters[0]));
if (dest)
{
- for (unsigned int x = 0; x < strlen(parameters[1]); x++)
+ if (Srv->IsUlined(dest->server))
{
- if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ','))
- {
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
- return;
- }
+ WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
+ return;
+ }
+ if (!IsValidChannelName(parameters[1]))
+ {
+ Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+ return;
}
Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+std::string(dest->nick)+" part "+parameters[1]);