aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/adminproc.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-05-18 09:49:12 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-05-18 09:49:12 +0200
commit2064d28dab760ca94e1f0c0caf8f629ee92e0796 (patch)
tree8dcab3a5729af3e5d343697c6581c2eb554a021a /FICS/adminproc.c
parent2cc07b589cd70aca320de54a2a5f5f0785531869 (diff)
Reformatted com_asetrealname()
Diffstat (limited to 'FICS/adminproc.c')
-rw-r--r--FICS/adminproc.c76
1 files changed, 45 insertions, 31 deletions
diff --git a/FICS/adminproc.c b/FICS/adminproc.c
index 7ff9369..6abb649 100644
--- a/FICS/adminproc.c
+++ b/FICS/adminproc.c
@@ -1323,40 +1323,54 @@ PUBLIC int com_asetemail(int p, param_list param)
* This command sets the user's real name (as displayed to admins on finger
* notes) to "newname".
*/
-PUBLIC int com_asetrealname(int p, param_list param)
+PUBLIC int
+com_asetrealname(int p, param_list param)
{
- int p1, connected;
+ int p1, connected;
- ASSERT(parray[p].adminLevel >= ADMIN_ADMIN);
- if (!FindPlayer(p, param[0].val.word, &p1, &connected))
- return COM_OK;
+ ASSERT(parray[p].adminLevel >= ADMIN_ADMIN);
- if ((parray[p].adminLevel <= parray[p1].adminLevel) && !player_ishead(p)) {
- pprintf(p, "You can only set real names for players below your adminlevel.\n");
- if (!connected)
- player_remove(p1);
- return COM_OK;
- }
- if (parray[p1].fullName)
- rfree(parray[p1].fullName);
- if (param[1].type == TYPE_NULL) {
- parray[p1].fullName = NULL;
- pprintf(p, "Real name for %s removed\n", parray[p1].name);
- } else {
- parray[p1].fullName = xstrdup(param[1].val.word);
- pprintf(p, "Real name of %s changed to \"%s\".\n", parray[p1].name, param[1].val.word);
- }
- player_save(p1);
- if (connected) {
- if (param[1].type == TYPE_NULL) {
- pprintf_prompt(p1, "\n\n%s has removed your real name.\n\n", parray[p].name);
- } else {
- pprintf_prompt(p1, "\n\n%s has changed your real name.\n\n", parray[p].name);
- }
- } else {
- player_remove(p1);
- }
- return COM_OK;
+ if (!FindPlayer(p, param[0].val.word, &p1, &connected))
+ return COM_OK;
+
+ if ((parray[p].adminLevel <= parray[p1].adminLevel) &&
+ !player_ishead(p)) {
+ pprintf(p, "You can only set real names for players below your "
+ "adminlevel.\n");
+
+ if (!connected)
+ player_remove(p1);
+ return COM_OK;
+ }
+
+ if (parray[p1].fullName)
+ rfree(parray[p1].fullName);
+
+ if (param[1].type == TYPE_NULL) {
+ parray[p1].fullName = NULL;
+ pprintf(p, "Real name for %s removed\n", parray[p1].name);
+ } else {
+ parray[p1].fullName = xstrdup(param[1].val.word);
+ pprintf(p, "Real name of %s changed to \"%s\".\n",
+ parray[p1].name,
+ param[1].val.word);
+ }
+
+ player_save(p1);
+
+ if (connected) {
+ if (param[1].type == TYPE_NULL) {
+ pprintf_prompt(p1, "\n\n%s has removed your real name."
+ "\n\n", parray[p].name);
+ } else {
+ pprintf_prompt(p1, "\n\n%s has changed your real name."
+ "\n\n", parray[p].name);
+ }
+ } else {
+ player_remove(p1);
+ }
+
+ return COM_OK;
}
/*