Skip to content

Commit e258bb7

Browse files
authored
Merge pull request #1643 from wwivbbs/fix-multmail-1636
Fix #1636 - adding/deleting/listing user list for multi-email
2 parents 76bac1a + 9f9c110 commit e258bb7

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

bbs/multmail.cpp

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,16 @@ void add_list(int *pnUserNumber, int *numu, int maxu, int allowdup) {
274274
bout.nl();
275275
bout.outstr("Already in list, not added.\r\n\n");
276276
i = 0;
277+
break;
277278
}
278-
if (i) {
279-
pnUserNumber[(*numu)++] = i;
280-
}
281-
}
279+
}
280+
if (i) {
281+
pnUserNumber[(*numu)++] = i;
282+
}
283+
} else {
284+
if (i) {
285+
pnUserNumber[(*numu)++] = i;
286+
}
282287
}
283288
}
284289
}
@@ -291,7 +296,7 @@ void add_list(int *pnUserNumber, int *numu, int maxu, int allowdup) {
291296
#define MAX_LIST 40
292297

293298
void slash_e() {
294-
int user_number[MAX_LIST], numu, i;
299+
int user_number[MAX_LIST]={}, numu, i;
295300
char s[81],*sss;
296301

297302
mml_s = nullptr;
@@ -315,7 +320,7 @@ void slash_e() {
315320
numu = 0;
316321
do {
317322
bout.nl(2);
318-
bout.outstr("|#2Multi-Mail: A,M,D,L,E,Q,? : ");
323+
bout.print("|#2Multi-Mail: List: {} : A,M,D,L,E,Q,? : ",numu);
319324
switch (char ch = onek("QAMDEL?"); ch) {
320325
case '?':
321326
bout.printfile(MMAIL_NOEXT);
@@ -325,9 +330,11 @@ void slash_e() {
325330
break;
326331
case 'A':
327332
bout.nl();
328-
bout.outstr("Enter names/numbers for users, one per line, max 20.\r\n\n");
333+
bout.print("Enter names/numbers for users, one per line, max {}.\r\n\n",MAX_LIST);
329334
mml_s = nullptr;
330-
add_list(user_number, &numu, MAX_LIST, so());
335+
//add_list(user_number, &numu, MAX_LIST, so());
336+
add_list(user_number, &numu, MAX_LIST, 0); // do we really want sysops
337+
// to be able to add dupe entries?
331338
break;
332339
case 'M': {
333340
FindFiles ff(FilePath(a()->config()->datadir(), "*.mml"), FindFiles::FindFilesType::any);
@@ -351,7 +358,6 @@ void slash_e() {
351358
bout.nl();
352359
bout.outstr("|#2Which? ");
353360
bin.input(s, 8);
354-
355361
File fileMailList(FilePath(a()->config()->datadir(), s));
356362
if (!fileMailList.Open(File::modeBinary | File::modeReadOnly)) {
357363
bout.nl();
@@ -383,6 +389,12 @@ void slash_e() {
383389
break;
384390
case 'D':
385391
if (numu) {
392+
bout.nl();
393+
for (i = 0; i < numu; i++) {
394+
User user;
395+
a()->users()->readuser(&user, user_number[i]);
396+
bout.print("{}. {}\r\n", i + 1, a()->names()->UserName(user_number[i]));
397+
}
386398
bout.nl();
387399
bout.outstr("|#2Delete which? ");
388400
bin.input(s, 2);
@@ -396,6 +408,7 @@ void slash_e() {
396408
}
397409
break;
398410
case 'L':
411+
bout.nl();
399412
for (i = 0; i < numu; i++) {
400413
User user;
401414
a()->users()->readuser(&user, user_number[i]);

0 commit comments

Comments
 (0)