From a867ad60cacf83b0c073e54f34dd6d1713fa0208 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 25 Aug 1998 03:51:09 +0000 Subject: [PATCH] * setup.c: Removed yesno_s() * citadel.h, room_ops.c: added QRmtime field to struct quickroom, modified whenever a room is modified or posted in. * citadelapi.c: Added CtdlForEachRoom() function --- citadel/ChangeLog | 6 +++++ citadel/citadel.h | 1 + citadel/citadelapi.c | 33 +++++++++++++++++++++++++++ citadel/ipcdef.h | 1 + citadel/room_ops.c | 4 ++-- citadel/setup.c | 49 +---------------------------------------- citadel/techdoc/api.txt | 7 ++++++ 7 files changed, 51 insertions(+), 50 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 9b4243fd9..5a5b50542 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,3 +1,9 @@ +Mon Aug 24 23:45:01 EDT 1998 Art Cancro + * setup.c: Removed yesno_s() + * citadel.h, room_ops.c: added QRmtime field to struct quickroom, + modified whenever a room is modified or posted in. + * citadelapi.c: Added CtdlForEachRoom() function + Mon Aug 24 20:04:04 EDT 1998 Nathan Bryant * Makefile.in: new target `cleaner' does the same as `realclean' without removing sysdep.h diff --git a/citadel/citadel.h b/citadel/citadel.h index 1d1fd688a..b1913411a 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -124,6 +124,7 @@ struct quickroom { char QRdirname[15]; /* Directory name, if applicable */ long QRinfo; /* Info file update relative to msgs*/ char QRfloor; /* Which floor this room is on */ + time_t QRmtime; /* Date/time of last post */ }; diff --git a/citadel/citadelapi.c b/citadel/citadelapi.c index 9e68e8733..a43306a52 100644 --- a/citadel/citadelapi.c +++ b/citadel/citadelapi.c @@ -402,6 +402,39 @@ int CtdlForEachUser(int (*CallBack)(char *EachUser)) { + + +int CtdlForEachRoom(int (*CallBack)(char *EachRoom)) { + struct CtdlInternalList *TheList = NULL; + struct CtdlInternalList *ptr; + char buf[256]; + + serv_puts("LKRA"); + serv_gets(buf); + if (buf[0] != '1') return(-1); + + while (serv_gets(buf), strcmp(buf, "000")) { + ptr = (struct CtdlInternalList *) + malloc(sizeof (struct CtdlInternalList)); + if (ptr != NULL) { + CtdlInternalExtract(ptr->data, buf, 0); + ptr->next = TheList; + TheList = ptr; + } + } + + while (TheList != NULL) { + (*CallBack)(TheList->data); + ptr = TheList->next; + free(TheList); + TheList = ptr; + } + + return(0); + } + + + /* * Goto a different room */ diff --git a/citadel/ipcdef.h b/citadel/ipcdef.h index 5d8069f89..f21408a28 100644 --- a/citadel/ipcdef.h +++ b/citadel/ipcdef.h @@ -85,4 +85,5 @@ struct CtdlServerHandle { struct CtdlRoomInfo { char RoomName[32]; + time_t mtime; }; diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 8af8feac5..a2ba42af8 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -103,7 +103,7 @@ void getroom(struct quickroom *qrbuf, int room_num) /** FIX ** VILE SLEAZY HACK ALERT!! - * This is a temporary fix until I can track down where room names + * This is a temporary fix until we can track down where room names * are getting corrupted on some systems. */ for (a=0; a<20; ++a) if (qrbuf->QRname[a] < 32) qrbuf->QRname[a] = 0; @@ -125,7 +125,7 @@ void lgetroom(struct quickroom *qrbuf, int room_num) */ void putroom(struct quickroom *qrbuf, int room_num) { - + time(&qrbuf->QRmtime); cdb_store(CDB_QUICKROOM, &room_num, sizeof(int), qrbuf, sizeof(struct quickroom)); } diff --git a/citadel/setup.c b/citadel/setup.c index bf05610ea..66cb93227 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -1,7 +1,5 @@ /* * Citadel/UX setup program - * v4.1 / by Art Cancro - * see copyright.txt for copyright information * * *** YOU MUST EDIT sysconfig.h >BEFORE< COMPILING SETUP *** */ @@ -139,8 +137,7 @@ char *setup_text[] = { "", "The most common settings for this will be either 1, for", "systems which require new user validation by the system", -"administrator ('sysop' is a word for people who run DOS", -"boards!), or 4, for systems which give instant access.", +"administrator, or 4, for systems which give instant access.", "The current access levels available are:", "11", @@ -726,50 +723,6 @@ void set_long_val(int msgpos, long int *ip) } -#if 0 /* FIXME: this isn't used, can we remove it? */ -int yesno_s(char *question) { - int a; - char buf[4096]; - char tempfile[64]; - FILE *fp; - - sprintf(tempfile, "/tmp/setup.%d", getpid()); - switch (setup_type) { - - case UI_TEXT: - a=yesno(question); - if (a==1) a=yesno("Are you SURE you want to reinitialize this file? "); - return(a); - break; - - case UI_CURSES: - a=yesno(question); - if (a==1) a=yesno("Are you SURE you want to reinitialize this file? "); - return(a); - break; - - case UI_DIALOG: - a = yesno(question); - if (a==0) return(a); - sprintf(buf, "dialog --title \"Confirm file overwrite\" --menu \"\nAre you SURE you want to reinitialize this file?\n\" 13 80 2 NO \"No, don't overwrite\" YES \"Yes, overwrite the existing file\" 2>%s", tempfile); - a = system(buf); - if (a != 0) return(0); - fp = fopen(tempfile, "rb"); - fgets(buf, 4095, fp); - fclose(fp); - if (strlen(buf)>0) - if (buf[strlen(buf)-1]==10) - buf[strlen(buf)-1]=0; - return( (!strcmp(buf, "YES")) ? 1 : 0 ); - break; - - } - - return(0); /* just in case */ - } -#endif - - void edit_value(int curr) { int a; diff --git a/citadel/techdoc/api.txt b/citadel/techdoc/api.txt index bfe9e5017..f6880c0a0 100644 --- a/citadel/techdoc/api.txt +++ b/citadel/techdoc/api.txt @@ -150,3 +150,10 @@ the user being processed. administrative or privileged access may enter any room on the system. An extension running in the context of an ordinary user may enter any room to which the user has access. + + + int CtdlForEachRoom(int (*CallBack)(char *EachRoom)) + + This allows a user-supplied function to be called once for each active room +on the system; the single argument passed to the function will be the name of +the room being processed. -- 2.39.2