dnl Ensure that libcitadel is configured with autoconf 2.52 or newer
AC_PREREQ(2.52)
-AC_INIT(libcitadel, 1.03, example@example.com)
+AC_INIT(libcitadel, 1.03, https://uncensored.citadel.org)
AC_CONFIG_SRCDIR(Makefile.in)
AC_CONFIG_AUX_DIR(conftools)
CFLAGS = -Wall -g
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0 -ggdb -rdynamic -MD -MP
else
- CFLAGS += -O2 -fno-strict-aliasing
+ CFLAGS += -O2
endif
build: build-stamp
*/
-#define LIBCITADEL_VERSION_NUMBER 103
+#define LIBCITADEL_VERSION_NUMBER 104
/*
* Here's a bunch of stupid magic to make the MIME parser portable.
int dont_decode
);
+const char *GuessMimeType(char *data, size_t dlen);
+
/* tools */
PostMultiPartCallBack,
userdata, dont_decode);
}
+
+
+
+
+
+
+typedef struct _MimeGuess {
+ const char *Pattern;
+ size_t PatternLen;
+ long PatternOffset;
+ const char *MimeString;
+} MimeGuess;
+
+MimeGuess MyMimes [] = {
+ {
+ "GIF",
+ 3,
+ 0,
+ "image/gif"
+ },
+ {
+ "\xff\xd8",
+ 2,
+ 0,
+ "image/jpeg"
+ },
+ {
+ "\x89PNG",
+ 4,
+ 0,
+ "image/png"
+ },
+ { // last...
+ "",
+ 0,
+ 0,
+ ""
+ }
+};
+
+
+const char *GuessMimeType(char *data, size_t dlen)
+{
+ int MimeIndex = 0;
+
+ while (MyMimes[MimeIndex].PatternLen != 0)
+ {
+ if ((MyMimes[MimeIndex].PatternLen +
+ MyMimes[MimeIndex].PatternOffset < dlen) &&
+ strncmp(MyMimes[MimeIndex].Pattern,
+ &data[MyMimes[MimeIndex].PatternOffset],
+ MyMimes[MimeIndex].PatternLen) == 0)
+ {
+ break;
+ }
+ MimeIndex ++;
+ }
+ return MyMimes[MimeIndex].MimeString;
+
+}