mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-05 08:33:14 +02:00
- Made CHGIDENT, CHGHOST and CHGNAME use more numerics (where possible) (#0002358).
This commit is contained in:
+18
-34
@@ -104,58 +104,43 @@ DLLFUNC int m_chghost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
aClient *acptr;
|
||||
|
||||
if (MyClient(sptr) && !IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DISABLE_USERMOD
|
||||
if (MyClient(sptr))
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** The /chghost command is disabled on this server", me.name, sptr->name);
|
||||
sendto_one(sptr, err_str(ERR_DISABLED), me.name, sptr->name, "CHGHOST",
|
||||
"This command is disabled on this server");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MyClient(sptr))
|
||||
if (!IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
if (parc < 3)
|
||||
if ((parc < 3) || !*parv[2])
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgHost syntax is /ChgHost <nick> <newhost>",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(parv[2]) < 1)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Write atleast something to change the host to!",
|
||||
me.name, sptr->name);
|
||||
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, sptr->name, "CHGHOST");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(parv[2]) > (HOSTLEN))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** ChgHost Error: Too long hostname!!",
|
||||
me.name, sptr->name);
|
||||
sendnotice(sptr, "*** ChgName Error: Requested hostname too long -- rejected.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!valid_host(parv[2]))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgHost Error: A hostname may contain a-z, A-Z, 0-9, '-' & '.' - Please only use them",
|
||||
me.name, parv[0]);
|
||||
sendnotice(sptr, "*** /ChgHost Error: A hostname may contain a-z, A-Z, 0-9, '-' & '.' - Please only use them");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parv[2][0] == ':')
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** A hostname cannot start with ':'", me.name, sptr->name);
|
||||
sendnotice(sptr, "*** A hostname cannot start with ':'");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -164,9 +149,7 @@ DLLFUNC int m_chghost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
DYN_LOCAL(char, did_parts, acptr->user->joined);
|
||||
if (!strcmp(GetHost(acptr), parv[2]))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgHost Error: requested host is same as current host.",
|
||||
me.name, parv[0]);
|
||||
sendnotice(sptr, "*** /ChgHost Error: requested host is same as current host.");
|
||||
DYN_FREE(did_parts);
|
||||
return 0;
|
||||
}
|
||||
@@ -175,7 +158,8 @@ DLLFUNC int m_chghost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
case UHALLOW_NEVER:
|
||||
if (MyClient(sptr))
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** /ChgHost is disabled", me.name, sptr->name);
|
||||
sendto_one(sptr, err_str(ERR_DISABLED), me.name, sptr->name, "CHGHOST",
|
||||
"This command is disabled on this server");
|
||||
DYN_FREE(did_parts);
|
||||
return 0;
|
||||
}
|
||||
@@ -185,7 +169,7 @@ DLLFUNC int m_chghost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
case UHALLOW_NOCHANS:
|
||||
if (IsPerson(acptr) && MyClient(sptr) && acptr->user->joined)
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** /ChgHost can not be used while %s is on a channel", me.name, sptr->name, acptr->name);
|
||||
sendnotice(sptr, "*** /ChgHost can not be used while %s is on a channel", acptr->name);
|
||||
DYN_FREE(did_parts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+21
-35
@@ -107,56 +107,43 @@ DLLFUNC int MOD_UNLOAD(m_chgident)(int module_unload)
|
||||
|
||||
int m_chgident(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
aClient *acptr;
|
||||
char *s;
|
||||
int legalident = 1;
|
||||
aClient *acptr;
|
||||
char *s;
|
||||
int legalident = 1;
|
||||
|
||||
if (MyClient(sptr) && !IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DISABLE_USERMOD
|
||||
if (MyClient(sptr))
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** The /chgident command is disabled on this server", me.name, sptr->name);
|
||||
sendto_one(sptr, err_str(ERR_DISABLED), me.name, sptr->name, "CHGIDENT",
|
||||
"This command is disabled on this server");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MyClient(sptr))
|
||||
if (!IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
if (parc < 3)
|
||||
if ((parc < 3) || !*parv[2])
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgIdent syntax is /ChgIdent <nick> <newident>",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(parv[2]) < 1)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Write atleast something to change the ident to!",
|
||||
me.name, sptr->name);
|
||||
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, sptr->name, "CHGIDENT");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(parv[2]) > (USERLEN))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** ChgIdent Error: Too long ident!!",
|
||||
me.name, sptr->name);
|
||||
sendnotice(sptr, "*** ChgIdent Error: Requested ident too long -- rejected.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* illegal?! */
|
||||
for (s = parv[2]; *s; s++)
|
||||
{
|
||||
if ((*s == '~') && (s == parv[2]))
|
||||
continue;
|
||||
if ((*s == '~') && (s == parv[2]))
|
||||
continue;
|
||||
if (!isallowed(*s))
|
||||
{
|
||||
legalident = 0;
|
||||
@@ -165,9 +152,7 @@ int m_chgident(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
if (legalident == 0)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgIdent Error: A ident may contain a-z, A-Z, 0-9, '-' & '.' - Please only use them",
|
||||
me.name, parv[0]);
|
||||
sendnotice(sptr, "*** /ChgIdent Error: A ident may contain a-z, A-Z, 0-9, '-' & '.' - Please only use them");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -179,7 +164,8 @@ int m_chgident(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
case UHALLOW_NEVER:
|
||||
if (MyClient(sptr))
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** /ChgIdent is disabled", me.name, sptr->name);
|
||||
sendto_one(sptr, err_str(ERR_DISABLED), me.name, sptr->name, "CHGIDENT",
|
||||
"This command is disabled on this server");
|
||||
DYN_FREE(did_parts);
|
||||
return 0;
|
||||
}
|
||||
@@ -189,7 +175,7 @@ int m_chgident(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
case UHALLOW_NOCHANS:
|
||||
if (IsPerson(acptr) && MyClient(sptr) && acptr->user->joined)
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** /ChgIdent can not be used while %s is on a channel", me.name, sptr->name, acptr->name);
|
||||
sendnotice(sptr, "*** /ChgIdent can not be used while %s is on a channel", acptr->name);
|
||||
DYN_FREE(did_parts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+12
-26
@@ -116,45 +116,31 @@ DLLFUNC int m_chgname(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
aClient *acptr;
|
||||
|
||||
if (MyClient(sptr) && !IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DISABLE_USERMOD
|
||||
if (MyClient(sptr))
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** The /chgname command is disabled on this server", me.name, sptr->name);
|
||||
sendto_one(sptr, err_str(ERR_DISABLED), me.name, sptr->name, "CHGNAME",
|
||||
"This command is disabled on this server");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (MyClient(sptr))
|
||||
if (!IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
if (parc < 3)
|
||||
if ((parc < 3) || !*parv[2])
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgName syntax is /ChgName <nick> <newident>",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(parv[2]) < 1)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Write atleast something to change the ident to!",
|
||||
me.name, sptr->name);
|
||||
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, sptr->name, "CHGNAME");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(parv[2]) > (REALLEN))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** ChgName Error: Too long !!", me.name,
|
||||
sptr->name);
|
||||
sendnotice(sptr, "*** ChgName Error: Requested realname too long -- rejected.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user