-
Notifications
You must be signed in to change notification settings - Fork 1
/
log2.cpp
163 lines (131 loc) · 3.14 KB
/
log2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// --------------------------------------------------------------------------
// Citadel: Log2.CPP
//
// User create and kill code
#include "ctdl.h"
#pragma hdrstop
#include "log.h"
#include "extmsg.h"
// --------------------------------------------------------------------------
// Contents
//
// purgeuserlog() From oldest to newest, prompt to kill each entry
// killuser() sysop special to kill a log entry
// --------------------------------------------------------------------------
// purgeuserlog(): From oldest to newest, prompt to kill each entry.
//
// Notes:
// Assumes MSG_SYSOP is locked.
void TERMWINDOWMEMBER purgeuserlog(void)
{
Bool done = FALSE;
for (l_slot i = (l_slot) (cfg.MAXLOGTAB - 1); i >= 0 && !done; i--)
{
if (LTab(i).IsInuse())
{
label UserName;
LTab(i).GetName(UserName, sizeof(UserName));
if (!loggedIn || !CurrentUser->IsSameName(UserName))
{
char prompt[256];
sprintf(prompt, getsysmsg(57), cfg.Luser_nym, UserName);
const int response = getYesNo(prompt, 3);
if (response == 1)
{
LogEntry1 Log1;
Log1.Clear();
if (Log1.Save(LTab(i).GetLogIndex()))
{
if(!read_tr_messages())
{
errorDisp(getmsg(172));
done = TRUE;
return;
}
#ifdef WINCIT
trap(T_SYSOP, WindowCaption, gettrmsg(16), UserName);
#else
trap(T_SYSOP, gettrmsg(16), UserName);
#endif
dump_tr_messages();
}
}
else if (response == 2)
{
done = TRUE;
}
}
}
}
}
// --------------------------------------------------------------------------
// killuser(): Sysop special to kill a log entry.
Bool TERMWINDOWMEMBER killuser(const char *name)
{
label who;
l_slot logno;
char line[80];
if (!name)
{
SetDoWhat(SYSKUSER);
}
if (name)
{
CopyStringToBuffer(who, name);
}
else
{
getNormStr(cfg.Luser_nym, who, LABELSIZE);
}
if (!*who)
{
return (FALSE);
}
logno = FindPersonByPartialName(who);
if (logno == CERROR)
{
if (!name)
{
mPrintfCR(getmsg(595), who);
}
return (FALSE);
}
LTab(logno).GetName(who, sizeof(who));
if (loggedIn && CurrentUser->IsSameName(who))
{
if (!name)
{
mPrintfCR(getsysmsg(83));
}
return (FALSE);
}
sprintf(line, getsysmsg(84), cfg.Luser_nym, who);
if (!name && !getYesNo(line, 0))
{
return (FALSE);
}
else
{
LogEntry1 Log1;
if (!name)
{
CRmPrintfCR(getsysmsg(85), who);
}
Log1.Clear();
if (Log1.Save(LTab(logno).GetLogIndex()))
{
if(!(read_tr_messages()))
{
errorDisp(getmsg(172));
return(FALSE);
}
#ifdef WINCIT
trap(T_SYSOP, WindowCaption, gettrmsg(16), who);
#else
trap(T_SYSOP, gettrmsg(16), who);
#endif
dump_tr_messages();
}
return (TRUE);
}
}