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
viewdefs[5] = _("Notes List");
viewdefs[6] = _("Wiki");
viewdefs[7] = _("Calendar List");
+ viewdefs[8] = _("Journal");
}
/**
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 */
}
}
*/
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 {
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\" "
* \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\" "
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.
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),
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\">"
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\">"
int floorvalue = 0;
tab = bstr("tab");
- if (strlen(tab) == 0) tab = "admin";
+ if (IsEmptyStr(tab)) tab = "admin";
load_floorlist();
serv_puts("GETR");
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: "));
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 ");
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>");
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);
}
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>");
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);
}
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\" "
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=\"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");
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=\"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("<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"));
int bump;
- if (strlen(bstr("ok_button")) == 0) {
+ if (IsEmptyStr(bstr("ok_button"))) {
strcpy(WC->ImportantMessage,
_("Cancelled. Changes were not saved."));
display_editroom();
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') {
}
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"));
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 {
}
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);
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);
}
}
- if (strlen(bstr("invite_button")) > 0) {
+ if (!IsEmptyStr(bstr("invite_button"))) {
sprintf(buf, "INVT %s", username);
serv_puts(buf);
serv_getln(buf, sizeof buf);
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");
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"
}
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: "));
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]);
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();
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");
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"
char hold_rm[SIZ];
char buf[SIZ];
- if (strlen(bstr("ok_button")) == 0) {
+ if (IsEmptyStr(bstr("ok_button"))) {
display_main_menu();
return;
}
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(" ");
wprintf("<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
*/
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') {
char cmpb1[SIZ];
int i, num_addrs;
- if (strlen(bstr("line"))==0) {
+ if (IsEmptyStr(bstr("line"))) {
display_editroom();
return;
}
serv_puts(buf);
}
- if (strlen(bstr("add_button")) > 0) {
+ if (!IsEmptyStr(bstr("add_button"))) {
num_addrs = num_tokens(bstr("line"), ',');
if (num_addrs < 2) {
/* just adding one node or address */
*/
void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
{
- int i;
+ int i, len;
/**
* For mailboxes, just do it straight...
/**
* 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] = '|';
}
}
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;
}
}
'|', 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");
'|', 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 */
}
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);
}
/** 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);
}
}
}
/** 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"));
}
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);
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();