* citadel.rc: changed the default for local_screen_dimensions to 1, since
authorArt Cancro <ajc@citadel.org>
Tue, 6 Feb 2001 02:09:41 +0000 (02:09 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 6 Feb 2001 02:09:41 +0000 (02:09 +0000)
  Internet users now outnumber dialup users 100 to 0.
* room_ops.c: added a really_create option to create_room().  Also moved the
  generation of personal namespace into that function.  MODULE OWNERS PLEASE
  CHECK YOUR CALLS TO AVOID MULTIPLE NAMESPACING!!
* room_ops.c: fixed a bug in cgetfloor() that left bad pointers around
* serv_imap.c: finished the CREATE command (finally)

16 files changed:
citadel/ChangeLog
citadel/citadel.rc
citadel/citserver.c
citadel/control.c
citadel/imap_tools.c
citadel/msgbase.c
citadel/room_ops.c
citadel/room_ops.h
citadel/serv_chat.c
citadel/serv_expire.c
citadel/serv_ical.c
citadel/serv_imap.c
citadel/serv_smtp.c
citadel/serv_vcard.c
citadel/techdoc/citadelapi.txt
citadel/user_ops.c

index 5c3d526cd07bcc8c6f6580b443ad5281b904368d..1469ac3523bd7bb98fafa10d2648bcc91e63f677 100644 (file)
@@ -1,4 +1,13 @@
  $Log$
+ Revision 573.84  2001/02/06 02:09:38  ajc
+ * citadel.rc: changed the default for local_screen_dimensions to 1, since
+   Internet users now outnumber dialup users 100 to 0.
+ * room_ops.c: added a really_create option to create_room().  Also moved the
+   generation of personal namespace into that function.  MODULE OWNERS PLEASE
+   CHECK YOUR CALLS TO AVOID MULTIPLE NAMESPACING!!
+ * room_ops.c: fixed a bug in cgetfloor() that left bad pointers around
+ * serv_imap.c: finished the CREATE command (finally)
+
  Revision 573.83  2001/02/05 05:20:22  ajc
  * Made some changes to functions which translate between Citadel room names
    and IMAP folder names.  They're still buggy.
@@ -2375,3 +2384,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 786a2a36c096c05127b3e964697ac1716cd85482..f982a180ead04fafd7ced4b772ada8f4306243d5 100644 (file)
@@ -13,7 +13,7 @@
 # messages.  If you want the external editor to be used by default, be sure
 # to reflect this in the command set below.
 #
-editor=vi
+editor=pico
 
 # If you define PRINTCMD, it will be a pipe through which messages are
 # printed when the user hits the <P>rint key after a message.
@@ -31,7 +31,7 @@ editor=vi
 # work for dialup connections.  Generally you should set this to 1 for a
 # private copy of the client or 0 for a shared copy of the client.
 #
-local_screen_dimensions=0
+local_screen_dimensions=1
 
 # ANSI_COLOR should be set to on/off/auto/user to control the use of
 # color on the screen.  If it is set to "auto" then an autodetect will be
index 08f4c4f8c4a998fc1373a722890db2972c83116d..d63c092cf93be00bc0ebd262d8ccd79cc3fa7c3e 100644 (file)
@@ -65,10 +65,10 @@ void master_startup(void) {
        check_ref_counts();
 
        lprintf(7, "Creating base rooms (if necessary)\n");
-       create_room(BASEROOM,           0, "", 0);
-       create_room(AIDEROOM,           3, "", 0);
-       create_room(SYSCONFIGROOM,      3, "", 0);
-       create_room(config.c_twitroom,  0, "", 0);
+       create_room(BASEROOM,           0, "", 0, 1);
+       create_room(AIDEROOM,           3, "", 0, 1);
+       create_room(SYSCONFIGROOM,      3, "", 0, 1);
+       create_room(config.c_twitroom,  0, "", 0, 1);
 
        lprintf(7, "Seeding the pseudo-random number generator...\n");
        gettimeofday(&tv, NULL);
index 7666c53ab38c3762418498be4b491c757b866d8d..dd056611ba1c24064a0c991a4156db6cb6c26375 100644 (file)
@@ -275,7 +275,7 @@ void cmd_conf(char *argbuf) {
                aide_message(buf);
 
                if (strlen(config.c_logpages) > 0)
-                       create_room(config.c_logpages, 3, "", 0);
+                       create_room(config.c_logpages, 3, "", 0, 1);
                }
 
        else if (!strcasecmp(cmd, "GETSYS")) {
index 043f676480a90eb2db3be0c3f3fb349b1a71df06..8d887b685d335107697b7d6d604474e77ae23180 100644 (file)
@@ -109,7 +109,8 @@ void imap_mailboxname(char *buf, int bufsize, struct quickroom *qrbuf) {
         */
        else {
                fl = cgetfloor(qrbuf->QRfloor);
-               lprintf(9, "floor %d: %s\n", qrbuf->QRfloor, fl->f_name); /* FIXME take out */
+               lprintf(9, "Floor %d: \n", qrbuf->QRfloor);
+               lprintf(9, "          %s\n", fl->f_name); /* FIXME take out */
                snprintf(buf, bufsize, "%s|%s",
                        fl->f_name,
                        qrbuf->QRname);
@@ -161,8 +162,11 @@ int imap_roomname(char *rbuf, int bufsize, char *foldername) {
                        }
                }
 
+               /* since we don't allow multi-level yet, fail.
                extract(rbuf, buf, 1);
                return(0);
+               */
+               return(-1);
        }
 
        safestrncpy(rbuf, foldername, bufsize);
index 4de51bae3114b31ac0ecbb16568d860923bbb409..5addba6406e7255a222fae9a4ab4170455f367dc 100644 (file)
@@ -2562,7 +2562,7 @@ void CtdlWriteObject(char *req_room,              /* Room to stuff it in */
        if (getroom(&qrbuf, roomname) != 0) {
                create_room(roomname, 
                        ( (is_mailbox != NULL) ? 4 : 3 ),
-                       "", 0);
+                       "", 0, 1);
        }
        /* If the caller specified this object as unique, delete all
         * other objects of this type that are currently in the room.
index 8825e35087480dac5bcbee4e65e935cf224bcf0b..f3598b4e98b28bdff269cdb6bba6ad09e5e23bd0 100644 (file)
@@ -289,7 +289,7 @@ struct floor *cgetfloor(int floor_num) {
        static int initialized = 0;
        int i;
 
-       if (!initialized) {
+       if (initialized == 0) {
                for (i=0; i<MAXFLOORS; ++i) {
                        floorcache[floor_num] = NULL;
                }
@@ -317,6 +317,7 @@ void putfloor(struct floor *flbuf, int floor_num)
        /* If we've cached this, clear it out, 'cuz it's WRONG now! */
        if (floorcache[floor_num] != NULL) {
                phree(floorcache[floor_num]);
+               floorcache[floor_num] = NULL;
        }
 }
 
@@ -1227,7 +1228,8 @@ void cmd_kill(char *argbuf)
 unsigned create_room(char *new_room_name,
                     int new_room_type,
                     char *new_room_pass,
-                    int new_room_floor)
+                    int new_room_floor,
+                    int really_create)
 {
 
        struct quickroom qrbuf;
@@ -1240,11 +1242,10 @@ unsigned create_room(char *new_room_name,
                return (0);     /* already exists */
        }
 
+
        memset(&qrbuf, 0, sizeof(struct quickroom));
-       safestrncpy(qrbuf.QRname, new_room_name, sizeof qrbuf.QRname);
        safestrncpy(qrbuf.QRpasswd, new_room_pass, sizeof qrbuf.QRpasswd);
        qrbuf.QRflags = QR_INUSE;
-       qrbuf.QRnumber = get_new_room_number();
        if (new_room_type > 0)
                qrbuf.QRflags = (qrbuf.QRflags | QR_PRIVATE);
        if (new_room_type == 1)
@@ -1254,6 +1255,16 @@ unsigned create_room(char *new_room_name,
        if (new_room_type == 4)
                qrbuf.QRflags = (qrbuf.QRflags | QR_MAILBOX);
 
+       /* If the user is requesting a personal room, set up the room
+        * name accordingly (prepend the user number)
+        */
+       if (new_room_type == 4) {
+               MailboxName(qrbuf.QRname, &CC->usersupp, new_room_name);
+       }
+       else {
+               safestrncpy(qrbuf.QRname, new_room_name, sizeof qrbuf.QRname);
+       }
+
        /* If the room is private, and the system administrator has elected
         * to automatically grant room aide privileges, do so now; otherwise,
         * set the room aide to undefined.
@@ -1264,6 +1275,14 @@ unsigned create_room(char *new_room_name,
                qrbuf.QRroomaide = (-1L);
        }
 
+       /* 
+        * If the caller is only interested in testing whether this will work,
+        * return now without creating the room.
+        */
+       if (!really_create) return (qrbuf.QRflags);
+
+       cdb_begin_transaction();
+       qrbuf.QRnumber = get_new_room_number();
        qrbuf.QRhighest = 0L;   /* No messages in this room yet */
        time(&qrbuf.QRgen);     /* Use a timestamp as the generation number */
        qrbuf.QRfloor = new_room_floor;
@@ -1285,6 +1304,7 @@ unsigned create_room(char *new_room_name,
        lputuser(&CC->usersupp);
 
        /* resume our happy day */
+       cdb_end_transaction();
        return (qrbuf.QRflags);
 }
 
@@ -1352,17 +1372,10 @@ void cmd_cre8(char *args)
                return;
        }
 
-       /* If the user is requesting a personal room, set up the room
-        * name accordingly (prepend the user number)
-        */
-       if (new_room_type == 4) {
-               sprintf(aaa, "%010ld.%s",
-                       CC->usersupp.usernum, new_room_name);
-               strcpy(new_room_name, aaa);
-       }
-
        /* Check to make sure the requested room name doesn't already exist */
-       if (getroom(&qrbuf, new_room_name) == 0) {
+       newflags = create_room(new_room_name,
+                          new_room_type, new_room_pass, new_room_floor, 0);
+       if (newflags == 0) {
                cprintf("%d '%s' already exists.\n",
                        ERROR + ALREADY_EXISTS, qrbuf.QRname);
                return;
@@ -1373,8 +1386,10 @@ void cmd_cre8(char *args)
                return;
        }
 
+       /* If we reach this point, the room needs to be created. */
+
        newflags = create_room(new_room_name,
-                          new_room_type, new_room_pass, new_room_floor);
+                          new_room_type, new_room_pass, new_room_floor, 1);
 
        /* post a message in Aide> describing the new room */
        safestrncpy(aaa, new_room_name, sizeof aaa);
index 06a951b2ffcb78c8d86bcddcf1d492d668a931cc..a3aca8918ffff151afeb028d0a20ee75cf44abdf 100644 (file)
@@ -35,7 +35,8 @@ void cmd_kill (char *argbuf);
 unsigned create_room(char *new_room_name,
                        int new_room_type,
                        char *new_room_pass,
-                       int new_room_floor);
+                       int new_room_floor,
+                       int really_create);
 void cmd_cre8 (char *args);
 void cmd_einf (char *ok);
 void cmd_lflr (void);
index edff3d93a18c0f7d018301febe55680839750fc6..1de7699af92bd1f0419640f7f5ff657959e159f4 100644 (file)
@@ -571,14 +571,14 @@ int send_express_message(char *lun, char *x_user, char *x_msg)
                logmsg->cm_fields['M'] = strdoop(x_msg);
 
                MailboxName(roomname, &CC->usersupp, PAGELOGROOM);
-               create_room(roomname, 4, "", 0);
+               create_room(roomname, 4, "", 0, 1);
                msgnum = CtdlSaveMsg(logmsg, "", roomname, MES_LOCAL);
                if (strlen(config.c_logpages) > 0) {
-                       create_room(config.c_logpages, 3, "", 0);
+                       create_room(config.c_logpages, 3, "", 0, 1);
                        CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0);
                }
                while (sl != NULL) {
-                       create_room(sl->roomname, 4, "", 0);
+                       create_room(sl->roomname, 4, "", 0, 1);
                        CtdlSaveMsgPointerInRoom(sl->roomname, msgnum, 0);
                        sptr = sl->next;
                        phree(sl);
index 7ebb33e651ae19d872ebe24671925b3e48fe6faa..682c0c1a399ade77436cd47cdf404fb6f257a94e 100644 (file)
@@ -319,7 +319,7 @@ void do_user_purge(struct usersupp *us, void *data) {
        struct quickroom qrbuf;
        char mailboxname[ROOMNAMELEN];
        MailboxName(mailboxname, us, MAILROOM);
-       create_room(mailboxname, 4, "", 0);
+       create_room(mailboxname, 4, "", 0, 1);
        if (getroom(&qrbuf, mailboxname) != 0) return;
        lprintf(9, "Got %s\n", qrbuf.QRname);
         */
index 8d4d5d58fbf1180011272cfed73fd209e546f1fc..d854702ce36c8c0a8d15195dbd18762e114a1ea3 100644 (file)
@@ -50,7 +50,7 @@ void ical_create_room(void)
 
        /* Create the room if it doesn't already exist */
        MailboxName(roomname, &CC->usersupp, USERCALENDARROOM);
-       create_room(roomname, 4, "", 0);
+       create_room(roomname, 4, "", 0, 1);
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (lgetroom(&qr, roomname)) {
                lprintf(3, "Couldn't get the user calendar room!\n");
index 0e776b63a0ebdb0bd633f1db55c7256021f4e15a..ff344aa969b450ceda361b6d1ed3284986e04223 100644 (file)
@@ -414,7 +414,10 @@ void imap_create(int num_parms, char *parms[]) {
                newroomtype = 0;        /* public folder */
        }
 
-       ret = create_room(roomname, newroomtype, "", floornum);
+       lprintf(7, "Create new room <%s> on floor <%d> with type <%d>\n",
+               roomname, floornum, newroomtype);
+
+       ret = create_room(roomname, newroomtype, "", floornum, 1);
        if (ret == 0) {
                cprintf("%s NO Mailbox already exists, or create failed\r\n",
                        parms[0]);
index 927d8206d4fd7ac95bb9f95d3d05e7704304bdec..1e54b7f07b9fa097daef125c3f08f877e062eb45 100644 (file)
@@ -1475,7 +1475,7 @@ char *Dynamic_Module_Init(void)
                                smtp_greeting,
                                smtp_command_loop);
 
-       create_room(SMTP_SPOOLOUT_ROOM, 3, "", 0);
+       create_room(SMTP_SPOOLOUT_ROOM, 3, "", 0, 1);
        CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER);
        return "$Id$";
 }
index be8d89c840ca871b7b01fd166aa1ca1fbdffbbee..07d93c6f7e555c774508fed06aea38c0746599df 100644 (file)
@@ -470,7 +470,7 @@ char *Dynamic_Module_Init(void)
        CtdlRegisterProtoHook(cmd_regi, "REGI", "Enter registration info");
        CtdlRegisterProtoHook(cmd_greg, "GREG", "Get registration info");
        CtdlRegisterUserHook(vcard_purge, EVT_PURGEUSER);
-       create_room(ADDRESS_BOOK_ROOM, 3, "", 0);
+       create_room(ADDRESS_BOOK_ROOM, 3, "", 0, 1);
        return "$Id$";
 }
 
index db57448144ccfa697e796d6e0a3f786798a9f6ca..2a810bff14046023aa7a39a297a561e0474ce553 100644 (file)
@@ -178,7 +178,8 @@ contain:
 unsigned create_room(char *new_room_name,
                      int new_room_type,
                      char *new_room_pass,
-                     int new_room_floor)
+                     int new_room_floor,
+                    int really_create)
 
  This function is used to create a new room.  new_room_name should be set to
 the desired name for the new room.  new_room_type should be set to 0 for a
@@ -188,6 +189,10 @@ a type 2 (passworded) room, new_room_pass should be set to the desired
 password.  new_room_floor should be set to the number of the floor upon which
 the new room should reside.
  
+ If the room is really to be created, set really_create to 1.  Otherwise, the
+caller may merely check to see if it's possible to create the room without
+actually creating it by setting really_create to 0.
  create_room() returns the flags associated with the new room (as in the
 data structure item quickroom.QRflags).  If the room cannot be created (for
 example, a room with the name already exists), it returns 0.
index cf39c2403a532b3d208c7d2c78e990ad8182c0a9..7d86b2c052420b34f0348d60ac4af0e20281adef 100644 (file)
@@ -675,7 +675,7 @@ int create_user(char *newusername)
        }
        /* give the user a private mailbox */
        MailboxName(mailboxname, &CC->usersupp, MAILROOM);
-       create_room(mailboxname, 4, "", 0);
+       create_room(mailboxname, 4, "", 0, 1);
 
        rec_log(CL_NEWUSER, CC->curr_user);
        return (0);