strip ansi codes from www reply

This commit is contained in:
Andrew Pamment 2018-04-20 16:20:05 +10:00
parent a300b001f8
commit 08c01c58c8

View File

@ -272,6 +272,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
char *replyid = NULL;
char *body = NULL;
char *body2 = NULL;
char *replybody = NULL;
int z;
struct tm msg_date;
time_t date;
@ -284,7 +285,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
char *from_s;
char *subject_s;
char *to_s;
int l1, l2;
char *aha_text;
char *aha_out;
@ -610,13 +611,26 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
strcat(page, buffer);
len += strlen(buffer);
replybody = (char *)malloc(strlen(body) + 1);
l2 = 0;
for (l1=0;l1<strlen(body);l1++){
if (body[l1] == '\e' && body[l1+1] == '[') {
while (strchr("ABCDEFGHIGJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", body[l1]) == NULL && l1 < strlen(body))
l1++;
}
replybody[l2++] = body[l1];
replybody[l2] ='\0';
}
free(body);
chars = 0;
body2 = www_wordwrap(body, 69);
body2 = www_wordwrap(replybody, 69);
if (body2 == NULL) {
body2 = body;
body2 = replybody;
} else {
free(body);
free(replybody);
}
for (i=0;i<strlen(body2);i++) {