/** start msg buttons */
+ char Urlsep = '?';
+
if (!printable_view) {
wprintf("<p id=\"msg%ld\" class=\"msgbuttons\" >\n",msgnum);
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("%creplyquote=%ld", Urlsep, msgnum);
+ Urlsep = '&';
}
- wprintf("?recp=");
+ wprintf("%crecp=", Urlsep);
+ Urlsep = '&';
urlescputs(reply_to);
if (!IsEmptyStr(m_subject)) {
- wprintf("?subject=");
+ wprintf("%csubject=", Urlsep);
if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%%20");
urlescputs(m_subject);
}
- wprintf("?references=");
+ wprintf("%creferences=", Urlsep);
if (!IsEmptyStr(reply_references)) {
urlescputs(reply_references);
urlescputs("|");
if (!WC->is_mailbox) {
wprintf("<a href=\"display_enter");
wprintf("?replyquote=%ld", msgnum);
- wprintf("?recp=");
+ wprintf("&recp=");
urlescputs(reply_to);
if (!IsEmptyStr(m_subject)) {
- wprintf("?subject=");
+ wprintf("&subject=");
if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%%20");
urlescputs(m_subject);
}
- wprintf("?references=");
+ wprintf("&references=");
if (!IsEmptyStr(reply_references)) {
urlescputs(reply_references);
urlescputs("|");
if (WC->wc_view == VIEW_MAILBOX) {
wprintf("<a href=\"display_enter");
wprintf("?replyquote=%ld", msgnum);
- wprintf("?recp=");
+ wprintf("&recp=");
urlescputs(reply_to);
- wprintf("?cc=");
+ wprintf("&cc=");
urlescputs(reply_all);
if (!IsEmptyStr(m_subject)) {
- wprintf("?subject=");
+ wprintf("&subject=");
if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%%20");
urlescputs(m_subject);
}
- wprintf("?references=");
+ wprintf("&references=");
if (!IsEmptyStr(reply_references)) {
urlescputs(reply_references);
urlescputs("|");
/* Forward */
if (WC->wc_view == VIEW_MAILBOX) {
- wprintf("<a href=\"display_enter?fwdquote=%ld?subject=", msgnum);
+ 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"));
/* HTML is fun, but we've got to strip it first */
else if (!strcasecmp(mime_content_type, "text/html")) {
- output_html(mime_charset, (WC->wc_view == VIEW_WIKI ? 1 : 0));
+ output_html(mime_charset, (WC->wc_view == VIEW_WIKI ? 1 : 0), msgnum);
}
/* Unknown weirdness */
|| (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))
|| (WC->wc_view == VIEW_ADDRESSBOOK)
) {
- wprintf("<a href=\"edit_vcard?msgnum=%ld?partnum=%s\">",
+ wprintf("<a href=\"edit_vcard?msgnum=%ld&partnum=%s\">",
msgnum, vcard_partnum);
wprintf("[%s]</a>", _("edit"));
}
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("<tr id=\"m%ld\" style=\"font-weight:%s;\" "
"onMouseDown=\"CtdlMoveMsgMouseDown(event,%ld)\">",
WC->summ[num].msgnum,
- (WC->summ[num].is_new ? "bold" : "normal"),
+ ((WC->summ[num].is_new) ? "bold" : "normal"),
WC->summ[num].msgnum
);
|| (WC->wc_view == VIEW_ADDRESSBOOK)
) {
wprintf("<a href=\"edit_vcard?"
- "msgnum=%ld?partnum=%s\">",
+ "msgnum=%ld&partnum=%s\">",
msgnum, vcard_partnum);
wprintf("[%s]</a>", _("edit"));
}
wprintf("<td>");
- wprintf("<a href=\"readfwd?startmsg=%ld&is_singlecard=1",
+ wprintf("<a href=\"readfwd?startmsg=%ld?is_singlecard=1",
addrbook[i].ab_msgnum);
wprintf("?maxmsgs=1?is_summary=0?alpha=%s\">", bstr("alpha"));
vcard_n_prettyize(addrbook[i].ab_name);
++displayed;
}
+ /* Placeholders for empty columns at end */
+ if ((num_ab % 4) != 0) {
+ for (i=0; i<(4-(num_ab % 4)); ++i) {
+ wprintf("<td> </td>");
+ }
+ }
+
wprintf("</tr></table>\n");
end_tab((num_pages-1), num_pages);
+ begin_tab(num_pages, num_pages);
+ /* FIXME there ought to be something here */
+ end_tab(num_pages, num_pages);
+
for (i=0; i<num_pages; ++i) {
free(tablabels[i]);
}
-/**
- * \brief load message pointers from the server
- * \param servcmd the citadel command to send to the citserver
- * \param with_headers what headers???
+/*
+ * load message pointers from the server for a "read messages" operation
+ *
+ * servcmd: the citadel command to send to the citserver
+ * with_headers: also include some of the headers with the message numbers (more expensive)
*/
int load_msg_ptrs(char *servcmd, int with_headers)
{
typedef int (*QSortFunction) (const void*, const void*);
-/**
- * \brief qsort() compatible function to compare two longs in descending order.
- *
- * \param s1 first number to compare
- * \param s2 second number to compare
+
+/*
+ * qsort() compatible function to compare two longs in descending order.
*/
int longcmp_r(const void *s1, const void *s2) {
long l1;
}
-/**
- * \brief qsort() compatible function to compare two message summary structs by ascending subject.
- *
- * \param s1 first item to compare
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by ascending subject.
*/
int summcmp_subj(const void *s1, const void *s2) {
struct message_summary *summ1;
return strcasecmp(summ1->subj, summ2->subj);
}
-/**
- * \brief qsort() compatible function to compare two message summary structs by descending subject.
- *
- * \param s1 first item to compare
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by descending subject.
*/
int summcmp_rsubj(const void *s1, const void *s2) {
struct message_summary *summ1;
return strcasecmp(summ2->subj, summ1->subj);
}
-/**
- * \brief qsort() compatible function to compare two message summary structs by ascending sender.
- *
- * \param s1 first item to compare
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by ascending sender.
*/
int summcmp_sender(const void *s1, const void *s2) {
struct message_summary *summ1;
return strcasecmp(summ1->from, summ2->from);
}
-/**
- * \brief qsort() compatible function to compare two message summary structs by descending sender.
- *
- * \param s1 first item to compare
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by descending sender.
*/
int summcmp_rsender(const void *s1, const void *s2) {
struct message_summary *summ1;
return strcasecmp(summ2->from, summ1->from);
}
-/**
- * \brief qsort() compatible function to compare two message summary structs by ascending date.
- *
- * \param s1 first item to compare
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by ascending date.
*/
int summcmp_date(const void *s1, const void *s2) {
struct message_summary *summ1;
else return 0;
}
-/**
- * \brief qsort() compatible function to compare two message summary structs by descending date.
- *
- * \param s1 first item to compare
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by descending date.
*/
int summcmp_rdate(const void *s1, const void *s2) {
struct message_summary *summ1;
eUnSet
};
-/** SortEnum to plain string representation */
+/* SortEnum to plain string representation */
static const char* SortByStrings[] = {
"date",
"rdate",
"unset"
};
-/** SortEnum to sort-Function Table */
+/* SortEnum to sort-Function Table */
const QSortFunction SortFuncs[eUnSet] = {
summcmp_date,
summcmp_rdate,
summcmp_rdate
};
-/** given a SortEnum, which icon should we choose? */
+/* given a SortEnum, which icon should we choose? */
const int SortDateToIcon[eUnSet] = { eUp, eDown, eNone, eNone, eNone, eNone, eNone};
const int SortSubjectToIcon[eUnSet] = { eNone, eNone, eUp, eDown, eNone, eNone, eNone};
const int SortSenderToIcon[eUnSet] = { eNone, eNone, eNone, eNone, eUp, eDown, eNone};
-/** given a SortEnum, which would be the "opposite" search option? */
+/* given a SortEnum, which would be the "opposite" search option? */
const int DateInvertSortString[eUnSet] = { eRDate, eDate, eDate, eDate, eDate, eDate, eDate};
const int SubjectInvertSortString[eUnSet] = { eSubject, eSubject, eRSubject, eUnSet, eSubject, eSubject, eSubject};
const int SenderInvertSortString[eUnSet] = { eSender, eSender, eSender, eSender, eRSender, eUnSet, eSender};
-/**
- * \Brief Translates sortoption String to its SortEnum representation
- * \param SortBy string to translate
- * \return the enum matching the string; defaults to RDate
+/*
+ * Translates sortoption String to its SortEnum representation
+ * returns the enum matching the string; defaults to RDate
*/
//SortByEnum
int StrToESort (const StrBuf *sortby)
-/**
- * \brief command loop for reading messages
+/*
+ * command loop for reading messages
*
- * \param oper Set to "readnew" or "readold" or "readfwd" or "headers"
+ * Set oper to "readnew" or "readold" or "readfwd" or "headers"
*/
void readloop(char *oper)
{
int is_addressbook = 0;
int is_singlecard = 0;
int is_calendar = 0;
+ struct calview calv;
int is_tasks = 0;
int is_notes = 0;
int is_bbview = 0;
struct wcsession *WCC = WC; /* This is done to make it run faster; WC is a function */
if (WCC->wc_view == VIEW_WIKI) {
- sprintf(buf, "wiki?room=%s?page=home", WCC->wc_roomname);
+ sprintf(buf, "wiki?room=%s&page=home", WCC->wc_roomname);
http_redirect(buf);
return;
}
}
SortBy = StrToESort(sortpref_value);
- /** message board sort */
+ /* message board sort */
if (SortBy == eReverse) {
bbs_reverse = 1;
}
output_headers(1, 1, 1, 0, 0, 0);
- /**
+ /*
* When in summary mode, always show ALL messages instead of just
* new or old. Otherwise, show what the user asked for.
*/
SortBy = eRDate;
}
- /**
+ /*
* Are we doing a summary view? If so, we need to know old messages
* and new messages, so we can do that pretty boldface thing for the
* new messages.
is_calendar = 1;
strcpy(cmd, "MSGS ALL|||1");
maxmsgs = 32767;
+ parse_calendar_view_request(&calv);
}
if (WCC->wc_default_view == VIEW_TASKS) { /**< tasks */
is_tasks = 1;
if (lo < 1) lo = 1;
wprintf("<option %s value="
"\"%s"
- "?startmsg=%ld"
- "?maxmsgs=%d"
- "?is_summary=%d\">"
+ "&startmsg=%ld"
+ "&maxmsgs=%d"
+ "&is_summary=%d\">"
"%d-%d</option> \n",
((WCC->msgarr[lo-1] == startmsg) ? "selected" : ""),
oper,
if (hi > nummsgs) hi = nummsgs;
wprintf("<option %s value="
"\"%s"
- "?startmsg=%ld"
- "?maxmsgs=%d"
- "?is_summary=%d\">"
+ "&startmsg=%ld"
+ "&maxmsgs=%d"
+ "&is_summary=%d\">"
"%d-%d</option> \n",
((WCC->msgarr[b] == startmsg) ? "selected" : ""),
oper,
}
wprintf("<option value=\"%s?startmsg=%ld"
- "?maxmsgs=9999999?is_summary=%d\">",
+ "&maxmsgs=9999999&is_summary=%d\">",
oper,
WCC->msgarr[0], is_summary);
wprintf(_("All"));
addrbook[num_ab-1].ab_msgnum = WCC->msgarr[a];
}
else if (is_calendar) {
- display_calendar(WCC->msgarr[a], WCC->summ[a].is_new);
+ load_calendar_item(WCC->msgarr[a], WCC->summ[a].is_new, &calv);
}
else if (is_tasks) {
display_task(WCC->msgarr[a], WCC->summ[a].is_new);
if (lo < 1) lo = 1;
wprintf("<option %s value="
"\"%s"
- "?startmsg=%ld"
- "?maxmsgs=%d"
- "?is_summary=%d\">"
+ "&startmsg=%ld"
+ "&maxmsgs=%d"
+ "&is_summary=%d\">"
"%d-%d</option> \n",
((WCC->msgarr[lo-1] == startmsg) ? "selected" : ""),
oper,
if (hi > nummsgs) hi = nummsgs;
wprintf("<option %s value="
"\"%s"
- "?startmsg=%ld"
- "?maxmsgs=%d"
- "?is_summary=%d\">"
+ "&startmsg=%ld"
+ "&maxmsgs=%d"
+ "&is_summary=%d\">"
"%d-%d</option> \n",
((WCC->msgarr[b] == startmsg) ? "selected" : ""),
oper,
}
}
- wprintf("<option value=\"%s?startmsg=%ld"
- "?maxmsgs=9999999?is_summary=%d\">",
+ wprintf("<option value=\"%s&startmsg=%ld"
+ "&maxmsgs=9999999&is_summary=%d\">",
oper,
WCC->msgarr[0], is_summary);
wprintf(_("All"));
/** forward/reverse */
wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
- "OnChange=\"location.href='%s?sortby=forward'\"",
+ "OnChange=\"location.href='%s&sortby=forward'\"",
(bbs_reverse ? "" : "checked"),
oper
);
wprintf(_("oldest to newest"));
wprintf(" ");
wprintf("<input type=\"radio\" %s name=\"direction\" value=\"\""
- "OnChange=\"location.href='%s?sortby=reverse'\"",
+ "OnChange=\"location.href='%s&sortby=reverse'\"",
(bbs_reverse ? "checked" : ""),
oper
);
}
if (is_calendar) {
- do_calendar_view(); /** Render the calendar */
+ render_calendar_view(&calv);
}
if (is_addressbook) {
ChrPtr(Wikipage),
ChrPtr(my_email_addr),
ChrPtr(references));
+ FreeStrBuf(&references);
lprintf(9, "%s\n", CmdBuf);
serv_puts(ChrPtr(CmdBuf));
}
sig ++;
}
+ FreeStrBuf(&Sig);
}
}