*/
/*@{*/
#include "webcit.h"
-#include "vcard.h"
#include "webserver.h"
#include "groupdav.h"
* \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;
*/
void url(char *buf)
{
- int pos, len;
- int start, end;
+ int len;
+ char *start, *end, *pos;
char urlbuf[SIZ];
char outbuf[1024];
- start = (-1);
- len = end = strlen(buf);
- for (pos = 0; pos < len; ++pos) {
- if (!strncasecmp(&buf[pos], "http://", 7))
+ start = NULL;
+ len = strlen(buf);
+ end = buf + len;
+ for (pos = buf; (pos < end) && (start == NULL); ++pos) {
+ if (!strncasecmp(pos, "http://", 7))
start = pos;
- if (!strncasecmp(&buf[pos], "ftp://", 6))
+ if (!strncasecmp(pos, "ftp://", 6))
start = pos;
}
- if (start < 0)
+ if (start == NULL)
return;
- for (pos = len; pos > start; --pos) {
- if ( (!isprint(buf[pos]))
- || (isspace(buf[pos]))
- || (buf[pos] == '{')
- || (buf[pos] == '}')
- || (buf[pos] == '|')
- || (buf[pos] == '\\')
- || (buf[pos] == '^')
- || (buf[pos] == '[')
- || (buf[pos] == ']')
- || (buf[pos] == '`')
- || (buf[pos] == '<')
- || (buf[pos] == '>')
- || (buf[pos] == '(')
- || (buf[pos] == ')')
+ for (pos = buf+len; pos > start; --pos) {
+ if ( (!isprint(*pos))
+ || (isspace(*pos))
+ || (*pos == '{')
+ || (*pos == '}')
+ || (*pos == '|')
+ || (*pos == '\\')
+ || (*pos == '^')
+ || (*pos == '[')
+ || (*pos == ']')
+ || (*pos == '`')
+ || (*pos == '<')
+ || (*pos == '>')
+ || (*pos == '(')
+ || (*pos == ')')
) {
end = pos;
}
}
- strncpy(urlbuf, &buf[start], end - start);
- urlbuf[end - start] = 0;
+ strncpy(urlbuf, start, end - start);
+ urlbuf[end - start] = '\0';
- strncpy(outbuf, buf, start);
- sprintf(&outbuf[start], "%ca href=%c%s%c TARGET=%c%s%c%c%s%c/A%c",
+ if (start != buf)
+ strncpy(outbuf, buf, start - buf );
+ sprintf(&outbuf[start-buf], "%ca href=%c%s%c TARGET=%c%s%c%c%s%c/A%c",
LB, QU, urlbuf, QU, QU, TARGET, QU, RB, urlbuf, LB, RB);
- strcat(outbuf, &buf[end]);
+ strcat(outbuf, end);
if ( strlen(outbuf) < 250 )
strcpy(buf, outbuf);
}
else if (!strcasecmp(firsttoken, "email")) {
if (!IsEmptyStr(mailto)) strcat(mailto, "<br />");
+ long len;
strcat(mailto,
"<a href=\"display_enter"
"?force_room=_MAIL_?recp=");
urlesc(&mailto[strlen(mailto)], ">");
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")) {
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];
wprintf("onMouseOut=document.getElementById(\"msg%ld\").style.visibility=\"hidden\" >", msgnum);
}
- /** start msg buttons */
-
- if (!printable_view) {
- wprintf("<p id=\"msg%ld\" class=\"msgbuttons\" >\n",msgnum);
-
- /** Reply */
- if ( (WC->wc_view == VIEW_MAILBOX) || (WC->wc_view == VIEW_BBS) ) {
- wprintf("<a href=\"display_enter");
- if (WC->is_mailbox) {
- wprintf("?replyquote=%ld", msgnum);
- }
- wprintf("?recp=");
- urlescputs(reply_to);
- if (!IsEmptyStr(m_subject)) {
- wprintf("?subject=");
- if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
- urlescputs(m_subject);
- }
- wprintf("\"><span>[</span>%s<span>]</span></a> ", _("Reply"));
- }
-
- /** ReplyQuoted */
- if ( (WC->wc_view == VIEW_MAILBOX) || (WC->wc_view == VIEW_BBS) ) {
- if (!WC->is_mailbox) {
- wprintf("<a href=\"display_enter");
- wprintf("?replyquote=%ld", msgnum);
- wprintf("?recp=");
- urlescputs(reply_to);
- if (!IsEmptyStr(m_subject)) {
- wprintf("?subject=");
- if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
- urlescputs(m_subject);
- }
- wprintf("\"><span>[</span>%s<span>]</span></a> ", _("ReplyQuoted"));
- }
- }
-
- /** ReplyAll */
- if (WC->wc_view == VIEW_MAILBOX) {
- wprintf("<a href=\"display_enter");
- wprintf("?replyquote=%ld", msgnum);
- wprintf("?recp=");
- urlescputs(reply_to);
- wprintf("?cc=");
- urlescputs(reply_all);
- if (!IsEmptyStr(m_subject)) {
- wprintf("?subject=");
- if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
- urlescputs(m_subject);
- }
- wprintf("\"><span>[</span>%s<span>]</span></a> ", _("ReplyAll"));
- }
-
- /** Forward */
- if (WC->wc_view == VIEW_MAILBOX) {
- wprintf("<a href=\"display_enter?fwdquote=%ld?subject=", msgnum);
- if (strncasecmp(m_subject, "Fwd:", 4)) wprintf("Fwd:%20");
- urlescputs(m_subject);
- wprintf("\"><span>[</span>%s<span>]</span></a> ", _("Forward"));
- }
-
- /** If this is one of my own rooms, or if I'm an Aide or Room Aide, I can move/delete */
- if ( (WC->is_room_aide) || (WC->is_mailbox) || (WC->room_flags2 & QR2_COLLABDEL) ) {
- /** Move */
- wprintf("<a href=\"confirm_move_msg?msgid=%ld\"><span>[</span>%s<span>]</span></a> ",
- msgnum, _("Move"));
-
- /** Delete */
- wprintf("<a href=\"delete_msg?msgid=%ld\" "
- "onClick=\"return confirm('%s');\">"
- "<span>[</span>%s<span>]</span> "
- "</a> ", msgnum, _("Delete this message?"), _("Delete")
- );
- }
-
- /** Headers */
- wprintf("<a href=\"#\" onClick=\"window.open('msgheaders/%ld', 'headers%ld', 'toolbar=no,location=no,directories=no,copyhistory=no,status=yes,scrollbars=yes,resizable=yes,width=600,height=400'); \" >"
- "<span>[</span>%s<span>]</span></a>", msgnum, msgnum, _("Headers"));
-
-
- /** Print */
- wprintf("<a href=\"#\" onClick=\"window.open('printmsg/%ld', 'print%ld', 'toolbar=no,location=no,directories=no,copyhistory=no,status=yes,scrollbars=yes,resizable=yes,width=600,height=400'); \" >"
- "<span>[</span>%s<span>]</span></a>", msgnum, msgnum, _("Print"));
-
- wprintf("</p>");
-
- }
-
/** begin message header table */
wprintf("<div class=\"message_header\">");
-
-
strcpy(m_subject, "");
strcpy(m_cc, "");
format_type = atoi(&buf[5]);
if (!strncasecmp(buf, "from=", 5)) {
strcpy(from, &buf[5]);
- wprintf("<br />");
wprintf(_("from "));
wprintf("<a href=\"showuser?who=");
#ifdef HAVE_ICONV
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>");
}
if (!strncasecmp(buf, "part=", 5)) {
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, 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")
);
}
wprintf("****");
}
- wprintf("</div>");
-
#ifdef HAVE_ICONV
utf8ify_rfc822_string(m_cc);
utf8ify_rfc822_string(m_subject);
#endif
+
+ /** start msg buttons */
+
+ if (!printable_view) {
+ wprintf("<p id=\"msg%ld\" class=\"msgbuttons\" >\n",msgnum);
+
+ /** Reply */
+ if ( (WC->wc_view == VIEW_MAILBOX) || (WC->wc_view == VIEW_BBS) ) {
+ wprintf("<a href=\"display_enter");
+ if (WC->is_mailbox) {
+ wprintf("?replyquote=%ld", msgnum);
+ }
+ wprintf("?recp=");
+ urlescputs(reply_to);
+ if (!IsEmptyStr(m_subject)) {
+ wprintf("?subject=");
+ if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
+ urlescputs(m_subject);
+ }
+ wprintf("\"><span>[</span>%s<span>]</span></a> ", _("Reply"));
+ }
+
+ /** ReplyQuoted */
+ if ( (WC->wc_view == VIEW_MAILBOX) || (WC->wc_view == VIEW_BBS) ) {
+ if (!WC->is_mailbox) {
+ wprintf("<a href=\"display_enter");
+ wprintf("?replyquote=%ld", msgnum);
+ wprintf("?recp=");
+ urlescputs(reply_to);
+ if (!IsEmptyStr(m_subject)) {
+ wprintf("?subject=");
+ if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
+ urlescputs(m_subject);
+ }
+ wprintf("\"><span>[</span>%s<span>]</span></a> ", _("ReplyQuoted"));
+ }
+ }
+
+ /** ReplyAll */
+ if (WC->wc_view == VIEW_MAILBOX) {
+ wprintf("<a href=\"display_enter");
+ wprintf("?replyquote=%ld", msgnum);
+ wprintf("?recp=");
+ urlescputs(reply_to);
+ wprintf("?cc=");
+ urlescputs(reply_all);
+ if (!IsEmptyStr(m_subject)) {
+ wprintf("?subject=");
+ if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
+ urlescputs(m_subject);
+ }
+ wprintf("\"><span>[</span>%s<span>]</span></a> ", _("ReplyAll"));
+ }
+
+ /** Forward */
+ if (WC->wc_view == VIEW_MAILBOX) {
+ wprintf("<a href=\"display_enter?fwdquote=%ld?subject=", msgnum);
+ if (strncasecmp(m_subject, "Fwd:", 4)) wprintf("Fwd:%20");
+ urlescputs(m_subject);
+ wprintf("\"><span>[</span>%s<span>]</span></a> ", _("Forward"));
+ }
+
+ /** If this is one of my own rooms, or if I'm an Aide or Room Aide, I can move/delete */
+ if ( (WC->is_room_aide) || (WC->is_mailbox) || (WC->room_flags2 & QR2_COLLABDEL) ) {
+ /** Move */
+ wprintf("<a href=\"confirm_move_msg?msgid=%ld\"><span>[</span>%s<span>]</span></a> ",
+ msgnum, _("Move"));
+
+ /** Delete */
+ wprintf("<a href=\"delete_msg?msgid=%ld\" "
+ "onClick=\"return confirm('%s');\">"
+ "<span>[</span>%s<span>]</span> "
+ "</a> ", msgnum, _("Delete this message?"), _("Delete")
+ );
+ }
+
+ /** Headers */
+ wprintf("<a href=\"#\" onClick=\"window.open('msgheaders/%ld', 'headers%ld', 'toolbar=no,location=no,directories=no,copyhistory=no,status=yes,scrollbars=yes,resizable=yes,width=600,height=400'); \" >"
+ "<span>[</span>%s<span>]</span></a>", msgnum, msgnum, _("Headers"));
+
+
+ /** Print */
+ wprintf("<a href=\"#\" onClick=\"window.open('printmsg/%ld', 'print%ld', 'toolbar=no,location=no,directories=no,copyhistory=no,status=yes,scrollbars=yes,resizable=yes,width=600,height=400'); \" >"
+ "<span>[</span>%s<span>]</span></a>", msgnum, msgnum, _("Print"));
+
+ wprintf("</p>");
+
+ }
+
if (!IsEmptyStr(m_cc)) {
- wprintf("<div class=\"message_subject\">");
+ wprintf("<p>");
wprintf(_("CC:"));
wprintf(" ");
escputs(m_cc);
- wprintf("</div>");
+ wprintf("</p>");
}
if (!IsEmptyStr(m_subject)) {
- wprintf("<div class=\"message_subject\">");
+ wprintf("<p class=\"message_subject\">");
wprintf(_("Subject:"));
wprintf(" ");
escputs(m_subject);
- wprintf("</div>");
+ wprintf("</p>");
}
+ wprintf("</div>");
+
/** Begin body */
wprintf("<div class=\"message_content\">");
/** 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) ) {
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);
wprintf("%s ", &buf[5]);
}
if (!strncasecmp(buf, "time=", 5)) {
- fmt_date(now, atol(&buf[5]), 0);
+ webcit_fmt_date(now, atol(&buf[5]), 0);
wprintf("%s ", now);
}
}
}
wprintf("<tt>");
url(buf);
- msgescputs(buf);
+ msgescputs1(buf);
wprintf("</tt><br />");
}
wprintf("</i><br />");
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");
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"));
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");
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;
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) {
);
}
+
+ /**
+ * Set the "is_bbview" variable if it appears that we are looking at
+ * a classic bulletin board view.
+ */
+ if ((!is_tasks) && (!is_calendar) && (!is_addressbook)
+ && (!is_notes) && (!is_singlecard) && (!is_summary)) {
+ is_bbview = 1;
+ }
+
+ /**
+ * If we're not currently looking at ALL requested
+ * messages, then display the selector bar
+ */
+ if (is_bbview) {
+ /** begin bbview scroller */
+ wprintf("<form name=\"msgomatictop\" class=\"selector_top\" > \n <p>");
+ wprintf(_("Reading #"), lowest_displayed, highest_displayed);
+
+ wprintf("<select name=\"whichones\" size=\"1\" "
+ "OnChange=\"location.href=msgomatictop.whichones.options"
+ "[selectedIndex].value\">\n");
+
+ if (bbs_reverse) {
+ for (b=nummsgs-1; b>=0; b = b - maxmsgs) {
+ hi = b + 1;
+ lo = b - maxmsgs + 2;
+ if (lo < 1) lo = 1;
+ wprintf("<option %s value="
+ "\"%s"
+ "?startmsg=%ld"
+ "?maxmsgs=%d"
+ "?is_summary=%d\">"
+ "%d-%d</option> \n",
+ ((WCC->msgarr[lo-1] == startmsg) ? "selected" : ""),
+ oper,
+ WCC->msgarr[lo-1],
+ maxmsgs,
+ is_summary,
+ hi, lo);
+ }
+ }
+ else {
+ for (b=0; b<nummsgs; b = b + maxmsgs) {
+ lo = b + 1;
+ hi = b + maxmsgs + 1;
+ if (hi > nummsgs) hi = nummsgs;
+ wprintf("<option %s value="
+ "\"%s"
+ "?startmsg=%ld"
+ "?maxmsgs=%d"
+ "?is_summary=%d\">"
+ "%d-%d</option> \n",
+ ((WCC->msgarr[b] == startmsg) ? "selected" : ""),
+ oper,
+ WCC->msgarr[lo-1],
+ maxmsgs,
+ is_summary,
+ lo, hi);
+ }
+ }
+
+ wprintf("<option value=\"%s?startmsg=%ld"
+ "?maxmsgs=9999999?is_summary=%d\">",
+ oper,
+ WCC->msgarr[0], is_summary);
+ wprintf(_("All"));
+ wprintf("</option>");
+ wprintf("</select> ");
+ wprintf(_("of %d messages."), nummsgs);
+
+ /** forward/reverse */
+ wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
+ "OnChange=\"location.href='%s?sortby=forward'\"",
+ (bbs_reverse ? "" : "checked"),
+ oper
+ );
+ wprintf(">");
+ wprintf(_("oldest to newest"));
+ 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("\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]);
}
else if (is_tasks) {
- display_task(WC->msgarr[a]);
+ display_task(WCC->msgarr[a]);
}
else if (is_notes) {
- display_note(WC->msgarr[a]);
+ display_note(WCC->msgarr[a]);
}
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;
}
}
- /**
- * Set the "is_bbview" variable if it appears that we are looking at
- * a classic bulletin board view.
- */
- if ((!is_tasks) && (!is_calendar) && (!is_addressbook)
- && (!is_notes) && (!is_singlecard) && (!is_summary)) {
- is_bbview = 1;
- }
-
/** Output loop */
if (displayed_msgs != NULL) {
if (bbs_reverse) {
*/
if (is_bbview) {
/** begin bbview scroller */
- wprintf("<form name=\"msgomatic\">");
+ 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\">"
- "ALL"
- "</option> ",
+ "?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\">oldest to newest</option>\n",
- (bbs_reverse ? "" : "selected"),
+ wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
+ "OnChange=\"location.href='%s?sortby=forward'\"",
+ (bbs_reverse ? "" : "checked"),
oper
);
-
- wprintf("<option %s value=\"%s?sortby=reverse\">newest to oldest</option>\n",
- (bbs_reverse ? "selected" : ""),
+ wprintf(">");
+ wprintf(_("oldest to newest"));
+ wprintf(" ");
+ wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
+ "OnChange=\"location.href='%s?sortby=reverse'\"",
+ (bbs_reverse ? "checked" : ""),
oper
);
-
- wprintf("</select></form>\n");
+ wprintf(">");
+ wprintf(_("newest to oldest"));
+ 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);
}
struct wc_attachment *att;
char *encoded;
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) {
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>");
+
+ wprintf("</td></tr>");
if (recipient_required) {
- wprintf("<div style=\"float: left;\"><label for=\"recp_id\"> ");
+ wprintf("<tr><th><label for=\"recp_id\"> ");
wprintf(_("To:"));
- wprintf("</label>"
- "<input autocomplete=\"off\" type=\"text\" name=\"recp\" id=\"recp_id\" value=\"");
+ wprintf("</label></th>"
+ "<td><input autocomplete=\"off\" type=\"text\" name=\"recp\" id=\"recp_id\" value=\"");
escputs(bstr("recp"));
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("</td></tr>");
- wprintf("<br/><label for=\"cc_id\"> ");
+ wprintf("<tr><th><label for=\"cc_id\"> ");
wprintf(_("CC:"));
- wprintf("</label>"
- "<input autocomplete=\"off\" type=\"text\" name=\"cc\" id=\"cc_id\" value=\"");
+ wprintf("</label></th>"
+ "<td><input autocomplete=\"off\" type=\"text\" name=\"cc\" id=\"cc_id\" value=\"");
escputs(bstr("cc"));
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=\"");
+ wprintf("</label></th>"
+ "<td><input autocomplete=\"off\" type=\"text\" name=\"bcc\" id=\"bcc_id\" value=\"");
escputs(bstr("bcc"));
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>"
+ 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\">");
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>");