Fix a bunch of quoteing bugs
This commit is contained in:
parent
f4c234073a
commit
14ecc81951
2
bbs.h
2
bbs.h
@ -211,7 +211,7 @@ extern struct msg_headers *read_message_headers(int msgconf, int msgarea, struct
|
||||
extern void mail_scan(struct user_record *user);
|
||||
extern int mail_menu(struct user_record *user);
|
||||
extern char *editor(struct user_record *user, char *quote, char *from, int email);
|
||||
extern char *external_editor(struct user_record *user, char *to, char *from, char *quote, char *qfrom, char *subject, int email);
|
||||
extern char *external_editor(struct user_record *user, char *to, char *from, char *quote, int qlen, char *qfrom, char *subject, int email);
|
||||
extern int msg_is_to(struct user_record *user, char *addressed_to, char *address, int type, int rn, int msgconf);
|
||||
extern int msg_is_from(struct user_record *user, char *addressed_from, char *address, int type, int rn, int msgconf);
|
||||
extern unsigned long generate_msgid();
|
||||
|
4
email.c
4
email.c
@ -59,7 +59,7 @@ void send_email(struct user_record *user) {
|
||||
subject = strdup(buffer);
|
||||
|
||||
// post a message
|
||||
msg = external_editor(user, user->loginname, recipient, NULL, NULL, subject, 1);
|
||||
msg = external_editor(user, user->loginname, recipient, NULL, 0, NULL, subject, 1);
|
||||
|
||||
if (msg != NULL) {
|
||||
sprintf(buffer, "%s/email.sq3", conf.bbs_path);
|
||||
@ -276,7 +276,7 @@ void show_email(struct user_record *user, int msgno, int email_count, struct ema
|
||||
subject = (char *)malloc(strlen(buffer) + 1);
|
||||
strcpy(subject, buffer);
|
||||
|
||||
replybody = external_editor(user, user->loginname, emails[msgno]->from, emails[msgno]->body, emails[msgno]->from, subject, 1);
|
||||
replybody = external_editor(user, user->loginname, emails[msgno]->from, emails[msgno]->body, strlen(emails[msgno]->body), emails[msgno]->from, subject, 1);
|
||||
if (replybody != NULL) {
|
||||
sprintf(buffer, "%s/email.sq3", conf.bbs_path);
|
||||
|
||||
|
10
mail_menu.c
10
mail_menu.c
@ -396,7 +396,7 @@ struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_r
|
||||
return msghs;
|
||||
}
|
||||
|
||||
char *external_editor(struct user_record *user, char *to, char *from, char *quote, char *qfrom, char *subject, int email) {
|
||||
char *external_editor(struct user_record *user, char *to, char *from, char *quote, int qlen, char *qfrom, char *subject, int email) {
|
||||
char c;
|
||||
FILE *fptr;
|
||||
char *body = NULL;
|
||||
@ -432,7 +432,7 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
|
||||
// write msgtemp
|
||||
if (quote != NULL) {
|
||||
fptr = fopen(buffer, "w");
|
||||
for (i=0;i<strlen(quote);i++) {
|
||||
for (i=0;i<qlen;i++) {
|
||||
if (quote[i] == '\r') {
|
||||
fprintf(fptr, "\r\n");
|
||||
} else if (quote[i] == 0x1) {
|
||||
@ -440,7 +440,7 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
|
||||
} else if (quote[i] == '\e' && quote[i + 1] == '[') {
|
||||
while (strchr("ABCDEFGHIGJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", quote[i]) == NULL)
|
||||
i++;
|
||||
} else {
|
||||
} else if (quote[i] != '\n') {
|
||||
fprintf(fptr, "%c", quote[i]);
|
||||
}
|
||||
}
|
||||
@ -1633,7 +1633,7 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn
|
||||
to = (char *)malloc(strlen(buffer) + 1);
|
||||
strcpy(to, buffer);
|
||||
}
|
||||
replybody = external_editor(user, to, from, body, msghs->msgs[mailno]->from, subject, 0);
|
||||
replybody = external_editor(user, to, from, body, z2, msghs->msgs[mailno]->from, subject, 0);
|
||||
if (replybody != NULL) {
|
||||
|
||||
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
|
||||
@ -2096,7 +2096,7 @@ int mail_menu(struct user_record *user) {
|
||||
from = (char *)malloc(strlen(user->firstname) + strlen(user->lastname) + 2);
|
||||
sprintf(from, "%s %s", user->firstname, user->lastname);
|
||||
}
|
||||
msg = external_editor(user, to, from, NULL, NULL, subject, 0);
|
||||
msg = external_editor(user, to, from, NULL, 0, NULL, subject, 0);
|
||||
|
||||
free(from);
|
||||
|
||||
|
@ -206,7 +206,7 @@ char *message_editor() {
|
||||
q_done = 0;
|
||||
q_marker = ' ';
|
||||
while (!q_done) {
|
||||
for (i=q_start;i<q_start + 20 && i < quote_line_count;i++) {
|
||||
for (i=q_start;i<q_start + 21 && i < quote_line_count;i++) {
|
||||
q_marker = ' ';
|
||||
for (j=0;j<q_line_count;j++) {
|
||||
if (q_lines[j] == i) {
|
||||
@ -233,7 +233,7 @@ char *message_editor() {
|
||||
q_position = 0;
|
||||
}
|
||||
if (q_position < q_start) {
|
||||
q_start = q_start - 20;
|
||||
q_start = q_start - 21;
|
||||
if (q_start < 0) {
|
||||
q_start = 0;
|
||||
}
|
||||
@ -244,10 +244,10 @@ char *message_editor() {
|
||||
q_position = quote_line_count - 1;
|
||||
}
|
||||
|
||||
if (q_position > q_start + 20) {
|
||||
q_start = q_start + 20;
|
||||
if (q_start + 20 >= quote_line_count) {
|
||||
q_start = quote_line_count - 20;
|
||||
if (q_position >= q_start + 21) {
|
||||
q_start = q_start + 21;
|
||||
if (q_start + 21 >= quote_line_count) {
|
||||
q_start = quote_line_count - 21;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,6 +310,7 @@ char *message_editor() {
|
||||
|
||||
}
|
||||
// restore screen
|
||||
od_set_color(L_WHITE, D_BLACK);
|
||||
od_clr_scr();
|
||||
od_set_cursor(1, 1);
|
||||
od_set_color(L_WHITE, D_BLUE);
|
||||
@ -331,7 +332,7 @@ char *message_editor() {
|
||||
}
|
||||
od_clr_line();
|
||||
}
|
||||
|
||||
position_x = 0;
|
||||
memset(line, 0, 81);
|
||||
od_set_cursor(position_y + 3, position_x + 1);
|
||||
} else {
|
||||
@ -707,7 +708,7 @@ int main(int argc, char **argv)
|
||||
if (!noquote) {
|
||||
fgets(buffer, 73, fptr);
|
||||
while (!feof(fptr)) {
|
||||
for (i=strlen(buffer) - 1; i > 0; i--) {
|
||||
for (i=strlen(buffer) - 1; i >= 0; i--) {
|
||||
if (buffer[i] != '\r' && buffer[i] != '\n') {
|
||||
break;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user