Whitespace cleanups: trailing spaces.

Remove them.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
This commit is contained in:
Dan Cross 2018-10-30 22:32:01 +00:00 committed by Andrew Pamment
parent 8a6348f5b1
commit e8eef519ed
11 changed files with 390 additions and 390 deletions

View File

@ -67,7 +67,7 @@ endif
${CC} -c -o $@ $< ${CFLAGS} ${CC} -c -o $@ $< ${CFLAGS}
magickawww: ${OBJS} ${WWWOBJS} ${LUA} ${ZMODEM} ${B64} ${JAMLIB} ${JSMN} ${UUID} magickawww: ${OBJS} ${WWWOBJS} ${LUA} ${ZMODEM} ${B64} ${JAMLIB} ${JSMN} ${UUID}
${CC} -o ../magicka $^ ${LIBS} -lmicrohttpd ${CC} -o ../magicka $^ ${LIBS} -lmicrohttpd
magicka: ${OBJS} ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID} magicka: ${OBJS} ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID}
${CC} -o ../magicka $^ ${LIBS} ${CC} -o ../magicka $^ ${LIBS}

View File

@ -1600,7 +1600,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
free(from); free(from);
ptr_vector_apply(&msg_lines, free); ptr_vector_apply(&msg_lines, free);
destroy_ptr_vector(&msg_lines); destroy_ptr_vector(&msg_lines);
return 0; return 0;
} }
s_printf(get_string(115)); s_printf(get_string(115));
s_readstring_inject(buffer, 64, subject); s_readstring_inject(buffer, 64, subject);

View File

@ -542,21 +542,21 @@ void list_users(struct user_record *user) {
int check_fullname_j(char *firstandlastname) { int check_fullname_j(char *firstandlastname) {
char *firstname = strdup(firstandlastname); char *firstname = strdup(firstandlastname);
if (!firstname) { if (!firstname) {
return 0; return 0;
} }
char *lastname = strchr(firstname, ' '); char *lastname = strchr(firstname, ' ');
int ret; int ret;
if (lastname == NULL) { if (lastname == NULL) {
return 0; return 0;
} }
*lastname = '\0'; *lastname = '\0';
lastname++; lastname++;
ret = check_fullname(firstname, lastname); ret = check_fullname(firstname, lastname);
free(firstname); free(firstname);
return ret; return ret;
} }

View File

@ -249,5 +249,5 @@ FILE *fopen_node_path(const char *filename, const char *mode) {
snprintf(buffer, PATH_MAX, "%s/node%d/%s", conf.bbs_path, mynode, filename); snprintf(buffer, PATH_MAX, "%s/node%d/%s", conf.bbs_path, mynode, filename);
return fopen(buffer, mode); return fopen(buffer, mode);
} }

View File

@ -15,7 +15,7 @@ char *www_blog() {
struct www_tag *child_tag; struct www_tag *child_tag;
struct www_tag *child_child_tag; struct www_tag *child_child_tag;
struct www_tag *child_child_child_tag; struct www_tag *child_child_child_tag;
page = www_tag_new(NULL, ""); page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
@ -28,8 +28,8 @@ char *www_blog() {
cur_tag = www_tag_new("p", NULL); cur_tag = www_tag_new("p", NULL);
www_tag_add_child(cur_tag, www_tag_new(NULL, "No Entries")); www_tag_add_child(cur_tag, www_tag_new(NULL, "No Entries"));
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
return www_tag_unwravel(page); return www_tag_unwravel(page);
} }
for (size_t i = 0; i < ptr_vector_len(&entries); i++) { for (size_t i = 0; i < ptr_vector_len(&entries); i++) {
@ -47,39 +47,39 @@ char *www_blog() {
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "blog-header"); www_tag_add_attrib(cur_tag, "class", "blog-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "blog-title"); www_tag_add_attrib(child_tag, "class", "blog-title");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("h3", NULL); child_child_tag = www_tag_new("h3", NULL);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, entry->subject); child_child_child_tag = www_tag_new(NULL, entry->subject);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "blog-date"); www_tag_add_attrib(child_tag, "class", "blog-date");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, timebuf); child_child_tag = www_tag_new(NULL, timebuf);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, hour >= 12 ? "pm" : "am"); child_child_tag = www_tag_new(NULL, hour >= 12 ? "pm" : "am");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, datebuf); child_child_tag = www_tag_new(NULL, datebuf);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "blog-author"); www_tag_add_attrib(child_tag, "class", "blog-author");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "by "); child_child_tag = www_tag_new(NULL, "by ");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, entry->author); child_child_tag = www_tag_new(NULL, entry->author);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "blog-entry"); www_tag_add_attrib(cur_tag, "class", "blog-entry");
@ -87,9 +87,9 @@ char *www_blog() {
child_tag = www_tag_new("p", NULL); child_tag = www_tag_new("p", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
stralloc blog_body = EMPTY_STRALLOC; stralloc blog_body = EMPTY_STRALLOC;
for (char *p = entry->body; *p != '\0'; ++p) { for (char *p = entry->body; *p != '\0'; ++p) {
if (*p != '\r') { if (*p != '\r') {
stralloc_append1(&blog_body, *p); stralloc_append1(&blog_body, *p);
@ -100,16 +100,16 @@ char *www_blog() {
continue; continue;
} }
} }
child_child_tag = www_tag_new(NULL, blog_body.s); child_child_tag = www_tag_new(NULL, blog_body.s);
free(blog_body.s); free(blog_body.s);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
} }
ptr_vector_apply(&entries, free); ptr_vector_apply(&entries, free);
destroy_ptr_vector(&entries); destroy_ptr_vector(&entries);
return www_tag_unwravel(page); return www_tag_unwravel(page);
} }

View File

@ -144,28 +144,28 @@ char *www_new_email() {
struct www_tag *cur_tag; struct www_tag *cur_tag;
struct www_tag *child_tag; struct www_tag *child_tag;
struct www_tag *child_child_tag; struct www_tag *child_child_tag;
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL); child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Email"); child_child_tag = www_tag_new(NULL, "New Email");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("form", NULL); cur_tag = www_tag_new("form", NULL);
stralloc url = EMPTY_STRALLOC; stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/"); stralloc_cats(&url, "email/");
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(cur_tag, "action", url.s); www_tag_add_attrib(cur_tag, "action", url.s);
free(url.s); free(url.s);
www_tag_add_attrib(cur_tag, "method", "POST"); www_tag_add_attrib(cur_tag, "method", "POST");
www_tag_add_attrib(cur_tag, "onsubmit", "return validate()"); www_tag_add_attrib(cur_tag, "onsubmit", "return validate()");
www_tag_add_attrib(cur_tag, "enctype", "application/x-www-form-urlencoded"); www_tag_add_attrib(cur_tag, "enctype", "application/x-www-form-urlencoded");
@ -173,26 +173,26 @@ char *www_new_email() {
child_tag = www_tag_new(NULL, "To : "); child_tag = www_tag_new(NULL, "To : ");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL); child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "text"); www_tag_add_attrib(child_tag, "type", "text");
www_tag_add_attrib(child_tag, "name", "recipient"); www_tag_add_attrib(child_tag, "name", "recipient");
www_tag_add_attrib(child_tag, "id", "recipient"); www_tag_add_attrib(child_tag, "id", "recipient");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL); child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new(NULL, "Subject : "); child_tag = www_tag_new(NULL, "Subject : ");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL); child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "text"); www_tag_add_attrib(child_tag, "type", "text");
www_tag_add_attrib(child_tag, "name", "subject"); www_tag_add_attrib(child_tag, "name", "subject");
www_tag_add_attrib(child_tag, "id", "subject"); www_tag_add_attrib(child_tag, "id", "subject");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL); child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
@ -203,13 +203,13 @@ char *www_new_email() {
www_tag_add_attrib(child_tag, "cols", "79"); www_tag_add_attrib(child_tag, "cols", "79");
www_tag_add_attrib(child_tag, "id", "body"); www_tag_add_attrib(child_tag, "id", "body");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, ""); child_child_tag = www_tag_new(NULL, "");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("br", NULL); child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL); child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "submit"); www_tag_add_attrib(child_tag, "type", "submit");
www_tag_add_attrib(child_tag, "name", "submit"); www_tag_add_attrib(child_tag, "name", "submit");
@ -218,7 +218,7 @@ char *www_new_email() {
child_tag = www_tag_new("br", NULL); child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
return www_tag_unwravel(page); return www_tag_unwravel(page);
} }
@ -280,17 +280,17 @@ char *www_email_display(struct user_record *user, int email) {
if (sqlite3_step(res) != SQLITE_ROW) { if (sqlite3_step(res) != SQLITE_ROW) {
page = www_tag_new(NULL, ""); page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL); child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "No such email!"); child_child_tag = www_tag_new(NULL, "No such email!");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
return www_tag_unwravel(page); return www_tag_unwravel(page);
} }
id = sqlite3_column_int(res, 0); id = sqlite3_column_int(res, 0);
@ -301,14 +301,14 @@ char *www_email_display(struct user_record *user, int email) {
localtime_r(&date, &msg_date); localtime_r(&date, &msg_date);
page = www_tag_new(NULL, ""); page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL); child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Your Email"); child_child_tag = www_tag_new(NULL, "Your Email");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -319,42 +319,42 @@ char *www_email_display(struct user_record *user, int email) {
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-subject"); www_tag_add_attrib(child_tag, "class", "email-view-subject");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, subject); child_child_tag = www_tag_new(NULL, subject);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-from"); www_tag_add_attrib(child_tag, "class", "email-view-from");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, from); child_child_tag = www_tag_new(NULL, from);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "email-view-date"); www_tag_add_attrib(child_tag, "class", "email-view-date");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Date: "); child_child_tag = www_tag_new(NULL, "Date: ");
www_tag_add_child(child_tag, child_child_tag); 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);
child_child_tag = www_tag_new(NULL, datebuf); child_child_tag = www_tag_new(NULL, datebuf);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "id", "msgbody"); www_tag_add_attrib(cur_tag, "id", "msgbody");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
aha(body, cur_tag); aha(body, cur_tag);
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "email-reply-form"); www_tag_add_attrib(cur_tag, "class", "email-reply-form");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h3", NULL); child_tag = www_tag_new("h3", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
@ -362,20 +362,20 @@ char *www_email_display(struct user_record *user, int email) {
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("form", NULL); child_tag = www_tag_new("form", NULL);
stralloc url = EMPTY_STRALLOC; stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/"); stralloc_cats(&url, "email/");
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_tag, "action", url.s); www_tag_add_attrib(child_tag, "action", url.s);
free(url.s); free(url.s);
www_tag_add_attrib(child_tag, "method", "POST"); www_tag_add_attrib(child_tag, "method", "POST");
www_tag_add_attrib(child_tag, "enctype", "application/x-www-form-urlencoded"); www_tag_add_attrib(child_tag, "enctype", "application/x-www-form-urlencoded");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("input", NULL); child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "hidden"); 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, "name", "recipient");
@ -383,21 +383,21 @@ char *www_email_display(struct user_record *user, int email) {
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, "Subject : "); child_child_tag = www_tag_new(NULL, "Subject : ");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL); child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "text"); www_tag_add_attrib(child_child_tag, "type", "text");
www_tag_add_attrib(child_child_tag, "name", "subject"); www_tag_add_attrib(child_child_tag, "name", "subject");
stralloc subj = EMPTY_STRALLOC; stralloc subj = EMPTY_STRALLOC;
if (strncasecmp(subject, "re:", 3) != 0) if (strncasecmp(subject, "re:", 3) != 0)
stralloc_cats(&subj, "RE: "); stralloc_cats(&subj, "RE: ");
stralloc_cats(&subj, subject); stralloc_cats(&subj, subject);
stralloc_0(&subj); stralloc_0(&subj);
www_tag_add_attrib(child_child_tag, "value", subj.s); www_tag_add_attrib(child_child_tag, "value", subj.s);
free(subj.s); free(subj.s);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL); child_child_tag = www_tag_new("br", NULL);
@ -410,7 +410,7 @@ char *www_email_display(struct user_record *user, int email) {
www_tag_add_attrib(child_child_tag, "cols", "79"); www_tag_add_attrib(child_child_tag, "cols", "79");
www_tag_add_attrib(child_child_tag, "id", "replybody"); www_tag_add_attrib(child_child_tag, "id", "replybody");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
stralloc content = EMPTY_STRALLOC; stralloc content = EMPTY_STRALLOC;
stralloc_cats(&content, from); stralloc_cats(&content, from);
@ -429,12 +429,12 @@ char *www_email_display(struct user_record *user, int email) {
stralloc_append1(&content, *p); stralloc_append1(&content, *p);
++column; ++column;
} }
stralloc_0(&content); stralloc_0(&content);
child_child_child_tag = www_tag_new(NULL, content.s); child_child_child_tag = www_tag_new(NULL, content.s);
free(content.s); free(content.s);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("br", NULL); child_child_tag = www_tag_new("br", NULL);
@ -511,14 +511,14 @@ 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);
page = www_tag_new(NULL, ""); page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL); child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Your Email"); child_child_tag = www_tag_new(NULL, "Your Email");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -528,7 +528,7 @@ char *www_email_summary(struct user_record *user) {
child_tag = www_tag_new("a", NULL); child_tag = www_tag_new("a", NULL);
stralloc url = EMPTY_STRALLOC; stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/new"); stralloc_cats(&url, "email/new");
stralloc_0(&url); stralloc_0(&url);
@ -543,7 +543,7 @@ char *www_email_summary(struct user_record *user) {
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "div-table"); www_tag_add_attrib(cur_tag, "class", "div-table");
www_tag_add_child(page, cur_tag); 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];
@ -556,7 +556,7 @@ 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);
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
if (seen != 0) { if (seen != 0) {
@ -566,7 +566,7 @@ char *www_email_summary(struct user_record *user) {
} }
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-id"); www_tag_add_attrib(child_child_tag, "class", "email-id");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -574,30 +574,30 @@ char *www_email_summary(struct user_record *user) {
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cat_long(&url, msgid); stralloc_cat_long(&url, msgid);
stralloc_0(&url); stralloc_0(&url);
child_child_child_tag = www_tag_new(NULL, url.s); child_child_child_tag = www_tag_new(NULL, url.s);
free(url.s); free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-subject"); www_tag_add_attrib(child_child_tag, "class", "email-subject");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("a", NULL); child_child_child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/"); stralloc_cats(&url, "email/");
stralloc_cat_long(&url, msgid); stralloc_cat_long(&url, msgid);
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_child_child_tag, "href", url.s); www_tag_add_attrib(child_child_child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, subject); child_child_child_child_tag = www_tag_new(NULL, subject);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag); www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-from"); www_tag_add_attrib(child_child_tag, "class", "email-from");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -609,33 +609,33 @@ char *www_email_summary(struct user_record *user) {
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "email-date"); www_tag_add_attrib(child_child_tag, "class", "email-date");
www_tag_add_child(child_tag, child_child_tag); 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);
child_child_child_tag = www_tag_new(NULL, datebuf); child_child_child_tag = www_tag_new(NULL, datebuf);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("a", NULL); child_child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "email/delete/"); stralloc_cats(&url, "email/delete/");
stralloc_cat_long(&url, id); stralloc_cat_long(&url, id);
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_child_tag, "href", url.s); www_tag_add_attrib(child_child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("div", NULL); child_child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "email-delete"); www_tag_add_attrib(child_child_child_tag, "class", "email-delete");
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, ""); child_child_child_child_tag = www_tag_new(NULL, "");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag); www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
} }

View File

@ -318,7 +318,7 @@ char *www_files_display_listing(int dir, int sub) {
struct file_sub *fsub = ptr_vector_get(&fdir->file_subs, sub); struct file_sub *fsub = ptr_vector_get(&fdir->file_subs, sub);
assert(fsub != NULL); assert(fsub != NULL);
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
@ -351,53 +351,53 @@ char *www_files_display_listing(int dir, int sub) {
www_tag_destroy(page); www_tag_destroy(page);
return NULL; return NULL;
} }
cur_tag = www_tag_new("table", NULL); cur_tag = www_tag_new("table", NULL);
www_tag_add_attrib(cur_tag, "class", "fileentry"); www_tag_add_attrib(cur_tag, "class", "fileentry");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("thead", NULL); child_tag = www_tag_new("thead", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("tr", NULL); child_child_tag = www_tag_new("tr", NULL);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("td", NULL); child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, "Filename"); child_child_child_child_tag = www_tag_new(NULL, "Filename");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag); www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_child_tag = www_tag_new("td", NULL); child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, "Size"); child_child_child_child_tag = www_tag_new(NULL, "Size");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag); www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_child_tag = www_tag_new("td", NULL); child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, "Description"); child_child_child_child_tag = www_tag_new(NULL, "Description");
www_tag_add_child(child_child_child_tag, child_child_child_child_tag); www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_tag = www_tag_new("tbody", NULL); child_tag = www_tag_new("tbody", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
while (sqlite3_step(res) == SQLITE_ROW) { while (sqlite3_step(res) == SQLITE_ROW) {
char *filename = strdup((char *)sqlite3_column_text(res, 1)); char *filename = strdup((char *)sqlite3_column_text(res, 1));
char *base_filename = basename(filename); char *base_filename = basename(filename);
child_child_tag = www_tag_new("tr", NULL); child_child_tag = www_tag_new("tr", NULL);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("td", NULL); child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "filename"); www_tag_add_attrib(child_child_child_tag, "class", "filename");
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new("a", NULL); child_child_child_child_tag = www_tag_new("a", NULL);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag); www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
stralloc url = EMPTY_STRALLOC; stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "files/areas/"); stralloc_cats(&url, "files/areas/");
stralloc_cat_long(&url, dir); stralloc_cat_long(&url, dir);
@ -405,20 +405,20 @@ char *www_files_display_listing(int dir, int sub) {
stralloc_cat_long(&url, sub); stralloc_cat_long(&url, sub);
stralloc_append1(&url, '/'); stralloc_append1(&url, '/');
www_encode(&url, base_filename); www_encode(&url, base_filename);
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_child_child_child_tag, "href", url.s); www_tag_add_attrib(child_child_child_child_tag, "href", url.s);
free(url.s); free(url.s);
child_child_child_child_child_tag = www_tag_new(NULL, base_filename); child_child_child_child_child_tag = www_tag_new(NULL, base_filename);
www_tag_add_child(child_child_child_child_tag, child_child_child_child_child_tag); www_tag_add_child(child_child_child_child_tag, child_child_child_child_child_tag);
int size = sqlite3_column_int(res, 3); int size = sqlite3_column_int(res, 3);
child_child_child_tag = www_tag_new("td", NULL); child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "filesize"); www_tag_add_attrib(child_child_child_tag, "class", "filesize");
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
int c = 'b'; int c = 'b';
if (size > 1024) { if (size > 1024) {
size /= 1024; size /= 1024;
@ -432,9 +432,9 @@ char *www_files_display_listing(int dir, int sub) {
size /= 1024; size /= 1024;
c = 'G'; c = 'G';
} }
stralloc size_str = EMPTY_STRALLOC; stralloc size_str = EMPTY_STRALLOC;
stralloc_cat_long(&size_str, size); stralloc_cat_long(&size_str, size);
stralloc_append1(&size_str, c); stralloc_append1(&size_str, c);
@ -445,7 +445,7 @@ char *www_files_display_listing(int dir, int sub) {
child_child_child_tag = www_tag_new("td", NULL); child_child_child_tag = www_tag_new("td", NULL);
www_tag_add_attrib(child_child_child_tag, "class", "filedesc"); www_tag_add_attrib(child_child_child_tag, "class", "filedesc");
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
char *description = strdup((char *)sqlite3_column_text(res, 2)); char *description = strdup((char *)sqlite3_column_text(res, 2));
for (char *p = description; *p != '\0'; ++p) { for (char *p = description; *p != '\0'; ++p) {
if (*p == '\n') if (*p == '\n')
@ -468,14 +468,14 @@ char *www_files_areas() {
struct www_tag *cur_tag; struct www_tag *cur_tag;
struct www_tag *child_tag; struct www_tag *child_tag;
struct www_tag *child_child_tag; struct www_tag *child_child_tag;
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL); child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "File Directories"); child_child_tag = www_tag_new(NULL, "File Directories");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -483,11 +483,11 @@ char *www_files_areas() {
struct file_directory *dir = ptr_vector_get(&conf.file_directories, i); struct file_directory *dir = ptr_vector_get(&conf.file_directories, i);
if (!dir->display_on_web) if (!dir->display_on_web)
continue; continue;
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "conference-list-item"); www_tag_add_attrib(cur_tag, "class", "conference-list-item");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new(NULL, dir->name); child_tag = www_tag_new(NULL, dir->name);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
@ -496,22 +496,22 @@ char *www_files_areas() {
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "area-list-item"); www_tag_add_attrib(cur_tag, "class", "area-list-item");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL); child_tag = www_tag_new("a", NULL);
stralloc url = EMPTY_STRALLOC; stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "files/areas/"); stralloc_cats(&url, "files/areas/");
stralloc_cat_long(&url, i); stralloc_cat_long(&url, i);
stralloc_append1(&url, '/'); stralloc_append1(&url, '/');
stralloc_cat_long(&url, j); stralloc_cat_long(&url, j);
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s); www_tag_add_attrib(child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, sub->name); child_child_tag = www_tag_new(NULL, sub->name);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
} }

View File

@ -35,10 +35,10 @@ char *www_last10() {
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL); child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Last 10 Callers"); child_child_tag = www_tag_new(NULL, "Last 10 Callers");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -53,11 +53,11 @@ char *www_last10() {
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "last10-row"); www_tag_add_attrib(child_tag, "class", "last10-row");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "last10-name"); www_tag_add_attrib(child_child_tag, "class", "last10-name");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, callers[i].name); child_child_child_tag = www_tag_new(NULL, callers[i].name);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
@ -65,10 +65,10 @@ char *www_last10() {
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "last10-location"); www_tag_add_attrib(child_child_tag, "class", "last10-location");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, callers[i].location); child_child_child_tag = www_tag_new(NULL, callers[i].location);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "last10-date"); www_tag_add_attrib(child_child_tag, "class", "last10-date");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -86,14 +86,14 @@ char *www_last10() {
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "last10-new"); www_tag_add_attrib(child_child_tag, "class", "last10-new");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
stralloc url = EMPTY_STRALLOC; stralloc url = EMPTY_STRALLOC;
stralloc_copys(&url, conf.www_url); stralloc_copys(&url, conf.www_url);
stralloc_cats(&url, "static/newuser.png"); stralloc_cats(&url, "static/newuser.png");
stralloc_0(&url); stralloc_0(&url);
child_child_child_tag = www_tag_new("img", NULL); child_child_child_tag = www_tag_new("img", NULL);
www_tag_add_attrib(child_child_child_tag, "src", url.s); www_tag_add_attrib(child_child_child_tag, "src", url.s);
free(url.s); free(url.s);

View File

@ -110,7 +110,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
char *from; char *from;
char *subject; char *subject;
char datebuf[32]; char datebuf[32];
stralloc url; stralloc url;
struct www_tag *page; struct www_tag *page;
@ -119,7 +119,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
struct www_tag *child_child_tag; struct www_tag *child_child_tag;
struct www_tag *child_child_child_tag; struct www_tag *child_child_child_tag;
struct www_tag *child_child_child_child_tag; struct www_tag *child_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);
@ -134,10 +134,10 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
child_tag = www_tag_new("h2", NULL); child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, mc->name); child_child_tag = www_tag_new(NULL, mc->name);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, " - "); child_child_tag = www_tag_new(NULL, " - ");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -148,9 +148,9 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "button"); www_tag_add_attrib(cur_tag, "class", "button");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL); child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/new/"); stralloc_cats(&url, "msgs/new/");
@ -158,12 +158,12 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
stralloc_append1(&url, '/'); stralloc_append1(&url, '/');
stralloc_cat_long(&url, area); stralloc_cat_long(&url, area);
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s); www_tag_add_attrib(child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Message"); child_child_tag = www_tag_new(NULL, "New Message");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
} }
@ -172,7 +172,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
if (mhrs == NULL) { if (mhrs == NULL) {
cur_tag = www_tag_new("h3", NULL); cur_tag = www_tag_new("h3", NULL);
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new(NULL, "No Messages"); child_tag = www_tag_new(NULL, "No Messages");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
} else { } else {
@ -206,7 +206,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
subject = strdup(mhrs->msgs[i]->subject); subject = strdup(mhrs->msgs[i]->subject);
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
if (msgbase_is_flagged(user, conference, area, mhrs->msgs[i]->msg_h->MsgNum)) { if (msgbase_is_flagged(user, conference, area, mhrs->msgs[i]->msg_h->MsgNum)) {
www_tag_add_attrib(child_tag, "class", "msg-summary-flag"); www_tag_add_attrib(child_tag, "class", "msg-summary-flag");
} else if (mhrs->msgs[i]->msg_h->MsgNum > jlr.HighReadMsg) { } else if (mhrs->msgs[i]->msg_h->MsgNum > jlr.HighReadMsg) {
@ -215,23 +215,23 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
www_tag_add_attrib(child_tag, "class", "msg-summary-seen"); www_tag_add_attrib(child_tag, "class", "msg-summary-seen");
} }
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-id"); www_tag_add_attrib(child_child_tag, "class", "msg-summary-id");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cat_long(&url, mhrs->msgs[i]->msg_no + 1); stralloc_cat_long(&url, mhrs->msgs[i]->msg_no + 1);
stralloc_0(&url); stralloc_0(&url);
child_child_child_tag = www_tag_new(NULL, url.s); child_child_child_tag = www_tag_new(NULL, url.s);
free(url.s); free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-subject"); www_tag_add_attrib(child_child_tag, "class", "msg-summary-subject");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
@ -242,41 +242,41 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
stralloc_append1(&url, '/'); stralloc_append1(&url, '/');
stralloc_cat_long(&url, mhrs->msgs[i]->msg_h->MsgNum); stralloc_cat_long(&url, mhrs->msgs[i]->msg_h->MsgNum);
stralloc_0(&url); stralloc_0(&url);
child_child_child_tag = www_tag_new("a", NULL); child_child_child_tag = www_tag_new("a", NULL);
www_tag_add_attrib(child_child_child_tag, "href", url.s); www_tag_add_attrib(child_child_child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_child_child_tag = www_tag_new(NULL, subject); child_child_child_child_tag = www_tag_new(NULL, subject);
www_tag_add_child(child_child_child_tag, child_child_child_child_tag); www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-from"); www_tag_add_attrib(child_child_tag, "class", "msg-summary-from");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, from); child_child_child_tag = www_tag_new(NULL, from);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-to"); www_tag_add_attrib(child_child_tag, "class", "msg-summary-to");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, to); child_child_child_tag = www_tag_new(NULL, to);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("div", NULL); child_child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_child_tag, "class", "msg-summary-date"); www_tag_add_attrib(child_child_tag, "class", "msg-summary-date");
www_tag_add_child(child_tag, child_child_tag); 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);
child_child_child_tag = www_tag_new(NULL, datebuf); child_child_child_tag = www_tag_new(NULL, datebuf);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
free(to); free(to);
free(from); free(from);
free(subject); free(subject);
@ -286,11 +286,11 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "msg-summary-next"); www_tag_add_attrib(cur_tag, "class", "msg-summary-next");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL); child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/"); stralloc_cats(&url, "msgs/");
stralloc_cat_long(&url, conference); stralloc_cat_long(&url, conference);
@ -299,7 +299,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
stralloc_cats(&url, "/?skip="); stralloc_cats(&url, "/?skip=");
stralloc_cat_long(&url, skip + 50); stralloc_cat_long(&url, skip + 50);
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s); www_tag_add_attrib(child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
@ -310,7 +310,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
if (skip > 0) { if (skip > 0) {
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "msg-summary-prev"); www_tag_add_attrib(cur_tag, "class", "msg-summary-prev");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL); child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
if (skip - 50 < 0) { if (skip - 50 < 0) {
@ -329,10 +329,10 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
stralloc_cats(&url, "/?skip="); stralloc_cats(&url, "/?skip=");
stralloc_cat_long(&url, skip - 50); stralloc_cat_long(&url, skip - 50);
} }
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s); www_tag_add_attrib(child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Prev"); child_child_tag = www_tag_new(NULL, "Prev");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -380,7 +380,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
struct www_tag *child_tag; struct www_tag *child_tag;
struct www_tag *child_child_tag; struct www_tag *child_child_tag;
struct www_tag *child_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);
@ -475,24 +475,24 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
JAM_WriteLastRead(jb, user->id, &jlr); JAM_WriteLastRead(jb, user->id, &jlr);
JAM_CloseMB(jb); JAM_CloseMB(jb);
free(jb); free(jb);
page = www_tag_new(NULL, ""); page = www_tag_new(NULL, "");
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("a", NULL); child_tag = www_tag_new("a", NULL);
stralloc url = EMPTY_STRALLOC; stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/"); stralloc_cats(&url, "msgs/");
stralloc_cat_long(&url, conference); stralloc_cat_long(&url, conference);
stralloc_append1(&url, '/'); stralloc_append1(&url, '/');
stralloc_cat_long(&url, area); stralloc_cat_long(&url, area);
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_tag, "href", url.s); www_tag_add_attrib(child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
@ -508,17 +508,17 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_child_tag = www_tag_new(NULL, ma->name); child_child_child_tag = www_tag_new(NULL, ma->name);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
if (msgbase_is_flagged(user, conference, area, msg)) { if (msgbase_is_flagged(user, conference, area, msg)) {
www_tag_add_attrib(cur_tag, "class", "msg-view-header-flagged"); www_tag_add_attrib(cur_tag, "class", "msg-view-header-flagged");
} else { } else {
www_tag_add_attrib(cur_tag, "class", "msg-view-header"); www_tag_add_attrib(cur_tag, "class", "msg-view-header");
} }
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
www_tag_add_attrib(child_tag, "class", "msg-view-subject"); www_tag_add_attrib(child_tag, "class", "msg-view-subject");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
@ -551,7 +551,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_tag = www_tag_new("span", NULL); child_child_tag = www_tag_new("span", NULL);
www_tag_add_attrib(child_child_tag, "class", "bbsname"); www_tag_add_attrib(child_child_tag, "class", "bbsname");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new(NULL, nodename); child_child_child_tag = www_tag_new(NULL, nodename);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
@ -574,7 +574,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
} else { } else {
snprintf(buffer, sizeof buffer, "From: %s", from); snprintf(buffer, sizeof buffer, "From: %s", from);
child_child_tag = www_tag_new(NULL, buffer); child_child_tag = www_tag_new(NULL, buffer);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
} }
child_tag = www_tag_new("div", NULL); child_tag = www_tag_new("div", NULL);
@ -583,7 +583,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_tag = www_tag_new(NULL, "To : "); child_child_tag = www_tag_new(NULL, "To : ");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new(NULL, to); child_child_tag = www_tag_new(NULL, to);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -609,9 +609,9 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new("a", NULL); child_child_tag = www_tag_new("a", NULL);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/flag/"); stralloc_cats(&url, "msgs/flag/");
stralloc_cat_long(&url, conference); stralloc_cat_long(&url, conference);
@ -620,24 +620,24 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
stralloc_append1(&url, '/'); stralloc_append1(&url, '/');
stralloc_cat_long(&url, msg); stralloc_cat_long(&url, msg);
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_child_tag, "href", url.s); www_tag_add_attrib(child_child_tag, "href", url.s);
free(url.s); free(url.s);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_child_tag = www_tag_new("img", NULL); child_child_child_tag = www_tag_new("img", NULL);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "static/flag.png"); stralloc_cats(&url, "static/flag.png");
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_child_child_tag, "src", url.s); www_tag_add_attrib(child_child_child_tag, "src", url.s);
free(url.s); free(url.s);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "id", "msgbody"); www_tag_add_attrib(cur_tag, "id", "msgbody");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
@ -650,23 +650,23 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "msg-reply-form"); www_tag_add_attrib(cur_tag, "class", "msg-reply-form");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h3", NULL); child_tag = www_tag_new("h3", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "Reply"); child_child_tag = www_tag_new(NULL, "Reply");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_tag = www_tag_new("form", NULL); child_tag = www_tag_new("form", NULL);
url = EMPTY_STRALLOC; url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/"); stralloc_cats(&url, "msgs/");
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(child_tag, "action", url.s); www_tag_add_attrib(child_tag, "action", url.s);
free(url.s); free(url.s);
www_tag_add_attrib(child_tag, "method", "POST"); 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_attrib(child_tag, "enctype", "application/x-www-form-urlencoded;charset=UTF-8");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
@ -697,13 +697,13 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_tag = www_tag_new(NULL, "To : "); child_child_tag = www_tag_new(NULL, "To : ");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL); child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "text"); 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, "name", "recipient");
www_tag_add_attrib(child_child_tag, "value", from); www_tag_add_attrib(child_child_tag, "value", from);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL); child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -713,16 +713,16 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
child_child_tag = www_tag_new("input", NULL); child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "text"); www_tag_add_attrib(child_child_tag, "type", "text");
www_tag_add_attrib(child_child_tag, "name", "subject"); www_tag_add_attrib(child_child_tag, "name", "subject");
if (strncasecmp(subject, "re:", 3) != 0) { if (strncasecmp(subject, "re:", 3) != 0) {
snprintf(buffer, sizeof buffer, "RE: %s", subject); snprintf(buffer, sizeof buffer, "RE: %s", subject);
www_tag_add_attrib(child_child_tag, "value", buffer); www_tag_add_attrib(child_child_tag, "value", buffer);
} else { } else {
www_tag_add_attrib(child_child_tag, "value", subject); www_tag_add_attrib(child_child_tag, "value", subject);
} }
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL); child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
@ -733,9 +733,9 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
www_tag_add_attrib(child_child_tag, "wrap", "soft"); www_tag_add_attrib(child_child_tag, "wrap", "soft");
www_tag_add_attrib(child_child_tag, "id", "replybody"); www_tag_add_attrib(child_child_tag, "id", "replybody");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
stralloc text = EMPTY_STRALLOC; stralloc text = EMPTY_STRALLOC;
stralloc_append1(&text, ' '); stralloc_append1(&text, ' ');
stralloc_append1(&text, from[0]); stralloc_append1(&text, from[0]);
stralloc_cats(&text, "> "); stralloc_cats(&text, "> ");
@ -781,20 +781,20 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
stralloc_cats(&text, buffer); stralloc_cats(&text, buffer);
} }
free(body2); free(body2);
stralloc_0(&text); stralloc_0(&text);
child_child_child_tag = www_tag_new(NULL, text.s); child_child_child_tag = www_tag_new(NULL, text.s);
www_tag_add_child(child_child_tag, child_child_child_tag); www_tag_add_child(child_child_tag, child_child_child_tag);
child_child_tag = www_tag_new("br", NULL); child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("input", NULL); child_child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_child_tag, "type", "submit"); 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, "name", "submit");
www_tag_add_attrib(child_child_tag, "value", "Reply"); www_tag_add_attrib(child_child_tag, "value", "Reply");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
child_child_tag = www_tag_new("br", NULL); child_child_tag = www_tag_new("br", NULL);
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
} }
@ -1148,11 +1148,11 @@ 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");
} }
char *p = body; char *p = body;
stralloc unhtmlized = EMPTY_STRALLOC; stralloc unhtmlized = EMPTY_STRALLOC;
// remove nbsp // remove nbsp
while (*p != '\0') { while (*p != '\0') {
if ((*p & 0xff) == 0xc2 && (*(p + 1) & 0xff) == 0xa0) { if ((*p & 0xff) == 0xc2 && (*(p + 1) & 0xff) == 0xa0) {
@ -1161,12 +1161,12 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
} else { } else {
stralloc_append1(&unhtmlized, *p); stralloc_append1(&unhtmlized, *p);
} }
p++; p++;
} }
stralloc_0(&unhtmlized); stralloc_0(&unhtmlized);
body2 = www_wordwrap(unhtmlized.s, 73); body2 = www_wordwrap(unhtmlized.s, 73);
free(unhtmlized.s); free(unhtmlized.s);
if (body2 == NULL) { if (body2 == NULL) {
@ -1176,9 +1176,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);
@ -1237,28 +1237,28 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
struct www_tag *cur_tag; struct www_tag *cur_tag;
struct www_tag *child_tag; struct www_tag *child_tag;
struct www_tag *child_child_tag; struct www_tag *child_child_tag;
char buffer[10]; char buffer[10];
cur_tag = www_tag_new("div", NULL); cur_tag = www_tag_new("div", NULL);
www_tag_add_attrib(cur_tag, "class", "content-header"); www_tag_add_attrib(cur_tag, "class", "content-header");
www_tag_add_child(page, cur_tag); www_tag_add_child(page, cur_tag);
child_tag = www_tag_new("h2", NULL); child_tag = www_tag_new("h2", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_child_tag = www_tag_new(NULL, "New Message"); child_child_tag = www_tag_new(NULL, "New Message");
www_tag_add_child(child_tag, child_child_tag); www_tag_add_child(child_tag, child_child_tag);
cur_tag = www_tag_new("form", NULL); cur_tag = www_tag_new("form", NULL);
stralloc url = EMPTY_STRALLOC; stralloc url = EMPTY_STRALLOC;
stralloc_cats(&url, conf.www_url); stralloc_cats(&url, conf.www_url);
stralloc_cats(&url, "msgs/"); stralloc_cats(&url, "msgs/");
stralloc_0(&url); stralloc_0(&url);
www_tag_add_attrib(cur_tag, "action", url.s); www_tag_add_attrib(cur_tag, "action", url.s);
free(url.s); free(url.s);
@ -1273,7 +1273,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
snprintf(buffer, sizeof buffer, "%d", conference); snprintf(buffer, sizeof buffer, "%d", conference);
www_tag_add_attrib(child_tag, "value", buffer); www_tag_add_attrib(child_tag, "value", buffer);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("input", NULL); child_tag = www_tag_new("input", NULL);
www_tag_add_attrib(child_tag, "type", "hidden"); www_tag_add_attrib(child_tag, "type", "hidden");
www_tag_add_attrib(child_tag, "name", "area"); www_tag_add_attrib(child_tag, "name", "area");
@ -1332,7 +1332,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
www_tag_add_attrib(child_tag, "name", "submit"); www_tag_add_attrib(child_tag, "name", "submit");
www_tag_add_attrib(child_tag, "value", "Send"); www_tag_add_attrib(child_tag, "value", "Send");
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);
child_tag = www_tag_new("br", NULL); child_tag = www_tag_new("br", NULL);
www_tag_add_child(cur_tag, child_tag); www_tag_add_child(cur_tag, child_tag);

View File

@ -17,95 +17,95 @@ static char *www_tag_sanatize(char *data, int isdata) {
case '>': case '>':
stralloc_cats(&str, "&gt;"); stralloc_cats(&str, "&gt;");
break; break;
case '\x01': case '\x01':
stralloc_cats(&str, "&#x263A;"); stralloc_cats(&str, "&#x263A;");
break; break;
case '\x02': case '\x02':
stralloc_cats(&str, "&#x263B;"); stralloc_cats(&str, "&#x263B;");
break; break;
case '\x03': case '\x03':
stralloc_cats(&str, "&#x2665;"); stralloc_cats(&str, "&#x2665;");
break; break;
case '\x04': case '\x04':
stralloc_cats(&str, "&#x2666;"); stralloc_cats(&str, "&#x2666;");
break; break;
case '\x05': case '\x05':
stralloc_cats(&str, "&#x2663;"); stralloc_cats(&str, "&#x2663;");
break; break;
case '\x06': case '\x06':
stralloc_cats(&str, "&#x2660;"); stralloc_cats(&str, "&#x2660;");
break; break;
case '\x07': case '\x07':
stralloc_cats(&str, "&#x2022;"); stralloc_cats(&str, "&#x2022;");
break; break;
case '\x08': case '\x08':
stralloc_cats(&str, "&#x25D8;"); stralloc_cats(&str, "&#x25D8;");
break; break;
case '\x09': case '\x09':
stralloc_cats(&str, "&#x25CB;"); stralloc_cats(&str, "&#x25CB;");
break; break;
case '\x0b': case '\x0b':
stralloc_cats(&str, "&#x2642;"); stralloc_cats(&str, "&#x2642;");
break; break;
case '\x0c': case '\x0c':
stralloc_cats(&str, "&#x2640;"); stralloc_cats(&str, "&#x2640;");
break; break;
case '\x0e': case '\x0e':
stralloc_cats(&str, "&#x266B;"); stralloc_cats(&str, "&#x266B;");
break; break;
case '\x0f': case '\x0f':
stralloc_cats(&str, "&#x263C;"); stralloc_cats(&str, "&#x263C;");
break; break;
case '\x10': case '\x10':
stralloc_cats(&str, "&#x25B8;"); stralloc_cats(&str, "&#x25B8;");
break; break;
case '\x11': case '\x11':
stralloc_cats(&str, "&#x25C2;"); stralloc_cats(&str, "&#x25C2;");
break; break;
case '\x12': case '\x12':
stralloc_cats(&str, "&#x2195;"); stralloc_cats(&str, "&#x2195;");
break; break;
case '\x13': case '\x13':
stralloc_cats(&str, "&#x203C;"); stralloc_cats(&str, "&#x203C;");
break; break;
case '\x14': case '\x14':
stralloc_cats(&str, "&#x00B6;"); stralloc_cats(&str, "&#x00B6;");
break; break;
case '\x15': case '\x15':
stralloc_cats(&str, "&#x00A7;"); stralloc_cats(&str, "&#x00A7;");
break; break;
case '\x16': case '\x16':
stralloc_cats(&str, "&#x25AC;"); stralloc_cats(&str, "&#x25AC;");
break; break;
case '\x17': case '\x17':
stralloc_cats(&str, "&#x21A8;"); stralloc_cats(&str, "&#x21A8;");
break; break;
case '\x18': case '\x18':
stralloc_cats(&str, "&#x2191;"); stralloc_cats(&str, "&#x2191;");
break; break;
case '\x19': case '\x19':
stralloc_cats(&str, "&#x2193;"); stralloc_cats(&str, "&#x2193;");
break; break;
case '\x1a': case '\x1a':
stralloc_cats(&str, "&#x2192;"); stralloc_cats(&str, "&#x2192;");
break; break;
case '\x1b': case '\x1b':
stralloc_cats(&str, "&#x2190;"); stralloc_cats(&str, "&#x2190;");
break; break;
case '\x1c': case '\x1c':
stralloc_cats(&str, "&#x221F;"); stralloc_cats(&str, "&#x221F;");
break; break;
case '\x1d': case '\x1d':
stralloc_cats(&str, "&#x2194;"); stralloc_cats(&str, "&#x2194;");
break; break;
case '\x1e': case '\x1e':
stralloc_cats(&str, "&#x25B4;"); stralloc_cats(&str, "&#x25B4;");
break; break;
case '\x1f': case '\x1f':
stralloc_cats(&str, "&#x25BE;"); stralloc_cats(&str, "&#x25BE;");
break; break;
/* /*
case '\x21': case '\x21':
stralloc_cats(&str, "&#x0021;"); stralloc_cats(&str, "&#x0021;");
break; break;
case '\x22': case '\x22':
@ -166,364 +166,364 @@ static char *www_tag_sanatize(char *data, int isdata) {
case '\x88': case '\x88':
stralloc_cats(&str, "&#x00EA;"); stralloc_cats(&str, "&#x00EA;");
break; break;
case '\x89': case '\x89':
stralloc_cats(&str, "&#x00EB;"); stralloc_cats(&str, "&#x00EB;");
break; break;
case '\x8a': case '\x8a':
stralloc_cats(&str, "&#x00E8;"); stralloc_cats(&str, "&#x00E8;");
break; break;
case '\x8b': case '\x8b':
stralloc_cats(&str, "&#x00EF;"); stralloc_cats(&str, "&#x00EF;");
break; break;
case '\x8c': case '\x8c':
stralloc_cats(&str, "&#x00EE;"); stralloc_cats(&str, "&#x00EE;");
break; break;
case '\x8d': case '\x8d':
stralloc_cats(&str, "&#x00EC;"); stralloc_cats(&str, "&#x00EC;");
break; break;
case '\x8e': case '\x8e':
stralloc_cats(&str, "&#x00C4;"); stralloc_cats(&str, "&#x00C4;");
break; break;
case '\x8f': case '\x8f':
stralloc_cats(&str, "&#x00C5;"); stralloc_cats(&str, "&#x00C5;");
break; break;
case '\x90': case '\x90':
stralloc_cats(&str, "&#x00C9;"); stralloc_cats(&str, "&#x00C9;");
break; break;
case '\x91': case '\x91':
stralloc_cats(&str, "&#x00E6;"); stralloc_cats(&str, "&#x00E6;");
break; break;
case '\x92': case '\x92':
stralloc_cats(&str, "&#x00C6;"); stralloc_cats(&str, "&#x00C6;");
break; break;
case '\x93': case '\x93':
stralloc_cats(&str, "&#x00F4;"); stralloc_cats(&str, "&#x00F4;");
break; break;
case '\x94': case '\x94':
stralloc_cats(&str, "&#x00F6;"); stralloc_cats(&str, "&#x00F6;");
break; break;
case '\x95': case '\x95':
stralloc_cats(&str, "&#x00F2;"); stralloc_cats(&str, "&#x00F2;");
break; break;
case '\x96': case '\x96':
stralloc_cats(&str, "&#x00FB;"); stralloc_cats(&str, "&#x00FB;");
break; break;
case '\x97': case '\x97':
stralloc_cats(&str, "&#x00F9;"); stralloc_cats(&str, "&#x00F9;");
break; break;
case '\x98': case '\x98':
stralloc_cats(&str, "&#x00FF;"); stralloc_cats(&str, "&#x00FF;");
break; break;
case '\x99': case '\x99':
stralloc_cats(&str, "&#x00D6;"); stralloc_cats(&str, "&#x00D6;");
break; break;
case '\x9a': case '\x9a':
stralloc_cats(&str, "&#x00DC;"); stralloc_cats(&str, "&#x00DC;");
break; break;
case '\x9b': case '\x9b':
stralloc_cats(&str, "&#x00A2;"); stralloc_cats(&str, "&#x00A2;");
break; break;
case '\x9c': case '\x9c':
stralloc_cats(&str, "&#x00A3;"); stralloc_cats(&str, "&#x00A3;");
break; break;
case '\x9d': case '\x9d':
stralloc_cats(&str, "&#x00A5;"); stralloc_cats(&str, "&#x00A5;");
break; break;
case '\x9e': case '\x9e':
stralloc_cats(&str, "&#x20A7;"); stralloc_cats(&str, "&#x20A7;");
break; break;
case '\x9f': case '\x9f':
stralloc_cats(&str, "&#x0192;"); stralloc_cats(&str, "&#x0192;");
break; break;
case '\xa0': case '\xa0':
stralloc_cats(&str, "&#x00E1;"); stralloc_cats(&str, "&#x00E1;");
break; break;
case '\xa1': case '\xa1':
stralloc_cats(&str, "&#x00ED;"); stralloc_cats(&str, "&#x00ED;");
break; break;
case '\xa2': case '\xa2':
stralloc_cats(&str, "&#x00F3;"); stralloc_cats(&str, "&#x00F3;");
break; break;
case '\xa3': case '\xa3':
stralloc_cats(&str, "&#x00FA;"); stralloc_cats(&str, "&#x00FA;");
break; break;
case '\xa4': case '\xa4':
stralloc_cats(&str, "&#x00F1;"); stralloc_cats(&str, "&#x00F1;");
break; break;
case '\xa5': case '\xa5':
stralloc_cats(&str, "&#x00D1;"); stralloc_cats(&str, "&#x00D1;");
break; break;
case '\xa6': case '\xa6':
stralloc_cats(&str, "&#x00AA;"); stralloc_cats(&str, "&#x00AA;");
break; break;
case '\xa7': case '\xa7':
stralloc_cats(&str, "&#x00BA;"); stralloc_cats(&str, "&#x00BA;");
break; break;
case '\xa8': case '\xa8':
stralloc_cats(&str, "&#x00BF;"); stralloc_cats(&str, "&#x00BF;");
break; break;
case '\xa9': case '\xa9':
stralloc_cats(&str, "&#x2310;"); stralloc_cats(&str, "&#x2310;");
break; break;
case '\xaa': case '\xaa':
stralloc_cats(&str, "&#x00AC;"); stralloc_cats(&str, "&#x00AC;");
break; break;
case '\xab': case '\xab':
stralloc_cats(&str, "&#x00BD;"); stralloc_cats(&str, "&#x00BD;");
break; break;
case '\xac': case '\xac':
stralloc_cats(&str, "&#x00BC;"); stralloc_cats(&str, "&#x00BC;");
break; break;
case '\xad': case '\xad':
stralloc_cats(&str, "&#x00A1;"); stralloc_cats(&str, "&#x00A1;");
break; break;
case '\xae': case '\xae':
stralloc_cats(&str, "&#x00AB;"); stralloc_cats(&str, "&#x00AB;");
break; break;
case '\xaf': case '\xaf':
stralloc_cats(&str, "&#x00BB;"); stralloc_cats(&str, "&#x00BB;");
break; break;
case '\xb0': case '\xb0':
stralloc_cats(&str, "&#x2591;"); stralloc_cats(&str, "&#x2591;");
break; break;
case '\xb1': case '\xb1':
stralloc_cats(&str, "&#x2592;"); stralloc_cats(&str, "&#x2592;");
break; break;
case '\xb2': case '\xb2':
stralloc_cats(&str, "&#x2593;"); stralloc_cats(&str, "&#x2593;");
break; break;
case '\xb3': case '\xb3':
stralloc_cats(&str, "&#x2502;"); stralloc_cats(&str, "&#x2502;");
break; break;
case '\xb4': case '\xb4':
stralloc_cats(&str, "&#x2524;"); stralloc_cats(&str, "&#x2524;");
break; break;
case '\xb5': case '\xb5':
stralloc_cats(&str, "&#x2561;"); stralloc_cats(&str, "&#x2561;");
break; break;
case '\xb6': case '\xb6':
stralloc_cats(&str, "&#x2562;"); stralloc_cats(&str, "&#x2562;");
break; break;
case '\xb7': case '\xb7':
stralloc_cats(&str, "&#x2556;"); stralloc_cats(&str, "&#x2556;");
break; break;
case '\xb8': case '\xb8':
stralloc_cats(&str, "&#x2555;"); stralloc_cats(&str, "&#x2555;");
break; break;
case '\xb9': case '\xb9':
stralloc_cats(&str, "&#x2563;"); stralloc_cats(&str, "&#x2563;");
break; break;
case '\xba': case '\xba':
stralloc_cats(&str, "&#x2551;"); stralloc_cats(&str, "&#x2551;");
break; break;
case '\xbb': case '\xbb':
stralloc_cats(&str, "&#x2557;"); stralloc_cats(&str, "&#x2557;");
break; break;
case '\xbc': case '\xbc':
stralloc_cats(&str, "&#x255D;"); stralloc_cats(&str, "&#x255D;");
break; break;
case '\xbd': case '\xbd':
stralloc_cats(&str, "&#x255C;"); stralloc_cats(&str, "&#x255C;");
break; break;
case '\xbe': case '\xbe':
stralloc_cats(&str, "&#x255B;"); stralloc_cats(&str, "&#x255B;");
break; break;
case '\xbf': case '\xbf':
stralloc_cats(&str, "&#x2510;"); stralloc_cats(&str, "&#x2510;");
break; break;
case '\xc0': case '\xc0':
stralloc_cats(&str, "&#x2514;"); stralloc_cats(&str, "&#x2514;");
break; break;
case '\xc1': case '\xc1':
stralloc_cats(&str, "&#x2534;"); stralloc_cats(&str, "&#x2534;");
break; break;
case '\xc2': case '\xc2':
stralloc_cats(&str, "&#x252C;"); stralloc_cats(&str, "&#x252C;");
break; break;
case '\xc3': case '\xc3':
stralloc_cats(&str, "&#x251C;"); stralloc_cats(&str, "&#x251C;");
break; break;
case '\xc4': case '\xc4':
stralloc_cats(&str, "&#x2500;"); stralloc_cats(&str, "&#x2500;");
break; break;
case '\xc5': case '\xc5':
stralloc_cats(&str, "&#x253C;"); stralloc_cats(&str, "&#x253C;");
break; break;
case '\xc6': case '\xc6':
stralloc_cats(&str, "&#x255E;"); stralloc_cats(&str, "&#x255E;");
break; break;
case '\xc7': case '\xc7':
stralloc_cats(&str, "&#x255F;"); stralloc_cats(&str, "&#x255F;");
break; break;
case '\xc8': case '\xc8':
stralloc_cats(&str, "&#x255A;"); stralloc_cats(&str, "&#x255A;");
break; break;
case '\xc9': case '\xc9':
stralloc_cats(&str, "&#x2554;"); stralloc_cats(&str, "&#x2554;");
break; break;
case '\xca': case '\xca':
stralloc_cats(&str, "&#x2569;"); stralloc_cats(&str, "&#x2569;");
break; break;
case '\xcb': case '\xcb':
stralloc_cats(&str, "&#x2566;"); stralloc_cats(&str, "&#x2566;");
break; break;
case '\xcc': case '\xcc':
stralloc_cats(&str, "&#x2560;"); stralloc_cats(&str, "&#x2560;");
break; break;
case '\xcd': case '\xcd':
stralloc_cats(&str, "&#x2550;"); stralloc_cats(&str, "&#x2550;");
break; break;
case '\xce': case '\xce':
stralloc_cats(&str, "&#x256C;"); stralloc_cats(&str, "&#x256C;");
break; break;
case '\xcf': case '\xcf':
stralloc_cats(&str, "&#x2567;"); stralloc_cats(&str, "&#x2567;");
break; break;
case '\xd0': case '\xd0':
stralloc_cats(&str, "&#x2568;"); stralloc_cats(&str, "&#x2568;");
break; break;
case '\xd1': case '\xd1':
stralloc_cats(&str, "&#x2564;"); stralloc_cats(&str, "&#x2564;");
break; break;
case '\xd2': case '\xd2':
stralloc_cats(&str, "&#x2565;"); stralloc_cats(&str, "&#x2565;");
break; break;
case '\xd3': case '\xd3':
stralloc_cats(&str, "&#x2559;"); stralloc_cats(&str, "&#x2559;");
break; break;
case '\xd4': case '\xd4':
stralloc_cats(&str, "&#x255B;"); stralloc_cats(&str, "&#x255B;");
break; break;
case '\xd5': case '\xd5':
stralloc_cats(&str, "&#x2552;"); stralloc_cats(&str, "&#x2552;");
break; break;
case '\xd6': case '\xd6':
stralloc_cats(&str, "&#x2553;"); stralloc_cats(&str, "&#x2553;");
break; break;
case '\xd7': case '\xd7':
stralloc_cats(&str, "&#x256B;"); stralloc_cats(&str, "&#x256B;");
break; break;
case '\xd8': case '\xd8':
stralloc_cats(&str, "&#x256A;"); stralloc_cats(&str, "&#x256A;");
break; break;
case '\xd9': case '\xd9':
stralloc_cats(&str, "&#x2518;"); stralloc_cats(&str, "&#x2518;");
break; break;
case '\xda': case '\xda':
stralloc_cats(&str, "&#x250C;"); stralloc_cats(&str, "&#x250C;");
break; break;
case '\xdb': case '\xdb':
stralloc_cats(&str, "&#x2588;"); stralloc_cats(&str, "&#x2588;");
break; break;
case '\xdc': case '\xdc':
stralloc_cats(&str, "&#x2584;"); stralloc_cats(&str, "&#x2584;");
break; break;
case '\xdd': case '\xdd':
stralloc_cats(&str, "&#x258C;"); stralloc_cats(&str, "&#x258C;");
break; break;
case '\xde': case '\xde':
stralloc_cats(&str, "&#x2590;"); stralloc_cats(&str, "&#x2590;");
break; break;
case '\xdf': case '\xdf':
stralloc_cats(&str, "&#x2580;"); stralloc_cats(&str, "&#x2580;");
break; break;
case '\xe0': case '\xe0':
stralloc_cats(&str, "&#x03B1;"); stralloc_cats(&str, "&#x03B1;");
break; break;
case '\xe1': case '\xe1':
stralloc_cats(&str, "&#x03B2;"); stralloc_cats(&str, "&#x03B2;");
break; break;
case '\xe2': case '\xe2':
stralloc_cats(&str, "&#x0393;"); stralloc_cats(&str, "&#x0393;");
break; break;
case '\xe3': case '\xe3':
stralloc_cats(&str, "&#x03C0;"); stralloc_cats(&str, "&#x03C0;");
break; break;
case '\xe4': case '\xe4':
stralloc_cats(&str, "&#x03A3;"); stralloc_cats(&str, "&#x03A3;");
break; break;
case '\xe5': case '\xe5':
stralloc_cats(&str, "&#x03C3;"); stralloc_cats(&str, "&#x03C3;");
break; break;
case '\xe6': case '\xe6':
stralloc_cats(&str, "&#x00B5;"); stralloc_cats(&str, "&#x00B5;");
break; break;
case '\xe7': case '\xe7':
stralloc_cats(&str, "&#x03C4;"); stralloc_cats(&str, "&#x03C4;");
break; break;
case '\xe8': case '\xe8':
stralloc_cats(&str, "&#x03A6;"); stralloc_cats(&str, "&#x03A6;");
break; break;
case '\xe9': case '\xe9':
stralloc_cats(&str, "&#x0398;"); stralloc_cats(&str, "&#x0398;");
break; break;
case '\xea': case '\xea':
stralloc_cats(&str, "&#x03A9;"); stralloc_cats(&str, "&#x03A9;");
break; break;
case '\xeb': case '\xeb':
stralloc_cats(&str, "&#x03B4;"); stralloc_cats(&str, "&#x03B4;");
break; break;
case '\xec': case '\xec':
stralloc_cats(&str, "&#x221E;"); stralloc_cats(&str, "&#x221E;");
break; break;
case '\xed': case '\xed':
stralloc_cats(&str, "&#x2205;"); stralloc_cats(&str, "&#x2205;");
break; break;
case '\xee': case '\xee':
stralloc_cats(&str, "&#x2208;"); stralloc_cats(&str, "&#x2208;");
break; break;
case '\xef': case '\xef':
stralloc_cats(&str, "&#x2229;"); stralloc_cats(&str, "&#x2229;");
break; break;
case '\xf0': case '\xf0':
stralloc_cats(&str, "&#x2261;"); stralloc_cats(&str, "&#x2261;");
break; break;
case '\xf1': case '\xf1':
stralloc_cats(&str, "&#x00B1;"); stralloc_cats(&str, "&#x00B1;");
break; break;
case '\xf2': case '\xf2':
stralloc_cats(&str, "&#x2265;"); stralloc_cats(&str, "&#x2265;");
break; break;
case '\xf3': case '\xf3':
stralloc_cats(&str, "&#x2264;"); stralloc_cats(&str, "&#x2264;");
break; break;
case '\xf4': case '\xf4':
stralloc_cats(&str, "&#x2320;"); stralloc_cats(&str, "&#x2320;");
break; break;
case '\xf5': case '\xf5':
stralloc_cats(&str, "&#x2321;"); stralloc_cats(&str, "&#x2321;");
break; break;
case '\xf6': case '\xf6':
stralloc_cats(&str, "&#x00F7;"); stralloc_cats(&str, "&#x00F7;");
break; break;
case '\xf7': case '\xf7':
stralloc_cats(&str, "&#x2248;"); stralloc_cats(&str, "&#x2248;");
break; break;
case '\xf8': case '\xf8':
stralloc_cats(&str, "&#x00B0;"); stralloc_cats(&str, "&#x00B0;");
break; break;
case '\xf9': case '\xf9':
stralloc_cats(&str, "&#x2219;"); stralloc_cats(&str, "&#x2219;");
break; break;
case '\xfa': case '\xfa':
stralloc_cats(&str, "&#x00B7;"); stralloc_cats(&str, "&#x00B7;");
break; break;
case '\xfb': case '\xfb':
stralloc_cats(&str, "&#x221A;"); stralloc_cats(&str, "&#x221A;");
break; break;
case '\xfc': case '\xfc':
stralloc_cats(&str, "&#x207F;"); stralloc_cats(&str, "&#x207F;");
break; break;
case '\xfd': case '\xfd':
stralloc_cats(&str, "&#x00B2;"); stralloc_cats(&str, "&#x00B2;");
break; break;
case '\xfe': case '\xfe':
stralloc_cats(&str, "&#x25AA;"); stralloc_cats(&str, "&#x25AA;");
break; break;
case ' ': case ' ':
if (isdata) { if (isdata) {
if (*(p+1) == ' ') { if (*(p+1) == ' ') {
stralloc_cats(&str, "&nbsp;"); stralloc_cats(&str, "&nbsp;");
} else { } else {
if (p > data && (*(p-1) == ' ' || *(p-1) == '\n')) { if (p > data && (*(p-1) == ' ' || *(p-1) == '\n')) {
stralloc_cats(&str, "&nbsp;"); stralloc_cats(&str, "&nbsp;");
@ -541,7 +541,7 @@ static char *www_tag_sanatize(char *data, int isdata) {
default: default:
stralloc_append1(&str, *p); stralloc_append1(&str, *p);
break; break;
} }
} }
stralloc_0(&str); stralloc_0(&str);
return str.s; return str.s;
@ -549,27 +549,27 @@ static char *www_tag_sanatize(char *data, int isdata) {
struct www_tag *www_tag_new(char *tag, char *data) { struct www_tag *www_tag_new(char *tag, char *data) {
struct www_tag *new_tag = malloz(sizeof(struct www_tag)); struct www_tag *new_tag = malloz(sizeof(struct www_tag));
new_tag->attribs = EMPTY_PTR_VECTOR; new_tag->attribs = EMPTY_PTR_VECTOR;
new_tag->values = EMPTY_PTR_VECTOR; new_tag->values = EMPTY_PTR_VECTOR;
new_tag->children = EMPTY_PTR_VECTOR; new_tag->children = EMPTY_PTR_VECTOR;
if (tag == NULL) { if (tag == NULL) {
new_tag->tag = NULL; new_tag->tag = NULL;
/* SANATIZE DATA HERE */ /* SANATIZE DATA HERE */
new_tag->data = www_tag_sanatize(data, 1); new_tag->data = www_tag_sanatize(data, 1);
} else { } else {
new_tag->tag = strdup(tag); new_tag->tag = strdup(tag);
new_tag->data = NULL; new_tag->data = NULL;
init_ptr_vector(&new_tag->attribs); init_ptr_vector(&new_tag->attribs);
init_ptr_vector(&new_tag->values); init_ptr_vector(&new_tag->values);
} }
init_ptr_vector(&new_tag->children); init_ptr_vector(&new_tag->children);
return new_tag; return new_tag;
} }
@ -595,14 +595,14 @@ char *www_tag_destroy(struct www_tag *tag) {
struct www_tag *child = ptr_vector_del(&tag->children, 0); struct www_tag *child = ptr_vector_del(&tag->children, 0);
www_tag_destroy(child); www_tag_destroy(child);
} }
if (tag->tag != NULL) { if (tag->tag != NULL) {
ptr_vector_apply(&tag->attribs, free); ptr_vector_apply(&tag->attribs, free);
destroy_ptr_vector(&tag->attribs); destroy_ptr_vector(&tag->attribs);
ptr_vector_apply(&tag->values, free); ptr_vector_apply(&tag->values, free);
destroy_ptr_vector(&tag->values); destroy_ptr_vector(&tag->values);
} }
destroy_ptr_vector(&tag->children); destroy_ptr_vector(&tag->children);
} }
char *www_tag_unwravel(struct www_tag *tag) { char *www_tag_unwravel(struct www_tag *tag) {
@ -621,14 +621,14 @@ char *www_tag_unwravel(struct www_tag *tag) {
stralloc_cats(&thedata, (char *)ptr_vector_get(&child->values, i)); stralloc_cats(&thedata, (char *)ptr_vector_get(&child->values, i));
stralloc_append1(&thedata, '\"'); stralloc_append1(&thedata, '\"');
} }
stralloc_append1(&thedata, '>'); stralloc_append1(&thedata, '>');
} }
char *data = www_tag_unwravel(child); char *data = www_tag_unwravel(child);
stralloc_cats(&thedata, data); stralloc_cats(&thedata, data);
free(data); free(data);
if (child->tag != NULL) { if (child->tag != NULL) {
stralloc_cats(&thedata, "</"); stralloc_cats(&thedata, "</");
stralloc_cats(&thedata, child->tag); stralloc_cats(&thedata, child->tag);
@ -654,17 +654,17 @@ char *www_tag_unwravel(struct www_tag *tag) {
ptr_vector_apply(&child->attribs, free); ptr_vector_apply(&child->attribs, free);
destroy_ptr_vector(&child->attribs); destroy_ptr_vector(&child->attribs);
ptr_vector_apply(&child->values, free); ptr_vector_apply(&child->values, free);
destroy_ptr_vector(&child->values); destroy_ptr_vector(&child->values);
} else { } else {
stralloc_cats(&thedata, child->data); stralloc_cats(&thedata, child->data);
} }
} }
destroy_ptr_vector(&child->children); destroy_ptr_vector(&child->children);
} }
stralloc_0(&thedata); stralloc_0(&thedata);
return thedata.s; return thedata.s;
} }

View File

@ -9,7 +9,7 @@ struct www_tag {
char *data; char *data;
struct ptr_vector attribs; struct ptr_vector attribs;
struct ptr_vector values; struct ptr_vector values;
struct ptr_vector children; struct ptr_vector children;
}; };