From 32fa822e6d8d61aa9c487dc150b36c225a5d3973 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 20 Aug 2016 21:19:11 +1000 Subject: [PATCH] Add message quoting --- www_email.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++--- www_msgs.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 128 insertions(+), 5 deletions(-) diff --git a/www_email.c b/www_email.c index 580dd98..5825875 100644 --- a/www_email.c +++ b/www_email.c @@ -227,6 +227,7 @@ char *www_email_display(struct user_record *user, int email) { char *body; int id; int i; + int chars; char *err_msg = 0; char *email_create_sql = "CREATE TABLE IF NOT EXISTS email (" "id INTEGER PRIMARY KEY," @@ -328,7 +329,14 @@ char *www_email_display(struct user_record *user, int email) { } strcat(page, buffer); len += strlen(buffer); - + sprintf(buffer, "
\n"); + if (len + strlen(buffer) > max_len - 1) { + max_len += 4096; + page = (char *)realloc(page, max_len); + } + strcat(page, buffer); + len += strlen(buffer); + for (i=0;i"); @@ -342,7 +350,14 @@ char *www_email_display(struct user_record *user, int email) { strcat(page, buffer); len += strlen(buffer); } - + sprintf(buffer, "
\n"); + if (len + strlen(buffer) > max_len - 1) { + max_len += 4096; + page = (char *)realloc(page, max_len); + } + strcat(page, buffer); + len += strlen(buffer); + sprintf(buffer, "
\n"); if (len + strlen(buffer) > max_len - 1) { max_len += 4096; @@ -386,7 +401,52 @@ char *www_email_display(struct user_record *user, int email) { strcat(page, buffer); len += strlen(buffer); - sprintf(buffer, "\n
"); + sprintf(buffer, "\n
"); if (len + strlen(buffer) > max_len - 1) { max_len += 4096; page = (char *)realloc(page, max_len); diff --git a/www_msgs.c b/www_msgs.c index fbc0e74..f33290c 100644 --- a/www_msgs.c +++ b/www_msgs.c @@ -205,7 +205,8 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i int max_len; int len; char buffer[4096]; - + int chars; + int i; if (conference < 0 || conference >= conf.mail_conference_count || area < 0 || area >= conf.mail_conferences[conference]->mail_area_count) { return NULL; } @@ -384,6 +385,13 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i } strcat(page, buffer); len += strlen(buffer); + sprintf(buffer, "
\n"); + if (len + strlen(buffer) > max_len - 1) { + max_len += 4096; + page = (char *)realloc(page, max_len); + } + strcat(page, buffer); + len += strlen(buffer); for (z=0;z\n"); + if (len + strlen(buffer) > max_len - 1) { + max_len += 4096; + page = (char *)realloc(page, max_len); + } + strcat(page, buffer); + len += strlen(buffer); + free(body); sprintf(buffer, "
\n"); @@ -468,7 +485,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i strcat(page, buffer); len += strlen(buffer); - sprintf(buffer, "\n
"); + sprintf(buffer, "\n
"); + if (len + strlen(buffer) > max_len - 1) { + max_len += 4096; + page = (char *)realloc(page, max_len); + } + strcat(page, buffer); + len += strlen(buffer); + + sprintf(buffer, "\n
"); if (len + strlen(buffer) > max_len - 1) { max_len += 4096;