summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-26 06:33:41 +0000
committerspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-26 06:33:41 +0000
commite4c1ae81efcfce5d5105c49bbb17356496e67ff1 (patch)
tree2fbb5c1bf9124f4dd072c7faf6d8ac18de145881 /src/modules
parentee6208dc8f5bb806eca36e230ca5bbb6d5a45f60 (diff)
Made all of the error messages in chg* and set* a bit more uniform, and added a few that were missing
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7413 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_chghost.cpp6
-rw-r--r--src/modules/m_chgident.cpp13
-rw-r--r--src/modules/m_chgname.cpp10
-rw-r--r--src/modules/m_sethost.cpp4
-rw-r--r--src/modules/m_setident.cpp20
-rw-r--r--src/modules/m_setname.cpp18
6 files changed, 44 insertions, 27 deletions
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index d914fd2a2..12fb8db03 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -39,7 +39,7 @@ class cmd_chghost : public command_t
{
if (!hostmap[(unsigned char)*x])
{
- user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** CHGHOST: Invalid characters in hostname");
return CMD_FAILURE;
}
}
@@ -51,14 +51,14 @@ class cmd_chghost : public command_t
if ((parameters[1] - x) > 63)
{
- user->WriteServ("NOTICE %s :*** CHGHOST: Host too long",user->nick);
+ user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick);
return CMD_FAILURE;
}
userrec* dest = ServerInstance->FindNick(parameters[0]);
if (!dest)
{
- /* Drop it like a hot potato. XXX - we should probably message here.. -- w00t */
+ user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
return CMD_FAILURE;
}
diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index e3067fe56..a212077ed 100644
--- a/src/modules/m_chgident.cpp
+++ b/src/modules/m_chgident.cpp
@@ -40,12 +40,19 @@ class cmd_chgident : public command_t
if (!*parameters[1])
{
- user->WriteServ("NOTICE %s :*** CHGIDENT: Needs non-zero length ident", user->nick);
+ user->WriteServ("NOTICE %s :*** CHGIDENT: Ident must be specified", user->nick);
return CMD_FAILURE;
}
- if(!ServerInstance->IsIdent(parameters[1]))
+
+ if (strlen(parameters[1]) > IDENTMAX)
{
- user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
+ user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick);
+ return CMD_FAILURE;
+ }
+
+ if (!ServerInstance->IsIdent(parameters[1]))
+ {
+ user->WriteServ("NOTICE %s :*** CHGIDENT: Invalid characters in ident", user->nick);
return CMD_FAILURE;
}
diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp
index f3ea9cc25..887940124 100644
--- a/src/modules/m_chgname.cpp
+++ b/src/modules/m_chgname.cpp
@@ -37,11 +37,19 @@ class cmd_chgname : public command_t
user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
return CMD_FAILURE;
}
+
if (!*parameters[1])
{
- user->WriteServ("NOTICE %s :*** GECOS is too short", user->nick);
+ user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick);
return CMD_FAILURE;
}
+
+ if (strlen(parameters[1]) > MAXGECOS)
+ {
+ user->WriteServ("NOTICE %s :*** GECOS too long", user->nick);
+ return CMD_FAILURE;
+ }
+
if (IS_LOCAL(dest))
{
dest->ChangeName(parameters[1]);
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index 0719bd648..ff7d0c4da 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -38,13 +38,13 @@ class cmd_sethost : public command_t
{
if (!hostmap[(unsigned char)*x])
{
- user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** SETHOST: Invalid characters in hostname");
return CMD_FAILURE;
}
}
if (len == 0)
{
- user->WriteServ("NOTICE %s :*** SETHOST: Host too short", user->nick);
+ user->WriteServ("NOTICE %s :*** SETHOST: Host must be specified", user->nick);
return CMD_FAILURE;
}
if (len > 64)
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index a98592299..97ed80496 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -30,26 +30,24 @@ class cmd_setident : public command_t
CmdResult Handle(const char** parameters, int pcnt, userrec *user)
{
- size_t len = 0;
- for(const char* x = parameters[0]; *x; x++, len++)
+ if (!*parameters[0])
{
- if(((*x >= 'A') && (*x <= '}')) || strchr(".-0123456789", *x))
- continue;
-
- user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
+ user->WriteServ("NOTICE %s :*** SETIDENT: Ident must be specified", user->nick);
return CMD_FAILURE;
}
- if (len == 0)
+
+ if (strlen(parameters[0]) > IDENTMAX)
{
- user->WriteServ("NOTICE %s :*** SETIDENT: Ident too short", user->nick);
+ user->WriteServ("NOTICE %s :*** SETIDENT: Ident is too long", user->nick);
return CMD_FAILURE;
}
- if (len > IDENTMAX)
+
+ if (!ServerInstance->IsIdent(parameters[0]))
{
- user->WriteServ("NOTICE %s :*** Ident is too long", user->nick);
+ user->WriteServ("NOTICE %s :*** SETIDENT: Invalid characters in ident", user->nick);
return CMD_FAILURE;
}
-
+
user->ChangeIdent(parameters[0]);
ServerInstance->WriteOpers("%s used SETIDENT to change their ident to '%s'", user->nick, user->ident);
diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp
index 3ececbbb3..ecf0d41a9 100644
--- a/src/modules/m_setname.cpp
+++ b/src/modules/m_setname.cpp
@@ -31,19 +31,23 @@ class cmd_setname : public command_t
CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
- std::string line;
- for (int i = 0; i < pcnt-1; i++)
+ if (!*parameters[0])
{
- line = line + std::string(parameters[i]) + " ";
+ user->WriteServ("NOTICE %s :*** SETNAME: GECOS must be specified", user->nick);
+ return CMD_FAILURE;
}
- line = line + std::string(parameters[pcnt-1]);
- if (line.length() == 0)
+ if (strlen(parameters[0]) > MAXGECOS)
{
- user->WriteServ("NOTICE %s :*** GECOS too short", user->nick);
+ user->WriteServ("NOTICE %s :*** SETNAME: GECOS too long", user->nick);
return CMD_FAILURE;
}
- user->ChangeName(line.c_str());
+
+ if (user->ChangeName(parameters[0]))
+ {
+ ServerInstance->WriteOpers("%s used SETNAME to change their GECOS to %s", user->nick, parameters[0]);
+ return CMD_SUCCESS;
+ }
return CMD_SUCCESS;
}