Codebase list mimetic / 8374ba1
[svn-upgrade] Integrating new upstream version, mimetic (0.9.2) gregor herrmann 17 years ago
26 changed file(s) with 954 addition(s) and 195 deletion(s). Raw diff Collapse all Expand all
0 x.x.x, 0.9.2
0 21.01.2007, 0.9.2
11 - Solaris compatibility fixes (thanks to Shan Will)
2 - itparser.h fixes (thanks to Phil Endecott and Joshua Chang)
3 - DateTime set fix
24
35 10.04.2006, 0.9.1
46 - utils.h: gcc 4.1 compatibility fix
0 Content-MD5 ?
1
2 test: multiple field w/ the same name must be preserved (Received:)
3
4 codecs bench/optimization
5
6 MimeEntity cpyctor & op=
7
8 b64 & qp examples converted to File::iterator
9
10 BUG: istring::find e istring::compare NON sono case insensitive
11
12 override MimeEntity::write for binary entities (application/* etc.) so
13 we don't need to store files in memory but we can just print them out
14 when needed
15
16 usare size_t(in config.h) invece di unsigned int
17
18 opt: create boundaries using char that are not allowed for
19 base64 encoded stuff
20
21 docs docs docs...
22
23 coding style check
24
25 MMFile and StdFile tests
26
27 MMFile and StdFile must be handled by configure
28
29 inline keyword where needed
30
31 omimeentity_iterator:
32 copy(beg,end,omimeentity_itarator<char>(entity))
33 imimeentity_iterator:
34 imimeentity_itarator beg(entity), end;
35 copy(beg,end, outputit)
36
37 char_type clean
38 error handling/codes
39
40 message/external-body
41
42 - message-id part-id
43 - multipart/related
44
45 rfc822 update:
46 - rfc 1123
47 - rfc 2822 (822bis)
48
49 todo:
50 -? usenet msg format test
51 rfc822:
52 - DateTie > < >= <= == !=
53 - DateTime() ctor == Now()
54 - tutte le classi devono ritornare la stringa di inizializzazione se
55 sono state costruite tramite stringa di input in modo da minimizzare
56 la differenza tra contenuti parsed e quelli reali
57 - field "\"" quoting support
58
59 -? field << Charset(IS08859-1) << base64str <<
60 Charset(ISO8859-4) << 34 << 55;
61 field.append(Charset(), base64str);
62
63 ::::
64 - uuencode binhex
65 - RFC2231
66 - check rfc2047
67
68 S/MIME
69 PGP/MIME
00 #! /bin/sh
1 # From configure.in Revision: 1.32 .
1 # From configure.in Revision: 1.35 .
22 # Guess values for system-dependent variables and create Makefiles.
33 # Generated by GNU Autoconf 2.59.
44 #
17771777
17781778 PACKAGE=mimetic
17791779
1780 VERSION=0.9.1
1780 VERSION=0.9.2
17811781
17821782 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
17831783 { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
2053020530 LDFLAGS="$LDFLAGS ${stlp_ldflags}"
2053120531 fi
2053220532
20533 CXXFLAGS="$CXXFLAGS -DHAVE_MIMETIC_CONFIG"
20534 CFLAGS="$CXXFLAGS"
20535
2053320536 echo "$as_me:$LINENO: checking STL required features" >&5
2053420537 echo $ECHO_N "checking STL required features... $ECHO_C" >&6
2053520538 cat >conftest.$ac_ext <<_ACEOF
2112321126 fi
2112421127
2112521128 fi
21129
21130
21131 for ac_header in sys/stat.h
21132 do
21133 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
21134 if eval "test \"\${$as_ac_Header+set}\" = set"; then
21135 echo "$as_me:$LINENO: checking for $ac_header" >&5
21136 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
21137 if eval "test \"\${$as_ac_Header+set}\" = set"; then
21138 echo $ECHO_N "(cached) $ECHO_C" >&6
21139 fi
21140 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
21141 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
21142 else
21143 # Is the header compilable?
21144 echo "$as_me:$LINENO: checking $ac_header usability" >&5
21145 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
21146 cat >conftest.$ac_ext <<_ACEOF
21147 /* confdefs.h. */
21148 _ACEOF
21149 cat confdefs.h >>conftest.$ac_ext
21150 cat >>conftest.$ac_ext <<_ACEOF
21151 /* end confdefs.h. */
21152 $ac_includes_default
21153 #include <$ac_header>
21154 _ACEOF
21155 rm -f conftest.$ac_objext
21156 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
21157 (eval $ac_compile) 2>conftest.er1
21158 ac_status=$?
21159 grep -v '^ *+' conftest.er1 >conftest.err
21160 rm -f conftest.er1
21161 cat conftest.err >&5
21162 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21163 (exit $ac_status); } &&
21164 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
21165 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
21166 (eval $ac_try) 2>&5
21167 ac_status=$?
21168 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21169 (exit $ac_status); }; } &&
21170 { ac_try='test -s conftest.$ac_objext'
21171 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
21172 (eval $ac_try) 2>&5
21173 ac_status=$?
21174 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21175 (exit $ac_status); }; }; then
21176 ac_header_compiler=yes
21177 else
21178 echo "$as_me: failed program was:" >&5
21179 sed 's/^/| /' conftest.$ac_ext >&5
21180
21181 ac_header_compiler=no
21182 fi
21183 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
21184 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
21185 echo "${ECHO_T}$ac_header_compiler" >&6
21186
21187 # Is the header present?
21188 echo "$as_me:$LINENO: checking $ac_header presence" >&5
21189 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
21190 cat >conftest.$ac_ext <<_ACEOF
21191 /* confdefs.h. */
21192 _ACEOF
21193 cat confdefs.h >>conftest.$ac_ext
21194 cat >>conftest.$ac_ext <<_ACEOF
21195 /* end confdefs.h. */
21196 #include <$ac_header>
21197 _ACEOF
21198 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
21199 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
21200 ac_status=$?
21201 grep -v '^ *+' conftest.er1 >conftest.err
21202 rm -f conftest.er1
21203 cat conftest.err >&5
21204 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21205 (exit $ac_status); } >/dev/null; then
21206 if test -s conftest.err; then
21207 ac_cpp_err=$ac_cxx_preproc_warn_flag
21208 ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
21209 else
21210 ac_cpp_err=
21211 fi
21212 else
21213 ac_cpp_err=yes
21214 fi
21215 if test -z "$ac_cpp_err"; then
21216 ac_header_preproc=yes
21217 else
21218 echo "$as_me: failed program was:" >&5
21219 sed 's/^/| /' conftest.$ac_ext >&5
21220
21221 ac_header_preproc=no
21222 fi
21223 rm -f conftest.err conftest.$ac_ext
21224 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
21225 echo "${ECHO_T}$ac_header_preproc" >&6
21226
21227 # So? What about this header?
21228 case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
21229 yes:no: )
21230 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
21231 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
21232 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
21233 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
21234 ac_header_preproc=yes
21235 ;;
21236 no:yes:* )
21237 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
21238 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
21239 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
21240 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
21241 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
21242 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
21243 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
21244 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
21245 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
21246 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
21247 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
21248 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
21249 (
21250 cat <<\_ASBOX
21251 ## ------------------------------------------ ##
21252 ## Report this to the AC_PACKAGE_NAME lists. ##
21253 ## ------------------------------------------ ##
21254 _ASBOX
21255 ) |
21256 sed "s/^/$as_me: WARNING: /" >&2
21257 ;;
21258 esac
21259 echo "$as_me:$LINENO: checking for $ac_header" >&5
21260 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
21261 if eval "test \"\${$as_ac_Header+set}\" = set"; then
21262 echo $ECHO_N "(cached) $ECHO_C" >&6
21263 else
21264 eval "$as_ac_Header=\$ac_header_preproc"
21265 fi
21266 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
21267 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
21268
21269 fi
21270 if test `eval echo '${'$as_ac_Header'}'` = yes; then
21271 cat >>confdefs.h <<_ACEOF
21272 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
21273 _ACEOF
21274
21275 fi
21276
21277 done
21278
21279
21280 for ac_header in sys/types.h
21281 do
21282 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
21283 if eval "test \"\${$as_ac_Header+set}\" = set"; then
21284 echo "$as_me:$LINENO: checking for $ac_header" >&5
21285 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
21286 if eval "test \"\${$as_ac_Header+set}\" = set"; then
21287 echo $ECHO_N "(cached) $ECHO_C" >&6
21288 fi
21289 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
21290 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
21291 else
21292 # Is the header compilable?
21293 echo "$as_me:$LINENO: checking $ac_header usability" >&5
21294 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
21295 cat >conftest.$ac_ext <<_ACEOF
21296 /* confdefs.h. */
21297 _ACEOF
21298 cat confdefs.h >>conftest.$ac_ext
21299 cat >>conftest.$ac_ext <<_ACEOF
21300 /* end confdefs.h. */
21301 $ac_includes_default
21302 #include <$ac_header>
21303 _ACEOF
21304 rm -f conftest.$ac_objext
21305 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
21306 (eval $ac_compile) 2>conftest.er1
21307 ac_status=$?
21308 grep -v '^ *+' conftest.er1 >conftest.err
21309 rm -f conftest.er1
21310 cat conftest.err >&5
21311 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21312 (exit $ac_status); } &&
21313 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
21314 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
21315 (eval $ac_try) 2>&5
21316 ac_status=$?
21317 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21318 (exit $ac_status); }; } &&
21319 { ac_try='test -s conftest.$ac_objext'
21320 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
21321 (eval $ac_try) 2>&5
21322 ac_status=$?
21323 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21324 (exit $ac_status); }; }; then
21325 ac_header_compiler=yes
21326 else
21327 echo "$as_me: failed program was:" >&5
21328 sed 's/^/| /' conftest.$ac_ext >&5
21329
21330 ac_header_compiler=no
21331 fi
21332 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
21333 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
21334 echo "${ECHO_T}$ac_header_compiler" >&6
21335
21336 # Is the header present?
21337 echo "$as_me:$LINENO: checking $ac_header presence" >&5
21338 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
21339 cat >conftest.$ac_ext <<_ACEOF
21340 /* confdefs.h. */
21341 _ACEOF
21342 cat confdefs.h >>conftest.$ac_ext
21343 cat >>conftest.$ac_ext <<_ACEOF
21344 /* end confdefs.h. */
21345 #include <$ac_header>
21346 _ACEOF
21347 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
21348 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
21349 ac_status=$?
21350 grep -v '^ *+' conftest.er1 >conftest.err
21351 rm -f conftest.er1
21352 cat conftest.err >&5
21353 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21354 (exit $ac_status); } >/dev/null; then
21355 if test -s conftest.err; then
21356 ac_cpp_err=$ac_cxx_preproc_warn_flag
21357 ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
21358 else
21359 ac_cpp_err=
21360 fi
21361 else
21362 ac_cpp_err=yes
21363 fi
21364 if test -z "$ac_cpp_err"; then
21365 ac_header_preproc=yes
21366 else
21367 echo "$as_me: failed program was:" >&5
21368 sed 's/^/| /' conftest.$ac_ext >&5
21369
21370 ac_header_preproc=no
21371 fi
21372 rm -f conftest.err conftest.$ac_ext
21373 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
21374 echo "${ECHO_T}$ac_header_preproc" >&6
21375
21376 # So? What about this header?
21377 case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
21378 yes:no: )
21379 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
21380 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
21381 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
21382 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
21383 ac_header_preproc=yes
21384 ;;
21385 no:yes:* )
21386 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
21387 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
21388 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
21389 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
21390 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
21391 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
21392 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
21393 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
21394 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
21395 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
21396 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
21397 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
21398 (
21399 cat <<\_ASBOX
21400 ## ------------------------------------------ ##
21401 ## Report this to the AC_PACKAGE_NAME lists. ##
21402 ## ------------------------------------------ ##
21403 _ASBOX
21404 ) |
21405 sed "s/^/$as_me: WARNING: /" >&2
21406 ;;
21407 esac
21408 echo "$as_me:$LINENO: checking for $ac_header" >&5
21409 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
21410 if eval "test \"\${$as_ac_Header+set}\" = set"; then
21411 echo $ECHO_N "(cached) $ECHO_C" >&6
21412 else
21413 eval "$as_ac_Header=\$ac_header_preproc"
21414 fi
21415 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
21416 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
21417
21418 fi
21419 if test `eval echo '${'$as_ac_Header'}'` = yes; then
21420 cat >>confdefs.h <<_ACEOF
21421 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
21422 _ACEOF
21423
21424 fi
21425
21426 done
2112621427
2112721428
2112821429 for ac_header in sys/time.h
00 dnl Process this file with autoconf to produce a configure script.
1 AC_REVISION($Revision: 1.32 $)
1 AC_REVISION($Revision: 1.35 $)
22 AC_INIT(mimetic/mimetic.h)
33 AC_CANONICAL_SYSTEM
44
5 AM_INIT_AUTOMAKE(mimetic,0.9.1)
5 AM_INIT_AUTOMAKE(mimetic,0.9.2)
66 AM_CONFIG_HEADER(mimetic/config.h)
77
88 dnl Checks for programs.
149149 LDFLAGS="$LDFLAGS ${stlp_ldflags}"
150150 fi
151151
152 CXXFLAGS="$CXXFLAGS -DHAVE_MIMETIC_CONFIG"
153 CFLAGS="$CXXFLAGS"
154
152155 dnl ** check for STL required features
153156 AC_MSG_CHECKING([STL required features])
154157 AC_TRY_COMPILE([#include <string>],
170173 AC_TYPE_UID_T
171174
172175 AC_HEADER_DIRENT
176 AC_CHECK_HEADERS(sys/stat.h)
177 AC_CHECK_HEADERS(sys/types.h)
173178 AC_CHECK_HEADERS(sys/time.h)
174179 AC_CHECK_HEADERS(stdint.h)
175180
00 EXTRA_DIST=test.msg
11 INCLUDES=-I$(top_srcdir)
22 LDADD=../mimetic/libmimetic.la
3 EXAMPLES=b64 qp exbin structure catpart buildidx search mbox mm
3 EXAMPLES=b64 qp exbin structure catpart buildidx search mbox mm \
4 smime2xml smimestruct
45
56 clean-local:
6 rm -f b64 qp exbin structure catpart buildidx search mbox mm
7 rm -f b64 qp exbin structure catpart buildidx search mbox mm \
8 smime2xml smimestruct
79
810 examples: $(EXAMPLES)
911
2628 mbox_SOURCES=mbox.cxx
2729
2830 mm_SOURCES=mm.cxx mm.h engine.h engine.cxx cmdline.cxx cmdline.h
31
32 smimestruct_SOURCES=smimestruct.cxx
33 smimestruct_LDADD=-lcrypto -lssl ../mimetic/libmimetic.la
34
35 smime2xml_SOURCES=smime2xml.cxx
36 smime2xml_LDADD=-lcrypto -lssl ../mimetic/libmimetic.la
37
9292 EXTRA_DIST = test.msg
9393 INCLUDES = -I$(top_srcdir)
9494 LDADD = ../mimetic/libmimetic.la
95 EXAMPLES = b64 qp exbin structure catpart buildidx search mbox mm
95 EXAMPLES = b64 qp exbin structure catpart buildidx search mbox mm smime2xml smimestruct
96
9697
9798 EXTRA_PROGRAMS = $(EXAMPLES)
9899
113114 mbox_SOURCES = mbox.cxx
114115
115116 mm_SOURCES = mm.cxx mm.h engine.h engine.cxx cmdline.cxx cmdline.h
117
118 smimestruct_SOURCES = smimestruct.cxx
119 smimestruct_LDADD = -lcrypto -lssl ../mimetic/libmimetic.la
120
121 smime2xml_SOURCES = smime2xml.cxx
122 smime2xml_LDADD = -lcrypto -lssl ../mimetic/libmimetic.la
116123 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
117124 CONFIG_HEADER = ../mimetic/config.h
118125 CONFIG_CLEAN_FILES =
157164 mm_LDADD = $(LDADD)
158165 mm_DEPENDENCIES = ../mimetic/libmimetic.la
159166 mm_LDFLAGS =
167 smime2xml_OBJECTS = smime2xml.$(OBJEXT)
168 smime2xml_DEPENDENCIES = ../mimetic/libmimetic.la
169 smime2xml_LDFLAGS =
170 smimestruct_OBJECTS = smimestruct.$(OBJEXT)
171 smimestruct_DEPENDENCIES = ../mimetic/libmimetic.la
172 smimestruct_LDFLAGS =
160173 CXXFLAGS = @CXXFLAGS@
161174 CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
162175 LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
174187
175188 TAR = tar
176189 GZIP_ENV = --best
177 SOURCES = $(b64_SOURCES) $(qp_SOURCES) $(exbin_SOURCES) $(structure_SOURCES) $(catpart_SOURCES) $(buildidx_SOURCES) $(search_SOURCES) $(mbox_SOURCES) $(mm_SOURCES)
178 OBJECTS = $(b64_OBJECTS) $(qp_OBJECTS) $(exbin_OBJECTS) $(structure_OBJECTS) $(catpart_OBJECTS) $(buildidx_OBJECTS) $(search_OBJECTS) $(mbox_OBJECTS) $(mm_OBJECTS)
190 SOURCES = $(b64_SOURCES) $(qp_SOURCES) $(exbin_SOURCES) $(structure_SOURCES) $(catpart_SOURCES) $(buildidx_SOURCES) $(search_SOURCES) $(mbox_SOURCES) $(mm_SOURCES) $(smime2xml_SOURCES) $(smimestruct_SOURCES)
191 OBJECTS = $(b64_OBJECTS) $(qp_OBJECTS) $(exbin_OBJECTS) $(structure_OBJECTS) $(catpart_OBJECTS) $(buildidx_OBJECTS) $(search_OBJECTS) $(mbox_OBJECTS) $(mm_OBJECTS) $(smime2xml_OBJECTS) $(smimestruct_OBJECTS)
179192
180193 all: all-redirect
181194 .SUFFIXES:
267280 mm$(EXEEXT): $(mm_OBJECTS) $(mm_DEPENDENCIES)
268281 @rm -f mm$(EXEEXT)
269282 $(CXXLINK) $(mm_LDFLAGS) $(mm_OBJECTS) $(mm_LDADD) $(LIBS)
283
284 smime2xml$(EXEEXT): $(smime2xml_OBJECTS) $(smime2xml_DEPENDENCIES)
285 @rm -f smime2xml$(EXEEXT)
286 $(CXXLINK) $(smime2xml_LDFLAGS) $(smime2xml_OBJECTS) $(smime2xml_LDADD) $(LIBS)
287
288 smimestruct$(EXEEXT): $(smimestruct_OBJECTS) $(smimestruct_DEPENDENCIES)
289 @rm -f smimestruct$(EXEEXT)
290 $(CXXLINK) $(smimestruct_LDFLAGS) $(smimestruct_OBJECTS) $(smimestruct_LDADD) $(LIBS)
270291 .cxx.o:
271292 $(CXXCOMPILE) -c $<
272293 .cxx.obj:
318339 || cp -p $$d/$$file $(distdir)/$$file || :; \
319340 fi; \
320341 done
342 smimestruct.o: smimestruct.cxx ../mimetic/mimetic.h \
343 ../mimetic/libconfig.h ../mimetic/config.h ../mimetic/version.h \
344 ../mimetic/body.h ../mimetic/rfc822/body.h \
345 ../mimetic/codec/code.h ../mimetic/codec/codec_base.h \
346 ../mimetic/codec/codec_chain.h ../mimetic/codec/other_codecs.h \
347 ../mimetic/utils.h ../mimetic/strutils.h \
348 ../mimetic/mimeentitylist.h ../mimetic/os/file.h \
349 ../mimetic/os/stdfile.h ../mimetic/os/fileop.h \
350 ../mimetic/os/file_iterator.h ../mimetic/os/mmfile.h \
351 ../mimetic/circular_buffer.h ../mimetic/contentdescription.h \
352 ../mimetic/rfc822/fieldvalue.h ../mimetic/contentdisposition.h \
353 ../mimetic/fieldparam.h ../mimetic/contenttransferencoding.h \
354 ../mimetic/contenttype.h ../mimetic/header.h \
355 ../mimetic/rfc822/header.h ../mimetic/rfc822/field.h \
356 ../mimetic/rfc822/mailbox.h ../mimetic/rfc822/messageid.h \
357 ../mimetic/os/utils.h ../mimetic/rfc822/mailboxlist.h \
358 ../mimetic/rfc822/addresslist.h ../mimetic/rfc822/address.h \
359 ../mimetic/rfc822/group.h ../mimetic/mimeversion.h \
360 ../mimetic/contentid.h ../mimetic/message.h \
361 ../mimetic/mimeentity.h ../mimetic/codec/codec.h \
362 ../mimetic/codec/base64.h ../mimetic/codec/qp.h \
363 ../mimetic/parser/itparserdecl.h ../mimetic/streambufs.h \
364 ../mimetic/tokenizer.h ../mimetic/os/os.h \
365 ../mimetic/parser/itparser.h ../mimetic/tree.h
321366
322367 info-am:
323368 info: info-am
390435
391436
392437 clean-local:
393 rm -f b64 qp exbin structure catpart buildidx search mbox mm
438 rm -f b64 qp exbin structure catpart buildidx search mbox mm \
439 smime2xml smimestruct
394440
395441 examples: $(EXAMPLES)
396442
0 #include <iostream>
1 #include <fstream>
2 #include <sstream>
3 #include <iterator>
4 #include <streambuf>
5 #include <mimetic/mimetic.h>
6 #include <mimetic/utils.h>
7 #include <openssl/bio.h>
8 #include <openssl/pkcs7.h>
9 #include <openssl/x509.h>
10 #include <openssl/err.h>
11 #include <openssl/ssl.h>
12
13 using namespace std;
14 using namespace mimetic;
15
16 void printMimeStructure(MimeEntity* pMe, int tabcount = 0);
17
18 int g_verbose; // verbose mode on/off
19 int g_quiet; // quiet mode
20
21 void printTabs(int c)
22 {
23 while(c--)
24 cout << " ";
25 }
26
27 int bca_pkcs7_verify(PKCS7 *p7)
28 {
29 return ~0;
30 }
31
32 int pkcs7MimeHandle(MimeEntity* pMe, int tabcount)
33 {
34 BIO *in = NULL, *content = NULL;
35 PKCS7 *p7 = NULL;
36 long sz;
37 char *pdata = NULL;
38 int rc = ~0, vfy, iMask = imPreamble | imEpilogue;
39 string me_str;
40 Header& h = pMe->header();
41 ContentType ct = h.contentType();
42
43 {
44 stringstream ss;
45 ss << *pMe;
46 me_str = ss.str();
47 }
48
49 in = BIO_new_mem_buf((void*)me_str.c_str(), me_str.length());
50 if(in == NULL)
51 goto err;
52 BIO_set_mem_eof_return(in, 0);
53
54 p7 = SMIME_read_PKCS7(in, &content);
55 if(p7 == NULL)
56 goto err;
57
58 vfy = bca_pkcs7_verify(p7);
59
60 if(content == NULL)
61 {
62 content = PKCS7_dataInit(p7, NULL);
63 if(content == NULL)
64 goto err;
65 } else {
66 ; /* multipart/signed, content is the cleartext message part */
67 goto err;
68 }
69
70 sz = BIO_get_mem_data(content, &pdata);
71 if(sz > 0 && pdata)
72 {
73 MimeEntity me(pdata, pdata + sz, iMask);
74 printMimeStructure(&me, 1 + tabcount);
75 }
76
77 /* success */
78 rc = 0;
79 err:
80 if(in)
81 BIO_free(in);
82 if(content)
83 BIO_free(content);
84 if(p7)
85 PKCS7_free(p7);
86 if(rc)
87 ERR_print_errors_fp(stderr);
88 return rc;
89 }
90
91 void printMimeStructure(MimeEntity* pMe, int tabcount)
92 {
93 Header& h = pMe->header();
94 ContentType ct = h.contentType();
95 ContentId ci = h.contentId();
96 ContentDisposition cd = h.contentDisposition();
97 ContentDescription cds = h.contentDescription();
98
99 cout << "<mime-content>" << endl;
100 cout << "<mime-info>" << endl;
101 cout << "<content-type>" <<
102 ct.type() << "/" << ct.subtype() <<
103 "</content-type>" << endl;
104 if(ci.str().length())
105 ;//cout << "<content-id>" << ci.str() << "</content-id>" << endl;
106 if(h.hasField("subject"))
107 cout << "<subject>" << h.field("subject").value() << "</subject>" <<
108 endl;
109 if(cd.param("filename").length())
110 cout << "<filename>" << cd.param("filename") << "</filename>" <<
111 endl;
112 if(cds.str().length())
113 cout << "<description>" << cds.str() << "</description>" << endl;
114
115 cout << "</mime-info>" << endl;
116
117 if(ct.isMultipart() ||
118 (ct.type() == "message" && ct.subtype() == "rfc822"))
119 {
120 if(ct.subtype() == "signed")
121 {
122 cerr << "S/MIME multipart/signed not yet supported!" << endl;
123 exit(1);
124 } else {
125 //printTabs(tabcount);
126 //cout << ct.type() << "/" << ct.subtype() << endl;
127
128 MimeEntityList::iterator mbit = pMe->body().parts().begin(),
129 meit = pMe->body().parts().end();
130 cout << "<structured-data>" << endl;
131 for(; mbit != meit; ++mbit)
132 {
133 printMimeStructure(*mbit, 1 + tabcount);
134 }
135 cout << "</structured-data>" << endl;
136 }
137 } else {
138 if(ct.type() == "application" &&
139 (ct.subtype() == "x-pkcs7-mime" || ct.subtype() == "pkcs7-mime"))
140 {
141 cout << "<structured-data>" << endl;
142 pkcs7MimeHandle(pMe, tabcount);
143 cout << "</structured-data>" << endl;
144 } else {
145 ;//printTabs(tabcount);
146 ;//cout << ct.type() << "/" << ct.subtype() << endl;
147 }
148 }
149 cout << "</mime-content>" << endl;
150 }
151
152 void usage()
153 {
154 cout << "smime2xml in_file" << endl;
155 cout << " -v Verbose mode" << endl;
156 cout << " -q totaly quiet; exit code = num of entities" << endl;
157 cout << endl;
158 exit(1);
159 }
160
161 int main(int argc, char** argv)
162 {
163 std::ios_base::sync_with_stdio(false);
164 int fidx = 1;
165 int iMask = imPreamble | imEpilogue;
166
167 /* Initialize the OpenSSL engine. */
168 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
169 OpenSSL_add_all_algorithms();
170 ERR_load_crypto_strings();
171
172 if(argc > 1)
173 {
174 g_verbose = 0;
175 string first = argv[1];
176 if(first == "-h")
177 usage();
178 else if(first == "-v")
179 g_verbose = 1;
180 else if(first == "-q")
181 g_quiet = 1;
182 fidx = (g_verbose || g_quiet ? 2 : 1); // first filename idx
183 }
184 if(argc == fidx)
185 {
186 istreambuf_iterator<char> bit(std::cin), eit;
187 MimeEntity me(bit,eit, iMask);
188 printMimeStructure(&me);
189 } else {
190 for(int fc = fidx; fc < argc; ++fc)
191 {
192 File in(argv[fc]);
193 if(!in)
194 {
195 cerr << "ERR: unable to open file "
196 << argv[fc]
197 << endl;
198 continue;
199 }
200 MimeEntity me(in.begin(), in.end(),iMask);
201 if(!me.header().hasField("content-type"))
202 { /* no content-type found, consider it a CMS */
203 me.header().contentType().set("application/x-pkcs7-mime");
204 }
205 printMimeStructure(&me);
206 }
207 }
208 return 0;
209 }
210
0 #include <iostream>
1 #include <fstream>
2 #include <sstream>
3 #include <iterator>
4 #include <streambuf>
5 #include <mimetic/mimetic.h>
6 #include <mimetic/utils.h>
7 #include <openssl/bio.h>
8 #include <openssl/pkcs7.h>
9 #include <openssl/x509.h>
10 #include <openssl/err.h>
11 #include <openssl/ssl.h>
12
13 using namespace std;
14 using namespace mimetic;
15
16 void printMimeStructure(MimeEntity* pMe, int tabcount = 0);
17
18 int g_verbose; // verbose mode on/off
19 int g_quiet; // quiet mode
20 int g_entityCount; // num of entities found
21
22 void printTabs(int c)
23 {
24 while(c--)
25 cout << " ";
26 }
27
28 int bca_pkcs7_verify(PKCS7 *p7)
29 {
30 return ~0;
31 }
32
33 int pkcs7MimeHandle(MimeEntity* pMe, int tabcount)
34 {
35 BIO *in = NULL, *content = NULL;
36 PKCS7 *p7 = NULL;
37 long sz;
38 char *pdata = NULL;
39 int rc = ~0, vfy, iMask = imPreamble | imEpilogue;
40 string me_str;
41 Header& h = pMe->header();
42 ContentType ct = h.contentType();
43
44 {
45 stringstream ss;
46 ss << *pMe;
47 me_str = ss.str();
48 }
49
50 in = BIO_new_mem_buf((void*)me_str.c_str(), me_str.length());
51 if(in == NULL)
52 goto err;
53 BIO_set_mem_eof_return(in, 0);
54
55 p7 = SMIME_read_PKCS7(in, &content);
56 if(p7 == NULL)
57 goto err;
58
59 vfy = bca_pkcs7_verify(p7);
60
61 printTabs(tabcount);
62 cout << ct.type() << "/" << ct.subtype()
63 << " (verify " << (vfy == 0 ? "ok" : "failed") << ")"
64 << endl;
65
66 if(content == NULL)
67 {
68 content = PKCS7_dataInit(p7, NULL);
69 if(content == NULL)
70 goto err;
71 } else {
72 ; /* multipart/signed, content is the cleartext message part */
73 goto err;
74 }
75
76 sz = BIO_get_mem_data(content, &pdata);
77 if(sz > 0 && pdata)
78 {
79 MimeEntity me(pdata, pdata + sz, iMask);
80 printMimeStructure(&me, 1 + tabcount);
81 }
82
83 /* success */
84 rc = 0;
85 err:
86 if(in)
87 BIO_free(in);
88 if(content)
89 BIO_free(content);
90 if(p7)
91 PKCS7_free(p7);
92 if(rc)
93 ERR_print_errors_fp(stderr);
94 return rc;
95 }
96
97
98 void printMimeStructure(MimeEntity* pMe, int tabcount)
99 {
100 Header& h = pMe->header();
101 ContentType ct = h.contentType();
102 ContentId ci = h.contentId();
103
104 ++g_entityCount;
105
106 if(ct.isMultipart() ||
107 (ct.type() == "message" && ct.subtype() == "rfc822"))
108 {
109 if(ct.subtype() == "signed")
110 {
111 cerr << "S/MIME multipart/signed not yet supported!" << endl;
112 exit(1);
113 #if 0
114 if(pMe->body().parts().size() != 2)
115 cerr << "bad message!" << endl;
116 if(smimeVerify(pMe))
117 cerr << "S/MIME verification failed" << endl;
118 #endif
119 } else {
120 printTabs(tabcount);
121 cout << ct.type() << "/" << ct.subtype() << endl;
122
123 MimeEntityList::iterator mbit = pMe->body().parts().begin(),
124 meit = pMe->body().parts().end();
125 for(; mbit != meit; ++mbit)
126 printMimeStructure(*mbit, 1 + tabcount);
127 }
128 } else {
129 if(ct.type() == "application" &&
130 (ct.subtype() == "x-pkcs7-mime" || ct.subtype() == "pkcs7-mime"))
131 {
132 pkcs7MimeHandle(pMe, tabcount);
133 } else {
134 printTabs(tabcount);
135 cout << ct.type() << "/" << ct.subtype() << endl;
136 }
137 }
138 }
139
140
141
142 void usage()
143 {
144 cout << "structure [-v] [in_file]..." << endl;
145 cout << " -v Verbose mode" << endl;
146 cout << " -q totaly quiet; exit code = num of entities" << endl;
147 cout << endl;
148 exit(1);
149 }
150
151
152 int main(int argc, char** argv)
153 {
154 std::ios_base::sync_with_stdio(false);
155 int fidx = 1;
156 //int iMask = imBody | imPreamble | imEpilogue;
157 int iMask = imPreamble | imEpilogue;
158
159 /* Initialize the OpenSSL engine. */
160 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
161 OpenSSL_add_all_algorithms();
162 ERR_load_crypto_strings();
163
164 if(argc > 1)
165 {
166 g_verbose = 0;
167 string first = argv[1];
168 if(first == "-h")
169 usage();
170 else if(first == "-v")
171 g_verbose = 1;
172 else if(first == "-q")
173 g_quiet = 1;
174 fidx = (g_verbose || g_quiet ? 2 : 1); // first filename idx
175 }
176 if(argc == fidx)
177 {
178 istreambuf_iterator<char> bit(std::cin), eit;
179 MimeEntity me(bit,eit, iMask);
180 printMimeStructure(&me);
181 } else {
182 for(int fc = fidx; fc < argc; ++fc)
183 {
184 File in(argv[fc]);
185 if(!in)
186 {
187 cerr << "ERR: unable to open file "
188 << argv[fc]
189 << endl;
190 continue;
191 }
192 MimeEntity me(in.begin(), in.end(),iMask);
193 printMimeStructure(&me);
194 }
195 }
196 return g_entityCount;
197 }
198
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: structure.cxx,v 1.2 2005/02/23 10:26:14 tat Exp $
4 $Id: structure.cxx,v 1.5 2007/01/21 14:55:33 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
1818 * Reads in_file (or standard input) and writes its MIME structure to out_file
1919 * (or standard output)
2020 */
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
2421
2522 #include <iostream>
2623 #include <fstream>
5047 {
5148 Header& h = pMe->header();
5249 ContentType ct = h.contentType();
50 cout << g_entityCount << " ";
5351 printTabs(tabcount);
5452 cout << ct.type() << "/" << ct.subtype() << endl;
5553 if(g_verbose)
131129 exit(1);
132130 }
133131
134
135132 int main(int argc, char** argv)
136133 {
137134 std::ios_base::sync_with_stdio(false);
138135 int fidx = 1;
139136 int iMask = imBody | imPreamble | imEpilogue;
137
140138 if(argc > 1)
141139 {
142140 g_verbose = 0;
88 include_HEADERS= \
99 body.h contenttransferencoding.h mimeentity.h tokenizer.h \
1010 circular_buffer.h contenttype.h mimeentitylist.h tree.h \
11 fieldparam.h mimetic.h utils.h config.h \
11 fieldparam.h mimetic.h utils.h \
1212 contentdescription.h header.h mimeversion.h version.h \
1313 contentdisposition.h libconfig.h streambufs.h \
1414 contentid.h message.h strutils.h
9696 #CPPFLAGS=-Winline
9797 includedir = @INCLUDEDIR@
9898
99 include_HEADERS = body.h contenttransferencoding.h mimeentity.h tokenizer.h circular_buffer.h contenttype.h mimeentitylist.h tree.h fieldparam.h mimetic.h utils.h config.h contentdescription.h header.h mimeversion.h version.h contentdisposition.h libconfig.h streambufs.h contentid.h message.h strutils.h
99 include_HEADERS = body.h contenttransferencoding.h mimeentity.h tokenizer.h circular_buffer.h contenttype.h mimeentitylist.h tree.h fieldparam.h mimetic.h utils.h contentdescription.h header.h mimeversion.h version.h contentdisposition.h libconfig.h streambufs.h contentid.h message.h strutils.h
100100
101101
102102 libmimetic_la_SOURCES = body.cxx contenttransferencoding.cxx message.cxx utils.cxx contentdescription.cxx contenttype.cxx mimeentity.cxx version.cxx contentdisposition.cxx fieldparam.cxx mimeversion.cxx contentid.cxx header.cxx strutils.cxx
393393 codec/code.h codec/other_codecs.h os/file.h os/stdfile.h \
394394 os/fileop.h os/file_iterator.h os/mmfile.h header.h \
395395 rfc822/header.h rfc822/field.h rfc822/mailbox.h \
396 rfc822/messageid.h config.h os/utils.h rfc822/mailboxlist.h \
396 rfc822/messageid.h os/utils.h rfc822/mailboxlist.h \
397397 rfc822/addresslist.h rfc822/address.h rfc822/group.h \
398398 contentid.h contentdescription.h body.h rfc822/body.h \
399399 parser/itparserdecl.h streambufs.h
414414 utils.h libconfig.h config.h
415415 header.lo header.o : header.cxx header.h rfc822/header.h strutils.h \
416416 utils.h libconfig.h config.h rfc822/field.h rfc822/fieldvalue.h \
417 rfc822/mailbox.h rfc822/messageid.h config.h os/utils.h \
417 rfc822/mailbox.h rfc822/messageid.h os/utils.h \
418418 rfc822/mailboxlist.h rfc822/addresslist.h rfc822/address.h \
419419 rfc822/group.h mimeversion.h version.h contenttype.h \
420420 fieldparam.h contentid.h contenttransferencoding.h \
427427 codec/base64.h circular_buffer.h codec/qp.h codec/code.h \
428428 codec/other_codecs.h os/file.h os/stdfile.h os/fileop.h \
429429 os/file_iterator.h os/mmfile.h header.h rfc822/header.h \
430 rfc822/field.h rfc822/mailbox.h rfc822/messageid.h config.h \
431 os/utils.h rfc822/mailboxlist.h rfc822/addresslist.h \
432 rfc822/address.h rfc822/group.h contentid.h \
433 contentdescription.h body.h rfc822/body.h parser/itparserdecl.h \
434 streambufs.h
430 rfc822/field.h rfc822/mailbox.h rfc822/messageid.h os/utils.h \
431 rfc822/mailboxlist.h rfc822/addresslist.h rfc822/address.h \
432 rfc822/group.h contentid.h contentdescription.h body.h \
433 rfc822/body.h parser/itparserdecl.h streambufs.h
435434 mimeentity.lo mimeentity.o : mimeentity.cxx mimeentity.h strutils.h \
436435 utils.h libconfig.h config.h contenttype.h rfc822/fieldvalue.h \
437436 fieldparam.h contenttransferencoding.h contentdisposition.h \
440439 circular_buffer.h codec/qp.h codec/code.h codec/other_codecs.h \
441440 os/file.h os/stdfile.h os/fileop.h os/file_iterator.h \
442441 os/mmfile.h header.h rfc822/header.h rfc822/field.h \
443 rfc822/mailbox.h rfc822/messageid.h config.h os/utils.h \
442 rfc822/mailbox.h rfc822/messageid.h os/utils.h \
444443 rfc822/mailboxlist.h rfc822/addresslist.h rfc822/address.h \
445444 rfc822/group.h contentid.h contentdescription.h body.h \
446445 rfc822/body.h parser/itparserdecl.h streambufs.h tokenizer.h \
450449 config.h
451450 strutils.lo strutils.o : strutils.cxx strutils.h
452451 utils.lo utils.o : utils.cxx utils.h libconfig.h config.h strutils.h
453 version.lo version.o : version.cxx version.h utils.h libconfig.h \
454 config.h strutils.h tokenizer.h
452 version.lo version.o : version.cxx config.h version.h utils.h \
453 libconfig.h strutils.h tokenizer.h
455454
456455 info-am:
457456 info: info-recursive
+0
-95
mimetic/config.h less more
0 /* mimetic/config.h. Generated by configure. */
1 /* mimetic/config.h.in. Generated from configure.in by autoheader. */
2
3 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
4 */
5 #define HAVE_DIRENT_H 1
6
7 /* Define to 1 if you have the <dlfcn.h> header file. */
8 #define HAVE_DLFCN_H 1
9
10 /* Define to 1 if you have the `getpagesize' function. */
11 #define HAVE_GETPAGESIZE 1
12
13 /* Define to 1 if you have the <inttypes.h> header file. */
14 #define HAVE_INTTYPES_H 1
15
16 /* Define to 1 if you have the `madvise' function. */
17 #define HAVE_MADVISE 1
18
19 /* Define to 1 if you have the <memory.h> header file. */
20 #define HAVE_MEMORY_H 1
21
22 /* Define to 1 if you have a working `mmap' system call. */
23 #define HAVE_MMAP 1
24
25 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
26 /* #undef HAVE_NDIR_H */
27
28 /* Define to 1 if you have the <stdint.h> header file. */
29 #define HAVE_STDINT_H 1
30
31 /* Define to 1 if you have the <stdlib.h> header file. */
32 #define HAVE_STDLIB_H 1
33
34 /* Define to 1 if you have the <strings.h> header file. */
35 #define HAVE_STRINGS_H 1
36
37 /* Define to 1 if you have the <string.h> header file. */
38 #define HAVE_STRING_H 1
39
40 /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
41 */
42 /* #undef HAVE_SYS_DIR_H */
43
44 /* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
45 */
46 /* #undef HAVE_SYS_NDIR_H */
47
48 /* Define to 1 if you have the <sys/stat.h> header file. */
49 #define HAVE_SYS_STAT_H 1
50
51 /* Define to 1 if you have the <sys/time.h> header file. */
52 #define HAVE_SYS_TIME_H 1
53
54 /* Define to 1 if you have the <sys/types.h> header file. */
55 #define HAVE_SYS_TYPES_H 1
56
57 /* Define to 1 if you have the <unistd.h> header file. */
58 #define HAVE_UNISTD_H 1
59
60 /* Name of package */
61 #define PACKAGE "mimetic"
62
63 /* Define to the address where bug reports for this package should be sent. */
64 #define PACKAGE_BUGREPORT ""
65
66 /* Define to the full name of this package. */
67 #define PACKAGE_NAME ""
68
69 /* Define to the full name and version of this package. */
70 #define PACKAGE_STRING ""
71
72 /* Define to the one symbol short name of this package. */
73 #define PACKAGE_TARNAME ""
74
75 /* Define to the version of this package. */
76 #define PACKAGE_VERSION ""
77
78 /* Define to 1 if you have the ANSI C header files. */
79 #define STDC_HEADERS 1
80
81 /* Version number of package */
82 #define VERSION "0.9.1"
83
84 /* Define to `int' if <sys/types.h> doesn't define. */
85 /* #undef gid_t */
86
87 /* Define to `long' if <sys/types.h> does not define. */
88 /* #undef off_t */
89
90 /* Define to `unsigned' if <sys/types.h> does not define. */
91 /* #undef size_t */
92
93 /* Define to `int' if <sys/types.h> doesn't define. */
94 /* #undef uid_t */
1414 #define HAVE_SYS_TYPES_H 1
1515
1616 #define PACKAGE "mimetic"
17 #define VERSION "0.8.7"
17 #define VERSION "0.9.2"
11 copyright : (C) by 2002-2004 Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: libconfig.h,v 1.7 2005/02/23 10:26:14 tat Exp $
4 $Id: libconfig.h,v 1.8 2006/04/18 14:10:52 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
1515 #ifndef _MIMETIC_LIB_CONFIG_H_
1616 #define _MIMETIC_LIB_CONFIG_H_
1717 #if defined(__unix__) || defined(__linux__) || defined(__unix) || defined(_AIX)
18 #ifdef HAVE_MIMETIC_CONFIG
1819 #include "config.h"
20 #endif
1921 #define CONFIG_UNIX
2022 #endif
2123
2224 /* Mac OS X */
2325 #if defined(__APPLE__) && defined(__MACH__)
26 #ifdef HAVE_MIMETIC_CONFIG
2427 #include "config.h"
28 #endif
2529 #define CONFIG_UNIX
2630 #endif
2731
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: message.cxx,v 1.2 2005/02/23 10:26:14 tat Exp $
4 $Id: message.cxx,v 1.3 2006/10/09 13:38:30 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
2424 using namespace std;
2525 Attachment::Attachment(const std::string& fqn)
2626 {
27 set(fqn, ContentType("application","octect-stream"),Base64::Encoder());
27 set(fqn, ContentType("application","octet-stream"),Base64::Encoder());
2828 }
2929
3030 Attachment::Attachment(const std::string& fqn, const ContentType& ct)
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: message.h,v 1.11 2005/03/07 15:35:08 tat Exp $
4 $Id: message.h,v 1.12 2006/10/09 13:38:30 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
107107 };
108108
109109
110 /// application/octect-stream entity class
110 /// application/octet-stream entity class
111111 struct ApplicationOctStream: public MimeEntity
112112 {
113113 ApplicationOctStream();
128128 struct Attachment: public MimeEntity
129129 {
130130 /**
131 * defaults to application/octect-stream
131 * defaults to application/octet-stream
132132 */
133133 Attachment(const std::string&);
134134 Attachment(const std::string&, const ContentType&);
188188
189189
190190 /**
191 * defaults to application/octect-stream
191 * defaults to application/octet-stream
192192 */
193193 template<typename Codec>
194194 Attachment::Attachment(const std::string& fqn, const Codec& codec)
195195 {
196 set(fqn, ContentType("application","octect-stream"), codec);
196 set(fqn, ContentType("application","octet-stream"), codec);
197197 }
198198
199199 template<typename Codec>
11 #define _MIMETIC_OS_DIRECTORY_H_
22 #include <string>
33 #include <iterator>
4 #include <mimetic/config.h>
4 #include <mimetic/libconfig.h>
55 #ifdef HAVE_DIRENT_H
66 #include <dirent.h>
77 #endif
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: fileop.cxx,v 1.2 2005/02/23 10:26:15 tat Exp $
4 $Id: fileop.cxx,v 1.4 2007/01/21 14:08:57 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
1717 #ifdef HAVE_UNISTD_H
1818 #include <unistd.h>
1919 #endif
20 #ifdef HAVE_SYS_TYPES_H
21 #include <sys/types.h>
22 #endif
2023 #ifdef HAVE_SYS_STAT_H
2124 #include <sys/stat.h>
2225 #endif
2326
2427 using namespace std;
25
2628
2729 namespace mimetic
2830 {
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: mmfile.cxx,v 1.4 2006/04/11 10:04:58 tat Exp $
4 $Id: mmfile.cxx,v 1.5 2006/07/13 13:36:25 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
4444
4545 bool MMFile::open(const std::string& fqn, int mode /*= O_RDONLY*/)
4646 {
47 m_fqn = fqn;
4748 if(!stat() || !S_ISREG(m_st.st_mode))
4849 return false;
49 m_fqn = fqn;
5050 return open(mode);
5151 }
5252
443443 // std::string because I want to be as fast as possible here
444444 virtual void copy_until_boundary(ParsingElem pe)
445445 {
446 size_t pos, lines, eomsz;
446 size_t pos, lines, eomsz = 0;
447447 register char c;
448448 enum { nlsz = 1 };
449 char nl[2] = { NL, 0 };
450449 const char *eom = 0;
451450
452451 enum { blksz = 4096 };
500499 {
501500 // not an empty row, is this a boundary?
502501 block[blkpos] = 0;
503 if(block[sl_off] == '-' &&
504 sl_off < blkpos &&
502 if(block[sl_off] == '-' && sl_off < blkpos &&
505503 block[sl_off+1] == '-')
506504 {
507505 std::string Line(block+sl_off, blkpos-sl_off);
508506 if(isBoundary(Line))
509507 {
510508 // trim last newline
511 int i = sl_off;
512 char a = block[--i];
513 char b = block[--i];
514 if(isnl(a,b))
515 sl_off -= 2;
516 else if(isnl(a))
509 if (sl_off>=2)
510 {
511 int i = sl_off;
512 char a = block[--i];
513 char b = block[--i];
514
515 if(isnl(a,b))
516 sl_off -= 2;
517 else if(isnl(a))
518 sl_off--;
519
520 } else if (sl_off==1 && isnl(block[0])) {
517521 sl_off--;
518 onBlock(block, sl_off,
519 pe);
522 }
523 onBlock(block, sl_off, pe);
520524 return;
521525 }
522526 }
674678 m_lastBoundary = ClosingBoundary;
675679 m_bit = off + 2;
676680 }
677 if(m_bit < m_eit && isnl(*m_bit))
681 if(m_bit < m_eit-1 && isnl(*m_bit))
678682 {
679683 char c = *m_bit++;
680684 char next = *m_bit;
281281 header.lo header.o : header.cxx header.h ../../mimetic/strutils.h \
282282 ../../mimetic/utils.h ../../mimetic/libconfig.h \
283283 ../../mimetic/config.h field.h fieldvalue.h mailbox.h \
284 messageid.h ../../mimetic/config.h ../../mimetic/os/utils.h \
285 mailboxlist.h addresslist.h address.h group.h
284 messageid.h ../../mimetic/os/utils.h mailboxlist.h \
285 addresslist.h address.h group.h
286286 mailbox.lo mailbox.o : mailbox.cxx mailbox.h fieldvalue.h \
287287 ../../mimetic/strutils.h
288288 mailboxlist.lo mailboxlist.o : mailboxlist.cxx mailboxlist.h \
292292 message.lo message.o : message.cxx message.h header.h \
293293 ../../mimetic/strutils.h ../../mimetic/utils.h \
294294 ../../mimetic/libconfig.h ../../mimetic/config.h field.h \
295 fieldvalue.h mailbox.h messageid.h ../../mimetic/config.h \
296 ../../mimetic/os/utils.h mailboxlist.h addresslist.h address.h \
297 group.h body.h
295 fieldvalue.h mailbox.h messageid.h ../../mimetic/os/utils.h \
296 mailboxlist.h addresslist.h address.h group.h body.h
298297 messageid.lo messageid.o : messageid.cxx messageid.h \
299 ../../mimetic/config.h ../../mimetic/utils.h \
300298 ../../mimetic/libconfig.h ../../mimetic/config.h \
301 ../../mimetic/strutils.h ../../mimetic/os/utils.h fieldvalue.h
299 ../../mimetic/utils.h ../../mimetic/strutils.h \
300 ../../mimetic/os/utils.h fieldvalue.h
302301
303302 info-am:
304303 info: info-am
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: datetime.cxx,v 1.2 2005/02/23 10:26:15 tat Exp $
4 $Id: datetime.cxx,v 1.3 2007/01/21 14:55:34 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
283283 }
284284
285285 // gg mon aa[aa]
286 for(; i < 3; ++i)
286 while(i < 3)
287287 {
288288 if(!stok.next(tok)) return;
289 if(tok.empty())
290 continue; /* there's a ' ' after ',' ("Wed, 23 Nov...") */
289291 switch(i)
290292 {
291293 case 0: m_iDay = utils::str2int(tok); break;
292294 case 1: m_iMonth = Month(tok).ordinal(); break;
293295 case 2: m_iYear = utils::str2int(tok); break;
294296 }
295 }
297 ++i;
298 }
299
296300 stok.setDelimList(" :");
297 for(int i = 0; i < 3; ++i)
301 for(i = 0; i < 3; ++i)
298302 {
299303 if(!stok.next(tok)) return;
300304 switch(i)
393397 ostream& operator<<(ostream& os, const DateTime& dt)
394398 {
395399 int width = os.width(), fill = os.fill();
400
396401 os << dt.dayOfWeek().name() << ", "
397402 << setw(2) << setfill('0') << dt.day() << " "
398403 << dt.month().name() << " "
401406 << setw(2) << setfill('0') << dt.minute() << ":"
402407 << setw(2) << setfill('0') << dt.second() << " "
403408 << dt.zone().name();
409
404410 os.width(width);
405411 os.fill(fill);
406412 return os;
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: datetime.h,v 1.11 2005/02/23 10:26:15 tat Exp $
4 $Id: datetime.h,v 1.12 2007/01/21 14:55:34 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
105105 short second() const;
106106 Zone zone() const;
107107 std::string str() const;
108 //friend std::ostream& operator<<(std::ostream&, const DateTime&);
108 friend std::ostream& operator<<(std::ostream&, const DateTime&);
109109 protected:
110110 FieldValue* clone() const;
111111 private:
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: messageid.h,v 1.13 2006/04/11 10:04:58 tat Exp $
4 $Id: messageid.h,v 1.14 2006/04/18 14:10:52 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
1818 #include <stdint.h>
1919 #endif
2020 #include <string>
21 #include <mimetic/config.h>
21 #include <mimetic/libconfig.h>
2222 #ifdef HAVE_INTTYPES_H
2323 #include <inttypes.h>
2424 #endif
11 copyright : (C) 2002-2005 by Stefano Barbato
22 email : stefano@codesink.org
33
4 $Id: version.cxx,v 1.2 2005/02/23 10:26:14 tat Exp $
4 $Id: version.cxx,v 1.3 2007/01/21 11:39:04 tat Exp $
55 ***************************************************************************/
66
77 /***************************************************************************
1313 * *
1414 ***************************************************************************/
1515 #include <iostream>
16 #include <mimetic/config.h>
1617 #include <mimetic/version.h>
1718 #include <mimetic/utils.h>
1819 #include <mimetic/tokenizer.h>
323323 ../mimetic/strutils.h ../mimetic/rfc822/fieldvalue.h \
324324 ../mimetic/fieldparam.h t.contenttype.h cutee.h
325325 t.directory.cutee.o: t.directory.cutee.cxx cutee.h t.directory.h \
326 ../mimetic/os/directory.h ../mimetic/config.h \
327 ../mimetic/os/fileop.h ../mimetic/utils.h \
328 ../mimetic/libconfig.h ../mimetic/config.h \
326 ../mimetic/os/directory.h ../mimetic/libconfig.h \
327 ../mimetic/config.h ../mimetic/os/fileop.h ../mimetic/utils.h \
329328 ../mimetic/strutils.h
330329 t.fieldparam.cutee.o: t.fieldparam.cutee.cxx cutee.h t.fieldparam.h \
331330 ../mimetic/fieldparam.h ../mimetic/strutils.h
356355 ../mimetic/contenttype.h ../mimetic/header.h \
357356 ../mimetic/rfc822/header.h ../mimetic/rfc822/field.h \
358357 ../mimetic/rfc822/mailbox.h ../mimetic/rfc822/messageid.h \
359 ../mimetic/config.h ../mimetic/os/utils.h \
360 ../mimetic/rfc822/mailboxlist.h ../mimetic/rfc822/addresslist.h \
361 ../mimetic/rfc822/address.h ../mimetic/rfc822/group.h \
362 ../mimetic/mimeversion.h ../mimetic/contentid.h \
363 ../mimetic/message.h ../mimetic/mimeentity.h \
364 ../mimetic/codec/codec.h ../mimetic/codec/base64.h \
365 ../mimetic/codec/qp.h ../mimetic/parser/itparserdecl.h \
366 ../mimetic/streambufs.h ../mimetic/tokenizer.h \
367 ../mimetic/os/os.h ../mimetic/parser/itparser.h \
368 ../mimetic/tree.h
358 ../mimetic/os/utils.h ../mimetic/rfc822/mailboxlist.h \
359 ../mimetic/rfc822/addresslist.h ../mimetic/rfc822/address.h \
360 ../mimetic/rfc822/group.h ../mimetic/mimeversion.h \
361 ../mimetic/contentid.h ../mimetic/message.h \
362 ../mimetic/mimeentity.h ../mimetic/codec/codec.h \
363 ../mimetic/codec/base64.h ../mimetic/codec/qp.h \
364 ../mimetic/parser/itparserdecl.h ../mimetic/streambufs.h \
365 ../mimetic/tokenizer.h ../mimetic/os/os.h \
366 ../mimetic/parser/itparser.h ../mimetic/tree.h
369367 t.parser.cutee.o: t.parser.cutee.cxx cutee.h t.parser.h \
370368 ../mimetic/mimeentity.h ../mimetic/strutils.h \
371369 ../mimetic/utils.h ../mimetic/libconfig.h ../mimetic/config.h \
382380 ../mimetic/os/mmfile.h ../mimetic/header.h \
383381 ../mimetic/rfc822/header.h ../mimetic/rfc822/field.h \
384382 ../mimetic/rfc822/mailbox.h ../mimetic/rfc822/messageid.h \
385 ../mimetic/config.h ../mimetic/os/utils.h \
386 ../mimetic/rfc822/mailboxlist.h ../mimetic/rfc822/addresslist.h \
387 ../mimetic/rfc822/address.h ../mimetic/rfc822/group.h \
388 ../mimetic/contentid.h ../mimetic/contentdescription.h \
389 ../mimetic/body.h ../mimetic/rfc822/body.h \
390 ../mimetic/parser/itparserdecl.h ../mimetic/streambufs.h \
391 ../mimetic/parser/itparser.h ../mimetic/tree.h
383 ../mimetic/os/utils.h ../mimetic/rfc822/mailboxlist.h \
384 ../mimetic/rfc822/addresslist.h ../mimetic/rfc822/address.h \
385 ../mimetic/rfc822/group.h ../mimetic/contentid.h \
386 ../mimetic/contentdescription.h ../mimetic/body.h \
387 ../mimetic/rfc822/body.h ../mimetic/parser/itparserdecl.h \
388 ../mimetic/streambufs.h ../mimetic/parser/itparser.h \
389 ../mimetic/tree.h
392390 t.qp.cutee.o: t.qp.cutee.cxx cutee.h t.qp.h ../mimetic/codec/codec.h \
393391 ../mimetic/codec/codec_base.h ../mimetic/codec/codec_chain.h \
394392 ../mimetic/codec/base64.h ../mimetic/circular_buffer.h \
407405 ../mimetic/strutils.h ../mimetic/rfc822/group.h \
408406 ../mimetic/rfc822/addresslist.h ../mimetic/rfc822/body.h \
409407 ../mimetic/rfc822/datetime.h ../mimetic/rfc822/messageid.h \
410 ../mimetic/config.h ../mimetic/utils.h ../mimetic/libconfig.h \
411 ../mimetic/config.h ../mimetic/os/utils.h \
412 ../mimetic/rfc822/field.h ../mimetic/rfc822/header.h \
413 ../mimetic/rfc822/mailboxlist.h ../mimetic/rfc822/message.h
408 ../mimetic/libconfig.h ../mimetic/config.h ../mimetic/utils.h \
409 ../mimetic/os/utils.h ../mimetic/rfc822/field.h \
410 ../mimetic/rfc822/header.h ../mimetic/rfc822/mailboxlist.h \
411 ../mimetic/rfc822/message.h
414412 t.rfc822.o: t.rfc822.cxx t.rfc822.h ../mimetic/rfc822/rfc822.h \
415413 ../mimetic/rfc822/address.h ../mimetic/rfc822/mailbox.h \
416414 ../mimetic/rfc822/fieldvalue.h ../mimetic/strutils.h \
417415 ../mimetic/rfc822/group.h ../mimetic/rfc822/addresslist.h \
418416 ../mimetic/rfc822/body.h ../mimetic/rfc822/datetime.h \
419 ../mimetic/rfc822/messageid.h ../mimetic/config.h \
420 ../mimetic/utils.h ../mimetic/libconfig.h ../mimetic/config.h \
421 ../mimetic/os/utils.h ../mimetic/rfc822/field.h \
422 ../mimetic/rfc822/header.h ../mimetic/rfc822/mailboxlist.h \
423 ../mimetic/rfc822/message.h cutee.h
417 ../mimetic/rfc822/messageid.h ../mimetic/libconfig.h \
418 ../mimetic/config.h ../mimetic/utils.h ../mimetic/os/utils.h \
419 ../mimetic/rfc822/field.h ../mimetic/rfc822/header.h \
420 ../mimetic/rfc822/mailboxlist.h ../mimetic/rfc822/message.h \
421 cutee.h
424422 t.strutils.cutee.o: t.strutils.cutee.cxx cutee.h t.strutils.h \
425423 ../mimetic/strutils.h
426424 t.tokenizer.cutee.o: t.tokenizer.cutee.cxx cutee.h t.tokenizer.h \