+ CtdlSetConfigStr("c_default_cal_zone", buf);
+ syslog(LOG_INFO, "Configuring timezone: %s", buf);
+ }
+ fclose(fp);
+ }
+}
+
+
+/*
+ * Per-room callback function for ingest_old_roominfo_and_roompic_files()
+ *
+ * This is the second pass, where we process the list of rooms with info or pic files.
+ */
+void iorarf_oneroom(char *roomname, char *infofile, char *picfile)
+{
+ FILE *fp;
+ long data_length;
+ char *unencoded_data;
+ char *encoded_data;
+ long info_msgnum = 0;
+ long pic_msgnum = 0;
+ char subject[SIZ];
+
+ // Test for the presence of a legacy "room info file"
+ if (!IsEmptyStr(infofile)) {
+ fp = fopen(infofile, "r");
+ }
+ else {
+ fp = NULL;
+ }
+ if (fp) {
+ fseek(fp, 0, SEEK_END);
+ data_length = ftell(fp);
+
+ if (data_length >= 1) {
+ rewind(fp);
+ unencoded_data = malloc(data_length);
+ if (unencoded_data) {
+ fread(unencoded_data, data_length, 1, fp);
+ encoded_data = malloc((data_length * 2) + 100);
+ if (encoded_data) {
+ sprintf(encoded_data, "Content-type: text/plain\nContent-transfer-encoding: base64\n\n");
+ CtdlEncodeBase64(&encoded_data[strlen(encoded_data)], unencoded_data, data_length, 1);
+ snprintf(subject, sizeof subject, "Imported room banner for %s", roomname);
+ info_msgnum = quickie_message("Citadel", NULL, NULL, SYSCONFIGROOM, encoded_data, FMT_RFC822, subject);
+ free(encoded_data);
+ }
+ free(unencoded_data);
+ }
+ }
+ fclose(fp);
+ if (info_msgnum > 0) unlink(infofile);
+ }
+
+ // Test for the presence of a legacy "room picture file" and import it.
+ if (!IsEmptyStr(picfile)) {
+ fp = fopen(picfile, "r");
+ }
+ else {
+ fp = NULL;
+ }
+ if (fp) {
+ fseek(fp, 0, SEEK_END);
+ data_length = ftell(fp);
+
+ if (data_length >= 1) {
+ rewind(fp);
+ unencoded_data = malloc(data_length);
+ if (unencoded_data) {
+ fread(unencoded_data, data_length, 1, fp);
+ encoded_data = malloc((data_length * 2) + 100);
+ if (encoded_data) {
+ sprintf(encoded_data, "Content-type: image/gif\nContent-transfer-encoding: base64\n\n");
+ CtdlEncodeBase64(&encoded_data[strlen(encoded_data)], unencoded_data, data_length, 1);
+ snprintf(subject, sizeof subject, "Imported room icon for %s", roomname);
+ pic_msgnum = quickie_message("Citadel", NULL, NULL, SYSCONFIGROOM, encoded_data, FMT_RFC822, subject);
+ free(encoded_data);
+ }
+ free(unencoded_data);
+ }