aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/obsproc.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-04-17 03:50:49 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-04-17 03:50:49 +0200
commit73ab7a6235ee93b845d000080a3f5fc299113078 (patch)
tree0c5f8f9b87e9de7ea41d9d465554c2b0efe7cfb5 /FICS/obsproc.c
parent016b0bc138027d79be0bca23357a3b585d57839c (diff)
Revised com_journal()
Diffstat (limited to 'FICS/obsproc.c')
-rw-r--r--FICS/obsproc.c64
1 files changed, 36 insertions, 28 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c
index 3abe6af..dadcda6 100644
--- a/FICS/obsproc.c
+++ b/FICS/obsproc.c
@@ -1375,37 +1375,45 @@ PUBLIC int com_history(int p, param_list param)
return COM_OK;
}
-PUBLIC int com_journal(int p, param_list param)
+PUBLIC int
+com_journal(int p, param_list param)
{
- int p1, connected;
- char fname[MAX_FILENAME_SIZE];
+ char fname[MAX_FILENAME_SIZE];
+ int p1, connected;
- if (param[0].type == TYPE_WORD) {
- if (!FindPlayer(p, param[0].val.word, &p1, &connected))
- return COM_OK;
- } else {
- p1 = p;
- connected = 1;
- }
+ if (param[0].type == TYPE_WORD) {
+ if (!FindPlayer(p, param[0].val.word, &p1, &connected))
+ return COM_OK;
+ } else {
+ p1 = p;
+ connected = 1;
+ }
-if (!parray[p1].registered) {
- pprintf (p,"Only registered players may keep a journal.\n");
- if (!connected)
- player_remove(p1);
- return COM_OK;
- }
- if ((parray[p1].jprivate) && (p != p1) && (parray[p].adminLevel < ADMIN_ADMIN)) {
- pprintf (p,"Sorry, this journal is private.\n");
- if (!connected)
- player_remove(p1);
- return COM_OK;
- }
- sprintf(fname, "%s/player_data/%c/%s.%s", stats_dir, parray[p1].login[0],
- parray[p1].login, STATS_JOURNAL);
- pjournal(p, p1, fname);
- if (!connected)
- player_remove(p1);
- return COM_OK;
+ if (!parray[p1].registered) {
+ pprintf(p, "Only registered players may keep a journal.\n");
+
+ if (!connected)
+ player_remove(p1);
+ return COM_OK;
+ }
+
+ if (parray[p1].jprivate &&
+ p != p1 &&
+ parray[p].adminLevel < ADMIN_ADMIN) {
+ pprintf(p, "Sorry, this journal is private.\n");
+
+ if (!connected)
+ player_remove(p1);
+ return COM_OK;
+ }
+
+ msnprintf(fname, sizeof fname, "%s/player_data/%c/%s.%s", stats_dir,
+ parray[p1].login[0], parray[p1].login, STATS_JOURNAL);
+ pjournal(p, p1, fname);
+
+ if (!connected)
+ player_remove(p1);
+ return COM_OK;
}
PRIVATE void