summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-13 02:01:03 +0000
committerom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-13 02:01:03 +0000
commit25a96c8f5175a5910c69a3bc623036320497b34b (patch)
tree3499cf69e296582d8db42a1b60853f6fc56f220c /src
parent7f89baebc58c2e27740aa01c33187c0c0229abd8 (diff)
Remove code duplication by using core function. Remove global Server*..one step on the road to losing the bloody regexp :<
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3187 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_chgident.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index 52bfd237c..1f7c28dda 100644
--- a/src/modules/m_chgident.cpp
+++ b/src/modules/m_chgident.cpp
@@ -1,19 +1,19 @@
#include <string>
#include "users.h"
#include "modules.h"
+#include "message.h"
#include "helperfuncs.h"
/* $ModDesc: Provides support for the CHGIDENT command */
-Server *Srv;
-
-
class cmd_chgident : public command_t
{
+ Server* Srv;
public:
- cmd_chgident() : command_t("CHGIDENT", 'o', 2)
+ cmd_chgident(Server* serv) : command_t("CHGIDENT", 'o', 2)
{
this->source = "m_chgident.so";
+ Srv = serv;
}
void Handle(char **parameters, int pcnt, userrec *user)
@@ -22,11 +22,8 @@ class cmd_chgident : public command_t
if(dest)
{
- for(unsigned int x = 0; x < strlen(parameters[1]); x++)
+ if(!isident(parameters[1]))
{
- if(((parameters[1][x] >= 'A') && (parameters[1][x] <= '}')) || strchr(".-0123456789", parameters[1][x]))
- continue;
-
WriteServ(user->fd, "NOTICE %s :*** Invalid characters in ident", user->nick);
return;
}
@@ -49,9 +46,8 @@ class ModuleChgIdent : public Module
public:
ModuleChgIdent(Server* Me) : Module::Module(Me)
{
- Srv = Me;
- mycommand = new cmd_chgident();
- Srv->AddCommand(mycommand);
+ mycommand = new cmd_chgident(Me);
+ Me->AddCommand(mycommand);
}
virtual ~ModuleChgIdent()