From 7b55d10cc11a57569ff98ebbe01e62315820ee0d Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 16 Sep 2004 01:46:42 +0000 Subject: [PATCH] * CRE8 command: allow setting default view during room creation --- citadel/ChangeLog | 4 ++++ citadel/citserver.c | 8 ++++---- citadel/control.c | 2 +- citadel/msgbase.c | 2 +- citadel/room_ops.c | 11 ++++++++--- citadel/room_ops.h | 3 ++- citadel/serv_calendar.c | 8 ++++---- citadel/serv_chat.c | 6 +++--- citadel/serv_expire.c | 2 +- citadel/serv_imap.c | 4 ++-- citadel/serv_smtp.c | 2 +- citadel/serv_vcard.c | 8 ++++---- citadel/techdoc/session.txt | 1 + citadel/user_ops.c | 8 ++++---- 14 files changed, 40 insertions(+), 29 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index f9b2ea962..183bc3b59 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citserver.c b/citadel/citserver.c index 041963b5a..82e58d988 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -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) { diff --git a/citadel/control.c b/citadel/control.c index a9adb4f10..ef507f6f3 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -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")) { diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 639b394bd..a5ee3d785 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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. diff --git a/citadel/room_ops.c b/citadel/room_ops.c index c4b24b409..1f19e320a 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -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); diff --git a/citadel/room_ops.h b/citadel/room_ops.h index 588747c74..724fa0782 100644 --- a/citadel/room_ops.h +++ b/citadel/room_ops.h @@ -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); diff --git a/citadel/serv_calendar.c b/citadel/serv_calendar.c index a8baf02c0..29cbb1eb2 100644 --- a/citadel/serv_calendar.c +++ b/citadel/serv_calendar.c @@ -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 */ diff --git a/citadel/serv_chat.c b/citadel/serv_chat.c index 22984881c..0c2e9135b 100644 --- a/citadel/serv_chat.c +++ b/citadel/serv_chat.c @@ -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); diff --git a/citadel/serv_expire.c b/citadel/serv_expire.c index cac821ff9..80e4ea202 100644 --- a/citadel/serv_expire.c +++ b/citadel/serv_expire.c @@ -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); */ diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index 684d39e30..b19e9ca86 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -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... */ diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 065304947..7ebfa7dd1 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -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 diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index 1ce0b9317..a776f022f 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -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); } diff --git a/citadel/techdoc/session.txt b/citadel/techdoc/session.txt index 8722916e7..a6b757341 100644 --- a/citadel/techdoc/session.txt +++ b/citadel/techdoc/session.txt @@ -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 diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 899e74e22..77f5f8603 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -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); -- 2.39.2