fix for fdo#62090 Mid function regression
[LibreOffice.git] / moz / seamonkey-source-1.1.14.patch
blob1d0db1f5db3e5febafed5b983cd54df09b4069f9
1 --- misc/mozilla/build/autoconf/mozconfig-find 2007-02-16 03:19:06.000000000 +0100
2 +++ misc/build/mozilla/build/autoconf/mozconfig-find 2008-08-19 10:12:04.000000000 +0200
3 @@ -51,10 +51,7 @@
4 "$topsrcdir/.mozconfig" \
5 "$topsrcdir/mozconfig" \
6 "$topsrcdir/mozconfig.sh" \
7 - "$topsrcdir/myconfig.sh" \
8 - "$HOME/.mozconfig" \
9 - "$HOME/.mozconfig.sh" \
10 - "$HOME/.mozmyconfig.sh"
11 + "$topsrcdir/myconfig.sh"
13 if test -f "$_config"; then
14 echo "$_config";
15 --- misc/mozilla/build/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
16 +++ misc/build/mozilla/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
17 @@ -1,4 +1,4 @@
18 -#!/bin/sh
19 +#!/bin/bash
21 # Stupid wrapper to avoid win32 dospath/cygdrive issues
22 # Try not to spawn programs from within this file. If the stuff in here looks royally
23 @@ -57,12 +57,36 @@
24 i=-I${mountpoint}/${driveletter}/${pathname}
26 else
27 - eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
28 - if ! test "${leader}" = "${i}"; then
29 - eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
30 - eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
31 - driveletter=${no_mountpoint%%/*}
32 - i=${leader}${driveletter}:/${pathname}
33 + # The original version missed mounted paths, the new version below
34 + # doesn't transform /para as this is most likely a parameter.
35 + eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}'
36 + if ! test "$notinpath" = "$i"; then
37 + # found $mountpoint
38 + eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}'
39 + eval 'withdrive=${i#'${notinpath}${mountpoint}'/}'
40 + driveletter=${withdrive%%/*}
41 + i=${notinpath}${driveletter}:/${restpath}
42 + else
43 + # check for potential path. Precheck using shell methods
44 + doconvert=""
45 + # Shortcut -X<path> when path does not begin with '/'
46 + noswitch=${i#-[a-zA-Z]}
47 + if test "$noswitch" != "$i"; then
48 + test "${noswitch#/}" != "$noswitch" && doconvert="1"
49 + fi
50 + # Precheck for possible path. Consider only absolute paths that contain at least
51 + # a second / to prevent converting of /abc parameters.
52 + test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1"
53 + if test -n "$doconvert"; then
54 + # Can be a path. If forking grep would be faster or we could require bash 3
55 + # this regexp would be all that's needed to find pathnames that need converting
56 + pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'`
57 + eval 'notinpath=${i%'${pathname}'}'
58 + if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then
59 + pathname=`cygpath -am "$pathname"`
60 + i=${notinpath}${pathname}
61 + fi
62 + fi
66 --- misc/mozilla/config/Makefile.in 2006-12-22 14:50:41.000000000 +0100
67 +++ misc/build/mozilla/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
68 @@ -166,7 +166,7 @@
70 ifdef MOZ_ENABLE_GTK2
71 GLIB_CFLAGS = $(MOZ_GTK2_CFLAGS)
72 - GLIB_LIBS = $(MOZ_GTK2_LIBS)
73 + GLIB_LIBS = $(filter -lglib% -L%,$(MOZ_GTK2_LIBS))
74 endif
76 build_number: FORCE
77 --- misc/mozilla/config/autoconf.mk.in 2006-09-14 20:07:03.000000000 +0200
78 +++ misc/build/mozilla/config/autoconf.mk.in 2008-11-07 16:08:52.937500000 +0100
79 @@ -543,6 +543,7 @@
80 MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
81 MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
82 MOZ_QUANTIFY = @MOZ_QUANTIFY@
83 +MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
85 #python options
86 PYTHON = @MOZ_PYTHON@
87 --- misc/mozilla/config/config.mk 2008-01-29 20:30:22.000000000 +0100
88 +++ misc/build/mozilla/config/config.mk 2008-08-14 16:22:21.000000000 +0200
89 @@ -758,6 +758,30 @@
90 endif
93 +# Shared library RUNPATH linker option(s)
95 +ifeq ($(OS_ARCH),FreeBSD)
96 +EXTRA_DSO_LDOPTS += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
97 +ifdef IS_COMPONENT
98 +EXTRA_DSO_LDOPTS += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib
99 +endif # IS_COMPONENT
100 +endif # FreeBSD
102 +ifeq ($(OS_ARCH),Linux)
103 +EXTRA_DSO_LDOPTS += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
104 +ifdef IS_COMPONENT
105 +EXTRA_DSO_LDOPTS += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib
106 +endif # IS_COMPONENT
107 +endif # Linux
109 +ifeq ($(OS_ARCH),SunOS)
110 +EXTRA_DSO_LDOPTS += -R '$$ORIGIN'
111 +ifdef IS_COMPONENT
112 +EXTRA_DSO_LDOPTS += -R '$$ORIGIN/..'
113 +endif # IS_COMPONENT
114 +endif # SunOS
117 # Include any personal overrides the user might think are needed.
119 -include $(MY_CONFIG)
120 --- misc/mozilla/config/rules.mk 2008-01-29 20:30:22.000000000 +0100
121 +++ misc/build/mozilla/config/rules.mk 2009-02-16 14:05:23.000000000 +0100
122 @@ -529,8 +529,9 @@
123 ifeq ($(OS_ARCH),WINNT)
124 ifdef GNU_CC
125 ifndef IS_COMPONENT
126 -DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
127 +DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
128 endif
129 +DSO_LDOPTS += -Wl,--enable-runtime-pseudo-reloc -Wl,-Map -Wl,$(LIB_PREFIX)$(LIBRARY_NAME).map
130 endif
131 endif
133 @@ -811,6 +810,12 @@
135 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
136 $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
137 +ifdef MSMANIFEST_TOOL
138 + @if test -f $@.manifest; then \
139 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
140 + rm -f $@.manifest; \
141 + fi
142 +endif # MSVC with manifest tool
143 else
144 ifeq ($(CPP_PROG_LINK),1)
145 $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE)
146 @@ -843,6 +848,12 @@
147 else
148 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
149 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
150 +ifdef MSMANIFEST_TOOL
151 + @if test -f $@.manifest; then \
152 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
153 + rm -f $@.manifest; \
154 + fi
155 +endif # MSVC with manifest tool
156 else
157 $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
158 endif
159 @@ -866,6 +877,12 @@
160 else
161 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
162 $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
163 +ifdef MSMANIFEST_TOOL
164 + @if test -f $@.manifest; then \
165 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
166 + rm -f $@.manifest; \
167 + fi
168 +endif # MSVC with manifest tool
169 else
170 ifeq ($(CPP_PROG_LINK),1)
171 $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
172 @@ -1019,6 +1036,14 @@
173 endif # SHARED_LIBRARY_LIBS
174 endif # NO_LD_ARCHIVE_FLAGS
175 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
176 +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
177 +ifdef MSMANIFEST_TOOL
178 + @if test -f $@.manifest; then \
179 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
180 + rm -f $@.manifest; \
181 + fi
182 +endif # MSVC with manifest tool
183 +endif # WINNT && !GCC
184 @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
185 else # os2 vacpp
186 $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
187 @@ -1043,7 +1070,7 @@
188 if test -d $(@D); then \
189 echo "Building deps for $<"; \
190 touch $(_MDDEPFILE) && \
191 - $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
192 + $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
193 mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
194 cat $(_MDDEPFILE).old | sed -e "s|^$(srcdir)/||" -e "s|^$(win_srcdir)/||" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
196 @@ -1053,7 +1080,7 @@
197 if test -d $(@D); then \
198 echo "Building deps for $<"; \
199 touch $(_MDDEPFILE) && \
200 - $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
201 + $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
202 mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
203 cat $(_MDDEPFILE).old | sed -e "s|^$(<D)/||g" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
205 @@ -1696,14 +1724,14 @@
206 define MAKE_DEPS_NOAUTO
207 set -e ; \
208 touch $@ && \
209 - $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $(srcdir)/$(<F) >/dev/null 2>&1 && \
210 + $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $(srcdir)/$(<F) >/dev/null 2>&1 && \
211 mv $@ $@.old && cat $@.old | sed "s|^$(srcdir)/||g" > $@ && rm -f $@.old
212 endef
213 else
214 define MAKE_DEPS_NOAUTO
215 set -e ; \
216 touch $@ && \
217 - $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
218 + $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
219 mv $@ $@.old && cat $@.old | sed "s|^$(<D)/||g" > $@ && rm -f $@.old
220 endef
221 endif # WINNT
222 --- misc/mozilla/configure 2008-10-30 23:05:30.000000000 +0100
223 +++ misc/build/mozilla/configure 2009-02-12 15:20:18.597579000 +0100
224 @@ -1068,6 +1068,8 @@
225 GCONF_VERSION=1.2.1
226 LIBGNOME_VERSION=2.0
228 +MSMANIFEST_TOOL=
230 MISSING_X=
231 for ac_prog in gawk mawk nawk awk
233 @@ -3022,9 +3024,26 @@
234 _CC_SUITE=7
235 elif test "$_CC_MAJOR_VERSION" = "14"; then
236 _CC_SUITE=8
237 + CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
238 else
239 { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
242 + # bug #249782
243 + # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
244 + if test "$_CC_SUITE" -ge "8"; then
245 + MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
246 + if test -n "MSMT_TOOL"; then
247 + MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
248 + if test -z "MSMANIFEST_TOOL_VERSION"; then
249 + echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
250 + fi
251 + MSMANIFEST_TOOL=1
252 + unset MSMT_TOOL
253 + else
254 + { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
255 + fi
256 + fi
258 # Check linker version
259 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
260 @@ -3422,6 +3441,8 @@
261 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
262 cross_compiling=$ac_cv_prog_cc_cross
264 +else
265 + ac_cv_prog_CXXCPP="$CXXCPP"
267 CXXCPP="$ac_cv_prog_CXXCPP"
268 echo "$ac_t""$CXXCPP" 1>&6
269 @@ -5726,6 +5747,7 @@
270 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
271 _pwd=`pwd`
272 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
273 + CYGWIN_WRAPPER=`cygpath -u $CYGWIN_WRAPPER`
275 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
276 AS_PERL=1
277 @@ -6036,7 +6058,7 @@
278 CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
279 DLL_SUFFIX=".dylib"
280 DSO_LDOPTS=''
281 - STRIP="$STRIP -x -S"
282 + STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
283 _PLATFORM_DEFAULT_TOOLKIT='mac'
284 MOZ_ENABLE_POSTSCRIPT=
285 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
286 @@ -6075,7 +6097,7 @@
289 *-freebsd*)
290 - if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
291 + if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
292 DLL_SUFFIX=".so.1.0"
293 DSO_LDOPTS="-shared"
295 @@ -6455,12 +6477,12 @@
298 case "$host" in
299 - *-mingw*)
300 - CYGPATH_W=echo
301 + *-cygwin*|*-mingw*)
302 + CYGPATH_W="cygpath -u"
303 CYGPATH_S=cat
304 - MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
305 + MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
307 - *-cygwin*|*-msvc*|*-mks*)
308 + *-msvc*|*-mks*)
309 CYGPATH_W="cygpath -a -w"
310 CYGPATH_S="sed -e s|\\\\|/|g"
311 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
312 @@ -6718,7 +6740,7 @@
313 MOZ_USER_DIR="Mozilla"
315 if test "$MOZTOOLS"; then
316 - MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
317 + MOZ_TOOLS_DIR=`echo $MOZTOOLS`
318 else
319 { echo "configure: error: MOZTOOLS is not set" 1>&2; exit 1; }
321 @@ -8614,6 +8636,8 @@
322 case $target in
323 *-hpux11.*)
325 +*-freebsd*)
326 + ;;
328 echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6
329 echo "configure:8620: checking for gethostbyname_r in -lc_r" >&5
330 @@ -19233,7 +19257,8 @@
331 MOZ_CAIRO_LIBS="-lmozcairo -lmozlibpixman $CAIRO_FT_LIBS"
333 if test "$MOZ_X11"; then
334 - MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
335 +# MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
336 + MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $XLIBS -lfontconfig -lfreetype"
338 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
339 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS -lgdi32"
340 @@ -20076,8 +20101,12 @@
341 WIN_TOP_SRC=`cd $srcdir; pwd -W`
343 cygwin*|msvc*|mks*)
344 - HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
345 - HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
346 +# Don't add the wrapper for the HOST_* versions as they contain an
347 +# unexpanded $CC and therfore wil get the wrapper below.
348 + if test -n "$GNU_CC"; then
349 + HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
350 + HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
351 + fi
352 CC="\$(CYGWIN_WRAPPER) $CC"
353 CXX="\$(CYGWIN_WRAPPER) $CXX"
354 CPP="\$(CYGWIN_WRAPPER) $CPP"
355 --- misc/mozilla/configure.in 2008-10-30 23:05:31.000000000 +0100
356 +++ misc/build/mozilla/configure.in 2009-02-05 20:12:45.456777753 +0100
357 @@ -126,6 +126,8 @@
358 GCONF_VERSION=1.2.1
359 LIBGNOME_VERSION=2.0
361 +MSMANIFEST_TOOL=
363 dnl Set various checks
364 dnl ========================================================
365 MISSING_X=
366 @@ -425,9 +427,26 @@
367 _CC_SUITE=7
368 elif test "$_CC_MAJOR_VERSION" = "14"; then
369 _CC_SUITE=8
370 + CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
371 else
372 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
375 + # bug #249782
376 + # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
377 + if test "$_CC_SUITE" -ge "8"; then
378 + MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
379 + if test -n "MSMT_TOOL"; then
380 + MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
381 + if test -z "MSMANIFEST_TOOL_VERSION"; then
382 + AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
383 + fi
384 + MSMANIFEST_TOOL=1
385 + unset MSMT_TOOL
386 + else
387 + AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
388 + fi
389 + fi
391 # Check linker version
392 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
393 @@ -1530,7 +1549,7 @@
394 CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
395 DLL_SUFFIX=".dylib"
396 DSO_LDOPTS=''
397 - STRIP="$STRIP -x -S"
398 + STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
399 _PLATFORM_DEFAULT_TOOLKIT='mac'
400 MOZ_ENABLE_POSTSCRIPT=
401 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
402 @@ -1552,7 +1571,7 @@
405 *-freebsd*)
406 - if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
407 + if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
408 DLL_SUFFIX=".so.1.0"
409 DSO_LDOPTS="-shared"
411 @@ -1853,10 +1872,10 @@
413 dnl MinGW/MSYS doesn't provide or need cygpath
414 case "$host" in
415 - *-mingw*)
416 - CYGPATH_W=echo
417 + *-cygwin*|*-mingw*)
418 + CYGPATH_W="cygpath -u"
419 CYGPATH_S=cat
420 - MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
421 + MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
423 *-cygwin*|*-msvc*|*-mks*)
424 CYGPATH_W="cygpath -a -w"
425 @@ -2749,6 +2768,8 @@
426 case $target in
427 *-hpux11.*)
429 +*-freebsd*)
430 + ;;
432 AC_CHECK_LIB(c_r, gethostbyname_r)
434 @@ -7321,6 +7342,7 @@
435 AC_SUBST(USE_N32)
436 AC_SUBST(CC_VERSION)
437 AC_SUBST(CXX_VERSION)
438 +AC_SUBST(MSMANIFEST_TOOL)
440 if test "$USING_HCC"; then
441 CC='${topsrcdir}/build/hcc'
442 @@ -7416,8 +7438,12 @@
443 WIN_TOP_SRC=`cd $srcdir; pwd -W`
445 cygwin*|msvc*|mks*)
446 - HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
447 - HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
448 +# Don't add the wrapper for the HOST_* versions as they contain an
449 +# unexpanded $CC and therfore wil get the wrapper below.
450 + if test -n "$GNU_CC"; then
451 + HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
452 + HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
453 + fi
454 CC="\$(CYGWIN_WRAPPER) $CC"
455 CXX="\$(CYGWIN_WRAPPER) $CXX"
456 CPP="\$(CYGWIN_WRAPPER) $CPP"
457 --- misc/mozilla/directory/c-sdk/build.mk 2006-02-03 15:44:29.000000000 +0100
458 +++ misc/build/mozilla/directory/c-sdk/build.mk 2008-08-14 16:22:21.000000000 +0200
459 @@ -384,7 +384,7 @@
460 ifdef NS_USE_GCC
461 LINK_EXE = $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
462 LINK_LIB = $(AR) cr $@ $(OBJS)
463 -LINK_DLL = $(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS)
464 +LINK_DLL = $(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(LIB_PREFIX)$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS)
465 else
466 DEBUG_LINK_OPT=-DEBUG
467 ifeq ($(BUILD_OPT), 1)
468 --- misc/mozilla/directory/c-sdk/config/FreeBSD.mk 2006-02-03 15:41:11.000000000 +0100
469 +++ misc/build/mozilla/directory/c-sdk/config/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
470 @@ -70,7 +70,7 @@
472 ARCH = freebsd
474 -MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
475 +MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
477 ifeq ($(MOZ_OBJFORMAT),elf)
478 DLL_SUFFIX = so
479 --- misc/mozilla/directory/c-sdk/config/autoconf.mk.in 2006-02-23 00:58:25.000000000 +0100
480 +++ misc/build/mozilla/directory/c-sdk/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
481 @@ -25,6 +25,7 @@
482 LIB_SUFFIX = @LIB_SUFFIX@
483 LIB_PREFIX = @LIB_PREFIX@
484 DLL_SUFFIX = @DLL_SUFFIX@
485 +DLL_PREFIX = @DLL_PREFIX@
486 ASM_SUFFIX = @ASM_SUFFIX@
487 PROG_SUFFIX = @PROG_SUFFIX@
488 MOD_NAME = @NSPR_MODNAME@
489 --- misc/mozilla/directory/c-sdk/config/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
490 +++ misc/build/mozilla/directory/c-sdk/config/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
491 @@ -1,4 +1,4 @@
492 -#!/bin/sh
493 +#!/bin/bash
495 # Stupid wrapper to avoid win32 dospath/cygdrive issues
496 # Try not to spawn programs from within this file. If the stuff in here looks royally
497 --- misc/mozilla/directory/c-sdk/configure 2006-02-23 01:58:13.000000000 +0100
498 +++ misc/build/mozilla/directory/c-sdk/configure 2008-08-14 16:22:21.000000000 +0200
499 @@ -2738,6 +2738,7 @@
500 LIB_SUFFIX=a
501 LIB_PREFIX=lib
502 DLL_SUFFIX=so
503 +DLL_PREFIX=lib
504 ASM_SUFFIX=s
505 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
506 PR_MD_ASFILES=
507 @@ -3444,7 +3445,7 @@
510 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
511 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
512 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
513 if test "$MOZ_OBJFORMAT" = "elf"; then
514 DLL_SUFFIX=so
515 else
516 @@ -3811,6 +3812,7 @@
517 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
518 DSO_CFLAGS=-fPIC
519 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
520 + DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,origin -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
521 OS_LIBS="$OS_LIBS -lc"
522 _OPTIMIZE_FLAGS=-O2
523 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
524 @@ -3880,7 +3882,8 @@
525 CC="$CC -mno-cygwin"
526 CXX="$CXX -mno-cygwin"
527 DLL_SUFFIX=dll
528 - MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
529 + DLL_PREFIX=
530 + MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
531 # Use temp file for windres (bug 213281)
532 RC="$WINDRES -O coff --use-temp-file"
533 else
534 @@ -3897,6 +3900,7 @@
535 LIB_SUFFIX=lib
536 LIB_PREFIX=
537 DLL_SUFFIX=dll
538 + DLL_PREFIX=
540 CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
541 DLLFLAGS='-OUT:"$@"'
542 @@ -4293,6 +4297,7 @@
543 NSINSTALL=nsinstall
544 LIB_PREFIX=
545 LIB_SUFFIX=lib
546 + DLL_PREFIX=
547 DLL_SUFFIX=dll
548 DLLTOOL=''
549 RC=rc.exe
550 @@ -4660,6 +4665,7 @@
551 LD=/usr/ccs/bin/ld
552 RANLIB=/usr/ccs/bin/ranlib
553 DSO_LDOPTS='-G -h $(notdir $@)'
554 + DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
555 if test -n "$GNU_CC"; then
556 DSO_CFLAGS=-fPIC
557 else
558 @@ -5844,6 +5850,7 @@
559 s%@LIB_SUFFIX@%$LIB_SUFFIX%g
560 s%@LIB_PREFIX@%$LIB_PREFIX%g
561 s%@DLL_SUFFIX@%$DLL_SUFFIX%g
562 +s%@DLL_PREFIX@%$DLL_PREFIX%g
563 s%@ASM_SUFFIX@%$ASM_SUFFIX%g
564 s%@PROG_SUFFIX@%$PROG_SUFFIX%g
565 s%@MKSHLIB@%$MKSHLIB%g
566 --- misc/mozilla/directory/c-sdk/configure.in 2007-07-15 16:41:07.000000000 +0200
567 +++ misc/build/mozilla/directory/c-sdk/configure.in 2008-08-14 16:22:21.000000000 +0200
568 @@ -549,6 +549,7 @@
569 LIB_SUFFIX=a
570 LIB_PREFIX=lib
571 DLL_SUFFIX=so
572 +DLL_PREFIX=lib
573 ASM_SUFFIX=s
574 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
575 PR_MD_ASFILES=
576 @@ -1037,7 +1038,7 @@
577 AC_DEFINE(FREEBSD)
578 AC_DEFINE(HAVE_BSD_FLOCK)
579 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
580 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
581 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
582 if test "$MOZ_OBJFORMAT" = "elf"; then
583 DLL_SUFFIX=so
584 else
585 @@ -1285,6 +1286,7 @@
586 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
587 DSO_CFLAGS=-fPIC
588 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
589 + DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,origin -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
590 OS_LIBS="$OS_LIBS -lc"
591 _OPTIMIZE_FLAGS=-O2
592 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
593 @@ -1336,6 +1338,8 @@
594 CC="$CC -mno-cygwin"
595 CXX="$CXX -mno-cygwin"
596 DLL_SUFFIX=dll
597 + DLL_SUFFIX=dll
598 + DLL_PREFIX=
599 MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
600 # Use temp file for windres (bug 213281)
601 RC="$WINDRES -O coff --use-temp-file"
602 @@ -1353,6 +1357,7 @@
603 LIB_SUFFIX=lib
604 LIB_PREFIX=
605 DLL_SUFFIX=dll
606 + DLL_PREFIX=
608 CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
609 DLLFLAGS='-OUT:"$@"'
610 @@ -1820,6 +1825,7 @@
611 LD=/usr/ccs/bin/ld
612 RANLIB=/usr/ccs/bin/ranlib
613 DSO_LDOPTS='-G -h $(notdir $@)'
614 + DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
615 if test -n "$GNU_CC"; then
616 DSO_CFLAGS=-fPIC
617 else
618 @@ -2410,6 +2416,7 @@
619 AC_SUBST(LIB_SUFFIX)
620 AC_SUBST(LIB_PREFIX)
621 AC_SUBST(DLL_SUFFIX)
622 +AC_SUBST(DLL_PREFIX)
623 AC_SUBST(ASM_SUFFIX)
624 AC_SUBST(PROG_SUFFIX)
625 AC_SUBST(MKSHLIB)
626 --- misc/mozilla/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100
627 +++ misc/build/mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-11-02 21:55:34.929250000 +0100
628 @@ -85,6 +85,11 @@
630 ###########################################################################
632 +ifeq ($(TERM),cygwin)
633 +INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
634 +GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
635 +endif
637 all export:: $(INCLUDEDIR) $(GENHEADERS)
638 $(NSINSTALL) -D $(PRIVATEINCDIR)
639 $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
640 --- misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2006-02-03 15:44:42.000000000 +0100
641 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
642 @@ -109,7 +109,7 @@
643 HDIR = $(topsrcdir)/ldap/include
645 LIBLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
646 -DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
647 +DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(DLL_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
649 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
651 @@ -320,6 +320,10 @@
652 -$(RM) $(SO_FILES_TO_REMOVE)
653 endif
654 $(LINK_DLL) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS)
655 + if test -f $@.manifest; then \
656 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
657 + rm -f $@.manifest; \
658 + fi
660 veryclean:: clean
662 --- misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
663 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
664 @@ -62,7 +62,7 @@
665 LIBPRLDAP =
666 endif
667 DLLPRLDAP = $(addprefix $(OBJDIR_NAME)/, \
668 - $(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
669 + $(DLL_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
671 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
673 --- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2004-08-26 01:02:30.000000000 +0200
674 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2008-08-14 16:22:21.000000000 +0200
675 @@ -41,7 +41,7 @@
676 HDIR = $(topsrcdir)/ldap/include
678 LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
679 -DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
680 +DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
682 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
684 @@ -76,7 +92,7 @@
686 # variable definitions for exported symbols
687 ifeq ($(OS_ARCH), WINNT)
688 - SSLDAP_EXPORT_DEFS= $(srcdir)/../msdos/winsock/nsldapssl32.def
689 + SSLDAP_EXPORT_DEFS= $(win_srcdir)/../msdos/winsock/nsldapssl32.def
690 else
691 SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp
692 endif
693 --- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
694 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
695 @@ -56,7 +56,7 @@
696 HDIR = $(topsrcdir)/ldap/include
698 LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
699 -DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
700 +DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
702 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
704 --- misc/mozilla/embedding/browser/gtk/src/Makefile.in 2006-03-22 19:22:41.000000000 +0100
705 +++ misc/build/mozilla/embedding/browser/gtk/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
706 @@ -112,14 +112,14 @@
707 gtkmozembed_internal.h
709 ifdef MOZ_ENABLE_GTK
710 -EXTRA_DSO_LDOPTS = \
711 +EXTRA_DSO_LDOPTS += \
712 $(MOZ_COMPONENT_LIBS) \
713 -lgtksuperwin \
714 $(NULL)
715 endif
717 ifdef MOZ_ENABLE_GTK2
718 -EXTRA_DSO_LDOPTS = \
719 +EXTRA_DSO_LDOPTS += \
720 $(MOZ_COMPONENT_LIBS) \
721 $(NULL)
722 endif
723 --- misc/mozilla/embedding/browser/gtk/tests/Makefile.in 2006-03-24 17:10:37.000000000 +0100
724 +++ misc/build/mozilla/embedding/browser/gtk/tests/Makefile.in 2008-08-14 16:22:21.000000000 +0200
725 @@ -63,10 +63,11 @@
726 TestGtkEmbedNotebook.cpp \
727 TestGtkEmbedSocket.cpp \
728 TestGtkEmbedChild.cpp
729 -endif
731 SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
733 +endif
735 # ENABLE_GNOME=1
737 ifdef ENABLE_GNOME
738 --- misc/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2005-06-20 21:24:51.000000000 +0200
739 +++ misc/build/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2009-02-19 13:11:39.000000000 +0100
740 @@ -68,25 +68,15 @@
742 unexport CC CXX
744 -ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
745 -ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
746 -export::
747 - rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/$(PROJECT) .
748 - ln -fs $(srcdir)/src
749 - ln -fs $(srcdir)/res
750 - ln -fs $(srcdir)/public
751 - ln -fs $(srcdir)/Info-*.plist .
752 -endif
754 libs::
755 # Bug 297227: The next line doesn't need to stay around forever, only
756 # long enough to clean up existing depend builds from when xcodebuild
757 # was being instructed to "install"
758 if test -e build/UninstalledProducts ; then $(MAKE) clean ; rm -rf $(DIST)/package/PrintPDE.plugin ; fi
760 - $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
761 - mkdir -p $(DIST)/package
762 - $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
763 +# $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
764 +# mkdir -p $(DIST)/package
765 +# $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
767 clean clobber::
768 rm -rf build
769 --- misc/mozilla/embedding/config/Makefile.in 2007-10-08 21:08:15.000000000 +0200
770 +++ misc/build/mozilla/embedding/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
771 @@ -110,7 +110,7 @@
772 $(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome
773 $(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed
774 ifndef MINIMO
775 - -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(LIB_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
776 + -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(DLL_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
777 endif
778 ifeq ($(OS_ARCH),WINNT)
779 ifeq ($(WINAPP),mfcembed)
780 --- misc/mozilla/extensions/pref/autoconfig/src/Makefile.in 2006-02-03 15:41:09.000000000 +0100
781 +++ misc/build/mozilla/extensions/pref/autoconfig/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
782 @@ -85,7 +85,7 @@
783 endif
786 -EXTRA_DSO_LDOPTS = \
787 +EXTRA_DSO_LDOPTS += \
788 $(LIBS_DIR) \
789 $(MOZ_JS_LIBS) \
790 $(MOZ_COMPONENT_LIBS) \
791 --- misc/mozilla/extensions/sql/build/Makefile.in 2004-11-29 18:39:08.000000000 +0100
792 +++ misc/build/mozilla/extensions/sql/build/Makefile.in 2008-08-18 14:03:04.000000000 +0200
793 @@ -55,5 +55,5 @@
794 bin/components/sqlpgsql.xpt \
795 bin/components/sqlsqlite.xpt \
796 bin/components/sqlmysql.xpt \
797 - bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \
798 + bin/components/$(DLL_PREFIX)sql$(DLL_SUFFIX) \
799 bin/chrome/sql.jar
800 --- misc/mozilla/gfx/idl/nsIFreeType2.idl 2004-04-16 01:30:02.000000000 +0200
801 +++ misc/build/mozilla/gfx/idl/nsIFreeType2.idl 2008-08-14 16:22:21.000000000 +0200
802 @@ -76,10 +76,11 @@
803 native FT_Sfnt_Tag(FT_Sfnt_Tag);
804 native FT_Size(FT_Size);
806 -[ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
807 +[ptr] native FTC_ImageType_p(FTC_ImageType);
808 native FTC_Face_Requester(FTC_Face_Requester);
809 native FTC_Font(FTC_Font);
810 -native FTC_Image_Cache(FTC_Image_Cache);
811 +native FTC_FaceID(FTC_FaceID);
812 +native FTC_ImageCache(FTC_ImageCache);
813 native FTC_Manager(FTC_Manager);
815 // #ifdef MOZ_SVG
816 @@ -99,7 +100,7 @@
818 readonly attribute FT_Library library;
819 readonly attribute FTC_Manager FTCacheManager;
820 - readonly attribute FTC_Image_Cache ImageCache;
821 + readonly attribute FTC_ImageCache ImageCache;
823 void doneFace(in FT_Face face);
824 void doneFreeType(in FT_Library lib);
825 @@ -115,16 +116,16 @@
826 void outlineDecompose(in FT_Outline_p outline,
827 in const_FT_Outline_Funcs_p funcs, in voidPtr p);
828 void setCharmap(in FT_Face face, in FT_CharMap charmap);
829 - void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
830 + void imageCacheLookup(in FTC_ImageCache cache, in FTC_ImageType_p desc,
831 in FT_UInt gindex, out FT_Glyph glyph);
832 - void managerLookupSize(in FTC_Manager manager, in FTC_Font font,
833 - out FT_Face face, out FT_Size size);
834 + void managerLookupFace(in FTC_Manager manager, in FTC_FaceID face_id,
835 + out FT_Face face);
836 void managerDone(in FTC_Manager manager);
837 void managerNew(in FT_Library lib, in FT_UInt max_faces,
838 in FT_UInt max_sizes, in FT_ULong max_bytes,
839 in FTC_Face_Requester requester, in FT_Pointer req_data,
840 out FTC_Manager manager);
841 - void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
842 + void imageCacheNew(in FTC_Manager manager, out FTC_ImageCache cache);
843 /* #ifdef MOZ_SVG */
844 void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
845 in FT_Vector_p delta);
846 --- misc/mozilla/gfx/src/freetype/nsFreeType.cpp 2005-07-13 20:21:10.000000000 +0200
847 +++ misc/build/mozilla/gfx/src/freetype/nsFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
848 @@ -111,7 +111,7 @@
849 {"FT_Outline_Decompose", NS_FT2_OFFSET(nsFT_Outline_Decompose), PR_TRUE},
850 {"FT_Set_Charmap", NS_FT2_OFFSET(nsFT_Set_Charmap), PR_TRUE},
851 {"FTC_Image_Cache_Lookup", NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup), PR_TRUE},
852 - {"FTC_Manager_Lookup_Size", NS_FT2_OFFSET(nsFTC_Manager_Lookup_Size), PR_TRUE},
853 + {"FTC_Manager_LookupFace", NS_FT2_OFFSET(nsFTC_Manager_LookupFace), PR_TRUE},
854 {"FTC_Manager_Done", NS_FT2_OFFSET(nsFTC_Manager_Done), PR_TRUE},
855 {"FTC_Manager_New", NS_FT2_OFFSET(nsFTC_Manager_New), PR_TRUE},
856 {"FTC_Image_Cache_New", NS_FT2_OFFSET(nsFTC_Image_Cache_New), PR_TRUE},
857 @@ -288,7 +288,7 @@
860 NS_IMETHODIMP
861 -nsFreeType2::ImageCacheLookup(FTC_Image_Cache cache, FTC_Image_Desc *desc,
862 +nsFreeType2::ImageCacheLookup(FTC_ImageCache cache, FTC_ImageType *desc,
863 FT_UInt glyphID, FT_Glyph *glyph)
865 // call the FreeType2 function via the function pointer
866 @@ -297,11 +297,11 @@
869 NS_IMETHODIMP
870 -nsFreeType2::ManagerLookupSize(FTC_Manager manager, FTC_Font font,
871 - FT_Face *face, FT_Size *size)
872 +nsFreeType2::ManagerLookupFace(FTC_Manager manager, FTC_FaceID font,
873 + FT_Face *face)
875 // call the FreeType2 function via the function pointer
876 - FT_Error error = nsFTC_Manager_Lookup_Size(manager, font, face, size);
877 + FT_Error error = nsFTC_Manager_LookupFace(manager, font, face);
878 return error ? NS_ERROR_FAILURE : NS_OK;
881 @@ -326,7 +326,7 @@
884 NS_IMETHODIMP
885 -nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_Image_Cache *cache)
886 +nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_ImageCache *cache)
888 // call the FreeType2 function via the function pointer
889 FT_Error error = nsFTC_Image_Cache_New(manager, cache);
890 @@ -395,7 +395,7 @@
893 NS_IMETHODIMP
894 -nsFreeType2::GetImageCache(FTC_Image_Cache *aCache)
895 +nsFreeType2::GetImageCache(FTC_ImageCache *aCache)
897 *aCache = mImageCache;
898 return NS_OK;
899 --- misc/mozilla/gfx/src/freetype/nsFreeType.h 2005-05-01 19:36:19.000000000 +0200
900 +++ misc/build/mozilla/gfx/src/freetype/nsFreeType.h 2008-08-14 16:22:21.000000000 +0200
901 @@ -120,13 +120,13 @@
902 typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
903 typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
904 typedef FT_Error (*FTC_Image_Cache_Lookup_t)
905 - (FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
906 -typedef FT_Error (*FTC_Manager_Lookup_Size_t)
907 - (FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
908 + (FTC_ImageCache, FTC_ImageType*, FT_UInt, FT_Glyph*);
909 +typedef FT_Error (*FTC_Manager_LookupFace_t)
910 + (FTC_Manager, FTC_FaceID, FT_Face*);
911 typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
912 typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
913 FTC_Face_Requester, FT_Pointer, FTC_Manager*);
914 -typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
915 +typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_ImageCache*);
916 // #ifdef MOZ_SVG
917 typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
918 typedef FT_Error (*FT_Get_Kerning_t)
919 @@ -181,7 +181,7 @@
920 FT_Outline_Decompose_t nsFT_Outline_Decompose;
921 FT_Set_Charmap_t nsFT_Set_Charmap;
922 FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
923 - FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
924 + FTC_Manager_LookupFace_t nsFTC_Manager_LookupFace;
925 FTC_Manager_Done_t nsFTC_Manager_Done;
926 FTC_Manager_New_t nsFTC_Manager_New;
927 FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
928 @@ -229,7 +229,7 @@
929 PRLibrary *mSharedLib;
930 FT_Library mFreeTypeLibrary;
931 FTC_Manager mFTCacheManager;
932 - FTC_Image_Cache mImageCache;
933 + FTC_ImageCache mImageCache;
935 static nsHashtable *sFontFamilies;
936 static nsHashtable *sRange1CharSetNames;
937 --- misc/mozilla/gfx/src/gtk/Makefile.in 2006-07-20 07:12:33.000000000 +0200
938 +++ misc/build/mozilla/gfx/src/gtk/Makefile.in 2008-08-14 16:22:21.000000000 +0200
939 @@ -211,6 +211,10 @@
940 CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
941 CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
943 +ifeq ($(OS_ARCH), Darwin)
944 +EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
945 +endif
947 ifeq ($(OS_ARCH), SunOS)
948 ifndef GNU_CC
949 # When using Sun's WorkShop compiler, including
950 --- misc/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2006-12-22 14:51:16.000000000 +0100
951 +++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2008-08-14 16:22:21.000000000 +0200
952 @@ -1870,10 +1870,10 @@
954 mPixelSize = NSToIntRound(app2dev * mFont->size);
956 - mImageDesc.font.face_id = (void*)mEntry;
957 - mImageDesc.font.pix_width = mPixelSize;
958 - mImageDesc.font.pix_height = mPixelSize;
959 - mImageDesc.image_type = 0;
960 + mImageDesc->face_id = (FTC_FaceID)&mEntry;
961 + mImageDesc->width = mPixelSize;
962 + mImageDesc->height = mPixelSize;
963 + mImageDesc->flags = 0;
965 nsresult rv;
966 mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
967 @@ -1907,7 +1907,7 @@
968 if (!face)
969 return 0;
971 - FTC_Image_Cache iCache;
972 + FTC_ImageCache iCache;
973 nsresult rv = mFt2->GetImageCache(&iCache);
974 if (NS_FAILED(rv)) {
975 NS_ERROR("Failed to get Image Cache");
976 @@ -1945,8 +1945,8 @@
978 FTC_Manager cManager;
979 mFt2->GetFTCacheManager(&cManager);
980 - nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
981 - &face, nsnull);
982 + nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
983 + &face);
984 NS_ASSERTION(rv==0, "failed to get face/size");
985 if (rv)
986 return nsnull;
987 @@ -2392,16 +2392,16 @@
988 mEntry->GetFamilyName(fontName);
989 mEntry->GetStyleName(styleName);
991 - mImageDesc.font.face_id = (void*)mEntry;
992 + mImageDesc->face_id = (FTC_FaceID)&mEntry;
993 // TT glyph has no relation to size
994 - mImageDesc.font.pix_width = 16;
995 - mImageDesc.font.pix_height = 16;
996 - mImageDesc.image_type = 0;
997 + mImageDesc->width = 16;
998 + mImageDesc->height = 16;
999 + mImageDesc->flags = 0;
1000 FT_Face face = nsnull;
1001 FTC_Manager cManager;
1002 mFt2->GetFTCacheManager(&cManager);
1003 - nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
1004 - &face, nsnull);
1005 + nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
1006 + &face);
1007 if (NS_FAILED(rv))
1008 return;
1010 --- misc/mozilla/gfx/src/ps/nsFontMetricsPS.h 2005-06-28 20:29:10.000000000 +0200
1011 +++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.h 2008-08-20 15:42:50.000000000 +0200
1012 @@ -424,7 +424,7 @@
1013 nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID;
1014 nsCOMPtr<nsIFreeType2> mFt2;
1015 PRUint16 mPixelSize;
1016 - FTC_Image_Desc mImageDesc;
1017 + FTC_ImageType mImageDesc;
1018 nsCString mFontNameBase; // the base name of type 1 (sub) fonts
1019 nscoord mHeight;
1021 @@ -493,7 +493,7 @@
1022 protected:
1023 nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry;
1024 nsCOMPtr<nsIFreeType2> mFt2;
1025 - FTC_Image_Desc mImageDesc;
1026 + FTC_ImageType mImageDesc;
1028 #endif // MOZ_ENABLE_FREETYPE2
1029 #endif // MOZ_ENABLE_XFT
1030 --- misc/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2004-04-17 23:52:34.000000000 +0200
1031 +++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
1032 @@ -177,7 +177,7 @@
1033 FTC_Manager mgr;
1034 nsresult rv;
1035 mFt2->GetFTCacheManager(&mgr);
1036 - rv = mFt2->ManagerLookupSize(mgr, &mImageDesc.font, &face, nsnull);
1037 + rv = mFt2->ManagerLookupFace(mgr, mImageDesc->face_id, &face);
1038 NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size");
1039 if (NS_FAILED(rv))
1040 return nsnull;
1041 @@ -191,22 +191,15 @@
1042 PRBool embedded_bimap = PR_FALSE;
1043 mFaceID = aFaceID;
1044 mPixelSize = aPixelSize;
1045 - mImageDesc.font.face_id = (void*)mFaceID;
1046 - mImageDesc.font.pix_width = aPixelSize;
1047 - mImageDesc.font.pix_height = aPixelSize;
1048 - mImageDesc.image_type = 0;
1049 + mImageDesc->face_id = (FTC_FaceID)&mFaceID;
1050 + mImageDesc->width = aPixelSize;
1051 + mImageDesc->height = aPixelSize;
1052 + mImageDesc->flags = 0;
1054 if (aPixelSize < nsFreeType2::gAntiAliasMinimum) {
1055 - mImageDesc.image_type |= ftc_image_mono;
1056 anti_alias = PR_FALSE;
1059 - if (nsFreeType2::gFreeType2Autohinted)
1060 - mImageDesc.image_type |= ftc_image_flag_autohinted;
1062 - if (nsFreeType2::gFreeType2Unhinted)
1063 - mImageDesc.image_type |= ftc_image_flag_unhinted;
1065 PRUint32 num_embedded_bitmaps, i;
1066 PRInt32* embedded_bitmapheights;
1067 mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps,
1068 @@ -218,7 +211,6 @@
1069 if (embedded_bitmapheights[i] == aPixelSize) {
1070 embedded_bimap = PR_TRUE;
1071 // unhinted must be set for embedded bitmaps to be used
1072 - mImageDesc.image_type |= ftc_image_flag_unhinted;
1073 break;
1076 @@ -312,7 +304,7 @@
1077 if (!face)
1078 return NS_ERROR_FAILURE;
1080 - FTC_Image_Cache icache;
1081 + FTC_ImageCache icache;
1082 mFt2->GetImageCache(&icache);
1083 if (!icache)
1084 return NS_ERROR_FAILURE;
1085 @@ -401,7 +393,7 @@
1086 if (!face)
1087 return 0;
1089 - FTC_Image_Cache icache;
1090 + FTC_ImageCache icache;
1091 mFt2->GetImageCache(&icache);
1092 if (!icache)
1093 return 0;
1094 @@ -723,7 +715,7 @@
1095 if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2);
1096 #endif
1098 - FTC_Image_Cache icache;
1099 + FTC_ImageCache icache;
1100 mFt2->GetImageCache(&icache);
1101 if (!icache)
1102 return 0;
1103 --- misc/mozilla/gfx/src/x11shared/nsFontFreeType.h 2004-04-17 23:52:34.000000000 +0200
1104 +++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.h 2008-08-14 16:22:21.000000000 +0200
1105 @@ -110,7 +110,7 @@
1106 XImage *GetXImage(PRUint32 width, PRUint32 height);
1107 nsITrueTypeFontCatalogEntry *mFaceID;
1108 PRUint16 mPixelSize;
1109 - FTC_Image_Desc mImageDesc;
1110 + FTC_ImageType mImageDesc;
1111 nsCOMPtr<nsIFreeType2> mFt2;
1114 --- misc/mozilla/jpeg/jmorecfg.h 2004-12-12 01:57:39.000000000 +0100
1115 +++ misc/build/mozilla/jpeg/jmorecfg.h 2008-08-18 09:06:05.000000000 +0200
1116 @@ -108,7 +108,7 @@
1117 /* Defines for MMX/SSE2 support. */
1119 #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
1120 -#define HAVE_MMX_INTEL_MNEMONICS
1121 +//#define HAVE_MMX_INTEL_MNEMONICS
1123 /* SSE2 code appears broken for some cpus (bug 247437) */
1124 /* #define HAVE_SSE2_INTEL_MNEMONICS */
1125 --- misc/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2006-03-16 18:09:14.000000000 +0100
1126 +++ misc/build/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2008-08-14 16:22:21.000000000 +0200
1127 @@ -423,19 +423,19 @@
1128 return;
1131 - FTC_Image_Desc imageDesc;
1132 - imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref?
1133 + FTC_ImageType imageDesc;
1134 + imageDesc->face_id=(FTC_FaceID)font_data.font_entry.get(); // XXX do we need to addref?
1135 float twipstopixel = GetTwipsToPixels();
1136 float scale = GetPixelScale();
1137 - imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale);
1138 - imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale);
1139 - imageDesc.image_type |= ftc_image_grays;
1140 + imageDesc->width = (int)((float)(font_data.font.size)*twipstopixel/scale);
1141 + imageDesc->height = (int)((float)(font_data.font.size)*twipstopixel/scale);
1142 + imageDesc->flags |= /* ftc_image_grays */0;
1144 // get the face
1145 nsresult rv;
1146 FTC_Manager mgr;
1147 nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
1148 - rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull);
1149 + rv = nsSVGLibartFreetype::ft2->ManagerLookupFace(mgr, imageDesc->face_id, &mFace);
1150 NS_ASSERTION(mFace, "failed to get face/size");
1153 --- misc/mozilla/mailnews/addrbook/src/Makefile.in 2007-05-03 03:39:37.000000000 +0200
1154 +++ misc/build/mozilla/mailnews/addrbook/src/Makefile.in 2008-10-16 12:59:35.000000000 +0200
1155 @@ -106,6 +106,7 @@
1156 nsVCard.cpp \
1157 nsVCardObj.cpp \
1158 nsMsgVCardService.cpp \
1159 + nsAbMD5sum.cpp \
1160 nsAbLDIFService.cpp \
1161 $(NULL)
1163 @@ -114,7 +115,9 @@
1164 nsDirPrefs.h \
1165 nsAbCardProperty.h \
1166 nsAbMDBCardProperty.h \
1167 - nsVCardObj.h \
1168 + nsVCardObj.h \
1169 + nsAbAddressCollecter.h \
1170 + nsAbDirectoryQuery.h \
1171 $(NULL)
1173 ifeq ($(OS_ARCH),WINNT)
1174 --- misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2005-05-11 06:16:53.000000000 +0200
1175 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2008-08-14 16:22:21.000000000 +0200
1176 @@ -43,6 +43,7 @@
1177 #include "nsIAbBooleanExpression.h"
1178 #include "nsCOMPtr.h"
1179 #include "nsString.h"
1180 +#include "nsAbUtils.h"
1182 class nsIAbLDAPAttributeMap;
1184 @@ -74,6 +75,16 @@
1185 nsIAbBooleanConditionString* condition,
1186 nsCString& filter,
1187 int flags);
1188 + static void GenerateMultipleFilter(
1189 + nsAbBooleanConditionType conditionType,
1190 + nsCString& filter,
1191 + NS_ConvertUCS2toUTF8 &vUTF8,
1192 + CharPtrArrayGuard *pAttrs);
1193 + static void GenerateSingleFilter(
1194 + nsAbBooleanConditionType conditionType,
1195 + nsCString& filter,
1196 + NS_ConvertUCS2toUTF8 &vUTF8,
1197 + const char *ldapProperty);
1200 #endif
1201 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2007-02-18 23:18:13.000000000 +0100
1202 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2008-08-20 12:16:50.000000000 +0200
1203 @@ -126,11 +126,13 @@
1205 // use mURINoQuery to get a prefName
1206 nsCAutoString prefName;
1207 - prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
1208 + prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen);
1210 // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
1211 nsXPIDLCString URI;
1212 - rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI));
1213 + nsCAutoString uriPrefName;
1214 + uriPrefName = prefName + NS_LITERAL_CSTRING(".uri");
1215 + rv = prefs->GetCharPref(uriPrefName.get(), getter_Copies(URI));
1216 if (NS_FAILED(rv))
1219 @@ -154,6 +156,27 @@
1220 nsCAutoString tempLDAPURL(mURINoQuery);
1221 tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
1222 rv = mURL->SetSpec(tempLDAPURL);
1223 + NS_ENSURE_SUCCESS(rv,rv);
1225 + nsCAutoString aHost;
1226 + mURL->GetHost(aHost);
1227 + aHost.ReplaceChar('.','_');
1228 + prefName = nsDependentCString("ldap_2.servers.") + aHost;
1229 + PRBool useSSL=0;
1230 + rv = prefs->GetBoolPref(
1231 + PromiseFlatCString(prefName
1232 + + NS_LITERAL_CSTRING(".UseSSL")).get(),
1233 + &useSSL
1234 + );
1236 + // If use SSL,ldap url will look like this ldaps://host:port/.....
1237 + if (!NS_FAILED(rv) && useSSL)
1239 + tempLDAPURL.ReplaceSubstring("ldap:", "ldaps:");
1240 + rv = mURL->SetSpec(tempLDAPURL);
1242 + //NS_FAILED(rv) means ldap_2.servers.nscpphonebook.UseSSL not exist
1243 + rv = 0;
1245 else
1247 @@ -164,24 +187,29 @@
1248 // get the login information, if there is any
1250 rv = prefs->GetCharPref(
1251 - PromiseFlatCString(
1252 - Substring(mURINoQuery, kLDAPDirectoryRootLen,
1253 - mURINoQuery.Length() - kLDAPDirectoryRootLen)
1254 + PromiseFlatCString(prefName
1255 + NS_LITERAL_CSTRING(".auth.dn")).get(),
1256 getter_Copies(mLogin));
1257 if (NS_FAILED(rv)) {
1258 mLogin.Truncate(); // zero out mLogin
1261 + // get the password information, if there is any
1262 + //
1263 + rv = prefs->GetCharPref(
1264 + PromiseFlatCString(prefName
1265 + + NS_LITERAL_CSTRING(".auth.pwd")).get(),
1266 + getter_Copies(mPassword));
1267 + if (NS_FAILED(rv)) {
1268 + mPassword.Truncate(); // zero out mLogin
1270 // get the protocol version, if there is any. using a string pref
1271 // here instead of an int, as protocol versions sometimes have names like
1272 // "4bis".
1274 nsXPIDLCString protocolVersion;
1275 rv = prefs->GetCharPref(
1276 - PromiseFlatCString(
1277 - Substring(mURINoQuery, kLDAPDirectoryRootLen,
1278 - mURINoQuery.Length() - kLDAPDirectoryRootLen)
1279 + PromiseFlatCString(prefName
1280 + NS_LITERAL_CSTRING(".protocolVersion")).get(),
1281 getter_Copies(protocolVersion));
1283 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2006-12-22 14:51:38.000000000 +0100
1284 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2008-08-20 15:01:16.000000000 +0200
1285 @@ -74,7 +74,7 @@
1286 PRInt32 resultLimit = -1,
1287 PRInt32 timeOut = 0);
1288 virtual ~nsAbQueryLDAPMessageListener ();
1290 + void SetPassword(const nsAString& aPassword){m_sPassword = aPassword;};
1291 protected:
1292 nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
1293 nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
1294 @@ -108,6 +108,8 @@
1295 PRBool mCanceled;
1296 PRBool mWaitingForPrevQueryToFinish;
1298 + nsAutoString m_sPassword;
1300 nsCOMPtr<nsILDAPOperation> mSearchOperation;
1302 PRLock* mLock;
1303 @@ -272,7 +274,7 @@
1305 // If mLogin is set, we're expected to use it to get a password.
1307 - if (!mDirectoryQuery->mLogin.IsEmpty()) {
1308 + if (!mDirectoryQuery->mLogin.IsEmpty() && !m_sPassword.Length()) {
1309 // XXX hack until nsUTF8AutoString exists
1310 #define nsUTF8AutoString nsCAutoString
1311 nsUTF8AutoString spec;
1312 @@ -415,10 +417,13 @@
1313 rv = ldapOperation->Init(mConnection, proxyListener, nsnull);
1314 NS_ENSURE_SUCCESS(rv, rv);
1316 - // Bind
1317 - rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
1319 + // Bind
1320 + if (m_sPassword.Length())
1321 + rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(m_sPassword));
1322 + else
1323 + rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
1324 NS_ENSURE_SUCCESS(rv, rv);
1326 return rv;
1329 @@ -707,7 +712,7 @@
1330 rv = getLdapReturnAttributes (arguments, returnAttributes);
1331 NS_ENSURE_SUCCESS(rv, rv);
1335 // Get the filter
1336 nsCOMPtr<nsISupports> supportsExpression;
1337 rv = arguments->GetExpression (getter_AddRefs (supportsExpression));
1338 @@ -828,6 +833,10 @@
1339 if (msgListener)
1341 msgListener->mUrl = url;
1342 + msgListener->mQueryListener = listener;
1343 + msgListener->mResultLimit = resultLimit;
1344 + msgListener->mTimeOut = timeOut;
1345 + msgListener->mQueryArguments = arguments;
1346 return msgListener->DoSearch();
1349 @@ -845,6 +854,11 @@
1350 timeOut);
1351 if (_messageListener == NULL)
1352 return NS_ERROR_OUT_OF_MEMORY;
1354 + nsAutoString wPassword;
1355 + wPassword.AssignWithConversion(mPassword.get());
1356 + _messageListener->SetPassword(wPassword);
1358 mListener = _messageListener;
1359 *_retval = 1;
1361 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2004-07-24 21:50:29.000000000 +0200
1362 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2008-08-14 16:22:21.000000000 +0200
1363 @@ -72,6 +72,7 @@
1364 friend class nsAbQueryLDAPMessageListener;
1365 nsresult Initiate ();
1366 nsXPIDLCString mLogin; // authenticate to the LDAP server as...
1367 + nsXPIDLCString mPassword; // password to the LDAP server as...
1368 nsCOMPtr<nsILDAPURL> mDirectoryUrl; // the URL for the server
1369 PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl)
1371 --- misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:30:14.000000000 +0200
1372 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:22:21.000000000 +0200
1373 @@ -1 +1,633 @@
1374 -dummy
1376 + * The contents of this file are subject to the Mozilla Public
1377 + * License Version 1.1 (the "License"); you may not use this file
1378 + * except in compliance with the License. You may obtain a copy of
1379 + * the License at http://www.mozilla.org/MPL/
1380 + *
1381 + * Software distributed under the License is distributed on an "AS
1382 + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1383 + * implied. See the License for the specific language governing
1384 + * rights and limitations under the License.
1385 + *
1386 + * The Original Code is the Netscape security libraries.
1387 + *
1388 + * The Initial Developer of the Original Code is Netscape
1389 + * Communications Corporation. Portions created by Netscape are
1390 + * Copyright (C) 1994-2000 Netscape Communications Corporation. All
1391 + * Rights Reserved.
1392 + *
1393 + * Contributor(s):
1394 + *
1395 + * Alternatively, the contents of this file may be used under the
1396 + * terms of the GNU General Public License Version 2 or later (the
1397 + * "GPL"), in which case the provisions of the GPL are applicable
1398 + * instead of those above. If you wish to allow use of your
1399 + * version of this file only under the terms of the GPL and not to
1400 + * allow others to use your version of this file under the MPL,
1401 + * indicate your decision by deleting the provisions above and
1402 + * replace them with the notice and other provisions required by
1403 + * the GPL. If you do not delete the provisions above, a recipient
1404 + * may use your version of this file under either the MPL or the
1405 + * GPL.
1406 + */
1407 +#include <stdio.h>
1408 +#include <stdlib.h>
1410 +#include "prerr.h"
1412 +#include "prtypes.h"
1413 +#include "prlong.h"
1414 +#include "plstr.h"
1415 +#include "nsMemory.h"
1417 +#define MD5_HASH_LEN 16
1418 +#define MD5_BUFFER_SIZE 64
1419 +#define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8)
1421 +#define CV0_1 0x67452301
1422 +#define CV0_2 0xefcdab89
1423 +#define CV0_3 0x98badcfe
1424 +#define CV0_4 0x10325476
1426 +#define T1_0 0xd76aa478
1427 +#define T1_1 0xe8c7b756
1428 +#define T1_2 0x242070db
1429 +#define T1_3 0xc1bdceee
1430 +#define T1_4 0xf57c0faf
1431 +#define T1_5 0x4787c62a
1432 +#define T1_6 0xa8304613
1433 +#define T1_7 0xfd469501
1434 +#define T1_8 0x698098d8
1435 +#define T1_9 0x8b44f7af
1436 +#define T1_10 0xffff5bb1
1437 +#define T1_11 0x895cd7be
1438 +#define T1_12 0x6b901122
1439 +#define T1_13 0xfd987193
1440 +#define T1_14 0xa679438e
1441 +#define T1_15 0x49b40821
1443 +#define T2_0 0xf61e2562
1444 +#define T2_1 0xc040b340
1445 +#define T2_2 0x265e5a51
1446 +#define T2_3 0xe9b6c7aa
1447 +#define T2_4 0xd62f105d
1448 +#define T2_5 0x02441453
1449 +#define T2_6 0xd8a1e681
1450 +#define T2_7 0xe7d3fbc8
1451 +#define T2_8 0x21e1cde6
1452 +#define T2_9 0xc33707d6
1453 +#define T2_10 0xf4d50d87
1454 +#define T2_11 0x455a14ed
1455 +#define T2_12 0xa9e3e905
1456 +#define T2_13 0xfcefa3f8
1457 +#define T2_14 0x676f02d9
1458 +#define T2_15 0x8d2a4c8a
1460 +#define T3_0 0xfffa3942
1461 +#define T3_1 0x8771f681
1462 +#define T3_2 0x6d9d6122
1463 +#define T3_3 0xfde5380c
1464 +#define T3_4 0xa4beea44
1465 +#define T3_5 0x4bdecfa9
1466 +#define T3_6 0xf6bb4b60
1467 +#define T3_7 0xbebfbc70
1468 +#define T3_8 0x289b7ec6
1469 +#define T3_9 0xeaa127fa
1470 +#define T3_10 0xd4ef3085
1471 +#define T3_11 0x04881d05
1472 +#define T3_12 0xd9d4d039
1473 +#define T3_13 0xe6db99e5
1474 +#define T3_14 0x1fa27cf8
1475 +#define T3_15 0xc4ac5665
1477 +#define T4_0 0xf4292244
1478 +#define T4_1 0x432aff97
1479 +#define T4_2 0xab9423a7
1480 +#define T4_3 0xfc93a039
1481 +#define T4_4 0x655b59c3
1482 +#define T4_5 0x8f0ccc92
1483 +#define T4_6 0xffeff47d
1484 +#define T4_7 0x85845dd1
1485 +#define T4_8 0x6fa87e4f
1486 +#define T4_9 0xfe2ce6e0
1487 +#define T4_10 0xa3014314
1488 +#define T4_11 0x4e0811a1
1489 +#define T4_12 0xf7537e82
1490 +#define T4_13 0xbd3af235
1491 +#define T4_14 0x2ad7d2bb
1492 +#define T4_15 0xeb86d391
1494 +#define R1B0 0
1495 +#define R1B1 1
1496 +#define R1B2 2
1497 +#define R1B3 3
1498 +#define R1B4 4
1499 +#define R1B5 5
1500 +#define R1B6 6
1501 +#define R1B7 7
1502 +#define R1B8 8
1503 +#define R1B9 9
1504 +#define R1B10 10
1505 +#define R1B11 11
1506 +#define R1B12 12
1507 +#define R1B13 13
1508 +#define R1B14 14
1509 +#define R1B15 15
1511 +#define R2B0 1
1512 +#define R2B1 6
1513 +#define R2B2 11
1514 +#define R2B3 0
1515 +#define R2B4 5
1516 +#define R2B5 10
1517 +#define R2B6 15
1518 +#define R2B7 4
1519 +#define R2B8 9
1520 +#define R2B9 14
1521 +#define R2B10 3
1522 +#define R2B11 8
1523 +#define R2B12 13
1524 +#define R2B13 2
1525 +#define R2B14 7
1526 +#define R2B15 12
1528 +#define R3B0 5
1529 +#define R3B1 8
1530 +#define R3B2 11
1531 +#define R3B3 14
1532 +#define R3B4 1
1533 +#define R3B5 4
1534 +#define R3B6 7
1535 +#define R3B7 10
1536 +#define R3B8 13
1537 +#define R3B9 0
1538 +#define R3B10 3
1539 +#define R3B11 6
1540 +#define R3B12 9
1541 +#define R3B13 12
1542 +#define R3B14 15
1543 +#define R3B15 2
1545 +#define R4B0 0
1546 +#define R4B1 7
1547 +#define R4B2 14
1548 +#define R4B3 5
1549 +#define R4B4 12
1550 +#define R4B5 3
1551 +#define R4B6 10
1552 +#define R4B7 1
1553 +#define R4B8 8
1554 +#define R4B9 15
1555 +#define R4B10 6
1556 +#define R4B11 13
1557 +#define R4B12 4
1558 +#define R4B13 11
1559 +#define R4B14 2
1560 +#define R4B15 9
1562 +#define S1_0 7
1563 +#define S1_1 12
1564 +#define S1_2 17
1565 +#define S1_3 22
1567 +#define S2_0 5
1568 +#define S2_1 9
1569 +#define S2_2 14
1570 +#define S2_3 20
1572 +#define S3_0 4
1573 +#define S3_1 11
1574 +#define S3_2 16
1575 +#define S3_3 23
1577 +#define S4_0 6
1578 +#define S4_1 10
1579 +#define S4_2 15
1580 +#define S4_3 21
1582 +struct MD5ContextStr {
1583 + PRUint32 lsbInput;
1584 + PRUint32 msbInput;
1585 + PRUint32 cv[4];
1586 + union {
1587 + PRUint8 b[64];
1588 + PRUint32 w[16];
1589 + } u;
1591 +typedef struct MD5ContextStr MD5Context;
1593 +#define inBuf u.b
1595 +int MD5_Hash(unsigned char *dest, const char *src);
1596 +int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length);
1597 +MD5Context * MD5_NewContext(void);
1598 +void MD5_DestroyContext(MD5Context *cx, PRBool freeit);
1599 +void MD5_Begin(MD5Context *cx);
1600 +static void md5_compress(MD5Context *cx);
1601 +void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen);
1602 +void MD5_End(MD5Context *cx, unsigned char *digest,
1603 + unsigned int *digestLen, unsigned int maxDigestLen);
1604 +unsigned int MD5_FlattenSize(MD5Context *cx);
1605 +int MD5_Flatten(MD5Context *cx, unsigned char *space);
1606 +MD5Context * MD5_Resurrect(unsigned char *space, void *arg);
1607 +void MD5_TraceState(MD5Context *cx);
1609 +int
1610 +MD5_Hash(unsigned char *dest, const char *src)
1612 + return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));
1615 +int
1616 +MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
1618 + unsigned int len;
1619 + MD5Context *cx = MD5_NewContext();
1620 + if (cx == NULL) {
1621 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
1622 + return -1;
1624 + MD5_Begin(cx);
1625 + MD5_Update(cx, src, src_length);
1626 + MD5_End(cx, dest, &len, MD5_HASH_LEN);
1627 + MD5_DestroyContext(cx, PR_TRUE);
1628 + return 0;
1631 +MD5Context *
1632 +MD5_NewContext(void)
1634 + MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context));
1635 + if (cx == NULL) {
1636 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
1637 + return NULL;
1639 + return cx;
1642 +void
1643 +MD5_DestroyContext(MD5Context *cx, PRBool freeit)
1645 + if (freeit) {
1646 + free(cx);
1650 +void
1651 +MD5_Begin(MD5Context *cx)
1653 + cx->lsbInput = 0;
1654 + cx->msbInput = 0;
1655 + memset(cx->inBuf, 0, sizeof(cx->inBuf));
1656 + cx->cv[0] = CV0_1;
1657 + cx->cv[1] = CV0_2;
1658 + cx->cv[2] = CV0_3;
1659 + cx->cv[3] = CV0_4;
1662 +#define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s))
1664 +#define MASK 0x00ff00ff
1665 +#ifdef IS_LITTLE_ENDIAN
1666 +#define lendian(i32) \
1667 + (i32)
1668 +#else
1669 +#define lendian(i32) \
1670 + (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
1671 +#endif
1673 +#if defined(SOLARIS) || defined(HPUX)
1674 +#define addto64(sumhigh, sumlow, addend) \
1675 + sumlow += addend; sumhigh += (sumlow < addend);
1676 +#else
1677 +#define addto64(sumhigh, sumlow, addend) \
1678 + sumlow += addend; if (sumlow < addend) ++sumhigh;
1679 +#endif
1681 +#define F(X, Y, Z) \
1682 + ((X & Y) | ((~X) & Z))
1684 +#define G(X, Y, Z) \
1685 + ((X & Z) | (Y & (~Z)))
1687 +#define H(X, Y, Z) \
1688 + (X ^ Y ^ Z)
1690 +#define I(X, Y, Z) \
1691 + (Y ^ (X | (~Z)))
1693 +#define FF(a, b, c, d, bufint, s, ti) \
1694 + a = b + cls(a + F(b, c, d) + bufint + ti, s)
1696 +#define GG(a, b, c, d, bufint, s, ti) \
1697 + a = b + cls(a + G(b, c, d) + bufint + ti, s)
1699 +#define HH(a, b, c, d, bufint, s, ti) \
1700 + a = b + cls(a + H(b, c, d) + bufint + ti, s)
1702 +#define II(a, b, c, d, bufint, s, ti) \
1703 + a = b + cls(a + I(b, c, d) + bufint + ti, s)
1705 +static void
1706 +md5_compress(MD5Context *cx)
1708 + PRUint32 a, b, c, d;
1709 + PRUint32 tmp;
1710 + a = cx->cv[0];
1711 + b = cx->cv[1];
1712 + c = cx->cv[2];
1713 + d = cx->cv[3];
1714 +#ifndef IS_LITTLE_ENDIAN
1715 + cx->u.w[0] = lendian(cx->u.w[0]);
1716 + cx->u.w[1] = lendian(cx->u.w[1]);
1717 + cx->u.w[2] = lendian(cx->u.w[2]);
1718 + cx->u.w[3] = lendian(cx->u.w[3]);
1719 + cx->u.w[4] = lendian(cx->u.w[4]);
1720 + cx->u.w[5] = lendian(cx->u.w[5]);
1721 + cx->u.w[6] = lendian(cx->u.w[6]);
1722 + cx->u.w[7] = lendian(cx->u.w[7]);
1723 + cx->u.w[8] = lendian(cx->u.w[8]);
1724 + cx->u.w[9] = lendian(cx->u.w[9]);
1725 + cx->u.w[10] = lendian(cx->u.w[10]);
1726 + cx->u.w[11] = lendian(cx->u.w[11]);
1727 + cx->u.w[12] = lendian(cx->u.w[12]);
1728 + cx->u.w[13] = lendian(cx->u.w[13]);
1729 + cx->u.w[14] = lendian(cx->u.w[14]);
1730 + cx->u.w[15] = lendian(cx->u.w[15]);
1731 +#endif
1732 + FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0);
1733 + FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1);
1734 + FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2);
1735 + FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3);
1736 + FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4);
1737 + FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5);
1738 + FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6);
1739 + FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7);
1740 + FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8);
1741 + FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9);
1742 + FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10);
1743 + FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11);
1744 + FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12);
1745 + FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13);
1746 + FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14);
1747 + FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15);
1748 + GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0);
1749 + GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1);
1750 + GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2);
1751 + GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3);
1752 + GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4);
1753 + GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5);
1754 + GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6);
1755 + GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7);
1756 + GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8);
1757 + GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9);
1758 + GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10);
1759 + GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11);
1760 + GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12);
1761 + GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13);
1762 + GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14);
1763 + GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15);
1764 + HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0);
1765 + HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1);
1766 + HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2);
1767 + HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3);
1768 + HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4);
1769 + HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5);
1770 + HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6);
1771 + HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7);
1772 + HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8);
1773 + HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9);
1774 + HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10);
1775 + HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11);
1776 + HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12);
1777 + HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13);
1778 + HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14);
1779 + HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15);
1780 + II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0);
1781 + II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1);
1782 + II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2);
1783 + II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3);
1784 + II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4);
1785 + II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5);
1786 + II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6);
1787 + II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7);
1788 + II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8);
1789 + II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9);
1790 + II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10);
1791 + II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11);
1792 + II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12);
1793 + II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13);
1794 + II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14);
1795 + II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15);
1796 + cx->cv[0] += a;
1797 + cx->cv[1] += b;
1798 + cx->cv[2] += c;
1799 + cx->cv[3] += d;
1802 +void
1803 +MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
1805 + PRUint32 bytesToConsume;
1806 + PRUint32 inBufIndex = cx->lsbInput & 63;
1808 + /* Add the number of input bytes to the 64-bit input counter. */
1809 + addto64(cx->msbInput, cx->lsbInput, inputLen);
1810 + if (inBufIndex) {
1811 + /* There is already data in the buffer. Fill with input. */
1812 + bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
1813 + memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
1814 + if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE)
1815 + /* The buffer is filled. Run the compression function. */
1816 + md5_compress(cx);
1817 + /* Remaining input. */
1818 + inputLen -= bytesToConsume;
1819 + input += bytesToConsume;
1822 + /* Iterate over 64-byte chunks of the message. */
1823 + while (inputLen >= MD5_BUFFER_SIZE) {
1824 + memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
1825 + md5_compress(cx);
1826 + inputLen -= MD5_BUFFER_SIZE;
1827 + input += MD5_BUFFER_SIZE;
1830 + /* Tail of message (message bytes mod 64). */
1831 + if (inputLen)
1832 + memcpy(cx->inBuf, input, inputLen);
1835 +static const unsigned char padbytes[] = {
1836 + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1837 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1838 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1839 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1840 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1841 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1842 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1843 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1844 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1845 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1846 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1847 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1850 +void
1851 +MD5_End(MD5Context *cx, unsigned char *digest,
1852 + unsigned int *digestLen, unsigned int maxDigestLen)
1854 +#ifndef IS_LITTLE_ENDIAN
1855 + PRUint32 tmp;
1856 +#endif
1857 + PRUint32 lowInput, highInput;
1858 + PRUint32 inBufIndex = cx->lsbInput & 63;
1860 + if (maxDigestLen < MD5_HASH_LEN) {
1861 +// PORT_SetError(SEC_ERROR_INVALID_ARGS);
1862 + return;
1865 + /* Copy out the length of bits input before padding. */
1866 + lowInput = cx->lsbInput;
1867 + highInput = (cx->msbInput << 3) | (lowInput >> 29);
1868 + lowInput <<= 3;
1870 + if (inBufIndex < MD5_END_BUFFER) {
1871 + MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
1872 + } else {
1873 + MD5_Update(cx, padbytes,
1874 + MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);
1877 + /* Store the number of bytes input (before padding) in final 64 bits. */
1878 + cx->u.w[14] = lendian(lowInput);
1879 + cx->u.w[15] = lendian(highInput);
1881 + /* Final call to compress. */
1882 + md5_compress(cx);
1884 + /* Copy the resulting values out of the chain variables into return buf. */
1885 + *digestLen = MD5_HASH_LEN;
1886 +#ifndef IS_LITTLE_ENDIAN
1887 + cx->cv[0] = lendian(cx->cv[0]);
1888 + cx->cv[1] = lendian(cx->cv[1]);
1889 + cx->cv[2] = lendian(cx->cv[2]);
1890 + cx->cv[3] = lendian(cx->cv[3]);
1891 +#endif
1892 + memcpy(digest, cx->cv, MD5_HASH_LEN);
1895 +unsigned int
1896 +MD5_FlattenSize(MD5Context *cx)
1898 + return sizeof(*cx);
1901 +int
1902 +MD5_Flatten(MD5Context *cx, unsigned char *space)
1904 + memcpy(space, cx, sizeof(*cx));
1905 + return 0;
1908 +MD5Context *
1909 +MD5_Resurrect(unsigned char *space, void *arg)
1911 + MD5Context *cx = MD5_NewContext();
1912 + if (cx)
1913 + memcpy(cx, space, sizeof(*cx));
1914 + return cx;
1917 +void
1918 +MD5_TraceState(MD5Context *cx)
1920 +// PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
1923 +int
1924 +md5_stream (FILE *stream, unsigned char *dest)
1926 + /* Important: BLOCKSIZE must be a multiple of 64. */
1927 +#define BLOCKSIZE 4096
1928 + unsigned int len;
1929 + MD5Context *cx = MD5_NewContext();
1930 + if (cx == NULL) {
1931 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
1932 + return -1;
1935 + unsigned char buffer[BLOCKSIZE + 72];
1936 + size_t sum;
1938 + /* Initialize the computation context. */
1939 + MD5_Begin(cx);
1941 + /* Iterate over full file contents. */
1942 + while (1)
1944 + /* We read the file in blocks of BLOCKSIZE bytes. One call of the
1945 + computation function processes the whole buffer so that with the
1946 + next round of the loop another block can be read. */
1947 + size_t n;
1948 + sum = 0;
1950 + /* Read block. Take care for partial reads. */
1951 + do
1953 + n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
1955 + sum += n;
1957 + while (sum < BLOCKSIZE && n != 0);
1958 + if (n == 0 && ferror (stream))
1959 + return 1;
1961 + /* If end of file is reached, end the loop. */
1962 + if (n == 0)
1963 + break;
1965 + /* Process buffer with BLOCKSIZE bytes. Note that
1966 + BLOCKSIZE % 64 == 0
1967 + */
1968 + MD5_Update(cx, buffer, BLOCKSIZE);
1971 + /* Add the last bytes if necessary. */
1972 + if (sum > 0)
1973 + MD5_Update(cx, buffer, sum);
1975 + MD5_End(cx, dest, &len, MD5_HASH_LEN);
1976 + MD5_DestroyContext(cx, PR_TRUE);
1977 + return len;
1981 +int getMD5sum(const char * fileName,char * sum)
1983 + unsigned char bin_sum[16];
1984 + int len=0;
1985 + if (fileName)
1987 + FILE *fp=fopen(fileName,"rb");
1988 + if (fp)
1990 + len=md5_stream(fp,bin_sum);
1991 + memset(sum,0,33);
1992 + for (int i = 0; i < len; ++i)
1993 + sprintf (sum,"%s%02x",sum, bin_sum[i]);
1994 + fclose(fp);
1995 + return 0;
1998 + return 1;
2001 +int testMD5sum(const char * fileName,char * sum)
2003 + char newSum[33]="";
2004 + if (getMD5sum(fileName,newSum))
2005 + return 1;
2006 + return strcmp(newSum,sum);
2008 --- misc/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2006-12-22 14:51:38.000000000 +0100
2009 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2008-08-14 16:22:21.000000000 +0200
2010 @@ -273,8 +273,7 @@
2011 if (mCardDatabase)
2013 mCardDatabase->EditCard(this, PR_TRUE);
2014 - mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2015 - return NS_OK;
2016 + return mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2018 else
2019 return NS_ERROR_FAILURE;
2020 --- misc/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-01-29 20:31:58.000000000 +0100
2021 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
2022 @@ -561,7 +561,7 @@
2026 - mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2027 + rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2029 return rv;
2031 @@ -707,6 +707,7 @@
2032 return NS_ERROR_NOT_IMPLEMENTED;
2034 nsresult rv = NS_OK;
2036 if (!mDatabase)
2037 rv = GetAbDatabase();
2039 @@ -736,10 +737,11 @@
2040 mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE /* notify */);
2041 else
2042 mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE);
2043 - mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2044 + rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2046 + NS_ENSURE_SUCCESS(rv, rv);
2047 NS_IF_ADDREF(*addedCard = newCard);
2048 - return NS_OK;
2049 + return rv;
2052 NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
2053 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2004-07-31 20:04:18.000000000 +0200
2054 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2008-08-14 16:22:21.000000000 +0200
2055 @@ -94,6 +94,7 @@
2057 index_DisplayName = 0,
2058 index_EmailAddress,
2059 + index_SecondEmailAddress,
2060 index_FirstName,
2061 index_LastName,
2062 index_NickName,
2063 @@ -121,32 +122,34 @@
2065 static const ULONG OutlookCardMAPIProps [] =
2067 - PR_DISPLAY_NAME_W,
2068 - PR_EMAIL_ADDRESS_W,
2069 - PR_GIVEN_NAME_W,
2070 - PR_SURNAME_W,
2071 - PR_NICKNAME_W,
2072 - PR_BUSINESS_TELEPHONE_NUMBER_W,
2073 - PR_HOME_TELEPHONE_NUMBER_W,
2074 - PR_BUSINESS_FAX_NUMBER_W,
2075 - PR_PAGER_TELEPHONE_NUMBER_W,
2076 - PR_MOBILE_TELEPHONE_NUMBER_W,
2077 - PR_HOME_ADDRESS_CITY_W,
2078 - PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
2079 - PR_HOME_ADDRESS_POSTAL_CODE_W,
2080 - PR_HOME_ADDRESS_COUNTRY_W,
2081 - PR_BUSINESS_ADDRESS_CITY_W,
2082 - PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
2083 - PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
2084 - PR_BUSINESS_ADDRESS_COUNTRY_W,
2085 - PR_TITLE_W,
2086 - PR_DEPARTMENT_NAME_W,
2087 - PR_COMPANY_NAME_W,
2088 - PR_BUSINESS_HOME_PAGE_W,
2089 - PR_PERSONAL_HOME_PAGE_W,
2090 - PR_COMMENT_W
2091 + PR_DISPLAY_NAME_A,//0x8035001E
2092 + PR_EMAIL_ADDRESS_A,//0x8034001E
2093 + PR_SECOND_EMAIL_ADDRESS_A,//Second Email Address
2094 + PR_GIVEN_NAME_A,
2095 + PR_SURNAME_A,
2096 + PR_NICKNAME_A,
2097 + PR_BUSINESS_TELEPHONE_NUMBER_A,
2098 + PR_HOME_TELEPHONE_NUMBER_A,
2099 + PR_BUSINESS_FAX_NUMBER_A,
2100 + PR_PAGER_TELEPHONE_NUMBER_A,
2101 + PR_MOBILE_TELEPHONE_NUMBER_A,
2102 + PR_HOME_ADDRESS_CITY_A,
2103 + PR_HOME_ADDRESS_STATE_OR_PROVINCE_A,
2104 + PR_HOME_ADDRESS_POSTAL_CODE_A,
2105 + PR_HOME_ADDRESS_COUNTRY_A,
2106 + PR_BUSINESS_ADDRESS_CITY_A,
2107 + PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A,
2108 + PR_BUSINESS_ADDRESS_POSTAL_CODE_A,
2109 + PR_BUSINESS_ADDRESS_COUNTRY_A,
2110 + PR_TITLE_A,
2111 + PR_DEPARTMENT_NAME_A,
2112 + PR_COMPANY_NAME_A,
2113 + PR_BUSINESS_HOME_PAGE_A,
2114 + PR_PERSONAL_HOME_PAGE_A,
2115 + PR_COMMENT_A
2119 nsresult nsAbOutlookCard::Init(const char *aUri)
2121 nsresult retCode = nsRDFResource::Init(aUri) ;
2122 @@ -173,6 +176,7 @@
2123 SetDisplayName(unichars [index_DisplayName]->get()) ;
2124 SetNickName(unichars [index_NickName]->get()) ;
2125 SetPrimaryEmail(unichars [index_EmailAddress]->get()) ;
2126 + SetSecondEmail(unichars [index_SecondEmailAddress]->get()) ;
2127 SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ;
2128 SetHomePhone(unichars [index_HomePhoneNumber]->get()) ;
2129 SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ;
2130 @@ -207,12 +211,12 @@
2131 nsAutoString unichar ;
2132 nsAutoString unicharBis ;
2134 - if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, unichar)) {
2135 + if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_A, unichar)) {
2136 splitString(unichar, unicharBis) ;
2137 SetHomeAddress(unichar.get()) ;
2138 SetHomeAddress2(unicharBis.get()) ;
2140 - if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, unichar)) {
2141 + if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_A, unichar)) {
2142 splitString(unichar, unicharBis) ;
2143 SetWorkAddress(unichar.get()) ;
2144 SetWorkAddress2(unicharBis.get()) ;
2145 @@ -290,6 +294,7 @@
2146 SetDisplayName(properties [index_DisplayName]) ;
2147 GetNickName(getter_Copies(properties [index_NickName])) ;
2148 GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
2149 + GetSecondEmail(getter_Copies(properties [index_SecondEmailAddress])) ;
2150 GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
2151 GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
2152 GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
2153 @@ -309,9 +314,16 @@
2154 GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
2155 GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
2156 GetNotes(getter_Copies(properties [index_Comments])) ;
2157 - if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps,
2158 - index_LastProp, properties)) {
2159 - PRINTF(("Cannot set general properties.\n")) ;
2161 + int i=0;
2162 + for (i=0;i<index_LastProp;i++)
2164 + if (!mapiAddBook->SetPropertyUString(*mMapiData,
2165 + OutlookCardMAPIProps[i],
2166 + properties[i]))
2168 + PRINTF(("Cannot set properties:%d.\n",OutlookCardMAPIProps[i])) ;
2171 delete [] properties ;
2172 nsXPIDLString unichar ;
2173 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2004-04-17 20:32:14.000000000 +0200
2174 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2008-08-14 16:22:21.000000000 +0200
2175 @@ -124,8 +124,8 @@
2176 nsCAutoString uri ;
2177 nsCOMPtr<nsIRDFResource> resource ;
2179 - for (ULONG i = 0 ; i < folders.mNbEntries ; ++ i) {
2180 - folders.mEntries [i].ToString(entryId) ;
2181 + for (ULONG i = 0 ; i < folders.GetSize() ; ++ i) {
2182 + folders[i].ToString(entryId) ;
2183 buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
2184 uri.Append(entryId) ;
2186 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2006-12-22 14:51:38.000000000 +0100
2187 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
2188 @@ -126,7 +126,7 @@
2189 PRINTF(("Cannot get type.\n")) ;
2190 return NS_ERROR_FAILURE ;
2192 - if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) {
2193 + if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, unichars)) {
2194 PRINTF(("Cannot get name.\n")) ;
2195 return NS_ERROR_FAILURE ;
2197 @@ -163,45 +163,85 @@
2198 return retCode;
2201 +nsresult nsAbOutlookDirectory::BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
2202 + PRBool aSearchForOld, PRBool& aIsNewCard)
2204 + nsresult retCode = NS_OK ;
2205 + if (aSearchForOld) {
2206 + nsCStringKey key(uriName) ;
2207 + nsCOMPtr<nsISupports> existingCard = mCardList.Get(&key) ;
2209 + if (existingCard) {
2210 + nsCOMPtr<nsIAbCard> card(do_QueryInterface(existingCard, &retCode)) ;
2212 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2213 + NS_IF_ADDREF(*aNewCard = card) ;
2214 + aIsNewCard = PR_FALSE ;
2215 + return retCode ;
2218 + aIsNewCard = PR_TRUE ;
2219 + nsCOMPtr<nsIRDFResource> resource ;
2221 + nsCOMPtr<nsIAbCard> childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
2222 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2223 + resource = do_QueryInterface(childCard, &retCode) ;
2224 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2225 + retCode = resource->Init(uriName.get()) ;
2226 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2227 + NS_IF_ADDREF(*aNewCard = childCard);
2228 + return retCode ;
2231 NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards)
2233 if (!aCards) { return NS_ERROR_NULL_POINTER ; }
2234 *aCards = nsnull ;
2235 nsCOMPtr<nsISupportsArray> cardList ;
2236 + nsCStringArray uriList ;
2237 + nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
2238 nsresult retCode ;
2240 - mCardList.Reset() ;
2241 if (mIsQueryURI) {
2242 retCode = StartSearch() ;
2243 - NS_NewISupportsArray(getter_AddRefs(cardList)) ;
2245 else {
2246 - retCode = GetChildCards(getter_AddRefs(cardList), nsnull) ;
2247 + retCode = GetChildCards(uriList, nsnull) ;
2249 + NS_NewISupportsArray(getter_AddRefs(cardList)) ;
2250 if (NS_SUCCEEDED(retCode)) {
2251 // Fill the results array and update the card list
2252 // Also update the address list and notify any changes.
2253 PRUint32 nbCards = 0 ;
2254 - nsCOMPtr<nsISupports> element ;
2255 + nsCAutoString uriName;
2256 + nsCOMPtr <nsIAbCard> childCard;
2257 + PRBool searchForOldCards = 0; //(mCardList.Count() != 0) ;
2259 + nbCards = uriList.Count();
2260 + NS_NewISupportsArray(getter_AddRefs(m_AddressList));
2262 - cardList->Enumerate(aCards) ;
2263 - cardList->Count(&nbCards) ;
2264 for (PRUint32 i = 0 ; i < nbCards ; ++ i) {
2265 - cardList->GetElementAt(i, getter_AddRefs(element)) ;
2266 - nsVoidKey newKey (NS_STATIC_CAST(void *, element)) ;
2267 - nsCOMPtr<nsISupports> oldElement = mCardList.Get(&newKey) ;
2268 + PRBool isNewCard = PR_FALSE ;
2270 - if (!oldElement) {
2271 + uriList.CStringAt(i,uriName);
2272 + retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), searchForOldCards, isNewCard);
2273 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2274 + cardList->AppendElement(childCard);
2276 + if (isNewCard) {
2277 // We are dealing with a new element (probably directly
2278 // added from Outlook), we may need to sync m_AddressList
2279 - mCardList.Put(&newKey, element) ;
2280 - nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
2281 + nsCStringKey newKey(uriName) ;
2283 + mCardList.Put(&newKey, childCard) ;
2284 + nsCOMPtr<nsIAbCard> card (do_QueryInterface(childCard, &retCode)) ;
2286 NS_ENSURE_SUCCESS(retCode, retCode) ;
2287 PRBool isMailList = PR_FALSE ;
2289 retCode = card->GetIsMailList(&isMailList) ;
2290 NS_ENSURE_SUCCESS(retCode, retCode) ;
2292 if (isMailList) {
2293 // We can have mailing lists only in folder,
2294 // we must add the directory to m_AddressList
2295 @@ -224,18 +264,33 @@
2296 NotifyItemAddition(card) ;
2299 - else {
2300 - NS_ASSERTION(oldElement == element, "Different card stored") ;
2303 + return cardList->Enumerate(aCards) ;
2306 +static nsresult ExtractUriFromCard(nsIAbCard *aCard, nsCString& aUri) {
2307 + nsresult retCode = NS_OK ;
2308 + nsCOMPtr<nsIRDFResource> resource (do_QueryInterface(aCard, &retCode)) ;
2310 + // Receiving a non-RDF card is accepted
2311 + if (NS_FAILED(retCode)) { return NS_OK ; }
2312 + nsXPIDLCString uri ;
2314 + retCode = resource->GetValue(getter_Copies(uri)) ;
2315 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2316 + aUri = uri.get() ;
2317 return retCode ;
2320 NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard)
2322 if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; }
2323 - nsVoidKey key (NS_STATIC_CAST(void *, aCard)) ;
2324 + *aHasCard = PR_FALSE ;
2325 + nsCString uri ;
2327 + ExtractUriFromCard(aCard, uri) ;
2328 + nsCStringKey key(uri) ;
2330 *aHasCard = mCardList.Exists(&key) ;
2331 return NS_OK ;
2332 @@ -317,7 +372,10 @@
2333 PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
2335 else {
2336 - nsVoidKey key (NS_STATIC_CAST(void *, element)) ;
2337 + nsCString uri ;
2339 + ExtractUriFromCard(card, uri) ;
2340 + nsCStringKey key(uri) ;
2342 mCardList.Remove(&key) ;
2343 if (m_IsMailList) { m_AddressList->RemoveElement(element) ; }
2344 @@ -386,7 +444,10 @@
2346 retCode = CreateCard(aData, addedCard) ;
2347 NS_ENSURE_SUCCESS(retCode, retCode) ;
2348 - nsVoidKey newKey (NS_STATIC_CAST(void *, *addedCard)) ;
2349 + nsCString uri ;
2351 + ExtractUriFromCard(*addedCard, uri) ;
2352 + nsCStringKey newKey(uri) ;
2354 mCardList.Put(&newKey, *addedCard) ;
2355 if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; }
2356 @@ -457,7 +518,7 @@
2357 if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
2358 retCode = GetDirName(getter_Copies(name)) ;
2359 NS_ENSURE_SUCCESS(retCode, retCode) ;
2360 - if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, name.get())) {
2361 + if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, name.get())) {
2362 return NS_ERROR_FAILURE ;
2364 retCode = CommitAddressList() ;
2365 @@ -518,6 +579,7 @@
2366 {"DisplayName", PR_DISPLAY_NAME_A},
2367 {"NickName", PR_NICKNAME_A},
2368 {"PrimaryEmail", PR_EMAIL_ADDRESS_A},
2369 + {"SecondEmail",PR_SECOND_EMAIL_ADDRESS_A},
2370 {"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A},
2371 {"HomePhone", PR_HOME_TELEPHONE_NUMBER_A},
2372 {"FaxNumber", PR_BUSINESS_FAX_NUMBER_A},
2373 @@ -1027,7 +1089,10 @@
2375 nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard)
2377 - nsVoidKey newKey (NS_STATIC_CAST(void *, aCard)) ;
2378 + nsCString uri ;
2380 + ExtractUriFromCard(aCard, uri) ;
2381 + nsCStringKey newKey(uri) ;
2382 nsresult retCode = NS_OK ;
2384 mCardList.Put(&newKey, aCard) ;
2385 @@ -1051,14 +1116,14 @@
2386 retCode = BuildRestriction(aArguments, arguments) ;
2387 NS_ENSURE_SUCCESS(retCode, retCode) ;
2388 nsCOMPtr<nsISupportsArray> resultsArray ;
2389 + nsCStringArray uriArray ;
2390 PRUint32 nbResults = 0 ;
2392 - retCode = GetChildCards(getter_AddRefs(resultsArray),
2393 + retCode = GetChildCards(uriArray,
2394 arguments.rt == RES_COMMENT ? nsnull : &arguments) ;
2395 DestroyRestriction(arguments) ;
2396 NS_ENSURE_SUCCESS(retCode, retCode) ;
2397 - retCode = resultsArray->Count(&nbResults) ;
2398 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2399 + nbResults = uriArray.Count() ;
2400 nsCOMPtr<nsIAbDirectoryQueryResult> result ;
2401 nsAbDirectoryQueryResult *newResult = nsnull ;
2403 @@ -1066,15 +1131,18 @@
2404 nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ;
2406 PRUint32 i = 0 ;
2407 - nsCOMPtr<nsISupports> element ;
2408 nsCOMPtr<nsISupportsArray> propertyValues ;
2410 + nsCAutoString uriName;
2411 + nsCOMPtr <nsIAbCard> card;
2413 for (i = 0 ; i < nbResults ; ++ i) {
2414 - retCode = resultsArray->GetElementAt(i, getter_AddRefs(element)) ;
2415 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2416 - nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
2417 + PRBool isNewCard = PR_FALSE ;
2419 + uriArray.CStringAt(i,uriName);
2420 + retCode = BuildCardFromURI(uriName,getter_AddRefs(card), PR_FALSE, isNewCard);
2421 NS_ENSURE_SUCCESS(retCode, retCode) ;
2423 FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
2424 newResult = new nsAbDirectoryQueryResult(0, aArguments,
2425 nsIAbDirectoryQueryResult::queryResultMatch,
2426 @@ -1099,13 +1167,43 @@
2427 if (!aCards) { return NS_ERROR_NULL_POINTER ; }
2428 *aCards = nsnull ;
2429 nsresult retCode = NS_OK ;
2430 - nsCOMPtr<nsISupportsArray> cards ;
2432 + nsCOMPtr<nsISupportsArray> cards;
2433 + retCode = NS_NewISupportsArray(getter_AddRefs(cards));
2434 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2436 + nsCStringArray uriList;
2437 + retCode = GetChildCards(uriList,aRestriction);
2438 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2440 + nsCAutoString uriName;
2441 + nsCOMPtr <nsIAbCard> childCard;
2442 + PRUint32 nbURIs = 0 ;
2443 + nbURIs = uriList.Count();
2444 + PRUint32 i = 0 ;
2446 + for (i = 0 ; i < nbURIs ; ++ i) {
2447 + PRBool isNewCard = PR_FALSE ;
2449 + uriList.CStringAt(i,uriName);
2450 + retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), PR_TRUE, isNewCard);
2451 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2452 + cards->AppendElement(childCard);
2453 + }
2455 + NS_IF_ADDREF(*aCards = cards);
2456 + return retCode ;
2459 +nsresult nsAbOutlookDirectory::GetChildCards(nsCStringArray& aURI,
2460 + void *aRestriction)
2462 + nsresult retCode = NS_OK ;
2463 nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
2464 nsMapiEntryArray cardEntries ;
2465 LPSRestriction restriction = (LPSRestriction) aRestriction ;
2467 if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
2468 - retCode = NS_NewISupportsArray(getter_AddRefs(cards)) ;
2469 NS_ENSURE_SUCCESS(retCode, retCode) ;
2470 if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
2471 PRINTF(("Cannot get cards.\n")) ;
2472 @@ -1114,22 +1212,14 @@
2473 nsCAutoString entryId ;
2474 nsCAutoString uriName ;
2475 nsCOMPtr<nsIRDFResource> resource ;
2476 - nsCOMPtr <nsIAbCard> childCard;
2478 - for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) {
2479 - cardEntries.mEntries [card].ToString(entryId) ;
2480 + aURI.Clear();
2482 + for (ULONG card = 0 ; card < cardEntries.GetSize() ; ++ card) {
2483 + cardEntries [card].ToString(entryId) ;
2484 buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ;
2485 uriName.Append(entryId) ;
2486 - childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
2487 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2488 - resource = do_QueryInterface(childCard, &retCode) ;
2489 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2490 - retCode = resource->Init(uriName.get()) ;
2491 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2492 - cards->AppendElement(childCard) ;
2493 + aURI.AppendCString(uriName);
2495 - *aCards = cards ;
2496 - NS_ADDREF(*aCards) ;
2497 return retCode ;
2500 @@ -1153,8 +1243,8 @@
2501 nsCAutoString uriName ;
2502 nsCOMPtr <nsIRDFResource> resource ;
2504 - for (ULONG node = 0 ; node < nodeEntries.mNbEntries ; ++ node) {
2505 - nodeEntries.mEntries [node].ToString(entryId) ;
2506 + for (ULONG node = 0 ; node < nodeEntries.GetSize() ; ++ node) {
2507 + nodeEntries [node].ToString(entryId) ;
2508 buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
2509 uriName.Append(entryId) ;
2510 retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ;
2511 @@ -1275,7 +1365,7 @@
2512 // In the case of a mailing list, we cannot directly create a new card,
2513 // we have to create a temporary one in a real folder (to be able to use
2514 // templates) and then copy it to the mailing list.
2515 - if (m_IsMailList) {
2516 + if (m_IsMailList && mAbWinType == nsAbWinType_OutlookExp) {
2517 nsMapiEntry parentEntry ;
2518 nsMapiEntry temporaryEntry ;
2520 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2004-04-17 20:32:14.000000000 +0200
2521 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2008-08-14 16:22:21.000000000 +0200
2522 @@ -46,6 +46,7 @@
2523 #include "nsHashtable.h"
2525 #include "nsISupportsArray.h"
2526 +#include "nsVoidArray.h"
2528 struct nsMapiEntry ;
2530 @@ -92,6 +93,8 @@
2531 protected:
2532 // Retrieve hierarchy as cards, with an optional restriction
2533 nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ;
2534 + // Retrieve hierarchy as URIs, with an optional restriction
2535 + nsresult GetChildCards(nsCStringArray& aURI, void *aRestriction) ;
2536 // Retrieve hierarchy as directories
2537 nsresult GetChildNodes(nsISupportsArray **aNodes) ;
2538 // Create a new card
2539 @@ -103,6 +106,9 @@
2540 nsresult CommitAddressList(void) ;
2541 // Read MAPI repository
2542 nsresult UpdateAddressList(void) ;
2543 + // Search for an existing card or build a new one
2544 + nsresult BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
2545 + PRBool aSearchForOld, PRBool& aIsNewCard) ;
2547 nsMapiEntry *mMapiData ;
2548 // Container for the query threads
2549 --- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2005-05-07 08:11:28.000000000 +0200
2550 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2008-08-14 16:22:21.000000000 +0200
2551 @@ -42,6 +42,9 @@
2552 #define USES_IID_IABContainer
2553 #define USES_IID_IMAPITable
2554 #define USES_IID_IDistList
2555 +#define USES_IID_IMsgStore
2556 +#define USES_IID_IMessage
2557 +#define USES_IID_IMAPIFolder
2559 #include "nsAbWinHelper.h"
2560 #include "nsMapiAddressBook.h"
2561 @@ -59,19 +62,6 @@
2563 #define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
2565 -// Small utility to ensure release of all MAPI interfaces
2566 -template <class tInterface> struct nsMapiInterfaceWrapper
2568 - tInterface mInterface ;
2570 - nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
2571 - ~nsMapiInterfaceWrapper(void) {
2572 - if (mInterface != NULL) { mInterface->Release() ; }
2574 - operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
2575 - tInterface operator -> (void) const { return mInterface ; }
2576 - operator tInterface *(void) { return &mInterface ; }
2577 -} ;
2579 static void assignEntryID(LPENTRYID& aTarget, LPENTRYID aSource, ULONG aByteCount)
2581 @@ -249,24 +239,28 @@
2582 MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray)
2584 nsMapiEntryArray::nsMapiEntryArray(void)
2585 -: mEntries(NULL), mNbEntries(0)
2587 MOZ_COUNT_CTOR(nsMapiEntryArray) ;
2590 nsMapiEntryArray::~nsMapiEntryArray(void)
2592 - if (mEntries) { delete [] mEntries ; }
2593 + CleanUp();
2594 MOZ_COUNT_DTOR(nsMapiEntryArray) ;
2597 +void nsMapiEntryArray::AddItem(nsMapiEntry * aEntries)
2599 + m_array.AppendElement(aEntries);
2601 void nsMapiEntryArray::CleanUp(void)
2603 - if (mEntries != NULL) {
2604 - delete [] mEntries ;
2605 - mEntries = NULL ;
2606 - mNbEntries = 0 ;
2607 + nsMapiEntry *pEntries;
2608 + for (int i = 0; i < m_array.Count(); i++)
2610 + pEntries = (nsMapiEntry *)m_array.ElementAt( i);
2611 + delete pEntries;
2613 + m_array.Clear();
2616 MOZ_DECL_CTOR_COUNTER(nsAbWinHelper)
2617 @@ -280,100 +274,55 @@
2618 // same protection (MAPI is supposed to be thread-safe).
2619 PRLock *nsAbWinHelper::mMutex = PR_NewLock() ;
2621 +int nsAbWinHelper::m_clients = 0;
2623 +PRUnichar * nsAbWinHelper::m_pUniBuff = NULL;
2624 +int nsAbWinHelper::m_uniBuffLen = 0;
2625 +char * nsAbWinHelper::m_pCStrBuff = NULL;
2626 +int nsAbWinHelper::m_cstrBuffLen = 0;
2628 nsAbWinHelper::nsAbWinHelper(void)
2629 -: mAddressBook(NULL), mLastError(S_OK)
2630 +:mLastError(S_OK)
2632 MOZ_COUNT_CTOR(nsAbWinHelper) ;
2633 + m_clients++;
2636 nsAbWinHelper::~nsAbWinHelper(void)
2638 MOZ_COUNT_DTOR(nsAbWinHelper) ;
2641 -BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders)
2642 + m_clients--;
2643 + if (!m_clients)
2645 - aFolders.CleanUp() ;
2646 - nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
2647 - nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
2648 - ULONG objType = 0 ;
2649 - ULONG rowCount = 0 ;
2650 - SRestriction restriction ;
2651 - SPropTagArray folderColumns ;
2653 - mLastError = mAddressBook->OpenEntry(0, NULL, NULL, 0, &objType,
2654 - rootFolder) ;
2655 - if (HR_FAILED(mLastError)) {
2656 - PRINTF(("Cannot open root %08x.\n", mLastError)) ;
2657 - return FALSE ;
2658 + delete [] m_pUniBuff;
2659 + m_pUniBuff = NULL;
2660 + m_uniBuffLen = 0;
2661 + delete [] m_pCStrBuff;
2662 + m_pCStrBuff = NULL;
2663 + m_cstrBuffLen = 0;
2665 - mLastError = rootFolder->GetHierarchyTable(0, folders) ;
2666 - if (HR_FAILED(mLastError)) {
2667 - PRINTF(("Cannot get hierarchy %08x.\n", mLastError)) ;
2668 - return FALSE ;
2670 - // We only take into account modifiable containers,
2671 - // otherwise, we end up with all the directory services...
2672 - restriction.rt = RES_BITMASK ;
2673 - restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
2674 - restriction.res.resBitMask.relBMR = BMR_NEZ ;
2675 - restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
2676 - mLastError = folders->Restrict(&restriction, 0) ;
2677 - if (HR_FAILED(mLastError)) {
2678 - PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
2680 - folderColumns.cValues = 1 ;
2681 - folderColumns.aulPropTag [0] = PR_ENTRYID ;
2682 - mLastError = folders->SetColumns(&folderColumns, 0) ;
2683 - if (HR_FAILED(mLastError)) {
2684 - PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
2685 - return FALSE ;
2687 - mLastError = folders->GetRowCount(0, &rowCount) ;
2688 - if (HR_SUCCEEDED(mLastError)) {
2689 - aFolders.mEntries = new nsMapiEntry [rowCount] ;
2690 - aFolders.mNbEntries = 0 ;
2691 - do {
2692 - LPSRowSet rowSet = NULL ;
2694 - rowCount = 0 ;
2695 - mLastError = folders->QueryRows(1, 0, &rowSet) ;
2696 - if (HR_SUCCEEDED(mLastError)) {
2697 - rowCount = rowSet->cRows ;
2698 - if (rowCount > 0) {
2699 - nsMapiEntry& current = aFolders.mEntries [aFolders.mNbEntries ++] ;
2700 - SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
2702 - current.Assign(currentValue.Value.bin.cb,
2703 - NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
2705 - MyFreeProws(rowSet) ;
2707 - else {
2708 - PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
2710 - } while (rowCount > 0) ;
2712 - return HR_SUCCEEDED(mLastError) ;
2716 BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
2717 nsMapiEntryArray& aCards)
2719 aCards.CleanUp() ;
2720 - return GetContents(aParent, aRestriction, &aCards.mEntries, aCards.mNbEntries, 0) ;
2721 + return GetContents(aParent, aRestriction, &aCards, 0) ;
2724 BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes)
2726 aNodes.CleanUp() ;
2727 - return GetContents(aParent, NULL, &aNodes.mEntries, aNodes.mNbEntries, MAPI_DISTLIST) ;
2728 + return GetContents(aParent, NULL, &aNodes, MAPI_DISTLIST) ;
2731 BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards)
2733 - aNbCards = 0 ;
2734 - return GetContents(aParent, NULL, NULL, aNbCards, 0) ;
2735 + nsMapiEntryArray aCards;
2736 + BOOL ret=GetContents(aParent, NULL, &aCards, 0) ;
2737 + aNbCards=aCards.GetSize();
2738 + return ret;
2741 BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject,
2742 @@ -390,7 +339,7 @@
2743 aName = values->Value.lpszA ;
2745 else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) {
2746 - aName.AssignWithConversion(values->Value.lpszW) ;
2747 + UnicodeToCStr(values->Value.lpszW,aName) ;
2750 FreeBuffer(values) ;
2751 @@ -410,7 +359,7 @@
2752 aName = values->Value.lpszW ;
2754 else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) {
2755 - aName.AssignWithConversion(values->Value.lpszA) ;
2756 + CStrToUnicode(values->Value.lpszA,aName) ;
2759 FreeBuffer(values) ;
2760 @@ -431,16 +380,22 @@
2761 ULONG i = 0 ;
2763 for (i = 0 ; i < valueCount ; ++ i) {
2764 - if (PROP_ID(values [i].ulPropTag) == PROP_ID(aPropertyTags [i])) {
2765 + if (PROP_TYPE( values [i].ulPropTag) != PT_ERROR && values [i].Value.l != MAPI_E_NOT_FOUND){
2766 if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) {
2767 nsAutoString temp ;
2769 - temp.AssignWithConversion (values [i].Value.lpszA) ;
2770 + CStrToUnicode(values [i].Value.lpszA,temp) ;
2771 aNames.AppendString(temp) ;
2773 else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) {
2774 aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ;
2776 + else if (aPropertyTags [i] == PR_EMAIL_ADDRESS_A) {
2777 + nsAutoString temp ;
2779 + CStrToUnicode (values [i].Value.lpszA,temp) ;
2780 + aNames.AppendString(temp) ;
2782 else {
2783 aNames.AppendString(nsAutoString((const PRUnichar *) "")) ;
2785 @@ -466,7 +421,6 @@
2786 if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) { return FALSE ; }
2787 if (valueCount == 1 && values != NULL && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
2788 SYSTEMTIME readableTime ;
2790 if (FileTimeToSystemTime(&values->Value.ft, &readableTime)) {
2791 aYear = readableTime.wYear ;
2792 aMonth = readableTime.wMonth ;
2793 @@ -518,7 +472,7 @@
2794 nsMapiInterfaceWrapper<LPMAPIPROP> subObject ;
2795 ULONG objType = 0 ;
2797 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2798 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2799 &IID_IMAPIContainer, 0, &objType,
2800 container) ;
2801 if (HR_FAILED(mLastError)) {
2802 @@ -537,7 +491,7 @@
2803 SBinary entry ;
2804 SBinaryArray entryArray ;
2806 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2807 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2808 &IID_IABContainer, MAPI_MODIFY, &objType,
2809 container) ;
2810 if (HR_FAILED(mLastError)) {
2811 @@ -567,14 +521,15 @@
2812 value.Value.lpszW = NS_CONST_CAST(WCHAR *, aValue) ;
2814 else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
2815 - alternativeValue.AssignWithConversion(aValue) ;
2816 + UnicodeToCStr(aValue,alternativeValue) ;
2817 value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ;
2819 else {
2820 PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ;
2821 return TRUE ;
2823 - return SetMAPIProperties(aObject, 1, &value) ;
2824 + LPSPropValue values=&value;
2825 + return SetMAPIProperties(aObject, 1, values) ;
2828 BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
2829 @@ -595,7 +550,7 @@
2830 values [currentValue ++].Value.lpszW = NS_CONST_CAST(WCHAR *, aValues [i].get()) ;
2832 else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
2833 - alternativeValue.AssignWithConversion(aValues [i].get()) ;
2834 + UnicodeToCStr(aValues [i].get(),alternativeValue) ;
2835 char *av = nsCRT::strdup(alternativeValue.get()) ;
2836 if (!av) {
2837 retCode = FALSE ;
2838 @@ -633,7 +588,8 @@
2839 readableTime.wSecond = 0 ;
2840 readableTime.wMilliseconds = 0 ;
2841 if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) {
2842 - return SetMAPIProperties(aObject, 1, &value) ;
2843 + LPSPropValue values=&value;
2844 + return SetMAPIProperties(aObject, 1, values) ;
2846 return TRUE ;
2848 @@ -645,7 +601,7 @@
2849 nsMapiInterfaceWrapper<LPABCONT> container ;
2850 ULONG objType = 0 ;
2852 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
2853 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
2854 &IID_IABContainer, MAPI_MODIFY, &objType,
2855 container) ;
2856 if (HR_FAILED(mLastError)) {
2857 @@ -708,7 +664,7 @@
2858 nsMapiInterfaceWrapper<LPABCONT> container ;
2859 ULONG objType = 0 ;
2861 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
2862 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
2863 &IID_IABContainer, MAPI_MODIFY, &objType,
2864 container) ;
2865 if (HR_FAILED(mLastError)) {
2866 @@ -773,7 +729,7 @@
2867 nsMapiInterfaceWrapper<LPABCONT> container ;
2868 ULONG objType = 0 ;
2870 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2871 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2872 &IID_IABContainer, MAPI_MODIFY, &objType,
2873 container) ;
2874 if (HR_FAILED(mLastError)) {
2875 @@ -810,194 +766,77 @@
2876 return TRUE ;
2879 -BOOL nsAbWinHelper::GetDefaultContainer(nsMapiEntry& aContainer)
2881 - LPENTRYID entryId = NULL ;
2882 - ULONG byteCount = 0 ;
2884 - mLastError = mAddressBook->GetPAB(&byteCount, &entryId) ;
2885 - if (HR_FAILED(mLastError)) {
2886 - PRINTF(("Cannot get PAB %08x.\n", mLastError)) ;
2887 - return FALSE ;
2889 - aContainer.Assign(byteCount, entryId) ;
2890 - FreeBuffer(entryId) ;
2891 - return TRUE ;
2894 -enum
2896 - ContentsColumnEntryId = 0,
2897 - ContentsColumnObjectType,
2898 - ContentsColumnsSize
2899 -} ;
2901 -static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
2903 - ContentsColumnsSize,
2905 - PR_ENTRYID,
2906 - PR_OBJECT_TYPE
2908 -} ;
2910 -BOOL nsAbWinHelper::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
2911 - nsMapiEntry **aList, ULONG& aNbElements, ULONG aMapiType)
2912 +void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
2914 - if (aList != NULL) { *aList = NULL ; }
2915 - aNbElements = 0 ;
2916 - nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
2917 - nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
2918 - ULONG objType = 0 ;
2919 - ULONG rowCount = 0 ;
2920 + if (aRowset == NULL) { return ; }
2921 + ULONG i = 0 ;
2923 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
2924 - &IID_IMAPIContainer, 0, &objType,
2925 - parent) ;
2926 - if (HR_FAILED(mLastError)) {
2927 - PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
2928 - return FALSE ;
2930 - // Here, flags for WAB and MAPI could be different, so this works
2931 - // only as long as we don't want to use any flag in GetContentsTable
2932 - mLastError = parent->GetContentsTable(0, contents) ;
2933 - if (HR_FAILED(mLastError)) {
2934 - PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
2935 - return FALSE ;
2936 + for (i = 0 ; i < aRowset->cRows ; ++ i) {
2937 + FreeBuffer(aRowset->aRow [i].lpProps) ;
2939 - if (aRestriction != NULL) {
2940 - mLastError = contents->Restrict(aRestriction, 0) ;
2941 - if (HR_FAILED(mLastError)) {
2942 - PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
2943 - return FALSE ;
2946 - mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
2947 - if (HR_FAILED(mLastError)) {
2948 - PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
2949 - return FALSE ;
2951 - mLastError = contents->GetRowCount(0, &rowCount) ;
2952 - if (HR_FAILED(mLastError)) {
2953 - PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
2954 - return FALSE ;
2956 - if (aList != NULL) { *aList = new nsMapiEntry [rowCount] ; }
2957 - aNbElements = 0 ;
2958 - do {
2959 - LPSRowSet rowSet = NULL ;
2961 - rowCount = 0 ;
2962 - mLastError = contents->QueryRows(1, 0, &rowSet) ;
2963 - if (HR_FAILED(mLastError)) {
2964 - PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
2965 - return FALSE ;
2967 - rowCount = rowSet->cRows ;
2968 - if (rowCount > 0 &&
2969 - (aMapiType == 0 ||
2970 - rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)) {
2971 - if (aList != NULL) {
2972 - nsMapiEntry& current = (*aList) [aNbElements] ;
2973 - SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
2975 - current.Assign(currentValue.Value.bin.cb,
2976 - NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
2977 + FreeBuffer(aRowset) ;
2979 +void nsAbWinHelper::CStrToUnicode( const char *pStr, nsString& result)
2981 + result.Truncate( 0);
2982 + int wLen = MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, 0);
2983 + if (wLen >= m_uniBuffLen)
2985 + delete [] m_pUniBuff;
2986 + m_pUniBuff = new PRUnichar[wLen + 64];
2987 + m_uniBuffLen = wLen + 64;
2989 - ++ aNbElements ;
2990 + if (wLen)
2992 + MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, m_uniBuffLen);
2993 + result = m_pUniBuff;
2995 - MyFreeProws(rowSet) ;
2996 - } while (rowCount > 0) ;
2997 - return TRUE ;
3000 -BOOL nsAbWinHelper::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3001 - ULONG aNbProperties, LPSPropValue& aValue,
3002 - ULONG& aValueCount)
3003 +void nsAbWinHelper::UnicodeToCStr( const PRUnichar *pUStr,nsCString& result)
3005 - nsMapiInterfaceWrapper<LPMAPIPROP> object ;
3006 - ULONG objType = 0 ;
3007 - LPSPropTagArray properties = NULL ;
3008 - ULONG i = 0 ;
3010 - mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
3011 - &IID_IMAPIProp, 0, &objType,
3012 - object) ;
3013 - if (HR_FAILED(mLastError)) {
3014 - PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
3015 - return FALSE ;
3016 + result.Truncate( 0);
3017 + int cLen = WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, 0,NULL,NULL);
3018 + if (cLen >= m_cstrBuffLen) {
3019 + if (m_pCStrBuff)
3020 + delete [] m_pCStrBuff;
3021 + m_pCStrBuff = new char[cLen + 64];
3022 + m_cstrBuffLen = cLen + 64;
3024 - AllocateBuffer(CbNewSPropTagArray(aNbProperties),
3025 - NS_REINTERPRET_CAST(void **, &properties)) ;
3026 - properties->cValues = aNbProperties ;
3027 - for (i = 0 ; i < aNbProperties ; ++ i) {
3028 - properties->aulPropTag [i] = aPropertyTags [i] ;
3030 - mLastError = object->GetProps(properties, 0, &aValueCount, &aValue) ;
3031 - FreeBuffer(properties) ;
3032 - if (HR_FAILED(mLastError)) {
3033 - PRINTF(("Cannot get props %08x.\n", mLastError)) ;
3034 + if (cLen) {
3035 + WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, m_cstrBuffLen,NULL,NULL);
3036 + result = m_pCStrBuff;
3038 - return HR_SUCCEEDED(mLastError) ;
3041 -BOOL nsAbWinHelper::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3042 - const LPSPropValue& aValues)
3044 - nsMapiInterfaceWrapper<LPMAPIPROP> object ;
3045 - ULONG objType = 0 ;
3046 - LPSPropProblemArray problems = NULL ;
3047 +static nsAbWinHelper *getOutlookAddressBook(void) {
3048 + static nsMapiAddressBook *addressBook = NULL ;
3050 - mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
3051 - &IID_IMAPIProp, MAPI_MODIFY, &objType,
3052 - object) ;
3053 - if (HR_FAILED(mLastError)) {
3054 - PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
3055 - return FALSE ;
3057 - mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
3058 - if (HR_FAILED(mLastError)) {
3059 - PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
3060 - return FALSE ;
3062 - if (problems != NULL) {
3063 - for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
3064 - PRINTF(("Problem %d: index %d code %08x.\n", i,
3065 - problems->aProblem [i].ulIndex,
3066 - problems->aProblem [i].scode)) ;
3069 - mLastError = object->SaveChanges(0) ;
3070 - if (HR_FAILED(mLastError)) {
3071 - PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
3073 - return HR_SUCCEEDED(mLastError) ;
3074 + if (addressBook == NULL) { addressBook = new nsMapiAddressBook ; }
3075 + return addressBook ;
3078 -void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
3080 - if (aRowset == NULL) { return ; }
3081 - ULONG i = 0 ;
3082 +static nsAbWinHelper *getOutlookExpAddressBook(void) {
3083 + static nsWabAddressBook *addressBook = NULL ;
3085 - for (i = 0 ; i < aRowset->cRows ; ++ i) {
3086 - FreeBuffer(aRowset->aRow [i].lpProps) ;
3088 - FreeBuffer(aRowset) ;
3089 + if (addressBook == NULL) { addressBook = new nsWabAddressBook ; }
3090 + return addressBook ;
3093 nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType)
3094 : mHelper(NULL)
3096 switch(aType) {
3097 - case nsAbWinType_Outlook: mHelper = new nsMapiAddressBook ; break ;
3098 - case nsAbWinType_OutlookExp: mHelper = new nsWabAddressBook ; break ;
3099 + case nsAbWinType_Outlook: mHelper = getOutlookAddressBook() ; break ;
3100 + case nsAbWinType_OutlookExp: mHelper = getOutlookExpAddressBook() ; break ;
3101 default: break ;
3105 nsAbWinHelperGuard::~nsAbWinHelperGuard(void)
3107 - delete mHelper ;
3110 const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
3111 --- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2004-04-17 20:32:14.000000000 +0200
3112 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2008-08-14 16:22:21.000000000 +0200
3113 @@ -45,6 +45,24 @@
3114 #include "nsVoidArray.h"
3115 #include "nsXPIDLString.h"
3117 +#define PR_SECOND_EMAIL_ADDRESS_A 0x8033001E
3118 +#define PR_SCREEN_NAME_A 0x805B001E
3121 +// Small utility to ensure release of all MAPI interfaces
3122 +template <class tInterface> struct nsMapiInterfaceWrapper
3124 + tInterface mInterface ;
3126 + nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
3127 + ~nsMapiInterfaceWrapper(void) {
3128 + if (mInterface ) { mInterface->Release() ; }
3130 + operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
3131 + tInterface operator -> (void) const { return mInterface ; }
3132 + operator tInterface *(void) { return &mInterface ; }
3133 +} ;
3135 struct nsMapiEntry
3137 ULONG mByteCount ;
3138 @@ -62,14 +80,28 @@
3140 struct nsMapiEntryArray
3142 - nsMapiEntry *mEntries ;
3143 - ULONG mNbEntries ;
3145 nsMapiEntryArray(void) ;
3146 ~nsMapiEntryArray(void) ;
3148 - const nsMapiEntry& operator [] (int aIndex) const { return mEntries [aIndex] ; }
3149 + void AddItem(nsMapiEntry * aEntries);
3150 + void AddItem( ULONG mByteCount , LPENTRYID mEntryId )
3152 + nsMapiEntry * aEntries=new nsMapiEntry();
3153 + aEntries->Assign(mByteCount,mEntryId);
3154 + AddItem(aEntries);
3157 + ULONG GetSize( void) { return( m_array.Count());}
3158 + nsMapiEntry& operator [] (int aIndex) { return *(nsMapiEntry*)m_array.ElementAt(aIndex); }
3159 + nsMapiEntry* ElementAt(int aIndex) { return (nsMapiEntry*)m_array.ElementAt(aIndex); }
3160 void CleanUp(void) ;
3161 + void Remove(nsMapiEntry * aEntries){ m_array.RemoveElement(aEntries); }
3162 + void Remove(int index){ m_array.RemoveElementAt(index); }
3163 + ULONG IndexOf(nsMapiEntry * aEntries){return m_array.IndexOf(aEntries);};
3164 +private:
3165 + nsVoidArray m_array;
3169 class nsAbWinHelper
3170 @@ -79,7 +111,7 @@
3171 virtual ~nsAbWinHelper(void) ;
3173 // Get the top address books
3174 - BOOL GetFolders(nsMapiEntryArray& aFolders) ;
3175 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders) =0;
3176 // Get a list of entries for cards/mailing lists in a folder/mailing list
3177 BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3178 nsMapiEntryArray& aCards) ;
3179 @@ -97,18 +129,14 @@
3180 BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3181 ULONG aNbProperties, nsStringArray& aValues) ;
3182 // Get the value of a MAPI property of type SYSTIME
3183 - BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3184 + virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3185 WORD& aYear, WORD& aMonth, WORD& aDay) ;
3186 - // Get the value of a MAPI property of type LONG
3187 - BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
3188 // Get the value of a MAPI property of type BIN
3189 BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ;
3190 // Tests if a container contains an entry
3191 BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3192 - // Delete an entry in the address book
3193 - BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3194 // Set the value of a MAPI property of type string in unicode
3195 - BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
3196 + virtual BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
3197 const PRUnichar *aValue) ;
3198 // Same as previous, but with a bunch of properties in one call
3199 BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3200 @@ -117,32 +145,44 @@
3201 BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3202 WORD aYear, WORD aMonth, WORD aDay) ;
3203 // Create entry in the address book
3204 - BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3205 + virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3206 + // Delete an entry in the address book
3207 + virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3208 // Create a distribution list in the address book
3209 - BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3210 + virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3211 // Copy an existing entry in the address book
3212 - BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
3213 + virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
3214 // Get a default address book container
3215 - BOOL GetDefaultContainer(nsMapiEntry& aContainer) ;
3216 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer) =0;
3217 // Is the helper correctly initialised?
3218 - BOOL IsOK(void) const { return mAddressBook != NULL ; }
3219 + virtual BOOL IsOK(void) =0;/*const { return mAddressBook != NULL ; }*/
3221 + // Get the value of a MAPI property of type LONG
3222 + virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
3224 protected:
3225 HRESULT mLastError ;
3226 - LPADRBOOK mAddressBook ;
3227 static PRUint32 mEntryCounter ;
3228 static PRLock *mMutex ;
3230 + virtual HRESULT OpenEntry(ULONG cbEntryID,
3231 + LPENTRYID lpEntryID,
3232 + LPCIID lpInterface,
3233 + ULONG ulFlags,
3234 + ULONG FAR * lpulObjType,
3235 + LPUNKNOWN FAR * lppUnk
3236 + ) = 0;
3238 // Retrieve the contents of a container, with an optional restriction
3239 - BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3240 - nsMapiEntry **aList, ULONG &aNbElements, ULONG aMapiType) ;
3241 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3242 + nsMapiEntryArray *aList, ULONG aMapiType) =0;
3243 // Retrieve the values of a set of properties on a MAPI object
3244 - BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3245 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3246 ULONG aNbProperties,
3247 - LPSPropValue& aValues, ULONG& aValueCount) ;
3248 + LPSPropValue& aValues, ULONG& aValueCount) =0;
3249 // Set the values of a set of properties on a MAPI object
3250 - BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3251 - const LPSPropValue& aValues) ;
3252 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3253 + LPSPropValue& aValues) =0;
3254 // Clean-up a rowset returned by QueryRows
3255 void MyFreeProws(LPSRowSet aSet) ;
3256 // Allocation of a buffer for transmission to interfaces
3257 @@ -150,7 +190,16 @@
3258 // Destruction of a buffer provided by the interfaces
3259 virtual void FreeBuffer(LPVOID aBuffer) = 0 ;
3261 + static void CStrToUnicode( const char *pStr, nsString& result);
3262 + static void UnicodeToCStr( const PRUnichar *pStr, nsCString& result);
3264 private:
3265 + static int m_clients;
3266 + static PRUnichar * m_pUniBuff;
3267 + static int m_uniBuffLen;
3268 + static char * m_pCStrBuff;
3269 + static int m_cstrBuffLen;
3273 enum nsAbWinType
3274 @@ -168,6 +217,7 @@
3276 nsAbWinHelper *operator ->(void) { return mHelper ; }
3278 + static void FreeWinAbLibrarys();
3279 private:
3280 nsAbWinHelper *mHelper ;
3282 --- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2006-12-22 14:51:39.000000000 +0100
3283 +++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2008-08-20 15:09:45.000000000 +0200
3284 @@ -100,6 +100,9 @@
3286 static const char kMailListAddressFormat[] = "Address%d";
3288 +extern int getMD5sum(const char * fileName,char * sum);
3289 +extern int testMD5sum(const char * fileName,char * sum);
3291 static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
3293 nsAddrDatabase::nsAddrDatabase()
3294 @@ -171,6 +174,7 @@
3295 m_LastRecordKey(0),
3296 m_dbDirectory(nsnull)
3298 + memset(m_dbMd5Sum,0,33);
3301 nsAddrDatabase::~nsAddrDatabase()
3302 @@ -790,7 +794,11 @@
3303 if (NS_FAILED(ret))
3304 ret = NS_ERROR_FILE_ACCESS_DENIED;
3308 + ret = getMD5sum(nativeFileName,m_dbMd5Sum);
3309 + if (ret == 1)
3310 + ret = NS_ERROR_FAILURE;
3312 nsCRT::free(nativeFileName);
3314 if (NS_SUCCEEDED(ret) && thumb)
3315 @@ -883,6 +891,17 @@
3317 nsresult err = NS_OK;
3318 nsIMdbThumb *commitThumb = nsnull;
3320 + const char *pFilename = m_dbName.GetCString(); /* do not free */
3321 + char *nativeFileName = nsCRT::strdup(pFilename);
3322 +#if defined(XP_PC) || defined(XP_MAC)
3323 + UnixToNative(nativeFileName);
3324 +#endif
3325 + if (testMD5sum(nativeFileName,m_dbMd5Sum))
3327 + nsCRT::free(nativeFileName);
3328 + return NS_ERROR_FILE_ACCESS_DENIED;
3331 if (commitType == nsAddrDBCommitType::kLargeCommit ||
3332 commitType == nsAddrDBCommitType::kSessionCommit)
3333 @@ -936,6 +955,10 @@
3334 // ### do something with error, but clear it now because mork errors out on commits.
3335 if (m_mdbEnv)
3336 m_mdbEnv->ClearErrors();
3337 + if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum))
3338 + err = NS_ERROR_FAILURE;
3339 + nsCRT::free(nativeFileName);
3341 return err;
3344 --- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2006-12-22 14:51:39.000000000 +0100
3345 +++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2008-08-14 16:29:20.000000000 +0200
3346 @@ -394,6 +394,7 @@
3347 nsIMdbTable *m_mdbPabTable;
3348 nsIMdbTable *m_mdbDeletedCardsTable;
3349 nsFileSpec m_dbName;
3350 + char m_dbMd5Sum[33];
3351 PRBool m_mdbTokensInitialized;
3352 nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners;
3354 --- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
3355 +++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
3356 @@ -40,6 +40,22 @@
3358 #include "prlog.h"
3360 +static char * stristr(const char *big, const char *little)
3362 + PRUint32 len;
3364 + if (!big || !little || !*big || !*little)
3365 + return 0;
3366 + len = strlen(little);
3368 + for( ; *big; big++ )
3369 + if(!_strnicmp (big, little, 1) && ! _strnicmp (big, little, len) )
3370 + return (char *)big;
3372 + return (char *)0;
3376 #ifdef PR_LOGGING
3377 static PRLogModuleInfo* gMapiAddressBookLog
3378 = PR_NewLogModule("nsMapiAddressBookLog");
3379 @@ -47,6 +63,60 @@
3381 #define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
3383 +#define OUTLOOK_EMAIL_DIAPLAY_MAPI_ID 0x00008005 //use to get and set display
3384 +#define OUTLOOK_EMAIL1_MAPI_ID 0x00008084 //use to get and set primary email address
3385 +#define OUTLOOK_EMAIL2_MAPI_ID 0x00008094 //use to get and set second email address
3386 +#define OUTLOOK_EMAIL_SCREEN_NAME 0x8061001E //use to get and set screen name
3387 +#define OUTLOOK_EMAIL_ORGID 0x00008085 //use to get orginal entryid to add to distlist
3388 +#define OUTLOOK_EMAIL_LIST1 0x00008054 //use to get distlist table
3389 +#define OUTLOOK_EMAIL_LIST2 0x00008055 //use to set distlist table
3391 +static const TagMap TagMaps[]={
3392 + {PR_DISPLAY_NAME_A, OUTLOOK_EMAIL_DIAPLAY_MAPI_ID, PT_STRING8},
3393 + {PR_EMAIL_ADDRESS_A, OUTLOOK_EMAIL1_MAPI_ID, PT_STRING8},
3394 + {PR_SECOND_EMAIL_ADDRESS_A, OUTLOOK_EMAIL2_MAPI_ID, PT_STRING8},
3395 + {PR_SCREEN_NAME_A, OUTLOOK_EMAIL_SCREEN_NAME, PT_STRING8}};
3397 +enum {
3398 + ieidPR_ENTRYID = 0,
3399 + ieidPR_OBJECT_TYPE,
3400 + ieidPR_DISPLAY_NAME,
3401 + ieidPR_MESSAGE_CLASS,
3402 + ieidPR_STORE_ENTRYID,
3403 + ieidPR_MESSAGE_RECIPIENTS,
3404 + ieidMax
3407 +static const SizedSPropTagArray(ieidMax, ptaEid)=
3409 + ieidMax,
3411 + PR_ENTRYID,
3412 + PR_OBJECT_TYPE,
3413 + PR_DISPLAY_NAME,
3414 + PR_MESSAGE_CLASS,
3415 + PR_STORE_ENTRYID,
3416 + PR_MESSAGE_RECIPIENTS
3420 +enum
3422 + ContentsColumnEntryId = 0,
3423 + ContentsColumnObjectType,
3424 + ContentsColumnMessageClass,
3425 + ContentsColumnsSize
3426 +} ;
3428 +static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
3430 + ContentsColumnsSize,
3432 + PR_ENTRYID,
3433 + PR_OBJECT_TYPE,
3434 + PR_MESSAGE_CLASS
3436 +} ;
3438 HMODULE nsMapiAddressBook::mLibrary = NULL ;
3439 PRInt32 nsMapiAddressBook::mLibUsage = 0 ;
3440 @@ -59,7 +129,7 @@
3441 BOOL nsMapiAddressBook::mInitialized = FALSE ;
3442 BOOL nsMapiAddressBook::mLogonDone = FALSE ;
3443 LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
3444 -LPADRBOOK nsMapiAddressBook::mRootBook = NULL ;
3445 +#define MAPI_NO_COINIT 8
3447 BOOL nsMapiAddressBook::LoadMapiLibrary(void)
3449 @@ -91,7 +161,7 @@
3450 mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX,
3451 GetProcAddress(mLibrary, "MAPILogonEx")) ;
3452 if (!mMAPILogonEx) { return FALSE ; }
3453 - MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS } ;
3454 + MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT } ;
3455 HRESULT retCode = mMAPIInitialize(&mapiInit) ;
3457 if (HR_FAILED(retCode)) {
3458 @@ -105,22 +175,19 @@
3459 MAPI_NEW_SESSION,
3460 &mRootSession) ;
3461 if (HR_FAILED(retCode)) {
3462 - PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; return FALSE ;
3463 + PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ;
3464 + return FALSE ;
3466 mLogonDone = TRUE ;
3467 - retCode = mRootSession->OpenAddressBook(0, NULL, 0, &mRootBook) ;
3468 - if (HR_FAILED(retCode)) {
3469 - PRINTF(("Cannot open MAPI address book %08x.\n", retCode)) ;
3472 return HR_SUCCEEDED(retCode) ;
3475 void nsMapiAddressBook::FreeMapiLibrary(void)
3477 if (mLibrary) {
3478 - if (-- mLibUsage == 0) {
3479 + if (--mLibUsage < 0) {
3481 - if (mRootBook) { mRootBook->Release() ; }
3482 if (mRootSession) {
3483 if (mLogonDone) {
3484 mRootSession->Logoff(NULL, 0, 0) ;
3485 @@ -134,6 +201,7 @@
3488 FreeLibrary(mLibrary) ;
3489 + mRootSession = NULL;
3490 mLibrary = NULL ;
3493 @@ -145,7 +213,6 @@
3494 : nsAbWinHelper()
3496 BOOL result = Initialize() ;
3498 NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ;
3499 MOZ_COUNT_CTOR(nsMapiAddressBook) ;
3501 @@ -153,22 +220,882 @@
3502 nsMapiAddressBook::~nsMapiAddressBook(void)
3504 nsAutoLock guard(mMutex) ;
3506 + CleanUpMDB();
3507 FreeMapiLibrary() ;
3508 MOZ_COUNT_DTOR(nsMapiAddressBook) ;
3511 +LPSPropValue nsMapiAddressBook::GetMapiProperty( LPMAPIPROP pProp, ULONG tag)
3513 + if (!pProp)
3514 + return( NULL);
3516 + int sz = CbNewSPropTagArray( 1);
3517 + SPropTagArray *pTag = (SPropTagArray *) new char[sz];
3518 + pTag->cValues = 1;
3519 + pTag->aulPropTag[0] = tag;
3520 + LPSPropValue lpProp = NULL;
3521 + ULONG cValues = 0;
3522 + HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp);
3523 + delete pTag;
3524 + if (HR_FAILED( hr) || (cValues != 1)) {
3525 + if (lpProp)
3526 + mMAPIFreeBuffer( lpProp);
3527 + return( NULL);
3529 + else {
3530 + if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) {
3531 + if (lpProp->Value.l == MAPI_E_NOT_FOUND) {
3532 + mMAPIFreeBuffer( lpProp);
3533 + lpProp = NULL;
3538 + return( lpProp);
3540 +BOOL nsMapiAddressBook::GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal)
3542 + if (!pVal)
3543 + return( FALSE);
3545 + BOOL bResult = TRUE;
3546 + switch (PROP_TYPE(pVal->ulPropTag))
3548 + case PT_BINARY:
3549 + cbEntryId = pVal->Value.bin.cb;
3550 + mMAPIAllocateBuffer( cbEntryId, (LPVOID *) &lpEntryId);
3551 + memcpy( lpEntryId, pVal->Value.bin.lpb, cbEntryId);
3552 + break;
3554 + default:
3555 + PRINTF(( "EntryId not in BINARY prop value\n"));
3556 + bResult = FALSE;
3557 + break;
3560 + if (pVal && delVal)
3561 + mMAPIFreeBuffer( pVal);
3563 + return( bResult);
3566 +BOOL nsMapiAddressBook::HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
3568 + LPMDB lpMsgStore;
3569 + ULONG objType=0;
3570 + HRESULT hr;
3572 + if (oType == MAPI_MESSAGE)
3573 + return FALSE;
3574 + if (oType == MAPI_STORE)
3576 + hr=mRootSession->OpenEntry(
3577 + cb,
3578 + pEntry,
3579 + &IID_IMsgStore,
3580 + MAPI_BEST_ACCESS,
3581 + &objType,
3582 + (IUnknown**)&lpMsgStore);
3583 + if (FAILED(hr))
3584 + return FALSE ;
3585 + //Add MDB to a list to make it can be released when class destroyed.
3586 + //We must leave it openned or else we can't open address store in it.
3587 + AddToMDBArray(lpMsgStore);
3589 + LPSPropValue pVal;
3590 + pVal=GetMapiProperty(lpMsgStore,PR_IPM_SUBTREE_ENTRYID);
3593 + if (pVal) {
3594 + ULONG cbEntry;
3595 + LPENTRYID pEntry;
3596 + nsMapiInterfaceWrapper<LPMAPICONTAINER> lpSubTree;
3598 + if (GetEntryIdFromProp( pVal, cbEntry, pEntry)) {
3599 + // Open up the folder!
3600 + BOOL bResult = TRUE;
3601 + bResult = lpMsgStore->OpenEntry(
3602 + cbEntry,
3603 + pEntry,
3604 + NULL,
3605 + MAPI_BEST_ACCESS,
3606 + &objType,
3607 + lpSubTree);
3608 + mMAPIFreeBuffer( pEntry);
3609 + if (!bResult && *(LPMAPICONTAINER*)&lpSubTree) {
3610 + // Iterate the subtree with the results going into the folder list
3611 + bResult = IterateHierarchy(*(LPMAPICONTAINER*)&lpSubTree,aFolders);
3613 + else {
3614 + PRINTF(( "GetStoreFolders: Error opening sub tree.\n"));
3617 + else {
3618 + PRINTF(( "GetStoreFolders: Error getting entryID from sub tree property val.\n"));
3621 + else {
3622 + PRINTF(( "GetStoreFolders: Error getting sub tree property.\n"));
3625 + else
3627 + PRINTF(("Type:%d\n",oType));
3630 + return TRUE ;
3633 +BOOL nsMapiAddressBook::IterateHierarchy(LPMAPICONTAINER pFolder,nsMapiEntryArray& aFolders, ULONG flags)
3635 + // flags can be CONVENIENT_DEPTH or 0
3636 + // CONVENIENT_DEPTH will return all depths I believe instead
3637 + // of just children
3638 + HRESULT hr;
3639 + nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
3640 + hr = pFolder->GetHierarchyTable( CONVENIENT_DEPTH , lpTable);
3641 + if (HR_FAILED(hr)) {
3642 + PRINTF(( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr));
3643 + return( FALSE);
3646 + ULONG rowCount;
3647 + hr = lpTable->GetRowCount( 0, &rowCount);
3648 + if (!rowCount) {
3649 + return( TRUE);
3652 + hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
3653 + if (HR_FAILED(hr)) {
3654 + PRINTF(( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr));
3655 + return( FALSE);
3658 + hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
3659 + if (HR_FAILED(hr)) {
3660 + PRINTF(( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr));
3661 + return( FALSE);
3664 + int cNumRows = 0;
3665 + LPSRowSet lpRow;
3666 + BOOL keepGoing = TRUE;
3667 + BOOL bResult = TRUE;
3668 + do {
3670 + lpRow = NULL;
3671 + hr = lpTable->QueryRows( 1, 0, &lpRow);
3673 + if (HR_FAILED(hr))
3675 + PRINTF(( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr));
3676 + bResult = FALSE;
3677 + break;
3680 + if (lpRow){
3681 + cNumRows = lpRow->cRows;
3683 + if (cNumRows) {
3684 + LPENTRYID lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
3685 + ULONG cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
3686 + ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
3688 + keepGoing = HandleHierarchyItem( oType, cb, lpEntry,aFolders);
3691 + MyFreeProws(lpRow);
3694 + } while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
3697 + if (bResult && !keepGoing)
3698 + bResult = FALSE;
3700 + return( bResult);
3702 +BOOL nsMapiAddressBook::HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
3704 + ULONG objType=0;
3705 + if (oType == MAPI_FOLDER)
3707 + nsMapiInterfaceWrapper<LPMAPICONTAINER> pFolder ;
3708 + if (!mRootSession->OpenEntry(
3709 + cb,
3710 + pEntry,
3711 + 0,
3712 + MAPI_BEST_ACCESS,
3713 + &objType,
3714 + pFolder))
3716 + LPSPropValue pVal;
3719 + pVal = GetMapiProperty(*(LPMAPICONTAINER*)&pFolder, PR_CONTAINER_CLASS);
3720 + if (pVal)
3722 + if (strcmp("IPF.Contact",pVal->Value.lpszA) == 0)
3724 + SPropValue *currentValue=GetMapiProperty( *(LPMAPICONTAINER*)&pFolder, PR_ENTRYID);
3726 + aFolders.AddItem(currentValue->Value.bin.cb,
3727 + NS_REINTERPRET_CAST(LPENTRYID, currentValue->Value.bin.lpb)) ;
3733 + else
3735 + PRINTF(( "GetStoreFolders - HandleHierarchyItem: Unhandled ObjectType: %ld\n", oType));
3738 + return( TRUE);
3742 +BOOL nsMapiAddressBook::GetFolders(nsMapiEntryArray& aFolders)
3744 + aFolders.CleanUp() ;
3745 + nsMapiInterfaceWrapper<LPMAPICONTAINER> rootFolder ;
3746 + nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
3747 + ULONG objType = 0 ;
3748 + ULONG rowCount = 0 ;
3750 + nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
3752 + mLastError = mRootSession->GetMsgStoresTable( 0, lpTable);
3753 + if (HR_FAILED(mLastError)) {
3754 + PRINTF(("Cannot open MAPI MsgStores %08x.\n", mLastError));
3755 + return mLastError;
3758 + mLastError = lpTable->GetRowCount( 0, &rowCount);
3760 + mLastError = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
3761 + if (FAILED(mLastError))
3762 + return( mLastError);
3763 + mLastError = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
3764 + if (FAILED(mLastError))
3765 + return mLastError;
3767 + int cNumRows = 0;
3768 + LPSRowSet lpRow;
3769 + BOOL keepGoing = TRUE;
3770 + BOOL bResult = TRUE;
3771 + do {
3773 + lpRow = NULL;
3774 + mLastError = lpTable->QueryRows( 1, 0, &lpRow);
3776 + if (HR_FAILED(mLastError)){
3777 + bResult = FALSE;
3778 + break;
3781 + if (lpRow){
3782 + cNumRows = lpRow->cRows;
3784 + if (cNumRows) {
3785 + LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
3786 + ULONG cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
3787 + ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
3790 + keepGoing = HandleContentsItem( oType, cbEID, lpEID,aFolders);
3792 + MyFreeProws( lpRow);
3795 + } while ( SUCCEEDED(mLastError) && cNumRows && lpRow && keepGoing);
3798 + return HR_SUCCEEDED(mLastError) ;
3800 +BOOL nsMapiAddressBook::CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction)
3802 + ULONG conditionType = 0 ;
3803 + ULONG ulResIndex;
3804 + if (!aRestriction)
3805 + return FALSE;
3806 + for (ulResIndex=0;ulResIndex < aRestrictionNum;ulResIndex++)
3808 + conditionType = aRestriction[ulResIndex].rt;
3809 + switch (conditionType)
3811 + case RES_EXIST :
3812 + aRestriction[ulResIndex].res.resExist.ulPropTag =
3813 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resExist.ulPropTag);
3814 + break ;
3815 + case RES_BITMASK :
3816 + aRestriction[ulResIndex].res.resBitMask.ulPropTag =
3817 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resBitMask.ulPropTag);
3818 + break ;
3819 + case RES_CONTENT :
3820 + aRestriction[ulResIndex].res.resContent.ulPropTag =
3821 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.ulPropTag);
3822 + aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag =
3823 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag);
3824 + break ;
3825 + case RES_PROPERTY :
3826 + aRestriction[ulResIndex].res.resProperty.ulPropTag =
3827 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.ulPropTag);
3828 + aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag =
3829 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag);
3830 + break ;
3831 + case RES_SIZE :
3832 + aRestriction[ulResIndex].res.resSize.ulPropTag =
3833 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resSize.ulPropTag);
3834 + break ;
3835 + case RES_COMPAREPROPS :
3836 + aRestriction[ulResIndex].res.resCompareProps.ulPropTag1 =
3837 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag1);
3838 + aRestriction[ulResIndex].res.resCompareProps.ulPropTag2 =
3839 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag2);
3840 + break ;
3841 + case RES_NOT :
3842 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resNot.lpRes);
3843 + break;
3844 + case RES_AND :
3845 + CorrectRestriction(aMapiProp,
3846 + aRestriction[ulResIndex].res.resAnd.cRes,
3847 + aRestriction[ulResIndex].res.resAnd.lpRes);
3848 + break;
3849 + case RES_OR :
3850 + CorrectRestriction(aMapiProp,
3851 + aRestriction[ulResIndex].res.resOr.cRes,
3852 + aRestriction[ulResIndex].res.resOr.lpRes);
3853 + break;
3855 + case RES_COMMENT :
3856 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resComment.lpRes);
3857 + aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag =
3858 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag);
3859 + break;
3860 + case RES_SUBRESTRICTION :
3861 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resSub.lpRes);
3862 + break;
3863 + default:
3864 + return FALSE;
3867 + return TRUE;
3869 +BOOL nsMapiAddressBook::Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList)
3871 + if (!aRestriction)
3872 + return FALSE;
3874 + ULONG conditionType = 0 ;
3876 + nsMapiEntryArray listOut;
3877 + ULONG listindex=0;
3879 + nsMapiEntryArray listDel;
3880 + ULONG delindex=0;
3882 + ULONG listsize;
3883 + ULONG resCount = 0;
3884 + ULONG resIndex = 0;
3886 + listsize = aList->GetSize();
3887 + conditionType = aRestriction->rt;
3888 + switch (conditionType)
3890 + case RES_EXIST :
3891 + case RES_BITMASK :
3892 + case RES_CONTENT :
3893 + case RES_PROPERTY :
3894 + case RES_SIZE :
3895 + case RES_COMPAREPROPS :
3896 + case RES_COMMENT :
3897 + case RES_SUBRESTRICTION :
3899 + while(listindex < aList->GetSize())
3901 + if (!FilterOnOneRow(aList->ElementAt(listindex),aRestriction))
3902 + aList->Remove(listindex);
3903 + else
3904 + listindex++;
3907 + break;
3908 + case RES_NOT :
3909 + aRestriction->res.resNot.ulReserved = 1;
3910 + case RES_AND :
3911 + case RES_OR :
3913 + if (conditionType == RES_OR)
3915 + for(listindex=0;listindex<aList->GetSize();listindex++)
3917 + listDel.AddItem(aList->ElementAt(listindex));
3921 + resCount = aRestriction->res.resAnd.cRes;
3922 + //notice that SAndRestriction ,SNotRestriction ,SOrRestriction
3923 + //use the same struct
3924 + for (resIndex = 0;resIndex < resCount;resIndex++)
3926 + //can't call listOut.CleanUp() here
3927 + //because it will destroy all Element too
3928 + while(listOut.GetSize())
3930 + listOut.Remove(0);
3933 + for(listindex=0;listindex<aList->GetSize();listindex++)
3935 + listOut.AddItem(aList->ElementAt(listindex));
3938 + Filter(&aRestriction->res.resAnd.lpRes[resIndex],&listOut);
3939 + if (conditionType == RES_NOT)
3941 + for(listindex=0;listindex<listOut.GetSize();listindex++)
3943 + aList->Remove(listOut.ElementAt(listindex));
3946 + else if (conditionType == RES_AND )
3948 + for(listindex=0;listindex<listOut.GetSize();listindex++)
3950 + if (!aList->IndexOf(listOut.ElementAt(listindex)))
3952 + aList->Remove(listOut.ElementAt(listindex));
3956 + else if (conditionType == RES_OR )
3958 + for(listindex=0;listindex<listOut.GetSize();listindex++)
3960 + listDel.Remove(listOut.ElementAt(listindex));
3962 + if (listDel.GetSize() == 0)
3964 + break;
3968 + if (conditionType == RES_OR)
3970 + for(listindex=0;listindex<listDel.GetSize();listindex++)
3972 + aList->Remove(listDel.ElementAt(listindex));
3978 + while(listDel.GetSize())
3980 + listDel.Remove(0);
3982 + while(listOut.GetSize())
3984 + listOut.Remove(0);
3988 + return TRUE;
3991 +BOOL nsMapiAddressBook::FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction)
3993 + LPMAPIPROP object ;
3994 + ULONG objType = 0 ;
3995 + LPSPropValue realValue = NULL ;
3996 + LPSPropValue resValue = NULL ;
3997 + ULONG valueCount = 0 ;
3999 + mLastError = OpenEntry(aEntry->mByteCount, aEntry->mEntryId,
4000 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4001 + (IUnknown **)&object) ;
4003 + if (HR_FAILED(mLastError)) {
4004 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4005 + return FALSE ;
4008 + ULONG conditionType = 0 ;
4009 + conditionType = aRestriction->rt;
4011 + switch (conditionType)
4013 + case RES_EXIST :
4014 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resExist.ulPropTag,1,realValue,valueCount))
4015 + return FALSE;
4016 + resValue = NULL;
4017 + break ;
4018 + case RES_CONTENT :
4019 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resContent.ulPropTag,1,realValue,valueCount))
4020 + return FALSE;
4021 + resValue = aRestriction->res.resContent.lpProp;
4022 + break ;
4023 + case RES_PROPERTY :
4024 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resProperty.ulPropTag,1,realValue,valueCount))
4025 + return FALSE;
4026 + resValue = aRestriction->res.resProperty.lpProp;
4027 + break ;
4028 + case RES_BITMASK :
4029 + return FALSE; //not support
4030 + break ;
4031 + case RES_SIZE :
4032 + return FALSE;//not been used now
4033 + break ;
4034 + case RES_COMPAREPROPS :
4035 + return FALSE;//not been used now
4036 + break ;
4037 + case RES_NOT :
4038 + return FALSE;//not need care here
4039 + break;
4040 + case RES_AND :
4041 + return FALSE;//not need care here
4042 + break;
4043 + case RES_OR :
4044 + return FALSE;//not need care here
4045 + break;
4046 + case RES_COMMENT :
4047 + return TRUE;//comment
4048 + break;
4049 + case RES_SUBRESTRICTION :
4050 + return FALSE;//not been used now
4051 + break ;
4053 + return AtomyFilter(aRestriction,realValue,resValue);
4057 +BOOL nsMapiAddressBook::AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue)
4059 + ULONG conditionType = 0 ;
4060 + conditionType = aRestriction->rt;
4062 + BOOL bTagEq=(aRealValue &&
4063 + PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) &&
4064 + aFilterValue;
4065 + // PROP_TYPE( aRealValue->ulPropTag ) == PROP_TYPE( aFilterValue->ulPropTag ));
4066 + switch (conditionType)
4068 + case RES_EXIST :
4069 + return (aRealValue && PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) ;
4070 + break ;
4071 + case RES_CONTENT :
4072 + if (bTagEq)
4074 + switch(aRestriction->res.resContent.ulFuzzyLevel)
4076 + case FL_FULLSTRING :
4077 + return !stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA);
4078 + break;
4079 + case FL_PREFIX :
4080 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == aRealValue->Value.lpszA;
4081 + break;
4082 + case FL_SUBSTRING :
4083 + default:
4084 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
4085 + break;
4088 + return FALSE;
4089 + break ;
4090 + case RES_PROPERTY :
4091 + if (bTagEq)
4093 + switch(aRestriction->res.resProperty.relop)
4095 + case RELOP_GE :
4096 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) >= 0;
4097 + break;
4098 + case RELOP_GT :
4099 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) > 0;
4100 + break;
4101 + case RELOP_LE :
4102 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) <= 0;
4103 + break;
4104 + case RELOP_LT :
4105 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) < 0;
4106 + break;
4107 + case RELOP_EQ :
4108 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == 0;
4109 + break;
4110 + case RELOP_NE :
4111 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != 0;
4112 + break;
4113 + case RELOP_RE :
4114 + default:
4115 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
4116 + break;
4120 + return FALSE;
4121 + break ;
4122 + case RES_BITMASK :
4123 + return FALSE; //not support
4124 + break ;
4125 + case RES_SIZE :
4126 + return FALSE;//not been used now
4127 + break ;
4128 + case RES_COMPAREPROPS :
4129 + return FALSE;//not been used now
4130 + break ;
4131 + case RES_NOT :
4132 + return FALSE;//not need care here
4133 + break;
4134 + case RES_AND :
4135 + return FALSE;//not need care here
4136 + break;
4137 + case RES_OR :
4138 + return FALSE;//not need care here
4139 + break;
4140 + case RES_COMMENT :
4141 + return TRUE;//comment
4142 + break;
4143 + case RES_SUBRESTRICTION :
4144 + return FALSE;//not been used now
4145 + break ;
4147 + return TRUE;
4150 +BOOL nsMapiAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
4151 + nsMapiEntryArray *aList, ULONG aMapiType)
4153 + if (aList)
4154 + aList->CleanUp();
4156 + nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
4157 + nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
4158 + ULONG objType = 0 ;
4159 + ULONG rowCount = 0 ;
4162 + nsMapiInterfaceWrapper<LPMAPIPROP> pFolder;
4163 + nsCString cs;
4164 + aParent.ToString(cs);
4166 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4167 + 0, MAPI_BEST_ACCESS, &objType, pFolder);
4168 + if (HR_FAILED(mLastError))
4170 + PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
4171 + return FALSE;
4175 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&pFolder,PR_MESSAGE_CLASS);
4176 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4178 + HRESULT hr;
4179 + LPSPropValue aValue = NULL ;
4180 + ULONG aValueCount = 0 ;
4182 + LPSPropTagArray properties = NULL ;
4183 + mMAPIAllocateBuffer(CbNewSPropTagArray(1),
4184 + (void **)&properties);
4185 + properties->cValues = 1;
4186 + properties->aulPropTag [0] = GetEmailPropertyTag(*(LPMAPIPROP*)&pFolder,OUTLOOK_EMAIL_LIST1);
4187 + hr = pFolder->GetProps(properties, 0, &aValueCount, &aValue) ;
4189 + SBinaryArray *sa=&aValue->Value.MVbin;
4191 + LPENTRYID lpEID;
4192 + ULONG cbEID;
4194 + ULONG idx;
4195 + nsMapiEntry testEntry;
4196 + nsCString sClass;
4197 + for (idx=0;sa->lpbin && idx<sa->cValues ;idx++)
4199 + lpEID= (LPENTRYID) sa->lpbin[idx].lpb;
4200 + cbEID = sa->lpbin[idx].cb;
4201 + testEntry.Assign(sa->lpbin[idx].cb,NS_REINTERPRET_CAST(LPENTRYID,sa->lpbin[idx].lpb));
4203 + if (GetPropertyString(testEntry,PR_MESSAGE_CLASS,sClass)) //Error get property
4205 + aList->AddItem(cbEID,lpEID);
4208 + Filter(aRestriction,aList);
4210 + else
4212 + if (aRestriction && !CorrectRestriction(*(LPMAPICONTAINER*)&pFolder,1,aRestriction))
4213 + return FALSE;
4214 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4215 + &IID_IMAPIContainer, MAPI_BEST_ACCESS, &objType,
4216 + parent) ;
4217 + if (HR_FAILED(mLastError)) {
4218 + PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
4219 + return FALSE ;
4222 + mLastError = parent->GetContentsTable(0, contents) ;
4223 + if (HR_FAILED(mLastError)) {
4224 + PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
4225 + return FALSE;
4227 + if (aRestriction) {
4228 + mLastError = contents->Restrict(aRestriction, TBL_BATCH) ;
4229 + if (HR_FAILED(mLastError)) {
4230 + PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
4231 + return FALSE ;
4234 + mLastError = contents->SetColumns((LPSPropTagArray)&ContentsColumns, 0);
4235 + if (HR_FAILED(mLastError)) {
4236 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
4237 + return FALSE ;
4239 + mLastError = contents->GetRowCount(0, &rowCount) ;
4240 + if (HR_FAILED(mLastError)) {
4241 + PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
4242 + return FALSE ;
4244 + do {
4245 + LPSRowSet rowSet = NULL ;
4247 + rowCount = 0 ;
4248 + mLastError = contents->QueryRows(1, 0, &rowSet) ;
4249 + if (HR_FAILED(mLastError)) {
4250 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
4251 + return FALSE ;
4253 + rowCount = rowSet->cRows ;
4254 + if (rowCount > 0 && aList)
4256 + if (aMapiType == 0 || rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)
4258 + SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
4259 + aList->AddItem(currentValue.Value.bin.cb,
4260 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
4262 + else if (aMapiType == MAPI_DISTLIST)
4264 + if (strcmp("IPM.DistList",rowSet->aRow->lpProps[ContentsColumnMessageClass].Value.lpszA)==0)
4266 + SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
4267 + aList->AddItem(currentValue.Value.bin.cb,
4268 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
4274 + MyFreeProws(rowSet) ;
4275 + } while (rowCount > 0) ;
4279 + return TRUE ;
4282 +BOOL nsMapiAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
4283 + ULONG aNbProperties, LPSPropValue& aValue,
4284 + ULONG& aValueCount)
4286 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
4287 + ULONG objType = 0 ;
4288 + LPSPropTagArray properties = NULL ;
4289 + ULONG i = 0 ;
4291 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
4292 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4293 + object) ;
4295 + if (HR_FAILED(mLastError)) {
4296 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4297 + return FALSE ;
4299 + AllocateBuffer(CbNewSPropTagArray(aNbProperties),
4300 + NS_REINTERPRET_CAST(void **, &properties));
4301 + properties->cValues = aNbProperties ;
4302 + for (i = 0 ; i < aNbProperties ; ++ i)
4304 + properties->aulPropTag [i] = GetRealMapiPropertyTag(*(LPMAPIPROP*)&object,aPropertyTags [i],TRUE);
4306 + mLastError = object->GetProps(properties, 0 , &aValueCount, &aValue) ;
4307 + FreeBuffer(properties) ;
4309 + if (HR_FAILED(mLastError)) {
4310 + PRINTF(("Error get props %08x.\n", mLastError)) ;
4312 + return HR_SUCCEEDED(mLastError);
4315 +BOOL nsMapiAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
4316 + LPSPropValue& aValues)
4318 + nsMapiInterfaceWrapper<LPMESSAGE> object;
4319 + ULONG objType = 0 ;
4320 + LPSPropProblemArray problems = NULL ;
4321 + ULONG i = 0 ;
4323 + LPMDB lpMsgStore=GetMsgStore(aObject);
4325 + if (!lpMsgStore)
4327 + return FALSE;
4329 + mLastError = lpMsgStore->OpenEntry(aObject.mByteCount, aObject.mEntryId,
4330 + &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
4331 + object) ;
4332 + lpMsgStore->Release();
4334 + if (HR_FAILED(mLastError)) {
4335 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4336 + return FALSE ;
4338 + for (i = 0 ; i < aNbProperties ; ++ i)
4340 + aValues[i].ulPropTag = GetRealMapiPropertyTag(*(LPMESSAGE*)&object,aValues[i].ulPropTag,TRUE);
4342 + mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
4343 + if (HR_FAILED(mLastError)) {
4344 + PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
4345 + return FALSE ;
4347 + if (problems) {
4348 + for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
4349 + PRINTF(("Problem %d: index %d code %08x.\n", i,
4350 + problems->aProblem [i].ulIndex,
4351 + problems->aProblem [i].scode)) ;
4354 + mLastError = object->SaveChanges(0) ;
4355 + if (MAPI_E_OBJECT_CHANGED == mLastError)
4357 + mLastError = object->SaveChanges(FORCE_SAVE ) ;
4359 + return HR_SUCCEEDED(mLastError) ;
4362 +BOOL nsMapiAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
4364 + return FALSE ;
4367 +BOOL nsMapiAddressBook::IsOK(void)
4369 + return mRootSession && mLibUsage;
4372 BOOL nsMapiAddressBook::Initialize(void)
4374 - if (mAddressBook) { return TRUE ; }
4376 nsAutoLock guard(mMutex) ;
4378 if (!LoadMapiLibrary()) {
4379 PRINTF(("Cannot load library.\n")) ;
4380 return FALSE ;
4382 - mAddressBook = mRootBook ;
4383 - return TRUE ;
4384 + return TRUE;
4387 void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
4388 @@ -181,7 +1108,803 @@
4389 mMAPIFreeBuffer(aBuffer) ;
4392 +ULONG nsMapiAddressBook::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID)
4394 + static GUID emailGUID =
4396 + 0x00062004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
4397 + };
4400 + MAPINAMEID mapiNameID;
4401 + mapiNameID.lpguid = &emailGUID;
4402 + mapiNameID.ulKind = MNID_ID;
4403 + mapiNameID.Kind.lID = nameID;
4405 + LPMAPINAMEID lpMapiNames = &mapiNameID;
4406 + LPSPropTagArray lpMailTagArray = NULL;
4408 + HRESULT result = lpProp->GetIDsFromNames(1L, &lpMapiNames, 0, &lpMailTagArray);
4409 + if (result == S_OK)
4411 + ULONG lTag = lpMailTagArray->aulPropTag[0];
4412 + mMAPIFreeBuffer(lpMailTagArray);
4413 + return lTag;
4415 + return 0L;
4417 +ULONG nsMapiAddressBook::GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest)
4419 + LPSPropValue addr;
4420 + ULONG upRealTag=aPropertyTag;
4421 + ULONG lSize=sizeof(TagMaps) / sizeof(TagMap);
4423 + for(int i=0; i<lSize; i++)
4425 + if (TagMaps[i].AddressTag == aPropertyTag)
4428 + ULONG kPriEmailColumn=GetEmailPropertyTag(lpProp,TagMaps[i].NameID);
4429 + if (aTest)
4431 + if (PR_DISPLAY_NAME_A == aPropertyTag)
4433 + //We need not change PR_DISPLAY_NAME_A tag if we are not using an address
4434 + LPSPropValue msgClass=GetMapiProperty(lpProp,PR_MESSAGE_CLASS);
4435 + if (msgClass && !strcmp("IPM.Contact",msgClass->Value.lpszA))
4437 + if (kPriEmailColumn)
4438 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4440 + else
4442 + FreeBuffer(msgClass);
4443 + upRealTag = aPropertyTag;
4446 + else //PR_DISPLAY_NAME_A == aPropertyTag
4448 + addr=GetMapiProperty(lpProp,aPropertyTag);
4449 + if (!addr || PROP_TYPE( addr->ulPropTag) == PT_ERROR ||
4450 + addr->Value.l == MAPI_E_NOT_FOUND)
4452 + if (kPriEmailColumn)
4453 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4457 + else //aTest
4459 + if (kPriEmailColumn)
4460 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4463 + break; //we find it,exit
4467 + return upRealTag;
4470 +BOOL nsMapiAddressBook::GetPropertyLong(const nsMapiEntry& aObject,
4471 + ULONG aPropertyTag,
4472 + ULONG& aValue)
4474 + aValue = 0 ;
4475 + LPSPropValue values = NULL ;
4476 + ULONG valueCount = 0 ;
4478 + if (PR_OBJECT_TYPE == aPropertyTag)
4480 + nsMapiInterfaceWrapper<LPMAPIFOLDER> pFolder ;
4481 + ULONG objType=0;
4482 + mLastError = OpenEntry(aObject.mByteCount,aObject.mEntryId,
4483 + NULL,MAPI_BEST_ACCESS,&objType, pFolder);
4484 + if (HR_FAILED(mLastError))
4486 + PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
4487 + return FALSE;
4489 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIFOLDER*)&pFolder,PR_MESSAGE_CLASS);
4490 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4492 + FreeBuffer(msgClass);
4493 + aValue = MAPI_DISTLIST;
4494 + return TRUE;
4498 + if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
4499 + return FALSE ;
4501 + if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_LONG) {
4502 + aValue = values->Value.ul ;
4504 + FreeBuffer(values) ;
4505 + return TRUE ;
4508 +BOOL nsMapiAddressBook::GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
4509 + WORD& aYear, WORD& aMonth, WORD& aDay)
4511 + aYear = 0;
4512 + aMonth = 0;
4513 + aDay = 0;
4514 + LPSPropValue values = NULL ;
4515 + ULONG valueCount = 0 ;
4517 + if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
4518 + return FALSE ;
4520 + if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
4521 + SYSTEMTIME readableTime ;
4522 + FILETIME localTime ;
4523 + FileTimeToLocalFileTime(&values->Value.ft,&localTime);
4524 + if (FileTimeToSystemTime(&localTime, &readableTime)) {
4525 + aYear = readableTime.wYear ;
4526 + aMonth = readableTime.wMonth ;
4527 + aDay = readableTime.wDay ;
4530 + FreeBuffer(values) ;
4531 + return TRUE ;
4534 +HRESULT nsMapiAddressBook::OpenEntry(ULONG cbEntryID,
4535 + LPENTRYID lpEntryID,
4536 + LPCIID lpInterface,
4537 + ULONG ulFlags,
4538 + ULONG FAR * lpulObjType,
4539 + LPUNKNOWN FAR * lppUnk
4543 + int err;
4544 + HRESULT rv;
4545 + __try
4547 + rv=mRootSession->OpenEntry(cbEntryID,
4548 + lpEntryID,
4549 + lpInterface,
4550 + ulFlags ,
4551 + lpulObjType,
4552 + lppUnk
4553 + );
4554 + }__except(err)
4556 + return (-1);
4559 + if (HR_FAILED(rv) && !m_MDBArray.Count())
4561 + //There are no openned Message store,so we have to open them all
4562 + nsMapiEntryArray aFolders;
4563 + if (GetFolders(aFolders))
4565 + __try
4567 + rv=mRootSession->OpenEntry(cbEntryID,
4568 + lpEntryID,
4569 + lpInterface,
4570 + ulFlags ,
4571 + lpulObjType,
4572 + lppUnk
4573 + );
4574 + }__except(err)
4576 + return (-1);
4580 + return rv;
4584 +BOOL nsMapiAddressBook::AddEntryToList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
4586 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
4587 + ULONG objType = 0 ;
4589 + nsMapiEntry parentEntry;
4590 + if (!GetEntryParent(aDistlist,parentEntry))
4591 + return FALSE;
4593 + LPMDB lpMsgStore=GetMsgStore(parentEntry);
4595 + if (!lpMsgStore)
4596 + return FALSE;
4597 + mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
4598 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4599 + container) ;
4600 + lpMsgStore->Release();
4602 + if (HR_FAILED(mLastError))
4603 + return FALSE ;
4606 + /*
4607 + When add mail address to distlist,Mapi need update 2 tag.
4608 + */
4609 + //update OUTLOOK_EMAIL_LIST1
4610 + ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
4611 + SBinaryArray oldChildren;
4612 + LPSBinary bins=NULL;
4613 + SBinaryArray newChildren;
4614 + LPSPropValue oldChildValue = NULL ;
4615 + ULONG valueCount = 0 ;
4617 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4619 + PRINTF(("Cannot get old children %08x.\n", mLastError)) ;
4620 + return FALSE;
4623 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4625 + oldChildren = oldChildValue->Value.MVbin;
4626 + newChildren.cValues=oldChildren.cValues + 1;
4627 + mMAPIAllocateBuffer(sizeof(SBinary) * newChildren.cValues,(void**)& bins);
4628 + newChildren.lpbin = bins;
4629 + for (ULONG i=0;i<oldChildren.cValues;i++)
4631 + newChildren.lpbin[i].lpb = oldChildren.lpbin[i].lpb;
4632 + newChildren.lpbin[i].cb = oldChildren.lpbin[i].cb;
4635 + else
4637 + newChildren.cValues = 1;
4638 + mMAPIAllocateBuffer(sizeof(SBinary) * newChildren.cValues,(void**)& bins);
4639 + newChildren.lpbin = bins;
4642 + nsMapiEntry orgEntryID;
4643 + if (!GetPropertyBin(aNewEntry,
4644 + GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_ORGID) | PT_BINARY,
4645 + orgEntryID))
4647 + return FALSE;
4649 + newChildren.lpbin[newChildren.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
4650 + newChildren.lpbin[newChildren.cValues-1].cb = orgEntryID.mByteCount;
4652 + SPropValue children;
4653 + children.ulPropTag = listTag;
4654 + children.Value.MVbin = newChildren;
4656 + LPSPropProblemArray problems = NULL ;
4657 + mLastError = container->SetProps(1, &children, &problems) ;
4658 + if (HR_FAILED(mLastError)) {
4659 + PRINTF(("Cannot set children %08x.\n", mLastError)) ;
4660 + return FALSE ;
4663 + //update OUTLOOK_EMAIL_LIST2
4664 + listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
4665 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4667 + PRINTF(("Cannot get old children %08x.\n", mLastError)) ;
4668 + return FALSE;
4671 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4673 + oldChildren = oldChildValue->Value.MVbin;
4674 + newChildren.cValues=oldChildren.cValues + 1;
4675 + mMAPIAllocateBuffer(sizeof(SBinary) * newChildren.cValues,(void**)& bins);
4676 + newChildren.lpbin = bins;
4677 + for (ULONG i=0;i<oldChildren.cValues;i++)
4679 + newChildren.lpbin[i].lpb = oldChildren.lpbin[i].lpb;
4680 + newChildren.lpbin[i].cb = oldChildren.lpbin[i].cb;
4683 + else
4685 + newChildren.cValues = 1;
4686 + mMAPIAllocateBuffer(sizeof(SBinary) * newChildren.cValues,(void**)& bins);
4687 + newChildren.lpbin = bins;
4690 + /*
4691 + Need more work here.
4692 + There are two kind of mail address in outlook DistList.
4693 + One is sample,not include in parent folder.
4694 + The other is a link to a unattached address in parents folders.
4695 + Currently we can only add first kind of address to a outlook distlist.
4696 + */
4698 + newChildren.lpbin[newChildren.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
4699 + newChildren.lpbin[newChildren.cValues-1].cb = orgEntryID.mByteCount;
4701 + children.ulPropTag = listTag;
4702 + children.Value.MVbin = newChildren;
4704 + mLastError = container->SetProps(1, &children, &problems) ;
4705 + if (HR_FAILED(mLastError))
4707 + PRINTF(("Cannot set children %08x.\n", mLastError)) ;
4708 + return FALSE ;
4711 + mMAPIFreeBuffer(bins);
4713 + mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
4714 + if (HR_FAILED(mLastError)) {
4715 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
4716 + return FALSE ;
4719 + return TRUE ;
4721 +BOOL nsMapiAddressBook::DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
4723 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
4724 + ULONG objType = 0 ;
4726 + nsMapiEntry parentEntry;
4727 + if (!GetEntryParent(aDistlist,parentEntry))
4728 + return FALSE;
4730 + LPMDB lpMsgStore=GetMsgStore(parentEntry);
4731 + if (!lpMsgStore)
4732 + return FALSE;
4734 + mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
4735 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4736 + container) ;
4737 + lpMsgStore->Release();
4739 + if (HR_FAILED(mLastError))
4740 + return FALSE ;
4741 + /*
4742 + When delete mail address from distlist,Mapi need update 2 tag.
4743 + */
4744 + //update OUTLOOK_EMAIL_LIST1
4745 + ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
4747 + SBinaryArray oldChildren;
4748 + LPSBinary bins=NULL;
4749 + SBinaryArray newChildren;
4750 + LPSPropValue oldChildValue = NULL ;
4751 + ULONG valueCount = 0 ;
4753 + newChildren.lpbin=NULL;
4755 + ULONG lDeleteEntry=0;
4756 + ULONG newIndex=0;
4757 + ULONG oldIndex=0;
4758 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4760 + PRINTF(("Cannot get old children %08x.\n", mLastError)) ;
4761 + return FALSE;
4764 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4766 + oldChildren = oldChildValue->Value.MVbin;
4767 + newChildren.cValues=oldChildren.cValues - 1;
4768 + mMAPIAllocateBuffer(sizeof(SBinary) * newChildren.cValues,(void**)& bins);
4769 + newChildren.lpbin = bins;
4770 + for (oldIndex=0;oldIndex<oldChildren.cValues;oldIndex++)
4772 + if ( oldChildren.lpbin[oldIndex].cb == aNewEntry.mByteCount &&
4773 + !memcmp((void*)(oldChildren.lpbin[oldIndex].lpb+4),
4774 + (void*)(aNewEntry.mEntryId->ab),
4775 + oldChildren.lpbin[oldIndex].cb-4))
4777 + lDeleteEntry=oldIndex;
4779 + else
4781 + newChildren.lpbin[newIndex].lpb = oldChildren.lpbin[oldIndex].lpb;
4782 + newChildren.lpbin[newIndex].cb = oldChildren.lpbin[oldIndex].cb;
4783 + newIndex++;
4787 + else
4788 + return FALSE;
4791 + SPropValue children;
4792 + LPSPropProblemArray problems = NULL ;
4794 + if (newChildren.cValues == 0)
4796 + SPropTagArray delTags;
4797 + delTags.cValues = 1;
4798 + delTags.aulPropTag[0] = listTag;
4800 + mLastError = container->DeleteProps(&delTags, &problems) ;
4802 + else
4804 + children.ulPropTag = listTag;
4805 + children.Value.MVbin = newChildren;
4806 + mLastError = container->SetProps(1, &children, &problems) ;
4809 + if (HR_FAILED(mLastError)) {
4810 + PRINTF(("Cannot set children %08x.\n", mLastError)) ;
4811 + return FALSE ;
4814 + //update OUTLOOK_EMAIL_LIST2
4815 + listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
4816 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4818 + PRINTF(("Cannot get old children %08x.\n", mLastError)) ;
4819 + return FALSE;
4822 + newIndex=0;
4823 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4825 + oldChildren = oldChildValue->Value.MVbin;
4826 + newChildren.cValues=oldChildren.cValues - 1;
4827 + mMAPIAllocateBuffer(sizeof(SBinary) * newChildren.cValues,(void**)& bins);
4828 + newChildren.lpbin = bins;
4829 + for (oldIndex=0;oldIndex<oldChildren.cValues;oldIndex++)
4831 + if (oldIndex != lDeleteEntry)
4833 + newChildren.lpbin[newIndex].lpb = oldChildren.lpbin[oldIndex].lpb;
4834 + newChildren.lpbin[newIndex].cb = oldChildren.lpbin[oldIndex].cb;
4835 + newIndex++;
4839 + else
4841 + newChildren.cValues = 1;
4842 + mMAPIAllocateBuffer(sizeof(SBinary) * newChildren.cValues,(void**)& bins);
4843 + newChildren.lpbin = bins;
4848 + if (newChildren.cValues == 0)
4850 + SPropTagArray delTags;
4851 + delTags.cValues = 1;
4852 + delTags.aulPropTag[0] = listTag;
4854 + mLastError = container->DeleteProps(&delTags, &problems) ;
4856 + else
4858 + children.ulPropTag = listTag;
4859 + children.Value.MVbin = newChildren;
4860 + mLastError = container->SetProps(1, &children, &problems) ;
4862 + if (HR_FAILED(mLastError)) {
4863 + PRINTF(("Cannot set children %08x.\n", mLastError)) ;
4864 + return FALSE ;
4867 + mMAPIFreeBuffer(bins);
4869 + mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
4870 + if (HR_FAILED(mLastError)) {
4871 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
4872 + return FALSE ;
4875 + return TRUE ;
4878 +BOOL nsMapiAddressBook::GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry)
4880 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
4881 + ULONG objType = 0 ;
4882 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4883 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4884 + (IUnknown **)&object) ;
4886 + if (HR_FAILED(mLastError)) {
4887 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4888 + return FALSE ;
4890 + SPropValue *parentID=GetMapiProperty(*(LPMAPIPROP*)&object, PR_PARENT_ENTRYID);
4892 + if (parentID->Value.l == MAPI_E_NOT_FOUND)
4893 + return FALSE;
4894 + aParentEntry.Assign(parentID->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, parentID->Value.bin.lpb));
4895 + return TRUE;
4897 +BOOL nsMapiAddressBook::CreateEntryInList(const nsMapiEntry& aDistlist, nsMapiEntry& aNewEntry)
4899 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
4900 + ULONG objType = 0 ;
4902 + nsMapiEntry parentEntry;
4903 + if (!GetEntryParent(aDistlist,parentEntry))
4905 + return FALSE;
4907 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
4908 + if (!CreateEntry(parentEntry,aNewEntry)) //Create a entry in parent folder
4909 + return FALSE;
4911 + return AddEntryToList(aDistlist,aNewEntry);
4914 +BOOL nsMapiAddressBook::CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
4916 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
4917 + ULONG objType = 0 ;
4919 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
4920 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4921 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4922 + object) ;
4924 + if (HR_FAILED(mLastError)) {
4925 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4926 + return NULL ;
4928 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
4930 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4931 + return CreateEntryInList(aParent,aNewEntry); //Create entry in DistList
4933 + LPMDB lpMsgStore=GetMsgStore(aParent);
4935 + if (!lpMsgStore)
4936 + return FALSE;
4938 + mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
4939 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
4940 + container) ;
4941 + lpMsgStore->Release();
4943 + if (HR_FAILED(mLastError))
4944 + return FALSE;
4946 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
4948 + mLastError = container->CreateMessage(&IID_IMessage,
4949 + 0,
4950 + newEntry) ;
4951 + if (HR_FAILED(mLastError)) {
4952 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
4953 + return FALSE ;
4955 + SPropValue messageclass ;
4956 + LPSPropProblemArray problems = NULL ;
4957 + nsCString tempName ;
4959 + messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
4960 + tempName.Assign("IPM.Contact") ;
4961 + messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
4962 + mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
4963 + if (HR_FAILED(mLastError)) {
4964 + PRINTF(("Cannot set temporary name %08x.\n", mLastError)) ;
4965 + return FALSE ;
4967 + mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
4968 + if (HR_FAILED(mLastError)) {
4969 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
4970 + return FALSE ;
4973 + SPropTagArray property ;
4974 + LPSPropValue value = NULL ;
4975 + ULONG valueCount = 0 ;
4977 + property.cValues = 1 ;
4978 + property.aulPropTag [0] = PR_ENTRYID ;
4979 + mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
4980 + if (HR_FAILED(mLastError) || valueCount != 1) {
4981 + PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
4982 + return FALSE ;
4984 + aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
4985 + FreeBuffer(value) ;
4986 + return TRUE ;
4989 +BOOL nsMapiAddressBook::CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
4991 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
4992 + ULONG objType = 0 ;
4994 + LPMDB lpMsgStore=GetMsgStore(aParent);
4995 + if (!lpMsgStore)
4996 + return FALSE;
4997 + mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
4998 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
4999 + container) ;
5000 + lpMsgStore->Release();
5002 + if (HR_FAILED(mLastError)) {
5003 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5004 + return FALSE ;
5007 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
5008 + mLastError = container->CreateMessage(&IID_IMAPIProp,
5009 + 0,
5010 + newEntry) ;
5011 + if (HR_FAILED(mLastError)) {
5012 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5013 + return FALSE ;
5015 + SPropValue messageclass ;
5016 + LPSPropProblemArray problems = NULL ;
5017 + nsCString tempName ;
5019 + messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
5020 + tempName.Assign("IPM.DistList") ;
5021 + messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
5022 + mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
5023 + if (HR_FAILED(mLastError)) {
5024 + PRINTF(("Cannot set PR_MESSAGE_CLASS_A %08x.\n", mLastError)) ;
5025 + return FALSE ;
5027 + mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
5028 + if (HR_FAILED(mLastError)) {
5029 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5030 + return FALSE ;
5033 + ULONG valueCount = 0 ;
5034 + SPropTagArray property ;
5035 + LPSPropValue value = NULL ;
5037 + property.cValues = 1 ;
5038 + property.aulPropTag [0] = PR_ENTRYID ;
5039 + mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
5040 + if (HR_FAILED(mLastError) || valueCount != 1) {
5041 + PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
5042 + return FALSE ;
5044 + aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
5046 + FreeBuffer(value) ;
5047 + return TRUE ;
5051 +BOOL nsMapiAddressBook::CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource,
5052 + nsMapiEntry& aTarget)
5054 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5055 + nsMapiInterfaceWrapper<LPMAPIFOLDER> targetFolder ;
5056 + ULONG objType = 0 ;
5057 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5058 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5059 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5060 + object) ;
5062 + if (HR_FAILED(mLastError)) {
5063 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5064 + return FALSE ;
5066 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5068 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5070 + //Add Entry To DistList
5071 + if (!AddEntryToList(aContainer,aSource))
5072 + return FALSE;
5073 + aTarget.Assign(aSource.mByteCount,aSource.mEntryId);
5074 + return TRUE;
5077 + SBinary entry ;
5078 + SBinaryArray entryArray ;
5080 + entry.cb = aSource.mByteCount ;
5081 + entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aSource.mEntryId) ;
5082 + entryArray.cValues = 1 ;
5083 + entryArray.lpbin = &entry ;
5085 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5086 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5087 + container) ;
5088 + if (HR_FAILED(mLastError)) {
5089 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5090 + return FALSE ;
5093 + mLastError = OpenEntry(aTarget.mByteCount, aTarget.mEntryId,
5094 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5095 + targetFolder) ;
5096 + if (HR_FAILED(mLastError)) {
5097 + PRINTF(("Cannot open Target folder %08x.\n", mLastError)) ;
5098 + return FALSE ;
5101 + nsMapiInterfaceWrapper<LPMAPIPROP> newEntry ;
5103 + mLastError = container->CopyMessages(&entryArray,
5104 + &IID_IMessage,
5105 + (void*)&targetFolder,
5106 + 0,
5107 + NULL,
5108 + NULL) ;
5109 + if (HR_FAILED(mLastError)) {
5110 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5111 + return FALSE ;
5113 + return TRUE ;
5116 +BOOL nsMapiAddressBook::DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry)
5118 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5119 + ULONG objType = 0 ;
5120 + SBinary entry ;
5121 + SBinaryArray entryArray ;
5124 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5125 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5126 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5127 + object) ;
5129 + if (HR_FAILED(mLastError)) {
5130 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5131 + return FALSE ;
5133 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5135 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5136 + return DeleteEntryFromList(aContainer,aEntry); //Delete Entry from DistList
5138 + LPMDB lpMsgStore=GetMsgStore(aContainer);
5139 + if (!lpMsgStore)
5140 + return FALSE;
5142 + mLastError = lpMsgStore->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5143 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5144 + container) ;
5145 + lpMsgStore->Release();
5146 + if (HR_FAILED(mLastError)) {
5147 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5148 + return FALSE ;
5150 + entry.cb = aEntry.mByteCount ;
5151 + entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aEntry.mEntryId) ;
5152 + entryArray.cValues = 1 ;
5153 + entryArray.lpbin = &entry ;
5154 + mLastError = container->DeleteMessages(&entryArray, 0,0,0) ;
5155 + if (HR_FAILED(mLastError)) {
5156 + PRINTF(("Cannot delete entry %08x.\n", mLastError)) ;
5157 + return FALSE ;
5159 + return TRUE ;
5162 +//Use to open message store in write mode
5163 +LPMDB nsMapiAddressBook::GetMsgStore(const nsMapiEntry& aEntry)
5165 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5166 + ULONG objType=0;
5168 + mLastError = OpenEntry(aEntry.mByteCount, aEntry.mEntryId,
5169 + &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
5170 + object) ;
5171 + if (HR_FAILED(mLastError)) {
5172 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5173 + return NULL ;
5175 + SPropValue *svMsgSore=GetMapiProperty( *(LPMAPIPROP*)&object, PR_STORE_ENTRYID);;
5177 + LPMDB lpMsgStore=NULL;
5178 + mLastError=mRootSession->OpenMsgStore(0,
5179 + svMsgSore->Value.bin.cb,
5180 + (ENTRYID*)svMsgSore->Value.bin.lpb,
5181 + &IID_IMsgStore,
5182 + MAPI_BEST_ACCESS ,
5183 + &lpMsgStore);
5185 + if (HR_FAILED(mLastError)) {
5186 + PRINTF(("Cannot open MsgStore %08x.\n", mLastError)) ;
5187 + return NULL ;
5190 + return lpMsgStore;
5192 --- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2004-04-17 20:32:14.000000000 +0200
5193 +++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2008-08-14 16:22:21.000000000 +0200
5194 @@ -40,12 +40,42 @@
5196 #include "nsAbWinHelper.h"
5198 +struct TagMap
5200 + ULONG AddressTag;
5201 + ULONG NameID;
5202 + ULONG TypeMask;
5204 class nsMapiAddressBook : public nsAbWinHelper
5206 public :
5207 nsMapiAddressBook(void) ;
5208 virtual ~nsMapiAddressBook(void) ;
5210 + // Get the top address books
5211 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
5213 + // Get a default address book container
5214 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
5215 + // Is the helper correctly initialised?
5216 + virtual BOOL IsOK(void);
5217 + virtual BOOL GetPropertyLong(const nsMapiEntry& aObject,
5218 + ULONG aPropertyTag,
5219 + ULONG& aValue);
5220 + // Get the value of a MAPI property of type SYSTIME
5221 + virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
5222 + WORD& aYear, WORD& aMonth, WORD& aDay);
5223 + // Create entry in the address book
5224 + virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
5225 + // Delete an entry in the address book
5226 + virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
5227 + // Create a distribution list in the address book
5228 + virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
5229 + // Copy an existing entry in the address book
5230 + virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
5232 + static void FreeMapiLibrary(void) ;
5234 protected :
5235 // Class members to handle the library/entry points
5236 static HMODULE mLibrary ;
5237 @@ -67,19 +97,77 @@
5238 static BOOL mInitialized ;
5239 static BOOL mLogonDone ;
5240 static LPMAPISESSION mRootSession ;
5241 - static LPADRBOOK mRootBook ;
5244 // Load the MAPI environment
5245 BOOL Initialize(void) ;
5247 + virtual HRESULT OpenEntry(ULONG cbEntryID,
5248 + LPENTRYID lpEntryID,
5249 + LPCIID lpInterface,
5250 + ULONG ulFlags,
5251 + ULONG FAR * lpulObjType,
5252 + LPUNKNOWN FAR * lppUnk
5253 + );
5256 + // Retrieve the contents of a container, with an optional restriction
5257 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5258 + nsMapiEntryArray *aList, ULONG aMapiType) ;
5259 + // Retrieve the values of a set of properties on a MAPI object
5260 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5261 + ULONG aNbProperties,
5262 + LPSPropValue& aValues, ULONG& aValueCount) ;
5263 + // Set the values of a set of properties on a MAPI object
5264 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5265 + LPSPropValue& aValues);
5268 // Allocation of a buffer for transmission to interfaces
5269 virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
5270 // Destruction of a buffer provided by the interfaces
5271 virtual void FreeBuffer(LPVOID aBuffer) ;
5272 // Library management
5273 static BOOL LoadMapiLibrary(void) ;
5274 - static void FreeMapiLibrary(void) ;
5276 + BOOL HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
5277 + LPSPropValue GetMapiProperty( LPMAPIPROP pProp, ULONG tag);
5278 + BOOL GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal=FALSE);
5279 + BOOL HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
5280 + BOOL IterateHierarchy(IMAPIContainer * pFolder, nsMapiEntryArray& aFolders,ULONG flags=0);
5281 + ULONG GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID);
5282 + ULONG GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest=FALSE);
5283 + LPMDB GetMsgStore(const nsMapiEntry& aEntry);
5284 + BOOL CreateEntryInList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry);
5285 + BOOL AddEntryToList(const nsMapiEntry& aParent,const nsMapiEntry& aNewEntry);
5286 + BOOL DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry);
5287 + BOOL GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry);
5288 + BOOL CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction);
5290 + //filter
5291 + BOOL Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList);
5292 + BOOL FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction);
5293 + BOOL AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue);
5295 + void AddToMDBArray(LPMDB aMDB)
5297 + m_MDBArray.AppendElement(aMDB);
5299 + void CleanUpMDB()
5301 + LPMDB mdb;
5302 + for (int i = 0; i < m_MDBArray.Count(); i++)
5304 + mdb = (LPMDB)m_MDBArray.ElementAt(i);
5305 + mdb->Release();
5307 + m_MDBArray.Clear();
5310 private :
5311 + //use to keep all openned MsgStore,if we not open a message store,we can't open any thing on it
5312 + //so we have to kill message stores openned
5313 + nsVoidArray m_MDBArray;
5316 #endif // nsMapiAddressBook_h___
5317 --- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
5318 +++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
5319 @@ -46,6 +46,22 @@
5321 #define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
5323 +enum
5325 + ContentsColumnEntryId = 0,
5326 + ContentsColumnObjectType,
5327 + ContentsColumnsSize
5328 +} ;
5330 +static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
5332 + ContentsColumnsSize,
5334 + PR_ENTRYID,
5335 + PR_OBJECT_TYPE
5337 +} ;
5339 HMODULE nsWabAddressBook::mLibrary = NULL ;
5340 PRInt32 nsWabAddressBook::mLibUsage = 0 ;
5341 LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
5342 @@ -94,7 +110,7 @@
5343 MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
5345 nsWabAddressBook::nsWabAddressBook(void)
5346 -: nsAbWinHelper()
5347 +: nsAbWinHelper(),mAddressBook(NULL)
5349 BOOL result = Initialize() ;
5351 @@ -109,9 +125,254 @@
5352 MOZ_COUNT_DTOR(nsWabAddressBook) ;
5355 +BOOL nsWabAddressBook::GetFolders(nsMapiEntryArray& aFolders)
5357 + aFolders.CleanUp() ;
5358 + nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
5359 + nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
5360 + ULONG objType = 0 ;
5361 + ULONG rowCount = 0 ;
5362 + SRestriction restriction ;
5363 + SPropTagArray folderColumns ;
5365 + mLastError = OpenEntry(0, NULL, NULL, 0, &objType,
5366 + rootFolder);
5367 + if (HR_FAILED(mLastError)){
5368 + PRINTF(("Cannot open root %08x.\n", mLastError));
5369 + return FALSE;
5371 + mLastError = rootFolder->GetHierarchyTable(0, folders);
5372 + if (HR_FAILED(mLastError)){
5373 + PRINTF(("Cannot get hierarchy %08x.\n", mLastError));
5374 + return FALSE;
5376 + // We only take into account modifiable containers,
5377 + // otherwise, we end up with all the directory services...
5378 + restriction.rt = RES_BITMASK ;
5379 + restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
5380 + restriction.res.resBitMask.relBMR = BMR_NEZ ;
5381 + restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
5382 + mLastError = folders->Restrict(&restriction, 0) ;
5383 + if (HR_FAILED(mLastError)) {
5384 + PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
5386 + folderColumns.cValues = 1 ;
5387 + folderColumns.aulPropTag [0] = PR_ENTRYID ;
5388 + mLastError = folders->SetColumns(&folderColumns, 0) ;
5389 + if (HR_FAILED(mLastError)) {
5390 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5391 + return FALSE ;
5393 + mLastError = folders->GetRowCount(0, &rowCount) ;
5394 + if (HR_SUCCEEDED(mLastError)) {
5395 + do {
5396 + LPSRowSet rowSet = NULL ;
5398 + rowCount = 0 ;
5399 + mLastError = folders->QueryRows(1, 0, &rowSet) ;
5400 + if (HR_SUCCEEDED(mLastError)) {
5401 + rowCount = rowSet->cRows ;
5402 + if (rowCount > 0) {
5403 + SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
5405 + aFolders.AddItem(currentValue.Value.bin.cb,
5406 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
5408 + MyFreeProws(rowSet) ;
5410 + else {
5411 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
5413 + } while (rowCount > 0) ;
5415 + return HR_SUCCEEDED(mLastError) ;
5417 +BOOL nsWabAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5418 + nsMapiEntryArray *aList, ULONG aMapiType)
5420 + if (aList) { aList->CleanUp(); }
5421 + nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
5422 + nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
5423 + ULONG objType = 0 ;
5424 + ULONG rowCount = 0 ;
5426 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
5427 + &IID_IMAPIContainer, 0, &objType,
5428 + parent) ;
5429 + if (HR_FAILED(mLastError)) {
5430 + PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
5431 + return FALSE ;
5433 + // Here, flags for WAB and MAPI could be different, so this works
5434 + // only as long as we don't want to use any flag in GetContentsTable
5435 + mLastError = parent->GetContentsTable(0, contents) ;
5436 + if (HR_FAILED(mLastError)) {
5437 + PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
5438 + return FALSE ;
5440 + if (aRestriction) {
5441 + mLastError = contents->Restrict(aRestriction, 0) ;
5442 + if (HR_FAILED(mLastError)) {
5443 + PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
5444 + return FALSE ;
5447 + int entryId = ContentsColumnEntryId ;
5448 + int objectType = ContentsColumnObjectType ;
5450 + if (aRestriction)
5452 + LPSPropTagArray allColumns = NULL ;
5454 + mLastError = contents->QueryColumns(TBL_ALL_COLUMNS, &allColumns) ;
5455 + if (HR_FAILED(mLastError)) {
5456 + PRINTF(("Cannot query columns %08x.\n", mLastError)) ;
5457 + return FALSE ;
5460 + for (unsigned int j = 0 ; j < allColumns->cValues ; ++ j) {
5461 + if (allColumns->aulPropTag [j] == PR_ENTRYID) {
5462 + entryId = j ;
5464 + else if (allColumns->aulPropTag [j] == PR_OBJECT_TYPE) {
5465 + objectType = j ;
5468 + mLastError = contents->SetColumns(allColumns, 0) ;
5469 + if (HR_FAILED(mLastError)) {
5470 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5471 + return FALSE ;
5473 + FreeBuffer(allColumns) ;
5475 + else
5478 + mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
5479 + if (HR_FAILED(mLastError)) {
5480 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5481 + return FALSE ;
5483 + }
5485 + mLastError = contents->GetRowCount(0, &rowCount) ;
5486 + if (HR_FAILED(mLastError)) {
5487 + PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
5488 + return FALSE ;
5490 + do {
5491 + LPSRowSet rowSet = NULL ;
5493 + rowCount = 0 ;
5494 + mLastError = contents->QueryRows(1, 0, &rowSet) ;
5495 + if (HR_FAILED(mLastError)) {
5496 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
5497 + return FALSE ;
5499 + rowCount = rowSet->cRows ;
5500 + if (rowCount > 0 &&
5501 + (aMapiType == 0 ||
5502 + rowSet->aRow->lpProps[objectType].Value.ul == aMapiType)) {
5503 + if (aList) {
5504 + SPropValue& currentValue = rowSet->aRow->lpProps[entryId] ;
5506 + aList->AddItem(currentValue.Value.bin.cb,
5507 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
5511 + MyFreeProws(rowSet) ;
5512 + } while (rowCount > 0) ;
5513 + return TRUE ;
5516 +BOOL nsWabAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5517 + ULONG aNbProperties, LPSPropValue& aValue,
5518 + ULONG& aValueCount)
5520 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
5521 + IMsgStore * mdb=NULL;
5522 + ULONG objType = 0 ;
5523 + LPSPropTagArray properties = NULL ;
5524 + ULONG i = 0 ;
5526 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
5527 + &IID_IMAPIProp, 0, &objType,
5528 + object) ;
5530 + if (HR_FAILED(mLastError)){
5531 + PRINTF(("Cannot open entry %08x.\n", mLastError));
5532 + return FALSE;
5534 + AllocateBuffer(CbNewSPropTagArray(aNbProperties),
5535 + NS_REINTERPRET_CAST(void **, &properties));
5536 + properties->cValues = aNbProperties;
5537 + for (i = 0 ; i < aNbProperties ; ++ i) {
5538 + properties->aulPropTag [i] = aPropertyTags [i];
5540 + mLastError = object->GetProps(properties, 0, &aValueCount, &aValue);
5541 + FreeBuffer(properties);
5542 + if (HR_FAILED(mLastError)){
5543 + PRINTF(("Cannot get props %08x.\n", mLastError));
5545 + return HR_SUCCEEDED(mLastError) ;
5548 +BOOL nsWabAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5549 + LPSPropValue& aValues)
5551 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
5552 + ULONG objType = 0 ;
5553 + LPSPropProblemArray problems = NULL ;
5555 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
5556 + &IID_IMAPIProp, MAPI_MODIFY, &objType,
5557 + object) ;
5558 + if (HR_FAILED(mLastError)) {
5559 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5560 + return FALSE ;
5562 + mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
5563 + if (HR_FAILED(mLastError)) {
5564 + PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
5565 + return FALSE ;
5567 + if (problems) {
5568 + for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
5569 + PRINTF(("Problem %d: index %d code %08x.\n", i,
5570 + problems->aProblem [i].ulIndex,
5571 + problems->aProblem [i].scode));
5574 + mLastError = object->SaveChanges(0) ;
5575 + if (HR_FAILED(mLastError)) {
5576 + PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
5578 + return HR_SUCCEEDED(mLastError) ;
5581 +BOOL nsWabAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
5583 + LPENTRYID entryId = NULL;
5584 + ULONG byteCount = 0;
5586 + mLastError = mAddressBook->GetPAB(&byteCount, &entryId);
5587 + if (HR_FAILED(mLastError)){
5588 + PRINTF(("Cannot get PAB %08x.\n", mLastError));
5589 + return FALSE;
5591 + aContainer.Assign(byteCount, entryId);
5592 + FreeBuffer(entryId) ;
5593 + return TRUE ;
5596 +BOOL nsWabAddressBook::IsOK(void)
5598 + return mAddressBook != NULL ;
5601 BOOL nsWabAddressBook::Initialize(void)
5603 - if (mAddressBook) { return TRUE ; }
5604 nsAutoLock guard(mMutex) ;
5606 if (!LoadWabLibrary()) {
5607 --- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2004-04-17 20:32:14.000000000 +0200
5608 +++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2008-08-14 16:22:21.000000000 +0200
5609 @@ -47,6 +47,15 @@
5610 nsWabAddressBook(void) ;
5611 virtual ~nsWabAddressBook(void) ;
5613 + // Get the top address books
5614 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
5616 + // Get a default address book container
5617 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
5618 + // Is the helper correctly initialised?
5619 + virtual BOOL IsOK(void);
5620 + static void FreeWabLibrary(void) ;
5622 protected :
5623 // Session and address book that will be shared by all instances
5624 // (see nsMapiAddressBook.h for details)
5625 @@ -57,15 +66,46 @@
5626 static HMODULE mLibrary ;
5627 static LPWABOPEN mWABOpen ;
5629 + LPADRBOOK mAddressBook ;
5631 // Load the WAB environment
5632 BOOL Initialize(void) ;
5634 + virtual HRESULT OpenEntry(ULONG cbEntryID,
5635 + LPENTRYID lpEntryID,
5636 + LPCIID lpInterface,
5637 + ULONG ulFlags,
5638 + ULONG FAR * lpulObjType,
5639 + LPUNKNOWN FAR * lppUnk
5642 + return mAddressBook->OpenEntry(cbEntryID,
5643 + lpEntryID,
5644 + lpInterface,
5645 + ulFlags,
5646 + lpulObjType,
5647 + lppUnk
5648 + );
5652 + // Retrieve the contents of a container, with an optional restriction
5653 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5654 + nsMapiEntryArray *aList, ULONG aMapiType) ;
5655 + // Retrieve the values of a set of properties on a MAPI object
5656 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5657 + ULONG aNbProperties,
5658 + LPSPropValue& aValues, ULONG& aValueCount) ;
5659 + // Set the values of a set of properties on a MAPI object
5660 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5661 + LPSPropValue& aValues) ;
5663 // Allocation of a buffer for transmission to interfaces
5664 virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
5665 // Destruction of a buffer provided by the interfaces
5666 virtual void FreeBuffer(LPVOID aBuffer) ;
5667 // Manage the library
5668 static BOOL LoadWabLibrary(void) ;
5669 - static void FreeWabLibrary(void) ;
5671 private :
5673 --- misc/mozilla/modules/libpref/src/Makefile.in 2006-02-03 15:44:52.000000000 +0100
5674 +++ misc/build/mozilla/modules/libpref/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
5675 @@ -91,7 +91,7 @@
5676 PREF_JS_EXPORTS += $(srcdir)/init/non-shared.txt
5677 endif
5679 -EXTRA_DSO_LDOPTS = \
5680 +EXTRA_DSO_LDOPTS += \
5681 $(LIBS_DIR) \
5682 $(MOZ_JS_LIBS) \
5683 $(MOZ_COMPONENT_LIBS) \
5684 --- misc/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2005-07-20 20:31:42.000000000 +0200
5685 +++ misc/build/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2008-08-20 15:45:06.000000000 +0200
5686 @@ -277,7 +277,7 @@
5687 nsresult
5688 nsHttpConnectionMgr::UpdateParam(nsParamName name, PRUint16 value)
5690 - PRUint32 param = (PRUint32(name) << 16) | PRUint32(value);
5691 + PRUint32 param = (NS_PTR_TO_INT32(name) << 16) | NS_PTR_TO_INT32(value);
5692 return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0, (void *) param);
5695 --- misc/mozilla/nsprpub/build/cygwin-wrapper 2006-12-22 14:47:17.000000000 +0100
5696 +++ misc/build/mozilla/nsprpub/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
5697 @@ -1,4 +1,4 @@
5698 -#!/bin/sh
5699 +#!/bin/bash
5701 # Stupid wrapper to avoid win32 dospath/cygdrive issues
5702 # Try not to spawn programs from within this file. If the stuff in here looks royally
5703 --- misc/mozilla/nsprpub/config/autoconf.mk.in 2006-12-22 14:47:17.000000000 +0100
5704 +++ misc/build/mozilla/nsprpub/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
5705 @@ -22,6 +22,7 @@
5706 RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
5707 OBJDIR_NAME = @OBJDIR_NAME@
5708 OBJDIR = @OBJDIR@
5709 +LIB_PREFIX = @LIB_PREFIX@
5710 OBJ_SUFFIX = @OBJ_SUFFIX@
5711 LIB_SUFFIX = @LIB_SUFFIX@
5712 DLL_SUFFIX = @DLL_SUFFIX@
5713 --- misc/mozilla/nsprpub/config/rules.mk 2006-12-22 14:47:17.000000000 +0100
5714 +++ misc/build/mozilla/nsprpub/config/rules.mk 2008-12-12 10:09:34.437500000 +0100
5715 @@ -111,9 +111,9 @@
5716 # other platforms do not.
5718 ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
5719 -LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
5720 +LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
5721 SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
5722 -IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
5723 +IMPORT_LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
5724 SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
5725 else
5726 LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
5727 @@ -340,6 +340,10 @@
5728 else # AIX 4.1
5729 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
5730 $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
5731 + @if test -f $@.manifest; then \
5732 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
5733 + rm -f $@.manifest; \
5734 + fi
5735 else
5736 ifeq ($(MOZ_OS2_TOOLS),VACPP)
5737 $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
5738 --- misc/mozilla/nsprpub/configure 2008-01-29 20:27:43.000000000 +0100
5739 +++ misc/build/mozilla/nsprpub/configure 2008-08-14 16:22:21.000000000 +0200
5740 @@ -2737,6 +2737,7 @@
5741 LIB_SUFFIX=a
5742 DLL_SUFFIX=so
5743 ASM_SUFFIX=s
5744 +LIB_PREFIX=lib
5745 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
5746 PR_MD_ASFILES=
5747 PR_MD_CSRCS=
5748 @@ -3475,7 +3476,7 @@
5751 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
5752 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
5753 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
5754 if test "$MOZ_OBJFORMAT" = "elf"; then
5755 DLL_SUFFIX=so
5756 else
5757 @@ -3941,7 +3942,7 @@
5758 CC="$CC -mno-cygwin"
5759 CXX="$CXX -mno-cygwin"
5760 DLL_SUFFIX=dll
5761 - MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
5762 + MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
5763 RC=$WINDRES
5764 # Use temp file for windres (bug 213281)
5765 RCFLAGS='-O coff --use-temp-file'
5766 @@ -3958,6 +3959,7 @@
5767 OBJ_SUFFIX=obj
5768 LIB_SUFFIX=lib
5769 DLL_SUFFIX=dll
5770 + LIB_PREFIX=
5772 # Determine compiler version
5773 CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
5774 @@ -5766,6 +5768,7 @@
5775 CC="\$(CYGWIN_WRAPPER) $CC"
5776 CXX="\$(CYGWIN_WRAPPER) $CXX"
5777 RC="\$(CYGWIN_WRAPPER) $RC"
5778 + LD="\$(CYGWIN_WRAPPER) $LD"
5780 esac
5782 @@ -6127,6 +6130,7 @@
5783 s%@LIB_SUFFIX@%$LIB_SUFFIX%g
5784 s%@DLL_SUFFIX@%$DLL_SUFFIX%g
5785 s%@ASM_SUFFIX@%$ASM_SUFFIX%g
5786 +s%@LIB_PREFIX@%$LIB_PREFIX%g
5787 s%@MKSHLIB@%$MKSHLIB%g
5788 s%@DSO_CFLAGS@%$DSO_CFLAGS%g
5789 s%@DSO_LDOPTS@%$DSO_LDOPTS%g
5790 --- misc/mozilla/nsprpub/configure.in 2008-01-29 20:27:44.000000000 +0100
5791 +++ misc/build/mozilla/nsprpub/configure.in 2008-08-14 16:22:21.000000000 +0200
5792 @@ -1137,7 +1137,7 @@
5793 AC_DEFINE(HAVE_BSD_FLOCK)
5794 AC_DEFINE(HAVE_SOCKLEN_T)
5795 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
5796 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
5797 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
5798 if test "$MOZ_OBJFORMAT" = "elf"; then
5799 DLL_SUFFIX=so
5800 else
5801 --- misc/mozilla/nsprpub/lib/ds/Makefile.in 2006-12-22 14:47:17.000000000 +0100
5802 +++ misc/build/mozilla/nsprpub/lib/ds/Makefile.in 2008-08-14 16:22:21.000000000 +0200
5803 @@ -79,18 +79,26 @@
5804 OS_LIBS = -lc
5805 endif
5807 +ifeq ($(OS_ARCH),FreeBSD)
5808 +MKSHLIB += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5809 +endif
5811 +ifeq ($(OS_ARCH),Linux)
5812 +MKSHLIB += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5813 +endif
5815 ifeq ($(OS_ARCH),SunOS)
5816 OS_LIBS = -lc
5817 MAPFILE = $(OBJDIR)/pldsmap.sun
5818 GARBAGE += $(MAPFILE)
5819 ifdef NS_USE_GCC
5820 ifdef GCC_USE_GNU_LD
5821 -MKSHLIB += -Wl,--version-script,$(MAPFILE)
5822 +MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5823 else
5824 -MKSHLIB += -Wl,-M,$(MAPFILE)
5825 +MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
5826 endif
5827 else
5828 -MKSHLIB += -M $(MAPFILE)
5829 +MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
5830 endif
5831 # The -R '$ORIGIN' linker option instructs this library to search for its
5832 # dependencies in the same directory where it resides.
5833 --- misc/mozilla/nsprpub/lib/libc/src/Makefile.in 2006-12-22 14:47:17.000000000 +0100
5834 +++ misc/build/mozilla/nsprpub/lib/libc/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
5835 @@ -89,18 +89,26 @@
5836 OS_LIBS = -lc
5837 endif
5839 +ifeq ($(OS_ARCH),FreeBSD)
5840 +MKSHLIB += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5841 +endif
5843 +ifeq ($(OS_ARCH),Linux)
5844 +MKSHLIB += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5845 +endif
5847 ifeq ($(OS_ARCH),SunOS)
5848 OS_LIBS = -lc
5849 MAPFILE = $(OBJDIR)/plcmap.sun
5850 GARBAGE += $(MAPFILE)
5851 ifdef NS_USE_GCC
5852 ifdef GCC_USE_GNU_LD
5853 -MKSHLIB += -Wl,--version-script,$(MAPFILE)
5854 +MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5855 else
5856 -MKSHLIB += -Wl,-M,$(MAPFILE)
5857 +MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
5858 endif
5859 else
5860 -MKSHLIB += -M $(MAPFILE)
5861 +MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
5862 endif
5863 # The -R '$ORIGIN' linker option instructs this library to search for its
5864 # dependencies in the same directory where it resides.
5865 --- misc/mozilla/nsprpub/pr/src/misc/prnetdb.c 2006-12-22 14:47:27.000000000 +0100
5866 +++ misc/build/mozilla/nsprpub/pr/src/misc/prnetdb.c 2008-08-14 16:22:21.000000000 +0200
5867 @@ -113,7 +113,8 @@
5868 #define _PR_HAVE_5_ARG_GETPROTO_R
5869 #endif
5871 -#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
5872 +#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) || \
5873 + (defined(__FreeBSD__) && __FreeBSD_version > 601103)
5874 #define _PR_HAVE_GETPROTO_R
5875 #define _PR_HAVE_5_ARG_GETPROTO_R
5876 #endif
5877 --- misc/mozilla/security/coreconf/FreeBSD.mk 2006-12-22 14:48:06.000000000 +0100
5878 +++ misc/build/mozilla/security/coreconf/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
5879 @@ -52,6 +52,7 @@
5881 DSO_CFLAGS = -fPIC
5882 DSO_LDOPTS = -shared -Wl,-soname -Wl,$(notdir $@)
5883 +DSO_LDOPTS += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5886 # The default implementation strategy for FreeBSD is pthreads.
5887 @@ -65,7 +66,7 @@
5889 ARCH = freebsd
5891 -MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
5892 +MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
5894 ifeq ($(MOZ_OBJFORMAT),elf)
5895 DLL_SUFFIX = so
5896 --- misc/mozilla/security/coreconf/Linux.mk 2006-12-22 14:48:06.000000000 +0100
5897 +++ misc/build/mozilla/security/coreconf/Linux.mk 2008-08-18 10:16:15.000000000 +0200
5898 @@ -139,7 +139,7 @@
5900 ifeq ($(OS_RELEASE),2.0)
5901 OS_REL_CFLAGS += -DLINUX2_0
5902 - MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
5903 + MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
5904 ifdef MAPFILE
5905 MKSHLIB += -Wl,--version-script,$(MAPFILE)
5906 endif
5907 @@ -166,6 +166,7 @@
5909 DSO_CFLAGS = -fPIC
5910 DSO_LDOPTS = -shared $(ARCHFLAG)
5911 +DSO_LDOPTS += -Wl,-z,origin -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5912 DSO_LDFLAGS =
5913 LDFLAGS += $(ARCHFLAG)
5915 --- misc/mozilla/security/coreconf/SunOS5.mk 2008-06-16 00:22:15.000000000 +0200
5916 +++ misc/build/mozilla/security/coreconf/SunOS5.mk 2008-08-14 16:22:21.000000000 +0200
5917 @@ -161,12 +161,14 @@
5919 # ld options:
5920 # -G: produce a shared object
5921 +# -R '$ORIGIN': search for dependencies in same directory
5922 # -z defs: no unresolved symbols allowed
5923 ifdef NS_USE_GCC
5924 ifeq ($(USE_64), 1)
5925 DSO_LDOPTS += -m64
5926 endif
5927 DSO_LDOPTS += -shared -h $(notdir $@)
5928 + DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5929 else
5930 ifeq ($(USE_64), 1)
5931 ifeq ($(OS_TEST),i86pc)
5932 @@ -176,6 +178,7 @@
5933 endif
5934 endif
5935 DSO_LDOPTS += -G -h $(notdir $@)
5936 + DSO_LDOPTS += -R '$$ORIGIN'
5937 endif
5938 DSO_LDOPTS += -z combreloc -z defs -z ignore
5940 --- misc/mozilla/security/coreconf/WIN32.mk 2008-06-16 00:22:15.000000000 +0200
5941 +++ misc/build/mozilla/security/coreconf/WIN32.mk 2008-08-18 16:04:59.000000000 +0200
5942 @@ -43,24 +43,24 @@
5943 DEFAULT_COMPILER = cl
5945 ifdef NS_USE_GCC
5946 - CC = gcc
5947 - CCC = g++
5948 - LINK = ld
5949 - AR = ar
5950 + CC = $(CYGWIN_WRAPPER) gcc
5951 + CCC = $(CYGWIN_WRAPPER) g++
5952 + LINK = $(CYGWIN_WRAPPER) ld
5953 + AR = $(CYGWIN_WRAPPER) ar
5954 AR += cr $@
5955 - RANLIB = ranlib
5956 + RANLIB = $(CYGWIN_WRAPPER) ranlib
5957 BSDECHO = echo
5958 - RC = windres.exe -O coff --use-temp-file
5959 - LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
5960 + RC = $(CYGWIN_WRAPPER) windres.exe -O coff --use-temp-file
5961 + LINK_DLL = $(CYGWIN_WRAPPER) $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
5962 else
5963 - CC = cl
5964 - CCC = cl
5965 - LINK = link
5966 - AR = lib
5967 + CC = $(CYGWIN_WRAPPER) cl
5968 + CCC = $(CYGWIN_WRAPPER) cl
5969 + LINK = $(CYGWIN_WRAPPER) link
5970 + AR = $(CYGWIN_WRAPPER) lib
5971 AR += -NOLOGO -OUT:"$@"
5972 RANLIB = echo
5973 BSDECHO = echo
5974 - RC = rc.exe
5975 + RC = $(CYGWIN_WRAPPER) rc.exe
5976 MT = mt.exe
5977 endif
5979 @@ -69,7 +69,7 @@
5980 else
5981 NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
5982 endif
5983 -NSINSTALL = nsinstall
5984 +NSINSTALL = $(CYGWIN_WRAPPER) nsinstall
5986 MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
5987 MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
5988 @@ -95,7 +95,7 @@
5989 # dllimport cannot be used as as a constant address.
5990 OS_CFLAGS += -mno-cygwin -mms-bitfields -mnop-fun-dllimport
5991 _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
5992 - DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
5993 + DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
5994 ifdef BUILD_OPT
5995 OPTIMIZER += -O2
5996 DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
5997 --- misc/mozilla/security/coreconf/WIN954.0.mk 2008-06-16 00:22:15.000000000 +0200
5998 +++ misc/build/mozilla/security/coreconf/WIN954.0.mk 2008-08-14 16:22:21.000000000 +0200
5999 @@ -72,3 +72,7 @@
6000 endif
6001 endif
6002 DEFINES += -DWIN95
6004 +ifdef NS_USE_GCC
6005 +NSPR31_LIB_PREFIX = lib
6006 +endif
6007 --- misc/mozilla/security/coreconf/command.mk 2008-06-16 00:22:15.000000000 +0200
6008 +++ misc/build/mozilla/security/coreconf/command.mk 2008-08-19 09:58:11.000000000 +0200
6009 @@ -45,7 +45,7 @@
6010 CCF = $(CC) $(CFLAGS)
6011 LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
6012 LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
6013 -CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
6014 +CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
6015 $(XCFLAGS)
6016 PERL = perl
6017 RANLIB = echo
6018 --- misc/mozilla/security/coreconf/rules.mk 2008-06-16 00:22:15.000000000 +0200
6019 +++ misc/build/mozilla/security/coreconf/rules.mk 2008-08-19 10:46:57.000000000 +0200
6020 @@ -284,7 +284,7 @@
6021 $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
6022 @$(MAKE_OBJDIR)
6023 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
6024 - $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
6025 + $(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
6026 ifdef MT
6027 if test -f $@.manifest; then \
6028 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
6029 @@ -305,11 +305,7 @@
6030 $(LIBRARY): $(OBJS)
6031 @$(MAKE_OBJDIR)
6032 rm -f $@
6033 -ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
6034 - $(AR) $(subst /,\\,$(OBJS))
6035 -else
6036 $(AR) $(OBJS)
6037 -endif
6038 $(RANLIB) $@
6041 @@ -344,7 +340,7 @@
6042 ifdef NS_USE_GCC
6043 $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
6044 else
6045 - $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
6046 + $(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
6047 ifdef MT
6048 if test -f $@.manifest; then \
6049 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
6050 @@ -429,15 +425,15 @@
6051 endif
6052 endif
6054 -core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
6055 +mozabspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
6057 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
6058 @$(MAKE_OBJDIR)
6059 ifdef USE_NT_C_SYNTAX
6060 - $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6061 + $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6062 else
6063 ifdef NEED_ABSOLUTE_PATH
6064 - $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6065 + $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6066 else
6067 $(CC) -o $@ -c $(CFLAGS) $<
6068 endif
6069 @@ -445,10 +441,10 @@
6071 $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
6072 ifdef USE_NT_C_SYNTAX
6073 - $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6074 + $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6075 else
6076 ifdef NEED_ABSOLUTE_PATH
6077 - $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6078 + $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6079 else
6080 $(CC) -o $@ -c $(CFLAGS) $<
6081 endif
6082 @@ -477,10 +473,10 @@
6083 $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
6084 @$(MAKE_OBJDIR)
6085 ifdef USE_NT_C_SYNTAX
6086 - $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6087 + $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6088 else
6089 ifdef NEED_ABSOLUTE_PATH
6090 - $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6091 + $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6092 else
6093 $(CCC) -o $@ -c $(CFLAGS) $<
6094 endif
6095 @@ -501,10 +497,10 @@
6096 rm -f $(OBJDIR)/t_$*.cc
6097 else
6098 ifdef USE_NT_C_SYNTAX
6099 - $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6100 + $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6101 else
6102 ifdef NEED_ABSOLUTE_PATH
6103 - $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6104 + $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6105 else
6106 $(CCC) -o $@ -c $(CFLAGS) $<
6107 endif
6108 --- misc/mozilla/security/manager/Makefile.in 2008-06-16 00:23:29.000000000 +0200
6109 +++ misc/build/mozilla/security/manager/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6110 @@ -123,8 +123,11 @@
6111 ifdef CYGDRIVE_MOUNT
6112 ABS_DIST := $(shell cygpath -w $(ABS_DIST) | sed -e 's|\\|/|g')
6113 endif
6114 +ifneq (,$(filter cygwin%,$(host_os)))
6115 +ABS_DIST := $(shell cygpath -u $(ABS_DIST))
6116 +endif
6117 ifneq (,$(filter mingw%,$(host_os)))
6118 -ABS_DIST := $(shell cd $(DIST) && pwd -W)
6119 +ABS_DIST := $(shell cygpath -u $(ABS_DIST))
6120 endif
6121 endif
6122 NSPR_INCLUDE_DIR = $(firstword $(filter -I%,$(NSPR_CFLAGS)))
6123 @@ -172,6 +175,7 @@
6124 endif
6125 ifeq ($(OS_ARCH),WINNT)
6126 DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
6127 +DEFAULT_GMAKE_FLAGS += CYGWIN_WRAPPER=@CYGWIN_WRAPPER@
6128 ifdef MOZ_DEBUG
6129 ifndef MOZ_NO_DEBUG_RTL
6130 DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
6131 --- misc/mozilla/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100
6132 +++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile 2009-02-12 15:42:13.033408000 +0100
6133 @@ -86,17 +86,42 @@
6135 include ../platrules.mk
6137 -SRCDIR = $(call core_abspath,.)
6139 +ifeq ($(OS_TARGET), Darwin)
6140 + SRCDIR = .
6141 +else
6142 +ifeq ($(OS_TARGET), Linux)
6143 + SRCDIR = .
6144 +else
6145 + SRCDIR = .
6146 +endif
6147 +endif
6148 %.chk: %.$(DLL_SUFFIX)
6149 ifeq ($(OS_TARGET), OS2)
6150 cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
6151 $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
6152 $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
6153 else
6154 - cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
6155 - $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
6156 - $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
6157 +ifeq ($(OS_TARGET), WIN95)
6158 + cd $(SRCDIR) ; sh $(CYGWIN_WRAPPER) ./sign.sh $(DIST) \
6159 + $(OBJDIR) $(OS_TARGET) \
6160 + $(NSPR_LIB_DIR) $<
6161 +else
6162 +ifeq ($(OS_TARGET), Darwin)
6163 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6164 + $(OBJDIR) $(OS_TARGET) \
6165 + $(NSPR_LIB_DIR) $<
6166 +else
6167 +ifeq ($(OS_TARGET), Linux)
6168 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6169 + $(OBJDIR) $(OS_TARGET) \
6170 + $(NSPR_LIB_DIR) $<
6171 +else
6172 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6173 + $(OBJDIR) $(OS_TARGET) \
6174 + $(NSPR_LIB_DIR) $<
6175 +endif
6176 +endif
6177 +endif
6178 endif
6180 libs install :: $(CHECKLOC)
6181 --- misc/mozilla/security/nss/lib/ckfw/builtins/config.mk 2005-01-20 03:25:46.000000000 +0100
6182 +++ misc/build/mozilla/security/nss/lib/ckfw/builtins/config.mk 2008-08-14 16:22:21.000000000 +0200
6183 @@ -63,9 +63,4 @@
6184 DSO_LDOPTS = -bundle
6185 endif
6187 -ifeq ($(OS_TARGET),SunOS)
6188 -# The -R '$ORIGIN' linker option instructs this library to search for its
6189 -# dependencies in the same directory where it resides.
6190 -MKSHLIB += -R '$$ORIGIN'
6191 -endif
6193 --- misc/mozilla/security/nss/lib/freebl/Makefile 2008-06-16 00:22:09.000000000 +0200
6194 +++ misc/build/mozilla/security/nss/lib/freebl/Makefile 2008-08-18 14:31:08.000000000 +0200
6195 @@ -199,10 +199,6 @@
6196 endif
6198 ifeq ($(OS_TARGET),SunOS)
6200 -# The -R '$ORIGIN' linker option instructs this library to search for its
6201 -# dependencies in the same directory where it resides.
6202 -MKSHLIB += -R '$$ORIGIN'
6203 ifdef NS_USE_GCC
6204 ifdef GCC_USE_GNU_LD
6205 MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text
6206 @@ -210,7 +206,7 @@
6207 MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text
6208 endif # GCC_USE_GNU_LD
6209 else
6210 - MKSHLIB += -B symbolic -z now -z text
6211 + MKSHLIB += -z now -z text
6212 endif # NS_USE_GCC
6214 # Sun's WorkShop defines v8, v8plus and v9 architectures.
6215 --- misc/mozilla/security/nss/lib/nss/config.mk 2006-12-22 14:47:56.000000000 +0100
6216 +++ misc/build/mozilla/security/nss/lib/nss/config.mk 2008-08-19 17:07:42.000000000 +0200
6217 @@ -113,12 +113,10 @@
6218 # The -R '$ORIGIN' linker option instructs this library to search for its
6219 # dependencies in the same directory where it resides.
6220 ifeq ($(USE_64), 1)
6221 -MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
6222 +DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
6223 else
6224 -MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
6225 +DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
6226 endif
6227 -else
6228 -MKSHLIB += -R '$$ORIGIN'
6229 endif
6230 endif
6232 @@ -127,9 +125,9 @@
6233 # pa-risc
6234 ifeq ($(USE_64), 1)
6235 MKSHLIB += +b '$$ORIGIN'
6236 -endif
6237 -endif
6238 -endif
6239 +endif # USE_64
6240 +endif # OS_TEST
6241 +endif # OS_ARCH
6243 ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
6244 ifndef NS_USE_GCC
6245 --- misc/mozilla/security/nss/lib/nss/nss.def 2008-06-16 00:22:10.000000000 +0200
6246 +++ misc/build/mozilla/security/nss/lib/nss/nss.def 2008-08-14 16:22:21.000000000 +0200
6247 @@ -61,6 +61,7 @@
6248 CERT_CheckCertValidTimes;
6249 CERT_CreateCertificateRequest;
6250 CERT_ChangeCertTrust;
6251 +CERT_DecodeDERCertificate;
6252 CERT_DecodeDERCrl;
6253 CERT_DestroyCertificateRequest;
6254 CERT_DestroyCertList;
6255 --- misc/mozilla/security/nss/lib/smime/config.mk 2006-12-22 14:48:00.000000000 +0100
6256 +++ misc/build/mozilla/security/nss/lib/smime/config.mk 2008-08-19 17:01:53.000000000 +0200
6257 @@ -92,8 +92,3 @@
6258 ../pkcs7 \
6259 $(NULL)
6261 -ifeq ($(OS_TARGET),SunOS)
6262 -# The -R '$ORIGIN' linker option instructs this library to search for its
6263 -# dependencies in the same directory where it resides.
6264 -MKSHLIB += -R '$$ORIGIN'
6265 -endif
6266 --- misc/mozilla/security/nss/lib/softoken/config.mk 2006-12-22 14:48:00.000000000 +0100
6267 +++ misc/build/mozilla/security/nss/lib/softoken/config.mk 2008-08-20 10:36:17.000000000 +0200
6268 @@ -87,13 +87,6 @@
6269 $(NULL)
6270 endif
6272 -ifeq ($(OS_TARGET),SunOS)
6273 -# The -R '$ORIGIN' linker option instructs this library to search for its
6274 -# dependencies in the same directory where it resides.
6275 -MKSHLIB += -R '$$ORIGIN'
6276 -OS_LIBS += -lbsm
6277 -endif
6279 ifeq ($(OS_TARGET),WINCE)
6280 DEFINES += -DDBM_USING_NSPR
6281 endif
6282 --- misc/mozilla/security/nss/lib/ssl/config.mk 2008-06-16 00:22:12.000000000 +0200
6283 +++ misc/build/mozilla/security/nss/lib/ssl/config.mk 2008-08-19 17:03:03.000000000 +0200
6284 @@ -116,13 +116,6 @@
6285 EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib
6286 endif
6288 -ifeq ($(OS_TARGET),SunOS)
6289 -# The -R '$ORIGIN' linker option instructs this library to search for its
6290 -# dependencies in the same directory where it resides.
6291 -MKSHLIB += -R '$$ORIGIN'
6292 -#EXTRA_SHARED_LIBS += -ldl -lrt -lc -z defs
6293 -endif
6295 endif
6297 # indicates dependency on freebl static lib
6298 --- misc/mozilla/webshell/tests/viewer/Makefile.in 2006-06-17 18:27:10.000000000 +0200
6299 +++ misc/build/mozilla/webshell/tests/viewer/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6300 @@ -181,7 +181,7 @@
6301 GTK_LIBS = unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS)
6303 XP_DIST_DEP_LIBS := $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS))
6304 -XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(LIB_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
6305 +XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(DLL_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
6307 EXTRA_DEPS = \
6308 $(XP_DIST_DEP_LIBS) \
6309 --- misc/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2004-04-18 16:18:20.000000000 +0200
6310 +++ misc/build/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2008-08-14 16:22:21.000000000 +0200
6311 @@ -132,7 +132,7 @@
6314 PRBool IsArray() const
6315 - {return (PRBool) TagPart() == T_ARRAY;}
6316 + {return (PRBool) (TagPart() == T_ARRAY);}
6318 // 'Dependent' means that params of this type are dependent upon other
6319 // params. e.g. an T_INTERFACE_IS is dependent upon some other param at
6320 @@ -152,7 +152,7 @@
6321 uint8 TagPart() const
6322 {return (uint8) (flags & XPT_TDP_TAGMASK);}
6324 - enum
6325 + enum _xpttype
6327 T_I8 = TD_INT8 ,
6328 T_I16 = TD_INT16 ,
6329 --- misc/mozilla/xpfe/bootstrap/Makefile.in 2007-10-08 21:09:58.000000000 +0200
6330 +++ misc/build/mozilla/xpfe/bootstrap/Makefile.in 2008-08-18 14:10:04.000000000 +0200
6331 @@ -115,11 +115,14 @@
6333 include $(topsrcdir)/config/config.mk
6335 +# reduce prerequisites by disabling mozilla binary
6336 +ifndef DISABLE_MOZ_EXECUTABLE
6337 ifeq ($(USE_SHORT_LIBNAME),1)
6338 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
6339 else
6340 PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
6341 endif
6342 +endif
6344 # Force applications to be built non-statically
6345 # when building the mozcomps meta component
6346 @@ -491,6 +494,7 @@
6347 APP_NAME = $(MOZ_APP_DISPLAYNAME)
6348 endif
6350 +ifdef PROGRAM
6351 libs:: $(PROGRAM)
6352 mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
6353 rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app
6354 @@ -505,6 +509,7 @@
6355 rsync -a --copy-unsafe-links $(DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
6356 cp -RL $(DIST)/package/mozillaSuite.rsrc $(DIST)/$(APP_NAME).app/Contents/Resources/$(PROGRAM).rsrc
6357 echo -n APPLMOZZ > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
6358 +endif
6360 clean clobber::
6361 rm -rf $(DIST)/$(APP_NAME).app
6362 --- misc/mozilla/directory/c-sdk/ldap/libraries/libiutil/Makefile.in 2006-02-03 15:44:41.000000000 +0100
6363 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libiutil/Makefile.in 2011-09-07 10:45:16.000000000 +0200
6364 @@ -89,12 +89,9 @@
6365 -e "s|%VERSION%|$${v}|" \
6366 < Version.c > $@)
6368 -export:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBIUTIL)
6369 +export:: $(OBJDEST) $(OBJS) $(LIBIUTIL)
6371 -$(LIBDIR):
6372 - $(MKDIR) $(LIBDIR)
6374 -$(LIBIUTIL): $(OBJS) $(LIBDIR)
6375 +$(LIBIUTIL): $(OBJS)
6376 @echo ======= making $(LIBIUTIL)
6377 ifdef SO_FILES_TO_REMOVE
6378 -$(RM) $(SO_FILES_TO_REMOVE)
6379 --- misc/mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.in 2006-02-03 15:44:41.000000000 +0100
6380 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/liblber/Makefile.in 2011-09-07 10:45:02.000000000 +0200
6381 @@ -79,12 +79,9 @@
6382 -e "s|%VERSION%|$${v}|" \
6383 < Version.c > $@)
6385 -export:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLBER)
6386 +export:: $(OBJDEST) $(OBJS) $(LIBLBER)
6388 -$(LIBDIR):
6389 - $(MKDIR) $(LIBDIR)
6391 -$(LIBLBER): $(OBJS) $(LIBDIR)
6392 +$(LIBLBER): $(OBJS)
6393 @echo ======= making $(LIBLBER)
6394 ifdef SO_FILES_TO_REMOVE
6395 -$(RM) $(SO_FILES_TO_REMOVE)
6396 --- misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2011-09-07 10:53:57.000000000 +0200
6397 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2011-09-07 10:44:45.000000000 +0200
6398 @@ -279,13 +279,13 @@
6399 < Version.c > $@)
6401 # Set the default sources for the export target
6402 -EXPDEPS = $(OBJDIR_NAME) $(LIBDIR) $(OBJS) $(LIBLDAP) $(DLLLDAP)
6403 +EXPDEPS = $(OBJDIR_NAME) $(OBJS) $(LIBLDAP) $(DLLLDAP)
6404 # Remove the LIB source if on win32 and using MSVC
6405 # This avoids problems with -jX builds where 'link' will make both the
6406 # .dll and .lib files in one pass
6407 ifeq ($(OS_ARCH), WINNT)
6408 ifeq ($(LD),link)
6409 -EXPDEPS = $(OBJDIR_NAME) $(LIBDIR) $(OBJS) $(DLLLDAP)
6410 +EXPDEPS = $(OBJDIR_NAME) $(OBJS) $(DLLLDAP)
6411 endif
6412 endif
6414 @@ -294,10 +294,7 @@
6415 ltest:: $(LIBLDAP) test.o
6416 $(LINK_EXE) test.o
6418 -$(LIBDIR):
6419 - $(MKDIR) $(LIBDIR)
6421 -$(LIBLDAP): $(OBJS) $(LIBDIR) $(LDAP_EXPORT_DEFS)
6422 +$(LIBLDAP): $(OBJS) $(LDAP_EXPORT_DEFS)
6423 @echo ======= making $(LIBLDAP)
6424 ifdef SO_FILES_TO_REMOVE
6425 -$(RM) $(SO_FILES_TO_REMOVE)
6426 @@ -314,7 +311,7 @@
6427 endif
6428 endif
6430 -$(DLLLDAP): $(OBJS) $(LIBDIR) $(LDAP_EXPORT_DEFS)
6431 +$(DLLLDAP): $(OBJS) $(LDAP_EXPORT_DEFS)
6432 @echo ======= making $(DLLLDAP)
6433 ifdef SO_FILES_TO_REMOVE
6434 -$(RM) $(SO_FILES_TO_REMOVE)
6435 --- misc/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile.in 2006-02-03 15:44:49.000000000 +0100
6436 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile.in 2011-09-07 10:44:15.000000000 +0200
6437 @@ -77,12 +77,9 @@
6438 -e "s|%VERSION%|$${v}|" \
6439 < Version.c > $@)
6441 -export:: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLDIF)
6442 +export:: $(OBJDEST) $(OBJS) $(LIBLDIF)
6444 -$(LIBDIR):
6445 - $(MKDIR) $(LIBDIR)
6447 -$(LIBLDIF): $(OBJS) $(LIBDIR)
6448 +$(LIBLDIF): $(OBJS)
6449 @echo ======= making $(LIBLDIF)
6450 ifdef SO_FILES_TO_REMOVE
6451 -$(RM) $(SO_FILES_TO_REMOVE)
6452 --- misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2011-09-07 10:53:57.000000000 +0200
6453 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2011-09-07 10:43:59.000000000 +0200
6454 @@ -201,12 +201,9 @@
6455 -e "s|%VERSION%|$${v}|" \
6456 < Version.c > $@)
6458 -export:: $(OBJDEST) $(LIBDIR) $(OBJS) $(DLLPRLDAP)
6459 +export:: $(OBJDEST) $(OBJS) $(DLLPRLDAP)
6461 -$(LIBDIR):
6462 - $(MKDIR) $(LIBDIR)
6464 -$(LIBPRLDAP): $(OBJS) $(LIBDIR) $(PRLDAP_EXPORT_DEFS)
6465 +$(LIBPRLDAP): $(OBJS) $(PRLDAP_EXPORT_DEFS)
6466 @echo ======= making $(LIBPRLDAP)
6467 ifdef SO_FILES_TO_REMOVE
6468 -$(RM) $(SO_FILES_TO_REMOVE)
6469 @@ -219,7 +216,7 @@
6470 $(LINK_LIB) $(EXTRA_LIBS)
6471 endif
6473 -$(DLLPRLDAP): $(OBJS) $(LIBDIR) $(PRLDAP_EXPORT_DEFS)
6474 +$(DLLPRLDAP): $(OBJS) $(PRLDAP_EXPORT_DEFS)
6475 @echo ======= making $(DLLPRLDAP)
6476 ifdef SO_FILES_TO_REMOVE
6477 -$(RM) $(SO_FILES_TO_REMOVE)
6478 --- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2011-09-07 10:53:57.000000000 +0200
6479 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2011-09-07 10:42:48.000000000 +0200
6480 @@ -214,19 +214,16 @@
6481 -e "s|%VERSION%|$${v}|" \
6482 < Version.c > $@)
6484 -export:: $(OBJDEST) $(LIBDIR) $(OBJS) $(DLLSSLDAP)
6485 +export:: $(OBJDEST) $(OBJS) $(DLLSSLDAP)
6487 -$(LIBDIR):
6488 - $(MKDIR) $(LIBDIR)
6490 -$(LIBSSLDAP): $(OBJS) $(LIBDIR) $(SSLDAP_EXPORT_DEFS)
6491 +$(LIBSSLDAP): $(OBJS) $(SSLDAP_EXPORT_DEFS)
6492 @echo ======= making $(LIBSSLDAP)
6493 ifdef SO_FILES_TO_REMOVE
6494 -$(RM) $(SO_FILES_TO_REMOVE)
6495 endif
6496 $(LINK_LIB) $(EXTRA_LIBS)
6498 -$(DLLSSLDAP): $(OBJS) $(LIBDIR) $(SSLDAP_EXPORT_DEFS)
6499 +$(DLLSSLDAP): $(OBJS) $(SSLDAP_EXPORT_DEFS)
6500 @echo ======= making $(DLLSSLDAP)
6501 ifdef SO_FILES_TO_REMOVE
6502 -$(RM) $(SO_FILES_TO_REMOVE)