X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Froomops.c;h=a128ba8bf4311ecf2ad7f4ae9d464b46f5be871c;hb=4ece18dbfa7b31a9dc319ec0480ed651a30b3213;hp=2a2017f1bd2aef6b83cb1868a50d67006bb833af;hpb=1e32899153e9e52aaec1e651e0c33a563b8aaed8;p=citadel.git diff --git a/webcit/roomops.c b/webcit/roomops.c index 2a2017f1b..a128ba8bf 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -1,19 +1,17 @@ /* * $Id$ + * Lots of different room-related operations. */ -/** - * \defgroup RoomOps Lots of different room-related operations. - * \ingroup CitadelCommunitacion - */ -/*@{*/ -#include "webcit.h" -char floorlist[128][SIZ]; /**< list of our floor names */ +#include "webcit.h" +#include "webserver.h" +#define MAX_FLOORS 128 +char floorlist[MAX_FLOORS][SIZ]; /**< list of our floor names */ -char *viewdefs[7]; /**< the different kinds of available views */ +char *viewdefs[9]; /**< the different kinds of available views */ -/** - * \brief initialize the viewdefs with localized strings +/* + * Initialize the viewdefs with localized strings */ void initialize_viewdefs(void) { viewdefs[0] = _("Bulletin Board"); @@ -23,18 +21,45 @@ void initialize_viewdefs(void) { viewdefs[4] = _("Task List"); viewdefs[5] = _("Notes List"); viewdefs[6] = _("Wiki"); + viewdefs[7] = _("Calendar List"); + viewdefs[8] = _("Journal"); } +/* + * Determine which views are allowed as the default for creating a new room. + */ +int is_view_allowed_as_default(int which_view) +{ + switch(which_view) { + case VIEW_BBS: return(1); + case VIEW_MAILBOX: return(1); + case VIEW_ADDRESSBOOK: return(1); + case VIEW_CALENDAR: return(1); + case VIEW_TASKS: return(1); + case VIEW_NOTES: return(1); + +#ifdef TECH_PREVIEW + case VIEW_WIKI: return(1); +#else /* TECH_PREVIEW */ + case VIEW_WIKI: return(0); /* because it isn't finished yet */ +#endif /* TECH_PREVIEW */ + + case VIEW_CALBRIEF: return(0); + case VIEW_JOURNAL: return(0); + default: return(0); /* should never get here */ + } +} -/** - * \brief load the list of floors + +/* + * load the list of floors */ void load_floorlist(void) { int a; char buf[SIZ]; - for (a = 0; a < 128; ++a) + for (a = 0; a < MAX_FLOORS; ++a) floorlist[a][0] = 0; serv_puts("LFLR"); @@ -49,8 +74,25 @@ void load_floorlist(void) } -/** - * \brief remove a room from the march list +/* + * Free a session's march list + */ +void free_march_list(struct wcsession *wcf) +{ + struct march *mptr; + + while (wcf->march != NULL) { + mptr = wcf->march->next; + free(wcf->march); + wcf->march = mptr; + } + +} + + + +/* + * remove a room from the march list */ void remove_march(char *aaa) { @@ -80,9 +122,8 @@ void remove_march(char *aaa) -/** - * \brief display rooms in tree structure??? - * \param rp the roomlist to build a tree from +/* + * display rooms in tree structure */ void room_tree_list(struct roomlisting *rp) { @@ -111,7 +152,7 @@ void room_tree_list(struct roomlisting *rp) wprintf(")"); else wprintf(">"); - wprintf(" \n"); + wprintf(" \n"); room_tree_list(rp->rnext); free(rp); @@ -157,7 +198,6 @@ void listrms(char *variety) struct roomlisting *rp; struct roomlisting *rs; - /** Ask the server for a room list */ serv_puts(variety); serv_getln(buf, sizeof buf); @@ -165,6 +205,7 @@ void listrms(char *variety) wprintf(" "); return; } + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { ++num_rooms; rp = malloc(sizeof(struct roomlisting)); @@ -213,7 +254,7 @@ void listrms(char *variety) */ void zapped_list(void) { - output_headers(1, 1, 0, 0, 0, 0); + output_headers(1, 1, 1, 0, 0, 0); svprintf("BOXTITLE", WCS_STRING, _("Zapped (forgotten) rooms")); do_template("beginbox"); @@ -232,12 +273,37 @@ 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') { - fmout("CENTER"); + + 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("
");
+ wprintf("
|
");
levels = 0;
@@ -2546,9 +3087,10 @@ 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");
+ wprintf(" "); ++num_boxes; if ((num_boxes % boxes_per_column) == 0) { @@ -2562,7 +3104,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { if (levels == 1) { /** Begin inner box */ - stresc(boxtitle, floor_name, 1, 0); + stresc(boxtitle, 256, floor_name, 1, 0); svprintf("BOXTITLE", WCS_STRING, boxtitle); do_template("beginbox"); } @@ -2581,14 +3123,14 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { wprintf(""); } if (fold[i].hasnewmsgs) { - wprintf(""); + wprintf(""); } else { - wprintf(""); + wprintf(""); } extract_token(buf, fold[i].name, levels-1, '|', sizeof buf); escputs(buf); - wprintf(""); + wprintf(""); if (fold[i].selectable) { wprintf(""); } @@ -2604,7 +3146,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { /** End the final inner box */ do_template("endbox"); - wprintf(" |