Support added for CC: in netmail

This commit is contained in:
Michiel Broek 2003-11-15 16:36:51 +00:00
parent 099601838d
commit 1cd242c135
10 changed files with 265 additions and 46 deletions

View File

@ -27,6 +27,10 @@ v0.39.1 22-Oct-2003
Fixed a bug where the bbs goes into a loop after idle timeout Fixed a bug where the bbs goes into a loop after idle timeout
during login (and maybe in other situations). during login (and maybe in other situations).
Fixed chat debug logging to only the debug.log file. Fixed chat debug logging to only the debug.log file.
Posted netmail messages now support CC: lines. The CC: lines
should be the first lines of the message in the format:
CC: Michiel Broek 2:280/28
The Carbon Copied messages are marked with original sender.
mbfile: mbfile:
When the areanumber with the adopt command was not given, the When the areanumber with the adopt command was not given, the
@ -58,6 +62,8 @@ v0.39.1 22-Oct-2003
script: script:
Added install scripts for Gentoo. Added install scripts for Gentoo.
lang: Two new language prompts, 21 and 22.
v0.39.0 09-Oct-2003 - 22-Oct-2003 v0.39.0 09-Oct-2003 - 22-Oct-2003

View File

@ -19,8 +19,8 @@
18 user.c |You may only login 18 user.c |You may only login
19 user.c |times at the same time 19 user.c |times at the same time
20 door.c |The door is in use by another user, try again later 20 door.c |The door is in use by another user, try again later
21 .c | 21 mail.c YN| Is this correct [y/N]:
22 .c | 22 mail.c |Could not parse
23 .c | 23 .c |
24 .c | 24 .c |
25 .c | 25 .c |

View File

@ -19,8 +19,8 @@ HR|Exporteer naar (H)ome of (R)egels directory:
|U mag maar |U mag maar
|keer tegelijk inloggen |keer tegelijk inloggen
|De door is in gebruik door een andere gebruiker, probeer het later nog eens |De door is in gebruik door een andere gebruiker, probeer het later nog eens
| JN| Is dit juist [j/N]:
| |Niet te verwerken
| |
| |
| |

View File

@ -19,8 +19,8 @@ HR|Export to (H)ome or (R)ules directory:
|You may only login |You may only login
|times at the same time |times at the same time
|The door is in use by another user, try again later |The door is in use by another user, try again later
| YN| Is this correct [y/N]:
| |Could not parse
| |
| |
| |

View File

@ -19,8 +19,8 @@ HR|Exportar
|You may only login |You may only login
|times at the same time |times at the same time
|The door is in use by another user, try again later |The door is in use by another user, try again later
| YN| Is this correct [y/N]:
| |Could not parse
| |
| |
| |

View File

@ -19,8 +19,8 @@ HR|Export in (H)ome oder (R)ules Direktorie:
|Du darfst nur |Du darfst nur
|mal gleichzeitig eingewaehlt sein |mal gleichzeitig eingewaehlt sein
|The door is in use by another user, try again later |The door is in use by another user, try again later
| YN| Is this correct [y/N]:
| |Could not parse
| |
| |
| |

View File

@ -19,8 +19,8 @@ HR|Export in (H)ome oder (R)ules Direktorie:
|Du darfst nur |Du darfst nur
|mal gleichzeitig eingewaehlt sein |mal gleichzeitig eingewaehlt sein
|The door is in use by another user, try again later |The door is in use by another user, try again later
| YN| Is this correct [y/N]:
| |Could not parse
| |
| |
| |

View File

@ -19,8 +19,8 @@ HR|Export to (H)ome or (R)ules directory:
|You may only login |You may only login
|times at the same time |times at the same time
|The door is in use by another user, try again later |The door is in use by another user, try again later
| YN| Is this correct [y/N]:
| |Could not parse
| |
| |
| |

View File

@ -19,8 +19,8 @@ PR|Exportar al directorio (P)ersonal o de (R)eglas:
|You may only login |You may only login
|times at the same time |times at the same time
|The door is in use by another user, try again later |The door is in use by another user, try again later
| YN| Is this correct [y/N]:
| |Could not parse
| |
| |
| |

View File

@ -86,6 +86,7 @@ int Read_a_Msg(unsigned long Num, int);/* Read a message */
int Export_a_Msg(unsigned long Num);/* Export message to homedir */ int Export_a_Msg(unsigned long Num);/* Export message to homedir */
int ReadPanel(void); /* Read panel bar */ int ReadPanel(void); /* Read panel bar */
int Save_Msg(int, faddr *); /* Save a message */ int Save_Msg(int, faddr *); /* Save a message */
int Save_CC(int, char *); /* Save carbon copy */
void Reply_Msg(int); /* Reply to message */ void Reply_Msg(int); /* Reply to message */
void Delete_MsgNum(unsigned long); /* Delete specified message */ void Delete_MsgNum(unsigned long); /* Delete specified message */
int CheckUser(char *); /* Check if user exists */ int CheckUser(char *); /* Check if user exists */
@ -350,27 +351,27 @@ void Check_Attach(void)
*/ */
void SysopComment(char *Cmt) void SysopComment(char *Cmt)
{ {
unsigned long tmp; unsigned long tmp;
char *temp; char *temp;
FILE *fp; FILE *fp;
tmp = iMsgAreaNumber; tmp = iMsgAreaNumber;
/* /*
* Make sure that the .quote file is empty. * Make sure that the .quote file is empty.
*/ */
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/%s/.quote", CFG.bbs_usersdir, exitinfo.Name); sprintf(temp, "%s/%s/.quote", CFG.bbs_usersdir, exitinfo.Name);
if ((fp = fopen(temp, "w")) != NULL) if ((fp = fopen(temp, "w")) != NULL)
fclose(fp); fclose(fp);
free(temp); free(temp);
SetMsgArea(CFG.iSysopArea -1); SetMsgArea(CFG.iSysopArea -1);
sprintf(Msg.From, "%s", CFG.sysop_name); sprintf(Msg.From, "%s", CFG.sysop_name);
sprintf(Msg.Subject, "%s", Cmt); sprintf(Msg.Subject, "%s", Cmt);
Reply_Msg(FALSE); Reply_Msg(FALSE);
SetMsgArea(tmp); SetMsgArea(tmp);
} }
@ -395,7 +396,7 @@ int Edit_Msg()
*/ */
void Post_Msg() void Post_Msg()
{ {
int i, x; int i, x, cc;
char *FidoNode; char *FidoNode;
faddr *Dest = NULL; faddr *Dest = NULL;
node *Nlent; node *Nlent;
@ -512,13 +513,13 @@ void Post_Msg()
Dest->point = point; Dest->point = point;
colour(CFG.MsgInputColourF, CFG.MsgInputColourB); colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
printf("%s in %s", Nlent->name, Nlent->location); printf("%s in %s", Nlent->name, Nlent->location);
colour(14, 0); /* " Is this correct [y/N]: " */
printf(" Is this correct Y/N: "); pout(YELLOW, BLACK, (char *)Language(21));
colour(CFG.MsgInputColourF, CFG.MsgInputColourB); colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
fflush(stdout); fflush(stdout);
alarm_on(); alarm_on();
if (toupper(Getone()) == 'Y') { if (toupper(Getone()) == Keystroke(21, 0)) {
Enter(1); Enter(1);
sprintf(Msg.ToAddress, "%s", ascfnode(Dest, 0x1f)); sprintf(Msg.ToAddress, "%s", ascfnode(Dest, 0x1f));
x = TRUE; x = TRUE;
@ -532,6 +533,7 @@ void Post_Msg()
} else { } else {
Dest->point = point; Dest->point = point;
printf("\r"); printf("\r");
/* Node not known, continue anayway [y/N]: */
pout(CYAN, BLACK, (char *) Language(241)); pout(CYAN, BLACK, (char *) Language(241));
fflush(stdout); fflush(stdout);
alarm_on(); alarm_on();
@ -588,15 +590,180 @@ void Post_Msg()
Check_Attach(); Check_Attach();
if (Edit_Msg()) if (Edit_Msg()) {
Save_Msg(FALSE, Dest); printf("\n");
fflush(stdout);
if (msgs.Type == NETMAIL) {
/*
* Check for Carbon Copy lines, process them if present.
*/
cc = 0;
for (i = 1; i <= Line; i++) {
if (strncasecmp(Message[i], "cc: ", 4)) {
break;
} else {
cc++;
}
}
Syslog('b', "CC: detected %d", cc);
if (cc) {
/*
* Carbon copies, modify the text to show the presence of CCs.
*/
for (i = Line; i; i--) {
Syslog('b', "%02d: \"%s\"", i, printable(Message[i], 0));
sprintf(Message[i + 1], Message[i]);
}
Line++;
sprintf(Message[1], " +: Original message to %s", ascfnode(Dest, 0x4f));
for (i = 1; i <= Line; i++) {
Syslog('b', "%02d: \"%s\"", i, printable(Message[i], 0));
}
/*
* First sent to original destination
*/
Save_Msg(FALSE, Dest);
/*
* Now sent copies
*/
for (i = 0; i < cc; i++) {
Save_CC(FALSE, Message[i+2]);
}
} else {
Save_Msg(FALSE, Dest);
}
} else {
Save_Msg(FALSE, Dest);
}
printf("\n");
fflush(stdout);
sleep(3);
}
for (i = 0; i < (TEXTBUFSIZE + 1); i++) for (i = 0; i < (TEXTBUFSIZE + 1); i++)
free(Message[i]); free(Message[i]);
} }
/*
* Save a Carbon Copy
* The ccline should have the format "cc: Firstname Lastname z:n/n.p"
*/
int Save_CC(int IsReply, char *ccline)
{
faddr *Dest = NULL;
int i, j, x, rc = FALSE;
char *p, *username;
unsigned short point;
node *Nlent;
Syslog('b', "Save_CC(%s, %s)", IsReply ?"TRUE":"FALSE", ccline);
/*
* Reformat the line and extract username and node
*/
i = 4;
j = strlen(ccline);
while (ccline[i] == ' ')
i++;
while (ccline[j] != ' ')
j--;
Syslog('b', "i=%d, j=%d", i, j);
if (j <= i) {
Syslog('+', "Could not parse %s", printable(ccline, 0));
colour(LIGHTRED, BLACK);
/* Could not parse */
printf("%s \"%s\"\n", Language(22), printable(ccline, 0));
Pause();
return FALSE;
}
username = calloc(j - i + 1, sizeof(char));
strncpy(username, ccline+i, j - i);
Syslog('b', "Username: \"%s\"", printable(username, 0));
while (*(p = username + strlen(username) -1) == ' ')
*p = '\0';
Syslog('b', "Username: \"%s\"", tlcap(printable(username, 0)));
if (strlen(username) == 0) {
Syslog('+', "Could not extract username from %s", printable(ccline, 0));
colour(LIGHTRED, BLACK);
/* Could not parse */
printf("%s \"%s\"\n", Language(22), printable(ccline, 0));
Pause();
return FALSE;
}
if ((Dest = parsefnode(ccline + j)) == NULL) {
Syslog('+', "Could not extract address from %s", printable(ccline, 0));
colour(LIGHTRED, BLACK);
/* Could not parse */
printf("%s \"%s\"\n", Language(22), printable(ccline, 0));
Pause();
return FALSE;
}
Dest->name = tlcap(printable(username, 0));
Syslog('b', "Dest %s", ascfnode(Dest, 0xff));
colour(LIGHTMAGENTA, BLACK);
printf("\nConfirm CC to %s\n", ascfnode(Dest, 0xff));
x = FALSE;
point = Dest->point;
Dest->point = 0;
if (((Nlent = getnlent(Dest)) != NULL) && (Nlent->addr.zone)) {
colour(YELLOW, BLACK);
if (point)
printf("Boss : ");
else
printf("Node : ");
Dest->point = point;
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
printf("%s in %s", Nlent->name, Nlent->location);
/* " Is this correct [y/N]: " */
pout(YELLOW, BLACK, (char *)Language(21));
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
fflush(stdout);
alarm_on();
if (toupper(Getone()) == Keystroke(21, 0)) {
Enter(1);
sprintf(Msg.ToAddress, "%s", ascfnode(Dest, 0x1f));
x = TRUE;
switch (Crash_Option(Dest)) {
case 1: Msg.Crash = TRUE;
break;
case 2: Msg.Immediate = TRUE;
break;
}
}
} else {
Dest->point = point;
printf("\n");
/* Node not known, continue anayway [y/N]: */
pout(CYAN, BLACK, (char *) Language(241));
fflush(stdout);
alarm_on();
if (toupper(Getone()) == Keystroke(241, 0)) {
x = TRUE;
Syslog('+', "Node %s not found, forced continue", ascfnode(Dest, 0x0f));
}
}
if (x) {
printf("\n");
fflush(stdout);
rc = Save_Msg(IsReply, Dest);
}
tidy_faddr(Dest);
free(username);
return rc;
}
/* /*
* Save the message to disk. * Save the message to disk.
*/ */
@ -606,7 +773,7 @@ int Save_Msg(int IsReply, faddr *Dest)
char *temp; char *temp;
FILE *fp; FILE *fp;
if (Line < 2) if ((Line < 2) || (Dest == NULL))
return TRUE; return TRUE;
if (!Open_Msgbase(msgs.Base, 'w')) if (!Open_Msgbase(msgs.Base, 'w'))
@ -654,9 +821,8 @@ int Save_Msg(int IsReply, faddr *Dest)
colour(CFG.HiliteF, CFG.HiliteB); colour(CFG.HiliteF, CFG.HiliteB);
/* Saving message to disk */ /* Saving message to disk */
printf("\n%s(%ld)\n\n", (char *) Language(202), Msg.Id); printf("%s(%ld)\n", (char *) Language(202), Msg.Id);
fflush(stdout); fflush(stdout);
sleep(2);
msgs.LastPosted = time(NULL); msgs.LastPosted = time(NULL);
msgs.Posted.total++; msgs.Posted.total++;
@ -1276,7 +1442,7 @@ int ReadPanel()
*/ */
void Reply_Msg(int IsReply) void Reply_Msg(int IsReply)
{ {
int i, j, x; int i, j, x, cc;
char to[65], from[65], subj[73], msgid[81], replyto[81], replyaddr[81], *tmp, *buf, qin[6]; char to[65], from[65], subj[73], msgid[81], replyto[81], replyaddr[81], *tmp, *buf, qin[6];
faddr *Dest = NULL; faddr *Dest = NULL;
@ -1438,8 +1604,55 @@ void Reply_Msg(int IsReply)
free(tmp); free(tmp);
} }
if (Edit_Msg()) if (Edit_Msg()) {
Save_Msg(IsReply, Dest); printf("\n");
fflush(stdout);
if (msgs.Type == NETMAIL) {
/*
* Check for Carbon Copy lines, process them if present.
*/
cc = 0;
for (i = 1; i <= Line; i++) {
if (strncasecmp(Message[i], "cc: ", 4)) {
break;
} else {
cc++;
}
}
Syslog('b', "CC: detected %d", cc);
if (cc) {
/*
* Carbon copies, modify the text to show the presence of CCs.
*/
for (i = Line; i; i--) {
Syslog('b', "%02d: \"%s\"", i, printable(Message[i], 0));
sprintf(Message[i + 1], Message[i]);
}
Line++;
sprintf(Message[1], " +: Original message to %s", ascfnode(Dest, 0x4f));
for (i = 1; i <= Line; i++) {
Syslog('b', "%02d: \"%s\"", i, printable(Message[i], 0));
}
/*
* First sent to original destination
*/
Save_Msg(IsReply, Dest);
/*
* Now sent copies
*/
for (i = 0; i < cc; i++) {
Save_CC(IsReply, Message[i+2]);
}
} else {
Save_Msg(IsReply, Dest);
}
} else {
Save_Msg(IsReply, Dest);
}
printf("\n");
fflush(stdout);
sleep(3);
}
for (i = 0; i < (TEXTBUFSIZE + 1); i++) for (i = 0; i < (TEXTBUFSIZE + 1); i++)
free(Message[i]); free(Message[i]);