mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 13:03:12 +02:00
- Added proper "not enough parameters" message for /SETNAME and cleaned up some whitespace
in the function, reported by Robby22 (#0002696). - Fixed set::static-part set to 'no' not working properly. Reported by Robby22 (#0002698). - Fixed crash in new resolver, reported by firstof9.
This commit is contained in:
@@ -105,6 +105,8 @@ DLLFUNC CMD_FUNC(m_part)
|
||||
{
|
||||
if (!strcasecmp(STATIC_PART, "yes") || !strcmp(STATIC_PART, "1"))
|
||||
commentx = NULL;
|
||||
else if (!strcasecmp(STATIC_PART, "no") || !strcmp(STATIC_PART, "0"))
|
||||
; /* keep original reason */
|
||||
else
|
||||
commentx = STATIC_PART;
|
||||
}
|
||||
|
||||
+33
-39
@@ -92,43 +92,37 @@ DLLFUNC int MOD_UNLOAD(m_setname)(int module_unload)
|
||||
yes it is experimental but anyways ;P
|
||||
FREEDOM TO THE USERS! ;)
|
||||
*/
|
||||
DLLFUNC int m_setname(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
|
||||
if (parc < 2)
|
||||
return 0;
|
||||
if (strlen(parv[1]) > (REALLEN))
|
||||
{
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /SetName Error: \"Real names\" may maximum be %i characters of length",
|
||||
me.name, sptr->name, REALLEN);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (strlen(parv[1]) < 1)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :Couldn't change realname - Nothing in parameter",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
/* set the new name before we check, but don't send to servers unless it is ok */
|
||||
else
|
||||
ircsprintf(sptr->info, "%s", parv[1]);
|
||||
/* Check for n:lines here too */
|
||||
if (!IsAnOper(sptr) && Find_ban(NULL, sptr->info, CONF_BAN_REALNAME))
|
||||
{
|
||||
int xx;
|
||||
xx =
|
||||
exit_client(cptr, sptr, &me,
|
||||
"Your GECOS (real name) is banned from this server");
|
||||
return xx;
|
||||
}
|
||||
sendto_serv_butone_token(cptr, sptr->name, MSG_SETNAME, TOK_SETNAME,
|
||||
":%s", parv[1]);
|
||||
if (MyConnect(sptr))
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :Your \"real name\" is now set to be %s - you have to set it manually to undo it",
|
||||
me.name, parv[0], parv[1]);
|
||||
return 0;
|
||||
DLLFUNC CMD_FUNC(m_setname)
|
||||
{
|
||||
if ((parc < 2) || BadPtr(parv[1]))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SETNAME");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strlen(parv[1]) > REALLEN)
|
||||
{
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
sendnotice(sptr, "*** /SetName Error: \"Real names\" may maximum be %i characters of length",
|
||||
REALLEN);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set the new name before we check, but don't send to servers unless it is ok */
|
||||
strcpy(sptr->info, parv[1]);
|
||||
|
||||
/* Check for n:lines here too */
|
||||
if (!IsAnOper(sptr) && Find_ban(NULL, sptr->info, CONF_BAN_REALNAME))
|
||||
return exit_client(cptr, sptr, &me,
|
||||
"Your GECOS (real name) is banned from this server");
|
||||
|
||||
sendto_serv_butone_token(cptr, sptr->name, MSG_SETNAME, TOK_SETNAME, ":%s", parv[1]);
|
||||
|
||||
if (MyConnect(sptr))
|
||||
sendnotice(sptr, "Your \"real name\" is now set to be %s - you have to set it manually to undo it",
|
||||
parv[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user