(no commit message)
authorWilfried Göesgens <willi@citadel.org>
Fri, 8 Feb 2008 21:42:33 +0000 (21:42 +0000)
committerWilfried Göesgens <willi@citadel.org>
Fri, 8 Feb 2008 21:42:33 +0000 (21:42 +0000)
libcitadel/configure.in
libcitadel/debian/rules
libcitadel/lib/libcitadel.h
libcitadel/lib/mime_parser.c

index 9e27abe6a9b5667de634b1d74c464d13e0df4762..532b35b87c11bd2d334983241173531e0773722b 100755 (executable)
@@ -5,7 +5,7 @@ dnl
 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)
index 8cb082d473070ad3a3e64affb57c27424b9d7576..2219e78da7edff126e830a3682d69d1d4fe30ecc 100755 (executable)
@@ -11,10 +11,10 @@ DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
 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
index 73813738dd053d3cbc7196fd40a4f5b717f97d32..edd37fb4c53bed6e768b82c03925ee2ff4d7cc86 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 
-#define LIBCITADEL_VERSION_NUMBER      103
+#define LIBCITADEL_VERSION_NUMBER      104
 
 /*
  * Here's a bunch of stupid magic to make the MIME parser portable.
@@ -168,6 +168,8 @@ void the_mime_parser(char *partnum,
                      int dont_decode
 );
 
+const char *GuessMimeType(char *data, size_t dlen);
+
 
 
 /* tools */
index 2b14d7129d9b1f8c79389af76104a42edc369e6c..a7753275afc1ac67928a3fe9802a8ee003e50ed7 100644 (file)
@@ -637,3 +637,63 @@ void mime_parser(char *content_start,
                        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;
+
+}