$Log$
+ Revision 591.13 2002/04/20 03:00:01 ajc
+ * One more fix for the RENAME command wrt namespaces.
+
Revision 591.12 2002/04/18 18:44:36 nbryant
don't use libtool -avoid-version for libcitserver - this might help for
OpenBSD
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
int levels;
char floorname[SIZ];
char roomname[SIZ];
- char buf[SIZ];
int i;
struct floor *fl;
int ret = (-1);
if (rbuf[i] == '|') rbuf[i] = '/';
}
+
+/*** This doesn't work.
+ char buf[SIZ];
if (ret & IR_MAILBOX) {
if (atol(rbuf) == 0L) {
strcpy(buf, rbuf);
sprintf(rbuf, "%010ld.%s", CC->usersupp.usernum, buf);
}
}
+ ***/
lprintf(9, "(That translates to \"%s\")\n", rbuf);
return(ret);
* You can also specify which floor to move the room to, or specify -1 to
* keep the room on the same floor it was on.
*
- * This function is unaware of namespaces. If you are renaming a mailbox
- * room, you must supply the namespace prefix in both the old and new names!
+ * If you are renaming a mailbox room, you must supply the namespace prefix
+ * in *at least* the old name!
*/
int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
int old_floor = 0;
int ret = 0;
struct floor *fl;
struct floor flbuf;
-
+ long owner = 0L;
lprintf(9, "CtdlRenameRoom(%s, %s, %d)\n",
old_name, new_name, new_floor);
}
else {
- safestrncpy(qrbuf.QRname, new_name, sizeof(qrbuf.QRname));
+ /* Rename it */
+ if (qrbuf.QRflags & QR_MAILBOX) {
+ owner = atol(qrbuf.QRname);
+ }
+ if ( (owner > 0L) && (atol(new_name) == 0L) ) {
+ snprintf(qrbuf.QRname, sizeof(qrbuf.QRname),
+ "%010ld.%s", owner, new_name);
+ }
+ else {
+ safestrncpy(qrbuf.QRname, new_name,
+ sizeof(qrbuf.QRname));
+ }
+
+ /* Take care of floor stuff */
old_floor = qrbuf.QRfloor;
if (new_floor < 0) {
new_floor = old_floor;
char newfoldername[SIZ];
char newroomname[ROOMNAMELEN];
int newfloor;
- int r;
imap_mailboxname(foldername, sizeof foldername, qrbuf);
while (irl != NULL) {
r = CtdlRenameRoom(irl->irl_oldroom,
irl->irl_newroom, irl->irl_newfloor);
- /* FIXME handle error returns */
+ if (r != crr_ok) {
+ /* FIXME handle error returns better */
+ lprintf(5, "CtdlRenameRoom() error %d\n", r);
+ }
irlp = irl;
irl = irl->next;
phree(irlp);