diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-29 01:26:53 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-29 01:26:53 +0100 |
commit | caef86417600b54ed00224db296528afe8bfa874 (patch) | |
tree | 644d80c1c8e78ac9b4ea3f56a1a75f8f65631357 /FICS | |
parent | 879ab52d0bc65747a41d27a0c3cb07717d614715 (diff) |
Reformatted ClearMsgsBySender()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/playerdb.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c index a27c84b..83bc036 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -2103,32 +2103,39 @@ PRIVATE int WriteMsgFile (int p, textlist *Head) return 1; } -PUBLIC int ClearMsgsBySender(int p, param_list param) +PUBLIC int +ClearMsgsBySender(int p, param_list param) { - textlist *Head; - int p1, connected; - int nFound; + int nFound; + int p1, connected; + textlist *Head; - if (!FindPlayer(p, param[0].val.word, &p1, &connected)) - return -1; + if (!FindPlayer(p, param[0].val.word, &p1, &connected)) + return -1; - nFound = LoadMsgs(p, -(p1+1), &Head); - if (nFound < 0) { - pprintf(p, "You have no messages.\n"); - } else if (nFound == 0) { - pprintf(p, "You have no messages from %s.\n", parray[p1].name); - } else { - if (WriteMsgFile (p, Head)) - pprintf(p, "Messages from %s cleared.\n", parray[p1].name); - else { - pprintf(p, "Problem writing message file; please contact an admin.\n"); - fprintf(stderr, "Problem writing message file for %s.\n", parray[p].name); - } - ClearTextList(Head); - } - if (!connected) - player_remove(p1); - return nFound; + nFound = LoadMsgs(p, -(p1 + 1), &Head); + + if (nFound < 0) { + pprintf(p, "You have no messages.\n"); + } else if (nFound == 0) { + pprintf(p, "You have no messages from %s.\n", parray[p1].name); + } else { + if (WriteMsgFile (p, Head)) { + pprintf(p, "Messages from %s cleared.\n", + parray[p1].name); + } else { + pprintf(p, "Problem writing message file; " + "please contact an admin.\n"); + fprintf(stderr, "Problem writing message file for " + "%s.\n", parray[p].name); + } + + ClearTextList(Head); + } + + if (!connected) + player_remove(p1); + return nFound; } PRIVATE void |