#define REV_LEVEL 730 /* This version */
#define REV_MIN 591 /* Oldest compatible database */
#define EXPORT_REV_MIN 725 /* Oldest compatible export files */
-#define LIBCITADEL_MIN 103 /* Minimum required version of libcitadel */
+#define LIBCITADEL_MIN 104 /* Minimum required version of libcitadel */
#define SERVER_TYPE 0 /* zero for stock Citadel; other developers please
obtain SERVER_TYPE codes for your implementations */
* It examines the file and displays the OK result code and some information
* about the file. NOTE: this stuff is Unix dependent.
*/
-void OpenCmdResult(char *filename, char *mime_type)
+void OpenCmdResult(char *filename, const char *mime_type)
{
struct stat statbuf;
time_t modtime;
{
char filename[256];
char pathname[PATH_MAX];
+ char MimeTestBuf[32];
struct ctdluser usbuf;
char which_user[USERNAME_SIZE];
int which_floor;
return;
}
snprintf(pathname, sizeof pathname,
- "%s/%ld.gif",
+ "%s/%ld",
ctdl_usrpic_dir,
usbuf.usernum);
} else if (!strcasecmp(filename, "_floorpic_")) {
which_floor = extract_int(cmdbuf, 1);
snprintf(pathname, sizeof pathname,
- "%s/floor.%d.gif",
+ "%s/floor.%d",
ctdl_image_dir, which_floor);
} else if (!strcasecmp(filename, "_roompic_")) {
assoc_file_name(pathname, sizeof pathname, &CC->room, ctdl_image_dir);
}
}
snprintf(pathname, sizeof pathname,
- "%s/%s.gif",
+ "%s/%s",
ctdl_image_dir,
filename);
}
CC->download_fp = fopen(pathname, "rb");
+ if (CC->download_fp == NULL) {
+ strcat(pathname, ".gif");
+ CC->download_fp = fopen(pathname, "rb");
+ }
if (CC->download_fp == NULL) {
cprintf("%d Cannot open %s: %s\n",
ERROR + FILE_NOT_FOUND, pathname, strerror(errno));
return;
}
-
- OpenCmdResult(pathname, "image/gif");
+ fread(&MimeTestBuf[0], 1, 32, CC->download_fp);
+ rewind (CC->download_fp);
+ OpenCmdResult(pathname, GuessMimeType(&MimeTestBuf[0], 32));
}
/*
void cmd_delf (char *filename);
void cmd_movf (char *cmdbuf);
void cmd_netf (char *cmdbuf);
-void OpenCmdResult (char *, char *);
+void OpenCmdResult (char *, const char *);
void cmd_open (char *cmdbuf);
void cmd_oimg (char *cmdbuf);
void cmd_uopn (char *cmdbuf);