Finished work converting www pages

This commit is contained in:
Andrew Pamment 2018-10-22 16:14:13 +10:00
parent d4e80de397
commit 3dab626285
4 changed files with 1257 additions and 752 deletions

1
deps/aha/aha.c vendored
View File

@ -402,7 +402,6 @@ struct www_tag * aha(char *input, struct www_tag *parent)
} }
} }
break; break;
default: { default: {
stralloc_append1(&data, c); stralloc_append1(&data, c);
break; break;

View File

@ -5,9 +5,11 @@
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include "www_tree.h"
#include "bbs.h" #include "bbs.h"
extern struct bbs_config conf; extern struct bbs_config conf;
extern struct www_tag * aha(char *input, struct www_tag *parent);
int www_email_delete(struct user_record *user, int id) { int www_email_delete(struct user_record *user, int id) {
char buffer[PATH_MAX]; char buffer[PATH_MAX];
@ -88,23 +90,14 @@ int www_send_email(struct user_record *user, char *recipient, char *subject, cha
uname(&name); uname(&name);
for (char *p = ibody; *p != '\0'; ++p) for (char *p = ibody; *p != '\0'; ++p) {
if (*p != '\n') if (*p == 0xc2 && *(p+1) == 0xa0) {
stralloc_append1(&sa, ' ');
p++;
} else if (*p != '\n') {
stralloc_append1(&sa, *p); stralloc_append1(&sa, *p);
}
stralloc_cats(&sa, "\r--- MagickaBBS v"); }
stralloc_cat_long(&sa, VERSION_MAJOR);
stralloc_append1(&sa, '.');
stralloc_cat_long(&sa, VERSION_MINOR);
stralloc_cats(&sa, VERSION_STR);
stralloc_cats(&sa, " (");
stralloc_cats(&sa, name.sysname);
stralloc_append1(&sa, '/');
stralloc_cats(&sa, name.machine);
stralloc_cats(&sa, ")\r");
stralloc_cats(&sa, " * Origin: ");
stralloc_cats(&sa, conf.default_tagline);
stralloc_cats(&sa, " \r");
stralloc_0(&sa); stralloc_0(&sa);
body = sa.s; body = sa.s;
@ -147,24 +140,94 @@ int www_send_email(struct user_record *user, char *recipient, char *subject, cha
} }
char *www_new_email() { char *www_new_email() {
stralloc page = EMPTY_STRALLOC; struct www_tag *page = www_tag_new(NULL, "");
struct www_tag *cur_tag;
struct www_tag *child_tag;
struct www_tag *child_child_tag;
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Email");
www_tag_add_child(child_tag, child_child_tag);
stralloc_copys(&page, "<div class=\"content-header\"><h2>New Email</h2></div>\n"); cur_tag = www_tag_new("form", NULL);
stralloc_cats(&page, "<form action=\"");
stralloc_cats(&page, conf.www_url); stralloc url = EMPTY_STRALLOC;
stralloc_cats(&page, "email/\" method=\"POST\" onsubmit=\"return validate()\" enctype=\"application/x-www-form-urlencoded\">\n");
stralloc_cats(&page, "To : <input type=\"text\" name=\"recipient\" id=\"recipient\" /><br />\n");
stralloc_cats(&page, "Subject : <input type=\"text\" name=\"subject\" id=\"subject\" /><br />\n");
stralloc_cats(&page, "<textarea name=\"body\" wrap=\"hard\" rows=\"25\" cols=\"79\" id=\"body\"></textarea>\n<br />");
stralloc_cats(&page, "<input type=\"submit\" name=\"submit\" value=\"Send\" />\n<br />");
stralloc_cats(&page, "</form>\n");
stralloc_0(&page);
return page.s; stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/");
stralloc_0(&url);
www_tag_add_attrib(cur_tag, "action", url.s);
free(url.s);
www_tag_add_attrib(cur_tag, "method", "POST");
www_tag_add_attrib(cur_tag, "onsubmit", "return validate()");
www_tag_add_attrib(cur_tag, "enctype", "application/x-www-form-urlencoded");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new(NULL, "To : ");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "text");
www_tag_add_attrib(child_tag, "name", "recipient");
www_tag_add_attrib(child_tag, "id", "recipient");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new(NULL, "Subject : ");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "text");
www_tag_add_attrib(child_tag, "name", "subject");
www_tag_add_attrib(child_tag, "id", "subject");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("textarea", NULL);
www_tag_add_attrib(child_tag, "name", "body");
www_tag_add_attrib(child_tag, "wrap", "hard");
www_tag_add_attrib(child_tag, "rows", "25");
www_tag_add_attrib(child_tag, "cols", "79");
www_tag_add_attrib(child_tag, "id", "body");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "");
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "submit");
www_tag_add_attrib(child_tag, "name", "submit");
www_tag_add_attrib(child_tag, "value", "Send");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
return www_tag_unwravel(page);
} }
char *www_email_display(struct user_record *user, int email) { char *www_email_display(struct user_record *user, int email) {
stralloc page = EMPTY_STRALLOC; struct www_tag *page;
struct www_tag *cur_tag;
struct www_tag *child_tag;
struct www_tag *child_child_tag;
struct www_tag *child_child_child_tag;
char pathbuf[PATH_MAX]; char pathbuf[PATH_MAX];
char datebuf[32]; char datebuf[32];
sqlite3 *db; sqlite3 *db;
@ -216,7 +279,19 @@ char *www_email_display(struct user_record *user, int email) {
sqlite3_bind_int(res, 2, email - 1); sqlite3_bind_int(res, 2, email - 1);
if (sqlite3_step(res) != SQLITE_ROW) { if (sqlite3_step(res) != SQLITE_ROW) {
return strdup("<div class=\"content-header\"><h2>No Such Email</h2></div>\n"); page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "No such email!");
www_tag_add_child(child_tag, child_child_tag);
return www_tag_unwravel(page);
} }
id = sqlite3_column_int(res, 0); id = sqlite3_column_int(res, 0);
from = (char *)sqlite3_column_text(res, 1); from = (char *)sqlite3_column_text(res, 1);
@ -225,74 +300,161 @@ char *www_email_display(struct user_record *user, int email) {
date = (time_t)sqlite3_column_int(res, 4); date = (time_t)sqlite3_column_int(res, 4);
localtime_r(&date, &msg_date); localtime_r(&date, &msg_date);
stralloc_copys(&page, "<div class=\"content-header\"><h2>Your Email</h2></div>\n"); page = www_tag_new(NULL, "");
stralloc_cats(&page, "<div class=\"email-view-header\">\n");
stralloc_cats(&page, "<div class=\"email-view-subject\">"); cur_tag = www_tag_new("div", NULL);
stralloc_cats(&page, subject); www_tag_add_attrib(cur_tag, "class", "content-header");
stralloc_cats(&page, "</div>\n"); www_tag_add_child(page, cur_tag);
stralloc_cats(&page, "<div class=\"email-view-from\">From: ");
stralloc_cats(&page, from); child_tag = www_tag_new("h2", NULL);
stralloc_cats(&page, "</div>\n"); www_tag_add_child(cur_tag, child_tag);
stralloc_cats(&page, "<div class=\"email-view-date\">Date: ");
child_child_tag = www_tag_new(NULL, "Your Email");
www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "email-view-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-subject");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, subject);
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-from");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, from);
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-date");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Date: ");
www_tag_add_child(child_tag, child_child_tag);
if (conf.date_style == 1) if (conf.date_style == 1)
strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date); strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
else else
strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date); strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
stralloc_cats(&page, datebuf);
stralloc_cats(&page, "</div>\n"); child_child_tag = www_tag_new(NULL, datebuf);
stralloc_cats(&page, "</div>\n"); www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, "<div id=\"msgbody\">\n");
for (char *p = body; *p != '\0'; ++p) { cur_tag = www_tag_new("div", NULL);
switch (*p) { www_tag_add_attrib(cur_tag, "id", "msgbody");
case '\r': stralloc_cats(&page, "<br />"); break; www_tag_add_child(page, cur_tag);
case '<': stralloc_cats(&page, "&lt;"); break;
case '>': stralloc_cats(&page, "&gt;"); break; aha(body, cur_tag);
default: stralloc_append1(&page, *p); break;
} cur_tag = www_tag_new("div", NULL);
} www_tag_add_attrib(cur_tag, "class", "email-reply-form");
stralloc_cats(&page, "</div>\n"); www_tag_add_child(page, cur_tag);
stralloc_cats(&page, "<div class=\"email-reply-form\">\n");
stralloc_cats(&page, "<h3>Reply</h3>\n"); child_tag = www_tag_new("h3", NULL);
stralloc_cats(&page, "<form action=\""); www_tag_add_child(cur_tag, child_tag);
stralloc_cats(&page, conf.www_url);
stralloc_cats(&page, "email/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n"); child_child_tag = www_tag_new(NULL, "Reply");
stralloc_cats(&page, "<input type=\"hidden\" name=\"recipient\" value=\""); www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, from);
stralloc_cats(&page, "\" />\n"); child_tag = www_tag_new("form", NULL);
stralloc_cats(&page, "Subject : <input type=\"text\" name=\"subject\" value=\"");
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/");
stralloc_0(&url);
www_tag_add_attrib(child_tag, "action", url.s);
free(url.s);
www_tag_add_attrib(child_tag, "method", "POST");
www_tag_add_attrib(child_tag, "enctype", "application/x-www-form-urlencoded");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "hidden");
www_tag_add_attrib(child_child_tag, "name", "recipient");
www_tag_add_attrib(child_child_tag, "value", from);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, "Subject : ");
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "text");
www_tag_add_attrib(child_child_tag, "name", "subject");
stralloc subj = EMPTY_STRALLOC;
if (strncasecmp(subject, "re:", 3) != 0) if (strncasecmp(subject, "re:", 3) != 0)
stralloc_cats(&page, "RE: "); stralloc_cats(&subj, "RE: ");
stralloc_cats(&page, subject); stralloc_cats(&subj, subject);
stralloc_cats(&page, "\" /><br />\n"); stralloc_0(&subj);
stralloc_cats(&page, "<textarea name=\"body\" wrap=\"hard\" rows=\"25\" cols=\"79\" id=\"replybody\">"); www_tag_add_attrib(child_child_tag, "value", subj.s);
stralloc_cats(&page, from); free(subj.s);
stralloc_cats(&page, " said....\n\n");
stralloc_cats(&page, "> "); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("textarea", NULL);
www_tag_add_attrib(child_child_tag, "name", "body");
www_tag_add_attrib(child_child_tag, "wrap", "hard");
www_tag_add_attrib(child_child_tag, "rows", "25");
www_tag_add_attrib(child_child_tag, "cols", "79");
www_tag_add_attrib(child_child_tag, "id", "replybody");
www_tag_add_child(child_tag, child_child_tag);
stralloc content = EMPTY_STRALLOC;
stralloc_cats(&content, from);
stralloc_cats(&content, " said....\n\n");
stralloc_cats(&content, "> ");
size_t column = 0; size_t column = 0;
for (char *p = body; *p != '\0'; ++p) { for (char *p = body; *p != '\0'; ++p) {
if (*p == '\r') { if (*p == '\r') {
stralloc_cats(&page, "\n> "); stralloc_cats(&content, "\n> ");
column = 0; column = 0;
continue; continue;
} else if (column >= 78) { } else if (column >= 78) {
stralloc_cats(&page, "\n> "); stralloc_cats(&content, "\n> ");
column = 0; column = 0;
} }
stralloc_append1(&page, *p); stralloc_append1(&content, *p);
++column; ++column;
} }
stralloc_cats(&page, "</textarea>\n<br />");
stralloc_cats(&page, "<input type=\"submit\" name=\"submit\" value=\"Reply\" />\n<br />"); stralloc_0(&content);
stralloc_cats(&page, "</form>\n");
stralloc_cats(&page, "</div>\n"); child_child_child_tag = www_tag_new(NULL, content.s);
stralloc_0(&page); free(content.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "submit");
www_tag_add_attrib(child_child_tag, "name", "submit");
www_tag_add_attrib(child_child_tag, "value", "reply");
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
sqlite3_finalize(res); sqlite3_finalize(res);
rc = sqlite3_prepare_v2(db, update_seen_sql, -1, &res, 0); rc = sqlite3_prepare_v2(db, update_seen_sql, -1, &res, 0);
if (rc != SQLITE_OK) { if (rc != SQLITE_OK) {
sqlite3_finalize(res); sqlite3_finalize(res);
sqlite3_close(db); sqlite3_close(db);
free(page.s); www_tag_destroy(page);
return NULL; return NULL;
} }
sqlite3_bind_int(res, 1, id); sqlite3_bind_int(res, 1, id);
@ -300,11 +462,16 @@ char *www_email_display(struct user_record *user, int email) {
sqlite3_finalize(res); sqlite3_finalize(res);
sqlite3_close(db); sqlite3_close(db);
return page.s; return www_tag_unwravel(page);
} }
char *www_email_summary(struct user_record *user) { char *www_email_summary(struct user_record *user) {
stralloc page = EMPTY_STRALLOC; struct www_tag *page;
struct www_tag *cur_tag;
struct www_tag *child_tag;
struct www_tag *child_child_tag;
struct www_tag *child_child_child_tag;
struct www_tag *child_child_child_child_tag;
char pathbuf[PATH_MAX]; char pathbuf[PATH_MAX];
sqlite3 *db; sqlite3 *db;
sqlite3_stmt *res; sqlite3_stmt *res;
@ -343,11 +510,40 @@ char *www_email_summary(struct user_record *user) {
} }
sqlite3_bind_text(res, 1, user->loginname, -1, 0); sqlite3_bind_text(res, 1, user->loginname, -1, 0);
stralloc_copys(&page, "<div class=\"content-header\"><h2>Your Email</h2></div>\n"); page = www_tag_new(NULL, "");
stralloc_cats(&page, "<div class=\"button\"><a href=\"");
stralloc_cats(&page, conf.www_url); cur_tag = www_tag_new("div", NULL);
stralloc_cats(&page, "email/new\">New Email</a></div>\n"); www_tag_add_attrib(cur_tag, "class", "content-header");
stralloc_cats(&page, "<div class=\"div-table\">\n"); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Your Email");
www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "button");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL);
stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/new");
stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s);
free(url.s);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Email");
www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "div-table");
www_tag_add_child(page, cur_tag);
while (sqlite3_step(res) == SQLITE_ROW) { while (sqlite3_step(res) == SQLITE_ROW) {
char datebuf[32]; char datebuf[32];
@ -360,39 +556,93 @@ char *www_email_summary(struct user_record *user) {
time_t date = (time_t)sqlite3_column_int(res, 4); time_t date = (time_t)sqlite3_column_int(res, 4);
localtime_r(&date, &msg_date); localtime_r(&date, &msg_date);
stralloc_cats(&page, "<div class=\"email-summary");
child_tag = www_tag_new("div", NULL);
if (seen != 0) { if (seen != 0) {
stralloc_cats(&page, "-seen"); www_tag_add_attrib(child_tag, "class", "email-summary-seen");
} else {
www_tag_add_attrib(child_tag, "class", "email-summary");
} }
stralloc_cats(&page, "\"><div class=\"email-id\">");
stralloc_cat_long(&page, msgid); www_tag_add_child(cur_tag, child_tag);
stralloc_cats(&page, "</div><div class=\"email-subject\"><a href=\"");
stralloc_cats(&page, conf.www_url); child_child_tag = www_tag_new("div", NULL);
stralloc_cats(&page, "email/"); www_tag_add_attrib(child_child_tag, "class", "email-id");
stralloc_cat_long(&page, msgid); www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, "\">");
stralloc_cats(&page, subject); url = EMPTY_STRALLOC;
stralloc_cats(&page, "</a></div><div class=\"email-from\">"); stralloc_cat_long(&url, msgid);
stralloc_cats(&page, from); stralloc_0(&url);
stralloc_cats(&page, "</div><div class=\"email-date\">");
child_child_child_tag = www_tag_new(NULL, url.s);
free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-subject");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/");
stralloc_cat_long(&url, msgid);
stralloc_0(&url);
www_tag_add_attrib(child_child_child_tag, "href", url.s);
free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, subject);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-from");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, from);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-date");
www_tag_add_child(child_tag, child_child_tag);
if (conf.date_style == 1) if (conf.date_style == 1)
strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date); strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
else else
strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date); strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
stralloc_cats(&page, datebuf);
stralloc_cats(&page, "</div><a href=\""); child_child_child_tag = www_tag_new(NULL, datebuf);
stralloc_cats(&page, conf.www_url); www_tag_add_child(child_child_tag, child_child_child_tag);
stralloc_cats(&page, "email/delete/");
stralloc_cat_long(&page, id); child_child_tag = www_tag_new("a", NULL);
stralloc_cats(&page, "\"><div class=\"email-delete\"></div></a></div>\n"); url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/delete/");
stralloc_cat_long(&url, id);
stralloc_0(&url);
www_tag_add_attrib(child_child_tag, "href", url.s);
free(url.s);
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "email-delete");
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, "");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
} }
stralloc_cats(&page, "</div>\n");
stralloc_0(&page);
sqlite3_finalize(res); sqlite3_finalize(res);
sqlite3_close(db); sqlite3_close(db);
return page.s; return www_tag_unwravel(page);
} }
#endif #endif

View File

@ -10,6 +10,8 @@
#include "jamlib/jam.h" #include "jamlib/jam.h"
#include "libuuid/uuid.h" #include "libuuid/uuid.h"
#include "www_tree.h"
#include "bbs.h" #include "bbs.h"
#include "mail_utils.h" #include "mail_utils.h"
@ -231,7 +233,6 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
int z; int z;
struct tm msg_date; struct tm msg_date;
time_t date; time_t date;
stralloc page = EMPTY_STRALLOC;
char buffer[4096]; char buffer[4096];
int chars; int chars;
int i; int i;
@ -243,6 +244,12 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
char *nodename; char *nodename;
struct fido_addr *nodeno; struct fido_addr *nodeno;
struct www_tag *page = www_tag_new(NULL, "");
struct www_tag *cur_tag;
struct www_tag *child_tag;
struct www_tag *child_child_tag;
struct www_tag *child_child_child_tag;
if (conference < 0 || conference >= ptr_vector_len(&conf.mail_conferences)) if (conference < 0 || conference >= ptr_vector_len(&conf.mail_conferences))
return NULL; return NULL;
struct mail_conference *mc = get_conf(conference); struct mail_conference *mc = get_conf(conference);
@ -338,137 +345,261 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
JAM_CloseMB(jb); JAM_CloseMB(jb);
free(jb); free(jb);
stralloc_copys(&page, "<div class=\"content-header\"><a href=\""); cur_tag = www_tag_new("div", NULL);
stralloc_cats(&page, conf.www_url); www_tag_add_attrib(cur_tag, "class", "content-header");
stralloc_cats(&page, "msgs/"); www_tag_add_child(page, cur_tag);
stralloc_cat_long(&page, conference);
stralloc_append1(&page, '/'); child_tag = www_tag_new("a", NULL);
stralloc_cat_long(&page, area);
stralloc_cats(&page, "\"><h2>"); stralloc url = EMPTY_STRALLOC;
stralloc_cats(&page, mc->name);
stralloc_cats(&page, " - "); stralloc_cats(&url, conf.www_url);
stralloc_cats(&page, ma->name); stralloc_cats(&url, "msgs/");
stralloc_cats(&page, "</h2></a></div>\n"); stralloc_cat_long(&url, conference);
stralloc_append1(&url, '/');
stralloc_cat_long(&url, area);
stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s);
free(url.s);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("h2", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, mc->name);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_tag = www_tag_new(NULL, " - ");
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_tag = www_tag_new(NULL, ma->name);
www_tag_add_child(child_child_tag, child_child_child_tag);
cur_tag = www_tag_new("div", NULL);
if (msgbase_is_flagged(user, conference, area, msg)) { if (msgbase_is_flagged(user, conference, area, msg)) {
stralloc_cats(&page, "<div class=\"msg-view-header-flagged\">\n"); www_tag_add_attrib(cur_tag, "class", "msg-view-header-flagged");
} else { } else {
stralloc_cats(&page, "<div class=\"msg-view-header\">\n"); www_tag_add_attrib(cur_tag, "class", "msg-view-header");
} }
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "msg-view-subject");
www_tag_add_child(cur_tag, child_tag);
subject_s = www_sanitize(subject); child_child_tag = www_tag_new(NULL, subject);
stralloc_cats(&page, "<div class=\"msg-view-subject\">"); www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, subject_s);
stralloc_cats(&page, "</div>\n"); child_tag = www_tag_new("div", NULL);
free(subject_s); www_tag_add_attrib(child_tag, "class", "msg-view-from");
www_tag_add_child(cur_tag, child_tag);
from_s = www_sanitize(from);
if (ma->type != TYPE_LOCAL_AREA && oaddress != NULL) { if (ma->type != TYPE_LOCAL_AREA && oaddress != NULL) {
if (mc->nettype == NETWORK_MAGI) { if (mc->nettype == NETWORK_MAGI) {
snprintf(buffer, sizeof buffer, "<div class=\"msg-view-from\">From: %s (@%s)</div>\n", from_s, oaddress); snprintf(buffer, sizeof buffer, "From: %s (@%s)", from, oaddress);
child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag);
} else if (mc->nettype == NETWORK_FIDO) { } else if (mc->nettype == NETWORK_FIDO) {
nodeno = parse_fido_addr(oaddress); nodeno = parse_fido_addr(oaddress);
if (nodeno != NULL) { if (nodeno != NULL) {
nodename = nl_get_bbsname(nodeno, mc->domain); nodename = nl_get_bbsname(nodeno, mc->domain);
if (strcmp(nodename, "Unknown") == 0) { if (strcmp(nodename, "Unknown") == 0) {
snprintf(buffer, sizeof buffer, "<div class=\"msg-view-from\">From: %s (%s)</div>\n", from_s, oaddress); snprintf(buffer, sizeof buffer, "From: %s (%s)", from, oaddress);
child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag);
} else { } else {
snprintf(buffer, sizeof buffer, snprintf(buffer, sizeof buffer, "From: %s (", from);
"<div class=\"msg-view-from\">From: %s (<span class=\"bbsname\">%s</span> - %s)</div>\n", child_child_tag = www_tag_new(NULL, buffer);
from_s, nodename, oaddress); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("span", NULL);
www_tag_add_attrib(child_child_tag, "class", "bbsname");
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, nodename);
www_tag_add_child(child_child_tag, child_child_child_tag);
snprintf(buffer, sizeof buffer, " - %s)", oaddress);
child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag);
} }
free(nodename); free(nodename);
free(nodeno); free(nodeno);
} else { } else {
snprintf(buffer, sizeof buffer, "<div class=\"msg-view-from\">From: %s (%s)</div>\n", from_s, oaddress); snprintf(buffer, sizeof buffer, "From: %s (%s)", from, oaddress);
child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag);
} }
} else { } else {
snprintf(buffer, sizeof buffer, "<div class=\"msg-view-from\">From: %s (%s)</div>\n", from_s, oaddress); snprintf(buffer, sizeof buffer, "From: %s (%s)", from, oaddress);
child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag);
} }
} else { } else {
snprintf(buffer, sizeof buffer, "<div class=\"msg-view-from\">From: %s</div>\n", from_s); snprintf(buffer, sizeof buffer, "From: %s", from);
child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag);
} }
free(from_s);
stralloc_cats(&page, buffer); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "msg-view-to");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, to);
www_tag_add_child(child_tag, child_child_tag);
to_s = www_sanitize(to); child_tag = www_tag_new("div", NULL);
stralloc_cats(&page, "<div class=\"msg-view-to\">To: "); www_tag_add_attrib(child_tag, "class", "msg-view-date");
stralloc_cats(&page, to_s); www_tag_add_child(cur_tag, child_tag);
stralloc_cats(&page, "</div>\n");
free(to_s);
date = (time_t)jmh.DateWritten; date = (time_t)jmh.DateWritten;
gmtime_r(&date, &msg_date); gmtime_r(&date, &msg_date);
if (conf.date_style == 1) { if (conf.date_style == 1) {
snprintf(buffer, sizeof buffer, "<div class=\"msg-view-date\">Date: %.2d:%.2d %.2d-%.2d-%.2d</div>\n", snprintf(buffer, sizeof buffer, "Date: %.2d:%.2d %.2d-%.2d-%.2d",
msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100); msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100);
} else { } else {
snprintf(buffer, sizeof buffer, "<div class=\"msg-view-date\">Date: %.2d:%.2d %.2d-%.2d-%.2d</div>\n", snprintf(buffer, sizeof buffer, "Date: %.2d:%.2d %.2d-%.2d-%.2d",
msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100); msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
} }
stralloc_cats(&page, buffer); child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag);
snprintf(buffer, sizeof buffer, child_tag = www_tag_new("div", NULL);
"<div class=\"msg-view-options\"><a href=\"%smsgs/flag/%d/%d/%d\"><img src=\"%sstatic/flag.png\" /></a></div>", www_tag_add_attrib(child_tag, "class", "msg-view-options");
conf.www_url, conference, area, msg, conf.www_url); www_tag_add_child(cur_tag, child_tag);
stralloc_cats(&page, buffer);
stralloc_cats(&page, "</div>\n"); child_child_tag = www_tag_new("a", NULL);
stralloc_cats(&page, "<div id=\"msgbody\">\n");
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/flag/");
stralloc_cat_long(&url, conference);
stralloc_append1(&url, '/');
stralloc_cat_long(&url, area);
stralloc_append1(&url, '/');
stralloc_cat_long(&url, msg);
stralloc_0(&url);
www_tag_add_attrib(child_child_tag, "href", url.s);
free(url.s);
www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("img", NULL);
url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "static/flag.png");
stralloc_0(&url);
www_tag_add_attrib(child_child_child_tag, "src", url.s);
free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "id", "msgbody");
www_tag_add_child(page, cur_tag);
aha_text = strndup(body, jmh.TxtLen); aha_text = strndup(body, jmh.TxtLen);
struct www_tag *aha_out = www_tag_new(NULL, ""); aha(aha_text, cur_tag);
aha(aha_text, aha_out);
char *aha_data = www_tag_unwravel(aha_out);
stralloc_cats(&page, aha_data);
free(aha_data);
free(aha_text); free(aha_text);
stralloc_cats(&page, "</div>\n");
stralloc_cats(&page, "<div class=\"msg-reply-form\">\n");
if (ma->write_sec_level <= user->sec_level && ma->type != TYPE_NETMAIL_AREA) { if (ma->write_sec_level <= user->sec_level && ma->type != TYPE_NETMAIL_AREA) {
stralloc_cats(&page, "<h3>Reply</h3>\n"); cur_tag = www_tag_new("div", NULL);
stralloc_cats(&page, "<form action=\""); www_tag_add_attrib(cur_tag, "class", "msg-reply-form");
stralloc_cats(&page, conf.www_url); www_tag_add_child(page, cur_tag);
stralloc_cats(&page, "msgs/\" method=\"POST\" enctype=\"application/x-www-form-urlencoded;charset=UTF-8\">\n");
child_tag = www_tag_new("h3", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Reply");
www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, "<input type=\"hidden\" name=\"conference\" value=\""); child_tag = www_tag_new("form", NULL);
stralloc_cat_long(&page, conference); url = EMPTY_STRALLOC;
stralloc_cats(&page, "\" />\n"); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/");
stralloc_0(&url);
www_tag_add_attrib(child_tag, "action", url.s);
free(url.s);
www_tag_add_attrib(child_tag, "method", "POST");
www_tag_add_attrib(child_tag, "enctype", "application/x-www-form-urlencoded;charset=UTF-8");
www_tag_add_child(cur_tag, child_tag);
stralloc_cats(&page, "<input type=\"hidden\" name=\"area\" value=\""); child_child_tag = www_tag_new("input", NULL);
stralloc_cat_long(&page, area); www_tag_add_attrib(child_child_tag, "type", "hidden");
stralloc_cats(&page, "\" />\n"); www_tag_add_attrib(child_child_tag, "name", "conference");
snprintf(buffer, sizeof buffer, "%d", conference);
www_tag_add_attrib(child_child_tag, "value", buffer);
www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, "<input type=\"hidden\" name=\"replyid\" value=\""); child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "hidden");
www_tag_add_attrib(child_child_tag, "name", "area");
snprintf(buffer, sizeof buffer, "%d", area);
www_tag_add_attrib(child_child_tag, "value", buffer);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "hidden");
www_tag_add_attrib(child_child_tag, "name", "replyid");
if (msgid == NULL) { if (msgid == NULL) {
stralloc_cats(&page, "NULL"); www_tag_add_attrib(child_child_tag, "value", "NULL");
} else { } else {
stralloc_cats(&page, msgid); www_tag_add_attrib(child_child_tag, "value", msgid);
} }
stralloc_cats(&page, "\" />\n"); www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, "To : <input type=\"text\" name=\"recipient\" value=\""); child_child_tag = www_tag_new(NULL, "To : ");
stralloc_cats(&page, from); www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, "\" /><br />\n");
child_child_tag = www_tag_new("input", NULL);
stralloc_cats(&page, "Subject : <input type=\"text\" name=\"subject\" value=\""); www_tag_add_attrib(child_child_tag, "type", "text");
www_tag_add_attrib(child_child_tag, "name", "recipient");
www_tag_add_attrib(child_child_tag, "value", from);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "text");
www_tag_add_attrib(child_child_tag, "name", "subject");
if (strncasecmp(subject, "re:", 3) != 0) { if (strncasecmp(subject, "re:", 3) != 0) {
stralloc_cats(&page, "RE: "); snprintf(buffer, sizeof buffer, "RE: %s", subject);
www_tag_add_attrib(child_child_tag, "value", buffer);
} else {
www_tag_add_attrib(child_child_tag, "value", subject);
} }
stralloc_cats(&page, subject);
stralloc_cats(&page, "\" /><br />\n"); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
stralloc_cats(&page, "<textarea name=\"body\" rows=\"25\" cols=\"79\" wrap=\"soft\" id=\"replybody\">"); child_child_tag = www_tag_new("textarea", NULL);
www_tag_add_attrib(child_child_tag, "name", "body");
stralloc_append1(&page, ' '); www_tag_add_attrib(child_child_tag, "rows", "25");
stralloc_append1(&page, from[0]); www_tag_add_attrib(child_child_tag, "cols", "79");
stralloc_cats(&page, "> "); www_tag_add_attrib(child_child_tag, "wrap", "soft");
www_tag_add_attrib(child_child_tag, "id", "replybody");
www_tag_add_child(child_tag, child_child_tag);
stralloc text = EMPTY_STRALLOC;
stralloc_append1(&text, ' ');
stralloc_append1(&text, from[0]);
stralloc_cats(&text, "> ");
replybody = (char *)malloz(strlen(body) + 1); replybody = (char *)malloz(strlen(body) + 1);
@ -501,18 +632,33 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
snprintf(buffer, sizeof buffer, "\n %c> %c", from[0], body2[i]); snprintf(buffer, sizeof buffer, "\n %c> %c", from[0], body2[i]);
chars = 1; chars = 1;
} else { } else {
snprintf(buffer, sizeof buffer, "%c", body2[i]); if (isalnum(body2[i]) || isspace(body2[i]) || ispunct(body2[i])) {
snprintf(buffer, sizeof buffer, "%c", body2[i]);
} else {
snprintf(buffer, sizeof buffer, "?");
}
chars++; chars++;
} }
stralloc_cats(&page, buffer); stralloc_cats(&text, buffer);
} }
free(body2); free(body2);
stralloc_cats(&page, "</textarea>\n<br />");
stralloc_cats(&page, "<input type=\"submit\" name=\"submit\" value=\"Reply\" />\n<br />"); stralloc_0(&text);
stralloc_cats(&page, "</form>\n");
stralloc_cats(&page, "</div>\n"); child_child_child_tag = www_tag_new(NULL, text.s);
www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "submit");
www_tag_add_attrib(child_child_tag, "name", "submit");
www_tag_add_attrib(child_child_tag, "value", "Reply");
www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag);
} }
stralloc_0(&page);
free(subject); free(subject);
free(from); free(from);
@ -522,7 +668,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
free(msgid); free(msgid);
free(replyid); free(replyid);
return page.s; return www_tag_unwravel(page);
} }
static char *www_wordwrap(char *content, int cutoff) { static char *www_wordwrap(char *content, int cutoff) {
@ -832,7 +978,27 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
} else { } else {
snprintf(buffer, sizeof buffer, "\r"); snprintf(buffer, sizeof buffer, "\r");
} }
body2 = www_wordwrap(body, 73);
char *p = body;
stralloc unhtmlized = EMPTY_STRALLOC;
// remove nbsp
while (*p != '\0') {
if (*p == 0xc2 && *(p + 1) == 0xa0) {
stralloc_append1(&unhtmlized, ' ');
p++;
} else {
stralloc_append1(&unhtmlized, *p);
}
p++;
}
stralloc_0(&unhtmlized);
body2 = www_wordwrap(unhtmlized.s, 73);
free(unhtmlized.s);
if (body2 == NULL) { if (body2 == NULL) {
JAM_UnlockMB(jb); JAM_UnlockMB(jb);
JAM_DelSubPacket(jsp); JAM_DelSubPacket(jsp);
@ -840,6 +1006,9 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
free(jb); free(jb);
return 0; return 0;
} }
body3 = str2dup(body2, buffer); body3 = str2dup(body2, buffer);
if (body3 == NULL) { if (body3 == NULL) {
free(body2); free(body2);
@ -894,28 +1063,110 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
} }
char *www_new_msg(struct user_record *user, int conference, int area) { char *www_new_msg(struct user_record *user, int conference, int area) {
stralloc page = EMPTY_STRALLOC; struct www_tag *page = www_tag_new(NULL, "");
struct www_tag *cur_tag;
struct www_tag *child_tag;
struct www_tag *child_child_tag;
char buffer[10];
cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Message");
www_tag_add_child(child_tag, child_child_tag);
stralloc_copys(&page, "<div class=\"content-header\"><h2>New Message</h2></div>\n"); cur_tag = www_tag_new("form", NULL);
stralloc_cats(&page, "<form action=\"");
stralloc_cats(&page, conf.www_url); stralloc url = EMPTY_STRALLOC;
stralloc_cats(&page, "msgs/\" method=\"POST\" onsubmit=\"return validate()\" "
"enctype=\"application/x-www-form-urlencoded;charset=UTF-8\">\n"); stralloc_cats(&url, conf.www_url);
stralloc_cats(&page, "<input type=\"hidden\" name=\"conference\" value=\""); stralloc_cats(&url, "msgs/");
stralloc_cat_long(&page, conference); stralloc_0(&url);
stralloc_cats(&page, "\" />\n");
stralloc_cats(&page, "<input type=\"hidden\" name=\"area\" value=\""); www_tag_add_attrib(cur_tag, "action", url.s);
stralloc_cat_long(&page, area); free(url.s);
stralloc_cats(&page, "\" />\n");
stralloc_cats(&page, "<input type=\"hidden\" name=\"replyid\" value=\"NULL\" />\n");
stralloc_cats(&page, "To : <input type=\"text\" name=\"recipient\" value=\"All\" id=\"recipient\"/><br />\n");
stralloc_cats(&page, "Subject : <input type=\"text\" name=\"subject\" id=\"subject\" /><br />\n");
stralloc_cats(&page, "<textarea name=\"body\" id=\"body\" rows=\"25\" cols=\"79\" wrap=\"soft\"></textarea>\n<br />");
stralloc_cats(&page, "<input type=\"submit\" name=\"submit\" value=\"Send\" />\n<br />");
stralloc_cats(&page, "</form>\n");
stralloc_0(&page);
return page.s; www_tag_add_attrib(cur_tag, "method", "POST");
www_tag_add_attrib(cur_tag, "onsubmit", "return validate()");
www_tag_add_attrib(cur_tag, "enctype", "application/x-www-form-urlencoded;charset=UTF-8");
www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "hidden");
www_tag_add_attrib(child_tag, "name", "conference");
snprintf(buffer, sizeof buffer, "%d", conference);
www_tag_add_attrib(child_tag, "value", buffer);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "hidden");
www_tag_add_attrib(child_tag, "name", "area");
snprintf(buffer, sizeof buffer, "%d", area);
www_tag_add_attrib(child_tag, "value", buffer);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "hidden");
www_tag_add_attrib(child_tag, "name", "replyid");
www_tag_add_attrib(child_tag, "value", "NULL");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new(NULL, "To : ");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "text");
www_tag_add_attrib(child_tag, "name", "recipient");
www_tag_add_attrib(child_tag, "value", "All");
www_tag_add_attrib(child_tag, "id", "recipient");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new(NULL, "Subject : ");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "text");
www_tag_add_attrib(child_tag, "name", "subject");
www_tag_add_attrib(child_tag, "id", "subject");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("textarea", NULL);
www_tag_add_attrib(child_tag, "name", "body");
www_tag_add_attrib(child_tag, "id", "body");
www_tag_add_attrib(child_tag, "rows", "25");
www_tag_add_attrib(child_tag, "cols", "79");
www_tag_add_attrib(child_tag, "wrap", "soft");
www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "");
www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "submit");
www_tag_add_attrib(child_tag, "name", "submit");
www_tag_add_attrib(child_tag, "value", "Send");
www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag);
return www_tag_unwravel(page);
} }
#endif #endif

File diff suppressed because it is too large Load Diff