1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-01 16:06:37 +02:00

- Made CHGIDENT, CHGHOST and CHGNAME use more numerics (where possible) (#0002358).

This commit is contained in:
Bram Matthys
2005-02-26 23:10:14 +00:00
parent 4788bc3f76
commit 7bad90fec1
6 changed files with 54 additions and 96 deletions
+1
View File
@@ -668,3 +668,4 @@
the nickchars system printing out incorrect set:: directives.
- spamfilter.conf and dccallow.conf are now also copied upon make install, reported by
TommyTheKid (#0002313).
- Made CHGIDENT, CHGHOST and CHGNAME use more numerics (where possible) (#0002358).
+1
View File
@@ -139,6 +139,7 @@
#define ERR_TOOMANYDCC 514
#define ERR_DISABLED 517
#define ERR_NOINVITE 518
#define ERR_ADMONLY 519
#define ERR_OPERONLY 520
+18 -34
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
+1 -1
View File
@@ -573,7 +573,7 @@ static char *replies[] = {
/* 514 ERR_TOOMANYDCC */ ":%s 514 %s %s :Your dcc allow list is full. Maximum size is %d entries",
/* 515 */ NULL, /* ircu */
/* 516 */ NULL, /* ircu */
/* 517 */ NULL, /* ircu */
/* 517 ERR_DISABLED*/ ":%s 517 %s %s :%s", /* ircu */
/* 518 518 */ ":%s 518 %s :Cannot invite (+V) at channel %s",
/* 519 519 */ ":%s 519 %s :Cannot join channel %s (Admin only)",
/* 520 520 */ ":%s 520 %s :Cannot join channel %s (IRCops only)",