\n");
@@ -931,7 +1008,7 @@ int load_msg_ptrs(char *servcmd)
serv_puts(servcmd);
serv_gets(buf);
if (buf[0] != '1') {
- wprintf("%s \n", &buf[4]);
+ wprintf("%s \n", &buf[4]);
return (nummsgs);
}
while (serv_gets(buf), strcmp(buf, "000")) {
@@ -951,7 +1028,9 @@ void readloop(char *oper)
{
char cmd[SIZ];
char buf[SIZ];
- int a, b, i;
+ char old_msgs[SIZ];
+ int is_new = 0;
+ int a, b;
int nummsgs;
long startmsg;
int maxmsgs;
@@ -961,6 +1040,7 @@ void readloop(char *oper)
int is_singlecard = 0;
int is_calendar = 0;
int is_tasks = 0;
+ int is_notes = 0;
int remaining_messages;
int lo, hi;
int lowest_displayed = (-1);
@@ -969,8 +1049,6 @@ void readloop(char *oper)
long pn_current = 0L;
long pn_next = 0L;
int bg = 0;
- char alpha = 0;
- char ab_alpha = 0;
struct addrbookent *addrbook = NULL;
int num_ab = 0;
@@ -979,20 +1057,24 @@ void readloop(char *oper)
is_summary = atoi(bstr("summary"));
if (maxmsgs == 0) maxmsgs = DEFAULT_MAXMSGS;
- output_headers(1);
+ output_headers(1, 1, 1, 0, 0, 0, 0);
+ /* When in summary mode, always show ALL messages instead of just
+ * new or old. Otherwise, show what the user asked for.
+ */
if (!strcmp(oper, "readnew")) {
strcpy(cmd, "MSGS NEW");
- } else if (!strcmp(oper, "readold")) {
+ }
+ else if (!strcmp(oper, "readold")) {
strcpy(cmd, "MSGS OLD");
- } else {
+ }
+ else {
strcpy(cmd, "MSGS ALL");
}
if ((WC->wc_view == VIEW_MAILBOX) && (maxmsgs > 1)) {
is_summary = 1;
strcpy(cmd, "MSGS ALL");
- /* maxmsgs = 32767; */
}
if ((WC->wc_view == VIEW_ADDRESSBOOK) && (maxmsgs > 1)) {
@@ -1001,39 +1083,25 @@ void readloop(char *oper)
maxmsgs = 32767;
}
- is_singlecard = atoi(bstr("is_singlecard"));
-
- /* Display the letter indices across the top */
- if ((is_addressbook) || (is_singlecard)) {
- if (strlen(bstr("alpha")) == 0) {
- alpha = 'a';
- }
- else {
- strcpy(buf, bstr("alpha"));
- alpha = buf[0];
- }
+ if (is_summary) {
+ strcpy(cmd, "MSGS ALL");
+ }
- for (i='1'; i<='z'; ++i) if ((i=='1')||(islower(i))) {
- if ((i != alpha) || (is_singlecard)) {
- wprintf("", i);
- }
- if (i == alpha) wprintf("");
- if (isalpha(i)) {
- wprintf("%c", toupper(i));
- }
- else {
- wprintf("(other)");
- }
- if (i == alpha) wprintf("");
- if ((i != alpha) || (is_singlecard)) {
- wprintf("\n");
- }
- wprintf(" ");
+ /* 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.
+ */
+ strcpy(old_msgs, "");
+ if (is_summary) {
+ serv_puts("GTSN");
+ serv_gets(buf);
+ if (buf[0] == '2') {
+ strcpy(old_msgs, &buf[4]);
}
-
- wprintf("\n");
}
+ is_singlecard = atoi(bstr("is_singlecard"));
+
if (WC->wc_view == VIEW_CALENDAR) { /* calendar */
is_calendar = 1;
strcpy(cmd, "MSGS ALL");
@@ -1043,20 +1111,23 @@ void readloop(char *oper)
is_tasks = 1;
strcpy(cmd, "MSGS ALL");
maxmsgs = 32767;
- wprintf("
");
+ }
+ if (WC->wc_view == VIEW_NOTES) { /* notes */
+ is_notes = 1;
+ strcpy(cmd, "MSGS ALL");
+ maxmsgs = 32767;
}
- started = time(NULL);
nummsgs = load_msg_ptrs(cmd);
if (nummsgs == 0) {
- if ((!is_tasks) && (!is_calendar)) {
+ if ((!is_tasks) && (!is_calendar) && (!is_notes)) {
if (!strcmp(oper, "readnew")) {
- wprintf("No new messages in this room.\n");
+ wprintf("No new messages.\n");
} else if (!strcmp(oper, "readold")) {
- wprintf("No old messages in this room.\n");
+ wprintf("No old messages.\n");
} else {
- wprintf("This room is empty.\n");
+ wprintf("No messages here.\n");
}
}
@@ -1072,9 +1143,11 @@ void readloop(char *oper)
}
}
+ wprintf("
\n");
DONE:
if (is_tasks) {
- wprintf(""
- "Add new task\n"
- );
+ do_tasks_view(); /* Render the task list */
}
if (is_calendar) {
@@ -1426,8 +1496,12 @@ void post_message(void)
serv_gets(buf);
if (buf[0] == '4') {
post_mime_to_server();
- sprintf(WC->ImportantMessage,
- "Message has been posted.\n");
+ if (strlen(bstr("recp")) > 0) {
+ sprintf(WC->ImportantMessage, "Message has been sent.\n");
+ }
+ else {
+ sprintf(WC->ImportantMessage, "Message has been posted.\n");
+ }
dont_post = atol(bstr("postseq"));
} else {
sprintf(WC->ImportantMessage,
@@ -1452,19 +1526,42 @@ void display_enter(void)
struct wc_attachment *att;
if (strlen(bstr("force_room")) > 0) {
- gotoroom(bstr("force_room"), 0);
+ gotoroom(bstr("force_room"));
}
/* Are we perhaps in an address book view? If so, then an "enter
* message" command really means "add new entry."
*/
- if (WC->wc_view == 2) {
+ if (WC->wc_view == VIEW_ADDRESSBOOK) {
do_edit_vcard(-1, "", "");
return;
}
- /* Otherwise proceed normally */
- output_headers(1);
+#ifdef WEBCIT_WITH_CALENDAR_SERVICE
+ /* Are we perhaps in a calendar view? If so, then an "enter
+ * message" command really means "add new calendar item."
+ */
+ if (WC->wc_view == VIEW_CALENDAR) {
+ display_edit_event();
+ return;
+ }
+
+ /* Are we perhaps in a tasks view? If so, then an "enter
+ * message" command really means "add new task."
+ */
+ if (WC->wc_view == VIEW_TASKS) {
+ display_edit_task();
+ return;
+ }
+#endif
+
+ /* Otherwise proceed normally. Do a custom room banner with no navbar... */
+ output_headers(1, 1, 2, 0, 0, 0, 0);
+ wprintf("