#include <errno.h>
#include "citadel.h"
#include "server.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
#include "database.h"
#include "config.h"
#include "room_ops.h"
+void cmd_lprm_backend(struct quickroom *qrbuf, void *data)
+{
+ int FloorBeingSearched = (-1);
+ FloorBeingSearched = *(int *)data;
+
+ if ( ((qrbuf->QRflags & QR_PRIVATE) == 0)
+ && ((qrbuf->QRflags & QR_MAILBOX) == 0)
+ && ((qrbuf->QRfloor == (FloorBeingSearched))
+ || ((FloorBeingSearched) < 0)))
+ list_roomname(qrbuf);
+}
+
+void cmd_lprm(char *argbuf)
+{
+ int FloorBeingSearched = (-1);
+ if (strlen(argbuf) > 0)
+ FloorBeingSearched = extract_int(argbuf, 0);
+
+ cprintf("%d Publiic rooms:\n", LISTING_FOLLOWS);
+
+ ForEachRoom(cmd_lprm_backend, &FloorBeingSearched);
+ cprintf("000\n");
+}
+
+
+
/*
* cmd_lkrn() - List all known rooms with new messages
*/
if (retmsgs != NULL) *retmsgs = total_messages;
if (retnew != NULL) *retnew = new_messages;
lprintf(9, "<%s> %d new of %d total messages\n",
- CC->quickroom.QRname, new_messages, total_messages);
+ CC->quickroom.QRname,
+ new_messages, total_messages
+ );
- if (display_result)
- cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d|%d\n",
+ if (display_result) {
+ cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d|%d|%d|\n",
CIT_OK, CtdlCheckExpress(),
truncated_roomname,
- new_messages, total_messages,
- info, CC->quickroom.QRflags,
- CC->quickroom.QRhighest,
- vbuf.v_lastseen,
- rmailflag, raideflag, newmailcount,
- CC->quickroom.QRfloor,
- vbuf.v_view);
+ (int)new_messages,
+ (int)total_messages,
+ (int)info,
+ (int)CC->quickroom.QRflags,
+ (long)CC->quickroom.QRhighest,
+ (long)vbuf.v_lastseen,
+ (int)rmailflag,
+ (int)raideflag,
+ (int)newmailcount,
+ (int)CC->quickroom.QRfloor,
+ (int)vbuf.v_view,
+ (int)CC->quickroom.QRdefaultview
+ );
+ }
}
struct floor *fl;
struct floor flbuf;
long owner = 0L;
+ char actual_old_name[SIZ];
lprintf(9, "CtdlRenameRoom(%s, %s, %d)\n",
old_name, new_name, new_floor);
else {
/* Rename it */
+ strcpy(actual_old_name, qrbuf.QRname);
if (qrbuf.QRflags & QR_MAILBOX) {
owner = atol(qrbuf.QRname);
}
* records, so we have to delete the old one.
*/
if (strcasecmp(new_name, old_name)) {
- b_deleteroom(old_name);
+ b_deleteroom(actual_old_name);
}
ret = crr_ok;
extract(new_floor_name, argbuf, 0);
cflr_ok = extract_int(argbuf, 1);
-
if (CtdlAccessCheck(ac_aide)) return;
+ if (strlen(new_floor_name) == 0) {
+ cprintf("%d Blank floor name not allowed.\n",
+ ERROR+ILLEGAL_VALUE);
+ return;
+ }
+
for (a = 0; a < MAXFLOORS; ++a) {
getfloor(&flbuf, a);