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)
$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.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
# 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.
# 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
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);
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")) {
*/
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);
}
}
+ /* since we don't allow multi-level yet, fail.
extract(rbuf, buf, 1);
return(0);
+ */
+ return(-1);
}
safestrncpy(rbuf, foldername, bufsize);
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.
static int initialized = 0;
int i;
- if (!initialized) {
+ if (initialized == 0) {
for (i=0; i<MAXFLOORS; ++i) {
floorcache[floor_num] = NULL;
}
/* 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;
}
}
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;
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)
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.
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;
lputuser(&CC->usersupp);
/* resume our happy day */
+ cdb_end_transaction();
return (qrbuf.QRflags);
}
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;
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);
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);
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);
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);
*/
/* 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");
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]);
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$";
}
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$";
}
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
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.
}
/* 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);