+struct iorarf_list {
+ struct iorarf_list *next;
+ char name[ROOMNAMELEN];
+ char info[PATH_MAX];
+ char pic[PATH_MAX];
+};
+
+
+/*
+ * Per-room callback function for ingest_old_roominfo_and_roompic_files()
+ *
+ * This is the first pass, where the list of qualifying rooms is gathered.
+ */
+void iorarf_backend(struct ctdlroom *qrbuf, void *data)
+{
+ FILE *fp;
+ struct iorarf_list **iorarf_list = (struct iorarf_list **)data;
+
+ struct iorarf_list *i = malloc(sizeof(struct iorarf_list));
+ i->next = *iorarf_list;
+ strcpy(i->name, qrbuf->QRname);
+ strcpy(i->info, "");
+ strcpy(i->pic, "");
+
+ // Test for the presence of a legacy "room info file"
+ assoc_file_name(i->info, sizeof i->info, qrbuf, ctdl_info_dir);
+ fp = fopen(i->info, "r");
+ if (fp) {
+ fclose(fp);
+ }
+ else {
+ i->info[0] = 0;
+ }
+
+ // Test for the presence of a legacy "room picture file"
+ assoc_file_name(i->pic, sizeof i->pic, qrbuf, ctdl_image_dir);
+ fp = fopen(i->pic, "r");
+ if (fp) {
+ fclose(fp);
+ }
+ else {
+ i->pic[0] = 0;
+ }
+
+ if ( (!IsEmptyStr(i->info)) || (!IsEmptyStr(i->pic)) ) {
+ *iorarf_list = i;
+ }
+ else {
+ free(i);
+ }
+}
+
+
+/*
+ * Prior to Citadel Server version 902, room info and pictures (which comprise the
+ * displayed banner for each room) were stored in the filesystem. If we are upgrading
+ * from version >000 to version >=902, ingest those files into the database.
+ */
+void ingest_old_roominfo_and_roompic_files(void)
+{
+ struct iorarf_list *il = NULL;
+
+ CtdlForEachRoom(iorarf_backend, &il);
+
+ struct iorarf_list *p;
+ while (il) {
+ iorarf_oneroom(il->name, il->info, il->pic);
+ p = il->next;
+ free(il);
+ il = p;
+ }
+
+}
+
+