* CRE8 command: allow setting default view during room creation
authorArt Cancro <ajc@citadel.org>
Thu, 16 Sep 2004 01:46:42 +0000 (01:46 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 16 Sep 2004 01:46:42 +0000 (01:46 +0000)
14 files changed:
citadel/ChangeLog
citadel/citserver.c
citadel/control.c
citadel/msgbase.c
citadel/room_ops.c
citadel/room_ops.h
citadel/serv_calendar.c
citadel/serv_chat.c
citadel/serv_expire.c
citadel/serv_imap.c
citadel/serv_smtp.c
citadel/serv_vcard.c
citadel/techdoc/session.txt
citadel/user_ops.c

index f9b2ea962b97481f553226da8dd98859a38a1c64..183bc3b598d7734afed1624ef794d2f9657ed88f 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 625.23  2004/09/16 01:46:40  ajc
+ * CRE8 command: allow setting default view during room creation
+
  Revision 625.22  2004/09/15 03:02:47  ajc
  * Add an SMTP MSA listener (separate port, requires auth)
 
@@ -6083,3 +6086,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 041963b5af30e2af03f38837dea61eeebec15c33..82e58d98860e08addcb99391a0db55302851b506 100644 (file)
@@ -91,10 +91,10 @@ void master_startup(void) {
        check_ref_counts();
 
        lprintf(CTDL_INFO, "Creating base rooms (if necessary)\n");
-       create_room(BASEROOM,           0, "", 0, 1, 0);
-       create_room(AIDEROOM,           3, "", 0, 1, 0);
-       create_room(SYSCONFIGROOM,      3, "", 0, 1, 0);
-       create_room(config.c_twitroom,  0, "", 0, 1, 0);
+       create_room(BASEROOM,           0, "", 0, 1, 0, VIEW_BBS);
+       create_room(AIDEROOM,           3, "", 0, 1, 0, VIEW_BBS);
+       create_room(SYSCONFIGROOM,      3, "", 0, 1, 0, VIEW_BBS);
+       create_room(config.c_twitroom,  0, "", 0, 1, 0, VIEW_BBS);
 
        /* The "Local System Configuration" room doesn't need to be visible */
         if (lgetroom(&qrbuf, SYSCONFIGROOM) == 0) {
index a9adb4f103ae271d8916ad026badcd010f663605..ef507f6f3461fab89364e9d5625e54be4147e34f 100644 (file)
@@ -386,7 +386,7 @@ void cmd_conf(char *argbuf)
                aide_message(buf);
 
                if (strlen(config.c_logpages) > 0)
-                       create_room(config.c_logpages, 3, "", 0, 1, 1);
+                       create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
        }
 
        else if (!strcasecmp(cmd, "GETSYS")) {
index 639b394bdaca13e5740a790e7ee0d7e57f492562..a5ee3d785de13f5ea7618992ef2cd3b77604de31 100644 (file)
@@ -3224,7 +3224,7 @@ void CtdlWriteObject(char *req_room,              /* Room to stuff it in */
        if (getroom(&qrbuf, roomname) != 0) {
                create_room(roomname, 
                        ( (is_mailbox != NULL) ? 5 : 3 ),
-                       "", 0, 1, 0);
+                       "", 0, 1, 0, VIEW_BBS);
        }
        /* If the caller specified this object as unique, delete all
         * other objects of this type that are currently in the room.
index c4b24b40916c8ecef08fbbcbe9eedb55c9a2eeec..1f19e320ac27ca1699b093c35595e45d246b2aaa 100644 (file)
@@ -1591,7 +1591,8 @@ unsigned create_room(char *new_room_name,
                     char *new_room_pass,
                     int new_room_floor,
                     int really_create,
-                    int avoid_access)
+                    int avoid_access,
+                    int new_room_view)
 {
 
        struct ctdlroom qrbuf;
@@ -1647,6 +1648,7 @@ unsigned create_room(char *new_room_name,
        qrbuf.QRhighest = 0L;   /* No messages in this room yet */
        time(&qrbuf.QRgen);     /* Use a timestamp as the generation number */
        qrbuf.QRfloor = new_room_floor;
+       qrbuf.QRdefaultview = new_room_view;
 
        /* save what we just did... */
        putroom(&qrbuf);
@@ -1683,6 +1685,7 @@ void cmd_cre8(char *args)
        int new_room_type;
        char new_room_pass[SIZ];
        int new_room_floor;
+       int new_room_view;
        char aaa[SIZ];
        unsigned newflags;
        struct floor *fl;
@@ -1694,6 +1697,7 @@ void cmd_cre8(char *args)
        new_room_type = extract_int(args, 2);
        extract(new_room_pass, args, 3);
        avoid_access = extract_int(args, 5);
+       new_room_view = extract_int(args, 6);
        new_room_pass[9] = 0;
        new_room_floor = 0;
 
@@ -1753,7 +1757,7 @@ void cmd_cre8(char *args)
        /* Check to make sure the requested room name doesn't already exist */
        newflags = create_room(new_room_name,
                                new_room_type, new_room_pass, new_room_floor,
-                               0, avoid_access);
+                               0, avoid_access, new_room_view);
        if (newflags == 0) {
                cprintf("%d '%s' already exists.\n",
                        ERROR + ALREADY_EXISTS, new_room_name);
@@ -1768,7 +1772,8 @@ void cmd_cre8(char *args)
        /* 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, 1, 0);
+                          new_room_type, new_room_pass, new_room_floor, 1, 0,
+                          new_room_view);
 
        /* post a message in Aide> describing the new room */
        safestrncpy(aaa, new_room_name, sizeof aaa);
index 588747c7464731449cd2b53d7e848beacd008c03..724fa0782c4cdcc400ad91424dad75586d0b1fdf 100644 (file)
@@ -39,7 +39,8 @@ unsigned create_room(char *new_room_name,
                        char *new_room_pass,
                        int new_room_floor,
                        int really_create,
-                       int avoid_access);
+                       int avoid_access,
+                       int new_room_view);
 void cmd_cre8 (char *args);
 void cmd_einf (char *ok);
 void cmd_lflr (void);
index a8baf02c00541a0ab39f66736d8c182f926a8195..29cbb1eb2fe49f163e141312ef231c9858bf56c0 100644 (file)
@@ -1409,7 +1409,7 @@ void ical_create_room(void)
        struct visit vbuf;
 
        /* Create the calendar room if it doesn't already exist */
-       create_room(USERCALENDARROOM, 4, "", 0, 1, 0);
+       create_room(USERCALENDARROOM, 4, "", 0, 1, 0, VIEW_CALENDAR);
 
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (lgetroom(&qr, USERCALENDARROOM)) {
@@ -1417,7 +1417,7 @@ void ical_create_room(void)
                return;
        }
        qr.QRep.expire_mode = EXPIRE_MANUAL;
-       qr.QRdefaultview = 3;   /* 3 = calendar view */
+       qr.QRdefaultview = VIEW_CALENDAR;       /* 3 = calendar view */
        lputroom(&qr);
 
        /* Set the view to a calendar view */
@@ -1426,7 +1426,7 @@ void ical_create_room(void)
        CtdlSetRelationship(&vbuf, &CC->user, &qr);
 
        /* Create the tasks list room if it doesn't already exist */
-       create_room(USERTASKSROOM, 4, "", 0, 1, 0);
+       create_room(USERTASKSROOM, 4, "", 0, 1, 0, VIEW_TASKS);
 
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (lgetroom(&qr, USERTASKSROOM)) {
@@ -1434,7 +1434,7 @@ void ical_create_room(void)
                return;
        }
        qr.QRep.expire_mode = EXPIRE_MANUAL;
-       qr.QRdefaultview = 4;   /* 4 = tasks view */
+       qr.QRdefaultview = VIEW_TASKS;  /* 4 = tasks view */
        lputroom(&qr);
 
        /* Set the view to a task list view */
index 22984881cf1399f2dfbb59d2a2d15ca3d40decc0..0c2e9135be1d50e9dcbc725561a5a6256cd02ea1 100644 (file)
@@ -634,12 +634,12 @@ int send_instant_message(char *lun, char *x_user, char *x_msg)
                /* Save a copy of the message in the sender's log room,
                 * creating the room if necessary.
                 */
-               create_room(PAGELOGROOM, 4, "", 0, 1, 0);
+               create_room(PAGELOGROOM, 4, "", 0, 1, 0, VIEW_BBS);
                msgnum = CtdlSubmitMsg(logmsg, NULL, PAGELOGROOM);
 
                /* Now save a copy in the global log room, if configured */
                if (strlen(config.c_logpages) > 0) {
-                       create_room(config.c_logpages, 3, "", 0, 1, 1);
+                       create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
                        CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0);
                }
 
@@ -649,7 +649,7 @@ int send_instant_message(char *lun, char *x_user, char *x_msg)
                 * but we've already supplied the namespace prefix.
                 */
                while (sl != NULL) {
-                       create_room(sl->roomname, 5, "", 0, 1, 1);
+                       create_room(sl->roomname, 5, "", 0, 1, 1, VIEW_BBS);
                        CtdlSaveMsgPointerInRoom(sl->roomname, msgnum, 0);
                        sptr = sl->next;
                        free(sl);
index cac821ff95d0ace4db68107ebf955c1d3458a55b..80e4ea20288fef0063ca7c70bcfd1bf5721f7db9 100644 (file)
@@ -389,7 +389,7 @@ void do_user_purge(struct ctdluser *us, void *data) {
        struct ctdlroom qrbuf;
        char mailboxname[ROOMNAMELEN];
        MailboxName(mailboxname, us, MAILROOM);
-       create_room(mailboxname, 4, "", 0, 1, 1);
+       create_room(mailboxname, 4, "", 0, 1, 1, VIEW_BBS);
        if (getroom(&qrbuf, mailboxname) != 0) return;
        lprintf(CTDL_DEBUG, "Got %s\n", qrbuf.QRname);
         */
index 684d39e306442a1dabaf15c5c3375fad456ca0b0..b19e9ca86830c47b85ac9b10141ad16d9d0dfa56 100644 (file)
@@ -833,7 +833,7 @@ void imap_create(int num_parms, char *parms[])
        lprintf(CTDL_INFO, "Create new room <%s> on floor <%d> with type <%d>\n",
                roomname, floornum, newroomtype);
 
-       ret = create_room(roomname, newroomtype, "", floornum, 1, 0);
+       ret = create_room(roomname, newroomtype, "", floornum, 1, 0, VIEW_BBS);
        if (ret == 0) {
                cprintf
                    ("%s NO Mailbox already exists, or create failed\r\n",
@@ -1195,7 +1195,7 @@ void imap_rename(int num_parms, char *parms[])
         * (already did that) and create a new inbox.
         */
        if (!strcasecmp(parms[2], "INBOX")) {
-               create_room(MAILROOM, 4, "", 0, 1, 0);
+               create_room(MAILROOM, 4, "", 0, 1, 0, VIEW_BBS);
        }
 
        /* Otherwise, do the subfolders.  Build a list of rooms to rename... */
index 065304947d54a9b254a9a9383e6322420c4752ed..7ebfa7dd10fd4b49d04558d50938e3c965d68602 100644 (file)
@@ -1623,7 +1623,7 @@ void smtp_init_spoolout(void) {
         * Create the room.  This will silently fail if the room already
         * exists, and that's perfectly ok, because we want it to exist.
         */
-       create_room(SMTP_SPOOLOUT_ROOM, 3, "", 0, 1, 0);
+       create_room(SMTP_SPOOLOUT_ROOM, 3, "", 0, 1, 0, VIEW_BBS);
 
        /*
         * Make sure it's set to be a "system room" so it doesn't show up
index 1ce0b931716d01edacf4f3af6b076d26d5b3870b..a776f022f1c6f1829828c9feed8a16aa8488e168 100644 (file)
@@ -884,7 +884,7 @@ void vcard_create_room(void)
        struct visit vbuf;
 
        /* Create the calendar room if it doesn't already exist */
-       create_room(USERCONTACTSROOM, 4, "", 0, 1, 0);
+       create_room(USERCONTACTSROOM, 4, "", 0, 1, 0, VIEW_ADDRESSBOOK);
 
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (lgetroom(&qr, USERCONTACTSROOM)) {
@@ -892,7 +892,7 @@ void vcard_create_room(void)
                return;
        }
        qr.QRep.expire_mode = EXPIRE_MANUAL;
-       qr.QRdefaultview = 2;   /* 2 = address book view */
+       qr.QRdefaultview = VIEW_ADDRESSBOOK;    /* 2 = address book view */
        lputroom(&qr);
 
        /* Set the view to a calendar view */
@@ -949,12 +949,12 @@ char *serv_vcard_init(void)
        CtdlRegisterNetprocHook(vcard_extract_from_network);
 
        /* Create the Global ADdress Book room if necessary */
-       create_room(ADDRESS_BOOK_ROOM, 3, "", 0, 1, 0);
+       create_room(ADDRESS_BOOK_ROOM, 3, "", 0, 1, 0, VIEW_ADDRESSBOOK);
 
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (!lgetroom(&qr, ADDRESS_BOOK_ROOM)) {
                qr.QRep.expire_mode = EXPIRE_MANUAL;
-               qr.QRdefaultview = 2;   /* 2 = address book view */
+               qr.QRdefaultview = VIEW_ADDRESSBOOK;    /* 2 = address book view */
                lputroom(&qr);
        }
 
index 8722916e76400bd4ff13eda611caa3f5a55d8a50..a6b757341eb30d306914d65f62c9069a1e147219 100644 (file)
@@ -892,6 +892,7 @@ or ERROR or ERROR+HIGHER_ACCESS_REQUIRED if the command will not succeed.
  3  -  Password for new room (if it is a type 2 room)
  4  -  Floor number on which the room should reside (optional)
  5  -  Set to 1 to avoid automatically gaining access to the created room.
+ 6  -  The default "view" for the room.
 
  If the create flag is set to 1, the room is created (unless something
 went wrong and an ERROR return is sent), and the server returns OK, but
index 899e74e229684714ba1964726d0f770a425fb622..77f5f86030ca20d09e3cf334b74d93d569a26ccc 100644 (file)
@@ -487,8 +487,8 @@ void session_startup(void)
        /* Create any personal rooms required by the system.
         * (Technically, MAILROOM should be there already, but just in case...)
         */
-       create_room(MAILROOM, 4, "", 0, 1, 0);
-       create_room(SENTITEMS, 4, "", 0, 1, 0);
+       create_room(MAILROOM, 4, "", 0, 1, 0, VIEW_BBS);
+       create_room(SENTITEMS, 4, "", 0, 1, 0, VIEW_BBS);
 
        /* Run any startup routines registered by loadable modules */
        PerformSessionHooks(EVT_LOGIN);
@@ -838,10 +838,10 @@ int create_user(char *newusername, int become_user)
         * Make the latter an invisible system room.
         */
        MailboxName(mailboxname, sizeof mailboxname, &usbuf, MAILROOM);
-       create_room(mailboxname, 5, "", 0, 1, 1);
+       create_room(mailboxname, 5, "", 0, 1, 1, VIEW_BBS);
 
        MailboxName(mailboxname, sizeof mailboxname, &usbuf, USERCONFIGROOM);
-       create_room(mailboxname, 5, "", 0, 1, 1);
+       create_room(mailboxname, 5, "", 0, 1, 1, VIEW_BBS);
         if (lgetroom(&qrbuf, mailboxname) == 0) {
                 qrbuf.QRflags2 |= QR2_SYSTEM;
                 lputroom(&qrbuf);