RINF command migrated to new data format
[citadel.git] / citadel / modules / ctdlproto / serv_rooms.c
index 9df142cd04b96579a7c74468fbca82dccc2824d7..09fb30061426e361b8d814540c0be3cf4243f358 100644 (file)
@@ -708,29 +708,20 @@ void cmd_seta(char *new_ra)
 }
 
 /* 
- * retrieve info file for this room
+ * Retrieve info file for this room (this ought to be upgraded to handle non-plain-text)
  */
-void cmd_rinf(char *gargs)
+void cmd_rinf(char *argbuf)
 {
-       char filename[PATH_MAX];
-       char buf[SIZ];
-       FILE *info_fp;
-
-       assoc_file_name(filename, sizeof filename, &CC->room, ctdl_info_dir);
-       info_fp = fopen(filename, "r");
-
-       if (info_fp == NULL) {
-               cprintf("%d No info file.\n", ERROR + FILE_NOT_FOUND);
-               return;
+       struct CtdlMessage *msg = CtdlFetchMessage(CC->room.msgnum_info, 1, 1);
+       if (msg != NULL) {
+               cprintf("%d Info:\n", LISTING_FOLLOWS);
+               CtdlOutputPreLoadedMsg(msg, MT_CITADEL, HEADERS_NONE, 0, 0, 0);
+               CM_Free(msg);
+               cprintf("000\n");
        }
-       cprintf("%d Info:\n", LISTING_FOLLOWS);
-       while (fgets(buf, sizeof buf, info_fp) != NULL) {
-               if (!IsEmptyStr(buf))
-                       buf[strlen(buf) - 1] = 0;
-               cprintf("%s\n", buf);
+       else {
+               cprintf("%d No info file.\n", ERROR + FILE_NOT_FOUND);
        }
-       cprintf("000\n");
-       fclose(info_fp);
 }
 
 
@@ -931,7 +922,6 @@ void cmd_einf(char *ok)
 
        /* now update the room index so people will see our new info */
        CtdlGetRoomLock(&CCC->room, CCC->room.QRname);          /* lock so no one steps on us */
-       CCC->room.QRinfo = CCC->room.QRhighest + 1L;
        CtdlPutRoomLock(&CCC->room);
 }