\n", _("Add new contact")
);
@@ -625,12 +644,12 @@ void embed_room_banner(char *got, int navbar_style) {
case VIEW_CALENDAR:
case VIEW_CALBRIEF:
wprintf("
\n",
_("Leave all messages marked as unread, go to next room with unread messages"),
@@ -705,7 +724,7 @@ void embed_room_banner(char *got, int navbar_style) {
"
\n",
_("Mark all messages as read, go to next room with unread messages"),
@@ -718,10 +737,8 @@ void embed_room_banner(char *got, int navbar_style) {
}
-/**
- * \brief back end routine to take the session to a new room
- * \param gname room to go to
- *
+/*
+ * back end routine to take the session to a new room
*/
int gotoroom(char *gname)
{
@@ -729,7 +746,7 @@ int gotoroom(char *gname)
static long ls = (-1L);
int err = 0;
- /** store ungoto information */
+ /* store ungoto information */
strcpy(WC->ugname, WC->wc_roomname);
WC->uglsn = ls;
@@ -815,8 +832,9 @@ char *pop_march(int desired_floor)
-/**
- *\brief Goto next room having unread messages.
+/*
+ * Goto next room having unread messages.
+ *
* We want to skip over rooms that the user has already been to, and take the
* user back to the lobby when done. The room we end up in is placed in
* newroom - which is set to 0 (the lobby) initially.
@@ -826,11 +844,13 @@ char *pop_march(int desired_floor)
void gotonext(void)
{
char buf[256];
- struct march *mptr, *mptr2;
+ struct march *mptr = NULL;
+ struct march *mptr2 = NULL;
char room_name[128];
char next_room[128];
+ int ELoop = 0;
- /**
+ /*
* 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.
*/
@@ -840,6 +860,14 @@ void gotonext(void)
serv_getln(buf, sizeof buf);
if (buf[0] == '1')
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+ if (IsEmptyStr(buf)) {
+ if (ELoop > 10000)
+ return;
+ if (ELoop % 100 == 0)
+ sleeeeeeeeeep(1);
+ ELoop ++;
+ continue;
+ }
extract_token(room_name, buf, 0, '|', sizeof room_name);
if (strcasecmp(room_name, WC->wc_roomname)) {
mptr = (struct march *) malloc(sizeof(struct march));
@@ -847,17 +875,15 @@ void gotonext(void)
safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
mptr->march_floor = extract_int(buf, 2);
mptr->march_order = extract_int(buf, 3);
- if (WC->march == NULL) {
+ if (WC->march == NULL)
WC->march = mptr;
- } else {
- mptr2 = WC->march;
- while (mptr2->next != NULL)
- mptr2 = mptr2->next;
+ else
mptr2->next = mptr;
- }
+ mptr2 = mptr;
}
+ buf[0] = '\0';
}
- /**
+ /*
* add _BASEROOM_ to the end of the march list, so the user will end up
* in the system base room (usually the Lobby>) at the end of the loop
*/
@@ -874,7 +900,7 @@ void gotonext(void)
mptr2 = mptr2->next;
mptr2->next = mptr;
}
- /**
+ /*
* ...and remove the room we're currently in, so a oto doesn't make us
* walk around in circles
*/
@@ -891,9 +917,8 @@ void gotonext(void)
}
-/**
- * \brief goto next room
- * \param next_room next room to go to
+/*
+ * goto next room
*/
void smart_goto(char *next_room) {
gotoroom(next_room);
@@ -902,8 +927,8 @@ void smart_goto(char *next_room) {
-/**
- * \brief mark all messages in current room as having been read
+/*
+ * mark all messages in current room as having been read
*/
void slrp_highest(void)
{
@@ -914,8 +939,8 @@ void slrp_highest(void)
}
-/**
- * \brief un-goto the previous room
+/*
+ * un-goto the previous room
*/
void ungoto(void)
{
@@ -940,15 +965,25 @@ void ungoto(void)
smart_goto(buf);
}
+typedef struct __room_states {
+ char password[SIZ];
+ char dirname[SIZ];
+ char name[SIZ];
+ int flags;
+ int floor;
+ int order;
+ int view;
+ int flags2;
+} room_states;
-/**
- * \brief Set/clear/read the "self-service list subscribe" flag for a room
+/*
+ * Set/clear/read the "self-service list subscribe" flag for a room
*
- * \param newval set to 0 to clear, 1 to set, any other value to leave unchanged.
- * \return return the new value.
+ * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
+ * returns the new value.
*/
int self_service(int newval) {
@@ -958,7 +993,7 @@ int self_service(int newval) {
char name[SIZ];
char password[SIZ];
char dirname[SIZ];
- int flags, floor, order, view, flags2;
+ int flags, floor, order, view, flags2;
serv_puts("GETR");
serv_getln(buf, sizeof buf);
@@ -1001,13 +1036,71 @@ int self_service(int newval) {
}
+int is_selflist(room_states *RoomFlags)
+{
+ return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
+}
+
+int is_publiclist(room_states *RoomFlags)
+{
+ return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
+}
+
+int is_moderatedlist(room_states *RoomFlags)
+{
+ return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
+}
+
+/*
+ * 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.
+ * returns the new value.
+ */
+int get_roomflags(room_states *RoomOps)
+{
+ char buf[SIZ];
+
+ serv_puts("GETR");
+ serv_getln(buf, sizeof buf);
+ if (buf[0] != '2') return(0);
+ extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
+ extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
+ extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
+ RoomOps->flags = extract_int(&buf[4], 3);
+ RoomOps->floor = extract_int(&buf[4], 4);
+ RoomOps->order = extract_int(&buf[4], 5);
+ RoomOps->view = extract_int(&buf[4], 6);
+ RoomOps->flags2 = extract_int(&buf[4], 7);
+ return (1);
+}
+int set_roomflags(room_states *RoomOps)
+{
+ char buf[SIZ];
+
+ serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
+ RoomOps->name,
+ RoomOps->password,
+ RoomOps->dirname,
+ RoomOps->flags,
+ RoomOps->floor,
+ RoomOps->order,
+ RoomOps->view,
+ RoomOps->flags2);
+ serv_getln(buf, sizeof buf);
+ return (1);
+}
-/**
- * \brief display the form for editing a room
+
+
+
+
+/*
+ * display the form for editing a room
*/
void display_editroom(void)
{
@@ -1033,6 +1126,7 @@ void display_editroom(void)
int floorvalue = 0;
char pop3_host[128];
char pop3_user[32];
+ int bg = 0;
tab = bstr("tab");
if (IsEmptyStr(tab)) tab = "admin";
@@ -1042,10 +1136,15 @@ void display_editroom(void)
wprintf("
\n");
+ /* end tabbed dialog */
- /** begin content of whatever tab is open now */
+ wprintf(""
+ );
+
+ /* begin content of whatever tab is open now */
if (!strcmp(tab, "admin")) {
wprintf("
");
@@ -1393,7 +1505,7 @@ void display_editroom(void)
}
- /** Sharing the room with other Citadel nodes... */
+ /* Sharing the room with other Citadel nodes... */
if (!strcmp(tab, "sharing")) {
wprintf("
");
@@ -1548,8 +1660,9 @@ void display_editroom(void)
wprintf("");
}
- /** Mailing list management */
+ /* Mailing list management */
if (!strcmp(tab, "listserv")) {
+ room_states RoomFlags;
wprintf("
");
wprintf("
"
@@ -1629,36 +1742,46 @@ void display_editroom(void)
_("Add recipients from Contacts or other address books"),
_("Add recipients from Contacts or other address books")
);
- /** Pop open an address book -- end **/
-
- wprintf("");
- if (self_service(999) == 1) {
- wprintf(_("This room is configured to allow "
- "self-service subscribe/unsubscribe requests."));
- wprintf("");
- wprintf(_("Click to disable."));
- wprintf(" \n");
- wprintf(_("The URL for subscribe/unsubscribe is: "));
- wprintf("%s://%s/listsub \n",
- (is_https ? "https" : "http"),
- WC->http_host);
- }
- else {
- wprintf(_("This room is not configured to allow "
- "self-service subscribe/unsubscribe requests."));
- wprintf(" ");
- wprintf(_("Click to enable."));
- wprintf(" \n");
- }
+ /* Pop open an address book -- end **/
+ wprintf(" \n");
+
wprintf("
\n");
wprintf("
");
}
- /** Configuration of The Dreaded Auto-Purger */
+ /* Configuration of The Dreaded Auto-Purger */
if (!strcmp(tab, "expire")) {
wprintf("
");
}
- /** Fetch messages from remote locations */
+ /* Fetch messages from remote locations */
if (!strcmp(tab, "feeds")) {
wprintf("
");
@@ -1770,23 +1893,31 @@ void display_editroom(void)
wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
wprintf(" \n");
- wprintf("
");
+ wprintf("
"
+ "
");
wprintf(_("Remote host"));
- wprintf("
");
+ wprintf("
");
wprintf(_("User name"));
- wprintf("
");
+ wprintf("
");
wprintf(_("Password"));
- wprintf("
");
+ wprintf("
");
wprintf(_("Keep messages on server?"));
- wprintf("
\n");
@@ -1841,31 +1977,37 @@ void display_editroom(void)
wprintf(_("Fetch the following RSS feeds and store them in this room:"));
wprintf(" \n");
- wprintf("
\n");
@@ -1889,7 +2031,7 @@ void display_editroom(void)
}
- /** end content of whatever tab is open now */
+ /* end content of whatever tab is open now */
wprintf("\n");
address_book_popup();
@@ -1897,21 +2039,42 @@ void display_editroom(void)
}
-/**
- * \brief Toggle self-service list subscription
+/*
+ * Toggle self-service list subscription
*/
void toggle_self_service(void) {
- int newval = 0;
+ room_states RoomFlags;
- newval = atoi(bstr("newval"));
- self_service(newval);
+ get_roomflags (&RoomFlags);
+
+ if (yesbstr("QR2_SelfList"))
+ RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
+ else
+ RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
+
+ if (yesbstr("QR2_SMTP_PUBLIC"))
+ RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
+ else
+ RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
+
+ if (yesbstr("QR2_Moderated"))
+ RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
+ else
+ RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
+ if (yesbstr("QR2_SubsOnly"))
+ RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
+ else
+ RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
+
+ set_roomflags (&RoomFlags);
+
display_editroom();
}
-/**
- * \brief save new parameters for a room
+/*
+ * save new parameters for a room
*/
void editroom(void)
{
@@ -1928,7 +2091,7 @@ void editroom(void)
int bump;
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
strcpy(WC->ImportantMessage,
_("Cancelled. Changes were not saved."));
display_editroom();
@@ -1994,62 +2157,62 @@ void editroom(void)
er_flags &= ~QR_MAILBOX;
}
- if (!strcmp(bstr("prefonly"), "yes")) {
+ if (yesbstr("prefonly")) {
er_flags |= QR_PREFONLY;
} else {
er_flags &= ~QR_PREFONLY;
}
- if (!strcmp(bstr("readonly"), "yes")) {
+ if (yesbstr("readonly")) {
er_flags |= QR_READONLY;
} else {
er_flags &= ~QR_READONLY;
}
- if (!strcmp(bstr("collabdel"), "yes")) {
+ if (yesbstr("collabdel")) {
er_flags2 |= QR2_COLLABDEL;
} else {
er_flags2 &= ~QR2_COLLABDEL;
}
- if (!strcmp(bstr("permanent"), "yes")) {
+ if (yesbstr("permanent")) {
er_flags |= QR_PERMANENT;
} else {
er_flags &= ~QR_PERMANENT;
}
- if (!strcmp(bstr("subjectreq"), "yes")) {
+ if (yesbstr("subjectreq")) {
er_flags2 |= QR2_SUBJECTREQ;
} else {
er_flags2 &= ~QR2_SUBJECTREQ;
}
- if (!strcmp(bstr("network"), "yes")) {
+ if (yesbstr("network")) {
er_flags |= QR_NETWORK;
} else {
er_flags &= ~QR_NETWORK;
}
- if (!strcmp(bstr("directory"), "yes")) {
+ if (yesbstr("directory")) {
er_flags |= QR_DIRECTORY;
} else {
er_flags &= ~QR_DIRECTORY;
}
- if (!strcmp(bstr("ulallowed"), "yes")) {
+ if (yesbstr("ulallowed")) {
er_flags |= QR_UPLOAD;
} else {
er_flags &= ~QR_UPLOAD;
}
- if (!strcmp(bstr("dlallowed"), "yes")) {
+ if (yesbstr("dlallowed")) {
er_flags |= QR_DOWNLOAD;
} else {
er_flags &= ~QR_DOWNLOAD;
}
- if (!strcmp(bstr("visdir"), "yes")) {
+ if (yesbstr("visdir")) {
er_flags |= QR_VISDIR;
} else {
er_flags &= ~QR_VISDIR;
@@ -2067,7 +2230,7 @@ void editroom(void)
if (!strcmp(bstr("bump"), "yes"))
bump = 1;
- er_floor = atoi(bstr("er_floor"));
+ er_floor = ibstr("er_floor");
sprintf(buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
er_name, er_password, er_dirname, er_flags, bump, er_floor,
@@ -2098,8 +2261,8 @@ void editroom(void)
}
-/**
- * \brief Display form for Invite, Kick, and show Who Knows a room
+/*
+ * Display form for Invite, Kick, and show Who Knows a room
*/
void do_invt_kick(void) {
char buf[SIZ], room[SIZ], username[SIZ];
@@ -2115,7 +2278,7 @@ void do_invt_kick(void) {
strcpy(username, bstr("username"));
- if (!IsEmptyStr(bstr("kick_button"))) {
+ if (havebstr("kick_button")) {
sprintf(buf, "KICK %s", username);
serv_puts(buf);
serv_getln(buf, sizeof buf);
@@ -2129,7 +2292,7 @@ void do_invt_kick(void) {
}
}
- if (!IsEmptyStr(bstr("invite_button"))) {
+ if (havebstr("invite_button")) {
sprintf(buf, "INVT %s", username);
serv_puts(buf);
serv_getln(buf, sizeof buf);
@@ -2148,8 +2311,8 @@ void do_invt_kick(void) {
-/**
- * \brief Display form for Invite, Kick, and show Who Knows a room
+/*
+ * Display form for Invite, Kick, and show Who Knows a room
*/
void display_whok(void)
{
@@ -2204,7 +2367,7 @@ void display_whok(void)
""
""
"\n", _("Invite"));
- /** Pop open an address book -- begin **/
+ /* Pop open an address book -- begin **/
wprintf(
""
@@ -2213,7 +2376,7 @@ void display_whok(void)
_("User"),
_("Users"), _("Users")
);
- /** Pop open an address book -- end **/
+ /* Pop open an address book -- end **/
wprintf("
\n");
address_book_popup();
@@ -2222,8 +2385,8 @@ void display_whok(void)
-/**
- * \brief display the form for entering a new room
+/*
+ * display the form for entering a new room
*/
void display_entroom(void)
{
@@ -2241,7 +2404,7 @@ void display_entroom(void)
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Create a new room"));
+ svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
do_template("beginbox");
wprintf("
");
- /**
+ /*
* Our clever little snippet of JavaScript automatically selects
* a public room if the view is set to Bulletin Board or wiki, and
* it selects a mailbox room otherwise. The user can override this,
@@ -2372,8 +2535,8 @@ void display_entroom(void)
-/**
- * \brief support function for entroom() -- sets the default view
+/*
+ * support function for entroom() -- sets the default view
*/
void er_set_default_view(int newview) {
@@ -2408,8 +2571,8 @@ void er_set_default_view(int newview) {
-/**
- * \brief enter a new room
+/*
+ * Create a new room
*/
void entroom(void)
{
@@ -2421,7 +2584,7 @@ void entroom(void)
int er_num_type;
int er_view;
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
strcpy(WC->ImportantMessage,
_("Cancelled. No new room was created."));
display_main_menu();
@@ -2430,8 +2593,8 @@ void entroom(void)
strcpy(er_name, bstr("er_name"));
strcpy(er_type, bstr("type"));
strcpy(er_password, bstr("er_password"));
- er_floor = atoi(bstr("er_floor"));
- er_view = atoi(bstr("er_view"));
+ er_floor = ibstr("er_floor");
+ er_view = ibstr("er_view");
er_num_type = 0;
if (!strcmp(er_type, "hidden"))
@@ -2452,6 +2615,10 @@ void entroom(void)
display_main_menu();
return;
}
+ /** TODO: Room created, now udate the left hand icon bar for this user */
+ burn_folder_cache(0); /* burn the old folder cache */
+
+
gotoroom(er_name);
do_change_view(er_view); /* Now go there */
}
@@ -2464,7 +2631,7 @@ void display_private(char *rname, int req_pass)
{
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Go to a hidden room"));
+ svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Go to a hidden room"));
do_template("beginbox");
wprintf("