char *viewdefs[] = {
"Messages",
"Summary",
- "Address Book"
+ "Address Book",
+ "Calendar",
+ "Tasks"
};
char floorlist[128][SIZ];
void zapped_list(void)
{
output_headers(1);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Zapped (forgotten) rooms</B>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Zapped (forgotten) rooms</SPAN>\n");
wprintf("</TD></TR></TABLE><BR>\n");
listrms("LZRM -1");
wprintf("<BR><BR>\n");
serv_puts("OIMG _roompic_");
serv_gets(buf);
if (buf[0] == '2') {
- wprintf("<TD BGCOLOR=444455>");
+ wprintf("<TD BGCOLOR=\"#444455\">");
wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
urlescputs(WC->wc_roomname);
wprintf("\"></TD>");
"<A HREF=\"/dotgoto?room=_MAIL_\">"
"<IMG SRC=\"/static/mail.gif\" border=0 "
"ALT=\"You have new mail\">"
- "<BR><FONT SIZE=2 COLOR=FFFFFF>"
- "%d new mail</FONT></A>", WC->new_mail);
+ "<BR><SPAN CLASS=\"youhavemail\">"
+ "%d new mail</SPAN></A>", WC->new_mail);
WC->remember_new_mail = WC->new_mail;
}
}
"[selectedIndex].value\">\n");
for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
- wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
- ((i == WC->wc_view) ? "SELECTED" : ""),
- i );
- escputs(viewdefs[i]);
- wprintf("</OPTION>\n");
+ /*
+ * Only offer the views that make sense, given the default
+ * view for the room. For example, don't offer a Calendar
+ * view in a non-Calendar room.
+ */
+ if (
+ (i == WC->wc_view)
+ || (i == WC->wc_default_view)
+ || ( (i == 0) && (WC->wc_default_view == 1) )
+ || ( (i == 1) && (WC->wc_default_view == 0) )
+ ) {
+
+ wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
+ ((i == WC->wc_view) ? "SELECTED" : ""),
+ i );
+ escputs(viewdefs[i]);
+ wprintf("</OPTION>\n");
+ }
}
wprintf("</SELECT></FORM>\n");
}
}
strcpy(WC->wc_roomname, WC->wc_roomname);
WC->wc_view = extract_int(&buf[4], 11);
+ WC->wc_default_view = extract_int(&buf[4], 12);
}
*/
char *pop_march(int desired_floor)
{
- static char TheRoom[64];
+ static char TheRoom[128];
int TheFloor = 0;
int TheOrder = 32767;
int TheWeight = 0;
{
char buf[SIZ];
struct march *mptr, *mptr2;
- char next_room[32];
+ char next_room[128];
/* First check to see if the march-mode list is already allocated.
* If it is, pop the first room off the list and go there.
smart_goto(buf);
}
+
+
+
+
+/*
+ * Set/clear/read the "self-service list subscribe" flag for a room
+ *
+ * Set 'newval' to 0 to clear, 1 to set, any other value to leave unchanged.
+ * Always returns the new value.
+ */
+
+int self_service(int newval) {
+ int current_value = 0;
+ char buf[SIZ];
+
+ char name[SIZ];
+ char password[SIZ];
+ char dirname[SIZ];
+ int flags, floor, order, view, flags2;
+
+ serv_puts("GETR");
+ serv_gets(buf);
+ if (buf[0] != '2') return(0);
+
+ extract(name, &buf[4], 0);
+ extract(password, &buf[4], 1);
+ extract(dirname, &buf[4], 2);
+ flags = extract_int(&buf[4], 3);
+ floor = extract_int(&buf[4], 4);
+ order = extract_int(&buf[4], 5);
+ view = extract_int(&buf[4], 6);
+ flags2 = extract_int(&buf[4], 7);
+
+ if (flags2 & QR2_SELFLIST) {
+ current_value = 1;
+ }
+ else {
+ current_value = 0;
+ }
+
+ if (newval == 1) {
+ flags2 = flags2 | QR2_SELFLIST;
+ }
+ else if (newval == 0) {
+ flags2 = flags2 & ~QR2_SELFLIST;
+ }
+ else {
+ return(current_value);
+ }
+
+ if (newval != current_value) {
+ serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
+ name, password, dirname, flags,
+ floor, order, view, flags2);
+ serv_gets(buf);
+ }
+
+ return(newval);
+
+}
+
+
+
+
+
+
/*
* display the form for editing a room
*/
output_headers(1);
/* print the tabbed dialog */
- wprintf("<TABLE border=0 width=100%%><TR BGCOLOR=FFFFFF><TD> </TD>");
+ wprintf("<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
+ "<TR ALIGN=CENTER BGCOLOR=\"#FFFFFF\">"
+ "<TD> </TD>\n");
if (!strcmp(tab, "admin")) {
- wprintf("<TD BGCOLOR=000077><FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");
+ wprintf("<TD BGCOLOR=\"#000077\"><SPAN CLASS=\"tablabel\">");
}
else {
- wprintf("<TD><A HREF=\"/display_editroom&tab=admin\">");
+ wprintf("<TD BGCOLOR=\"#AAAAAA\"><A HREF=\"/display_editroom&tab=admin\">");
}
wprintf("Room administration");
if (!strcmp(tab, "admin")) {
- wprintf("</B></FONT></TD>\n");
+ wprintf("</SPAN></TD>\n");
}
else {
wprintf("</A></TD>\n");
}
- wprintf("<TD> </TD>\n");
+ wprintf("<TD> </TD>\n");
if (!strcmp(tab, "config")) {
- wprintf("<TD BGCOLOR=000077><FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");
+ wprintf("<TD BGCOLOR=\"#000077\"><SPAN CLASS=\"tablabel\">");
}
else {
- wprintf("<TD><A HREF=\"/display_editroom&tab=config\">");
+ wprintf("<TD BGCOLOR=\"#AAAAAA\"><A HREF=\"/display_editroom&tab=config\">");
}
wprintf("Room configuration");
if (!strcmp(tab, "config")) {
- wprintf("</B></FONT></TD>\n");
+ wprintf("</SPAN></TD>\n");
}
else {
wprintf("</A></TD>\n");
}
- wprintf("<TD> </TD>\n");
+ wprintf("<TD> </TD>\n");
if (!strcmp(tab, "sharing")) {
- wprintf("<TD BGCOLOR=000077><FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");
+ wprintf("<TD BGCOLOR=\"#000077\"><SPAN CLASS=\"tablabel\">");
}
else {
- wprintf("<TD><A HREF=\"/display_editroom&tab=sharing\">");
+ wprintf("<TD BGCOLOR=\"#AAAAAA\"><A HREF=\"/display_editroom&tab=sharing\">");
}
wprintf("Sharing");
if (!strcmp(tab, "sharing")) {
- wprintf("</B></FONT></TD>\n");
+ wprintf("</SPAN></TD>\n");
}
else {
wprintf("</A></TD>\n");
}
- wprintf("<TD> </TD>\n");
+ wprintf("<TD> </TD>\n");
if (!strcmp(tab, "listserv")) {
- wprintf("<TD BGCOLOR=000077><FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");
+ wprintf("<TD BGCOLOR=\"#000077\"><SPAN CLASS=\"tablabel\">");
}
else {
- wprintf("<TD><A HREF=\"/display_editroom&tab=listserv\">");
+ wprintf("<TD BGCOLOR=\"#AAAAAA\"><A HREF=\"/display_editroom&tab=listserv\">");
}
wprintf("Mailing list service");
if (!strcmp(tab, "listserv")) {
- wprintf("</B></FONT></TD>\n");
+ wprintf("</SPAN></TD>\n");
}
else {
wprintf("</A></TD>\n");
}
- wprintf("<TD> </TD></TR></TABLE>\n");
+ wprintf("<TD> </TD></TR>"
+ "<TR><TD BGCOLOR=\"#000077\" COLSPAN=9 HEIGHT=5> </TD></TR>"
+ "</TABLE>\n");
/* end tabbed dialog */
}
}
- wprintf("</TD></TR></TABLE><BR>\n"
+ wprintf("</TD></TR>"
+ "</TABLE><BR>\n"
"<I><B>Reminder:</B> When sharing a room, "
"it must be shared from both ends. Adding a node to "
"the 'shared' list sends messages out, but in order to"
/* Mailing list management */
if (!strcmp(tab, "listserv")) {
- wprintf("<BR><center><i>The contents of this room are being "
- "mailed to the following list recipients:"
+ wprintf("<BR><center>"
+ "<TABLE BORDER=0 WIDTH=100%% CELLPADDING=5>"
+ "<TR><TD VALIGN=TOP>");
+
+ wprintf("<i>The contents of this room are being "
+ "mailed <b>as individual messages</b> "
+ "to the following list recipients:"
"</i><br><br>\n");
serv_puts("GNET");
"<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
- wprintf("</FORM><BR></CENTER>\n");
+ wprintf("</FORM>\n");
+
+ wprintf("</TD><TD VALIGN=TOP>\n");
+
+ wprintf("<i>The contents of this room are being "
+ "mailed <b>in digest form</b> "
+ "to the following list recipients:"
+ "</i><br><br>\n");
+
+ serv_puts("GNET");
+ serv_gets(buf);
+ if (buf[0]=='1') while (serv_gets(buf), strcmp(buf, "000")) {
+ extract(cmd, buf, 0);
+ if (!strcasecmp(cmd, "digestrecp")) {
+ extract(recp, buf, 1);
+
+ escputs(recp);
+ wprintf(" <A HREF=\"/netedit&cmd=remove&line="
+ "digestrecp|");
+ urlescputs(recp);
+ wprintf("&tab=listserv\">(remove)</A><BR>");
+
+ }
+ }
+ wprintf("<BR><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
+ "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
+ "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
+ wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
+ wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
+ wprintf("</FORM>\n");
+
+ wprintf("</TD></TR></TABLE><HR>\n");
+
+ if (self_service(999) == 1) {
+ wprintf("This room is configured to allow "
+ "self-service subscribe/unsubscribe requests."
+ " <A HREF=\"/toggle_self_service?newval=0&"
+ "tab=listserv\">"
+ "Click to disable.</A><BR>\n"
+ "The URL for subscribe/unsubscribe is: "
+ "<TT>http://%s/listsub</TT><BR>\n",
+ WC->http_host
+ );
+ }
+ else {
+ wprintf("This room is <i>not</i> configured to allow "
+ "self-service subscribe/unsubscribe requests."
+ " <A HREF=\"/toggle_self_service?newval=1&"
+ "tab=listserv\">"
+ "Click to enable.</A><BR>\n"
+ );
+ }
+
+
+ wprintf("</CENTER>\n");
}
wDumpContent(1);
}
+/*
+ * Toggle self-service list subscription
+ */
+void toggle_self_service(void) {
+ int newval = 0;
+
+ newval = atoi(bstr("newval"));
+ self_service(newval);
+ display_editroom();
+}
+
+
+
/*
* save new parameters for a room
*/
output_headers(1);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>Access control list for ");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#007700\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Access control list for ");
escputs(WC->wc_roomname);
- wprintf("</B></FONT></TD></TR></TABLE>\n");
+ wprintf("</SPAN></TD></TR></TABLE>\n");
if(!strcmp(bstr("sc"), "Kick")) {
sprintf(buf, "KICK %s", username);
}
output_headers(1);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Enter (create) a new room</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#000077\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Enter (create) a new room</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<FORM METHOD=\"POST\" ACTION=\"/entroom\">\n");
output_headers(1);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Goto a private room</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Goto a private room</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<CENTER>\n");
wprintf("If you know the name of a hidden (guess-name) or\n");
wprintf("so you don't have to keep returning here.\n");
wprintf("<BR><BR>");
- wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
+ wprintf("<FORM METHOD=\"GET\" ACTION=\"/goto_private\">\n");
wprintf("<TABLE border><TR><TD>");
wprintf("Enter room name:</TD><TD>");
*/
void goto_private(void)
{
- char hold_rm[32];
+ char hold_rm[SIZ];
char buf[SIZ];
if (strcasecmp(bstr("sc"), "OK")) {
{
output_headers(1);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Zap (forget) the current room</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Zap (forget) the current room</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
wprintf("disappear from your room list. Is this what you wish ");
wprintf("to do?<BR>\n");
- wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
+ wprintf("<FORM METHOD=\"GET\" ACTION=\"/zap\">\n");
wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
wprintf("</FORM>\n");
return;
}
output_headers(1);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
- wprintf("<B>Confirm deletion of room</B>\n");
- wprintf("</FONT></TD></TR></TABLE>\n");
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
+ wprintf("<SPAN CLASS=\"titlebar\">Confirm deletion of room</SPAN>\n");
+ wprintf("</TD></TR></TABLE>\n");
wprintf("<CENTER>");
- wprintf("<FORM METHOD=\"POST\" ACTION=\"/delete_room\">\n");
+ wprintf("<FORM METHOD=\"GET\" ACTION=\"/delete_room\">\n");
wprintf("Are you sure you want to delete <FONT SIZE=+1>");
escputs(WC->wc_roomname);
char buf[SIZ];
int levels, oldlevels;
+ int swap = 0;
struct folder {
char room[SIZ];
struct folder ftmp;
int max_folders = 0;
int alloc_folders = 0;
- int i, j, k;
+ int i, j, k, t;
int p;
int flags;
int floor;
fold = malloc(sizeof(struct folder));
memset(fold, 0, sizeof(struct folder));
strcpy(fold[0].name, "My folders");
+ fold[0].is_mailbox = 1;
/* Then add floors */
serv_puts("LFLR");
/* Bubble-sort the folder list */
for (i=0; i<max_folders; ++i) {
for (j=0; j<(max_folders-1)-i; ++j) {
- if (strcasecmp(fold[j].name, fold[j+1].name) > 0) {
+ if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
+ swap = strcasecmp(fold[j].name, fold[j+1].name);
+ }
+ else {
+ if ( (fold[j+1].is_mailbox)
+ && (!fold[j].is_mailbox)) {
+ swap = 1;
+ }
+ else {
+ swap = 0;
+ }
+ }
+ if (swap > 0) {
memcpy(&ftmp, &fold[j], sizeof(struct folder));
memcpy(&fold[j], &fold[j+1],
sizeof(struct folder));
levels = num_tokens(fold[i].name, '|');
if (levels > oldlevels) {
for (k=0; k<(levels-oldlevels); ++k) {
- wprintf("<UL>");
++nests;
}
}
if (levels < oldlevels) {
for (k=0; k<(oldlevels-levels); ++k) {
- wprintf("</UL>");
--nests;
}
}
oldlevels = levels;
- wprintf("<LI>");
+ for (t=0; t<nests; ++t) wprintf(" ");
if (fold[i].selectable) {
wprintf("<A HREF=\"/dotgoto?room=");
urlescputs(fold[i].room);
wprintf("\">");
}
+ else {
+ wprintf("<i>");
+ }
if (fold[i].hasnewmsgs) wprintf("<B>");
extract(buf, fold[i].name, levels-1);
escputs(buf);
if (fold[i].hasnewmsgs) wprintf("</B>");
- if (fold[i].selectable) wprintf("</A>\n");
+ if (fold[i].selectable) {
+ wprintf("</A>");
+ }
+ else {
+ wprintf("</i>");
+ }
+ if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
+ wprintf(" (INBOX)");
+ }
+ wprintf("<BR>\n");
}
- while (nests-- > 0) wprintf("</UL>\n");
+ while (nests-- > 0) ;;
free(fold);
wDumpContent(1);
}
/* title bar */
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>"
- "<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>"
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#000077\"><TR><TD>"
+ "<SPAN CLASS=\"titlebar\">"
);
if (!strcasecmp(listviewpref, "rooms")) {
wprintf("Room list");
if (!strcasecmp(listviewpref, "folders")) {
wprintf("Folder list");
}
- wprintf("</B></TD>\n");
+ wprintf("</SPAN></TD>\n");
/* offer the ability to switch views */