X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmessages.c;h=f06d17fd9ccb41eae09db20e6310d1fc18f9886e;hb=4ea562633e7454d0adfa7fef991a91fb184c71af;hp=a173d19810b471b636b1a7c981926cc503ea1ada;hpb=7a5dffa845faf97f684e24a6a722a5390df5fec5;p=citadel.git
diff --git a/webcit/messages.c b/webcit/messages.c
index a173d1981..f06d17fd9 100644
--- a/webcit/messages.c
+++ b/webcit/messages.c
@@ -1929,7 +1929,7 @@ void do_addrbook_view(struct addrbookent *addrbook, int num_ab) {
wprintf("", 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("\n");
@@ -2196,19 +2196,20 @@ void readloop(char *oper)
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");
@@ -2247,7 +2248,7 @@ void readloop(char *oper)
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"));
@@ -2257,7 +2258,7 @@ void readloop(char *oper)
}
}
- 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"));
@@ -2293,17 +2294,17 @@ void readloop(char *oper)
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;
@@ -2336,11 +2337,11 @@ void readloop(char *oper)
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;
}
}
}
@@ -2348,68 +2349,68 @@ void readloop(char *oper)
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 = "" ;
+ subjsort_button = "" ;
}
else if (!strcasecmp(sortby, "rsubject")) {
- subjsort_button = "" ;
+ subjsort_button = "" ;
}
else {
- subjsort_button = "" ;
+ subjsort_button = "" ;
}
if (!strcasecmp(sortby, "sender")) {
- sendsort_button = "" ;
+ sendsort_button = "" ;
}
else if (!strcasecmp(sortby, "rsender")) {
- sendsort_button = "" ;
+ sendsort_button = "" ;
}
else {
- sendsort_button = "" ;
+ sendsort_button = "" ;
}
if (!strcasecmp(sortby, "date")) {
- datesort_button = "" ;
+ datesort_button = "" ;
}
else if (!strcasecmp(sortby, "rdate")) {
- datesort_button = "" ;
+ datesort_button = "" ;
}
else {
- datesort_button = "" ;
+ datesort_button = "" ;
}
if (is_summary) {
@@ -2489,11 +2490,11 @@ void readloop(char *oper)
"\"%s"
"?startmsg=%ld"
"?maxmsgs=%d"
- "?summary=%d\">"
+ "?is_summary=%d\">"
"%d-%d \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);
@@ -2508,11 +2509,11 @@ void readloop(char *oper)
"\"%s"
"?startmsg=%ld"
"?maxmsgs=%d"
- "?summary=%d\">"
+ "?is_summary=%d\">"
"%d-%d \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);
@@ -2520,9 +2521,9 @@ void readloop(char *oper)
}
wprintf("");
wprintf(" ");
@@ -2554,36 +2555,36 @@ void readloop(char *oper)
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) *
(maxmsgsmsgarr[a];
+ displayed_msgs[num_displayed] = WCC->msgarr[a];
}
if (lowest_displayed < 0) lowest_displayed = a;
@@ -2656,11 +2657,11 @@ void readloop(char *oper)
"\"%s"
"?startmsg=%ld"
"?maxmsgs=%d"
- "?summary=%d\">"
+ "?is_summary=%d\">"
"%d-%d \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);
@@ -2675,11 +2676,11 @@ void readloop(char *oper)
"\"%s"
"?startmsg=%ld"
"?maxmsgs=%d"
- "?summary=%d\">"
+ "?is_summary=%d\">"
"%d-%d \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);
@@ -2687,9 +2688,9 @@ void readloop(char *oper)
}
wprintf("");
wprintf(" ");
@@ -2735,10 +2736,10 @@ DONE:
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);
}