*/
/*@{*/
#include "webcit.h"
-#include "vcard.h"
#include "webserver.h"
#include "groupdav.h"
+#include "html.h"
#define SUBJ_COL_WIDTH_PCT 50 /**< Mailbox view column width */
#define SENDER_COL_WIDTH_PCT 30 /**< Mailbox view column width */
* \param buf the stringbuffer to process
*/
void utf8ify_rfc822_string(char *buf) {
- char *start, *end;
+ char *start, *end, *next, *nextend, *ptr;
char newbuf[1024];
char charset[128];
char encoding[16];
char *isav; /**< Saved pointer to input buffer */
char *osav; /**< Saved pointer to output buffer */
int passes = 0;
- int i, len;
+ int i, len, delta;
int illegal_non_rfc2047_encoding = 0;
/** Sometimes, badly formed messages contain strings which were simply
}
}
+ /* pre evaluate the first pair */
+ nextend = end = NULL;
+ len = strlen(buf);
+ start = strstr(buf, "=?");
+ if (start != NULL)
+ end = strstr(start, "?=");
+
+ while ((start != NULL) && (end != NULL))
+ {
+ next = strstr(end, "=?");
+ if (next != NULL)
+ nextend = strstr(next, "?=");
+ if (nextend == NULL)
+ next = NULL;
+
+ /* did we find two partitions */
+ if ((next != NULL) &&
+ ((next - end) > 2))
+ {
+ ptr = end + 2;
+ while ((ptr < next) &&
+ (isspace(*ptr) ||
+ (*ptr == '\r') ||
+ (*ptr == '\n') ||
+ (*ptr == '\t')))
+ ptr ++;
+ /* did we find a gab just filled with blanks? */
+ if (ptr == next)
+ {
+ memmove (end + 2,
+ next,
+ len - (next - start));
+
+ /* now terminate the gab at the end */
+ delta = (next - end) - 2;
+ len -= delta;
+ buf[len] = '\0';
+
+ /* move next to its new location. */
+ next -= delta;
+ nextend -= delta;
+ }
+ }
+ /* our next-pair is our new first pair now. */
+ start = next;
+ end = nextend;
+ }
+
/** Now we handle foreign character sets properly encoded
* in RFC2047 format.
*/
* \param maxlen Maximum size of target buffer.
* \param source Source string to be encoded.
*/
-void rfc2047encode(char *target, int maxlen, char *source)
+void webcit_rfc2047encode(char *target, int maxlen, char *source)
{
int need_to_encode = 0;
int i, len;
}
len = strlen(v->prop[i].value);
-
+ /* if we have some untagged QP, detect it here. */
+ if (!is_qp && (strstr(v->prop[i].value, "=?")!=NULL))
+#ifdef HAVE_ICONV
+ utf8ify_rfc822_string(v->prop[i].value);
+#endif
+
if (is_qp) {
// %ff can become 6 bytes in utf8
thisvalue = malloc(len * 2 + 3);
}
else if (!strcasecmp(firsttoken, "email")) {
+ size_t len;
if (!IsEmptyStr(mailto)) strcat(mailto, "<br />");
strcat(mailto,
"<a href=\"display_enter"
"?force_room=_MAIL_?recp=");
- urlesc(&mailto[strlen(mailto)], fullname);
- urlesc(&mailto[strlen(mailto)], " <");
- urlesc(&mailto[strlen(mailto)], thisvalue);
- urlesc(&mailto[strlen(mailto)], ">");
+ len = strlen(mailto);
+ urlesc(&mailto[len], SIZ - len, fullname);
+ len = strlen(mailto);
+ urlesc(&mailto[len], SIZ - len, " <");
+ len = strlen(mailto);
+ urlesc(&mailto[len], SIZ - len, thisvalue);
+ len = strlen(mailto);
+ urlesc(&mailto[len], SIZ - len, ">");
strcat(mailto, "\">");
- stresc(&mailto[strlen(mailto)], thisvalue, 1, 1);
+ len = strlen(mailto);
+ stresc(mailto+len, SIZ - len, thisvalue, 1, 1);
strcat(mailto, "</A>");
}
else if (!strcasecmp(firsttoken, "tel")) {
name = vcard_get_prop(v, "n", 1, 0, 0);
if (name != NULL) {
+#ifdef HAVE_ICONV
+ utf8ify_rfc822_string(name);
+#endif
strcpy(buf, name);
this_alpha = buf[0];
}
};
-/**
- * \brief I wanna SEE that message!
- * \param msgnum the citadel number of the message to display
- * \param printable_view are we doing a print view?
- * \param section Optional for encapsulated message/rfc822 submessage)
+/*
+ * I wanna SEE that message!
+ *
+ * msgnum Message number to display
+ * printable_view Nonzero to display a printable view
+ * section Optional for encapsulated message/rfc822 submessage
*/
void read_message(long msgnum, int printable_view, char *section) {
char buf[SIZ];
- char mime_partnum[256];
- char mime_name[256];
- char mime_filename[256];
- char mime_content_type[256];
- char mime_charset[256];
- char mime_disposition[256];
+ char mime_partnum[256] = "";
+ char mime_name[256] = "";
+ char mime_filename[256] = "";
+ char escaped_mime_filename[256] = "";
+ char mime_content_type[256] = "";
+ char mime_charset[256] = "";
+ char mime_disposition[256] = "";
int mime_length;
struct attach_link *attach_links = NULL;
int num_attach_links = 0;
- char mime_submessages[256];
- char m_subject[256];
- char m_cc[1024];
- char from[256];
- char node[256];
- char rfca[256];
- char reply_to[512];
- char reply_all[4096];
- char now[64];
+ char mime_submessages[256] = "";
+ char m_subject[256] = "";
+ char m_cc[1024] = "";
+ char from[256] = "";
+ char node[256] = "";
+ char rfca[256] = "";
+ char reply_to[512] = "";
+ char reply_all[4096] = "";
+ char now[64] = "";
int format_type = 0;
int nhdr = 0;
int bq = 0;
int i = 0;
- char vcard_partnum[256];
- char cal_partnum[256];
+ char vcard_partnum[256] = "";
+ char cal_partnum[256] = "";
char *part_source = NULL;
- char msg4_partnum[32];
+ char msg4_partnum[32] = "";
#ifdef HAVE_ICONV
iconv_t ic = (iconv_t)(-1) ;
char *ibuf; /**< Buffer of characters to be converted */
char *osav; /**< Saved pointer to output buffer */
#endif
- strcpy(from, "");
- strcpy(node, "");
- strcpy(rfca, "");
- strcpy(reply_to, "");
- strcpy(reply_all, "");
- strcpy(vcard_partnum, "");
- strcpy(cal_partnum, "");
strcpy(mime_content_type, "text/plain");
strcpy(mime_charset, "us-ascii");
strcpy(mime_submessages, "");
wprintf(" ");
}
if (!strncasecmp(buf, "time=", 5)) {
- fmt_date(now, atol(&buf[5]), 0);
+ webcit_fmt_date(now, atol(&buf[5]), 0);
wprintf("<span>");
wprintf("%s ", now);
wprintf("</span>");
attach_links = realloc(attach_links,
(num_attach_links*sizeof(struct attach_link)));
safestrncpy(attach_links[num_attach_links-1].partnum, mime_partnum, 32);
+ urlesc(escaped_mime_filename, 265, mime_filename);
snprintf(attach_links[num_attach_links-1].html, 1024,
"<img src=\"static/diskette_24x.gif\" "
"border=0 align=middle>\n"
" ]<br />\n",
mime_filename,
mime_content_type, mime_length,
- msgnum, mime_partnum, mime_filename,
+ msgnum, mime_partnum, escaped_mime_filename,
msgnum, mime_partnum,
_("View"),
- msgnum, mime_partnum, mime_filename,
+ msgnum, mime_partnum, escaped_mime_filename,
_("Download")
);
}
strcpy(vcard_partnum, mime_partnum);
}
- if (!strcasecmp(mime_content_type, "text/calendar")) {
+ if ( (!strcasecmp(mime_content_type, "text/calendar"))
+ || (!strcasecmp(mime_content_type, "application/ics")) ) {
strcpy(cal_partnum, mime_partnum);
}
strcpy(mime_content_type, "text/plain");
while (serv_getln(buf, sizeof buf), (!IsEmptyStr(buf))) {
if (!strcmp(buf, "000")) {
- wprintf("<i>");
- wprintf(_("unexpected end of message"));
- wprintf(" (2)</i><br /><br />\n");
+ /* This is not necessarily an error condition. See bug #226. */
goto ENDBODY;
}
if (!strncasecmp(buf, "X-Citadel-MSG4-Partnum:", 23)) {
/** Boring old 80-column fixed format text gets handled this way... */
else if ( (!strcasecmp(mime_content_type, "text/plain"))
|| (!strcasecmp(mime_content_type, "text")) ) {
+ buf [0] = '\0';
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
int len;
len = strlen(buf);
- if (buf[len-1] == '\n') buf[--len] = 0;
- if (buf[len-1] == '\r') buf[--len] = 0;
+ if ((len > 0) && buf[len-1] == '\n') buf[--len] = 0;
+ if ((len > 0) && buf[len-1] == '\r') buf[--len] = 0;
#ifdef HAVE_ICONV
if (ic != (iconv_t)(-1) ) {
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { }
}
- /** If there are attached submessages, display them now... */
+ENDBODY: /* If there are attached submessages, display them now... */
+
if ( (!IsEmptyStr(mime_submessages)) && (!section[0]) ) {
for (i=0; i<num_tokens(mime_submessages, '|'); ++i) {
extract_token(buf, mime_submessages, i, '|', sizeof buf);
part_source = NULL;
}
-ENDBODY:
wprintf("</div>\n");
/** end everythingamundo table */
wprintf("Content-type: text/html\r\n"
"Server: %s\r\n"
"Connection: close\r\n",
- SERVER);
+ PACKAGE_STRING);
begin_burst();
wprintf("\r\n\r\n<html>\n"
wprintf("Content-type: text/plain\r\n"
"Server: %s\r\n"
"Connection: close\r\n",
- SERVER);
+ PACKAGE_STRING);
begin_burst();
serv_printf("MSG2 %ld|3", msgnum);
char from[256];
char node[256];
char rfca[256];
+ char to[256];
char reply_to[512];
char now[256];
int format_type = 0;
}
if (!strncasecmp(buf, "rcpt=", 5)) {
wprintf(_("to "));
- wprintf("%s ", &buf[5]);
+ strcpy(to, &buf[5]);
+#ifdef HAVE_ICONV
+ utf8ify_rfc822_string(to);
+#endif
+ wprintf("%s ", to);
}
if (!strncasecmp(buf, "time=", 5)) {
- fmt_date(now, atol(&buf[5]), 0);
+ webcit_fmt_date(now, atol(&buf[5]), 0);
wprintf("%s ", now);
}
}
);
wprintf("<td width=%d%%>", SUBJ_COL_WIDTH_PCT);
- escputs(WC->summ[num].subj);
+
+ escputs(WC->summ[num].subj);//////////////////////////////////TODO: QP DECODE
wprintf("</td>");
wprintf("<td width=%d%%>", SENDER_COL_WIDTH_PCT);
wprintf("</td>");
wprintf("<td width=%d%%>", DATE_PLUS_BUTTONS_WIDTH_PCT);
- fmt_date(datebuf, WC->summ[num].date, 1); /* brief */
+ webcit_fmt_date(datebuf, WC->summ[num].date, 1); /* brief */
escputs(datebuf);
wprintf("</td>");
* \param tabbuf the tabbuffer to add name to
* \param name the name to add to the tabbuffer
*/
-void nametab(char *tabbuf, char *name) {
- stresc(tabbuf, name, 0, 0);
+void nametab(char *tabbuf, long len, char *name) {
+ stresc(tabbuf, len, name, 0, 0);
tabbuf[0] = toupper(tabbuf[0]);
tabbuf[1] = tolower(tabbuf[1]);
tabbuf[2] = tolower(tabbuf[2]);
tabfirst = i * NAMESPERPAGE;
tablast = tabfirst + NAMESPERPAGE - 1;
if (tablast > (num_ab - 1)) tablast = (num_ab - 1);
- nametab(tabfirst_label, addrbook[tabfirst].ab_name);
- nametab(tablast_label, addrbook[tablast].ab_name);
+ nametab(tabfirst_label, 64, addrbook[tabfirst].ab_name);
+ nametab(tablast_label, 64, addrbook[tablast].ab_name);
sprintf(this_tablabel, "%s - %s", tabfirst_label, tablast_label);
tablabels[i] = strdup(this_tablabel);
}
wprintf("<a href=\"readfwd?startmsg=%ld&is_singlecard=1",
addrbook[i].ab_msgnum);
- wprintf("?maxmsgs=1?summary=0?alpha=%s\">", bstr("alpha"));
+ wprintf("?maxmsgs=1?is_summary=0?alpha=%s\">", bstr("alpha"));
vcard_n_prettyize(addrbook[i].ab_name);
escputs(addrbook[i].ab_name);
wprintf("</a></td>\n");
safestrncpy(WC->summ[nummsgs-1].subj,
_("(no subject)"), sizeof WC->summ[nummsgs-1].subj);
if (!IsEmptyStr(fullname)) {
+#ifdef HAVE_ICONV
+ /** Handle senders with RFC2047 encoding */
+ utf8ify_rfc822_string(fullname);
+#endif
safestrncpy(WC->summ[nummsgs-1].from,
fullname, sizeof WC->summ[nummsgs-1].from);
}
if (!IsEmptyStr(subject)) {
- safestrncpy(WC->summ[nummsgs-1].subj, subject,
- sizeof WC->summ[nummsgs-1].subj);
- }
#ifdef HAVE_ICONV
/** Handle subjects with RFC2047 encoding */
- utf8ify_rfc822_string(WC->summ[nummsgs-1].subj);
+ utf8ify_rfc822_string(subject);
#endif
+ safestrncpy(WC->summ[nummsgs-1].subj, subject,
+ sizeof WC->summ[nummsgs-1].subj);
+ }
if (strlen(WC->summ[nummsgs-1].subj) > 75) {
strcpy(&WC->summ[nummsgs-1].subj[72], "...");
}
char *sendsort_button;
char *datesort_button;
int bbs_reverse = 0;
+ struct wcsession *WCC = WC; /* This is done to make it run faster; WC is a function */
- if (WC->wc_view == VIEW_WIKI) {
- sprintf(buf, "wiki?room=%s?page=home", WC->wc_roomname);
+ if (WCC->wc_view == VIEW_WIKI) {
+ sprintf(buf, "wiki?room=%s?page=home", WCC->wc_roomname);
http_redirect(buf);
return;
}
startmsg = atol(bstr("startmsg"));
maxmsgs = atoi(bstr("maxmsgs"));
- is_summary = atoi(bstr("summary"));
+ is_summary = atoi(bstr("is_summary"));
if (maxmsgs == 0) maxmsgs = DEFAULT_MAXMSGS;
- snprintf(sortpref_name, sizeof sortpref_name, "sort %s", WC->wc_roomname);
+ snprintf(sortpref_name, sizeof sortpref_name, "sort %s", WCC->wc_roomname);
get_preference(sortpref_name, sortpref_value, sizeof sortpref_value);
sortby = bstr("sortby");
strcpy(cmd, "MSGS ALL");
}
- if ((WC->wc_view == VIEW_MAILBOX) && (maxmsgs > 1)) {
+ if ((WCC->wc_view == VIEW_MAILBOX) && (maxmsgs > 1)) {
is_summary = 1;
if (!strcmp(oper, "do_search")) {
sprintf(cmd, "MSGS SEARCH|%s", bstr("query"));
}
}
- if ((WC->wc_view == VIEW_ADDRESSBOOK) && (maxmsgs > 1)) {
+ if ((WCC->wc_view == VIEW_ADDRESSBOOK) && (maxmsgs > 1)) {
is_addressbook = 1;
if (!strcmp(oper, "do_search")) {
sprintf(cmd, "MSGS SEARCH|%s", bstr("query"));
* new messages.
*/
strcpy(old_msgs, "");
- if (is_summary) {
+ if ((is_summary) || (WCC->wc_default_view == VIEW_CALENDAR)){
serv_puts("GTSN");
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
is_singlecard = atoi(bstr("is_singlecard"));
- if (WC->wc_default_view == VIEW_CALENDAR) { /**< calendar */
+ if (WCC->wc_default_view == VIEW_CALENDAR) { /**< calendar */
is_calendar = 1;
- strcpy(cmd, "MSGS ALL");
+ strcpy(cmd, "MSGS ALL|||1");
maxmsgs = 32767;
}
- if (WC->wc_default_view == VIEW_TASKS) { /**< tasks */
+ if (WCC->wc_default_view == VIEW_TASKS) { /**< tasks */
is_tasks = 1;
strcpy(cmd, "MSGS ALL");
maxmsgs = 32767;
}
- if (WC->wc_default_view == VIEW_NOTES) { /**< notes */
+ if (WCC->wc_default_view == VIEW_NOTES) { /**< notes */
is_notes = 1;
strcpy(cmd, "MSGS ALL");
maxmsgs = 32767;
goto DONE;
}
- if (is_summary) {
+ if ((is_summary) || (WCC->wc_default_view == VIEW_CALENDAR)){
for (a = 0; a < nummsgs; ++a) {
/** Are you a new message, or an old message? */
if (is_summary) {
- if (is_msg_in_mset(old_msgs, WC->msgarr[a])) {
- WC->summ[a].is_new = 0;
+ if (is_msg_in_mset(old_msgs, WCC->msgarr[a])) {
+ WCC->summ[a].is_new = 0;
}
else {
- WC->summ[a].is_new = 1;
+ WCC->summ[a].is_new = 1;
}
}
}
if (startmsg == 0L) {
if (bbs_reverse) {
- startmsg = WC->msgarr[(nummsgs >= maxmsgs) ? (nummsgs - maxmsgs) : 0];
+ startmsg = WCC->msgarr[(nummsgs >= maxmsgs) ? (nummsgs - maxmsgs) : 0];
}
else {
- startmsg = WC->msgarr[0];
+ startmsg = WCC->msgarr[0];
}
}
if (is_summary) {
if (!strcasecmp(sortby, "subject")) {
- qsort(WC->summ, WC->num_summ,
+ qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_subj);
}
else if (!strcasecmp(sortby, "rsubject")) {
- qsort(WC->summ, WC->num_summ,
+ qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_rsubj);
}
else if (!strcasecmp(sortby, "sender")) {
- qsort(WC->summ, WC->num_summ,
+ qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_sender);
}
else if (!strcasecmp(sortby, "rsender")) {
- qsort(WC->summ, WC->num_summ,
+ qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_rsender);
}
else if (!strcasecmp(sortby, "date")) {
- qsort(WC->summ, WC->num_summ,
+ qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_date);
}
else if (!strcasecmp(sortby, "rdate")) {
- qsort(WC->summ, WC->num_summ,
+ qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_rdate);
}
}
if (!strcasecmp(sortby, "subject")) {
- subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=rsubject\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
+ subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=rsubject\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
}
else if (!strcasecmp(sortby, "rsubject")) {
- subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=subject\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
+ subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=subject\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
}
else {
- subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=subject\"><img border=\"0\" src=\"static/sort_none.gif\" /></a>" ;
+ subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=subject\"><img border=\"0\" src=\"static/sort_none.gif\" /></a>" ;
}
if (!strcasecmp(sortby, "sender")) {
- sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=rsender\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
+ sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=rsender\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
}
else if (!strcasecmp(sortby, "rsender")) {
- sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=sender\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
+ sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=sender\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
}
else {
- sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=sender\"><img border=\"0\" src=\"static/sort_none.gif\" /></a>" ;
+ sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=sender\"><img border=\"0\" src=\"static/sort_none.gif\" /></a>" ;
}
if (!strcasecmp(sortby, "date")) {
- datesort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=rdate\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
+ datesort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=rdate\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
}
else if (!strcasecmp(sortby, "rdate")) {
- datesort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=date\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
+ datesort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=date\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
}
else {
- datesort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?summary=1?sortby=rdate\"><img border=\"0\" src=\"static/sort_none.gif\" /></a>" ;
+ datesort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=rdate\"><img border=\"0\" src=\"static/sort_none.gif\" /></a>" ;
}
if (is_summary) {
*/
if (is_bbview) {
/** begin bbview scroller */
- wprintf("<form name=\"msgomatic\" class=\"selector_top\" >");
+ wprintf("<form name=\"msgomatictop\" class=\"selector_top\" > \n <p>");
wprintf(_("Reading #"), lowest_displayed, highest_displayed);
wprintf("<select name=\"whichones\" size=\"1\" "
"\"%s"
"?startmsg=%ld"
"?maxmsgs=%d"
- "?summary=%d\">"
+ "?is_summary=%d\">"
"%d-%d</option> \n",
- ((WC->msgarr[lo-1] == startmsg) ? "selected" : ""),
+ ((WCC->msgarr[lo-1] == startmsg) ? "selected" : ""),
oper,
- WC->msgarr[lo-1],
+ WCC->msgarr[lo-1],
maxmsgs,
is_summary,
hi, lo);
"\"%s"
"?startmsg=%ld"
"?maxmsgs=%d"
- "?summary=%d\">"
+ "?is_summary=%d\">"
"%d-%d</option> \n",
- ((WC->msgarr[b] == startmsg) ? "selected" : ""),
+ ((WCC->msgarr[b] == startmsg) ? "selected" : ""),
oper,
- WC->msgarr[lo-1],
+ WCC->msgarr[lo-1],
maxmsgs,
is_summary,
lo, hi);
}
wprintf("<option value=\"%s?startmsg=%ld"
- "?maxmsgs=9999999?summary=%d\">",
+ "?maxmsgs=9999999?is_summary=%d\">",
oper,
- WC->msgarr[0], is_summary);
+ WCC->msgarr[0], is_summary);
wprintf(_("All"));
wprintf("</option>");
wprintf("</select> ");
wprintf(_("of %d messages."), nummsgs);
/** forward/reverse */
- wprintf(" <select name=\"direction\" size=\"1\" "
- "OnChange=\"location.href=msgomatictop.direction.options"
- "[selectedIndex].value\">\n"
- );
-
- wprintf("<option %s value=\"%s?sortby=forward\">",
- (bbs_reverse ? "" : "selected"),
+ wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
+ "OnChange=\"location.href='%s?sortby=forward'\"",
+ (bbs_reverse ? "" : "checked"),
oper
);
+ wprintf(">");
wprintf(_("oldest to newest"));
- wprintf("</option>\n");
-
- wprintf("<option %s value=\"%s?sortby=reverse\">",
- (bbs_reverse ? "selected" : ""),
+ wprintf(" ");
+
+ wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
+ "OnChange=\"location.href='%s?sortby=reverse'\"",
+ (bbs_reverse ? "checked" : ""),
oper
);
+ wprintf(">");
wprintf(_("newest to oldest"));
- wprintf("</option>\n");
+ wprintf("\n");
- wprintf("</select></form>\n");
+ wprintf("</p></form>\n");
/** end bbview scroller */
}
+ if (is_notes)
+ {
+ wprintf ("<script src=\"/static/dragdrop.js\" type=\"text/javascript\"></script>\n");
+ }
+
for (a = 0; a < nummsgs; ++a) {
- if ((WC->msgarr[a] >= startmsg) && (num_displayed < maxmsgs)) {
+ if ((WCC->msgarr[a] >= startmsg) && (num_displayed < maxmsgs)) {
/** Display the message */
if (is_summary) {
display_summarized(a);
}
else if (is_addressbook) {
- fetch_ab_name(WC->msgarr[a], buf);
+ fetch_ab_name(WCC->msgarr[a], buf);
++num_ab;
addrbook = realloc(addrbook,
(sizeof(struct addrbookent) * num_ab) );
safestrncpy(addrbook[num_ab-1].ab_name, buf,
sizeof(addrbook[num_ab-1].ab_name));
- addrbook[num_ab-1].ab_msgnum = WC->msgarr[a];
+ addrbook[num_ab-1].ab_msgnum = WCC->msgarr[a];
}
else if (is_calendar) {
- display_calendar(WC->msgarr[a]);
+ display_calendar(WCC->msgarr[a], WCC->summ[a].is_new);
}
else if (is_tasks) {
- display_task(WC->msgarr[a]);
+ display_task(WCC->msgarr[a], WCC->summ[a].is_new);
}
else if (is_notes) {
- display_note(WC->msgarr[a]);
+ display_note(WCC->msgarr[a], WCC->summ[a].is_new);
}
else {
if (displayed_msgs == NULL) {
displayed_msgs = malloc(sizeof(long) *
(maxmsgs<nummsgs ? maxmsgs : nummsgs));
}
- displayed_msgs[num_displayed] = WC->msgarr[a];
+ displayed_msgs[num_displayed] = WCC->msgarr[a];
}
if (lowest_displayed < 0) lowest_displayed = a;
}
}
-
/** Output loop */
if (displayed_msgs != NULL) {
if (bbs_reverse) {
*/
if (is_bbview) {
/** begin bbview scroller */
- wprintf("<form name=\"msgomatic\" class=\"selector_bottom\" >");
+ wprintf("<form name=\"msgomatic\" class=\"selector_bottom\" > \n <p>");
wprintf(_("Reading #"), lowest_displayed, highest_displayed);
wprintf("<select name=\"whichones\" size=\"1\" "
"\"%s"
"?startmsg=%ld"
"?maxmsgs=%d"
- "?summary=%d\">"
+ "?is_summary=%d\">"
"%d-%d</option> \n",
- ((WC->msgarr[lo-1] == startmsg) ? "selected" : ""),
+ ((WCC->msgarr[lo-1] == startmsg) ? "selected" : ""),
oper,
- WC->msgarr[lo-1],
+ WCC->msgarr[lo-1],
maxmsgs,
is_summary,
hi, lo);
"\"%s"
"?startmsg=%ld"
"?maxmsgs=%d"
- "?summary=%d\">"
+ "?is_summary=%d\">"
"%d-%d</option> \n",
- ((WC->msgarr[b] == startmsg) ? "selected" : ""),
+ ((WCC->msgarr[b] == startmsg) ? "selected" : ""),
oper,
- WC->msgarr[lo-1],
+ WCC->msgarr[lo-1],
maxmsgs,
is_summary,
lo, hi);
}
wprintf("<option value=\"%s?startmsg=%ld"
- "?maxmsgs=9999999?summary=%d\">",
+ "?maxmsgs=9999999?is_summary=%d\">",
oper,
- WC->msgarr[0], is_summary);
+ WCC->msgarr[0], is_summary);
wprintf(_("All"));
wprintf("</option>");
wprintf("</select> ");
wprintf(_("of %d messages."), nummsgs);
/** forward/reverse */
- wprintf(" <select name=\"direction\" size=\"1\" "
- "OnChange=\"location.href=msgomatic.direction.options"
- "[selectedIndex].value\">\n"
- );
-
- wprintf("<option %s value=\"%s?sortby=forward\">",
- (bbs_reverse ? "" : "selected"),
+ wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
+ "OnChange=\"location.href='%s?sortby=forward'\"",
+ (bbs_reverse ? "" : "checked"),
oper
);
+ wprintf(">");
wprintf(_("oldest to newest"));
- wprintf("</option>\n");
-
- wprintf("<option %s value=\"%s?sortby=reverse\">",
- (bbs_reverse ? "selected" : ""),
+ wprintf(" ");
+ wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
+ "OnChange=\"location.href='%s?sortby=reverse'\"",
+ (bbs_reverse ? "checked" : ""),
oper
);
+ wprintf(">");
wprintf(_("newest to oldest"));
- wprintf("</option>\n");
-
- wprintf("</select></form>\n");
+ wprintf("\n");
+
+ wprintf("</p></form>\n");
/** end bbview scroller */
}
+
+ if (is_notes)
+ {
+// wprintf ("</div>\n");
+ wprintf ("<div id=\"wastebin\" align=middle>Drop notes here to remove them.</div>\n");
+ wprintf ("<script type=\"text/javascript\">\n");
+// wprintf ("//<![CDATA[\n");
+ wprintf ("Droppables.add(\"wastebin\",\n");
+ wprintf ("\t{\n");
+ wprintf ("\t\taccept:'notes',\n");
+ wprintf ("\t\tonDrop:function(element)\n");
+ wprintf ("\t\t{\n");
+ wprintf ("\t\t\tElement.hide(element);\n");
+ wprintf ("\t\t\tnew Ajax.Updater('notes', 'delnote',\n");
+ wprintf ("\t\t\t{\n");
+ wprintf ("\t\t\t\tasynchronous:true,\n");
+ wprintf ("\t\t\t\tevalScripts:true,\n");
+ wprintf ("\t\t\t\tonComplete:function(request)\n");
+ wprintf ("\t\t\t\t{\n");
+ wprintf ("\t\t\t\t\tElement.hide('indicator')\n");
+ wprintf ("\t\t\t\t},\n");
+ wprintf ("\t\t\t\tonLoading:function(request)\n");
+ wprintf ("\t\t\t\t{\n");
+ wprintf ("\t\t\t\t\tElement.show('indicator')\n");
+ wprintf ("\t\t\t\t},\n");
+ wprintf ("\t\t\t\tparameters:'id=' + encodeURIComponent(element.id)\n");
+ wprintf ("\t\t\t})\n");
+ wprintf ("\t\t}\n");
+ wprintf ("\t})\n");
+// wprintf ("//]]>\n");
+ wprintf ("</script>\n");
+ }
+
+
DONE:
if (is_tasks) {
wDumpContent(1);
/** free the summary */
- if (WC->summ != NULL) {
- free(WC->summ);
- WC->num_summ = 0;
- WC->summ = NULL;
+ if (WCC->summ != NULL) {
+ free(WCC->summ);
+ WCC->num_summ = 0;
+ WCC->summ = NULL;
}
if (addrbook != NULL) free(addrbook);
}
static int seq = 0;
struct wc_attachment *att;
char *encoded;
+ char *txtmail;
size_t encoded_length;
+ size_t encoded_strlen;
/** RFC2045 requires this, and some clients look for it... */
serv_puts("MIME-Version: 1.0");
- serv_puts("X-Mailer: " SERVER);
+ serv_puts("X-Mailer: " PACKAGE_STRING);
/** If there are attachments, we have to do multipart/mixed */
if (WC->first_attachment != NULL) {
is_multipart = 1;
}
- if (is_multipart) {
+// if (is_multipart) {
sprintf(boundary, "Citadel--Multipart--%s--%04x--%04x",
serv_info.serv_fqdn,
getpid(),
);
/** Remember, serv_printf() appends an extra newline */
- serv_printf("Content-type: multipart/mixed; "
- "boundary=\"%s\"\n", boundary);
+ if (is_multipart)
+ serv_printf("Content-type: multipart/mixed; "
+ "boundary=\"%s\"\n", boundary);
+ else
+ serv_printf("Content-type: multipart/alternative; "
+ "boundary=\"%s\"\n", boundary);
serv_printf("This is a multipart message in MIME format.\n");
serv_printf("--%s", boundary);
- }
+// }
serv_puts("Content-type: text/html; charset=utf-8");
serv_puts("Content-Transfer-Encoding: quoted-printable");
serv_puts("<html><body>\r\n");
text_to_server_qp(bstr("msgtext")); /** Transmit message in quoted-printable encoding */
serv_puts("</body></html>\r\n");
+
+ serv_puts("Content-type: text/plain; charset=utf-8");
+ serv_puts("Content-Transfer-Encoding: quoted-printable");
+ serv_puts("");
+
+ txtmail = html_to_ascii(bstr("msgtext"), 0, 80, 0);
+ text_to_server_qp(txtmail); /** Transmit message in quoted-printable encoding */
+ free(txtmail);
+ if (!is_multipart)
+ serv_printf("--%s", boundary);
if (is_multipart) {
encoded_length = ((att->length * 150) / 100);
encoded = malloc(encoded_length);
if (encoded == NULL) break;
- CtdlEncodeBase64(encoded, att->data, att->length, 1);
+ encoded_strlen = CtdlEncodeBase64(encoded, att->data, att->length, 1);
serv_printf("--%s", boundary);
serv_printf("Content-type: %s", att->content_type);
"filename=\"%s\"", att->filename);
serv_puts("Content-transfer-encoding: base64");
serv_puts("");
- serv_write(encoded, strlen(encoded));
+ serv_write(encoded, encoded_strlen);
serv_puts("");
serv_puts("");
free(encoded);
int is_anonymous = 0;
char *display_name;
+ if (!IsEmptyStr(bstr("force_room"))) {
+ gotoroom(bstr("force_room"));
+ }
+
display_name = bstr("display_name");
if (!strcmp(display_name, "__ANONYMOUS__")) {
display_name = "";
_("Automatically cancelled because you have already "
"saved this message."));
} else {
- rfc2047encode(encoded_subject, sizeof encoded_subject, bstr("subject"));
+ webcit_rfc2047encode(encoded_subject, sizeof encoded_subject, bstr("subject"));
sprintf(buf, "ENT0 1|%s|%d|4|%s|%s||%s|%s|%s|%s",
bstr("recp"),
is_anonymous,
* message" command really means "add new entry."
*/
if (WC->wc_default_view == VIEW_ADDRESSBOOK) {
- do_edit_vcard(-1, "", "");
+ do_edit_vcard(-1, "", "", WC->wc_roomname);
return;
}
}
wprintf("<input type=\"hidden\" name=\"return_to\" value=\"%s\">\n", bstr("return_to"));
wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"force_room\" value=\"");
+ escputs(WC->wc_roomname);
+ wprintf("\">\n");
/** submit or cancel buttons */
wprintf("<p class=\"send_edit_msg\">");
wprintf("<img src=\"static/newmess3_24x.gif\" class=\"imgedit\">");
wprintf(" "); /** header bar */
- fmt_date(buf, now, 0);
+ webcit_fmt_date(buf, now, 0);
wprintf("%s", buf);
wprintf("\n"); /** header bar */
- wprintf("<div>");
- wprintf("<label for=\"from_id\" > ");
+ wprintf("<table width=\"100%%\" class=\"edit_msg_table\">");
+ wprintf("<tr>");
+ wprintf("<th><label for=\"from_id\" > ");
wprintf(_(" <I>from</I> "));
- wprintf("</label>");
+ wprintf("</label></th>");
+
+ wprintf("<td colspan=\"2\">");
/* Allow the user to select any of his valid screen names */
wprintf(_(" <I>in</I> "));
escputs(WC->wc_roomname);
- wprintf("</div>");
- if (recipient_required) {
+ wprintf("</td></tr>");
- wprintf("<div style=\"float: left;\"><label for=\"recp_id\"> ");
+ if (recipient_required) {
+ char *ccraw;
+ char *copy;
+ size_t len;
+ wprintf("<tr><th><label for=\"recp_id\"> ");
wprintf(_("To:"));
- wprintf("</label>"
- "<input autocomplete=\"off\" type=\"text\" name=\"recp\" id=\"recp_id\" value=\"");
- escputs(bstr("recp"));
+ wprintf("</label></th>"
+ "<td><input autocomplete=\"off\" type=\"text\" name=\"recp\" id=\"recp_id\" value=\"");
+ ccraw = bstr("recp");
+ len = strlen(ccraw);
+ copy = (char*) malloc(len * 2 + 1);
+ memcpy(copy, ccraw, len + 1);
+#ifdef HAVE_ICONV
+ utf8ify_rfc822_string(copy);
+#endif
+ escputs(copy);
+ free(copy);
wprintf("\" size=45 maxlength=1000 />");
wprintf("<div class=\"auto_complete\" id=\"recp_name_choices\"></div>");
+ wprintf("</td><td rowspan=\"3\" align=\"left\" valign=\"top\">");
+ /** Pop open an address book -- begin **/
+ wprintf(
+ "<a href=\"javascript:PopOpenAddressBook('recp_id|%s|cc_id|%s|bcc_id|%s');\" "
+ "title=\"%s\">"
+ "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
+ " %s</a>",
+ _("To:"), _("CC:"), _("BCC:"),
+ _("Contacts"), _("Contacts")
+ );
+ /** Pop open an address book -- end **/
- wprintf("<br/><label for=\"cc_id\"> ");
+ wprintf("</td></tr>");
+
+ wprintf("<tr><th><label for=\"cc_id\"> ");
wprintf(_("CC:"));
- wprintf("</label>"
- "<input autocomplete=\"off\" type=\"text\" name=\"cc\" id=\"cc_id\" value=\"");
- escputs(bstr("cc"));
+ wprintf("</label></th>"
+ "<td><input autocomplete=\"off\" type=\"text\" name=\"cc\" id=\"cc_id\" value=\"");
+ ccraw = bstr("cc");
+ len = strlen(ccraw);
+ copy = (char*) malloc(len * 2 + 1);
+ memcpy(copy, ccraw, len + 1);
+#ifdef HAVE_ICONV
+ utf8ify_rfc822_string(copy);
+#endif
+ escputs(copy);
+ free(copy);
wprintf("\" size=45 maxlength=1000 />");
wprintf("<div class=\"auto_complete\" id=\"cc_name_choices\"></div>");
- wprintf("<br/><label for=\"bcc_id\"> ");
+ wprintf("</td></tr>");
+
+ wprintf("<tr><th><label for=\"bcc_id\"> ");
wprintf(_("BCC:"));
- wprintf("</label>"
- "<input autocomplete=\"off\" type=\"text\" name=\"bcc\" id=\"bcc_id\" value=\"");
- escputs(bstr("bcc"));
+ wprintf("</label></th>"
+ "<td><input autocomplete=\"off\" type=\"text\" name=\"bcc\" id=\"bcc_id\" value=\"");
+ ccraw = bstr("bcc");
+ len = strlen(ccraw);
+ copy = (char*) malloc(len * 2 + 1);
+ memcpy(copy, ccraw, len + 1);
+#ifdef HAVE_ICONV
+ utf8ify_rfc822_string(copy);
+#endif
+ escputs(copy);
+ free(copy);
wprintf("\" size=45 maxlength=1000 />");
wprintf("<div class=\"auto_complete\" id=\"bcc_name_choices\"></div>");
+ wprintf("</td></tr>");
/** Initialize the autocomplete ajax helpers (found in wclib.js) */
wprintf("<script type=\"text/javascript\"> \n"
" activate_entmsg_autocompleters(); \n"
"</script> \n"
);
- wprintf("</div>");
- /** Pop open an address book -- begin **/
- wprintf(
- "<a href=\"javascript:PopOpenAddressBook('recp_id|%s|cc_id|%s|bcc_id|%s');\" "
- "title=\"%s\">"
- "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
- " %s</a>",
- _("To:"), _("CC:"), _("BCC:"),
- _("Contacts"), _("Contacts")
- );
- /** Pop open an address book -- end **/
}
- wprintf("<div style=\"clear: both;\"><label for=\"subject_id\" > ");
+ wprintf("<tr><th><label for=\"subject_id\" > ");
if (recipient_required || subject_required) {
wprintf(_("Subject:"));
}
else {
wprintf(_("Subject (optional):"));
}
- wprintf("</label>"
- "<input type=\"text\" name=\"subject\" id=\"subject_id\" value=\" ");
+ wprintf("</label></th>"
+ "<td colspan=\"2\">"
+ "<input type=\"text\" name=\"subject\" id=\"subject_id\" value=\"");
escputs(bstr("subject"));
wprintf("\" size=45 maxlength=70>\n");
+ wprintf("</td></tr>");
- wprintf("</div>\n");
+ wprintf("<tr><td colspan=\"3\">\n");
wprintf("<textarea name=\"msgtext\" cols=\"80\" rows=\"15\">");
}
}
- wprintf("</textarea>");
+ wprintf("</textarea>\n");
+ /** Make sure we only insert our signature once */
+ /** We don't care if it was there or not before, it needs to be there now. */
+ wprintf("<input type=\"hidden\" name=\"sig_inserted\" value=\"yes\">\n");
+
/**
* The following template embeds the TinyMCE richedit control, and automatically
* transforms the textarea into a richedit textarea.
do_template("richedit");
/** Enumerate any attachments which are already in place... */
- wprintf("<div><img src=\"static/diskette_24x.gif\" class=\"imgedit\" ");
+ wprintf("<div class=\"attachment buttons\"><img src=\"static/diskette_24x.gif\" class=\"imgedit\" > ");
wprintf(_("Attachments:"));
wprintf(" ");
wprintf("<select name=\"which_attachment\" size=1>");
/** Now offer the ability to attach additional files... */
wprintf(" ");
wprintf(_("Attach file:"));
- wprintf(" <input name=\"attachfile\" "
+ wprintf(" <input name=\"attachfile\" class=\"attachfile\" "
"size=16 type=\"file\">\n "
"<input type=\"submit\" name=\"attach_button\" value=\"%s\">\n", _("Add"));
- wprintf("</div>");
+ wprintf("</div>"); /* End of "attachment buttons" div */
- /** Make sure we only insert our signature once */
- if (strcmp(bstr("sig_inserted"), "yes")) {
- wprintf("<input type=\"hidden\" name=\"sig_inserted\" value=\"yes\">\n");
- }
-
+ wprintf("</td></tr></table>");
+
wprintf("</form>\n");
- wprintf("</div></div>\n");
+ wprintf("</div>\n"); /* end of "fix_scrollbar_bug" div */
+ /* NOTE: address_book_popup() will close the "content" div. Don't close it here. */
DONE: address_book_popup();
wDumpContent(1);
}
output_headers(1, 1, 2, 0, 0, 0);
wprintf("<div id=\"banner\">\n");
- wprintf("<TABLE WIDTH=100%% BORDER=0><TR><TD>");
- wprintf("<SPAN CLASS=\"titlebar\">");
+ wprintf("<h1>");
wprintf(_("Confirm move of message"));
- wprintf("</SPAN>\n");
- wprintf("</TD></TR></TABLE>\n");
- wprintf("</div>\n<div id=\"content\">\n");
+ wprintf("</h1>");
+ wprintf("</div>\n");
+
+ wprintf("<div id=\"content\" class=\"service\">\n");
wprintf("<CENTER>");