use the same way to display all banners and services contents
[citadel.git] / webcit / roomops.c
index 5cee8c9f21012816ca6b76aa303147fe42346f85..0c5b3c3b56178e94b513521de6be0326896c368d 100644 (file)
@@ -10,7 +10,7 @@
 
 char floorlist[128][SIZ]; /**< list of our floor names */
 
-char *viewdefs[8]; /**< the different kinds of available views */
+char *viewdefs[9]; /**< the different kinds of available views */
 
 /**
  * \brief initialize the viewdefs with localized strings
@@ -24,6 +24,7 @@ void initialize_viewdefs(void) {
        viewdefs[5] = _("Notes List");
        viewdefs[6] = _("Wiki");
        viewdefs[7] = _("Calendar List");
+       viewdefs[8] = _("Journal");
 }
 
 /**
@@ -42,6 +43,7 @@ int is_view_allowed_as_default(int which_view)
                case VIEW_NOTES:        return(1);
                case VIEW_WIKI:         return(0);      /**< because it isn't finished yet */
                case VIEW_CALBRIEF:     return(0);
+               case VIEW_JOURNAL:      return(0);
                default:                return(0);      /**< should never get here */
        }
 }
@@ -272,22 +274,36 @@ void zapped_list(void)
  */
 void readinfo(void)
 {
-       char buf[SIZ];
+       char buf[256];
+       char briefinfo[128];
+       char fullinfo[8192];
+       int fullinfo_len = 0;
 
        serv_puts("RINF");
        serv_getln(buf, sizeof buf);
        if (buf[0] == '1') {
+
+               while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+                       if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
+                               strcpy(&fullinfo[fullinfo_len], buf);
+                               fullinfo_len += strlen(buf);
+                       }
+               }
+
+               safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
+               strcpy(&briefinfo[50], "...");
+
                 wprintf("<div class=\"infos\" "
                 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
                 ">");
-                wprintf(_("Room info"));
-                wprintf("</div><div id=\"room_infos\" style=\"display:none;\">"
-                "<p class=\"close_infos\" "
-                "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
-                ">");
-               wprintf(_("Close window"));
-               wprintf("</p>");
-                fmout("CENTER");
+               escputs(briefinfo);
+                wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
+               wprintf("<img class=\"close_infos\" "
+                       "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
+                       "src=\"static/closewindow.gif\" alt=\"%s\">",
+                       _("Close window")
+               );
+               escputs(fullinfo);
                 wprintf("</div>");
        }
        else {
@@ -364,8 +380,9 @@ void embed_room_graphic(void) {
 void embed_view_o_matic(void) {
        int i;
 
-       wprintf("<form name=\"viewomatic\" action=\"changeview\">\n"
-               "<label for=\"view_name\">");
+       wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+       wprintf("<label for=\"view_name\">");
        wprintf(_("View as:"));
        wprintf("</label> "
                "<select name=\"newview\" size=\"1\" "
@@ -402,8 +419,9 @@ void embed_view_o_matic(void) {
  * \brief Display a search box
  */
 void embed_search_o_matic(void) {
-       wprintf("<form name=\"searchomatic\" action=\"do_search\">\n"
-               "<label for=\"search_name\">");
+       wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+       wprintf("<label for=\"search_name\">");
        wprintf(_("Search: "));
        wprintf("</label> <input "
                "type=\"text\" name=\"query\" size=\"15\" maxlength=\"128\" "
@@ -423,6 +441,7 @@ void embed_search_o_matic(void) {
 
 void embed_room_banner(char *got, int navbar_style) {
        char buf[256];
+       char sanitized_roomname[256];
 
        /**
         * We need to have the information returned by a GOTO server command.
@@ -453,7 +472,8 @@ void embed_room_banner(char *got, int navbar_style) {
        WC->new_mail = extract_int(&got[4], 9);
        WC->wc_view = extract_int(&got[4], 11);
 
-       svprintf("ROOMNAME", WCS_STRING, "%s", WC->wc_roomname);
+       stresc(sanitized_roomname, WC->wc_roomname, 1, 1);
+       svprintf("ROOMNAME", WCS_STRING, "%s", sanitized_roomname);
        svprintf("NUMMSGS", WCS_STRING,
                _("%d new of %d messages"),
                extract_int(&got[4], 1),
@@ -468,10 +488,7 @@ void embed_room_banner(char *got, int navbar_style) {
        do_template("roombanner");
        if (navbar_style != navbar_none) {
 
-               wprintf("<div id=\"navbar\">\n"
-                       "<ul>");
-
-               
+               wprintf("<div id=\"navbar\"><ul>");
 
                if (navbar_style == navbar_default) wprintf(
                        "<li class=\"ungoto\">"
@@ -608,9 +625,9 @@ void embed_room_banner(char *got, int navbar_style) {
                                case VIEW_CALENDAR:
                                case VIEW_CALBRIEF:
                                        wprintf("<li class=\"addevent\"><a href=\"display_enter");
-                                       if (strlen(bstr("year")) > 0) wprintf("?year=%s", bstr("year"));
-                                       if (strlen(bstr("month")) > 0) wprintf("?month=%s", bstr("month"));
-                                       if (strlen(bstr("day")) > 0) wprintf("?day=%s", bstr("day"));
+                                       if (!IsEmptyStr(bstr("year" ))) wprintf("?year=%s", bstr("year"));
+                                       if (!IsEmptyStr(bstr("month"))) wprintf("?month=%s", bstr("month"));
+                                       if (!IsEmptyStr(bstr("day"  ))) wprintf("?day=%s", bstr("day"));
                                        wprintf("\">"
                                                "<img align=\"middle\" src=\"static/addevent_24x.gif\" "
                                                "border=\"0\"><span class=\"navbar_link\">"
@@ -1014,7 +1031,7 @@ void display_editroom(void)
        int floorvalue = 0;
 
        tab = bstr("tab");
-       if (strlen(tab) == 0) tab = "admin";
+       if (IsEmptyStr(tab)) tab = "admin";
 
        load_floorlist();
        serv_puts("GETR");
@@ -1164,6 +1181,7 @@ void display_editroom(void)
 
        if (!strcmp(tab, "config")) {
                wprintf("<FORM METHOD=\"POST\" action=\"editroom\">\n");
+               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
        
                wprintf("<UL><LI>");
                wprintf(_("Name of room: "));
@@ -1176,7 +1194,7 @@ void display_editroom(void)
                wprintf(_("Resides on floor: "));
                wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
                for (i = 0; i < 128; ++i)
-                       if (strlen(floorlist[i]) > 0) {
+                       if (!IsEmptyStr(floorlist[i])) {
                                wprintf("<OPTION ");
                                if (i == er_floor)
                                        wprintf("SELECTED ");
@@ -1194,7 +1212,7 @@ void display_editroom(void)
                if ((er_flags & QR_PRIVATE) == 0)
                wprintf("CHECKED ");
                wprintf("> ");
-               wprintf(_("Public room"));
+               wprintf(_("Public (automatically appears to everyone)"));
                wprintf("\n");
 
                wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
@@ -1202,14 +1220,14 @@ void display_editroom(void)
                    (er_flags & QR_GUESSNAME))
                        wprintf("CHECKED ");
                wprintf("> ");
-               wprintf(_("Private - guess name"));
+               wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
        
                wprintf("\n<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
                if ((er_flags & QR_PRIVATE) &&
                    (er_flags & QR_PASSWORDED))
                        wprintf("CHECKED ");
                wprintf("> ");
-               wprintf(_("Private - require password:"));
+               wprintf(_("Private - require password: "));
                wprintf("\n<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
                        er_password);
        
@@ -1290,6 +1308,12 @@ void display_editroom(void)
                wprintf("> ");
                wprintf(_("Permanent (does not auto-purge)"));
 
+               wprintf("\n<LI><INPUT TYPE=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
+               if (er_flags2 & QR2_SUBJECTREQ)
+                       wprintf("CHECKED ");
+               wprintf("> ");
+               wprintf(_("Subject Required (Force users to specify a message subject)"));
+
                /** start of anon options */
        
                wprintf("\n<LI>");
@@ -1368,7 +1392,7 @@ void display_editroom(void)
                                shared_with = realloc(shared_with,
                                                strlen(shared_with) + 32);
                                strcat(shared_with, node);
-                               if (strlen(remote_room) > 0) {
+                               if (!IsEmptyStr(remote_room)) {
                                        strcat(shared_with, "|");
                                        strcat(shared_with, remote_room);
                                }
@@ -1410,13 +1434,13 @@ void display_editroom(void)
                        extract_token(buf, shared_with, i, '\n', sizeof buf);
                        extract_token(node, buf, 0, '|', sizeof node);
                        extract_token(remote_room, buf, 1, '|', sizeof remote_room);
-                       if (strlen(node) > 0) {
-                               wprintf("<FORM METHOD=\"POST\" "
-                                       "action=\"netedit\">"
-                                       "<TR><TD>%s</TD>\n", node);
+                       if (!IsEmptyStr(node)) {
+                               wprintf("<FORM METHOD=\"POST\" action=\"netedit\">");
+                               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+                               wprintf("<TR><TD>%s</TD>\n", node);
 
                                wprintf("<TD>");
-                               if (strlen(remote_room) > 0) {
+                               if (!IsEmptyStr(remote_room)) {
                                        escputs(remote_room);
                                }
                                wprintf("</TD>");
@@ -1426,7 +1450,7 @@ void display_editroom(void)
                                wprintf("<INPUT TYPE=\"hidden\" NAME=\"line\" "
                                        "VALUE=\"ignet_push_share|");
                                urlescputs(node);
-                               if (strlen(remote_room) > 0) {
+                               if (!IsEmptyStr(remote_room)) {
                                        wprintf("|");
                                        urlescputs(remote_room);
                                }
@@ -1453,10 +1477,10 @@ void display_editroom(void)
 
                for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
                        extract_token(node, not_shared_with, i, '\n', sizeof node);
-                       if (strlen(node) > 0) {
-                               wprintf("<FORM METHOD=\"POST\" "
-                                       "action=\"netedit\">"
-                                       "<TR><TD>");
+                       if (!IsEmptyStr(node)) {
+                               wprintf("<FORM METHOD=\"POST\" action=\"netedit\">");
+                               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+                               wprintf("<TR><TD>");
                                escputs(node);
                                wprintf("</TD><TD>"
                                        "<INPUT TYPE=\"INPUT\" "
@@ -1516,10 +1540,9 @@ void display_editroom(void)
                                extract_token(recp, buf, 1, '|', sizeof recp);
                        
                                escputs(recp);
-                               wprintf(" <a href=\"netedit&cmd=remove&line="
-                                       "listrecp|");
+                               wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
                                urlescputs(recp);
-                               wprintf("&tab=listserv\">");
+                               wprintf("\">");
                                wprintf(_("(remove)"));
                                wprintf("</A><br />");
                        }
@@ -1527,7 +1550,8 @@ void display_editroom(void)
                wprintf("<br /><FORM METHOD=\"POST\" action=\"netedit\">\n"
                        "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
                        "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
-               wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
+               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+               wprintf("<INPUT TYPE=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
                wprintf("<INPUT TYPE=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
                wprintf("</FORM>\n");
 
@@ -1546,10 +1570,10 @@ void display_editroom(void)
                                extract_token(recp, buf, 1, '|', sizeof recp);
                        
                                escputs(recp);
-                               wprintf(" <a href=\"netedit&cmd=remove&line="
+                               wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
                                        "digestrecp|");
                                urlescputs(recp);
-                               wprintf("&tab=listserv\">");
+                               wprintf("\">");
                                wprintf(_("(remove)"));
                                wprintf("</A><br />");
                        }
@@ -1557,12 +1581,28 @@ void display_editroom(void)
                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=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+               wprintf("<INPUT TYPE=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
                wprintf("<INPUT TYPE=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
                wprintf("</FORM>\n");
                
-               wprintf("</TD></TR></TABLE><hr />\n");
+               wprintf("</TD></TR></TABLE>\n");
 
+               /** Pop open an address book -- begin **/
+               wprintf("<div align=right>"
+                       "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
+                       "title=\"%s\">"
+                       "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
+                       "&nbsp;%s</a>"
+                       "</div>",
+                       _("List"),
+                       _("Digest"),
+                       _("Add recipients from Contacts or other address books"),
+                       _("Add recipients from Contacts or other address books")
+               );
+               /** Pop open an address book -- end **/
+
+               wprintf("<hr />");
                if (self_service(999) == 1) {
                        wprintf(_("This room is configured to allow "
                                "self-service subscribe/unsubscribe requests."));
@@ -1606,6 +1646,7 @@ void display_editroom(void)
                }
                
                wprintf("<br /><FORM METHOD=\"POST\" action=\"set_room_policy\">\n");
+               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
                wprintf("<TABLE border=0 cellspacing=5>\n");
                wprintf("<TR><TD>");
                wprintf(_("Message expire policy for this room"));
@@ -1682,6 +1723,7 @@ void display_editroom(void)
        /** end content of whatever tab is open now */
        wprintf("</TD></TR></TABLE></div>\n");
 
+       address_book_popup();
        wDumpContent(1);
 }
 
@@ -1717,7 +1759,7 @@ void editroom(void)
        int bump;
 
 
-       if (strlen(bstr("ok_button")) == 0) {
+       if (IsEmptyStr(bstr("ok_button"))) {
                strcpy(WC->ImportantMessage,
                        _("Cancelled.  Changes were not saved."));
                display_editroom();
@@ -1740,7 +1782,7 @@ void editroom(void)
        er_flags2 = extract_int(&buf[4], 7);
 
        strcpy(er_roomaide, bstr("er_roomaide"));
-       if (strlen(er_roomaide) == 0) {
+       if (IsEmptyStr(er_roomaide)) {
                serv_puts("GETA");
                serv_getln(buf, sizeof buf);
                if (buf[0] != '2') {
@@ -1751,18 +1793,18 @@ void editroom(void)
        }
        strcpy(buf, bstr("er_name"));
        buf[128] = 0;
-       if (strlen(buf) > 0) {
+       if (!IsEmptyStr(buf)) {
                strcpy(er_name, buf);
        }
 
        strcpy(buf, bstr("er_password"));
        buf[10] = 0;
-       if (strlen(buf) > 0)
+       if (!IsEmptyStr(buf))
                strcpy(er_password, buf);
 
        strcpy(buf, bstr("er_dirname"));
        buf[15] = 0;
-       if (strlen(buf) > 0)
+       if (!IsEmptyStr(buf))
                strcpy(er_dirname, buf);
 
        strcpy(buf, bstr("type"));
@@ -1801,6 +1843,12 @@ void editroom(void)
                er_flags &= ~QR_PERMANENT;
        }
 
+       if (!strcmp(bstr("subjectreq"), "yes")) {
+               er_flags2 |= QR2_SUBJECTREQ;
+       } else {
+               er_flags2 &= ~QR2_SUBJECTREQ;
+       }
+
        if (!strcmp(bstr("network"), "yes")) {
                er_flags |= QR_NETWORK;
        } else {
@@ -1857,7 +1905,7 @@ void editroom(void)
        }
        gotoroom(er_name);
 
-       if (strlen(er_roomaide) > 0) {
+       if (!IsEmptyStr(er_roomaide)) {
                sprintf(buf, "SETA %s", er_roomaide);
                serv_puts(buf);
                serv_getln(buf, sizeof buf);
@@ -1891,7 +1939,7 @@ void do_invt_kick(void) {
 
         strcpy(username, bstr("username"));
 
-        if (strlen(bstr("kick_button")) > 0) {
+        if (!IsEmptyStr(bstr("kick_button"))) {
                 sprintf(buf, "KICK %s", username);
                 serv_puts(buf);
                 serv_getln(buf, sizeof buf);
@@ -1905,7 +1953,7 @@ void do_invt_kick(void) {
                 }
         }
 
-       if (strlen(bstr("invite_button")) > 0) {
+       if (!IsEmptyStr(bstr("invite_button"))) {
                 sprintf(buf, "INVT %s", username);
                 serv_puts(buf);
                 serv_getln(buf, sizeof buf);
@@ -1948,6 +1996,7 @@ void display_whok(void)
        wprintf("<br /><br />");
        
         wprintf("<CENTER><FORM METHOD=\"POST\" action=\"do_invt_kick\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
        wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
         wprintf("<SELECT NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
         serv_puts("WHOK");
@@ -1972,6 +2021,7 @@ void display_whok(void)
 
         wprintf("<CENTER><FORM METHOD=\"POST\" action=\"do_invt_kick\">\n");
        wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
         wprintf(_("Invite:"));
        wprintf(" ");
         wprintf("<input type=\"text\" name=\"username\" style=\"width:100%%\"><br />\n"
@@ -2003,19 +2053,19 @@ void display_entroom(void)
        }
 
        output_headers(1, 1, 2, 0, 0, 0);
-       wprintf("<div id=\"banner\">\n"
-               "<TABLE class=\"roomops_banner\"><TR><TD>"
-               "<SPAN CLASS=\"titlebar\">");
+       wprintf("<div id=\"banner\">\n");
+       wprintf("<h1>");
        wprintf(_("Create a new room"));
-       wprintf("</SPAN>"
-               "</TD></TR></TABLE>\n"
-               "</div>\n<div id=\"content\">\n"
-       );
+       wprintf("</h1>");
+       wprintf("</div>");
+
+       wprintf("<div id=\"content\" class=\"service\">\n");
 
        wprintf("<div class=\"fix_scrollbar_bug\">"
                "<table class=\"roomops_background\"><tr><td>\n");
 
        wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
 
        wprintf("<UL><LI>");
        wprintf(_("Name of room: "));
@@ -2026,7 +2076,7 @@ void display_entroom(void)
         load_floorlist(); 
         wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
         for (i = 0; i < 128; ++i)
-                if (strlen(floorlist[i]) > 0) {
+                if (!IsEmptyStr(floorlist[i])) {
                         wprintf("<OPTION ");
                         wprintf("VALUE=\"%d\">", i);
                         escputs(floorlist[i]);
@@ -2174,7 +2224,7 @@ void entroom(void)
        int er_num_type;
        int er_view;
 
-       if (strlen(bstr("ok_button")) == 0) {
+       if (IsEmptyStr(bstr("ok_button"))) {
                strcpy(WC->ImportantMessage,
                        _("Cancelled.  No new room was created."));
                display_main_menu();
@@ -2216,14 +2266,13 @@ void entroom(void)
 void display_private(char *rname, int req_pass)
 {
        output_headers(1, 1, 2, 0, 0, 0);
-       wprintf("<div id=\"banner\">\n"
-               "<TABLE class=\"roomops_banner\"><TR><TD>"
-               "<SPAN CLASS=\"titlebar\">");
+       wprintf("<div id=\"banner\">\n");
+       wprintf("<h1>");
        wprintf(_("Go to a hidden room"));
-       wprintf("</SPAN>"
-               "</TD></TR></TABLE>\n"
-               "</div>\n<div id=\"content\">\n"
-       );
+       wprintf("</h1>");
+       wprintf("</div>\n");
+
+       wprintf("<div id=\"content\" class=\"service\">\n");
 
        wprintf("<div class=\"fix_scrollbar_bug\">"
                "<table class=\"roomops_background\"><tr><td>\n");
@@ -2238,6 +2287,7 @@ void display_private(char *rname, int req_pass)
        wprintf("\n<br /><br />");
 
        wprintf("<FORM METHOD=\"POST\" action=\"goto_private\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
 
        wprintf("<table border=\"0\" cellspacing=\"5\" "
                "cellpadding=\"5\" class=\"roomops_background_alt\">\n"
@@ -2274,7 +2324,7 @@ void goto_private(void)
        char hold_rm[SIZ];
        char buf[SIZ];
 
-       if (strlen(bstr("ok_button")) == 0) {
+       if (IsEmptyStr(bstr("ok_button"))) {
                display_main_menu();
                return;
        }
@@ -2309,18 +2359,19 @@ void display_zap(void)
        output_headers(1, 1, 2, 0, 0, 0);
 
        wprintf("<div id=\"banner\">\n");
-       wprintf("<TABLE class=\"roomops_zap\"><TR><TD>");
-       wprintf("<SPAN CLASS=\"titlebar\">");
+       wprintf("<h1>");
        wprintf(_("Zap (forget/unsubscribe) the current room"));
-       wprintf("</SPAN>\n");
-       wprintf("</TD></TR></TABLE>\n");
-       wprintf("</div>\n<div id=\"content\">\n");
+       wprintf("</h1>\n");
+       wprintf("</div>\n");
+
+       wprintf("<div id=\"content\" class=\"service\">\n");
 
        wprintf(_("If you select this option, <em>%s</em> will "
                "disappear from your room list.  Is this what you wish "
                "to do?<br />\n"), WC->wc_roomname);
 
        wprintf("<FORM METHOD=\"POST\" action=\"zap\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
        wprintf("<INPUT TYPE=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
        wprintf("&nbsp;");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
@@ -2343,7 +2394,7 @@ void zap(void)
         */
        strcpy(final_destination, WC->wc_roomname);
 
-       if (strlen(bstr("ok_button")) > 0) {
+       if (!IsEmptyStr(bstr("ok_button"))) {
                serv_printf("GOTO %s", WC->wc_roomname);
                serv_getln(buf, sizeof buf);
                if (buf[0] == '2') {
@@ -2390,8 +2441,9 @@ void netedit(void) {
        char cmpa1[SIZ];
        char cmpb0[SIZ];
        char cmpb1[SIZ];
+       int i, num_addrs;
 
-       if (strlen(bstr("line"))==0) {
+       if (IsEmptyStr(bstr("line"))) {
                display_editroom();
                return;
        }
@@ -2440,8 +2492,23 @@ void netedit(void) {
                serv_puts(buf);
        }
 
-       if (strlen(bstr("add_button")) > 0) {
-               serv_puts(line);
+       if (!IsEmptyStr(bstr("add_button"))) {
+               num_addrs = num_tokens(bstr("line"), ',');
+               if (num_addrs < 2) {
+                       /* just adding one node or address */
+                       serv_puts(line);
+               }
+               else {
+                       /* adding multiple addresses separated by commas */
+                       for (i=0; i<num_addrs; ++i) {
+                               strcpy(line, bstr("prefix"));
+                               extract_token(buf, bstr("line"), i, ',', sizeof buf);
+                               striplt(buf);
+                               strcat(line, buf);
+                               strcat(line, bstr("suffix"));
+                               serv_puts(line);
+                       }
+               }
        }
 
        serv_puts("000");
@@ -2460,7 +2527,7 @@ void netedit(void) {
  */
 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
 {
-       int i;
+       int i, len;
 
        /**
         * For mailboxes, just do it straight...
@@ -2479,7 +2546,8 @@ void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
        /**
         * Replace "\" characters with "|" for pseudo-folder-delimiting
         */
-       for (i=0; i<strlen(folder); ++i) {
+       len = strlen (folder);
+       for (i=0; i<len; ++i) {
                if (folder[i] == '\\') folder[i] = '|';
        }
 }
@@ -2554,8 +2622,10 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
 
                has_subfolders = 0;
                if ((i+1) < max_folders) {
-                       if ( (!strncasecmp(fold[i].name, fold[i+1].name, strlen(fold[i].name)))
-                          && (fold[i+1].name[strlen(fold[i].name)] == '|') ) {
+                       int len;
+                       len = strlen(fold[i].name);
+                       if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
+                          && (fold[i+1].name[len] == '|') ) {
                                has_subfolders = 1;
                        }
                }
@@ -2670,7 +2740,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
                        '|', sizeof floor_name);
 
                if ( (strcasecmp(floor_name, old_floor_name))
-                  && (strlen(old_floor_name) > 0) ) {
+                  && (!IsEmptyStr(old_floor_name)) ) {
                        /* End inner box */
                        do_template("endbox");
 
@@ -2770,7 +2840,7 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
                        '|', sizeof floor_name);
 
                if ( (strcasecmp(floor_name, old_floor_name))
-                  && (strlen(old_floor_name) > 0) ) {
+                  && (!IsEmptyStr(old_floor_name)) ) {
                        /** End inner box */
                        wprintf("<br>\n");
                        wprintf("</div>\n");    /** floordiv */
@@ -2871,7 +2941,8 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
        }
 
        wprintf("num_drop_targets = %d;\n", num_drop_targets);
-       if (strlen(WC->floordiv_expanded) > 1) {
+       if ((WC->floordiv_expanded[0] != '\0')&&
+           (WC->floordiv_expanded[1] != '\0')){
                wprintf("which_div_expanded = '%s';\n", WC->floordiv_expanded);
        }
 
@@ -3036,7 +3107,7 @@ void knrooms(void)
 
        /** Determine whether the user is trying to change views */
        if (bstr("view") != NULL) {
-               if (strlen(bstr("view")) > 0) {
+               if (!IsEmptyStr(bstr("view"))) {
                        set_preference("roomlistview", bstr("view"), 1);
                }
        }
@@ -3049,10 +3120,8 @@ void knrooms(void)
        }
 
        /** title bar */
-       wprintf("<div id=\"banner\">\n"
-               "<TABLE class=\"roomops_banner\"><TR><TD>"
-               "<SPAN CLASS=\"titlebar\">"
-       );
+       wprintf("<div id=\"banner\">\n");
+       wprintf("<h1>");
        if (!strcasecmp(listviewpref, "rooms")) {
                wprintf(_("Room list"));
        }
@@ -3062,32 +3131,32 @@ void knrooms(void)
        if (!strcasecmp(listviewpref, "table")) {
                wprintf(_("Room list"));
        }
-       wprintf("</SPAN></TD>\n");
+       wprintf("</h1>\n");
 
        /** offer the ability to switch views */
-       wprintf("<TD ALIGN=RIGHT><FORM NAME=\"roomlistomatic\">\n"
-               "<SELECT NAME=\"newview\" SIZE=\"1\" "
+       wprintf("<form name=\"roomlistomatic\">\n"
+               "<select name=\"newview\" size=\"1\" "
                "OnChange=\"location.href=roomlistomatic.newview.options"
                "[selectedIndex].value\">\n");
 
-       wprintf("<OPTION %s VALUE=\"knrooms&view=rooms\">"
+       wprintf("<option %s value=\"knrooms&view=rooms\">"
                "View as room list"
-               "</OPTION>\n",
+               "</option>\n",
                ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
        );
 
-       wprintf("<OPTION %s VALUE=\"knrooms&view=folders\">"
+       wprintf("<option %s value=\"knrooms&view=folders\">"
                "View as folder list"
-               "</OPTION>\n",
+               "</option>\n",
                ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
        );
 
-       wprintf("</SELECT><br />");
+       wprintf("</select>");
+       wprintf("</form>");
        offer_start_page();
-       wprintf("</FORM></TD></TR></TABLE>\n");
-       wprintf("</div>\n"
-               "</div>\n"
-               "<div id=\"content\">\n");
+       wprintf("</div>\n");
+
+       wprintf("<div id=\"content\" class=\"service\">\n");
 
        /** Display the room list in the user's preferred format */
        list_all_rooms_by_floor(listviewpref);
@@ -3102,7 +3171,7 @@ void knrooms(void)
 void set_room_policy(void) {
        char buf[SIZ];
 
-       if (strlen(bstr("ok_button")) == 0) {
+       if (IsEmptyStr(bstr("ok_button"))) {
                strcpy(WC->ImportantMessage,
                        _("Cancelled.  Changes were not saved."));
                display_editroom();
@@ -3123,5 +3192,4 @@ void set_room_policy(void) {
        display_editroom();
 }
 
-
 /*@}*/