merged tag ooo/OOO330_m14
[LibreOffice.git] / moz / seamonkey-source-1.1.14.patch
blob3aabbe1a5f44cc7547ce8656753b9d85e737b66e
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,23 @@
90 endif
93 +# Shared library RUNPATH linker option(s)
95 +ifeq ($(OS_ARCH),Linux)
96 +EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
97 +ifdef IS_COMPONENT
98 +EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib
99 +endif # IS_COMPONENT
100 +endif # Linux
102 +ifeq ($(OS_ARCH),SunOS)
103 +EXTRA_DSO_LDOPTS += -R '$$ORIGIN'
104 +ifdef IS_COMPONENT
105 +EXTRA_DSO_LDOPTS += -R '$$ORIGIN/..'
106 +endif # IS_COMPONENT
107 +endif # SunOS
110 # Include any personal overrides the user might think are needed.
112 -include $(MY_CONFIG)
113 --- misc/mozilla/config/rules.mk 2008-01-29 20:30:22.000000000 +0100
114 +++ misc/build/mozilla/config/rules.mk 2009-02-16 14:05:23.000000000 +0100
115 @@ -529,8 +529,9 @@
116 ifeq ($(OS_ARCH),WINNT)
117 ifdef GNU_CC
118 ifndef IS_COMPONENT
119 -DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
120 +DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
121 endif
122 +DSO_LDOPTS += -Wl,--enable-runtime-pseudo-reloc -Wl,-Map -Wl,$(LIB_PREFIX)$(LIBRARY_NAME).map
123 endif
124 endif
126 @@ -811,6 +810,12 @@
128 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
129 $(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
130 +ifdef MSMANIFEST_TOOL
131 + @if test -f $@.manifest; then \
132 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
133 + rm -f $@.manifest; \
134 + fi
135 +endif # MSVC with manifest tool
136 else
137 ifeq ($(CPP_PROG_LINK),1)
138 $(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)
139 @@ -843,6 +848,12 @@
140 else
141 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
142 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
143 +ifdef MSMANIFEST_TOOL
144 + @if test -f $@.manifest; then \
145 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
146 + rm -f $@.manifest; \
147 + fi
148 +endif # MSVC with manifest tool
149 else
150 $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
151 endif
152 @@ -866,6 +877,12 @@
153 else
154 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
155 $(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
156 +ifdef MSMANIFEST_TOOL
157 + @if test -f $@.manifest; then \
158 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
159 + rm -f $@.manifest; \
160 + fi
161 +endif # MSVC with manifest tool
162 else
163 ifeq ($(CPP_PROG_LINK),1)
164 $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
165 @@ -1019,6 +1036,14 @@
166 endif # SHARED_LIBRARY_LIBS
167 endif # NO_LD_ARCHIVE_FLAGS
168 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
169 +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
170 +ifdef MSMANIFEST_TOOL
171 + @if test -f $@.manifest; then \
172 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
173 + rm -f $@.manifest; \
174 + fi
175 +endif # MSVC with manifest tool
176 +endif # WINNT && !GCC
177 @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
178 else # os2 vacpp
179 $(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
180 @@ -1043,7 +1070,7 @@
181 if test -d $(@D); then \
182 echo "Building deps for $<"; \
183 touch $(_MDDEPFILE) && \
184 - $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
185 + $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
186 mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
187 cat $(_MDDEPFILE).old | sed -e "s|^$(srcdir)/||" -e "s|^$(win_srcdir)/||" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
189 @@ -1053,7 +1080,7 @@
190 if test -d $(@D); then \
191 echo "Building deps for $<"; \
192 touch $(_MDDEPFILE) && \
193 - $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
194 + $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
195 mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
196 cat $(_MDDEPFILE).old | sed -e "s|^$(<D)/||g" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
198 @@ -1325,6 +1352,7 @@
200 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
201 $(REPORT_BUILD)
202 + echo "PATH=" $(PATH)
203 $(ELOG) $(XPIDL_COMPILE) -m header -w -I$(srcdir) -I$(IDL_DIR) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
204 @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
205 then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
206 @@ -1696,14 +1724,14 @@
207 define MAKE_DEPS_NOAUTO
208 set -e ; \
209 touch $@ && \
210 - $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $(srcdir)/$(<F) >/dev/null 2>&1 && \
211 + $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $(srcdir)/$(<F) >/dev/null 2>&1 && \
212 mv $@ $@.old && cat $@.old | sed "s|^$(srcdir)/||g" > $@ && rm -f $@.old
213 endef
214 else
215 define MAKE_DEPS_NOAUTO
216 set -e ; \
217 touch $@ && \
218 - $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
219 + $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
220 mv $@ $@.old && cat $@.old | sed "s|^$(<D)/||g" > $@ && rm -f $@.old
221 endef
222 endif # WINNT
223 --- misc/mozilla/configure 2008-10-30 23:05:30.000000000 +0100
224 +++ misc/build/mozilla/configure 2009-02-12 15:20:18.597579000 +0100
225 @@ -1068,6 +1068,8 @@
226 GCONF_VERSION=1.2.1
227 LIBGNOME_VERSION=2.0
229 +MSMANIFEST_TOOL=
231 MISSING_X=
232 for ac_prog in gawk mawk nawk awk
234 @@ -3022,9 +3024,26 @@
235 _CC_SUITE=7
236 elif test "$_CC_MAJOR_VERSION" = "14"; then
237 _CC_SUITE=8
238 + CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
239 else
240 { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
243 + # bug #249782
244 + # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
245 + if test "$_CC_SUITE" -ge "8"; then
246 + MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
247 + if test -n "MSMT_TOOL"; then
248 + MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
249 + if test -z "MSMANIFEST_TOOL_VERSION"; then
250 + echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
251 + fi
252 + MSMANIFEST_TOOL=1
253 + unset MSMT_TOOL
254 + else
255 + { echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
256 + fi
257 + fi
259 # Check linker version
260 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
261 @@ -3422,6 +3441,8 @@
262 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
263 cross_compiling=$ac_cv_prog_cc_cross
265 +else
266 + ac_cv_prog_CXXCPP="$CXXCPP"
268 CXXCPP="$ac_cv_prog_CXXCPP"
269 echo "$ac_t""$CXXCPP" 1>&6
270 @@ -5726,6 +5747,7 @@
271 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
272 _pwd=`pwd`
273 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
274 + CYGWIN_WRAPPER=`cygpath -u $CYGWIN_WRAPPER`
276 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
277 AS_PERL=1
278 @@ -6036,7 +6058,7 @@
279 CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
280 DLL_SUFFIX=".dylib"
281 DSO_LDOPTS=''
282 - STRIP="$STRIP -x -S"
283 + STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
284 _PLATFORM_DEFAULT_TOOLKIT='mac'
285 MOZ_ENABLE_POSTSCRIPT=
286 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
287 @@ -6075,7 +6097,7 @@
290 *-freebsd*)
291 - if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
292 + if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
293 DLL_SUFFIX=".so.1.0"
294 DSO_LDOPTS="-shared"
296 @@ -6455,12 +6477,12 @@
299 case "$host" in
300 - *-mingw*)
301 - CYGPATH_W=echo
302 + *-cygwin*|*-mingw*)
303 + CYGPATH_W="cygpath -u"
304 CYGPATH_S=cat
305 - MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
306 + MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
308 - *-cygwin*|*-msvc*|*-mks*)
309 + *-msvc*|*-mks*)
310 CYGPATH_W="cygpath -a -w"
311 CYGPATH_S="sed -e s|\\\\|/|g"
312 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
313 @@ -6718,7 +6740,7 @@
314 MOZ_USER_DIR="Mozilla"
316 if test "$MOZTOOLS"; then
317 - MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
318 + MOZ_TOOLS_DIR=`echo $MOZTOOLS`
319 else
320 { echo "configure: error: MOZTOOLS is not set" 1>&2; exit 1; }
322 @@ -8614,6 +8636,8 @@
323 case $target in
324 *-hpux11.*)
326 +*-freebsd*)
327 + ;;
329 echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6
330 echo "configure:8620: checking for gethostbyname_r in -lc_r" >&5
331 @@ -19233,7 +19257,8 @@
332 MOZ_CAIRO_LIBS="-lmozcairo -lmozlibpixman $CAIRO_FT_LIBS"
334 if test "$MOZ_X11"; then
335 - MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
336 +# MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
337 + MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $XLIBS -lfontconfig -lfreetype"
339 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
340 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS -lgdi32"
341 @@ -20076,8 +20101,12 @@
342 WIN_TOP_SRC=`cd $srcdir; pwd -W`
344 cygwin*|msvc*|mks*)
345 - HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
346 - HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
347 +# Don't add the wrapper for the HOST_* versions as they contain an
348 +# unexpanded $CC and therfore wil get the wrapper below.
349 + if test -n "$GNU_CC"; then
350 + HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
351 + HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
352 + fi
353 CC="\$(CYGWIN_WRAPPER) $CC"
354 CXX="\$(CYGWIN_WRAPPER) $CXX"
355 CPP="\$(CYGWIN_WRAPPER) $CPP"
356 --- misc/mozilla/configure.in 2008-10-30 23:05:31.000000000 +0100
357 +++ misc/build/mozilla/configure.in 2009-02-05 20:12:45.456777753 +0100
358 @@ -126,6 +126,8 @@
359 GCONF_VERSION=1.2.1
360 LIBGNOME_VERSION=2.0
362 +MSMANIFEST_TOOL=
364 dnl Set various checks
365 dnl ========================================================
366 MISSING_X=
367 @@ -425,9 +427,26 @@
368 _CC_SUITE=7
369 elif test "$_CC_MAJOR_VERSION" = "14"; then
370 _CC_SUITE=8
371 + CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
372 else
373 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
376 + # bug #249782
377 + # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
378 + if test "$_CC_SUITE" -ge "8"; then
379 + MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
380 + if test -n "MSMT_TOOL"; then
381 + MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
382 + if test -z "MSMANIFEST_TOOL_VERSION"; then
383 + AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
384 + fi
385 + MSMANIFEST_TOOL=1
386 + unset MSMT_TOOL
387 + else
388 + AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
389 + fi
390 + fi
392 # Check linker version
393 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
394 @@ -1530,7 +1549,7 @@
395 CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
396 DLL_SUFFIX=".dylib"
397 DSO_LDOPTS=''
398 - STRIP="$STRIP -x -S"
399 + STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
400 _PLATFORM_DEFAULT_TOOLKIT='mac'
401 MOZ_ENABLE_POSTSCRIPT=
402 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
403 @@ -1552,7 +1571,7 @@
406 *-freebsd*)
407 - if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
408 + if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
409 DLL_SUFFIX=".so.1.0"
410 DSO_LDOPTS="-shared"
412 @@ -1853,10 +1872,10 @@
414 dnl MinGW/MSYS doesn't provide or need cygpath
415 case "$host" in
416 - *-mingw*)
417 - CYGPATH_W=echo
418 + *-cygwin*|*-mingw*)
419 + CYGPATH_W="cygpath -u"
420 CYGPATH_S=cat
421 - MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
422 + MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
424 *-cygwin*|*-msvc*|*-mks*)
425 CYGPATH_W="cygpath -a -w"
426 @@ -2749,6 +2768,8 @@
427 case $target in
428 *-hpux11.*)
430 +*-freebsd*)
431 + ;;
433 AC_CHECK_LIB(c_r, gethostbyname_r)
435 @@ -7321,6 +7342,7 @@
436 AC_SUBST(USE_N32)
437 AC_SUBST(CC_VERSION)
438 AC_SUBST(CXX_VERSION)
439 +AC_SUBST(MSMANIFEST_TOOL)
441 if test "$USING_HCC"; then
442 CC='${topsrcdir}/build/hcc'
443 @@ -7416,8 +7438,12 @@
444 WIN_TOP_SRC=`cd $srcdir; pwd -W`
446 cygwin*|msvc*|mks*)
447 - HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
448 - HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
449 +# Don't add the wrapper for the HOST_* versions as they contain an
450 +# unexpanded $CC and therfore wil get the wrapper below.
451 + if test -n "$GNU_CC"; then
452 + HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
453 + HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
454 + fi
455 CC="\$(CYGWIN_WRAPPER) $CC"
456 CXX="\$(CYGWIN_WRAPPER) $CXX"
457 CPP="\$(CYGWIN_WRAPPER) $CPP"
458 --- misc/mozilla/directory/c-sdk/build.mk 2006-02-03 15:44:29.000000000 +0100
459 +++ misc/build/mozilla/directory/c-sdk/build.mk 2008-08-14 16:22:21.000000000 +0200
460 @@ -384,7 +384,7 @@
461 ifdef NS_USE_GCC
462 LINK_EXE = $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
463 LINK_LIB = $(AR) cr $@ $(OBJS)
464 -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)
465 +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)
466 else
467 DEBUG_LINK_OPT=-DEBUG
468 ifeq ($(BUILD_OPT), 1)
469 --- misc/mozilla/directory/c-sdk/config/FreeBSD.mk 2006-02-03 15:41:11.000000000 +0100
470 +++ misc/build/mozilla/directory/c-sdk/config/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
471 @@ -70,7 +70,7 @@
473 ARCH = freebsd
475 -MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
476 +MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
478 ifeq ($(MOZ_OBJFORMAT),elf)
479 DLL_SUFFIX = so
480 --- misc/mozilla/directory/c-sdk/config/autoconf.mk.in 2006-02-23 00:58:25.000000000 +0100
481 +++ misc/build/mozilla/directory/c-sdk/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
482 @@ -25,6 +25,7 @@
483 LIB_SUFFIX = @LIB_SUFFIX@
484 LIB_PREFIX = @LIB_PREFIX@
485 DLL_SUFFIX = @DLL_SUFFIX@
486 +DLL_PREFIX = @DLL_PREFIX@
487 ASM_SUFFIX = @ASM_SUFFIX@
488 PROG_SUFFIX = @PROG_SUFFIX@
489 MOD_NAME = @NSPR_MODNAME@
490 --- misc/mozilla/directory/c-sdk/config/cygwin-wrapper 2004-08-19 01:18:55.000000000 +0200
491 +++ misc/build/mozilla/directory/c-sdk/config/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
492 @@ -1,4 +1,4 @@
493 -#!/bin/sh
494 +#!/bin/bash
496 # Stupid wrapper to avoid win32 dospath/cygdrive issues
497 # Try not to spawn programs from within this file. If the stuff in here looks royally
498 --- misc/mozilla/directory/c-sdk/configure 2006-02-23 01:58:13.000000000 +0100
499 +++ misc/build/mozilla/directory/c-sdk/configure 2008-08-14 16:22:21.000000000 +0200
500 @@ -2738,6 +2738,7 @@
501 LIB_SUFFIX=a
502 LIB_PREFIX=lib
503 DLL_SUFFIX=so
504 +DLL_PREFIX=lib
505 ASM_SUFFIX=s
506 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
507 PR_MD_ASFILES=
508 @@ -3444,7 +3445,7 @@
511 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
512 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
513 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
514 if test "$MOZ_OBJFORMAT" = "elf"; then
515 DLL_SUFFIX=so
516 else
517 @@ -3811,6 +3812,7 @@
518 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
519 DSO_CFLAGS=-fPIC
520 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
521 + DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
522 OS_LIBS="$OS_LIBS -lc"
523 _OPTIMIZE_FLAGS=-O2
524 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
525 @@ -3880,7 +3882,8 @@
526 CC="$CC -mno-cygwin"
527 CXX="$CXX -mno-cygwin"
528 DLL_SUFFIX=dll
529 - MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
530 + DLL_PREFIX=
531 + MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
532 # Use temp file for windres (bug 213281)
533 RC="$WINDRES -O coff --use-temp-file"
534 else
535 @@ -3897,6 +3900,7 @@
536 LIB_SUFFIX=lib
537 LIB_PREFIX=
538 DLL_SUFFIX=dll
539 + DLL_PREFIX=
541 CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
542 DLLFLAGS='-OUT:"$@"'
543 @@ -4293,6 +4297,7 @@
544 NSINSTALL=nsinstall
545 LIB_PREFIX=
546 LIB_SUFFIX=lib
547 + DLL_PREFIX=
548 DLL_SUFFIX=dll
549 DLLTOOL=''
550 RC=rc.exe
551 @@ -4660,6 +4665,7 @@
552 LD=/usr/ccs/bin/ld
553 RANLIB=/usr/ccs/bin/ranlib
554 DSO_LDOPTS='-G -h $(notdir $@)'
555 + DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
556 if test -n "$GNU_CC"; then
557 DSO_CFLAGS=-fPIC
558 else
559 @@ -5844,6 +5850,7 @@
560 s%@LIB_SUFFIX@%$LIB_SUFFIX%g
561 s%@LIB_PREFIX@%$LIB_PREFIX%g
562 s%@DLL_SUFFIX@%$DLL_SUFFIX%g
563 +s%@DLL_PREFIX@%$DLL_PREFIX%g
564 s%@ASM_SUFFIX@%$ASM_SUFFIX%g
565 s%@PROG_SUFFIX@%$PROG_SUFFIX%g
566 s%@MKSHLIB@%$MKSHLIB%g
567 --- misc/mozilla/directory/c-sdk/configure.in 2007-07-15 16:41:07.000000000 +0200
568 +++ misc/build/mozilla/directory/c-sdk/configure.in 2008-08-14 16:22:21.000000000 +0200
569 @@ -549,6 +549,7 @@
570 LIB_SUFFIX=a
571 LIB_PREFIX=lib
572 DLL_SUFFIX=so
573 +DLL_PREFIX=lib
574 ASM_SUFFIX=s
575 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
576 PR_MD_ASFILES=
577 @@ -1037,7 +1038,7 @@
578 AC_DEFINE(FREEBSD)
579 AC_DEFINE(HAVE_BSD_FLOCK)
580 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
581 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
582 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
583 if test "$MOZ_OBJFORMAT" = "elf"; then
584 DLL_SUFFIX=so
585 else
586 @@ -1285,6 +1286,7 @@
587 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
588 DSO_CFLAGS=-fPIC
589 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
590 + DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
591 OS_LIBS="$OS_LIBS -lc"
592 _OPTIMIZE_FLAGS=-O2
593 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
594 @@ -1336,6 +1338,8 @@
595 CC="$CC -mno-cygwin"
596 CXX="$CXX -mno-cygwin"
597 DLL_SUFFIX=dll
598 + DLL_SUFFIX=dll
599 + DLL_PREFIX=
600 MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
601 # Use temp file for windres (bug 213281)
602 RC="$WINDRES -O coff --use-temp-file"
603 @@ -1353,6 +1357,7 @@
604 LIB_SUFFIX=lib
605 LIB_PREFIX=
606 DLL_SUFFIX=dll
607 + DLL_PREFIX=
609 CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
610 DLLFLAGS='-OUT:"$@"'
611 @@ -1820,6 +1825,7 @@
612 LD=/usr/ccs/bin/ld
613 RANLIB=/usr/ccs/bin/ranlib
614 DSO_LDOPTS='-G -h $(notdir $@)'
615 + DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
616 if test -n "$GNU_CC"; then
617 DSO_CFLAGS=-fPIC
618 else
619 @@ -2410,6 +2416,7 @@
620 AC_SUBST(LIB_SUFFIX)
621 AC_SUBST(LIB_PREFIX)
622 AC_SUBST(DLL_SUFFIX)
623 +AC_SUBST(DLL_PREFIX)
624 AC_SUBST(ASM_SUFFIX)
625 AC_SUBST(PROG_SUFFIX)
626 AC_SUBST(MKSHLIB)
627 --- misc/mozilla/directory/c-sdk/ldap/include/Makefile.in 2006-02-03 15:44:33.000000000 +0100
628 +++ misc/build/mozilla/directory/c-sdk/ldap/include/Makefile.in 2008-11-02 21:55:34.929250000 +0100
629 @@ -85,6 +85,11 @@
631 ###########################################################################
633 +ifeq ($(TERM),cygwin)
634 +INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
635 +GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
636 +endif
638 all export:: $(INCLUDEDIR) $(GENHEADERS)
639 $(NSINSTALL) -D $(PRIVATEINCDIR)
640 $(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
641 --- misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2006-02-03 15:44:42.000000000 +0100
642 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
643 @@ -109,7 +109,7 @@
644 HDIR = $(topsrcdir)/ldap/include
646 LIBLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
647 -DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
648 +DLLLDAP = $(addprefix $(OBJDIR_NAME)/, $(DLL_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
650 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
652 @@ -320,6 +320,10 @@
653 -$(RM) $(SO_FILES_TO_REMOVE)
654 endif
655 $(LINK_DLL) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS)
656 + if test -f $@.manifest; then \
657 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
658 + rm -f $@.manifest; \
659 + fi
661 veryclean:: clean
663 --- misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
664 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
665 @@ -62,7 +62,7 @@
666 LIBPRLDAP =
667 endif
668 DLLPRLDAP = $(addprefix $(OBJDIR_NAME)/, \
669 - $(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
670 + $(DLL_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
672 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
674 --- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2004-08-26 01:02:30.000000000 +0200
675 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile 2008-08-14 16:22:21.000000000 +0200
676 @@ -41,7 +41,7 @@
677 HDIR = $(topsrcdir)/ldap/include
679 LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
680 -DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
681 +DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
683 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
685 @@ -76,7 +92,7 @@
687 # variable definitions for exported symbols
688 ifeq ($(OS_ARCH), WINNT)
689 - SSLDAP_EXPORT_DEFS= $(srcdir)/../msdos/winsock/nsldapssl32.def
690 + SSLDAP_EXPORT_DEFS= $(win_srcdir)/../msdos/winsock/nsldapssl32.def
691 else
692 SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp
693 endif
694 --- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2006-02-03 15:44:49.000000000 +0100
695 +++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in 2008-08-14 16:22:21.000000000 +0200
696 @@ -56,7 +56,7 @@
697 HDIR = $(topsrcdir)/ldap/include
699 LIBSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
700 -DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
701 +DLLSSLDAP = $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
703 INSTALLDIR = $(DIST)/$(OBJDIR_NAME)
705 --- misc/mozilla/embedding/browser/gtk/src/Makefile.in 2006-03-22 19:22:41.000000000 +0100
706 +++ misc/build/mozilla/embedding/browser/gtk/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
707 @@ -112,14 +112,14 @@
708 gtkmozembed_internal.h
710 ifdef MOZ_ENABLE_GTK
711 -EXTRA_DSO_LDOPTS = \
712 +EXTRA_DSO_LDOPTS += \
713 $(MOZ_COMPONENT_LIBS) \
714 -lgtksuperwin \
715 $(NULL)
716 endif
718 ifdef MOZ_ENABLE_GTK2
719 -EXTRA_DSO_LDOPTS = \
720 +EXTRA_DSO_LDOPTS += \
721 $(MOZ_COMPONENT_LIBS) \
722 $(NULL)
723 endif
724 --- misc/mozilla/embedding/browser/gtk/tests/Makefile.in 2006-03-24 17:10:37.000000000 +0100
725 +++ misc/build/mozilla/embedding/browser/gtk/tests/Makefile.in 2008-08-14 16:22:21.000000000 +0200
726 @@ -63,10 +63,11 @@
727 TestGtkEmbedNotebook.cpp \
728 TestGtkEmbedSocket.cpp \
729 TestGtkEmbedChild.cpp
730 -endif
732 SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
734 +endif
736 # ENABLE_GNOME=1
738 ifdef ENABLE_GNOME
739 --- misc/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2005-06-20 21:24:51.000000000 +0200
740 +++ misc/build/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in 2009-02-19 13:11:39.000000000 +0100
741 @@ -68,25 +68,15 @@
743 unexport CC CXX
745 -ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
746 -ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
747 -export::
748 - rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/$(PROJECT) .
749 - ln -fs $(srcdir)/src
750 - ln -fs $(srcdir)/res
751 - ln -fs $(srcdir)/public
752 - ln -fs $(srcdir)/Info-*.plist .
753 -endif
755 libs::
756 # Bug 297227: The next line doesn't need to stay around forever, only
757 # long enough to clean up existing depend builds from when xcodebuild
758 # was being instructed to "install"
759 if test -e build/UninstalledProducts ; then $(MAKE) clean ; rm -rf $(DIST)/package/PrintPDE.plugin ; fi
761 - $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
762 - mkdir -p $(DIST)/package
763 - $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
764 +# $(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
765 +# mkdir -p $(DIST)/package
766 +# $(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
768 clean clobber::
769 rm -rf build
770 --- misc/mozilla/embedding/config/Makefile.in 2007-10-08 21:08:15.000000000 +0200
771 +++ misc/build/mozilla/embedding/config/Makefile.in 2008-08-14 16:22:21.000000000 +0200
772 @@ -110,7 +110,7 @@
773 $(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome
774 $(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed
775 ifndef MINIMO
776 - -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(LIB_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
777 + -$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(DLL_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
778 endif
779 ifeq ($(OS_ARCH),WINNT)
780 ifeq ($(WINAPP),mfcembed)
781 --- misc/mozilla/extensions/pref/autoconfig/src/Makefile.in 2006-02-03 15:41:09.000000000 +0100
782 +++ misc/build/mozilla/extensions/pref/autoconfig/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
783 @@ -85,7 +85,7 @@
784 endif
787 -EXTRA_DSO_LDOPTS = \
788 +EXTRA_DSO_LDOPTS += \
789 $(LIBS_DIR) \
790 $(MOZ_JS_LIBS) \
791 $(MOZ_COMPONENT_LIBS) \
792 --- misc/mozilla/extensions/sql/build/Makefile.in 2004-11-29 18:39:08.000000000 +0100
793 +++ misc/build/mozilla/extensions/sql/build/Makefile.in 2008-08-18 14:03:04.000000000 +0200
794 @@ -55,5 +55,5 @@
795 bin/components/sqlpgsql.xpt \
796 bin/components/sqlsqlite.xpt \
797 bin/components/sqlmysql.xpt \
798 - bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \
799 + bin/components/$(DLL_PREFIX)sql$(DLL_SUFFIX) \
800 bin/chrome/sql.jar
801 --- misc/mozilla/gfx/idl/nsIFreeType2.idl 2004-04-16 01:30:02.000000000 +0200
802 +++ misc/build/mozilla/gfx/idl/nsIFreeType2.idl 2008-08-14 16:22:21.000000000 +0200
803 @@ -76,10 +76,11 @@
804 native FT_Sfnt_Tag(FT_Sfnt_Tag);
805 native FT_Size(FT_Size);
807 -[ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
808 +[ptr] native FTC_ImageType_p(FTC_ImageType);
809 native FTC_Face_Requester(FTC_Face_Requester);
810 native FTC_Font(FTC_Font);
811 -native FTC_Image_Cache(FTC_Image_Cache);
812 +native FTC_FaceID(FTC_FaceID);
813 +native FTC_ImageCache(FTC_ImageCache);
814 native FTC_Manager(FTC_Manager);
816 // #ifdef MOZ_SVG
817 @@ -99,7 +100,7 @@
819 readonly attribute FT_Library library;
820 readonly attribute FTC_Manager FTCacheManager;
821 - readonly attribute FTC_Image_Cache ImageCache;
822 + readonly attribute FTC_ImageCache ImageCache;
824 void doneFace(in FT_Face face);
825 void doneFreeType(in FT_Library lib);
826 @@ -115,16 +116,16 @@
827 void outlineDecompose(in FT_Outline_p outline,
828 in const_FT_Outline_Funcs_p funcs, in voidPtr p);
829 void setCharmap(in FT_Face face, in FT_CharMap charmap);
830 - void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
831 + void imageCacheLookup(in FTC_ImageCache cache, in FTC_ImageType_p desc,
832 in FT_UInt gindex, out FT_Glyph glyph);
833 - void managerLookupSize(in FTC_Manager manager, in FTC_Font font,
834 - out FT_Face face, out FT_Size size);
835 + void managerLookupFace(in FTC_Manager manager, in FTC_FaceID face_id,
836 + out FT_Face face);
837 void managerDone(in FTC_Manager manager);
838 void managerNew(in FT_Library lib, in FT_UInt max_faces,
839 in FT_UInt max_sizes, in FT_ULong max_bytes,
840 in FTC_Face_Requester requester, in FT_Pointer req_data,
841 out FTC_Manager manager);
842 - void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
843 + void imageCacheNew(in FTC_Manager manager, out FTC_ImageCache cache);
844 /* #ifdef MOZ_SVG */
845 void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
846 in FT_Vector_p delta);
847 --- misc/mozilla/gfx/src/freetype/nsFreeType.cpp 2005-07-13 20:21:10.000000000 +0200
848 +++ misc/build/mozilla/gfx/src/freetype/nsFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
849 @@ -111,7 +111,7 @@
850 {"FT_Outline_Decompose", NS_FT2_OFFSET(nsFT_Outline_Decompose), PR_TRUE},
851 {"FT_Set_Charmap", NS_FT2_OFFSET(nsFT_Set_Charmap), PR_TRUE},
852 {"FTC_Image_Cache_Lookup", NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup), PR_TRUE},
853 - {"FTC_Manager_Lookup_Size", NS_FT2_OFFSET(nsFTC_Manager_Lookup_Size), PR_TRUE},
854 + {"FTC_Manager_LookupFace", NS_FT2_OFFSET(nsFTC_Manager_LookupFace), PR_TRUE},
855 {"FTC_Manager_Done", NS_FT2_OFFSET(nsFTC_Manager_Done), PR_TRUE},
856 {"FTC_Manager_New", NS_FT2_OFFSET(nsFTC_Manager_New), PR_TRUE},
857 {"FTC_Image_Cache_New", NS_FT2_OFFSET(nsFTC_Image_Cache_New), PR_TRUE},
858 @@ -288,7 +288,7 @@
861 NS_IMETHODIMP
862 -nsFreeType2::ImageCacheLookup(FTC_Image_Cache cache, FTC_Image_Desc *desc,
863 +nsFreeType2::ImageCacheLookup(FTC_ImageCache cache, FTC_ImageType *desc,
864 FT_UInt glyphID, FT_Glyph *glyph)
866 // call the FreeType2 function via the function pointer
867 @@ -297,11 +297,11 @@
870 NS_IMETHODIMP
871 -nsFreeType2::ManagerLookupSize(FTC_Manager manager, FTC_Font font,
872 - FT_Face *face, FT_Size *size)
873 +nsFreeType2::ManagerLookupFace(FTC_Manager manager, FTC_FaceID font,
874 + FT_Face *face)
876 // call the FreeType2 function via the function pointer
877 - FT_Error error = nsFTC_Manager_Lookup_Size(manager, font, face, size);
878 + FT_Error error = nsFTC_Manager_LookupFace(manager, font, face);
879 return error ? NS_ERROR_FAILURE : NS_OK;
882 @@ -326,7 +326,7 @@
885 NS_IMETHODIMP
886 -nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_Image_Cache *cache)
887 +nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_ImageCache *cache)
889 // call the FreeType2 function via the function pointer
890 FT_Error error = nsFTC_Image_Cache_New(manager, cache);
891 @@ -395,7 +395,7 @@
894 NS_IMETHODIMP
895 -nsFreeType2::GetImageCache(FTC_Image_Cache *aCache)
896 +nsFreeType2::GetImageCache(FTC_ImageCache *aCache)
898 *aCache = mImageCache;
899 return NS_OK;
900 --- misc/mozilla/gfx/src/freetype/nsFreeType.h 2005-05-01 19:36:19.000000000 +0200
901 +++ misc/build/mozilla/gfx/src/freetype/nsFreeType.h 2008-08-14 16:22:21.000000000 +0200
902 @@ -120,13 +120,13 @@
903 typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
904 typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
905 typedef FT_Error (*FTC_Image_Cache_Lookup_t)
906 - (FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
907 -typedef FT_Error (*FTC_Manager_Lookup_Size_t)
908 - (FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
909 + (FTC_ImageCache, FTC_ImageType*, FT_UInt, FT_Glyph*);
910 +typedef FT_Error (*FTC_Manager_LookupFace_t)
911 + (FTC_Manager, FTC_FaceID, FT_Face*);
912 typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
913 typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
914 FTC_Face_Requester, FT_Pointer, FTC_Manager*);
915 -typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
916 +typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_ImageCache*);
917 // #ifdef MOZ_SVG
918 typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
919 typedef FT_Error (*FT_Get_Kerning_t)
920 @@ -181,7 +181,7 @@
921 FT_Outline_Decompose_t nsFT_Outline_Decompose;
922 FT_Set_Charmap_t nsFT_Set_Charmap;
923 FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
924 - FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
925 + FTC_Manager_LookupFace_t nsFTC_Manager_LookupFace;
926 FTC_Manager_Done_t nsFTC_Manager_Done;
927 FTC_Manager_New_t nsFTC_Manager_New;
928 FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
929 @@ -229,7 +229,7 @@
930 PRLibrary *mSharedLib;
931 FT_Library mFreeTypeLibrary;
932 FTC_Manager mFTCacheManager;
933 - FTC_Image_Cache mImageCache;
934 + FTC_ImageCache mImageCache;
936 static nsHashtable *sFontFamilies;
937 static nsHashtable *sRange1CharSetNames;
938 --- misc/mozilla/gfx/src/gtk/Makefile.in 2006-07-20 07:12:33.000000000 +0200
939 +++ misc/build/mozilla/gfx/src/gtk/Makefile.in 2008-08-14 16:22:21.000000000 +0200
940 @@ -211,6 +211,10 @@
941 CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
942 CFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
944 +ifeq ($(OS_ARCH), Darwin)
945 +EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
946 +endif
948 ifeq ($(OS_ARCH), SunOS)
949 ifndef GNU_CC
950 # When using Sun's WorkShop compiler, including
951 --- misc/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2006-12-22 14:51:16.000000000 +0100
952 +++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.cpp 2008-08-14 16:22:21.000000000 +0200
953 @@ -1870,10 +1870,10 @@
955 mPixelSize = NSToIntRound(app2dev * mFont->size);
957 - mImageDesc.font.face_id = (void*)mEntry;
958 - mImageDesc.font.pix_width = mPixelSize;
959 - mImageDesc.font.pix_height = mPixelSize;
960 - mImageDesc.image_type = 0;
961 + mImageDesc->face_id = (FTC_FaceID)&mEntry;
962 + mImageDesc->width = mPixelSize;
963 + mImageDesc->height = mPixelSize;
964 + mImageDesc->flags = 0;
966 nsresult rv;
967 mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
968 @@ -1907,7 +1907,7 @@
969 if (!face)
970 return 0;
972 - FTC_Image_Cache iCache;
973 + FTC_ImageCache iCache;
974 nsresult rv = mFt2->GetImageCache(&iCache);
975 if (NS_FAILED(rv)) {
976 NS_ERROR("Failed to get Image Cache");
977 @@ -1945,8 +1945,8 @@
979 FTC_Manager cManager;
980 mFt2->GetFTCacheManager(&cManager);
981 - nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
982 - &face, nsnull);
983 + nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
984 + &face);
985 NS_ASSERTION(rv==0, "failed to get face/size");
986 if (rv)
987 return nsnull;
988 @@ -2392,16 +2392,16 @@
989 mEntry->GetFamilyName(fontName);
990 mEntry->GetStyleName(styleName);
992 - mImageDesc.font.face_id = (void*)mEntry;
993 + mImageDesc->face_id = (FTC_FaceID)&mEntry;
994 // TT glyph has no relation to size
995 - mImageDesc.font.pix_width = 16;
996 - mImageDesc.font.pix_height = 16;
997 - mImageDesc.image_type = 0;
998 + mImageDesc->width = 16;
999 + mImageDesc->height = 16;
1000 + mImageDesc->flags = 0;
1001 FT_Face face = nsnull;
1002 FTC_Manager cManager;
1003 mFt2->GetFTCacheManager(&cManager);
1004 - nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
1005 - &face, nsnull);
1006 + nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
1007 + &face);
1008 if (NS_FAILED(rv))
1009 return;
1011 --- misc/mozilla/gfx/src/ps/nsFontMetricsPS.h 2005-06-28 20:29:10.000000000 +0200
1012 +++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.h 2008-08-20 15:42:50.000000000 +0200
1013 @@ -424,7 +424,7 @@
1014 nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID;
1015 nsCOMPtr<nsIFreeType2> mFt2;
1016 PRUint16 mPixelSize;
1017 - FTC_Image_Desc mImageDesc;
1018 + FTC_ImageType mImageDesc;
1019 nsCString mFontNameBase; // the base name of type 1 (sub) fonts
1020 nscoord mHeight;
1022 @@ -493,7 +493,7 @@
1023 protected:
1024 nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry;
1025 nsCOMPtr<nsIFreeType2> mFt2;
1026 - FTC_Image_Desc mImageDesc;
1027 + FTC_ImageType mImageDesc;
1029 #endif // MOZ_ENABLE_FREETYPE2
1030 #endif // MOZ_ENABLE_XFT
1031 --- misc/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2004-04-17 23:52:34.000000000 +0200
1032 +++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.cpp 2008-08-14 16:22:21.000000000 +0200
1033 @@ -177,7 +177,7 @@
1034 FTC_Manager mgr;
1035 nsresult rv;
1036 mFt2->GetFTCacheManager(&mgr);
1037 - rv = mFt2->ManagerLookupSize(mgr, &mImageDesc.font, &face, nsnull);
1038 + rv = mFt2->ManagerLookupFace(mgr, mImageDesc->face_id, &face);
1039 NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size");
1040 if (NS_FAILED(rv))
1041 return nsnull;
1042 @@ -191,22 +191,15 @@
1043 PRBool embedded_bimap = PR_FALSE;
1044 mFaceID = aFaceID;
1045 mPixelSize = aPixelSize;
1046 - mImageDesc.font.face_id = (void*)mFaceID;
1047 - mImageDesc.font.pix_width = aPixelSize;
1048 - mImageDesc.font.pix_height = aPixelSize;
1049 - mImageDesc.image_type = 0;
1050 + mImageDesc->face_id = (FTC_FaceID)&mFaceID;
1051 + mImageDesc->width = aPixelSize;
1052 + mImageDesc->height = aPixelSize;
1053 + mImageDesc->flags = 0;
1055 if (aPixelSize < nsFreeType2::gAntiAliasMinimum) {
1056 - mImageDesc.image_type |= ftc_image_mono;
1057 anti_alias = PR_FALSE;
1060 - if (nsFreeType2::gFreeType2Autohinted)
1061 - mImageDesc.image_type |= ftc_image_flag_autohinted;
1063 - if (nsFreeType2::gFreeType2Unhinted)
1064 - mImageDesc.image_type |= ftc_image_flag_unhinted;
1066 PRUint32 num_embedded_bitmaps, i;
1067 PRInt32* embedded_bitmapheights;
1068 mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps,
1069 @@ -218,7 +211,6 @@
1070 if (embedded_bitmapheights[i] == aPixelSize) {
1071 embedded_bimap = PR_TRUE;
1072 // unhinted must be set for embedded bitmaps to be used
1073 - mImageDesc.image_type |= ftc_image_flag_unhinted;
1074 break;
1077 @@ -312,7 +304,7 @@
1078 if (!face)
1079 return NS_ERROR_FAILURE;
1081 - FTC_Image_Cache icache;
1082 + FTC_ImageCache icache;
1083 mFt2->GetImageCache(&icache);
1084 if (!icache)
1085 return NS_ERROR_FAILURE;
1086 @@ -401,7 +393,7 @@
1087 if (!face)
1088 return 0;
1090 - FTC_Image_Cache icache;
1091 + FTC_ImageCache icache;
1092 mFt2->GetImageCache(&icache);
1093 if (!icache)
1094 return 0;
1095 @@ -723,7 +715,7 @@
1096 if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2);
1097 #endif
1099 - FTC_Image_Cache icache;
1100 + FTC_ImageCache icache;
1101 mFt2->GetImageCache(&icache);
1102 if (!icache)
1103 return 0;
1104 --- misc/mozilla/gfx/src/x11shared/nsFontFreeType.h 2004-04-17 23:52:34.000000000 +0200
1105 +++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.h 2008-08-14 16:22:21.000000000 +0200
1106 @@ -110,7 +110,7 @@
1107 XImage *GetXImage(PRUint32 width, PRUint32 height);
1108 nsITrueTypeFontCatalogEntry *mFaceID;
1109 PRUint16 mPixelSize;
1110 - FTC_Image_Desc mImageDesc;
1111 + FTC_ImageType mImageDesc;
1112 nsCOMPtr<nsIFreeType2> mFt2;
1115 --- misc/mozilla/jpeg/jmorecfg.h 2004-12-12 01:57:39.000000000 +0100
1116 +++ misc/build/mozilla/jpeg/jmorecfg.h 2008-08-18 09:06:05.000000000 +0200
1117 @@ -108,7 +108,7 @@
1118 /* Defines for MMX/SSE2 support. */
1120 #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
1121 -#define HAVE_MMX_INTEL_MNEMONICS
1122 +//#define HAVE_MMX_INTEL_MNEMONICS
1124 /* SSE2 code appears broken for some cpus (bug 247437) */
1125 /* #define HAVE_SSE2_INTEL_MNEMONICS */
1126 --- misc/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2006-03-16 18:09:14.000000000 +0100
1127 +++ misc/build/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp 2008-08-14 16:22:21.000000000 +0200
1128 @@ -423,19 +423,19 @@
1129 return;
1132 - FTC_Image_Desc imageDesc;
1133 - imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref?
1134 + FTC_ImageType imageDesc;
1135 + imageDesc->face_id=(FTC_FaceID)font_data.font_entry.get(); // XXX do we need to addref?
1136 float twipstopixel = GetTwipsToPixels();
1137 float scale = GetPixelScale();
1138 - imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale);
1139 - imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale);
1140 - imageDesc.image_type |= ftc_image_grays;
1141 + imageDesc->width = (int)((float)(font_data.font.size)*twipstopixel/scale);
1142 + imageDesc->height = (int)((float)(font_data.font.size)*twipstopixel/scale);
1143 + imageDesc->flags |= /* ftc_image_grays */0;
1145 // get the face
1146 nsresult rv;
1147 FTC_Manager mgr;
1148 nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
1149 - rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull);
1150 + rv = nsSVGLibartFreetype::ft2->ManagerLookupFace(mgr, imageDesc->face_id, &mFace);
1151 NS_ASSERTION(mFace, "failed to get face/size");
1154 --- misc/mozilla/mailnews/addrbook/src/Makefile.in 2007-05-03 03:39:37.000000000 +0200
1155 +++ misc/build/mozilla/mailnews/addrbook/src/Makefile.in 2008-10-16 12:59:35.000000000 +0200
1156 @@ -106,6 +106,7 @@
1157 nsVCard.cpp \
1158 nsVCardObj.cpp \
1159 nsMsgVCardService.cpp \
1160 + nsAbMD5sum.cpp \
1161 nsAbLDIFService.cpp \
1162 $(NULL)
1164 @@ -114,7 +115,9 @@
1165 nsDirPrefs.h \
1166 nsAbCardProperty.h \
1167 nsAbMDBCardProperty.h \
1168 - nsVCardObj.h \
1169 + nsVCardObj.h \
1170 + nsAbAddressCollecter.h \
1171 + nsAbDirectoryQuery.h \
1172 $(NULL)
1174 ifeq ($(OS_ARCH),WINNT)
1175 --- misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2005-05-11 06:16:53.000000000 +0200
1176 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h 2008-08-14 16:22:21.000000000 +0200
1177 @@ -43,6 +43,7 @@
1178 #include "nsIAbBooleanExpression.h"
1179 #include "nsCOMPtr.h"
1180 #include "nsString.h"
1181 +#include "nsAbUtils.h"
1183 class nsIAbLDAPAttributeMap;
1185 @@ -74,6 +75,16 @@
1186 nsIAbBooleanConditionString* condition,
1187 nsCString& filter,
1188 int flags);
1189 + static void GenerateMultipleFilter(
1190 + nsAbBooleanConditionType conditionType,
1191 + nsCString& filter,
1192 + NS_ConvertUCS2toUTF8 &vUTF8,
1193 + CharPtrArrayGuard *pAttrs);
1194 + static void GenerateSingleFilter(
1195 + nsAbBooleanConditionType conditionType,
1196 + nsCString& filter,
1197 + NS_ConvertUCS2toUTF8 &vUTF8,
1198 + const char *ldapProperty);
1201 #endif
1202 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2007-02-18 23:18:13.000000000 +0100
1203 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp 2008-08-20 12:16:50.000000000 +0200
1204 @@ -126,11 +126,13 @@
1206 // use mURINoQuery to get a prefName
1207 nsCAutoString prefName;
1208 - prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
1209 + prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen);
1211 // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
1212 nsXPIDLCString URI;
1213 - rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI));
1214 + nsCAutoString uriPrefName;
1215 + uriPrefName = prefName + NS_LITERAL_CSTRING(".uri");
1216 + rv = prefs->GetCharPref(uriPrefName.get(), getter_Copies(URI));
1217 if (NS_FAILED(rv))
1220 @@ -154,6 +156,27 @@
1221 nsCAutoString tempLDAPURL(mURINoQuery);
1222 tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
1223 rv = mURL->SetSpec(tempLDAPURL);
1224 + NS_ENSURE_SUCCESS(rv,rv);
1226 + nsCAutoString aHost;
1227 + mURL->GetHost(aHost);
1228 + aHost.ReplaceChar('.','_');
1229 + prefName = nsDependentCString("ldap_2.servers.") + aHost;
1230 + PRBool useSSL=0;
1231 + rv = prefs->GetBoolPref(
1232 + PromiseFlatCString(prefName
1233 + + NS_LITERAL_CSTRING(".UseSSL")).get(),
1234 + &useSSL
1235 + );
1237 + // If use SSL,ldap url will look like this ldaps://host:port/.....
1238 + if (!NS_FAILED(rv) && useSSL)
1240 + tempLDAPURL.ReplaceSubstring("ldap:", "ldaps:");
1241 + rv = mURL->SetSpec(tempLDAPURL);
1243 + //NS_FAILED(rv) means ldap_2.servers.nscpphonebook.UseSSL not exist
1244 + rv = 0;
1246 else
1248 @@ -164,24 +187,29 @@
1249 // get the login information, if there is any
1251 rv = prefs->GetCharPref(
1252 - PromiseFlatCString(
1253 - Substring(mURINoQuery, kLDAPDirectoryRootLen,
1254 - mURINoQuery.Length() - kLDAPDirectoryRootLen)
1255 + PromiseFlatCString(prefName
1256 + NS_LITERAL_CSTRING(".auth.dn")).get(),
1257 getter_Copies(mLogin));
1258 if (NS_FAILED(rv)) {
1259 mLogin.Truncate(); // zero out mLogin
1262 + // get the password information, if there is any
1263 + //
1264 + rv = prefs->GetCharPref(
1265 + PromiseFlatCString(prefName
1266 + + NS_LITERAL_CSTRING(".auth.pwd")).get(),
1267 + getter_Copies(mPassword));
1268 + if (NS_FAILED(rv)) {
1269 + mPassword.Truncate(); // zero out mLogin
1271 // get the protocol version, if there is any. using a string pref
1272 // here instead of an int, as protocol versions sometimes have names like
1273 // "4bis".
1275 nsXPIDLCString protocolVersion;
1276 rv = prefs->GetCharPref(
1277 - PromiseFlatCString(
1278 - Substring(mURINoQuery, kLDAPDirectoryRootLen,
1279 - mURINoQuery.Length() - kLDAPDirectoryRootLen)
1280 + PromiseFlatCString(prefName
1281 + NS_LITERAL_CSTRING(".protocolVersion")).get(),
1282 getter_Copies(protocolVersion));
1284 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2006-12-22 14:51:38.000000000 +0100
1285 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp 2008-08-20 15:01:16.000000000 +0200
1286 @@ -74,7 +74,7 @@
1287 PRInt32 resultLimit = -1,
1288 PRInt32 timeOut = 0);
1289 virtual ~nsAbQueryLDAPMessageListener ();
1291 + void SetPassword(const nsAString& aPassword){m_sPassword = aPassword;};
1292 protected:
1293 nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
1294 nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
1295 @@ -108,6 +108,8 @@
1296 PRBool mCanceled;
1297 PRBool mWaitingForPrevQueryToFinish;
1299 + nsAutoString m_sPassword;
1301 nsCOMPtr<nsILDAPOperation> mSearchOperation;
1303 PRLock* mLock;
1304 @@ -272,7 +274,7 @@
1306 // If mLogin is set, we're expected to use it to get a password.
1308 - if (!mDirectoryQuery->mLogin.IsEmpty()) {
1309 + if (!mDirectoryQuery->mLogin.IsEmpty() && !m_sPassword.Length()) {
1310 // XXX hack until nsUTF8AutoString exists
1311 #define nsUTF8AutoString nsCAutoString
1312 nsUTF8AutoString spec;
1313 @@ -415,10 +417,13 @@
1314 rv = ldapOperation->Init(mConnection, proxyListener, nsnull);
1315 NS_ENSURE_SUCCESS(rv, rv);
1317 - // Bind
1318 - rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
1320 + // Bind
1321 + if (m_sPassword.Length())
1322 + rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(m_sPassword));
1323 + else
1324 + rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
1325 NS_ENSURE_SUCCESS(rv, rv);
1327 return rv;
1330 @@ -707,7 +712,7 @@
1331 rv = getLdapReturnAttributes (arguments, returnAttributes);
1332 NS_ENSURE_SUCCESS(rv, rv);
1336 // Get the filter
1337 nsCOMPtr<nsISupports> supportsExpression;
1338 rv = arguments->GetExpression (getter_AddRefs (supportsExpression));
1339 @@ -828,6 +833,10 @@
1340 if (msgListener)
1342 msgListener->mUrl = url;
1343 + msgListener->mQueryListener = listener;
1344 + msgListener->mResultLimit = resultLimit;
1345 + msgListener->mTimeOut = timeOut;
1346 + msgListener->mQueryArguments = arguments;
1347 return msgListener->DoSearch();
1350 @@ -845,6 +854,11 @@
1351 timeOut);
1352 if (_messageListener == NULL)
1353 return NS_ERROR_OUT_OF_MEMORY;
1355 + nsAutoString wPassword;
1356 + wPassword.AssignWithConversion(mPassword.get());
1357 + _messageListener->SetPassword(wPassword);
1359 mListener = _messageListener;
1360 *_retval = 1;
1362 --- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2004-07-24 21:50:29.000000000 +0200
1363 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h 2008-08-14 16:22:21.000000000 +0200
1364 @@ -72,6 +72,7 @@
1365 friend class nsAbQueryLDAPMessageListener;
1366 nsresult Initiate ();
1367 nsXPIDLCString mLogin; // authenticate to the LDAP server as...
1368 + nsXPIDLCString mPassword; // password to the LDAP server as...
1369 nsCOMPtr<nsILDAPURL> mDirectoryUrl; // the URL for the server
1370 PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl)
1372 --- misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:30:14.000000000 +0200
1373 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp 2008-08-14 16:22:21.000000000 +0200
1374 @@ -1 +1,633 @@
1375 -dummy
1377 + * The contents of this file are subject to the Mozilla Public
1378 + * License Version 1.1 (the "License"); you may not use this file
1379 + * except in compliance with the License. You may obtain a copy of
1380 + * the License at http://www.mozilla.org/MPL/
1381 + *
1382 + * Software distributed under the License is distributed on an "AS
1383 + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1384 + * implied. See the License for the specific language governing
1385 + * rights and limitations under the License.
1386 + *
1387 + * The Original Code is the Netscape security libraries.
1388 + *
1389 + * The Initial Developer of the Original Code is Netscape
1390 + * Communications Corporation. Portions created by Netscape are
1391 + * Copyright (C) 1994-2000 Netscape Communications Corporation. All
1392 + * Rights Reserved.
1393 + *
1394 + * Contributor(s):
1395 + *
1396 + * Alternatively, the contents of this file may be used under the
1397 + * terms of the GNU General Public License Version 2 or later (the
1398 + * "GPL"), in which case the provisions of the GPL are applicable
1399 + * instead of those above. If you wish to allow use of your
1400 + * version of this file only under the terms of the GPL and not to
1401 + * allow others to use your version of this file under the MPL,
1402 + * indicate your decision by deleting the provisions above and
1403 + * replace them with the notice and other provisions required by
1404 + * the GPL. If you do not delete the provisions above, a recipient
1405 + * may use your version of this file under either the MPL or the
1406 + * GPL.
1407 + */
1408 +#include <stdio.h>
1409 +#include <stdlib.h>
1411 +#include "prerr.h"
1413 +#include "prtypes.h"
1414 +#include "prlong.h"
1415 +#include "plstr.h"
1416 +#include "nsMemory.h"
1418 +#define MD5_HASH_LEN 16
1419 +#define MD5_BUFFER_SIZE 64
1420 +#define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8)
1422 +#define CV0_1 0x67452301
1423 +#define CV0_2 0xefcdab89
1424 +#define CV0_3 0x98badcfe
1425 +#define CV0_4 0x10325476
1427 +#define T1_0 0xd76aa478
1428 +#define T1_1 0xe8c7b756
1429 +#define T1_2 0x242070db
1430 +#define T1_3 0xc1bdceee
1431 +#define T1_4 0xf57c0faf
1432 +#define T1_5 0x4787c62a
1433 +#define T1_6 0xa8304613
1434 +#define T1_7 0xfd469501
1435 +#define T1_8 0x698098d8
1436 +#define T1_9 0x8b44f7af
1437 +#define T1_10 0xffff5bb1
1438 +#define T1_11 0x895cd7be
1439 +#define T1_12 0x6b901122
1440 +#define T1_13 0xfd987193
1441 +#define T1_14 0xa679438e
1442 +#define T1_15 0x49b40821
1444 +#define T2_0 0xf61e2562
1445 +#define T2_1 0xc040b340
1446 +#define T2_2 0x265e5a51
1447 +#define T2_3 0xe9b6c7aa
1448 +#define T2_4 0xd62f105d
1449 +#define T2_5 0x02441453
1450 +#define T2_6 0xd8a1e681
1451 +#define T2_7 0xe7d3fbc8
1452 +#define T2_8 0x21e1cde6
1453 +#define T2_9 0xc33707d6
1454 +#define T2_10 0xf4d50d87
1455 +#define T2_11 0x455a14ed
1456 +#define T2_12 0xa9e3e905
1457 +#define T2_13 0xfcefa3f8
1458 +#define T2_14 0x676f02d9
1459 +#define T2_15 0x8d2a4c8a
1461 +#define T3_0 0xfffa3942
1462 +#define T3_1 0x8771f681
1463 +#define T3_2 0x6d9d6122
1464 +#define T3_3 0xfde5380c
1465 +#define T3_4 0xa4beea44
1466 +#define T3_5 0x4bdecfa9
1467 +#define T3_6 0xf6bb4b60
1468 +#define T3_7 0xbebfbc70
1469 +#define T3_8 0x289b7ec6
1470 +#define T3_9 0xeaa127fa
1471 +#define T3_10 0xd4ef3085
1472 +#define T3_11 0x04881d05
1473 +#define T3_12 0xd9d4d039
1474 +#define T3_13 0xe6db99e5
1475 +#define T3_14 0x1fa27cf8
1476 +#define T3_15 0xc4ac5665
1478 +#define T4_0 0xf4292244
1479 +#define T4_1 0x432aff97
1480 +#define T4_2 0xab9423a7
1481 +#define T4_3 0xfc93a039
1482 +#define T4_4 0x655b59c3
1483 +#define T4_5 0x8f0ccc92
1484 +#define T4_6 0xffeff47d
1485 +#define T4_7 0x85845dd1
1486 +#define T4_8 0x6fa87e4f
1487 +#define T4_9 0xfe2ce6e0
1488 +#define T4_10 0xa3014314
1489 +#define T4_11 0x4e0811a1
1490 +#define T4_12 0xf7537e82
1491 +#define T4_13 0xbd3af235
1492 +#define T4_14 0x2ad7d2bb
1493 +#define T4_15 0xeb86d391
1495 +#define R1B0 0
1496 +#define R1B1 1
1497 +#define R1B2 2
1498 +#define R1B3 3
1499 +#define R1B4 4
1500 +#define R1B5 5
1501 +#define R1B6 6
1502 +#define R1B7 7
1503 +#define R1B8 8
1504 +#define R1B9 9
1505 +#define R1B10 10
1506 +#define R1B11 11
1507 +#define R1B12 12
1508 +#define R1B13 13
1509 +#define R1B14 14
1510 +#define R1B15 15
1512 +#define R2B0 1
1513 +#define R2B1 6
1514 +#define R2B2 11
1515 +#define R2B3 0
1516 +#define R2B4 5
1517 +#define R2B5 10
1518 +#define R2B6 15
1519 +#define R2B7 4
1520 +#define R2B8 9
1521 +#define R2B9 14
1522 +#define R2B10 3
1523 +#define R2B11 8
1524 +#define R2B12 13
1525 +#define R2B13 2
1526 +#define R2B14 7
1527 +#define R2B15 12
1529 +#define R3B0 5
1530 +#define R3B1 8
1531 +#define R3B2 11
1532 +#define R3B3 14
1533 +#define R3B4 1
1534 +#define R3B5 4
1535 +#define R3B6 7
1536 +#define R3B7 10
1537 +#define R3B8 13
1538 +#define R3B9 0
1539 +#define R3B10 3
1540 +#define R3B11 6
1541 +#define R3B12 9
1542 +#define R3B13 12
1543 +#define R3B14 15
1544 +#define R3B15 2
1546 +#define R4B0 0
1547 +#define R4B1 7
1548 +#define R4B2 14
1549 +#define R4B3 5
1550 +#define R4B4 12
1551 +#define R4B5 3
1552 +#define R4B6 10
1553 +#define R4B7 1
1554 +#define R4B8 8
1555 +#define R4B9 15
1556 +#define R4B10 6
1557 +#define R4B11 13
1558 +#define R4B12 4
1559 +#define R4B13 11
1560 +#define R4B14 2
1561 +#define R4B15 9
1563 +#define S1_0 7
1564 +#define S1_1 12
1565 +#define S1_2 17
1566 +#define S1_3 22
1568 +#define S2_0 5
1569 +#define S2_1 9
1570 +#define S2_2 14
1571 +#define S2_3 20
1573 +#define S3_0 4
1574 +#define S3_1 11
1575 +#define S3_2 16
1576 +#define S3_3 23
1578 +#define S4_0 6
1579 +#define S4_1 10
1580 +#define S4_2 15
1581 +#define S4_3 21
1583 +struct MD5ContextStr {
1584 + PRUint32 lsbInput;
1585 + PRUint32 msbInput;
1586 + PRUint32 cv[4];
1587 + union {
1588 + PRUint8 b[64];
1589 + PRUint32 w[16];
1590 + } u;
1592 +typedef struct MD5ContextStr MD5Context;
1594 +#define inBuf u.b
1596 +int MD5_Hash(unsigned char *dest, const char *src);
1597 +int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length);
1598 +MD5Context * MD5_NewContext(void);
1599 +void MD5_DestroyContext(MD5Context *cx, PRBool freeit);
1600 +void MD5_Begin(MD5Context *cx);
1601 +static void md5_compress(MD5Context *cx);
1602 +void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen);
1603 +void MD5_End(MD5Context *cx, unsigned char *digest,
1604 + unsigned int *digestLen, unsigned int maxDigestLen);
1605 +unsigned int MD5_FlattenSize(MD5Context *cx);
1606 +int MD5_Flatten(MD5Context *cx, unsigned char *space);
1607 +MD5Context * MD5_Resurrect(unsigned char *space, void *arg);
1608 +void MD5_TraceState(MD5Context *cx);
1610 +int
1611 +MD5_Hash(unsigned char *dest, const char *src)
1613 + return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));
1616 +int
1617 +MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
1619 + unsigned int len;
1620 + MD5Context *cx = MD5_NewContext();
1621 + if (cx == NULL) {
1622 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
1623 + return -1;
1625 + MD5_Begin(cx);
1626 + MD5_Update(cx, src, src_length);
1627 + MD5_End(cx, dest, &len, MD5_HASH_LEN);
1628 + MD5_DestroyContext(cx, PR_TRUE);
1629 + return 0;
1632 +MD5Context *
1633 +MD5_NewContext(void)
1635 + MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context));
1636 + if (cx == NULL) {
1637 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
1638 + return NULL;
1640 + return cx;
1643 +void
1644 +MD5_DestroyContext(MD5Context *cx, PRBool freeit)
1646 + if (freeit) {
1647 + free(cx);
1651 +void
1652 +MD5_Begin(MD5Context *cx)
1654 + cx->lsbInput = 0;
1655 + cx->msbInput = 0;
1656 + memset(cx->inBuf, 0, sizeof(cx->inBuf));
1657 + cx->cv[0] = CV0_1;
1658 + cx->cv[1] = CV0_2;
1659 + cx->cv[2] = CV0_3;
1660 + cx->cv[3] = CV0_4;
1663 +#define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s))
1665 +#define MASK 0x00ff00ff
1666 +#ifdef IS_LITTLE_ENDIAN
1667 +#define lendian(i32) \
1668 + (i32)
1669 +#else
1670 +#define lendian(i32) \
1671 + (tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
1672 +#endif
1674 +#if defined(SOLARIS) || defined(HPUX)
1675 +#define addto64(sumhigh, sumlow, addend) \
1676 + sumlow += addend; sumhigh += (sumlow < addend);
1677 +#else
1678 +#define addto64(sumhigh, sumlow, addend) \
1679 + sumlow += addend; if (sumlow < addend) ++sumhigh;
1680 +#endif
1682 +#define F(X, Y, Z) \
1683 + ((X & Y) | ((~X) & Z))
1685 +#define G(X, Y, Z) \
1686 + ((X & Z) | (Y & (~Z)))
1688 +#define H(X, Y, Z) \
1689 + (X ^ Y ^ Z)
1691 +#define I(X, Y, Z) \
1692 + (Y ^ (X | (~Z)))
1694 +#define FF(a, b, c, d, bufint, s, ti) \
1695 + a = b + cls(a + F(b, c, d) + bufint + ti, s)
1697 +#define GG(a, b, c, d, bufint, s, ti) \
1698 + a = b + cls(a + G(b, c, d) + bufint + ti, s)
1700 +#define HH(a, b, c, d, bufint, s, ti) \
1701 + a = b + cls(a + H(b, c, d) + bufint + ti, s)
1703 +#define II(a, b, c, d, bufint, s, ti) \
1704 + a = b + cls(a + I(b, c, d) + bufint + ti, s)
1706 +static void
1707 +md5_compress(MD5Context *cx)
1709 + PRUint32 a, b, c, d;
1710 + PRUint32 tmp;
1711 + a = cx->cv[0];
1712 + b = cx->cv[1];
1713 + c = cx->cv[2];
1714 + d = cx->cv[3];
1715 +#ifndef IS_LITTLE_ENDIAN
1716 + cx->u.w[0] = lendian(cx->u.w[0]);
1717 + cx->u.w[1] = lendian(cx->u.w[1]);
1718 + cx->u.w[2] = lendian(cx->u.w[2]);
1719 + cx->u.w[3] = lendian(cx->u.w[3]);
1720 + cx->u.w[4] = lendian(cx->u.w[4]);
1721 + cx->u.w[5] = lendian(cx->u.w[5]);
1722 + cx->u.w[6] = lendian(cx->u.w[6]);
1723 + cx->u.w[7] = lendian(cx->u.w[7]);
1724 + cx->u.w[8] = lendian(cx->u.w[8]);
1725 + cx->u.w[9] = lendian(cx->u.w[9]);
1726 + cx->u.w[10] = lendian(cx->u.w[10]);
1727 + cx->u.w[11] = lendian(cx->u.w[11]);
1728 + cx->u.w[12] = lendian(cx->u.w[12]);
1729 + cx->u.w[13] = lendian(cx->u.w[13]);
1730 + cx->u.w[14] = lendian(cx->u.w[14]);
1731 + cx->u.w[15] = lendian(cx->u.w[15]);
1732 +#endif
1733 + FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0);
1734 + FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1);
1735 + FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2);
1736 + FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3);
1737 + FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4);
1738 + FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5);
1739 + FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6);
1740 + FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7);
1741 + FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8);
1742 + FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9);
1743 + FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10);
1744 + FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11);
1745 + FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12);
1746 + FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13);
1747 + FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14);
1748 + FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15);
1749 + GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0);
1750 + GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1);
1751 + GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2);
1752 + GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3);
1753 + GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4);
1754 + GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5);
1755 + GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6);
1756 + GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7);
1757 + GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8);
1758 + GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9);
1759 + GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10);
1760 + GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11);
1761 + GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12);
1762 + GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13);
1763 + GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14);
1764 + GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15);
1765 + HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0);
1766 + HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1);
1767 + HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2);
1768 + HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3);
1769 + HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4);
1770 + HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5);
1771 + HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6);
1772 + HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7);
1773 + HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8);
1774 + HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9);
1775 + HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10);
1776 + HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11);
1777 + HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12);
1778 + HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13);
1779 + HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14);
1780 + HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15);
1781 + II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0);
1782 + II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1);
1783 + II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2);
1784 + II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3);
1785 + II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4);
1786 + II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5);
1787 + II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6);
1788 + II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7);
1789 + II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8);
1790 + II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9);
1791 + II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10);
1792 + II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11);
1793 + II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12);
1794 + II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13);
1795 + II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14);
1796 + II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15);
1797 + cx->cv[0] += a;
1798 + cx->cv[1] += b;
1799 + cx->cv[2] += c;
1800 + cx->cv[3] += d;
1803 +void
1804 +MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
1806 + PRUint32 bytesToConsume;
1807 + PRUint32 inBufIndex = cx->lsbInput & 63;
1809 + /* Add the number of input bytes to the 64-bit input counter. */
1810 + addto64(cx->msbInput, cx->lsbInput, inputLen);
1811 + if (inBufIndex) {
1812 + /* There is already data in the buffer. Fill with input. */
1813 + bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
1814 + memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
1815 + if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE)
1816 + /* The buffer is filled. Run the compression function. */
1817 + md5_compress(cx);
1818 + /* Remaining input. */
1819 + inputLen -= bytesToConsume;
1820 + input += bytesToConsume;
1823 + /* Iterate over 64-byte chunks of the message. */
1824 + while (inputLen >= MD5_BUFFER_SIZE) {
1825 + memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
1826 + md5_compress(cx);
1827 + inputLen -= MD5_BUFFER_SIZE;
1828 + input += MD5_BUFFER_SIZE;
1831 + /* Tail of message (message bytes mod 64). */
1832 + if (inputLen)
1833 + memcpy(cx->inBuf, input, inputLen);
1836 +static const unsigned char padbytes[] = {
1837 + 0x80, 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,
1848 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1851 +void
1852 +MD5_End(MD5Context *cx, unsigned char *digest,
1853 + unsigned int *digestLen, unsigned int maxDigestLen)
1855 +#ifndef IS_LITTLE_ENDIAN
1856 + PRUint32 tmp;
1857 +#endif
1858 + PRUint32 lowInput, highInput;
1859 + PRUint32 inBufIndex = cx->lsbInput & 63;
1861 + if (maxDigestLen < MD5_HASH_LEN) {
1862 +// PORT_SetError(SEC_ERROR_INVALID_ARGS);
1863 + return;
1866 + /* Copy out the length of bits input before padding. */
1867 + lowInput = cx->lsbInput;
1868 + highInput = (cx->msbInput << 3) | (lowInput >> 29);
1869 + lowInput <<= 3;
1871 + if (inBufIndex < MD5_END_BUFFER) {
1872 + MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
1873 + } else {
1874 + MD5_Update(cx, padbytes,
1875 + MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);
1878 + /* Store the number of bytes input (before padding) in final 64 bits. */
1879 + cx->u.w[14] = lendian(lowInput);
1880 + cx->u.w[15] = lendian(highInput);
1882 + /* Final call to compress. */
1883 + md5_compress(cx);
1885 + /* Copy the resulting values out of the chain variables into return buf. */
1886 + *digestLen = MD5_HASH_LEN;
1887 +#ifndef IS_LITTLE_ENDIAN
1888 + cx->cv[0] = lendian(cx->cv[0]);
1889 + cx->cv[1] = lendian(cx->cv[1]);
1890 + cx->cv[2] = lendian(cx->cv[2]);
1891 + cx->cv[3] = lendian(cx->cv[3]);
1892 +#endif
1893 + memcpy(digest, cx->cv, MD5_HASH_LEN);
1896 +unsigned int
1897 +MD5_FlattenSize(MD5Context *cx)
1899 + return sizeof(*cx);
1902 +int
1903 +MD5_Flatten(MD5Context *cx, unsigned char *space)
1905 + memcpy(space, cx, sizeof(*cx));
1906 + return 0;
1909 +MD5Context *
1910 +MD5_Resurrect(unsigned char *space, void *arg)
1912 + MD5Context *cx = MD5_NewContext();
1913 + if (cx)
1914 + memcpy(cx, space, sizeof(*cx));
1915 + return cx;
1918 +void
1919 +MD5_TraceState(MD5Context *cx)
1921 +// PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
1924 +int
1925 +md5_stream (FILE *stream, unsigned char *dest)
1927 + /* Important: BLOCKSIZE must be a multiple of 64. */
1928 +#define BLOCKSIZE 4096
1929 + unsigned int len;
1930 + MD5Context *cx = MD5_NewContext();
1931 + if (cx == NULL) {
1932 +// PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
1933 + return -1;
1936 + unsigned char buffer[BLOCKSIZE + 72];
1937 + size_t sum;
1939 + /* Initialize the computation context. */
1940 + MD5_Begin(cx);
1942 + /* Iterate over full file contents. */
1943 + while (1)
1945 + /* We read the file in blocks of BLOCKSIZE bytes. One call of the
1946 + computation function processes the whole buffer so that with the
1947 + next round of the loop another block can be read. */
1948 + size_t n;
1949 + sum = 0;
1951 + /* Read block. Take care for partial reads. */
1952 + do
1954 + n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
1956 + sum += n;
1958 + while (sum < BLOCKSIZE && n != 0);
1959 + if (n == 0 && ferror (stream))
1960 + return 1;
1962 + /* If end of file is reached, end the loop. */
1963 + if (n == 0)
1964 + break;
1966 + /* Process buffer with BLOCKSIZE bytes. Note that
1967 + BLOCKSIZE % 64 == 0
1968 + */
1969 + MD5_Update(cx, buffer, BLOCKSIZE);
1972 + /* Add the last bytes if necessary. */
1973 + if (sum > 0)
1974 + MD5_Update(cx, buffer, sum);
1976 + MD5_End(cx, dest, &len, MD5_HASH_LEN);
1977 + MD5_DestroyContext(cx, PR_TRUE);
1978 + return len;
1982 +int getMD5sum(const char * fileName,char * sum)
1984 + unsigned char bin_sum[16];
1985 + int len=0;
1986 + if (fileName)
1988 + FILE *fp=fopen(fileName,"rb");
1989 + if (fp)
1991 + len=md5_stream(fp,bin_sum);
1992 + memset(sum,0,33);
1993 + for (int i = 0; i < len; ++i)
1994 + sprintf (sum,"%s%02x",sum, bin_sum[i]);
1995 + fclose(fp);
1996 + return 0;
1999 + return 1;
2002 +int testMD5sum(const char * fileName,char * sum)
2004 + char newSum[33]="";
2005 + if (getMD5sum(fileName,newSum))
2006 + return 1;
2007 + return strcmp(newSum,sum);
2009 --- misc/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2006-12-22 14:51:38.000000000 +0100
2010 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp 2008-08-14 16:22:21.000000000 +0200
2011 @@ -273,8 +273,7 @@
2012 if (mCardDatabase)
2014 mCardDatabase->EditCard(this, PR_TRUE);
2015 - mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2016 - return NS_OK;
2017 + return mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2019 else
2020 return NS_ERROR_FAILURE;
2021 --- misc/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-01-29 20:31:58.000000000 +0100
2022 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
2023 @@ -561,7 +561,7 @@
2027 - mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2028 + rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2030 return rv;
2032 @@ -707,6 +707,7 @@
2033 return NS_ERROR_NOT_IMPLEMENTED;
2035 nsresult rv = NS_OK;
2037 if (!mDatabase)
2038 rv = GetAbDatabase();
2040 @@ -736,10 +737,11 @@
2041 mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE /* notify */);
2042 else
2043 mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE);
2044 - mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2045 + rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
2047 + NS_ENSURE_SUCCESS(rv, rv);
2048 NS_IF_ADDREF(*addedCard = newCard);
2049 - return NS_OK;
2050 + return rv;
2053 NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
2054 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2004-07-31 20:04:18.000000000 +0200
2055 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp 2008-08-14 16:22:21.000000000 +0200
2056 @@ -94,6 +94,7 @@
2058 index_DisplayName = 0,
2059 index_EmailAddress,
2060 + index_SecondEmailAddress,
2061 index_FirstName,
2062 index_LastName,
2063 index_NickName,
2064 @@ -121,32 +122,34 @@
2066 static const ULONG OutlookCardMAPIProps [] =
2068 - PR_DISPLAY_NAME_W,
2069 - PR_EMAIL_ADDRESS_W,
2070 - PR_GIVEN_NAME_W,
2071 - PR_SURNAME_W,
2072 - PR_NICKNAME_W,
2073 - PR_BUSINESS_TELEPHONE_NUMBER_W,
2074 - PR_HOME_TELEPHONE_NUMBER_W,
2075 - PR_BUSINESS_FAX_NUMBER_W,
2076 - PR_PAGER_TELEPHONE_NUMBER_W,
2077 - PR_MOBILE_TELEPHONE_NUMBER_W,
2078 - PR_HOME_ADDRESS_CITY_W,
2079 - PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
2080 - PR_HOME_ADDRESS_POSTAL_CODE_W,
2081 - PR_HOME_ADDRESS_COUNTRY_W,
2082 - PR_BUSINESS_ADDRESS_CITY_W,
2083 - PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
2084 - PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
2085 - PR_BUSINESS_ADDRESS_COUNTRY_W,
2086 - PR_TITLE_W,
2087 - PR_DEPARTMENT_NAME_W,
2088 - PR_COMPANY_NAME_W,
2089 - PR_BUSINESS_HOME_PAGE_W,
2090 - PR_PERSONAL_HOME_PAGE_W,
2091 - PR_COMMENT_W
2092 + PR_DISPLAY_NAME_A,//0x8035001E
2093 + PR_EMAIL_ADDRESS_A,//0x8034001E
2094 + PR_SECOND_EMAIL_ADDRESS_A,//Second Email Address
2095 + PR_GIVEN_NAME_A,
2096 + PR_SURNAME_A,
2097 + PR_NICKNAME_A,
2098 + PR_BUSINESS_TELEPHONE_NUMBER_A,
2099 + PR_HOME_TELEPHONE_NUMBER_A,
2100 + PR_BUSINESS_FAX_NUMBER_A,
2101 + PR_PAGER_TELEPHONE_NUMBER_A,
2102 + PR_MOBILE_TELEPHONE_NUMBER_A,
2103 + PR_HOME_ADDRESS_CITY_A,
2104 + PR_HOME_ADDRESS_STATE_OR_PROVINCE_A,
2105 + PR_HOME_ADDRESS_POSTAL_CODE_A,
2106 + PR_HOME_ADDRESS_COUNTRY_A,
2107 + PR_BUSINESS_ADDRESS_CITY_A,
2108 + PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A,
2109 + PR_BUSINESS_ADDRESS_POSTAL_CODE_A,
2110 + PR_BUSINESS_ADDRESS_COUNTRY_A,
2111 + PR_TITLE_A,
2112 + PR_DEPARTMENT_NAME_A,
2113 + PR_COMPANY_NAME_A,
2114 + PR_BUSINESS_HOME_PAGE_A,
2115 + PR_PERSONAL_HOME_PAGE_A,
2116 + PR_COMMENT_A
2120 nsresult nsAbOutlookCard::Init(const char *aUri)
2122 nsresult retCode = nsRDFResource::Init(aUri) ;
2123 @@ -173,6 +176,7 @@
2124 SetDisplayName(unichars [index_DisplayName]->get()) ;
2125 SetNickName(unichars [index_NickName]->get()) ;
2126 SetPrimaryEmail(unichars [index_EmailAddress]->get()) ;
2127 + SetSecondEmail(unichars [index_SecondEmailAddress]->get()) ;
2128 SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ;
2129 SetHomePhone(unichars [index_HomePhoneNumber]->get()) ;
2130 SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ;
2131 @@ -207,12 +211,12 @@
2132 nsAutoString unichar ;
2133 nsAutoString unicharBis ;
2135 - if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, unichar)) {
2136 + if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_A, unichar)) {
2137 splitString(unichar, unicharBis) ;
2138 SetHomeAddress(unichar.get()) ;
2139 SetHomeAddress2(unicharBis.get()) ;
2141 - if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, unichar)) {
2142 + if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_A, unichar)) {
2143 splitString(unichar, unicharBis) ;
2144 SetWorkAddress(unichar.get()) ;
2145 SetWorkAddress2(unicharBis.get()) ;
2146 @@ -290,6 +294,7 @@
2147 SetDisplayName(properties [index_DisplayName]) ;
2148 GetNickName(getter_Copies(properties [index_NickName])) ;
2149 GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
2150 + GetSecondEmail(getter_Copies(properties [index_SecondEmailAddress])) ;
2151 GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
2152 GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
2153 GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
2154 @@ -309,9 +314,16 @@
2155 GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
2156 GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
2157 GetNotes(getter_Copies(properties [index_Comments])) ;
2158 - if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps,
2159 - index_LastProp, properties)) {
2160 - PRINTF(("Cannot set general properties.\n")) ;
2162 + int i=0;
2163 + for (i=0;i<index_LastProp;i++)
2165 + if (!mapiAddBook->SetPropertyUString(*mMapiData,
2166 + OutlookCardMAPIProps[i],
2167 + properties[i]))
2169 + PRINTF(("Cannot set properties:%d.\n",OutlookCardMAPIProps[i])) ;
2172 delete [] properties ;
2173 nsXPIDLString unichar ;
2174 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2004-04-17 20:32:14.000000000 +0200
2175 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp 2008-08-14 16:22:21.000000000 +0200
2176 @@ -124,8 +124,8 @@
2177 nsCAutoString uri ;
2178 nsCOMPtr<nsIRDFResource> resource ;
2180 - for (ULONG i = 0 ; i < folders.mNbEntries ; ++ i) {
2181 - folders.mEntries [i].ToString(entryId) ;
2182 + for (ULONG i = 0 ; i < folders.GetSize() ; ++ i) {
2183 + folders[i].ToString(entryId) ;
2184 buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
2185 uri.Append(entryId) ;
2187 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2006-12-22 14:51:38.000000000 +0100
2188 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp 2008-08-14 16:22:21.000000000 +0200
2189 @@ -126,7 +126,7 @@
2190 PRINTF(("Cannot get type.\n")) ;
2191 return NS_ERROR_FAILURE ;
2193 - if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) {
2194 + if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, unichars)) {
2195 PRINTF(("Cannot get name.\n")) ;
2196 return NS_ERROR_FAILURE ;
2198 @@ -163,45 +163,85 @@
2199 return retCode;
2202 +nsresult nsAbOutlookDirectory::BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
2203 + PRBool aSearchForOld, PRBool& aIsNewCard)
2205 + nsresult retCode = NS_OK ;
2206 + if (aSearchForOld) {
2207 + nsCStringKey key(uriName) ;
2208 + nsCOMPtr<nsISupports> existingCard = mCardList.Get(&key) ;
2210 + if (existingCard) {
2211 + nsCOMPtr<nsIAbCard> card(do_QueryInterface(existingCard, &retCode)) ;
2213 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2214 + NS_IF_ADDREF(*aNewCard = card) ;
2215 + aIsNewCard = PR_FALSE ;
2216 + return retCode ;
2219 + aIsNewCard = PR_TRUE ;
2220 + nsCOMPtr<nsIRDFResource> resource ;
2222 + nsCOMPtr<nsIAbCard> childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
2223 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2224 + resource = do_QueryInterface(childCard, &retCode) ;
2225 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2226 + retCode = resource->Init(uriName.get()) ;
2227 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2228 + NS_IF_ADDREF(*aNewCard = childCard);
2229 + return retCode ;
2232 NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards)
2234 if (!aCards) { return NS_ERROR_NULL_POINTER ; }
2235 *aCards = nsnull ;
2236 nsCOMPtr<nsISupportsArray> cardList ;
2237 + nsCStringArray uriList ;
2238 + nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
2239 nsresult retCode ;
2241 - mCardList.Reset() ;
2242 if (mIsQueryURI) {
2243 retCode = StartSearch() ;
2244 - NS_NewISupportsArray(getter_AddRefs(cardList)) ;
2246 else {
2247 - retCode = GetChildCards(getter_AddRefs(cardList), nsnull) ;
2248 + retCode = GetChildCards(uriList, nsnull) ;
2250 + NS_NewISupportsArray(getter_AddRefs(cardList)) ;
2251 if (NS_SUCCEEDED(retCode)) {
2252 // Fill the results array and update the card list
2253 // Also update the address list and notify any changes.
2254 PRUint32 nbCards = 0 ;
2255 - nsCOMPtr<nsISupports> element ;
2256 + nsCAutoString uriName;
2257 + nsCOMPtr <nsIAbCard> childCard;
2258 + PRBool searchForOldCards = 0; //(mCardList.Count() != 0) ;
2260 + nbCards = uriList.Count();
2261 + NS_NewISupportsArray(getter_AddRefs(m_AddressList));
2263 - cardList->Enumerate(aCards) ;
2264 - cardList->Count(&nbCards) ;
2265 for (PRUint32 i = 0 ; i < nbCards ; ++ i) {
2266 - cardList->GetElementAt(i, getter_AddRefs(element)) ;
2267 - nsVoidKey newKey (NS_STATIC_CAST(void *, element)) ;
2268 - nsCOMPtr<nsISupports> oldElement = mCardList.Get(&newKey) ;
2269 + PRBool isNewCard = PR_FALSE ;
2271 - if (!oldElement) {
2272 + uriList.CStringAt(i,uriName);
2273 + retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), searchForOldCards, isNewCard);
2274 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2275 + cardList->AppendElement(childCard);
2277 + if (isNewCard) {
2278 // We are dealing with a new element (probably directly
2279 // added from Outlook), we may need to sync m_AddressList
2280 - mCardList.Put(&newKey, element) ;
2281 - nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
2282 + nsCStringKey newKey(uriName) ;
2284 + mCardList.Put(&newKey, childCard) ;
2285 + nsCOMPtr<nsIAbCard> card (do_QueryInterface(childCard, &retCode)) ;
2287 NS_ENSURE_SUCCESS(retCode, retCode) ;
2288 PRBool isMailList = PR_FALSE ;
2290 retCode = card->GetIsMailList(&isMailList) ;
2291 NS_ENSURE_SUCCESS(retCode, retCode) ;
2293 if (isMailList) {
2294 // We can have mailing lists only in folder,
2295 // we must add the directory to m_AddressList
2296 @@ -224,18 +264,33 @@
2297 NotifyItemAddition(card) ;
2300 - else {
2301 - NS_ASSERTION(oldElement == element, "Different card stored") ;
2304 + return cardList->Enumerate(aCards) ;
2307 +static nsresult ExtractUriFromCard(nsIAbCard *aCard, nsCString& aUri) {
2308 + nsresult retCode = NS_OK ;
2309 + nsCOMPtr<nsIRDFResource> resource (do_QueryInterface(aCard, &retCode)) ;
2311 + // Receiving a non-RDF card is accepted
2312 + if (NS_FAILED(retCode)) { return NS_OK ; }
2313 + nsXPIDLCString uri ;
2315 + retCode = resource->GetValue(getter_Copies(uri)) ;
2316 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2317 + aUri = uri.get() ;
2318 return retCode ;
2321 NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard)
2323 if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; }
2324 - nsVoidKey key (NS_STATIC_CAST(void *, aCard)) ;
2325 + *aHasCard = PR_FALSE ;
2326 + nsCString uri ;
2328 + ExtractUriFromCard(aCard, uri) ;
2329 + nsCStringKey key(uri) ;
2331 *aHasCard = mCardList.Exists(&key) ;
2332 return NS_OK ;
2333 @@ -317,7 +372,10 @@
2334 PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
2336 else {
2337 - nsVoidKey key (NS_STATIC_CAST(void *, element)) ;
2338 + nsCString uri ;
2340 + ExtractUriFromCard(card, uri) ;
2341 + nsCStringKey key(uri) ;
2343 mCardList.Remove(&key) ;
2344 if (m_IsMailList) { m_AddressList->RemoveElement(element) ; }
2345 @@ -386,7 +444,10 @@
2347 retCode = CreateCard(aData, addedCard) ;
2348 NS_ENSURE_SUCCESS(retCode, retCode) ;
2349 - nsVoidKey newKey (NS_STATIC_CAST(void *, *addedCard)) ;
2350 + nsCString uri ;
2352 + ExtractUriFromCard(*addedCard, uri) ;
2353 + nsCStringKey newKey(uri) ;
2355 mCardList.Put(&newKey, *addedCard) ;
2356 if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; }
2357 @@ -457,7 +518,7 @@
2358 if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
2359 retCode = GetDirName(getter_Copies(name)) ;
2360 NS_ENSURE_SUCCESS(retCode, retCode) ;
2361 - if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, name.get())) {
2362 + if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, name.get())) {
2363 return NS_ERROR_FAILURE ;
2365 retCode = CommitAddressList() ;
2366 @@ -518,6 +579,7 @@
2367 {"DisplayName", PR_DISPLAY_NAME_A},
2368 {"NickName", PR_NICKNAME_A},
2369 {"PrimaryEmail", PR_EMAIL_ADDRESS_A},
2370 + {"SecondEmail",PR_SECOND_EMAIL_ADDRESS_A},
2371 {"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A},
2372 {"HomePhone", PR_HOME_TELEPHONE_NUMBER_A},
2373 {"FaxNumber", PR_BUSINESS_FAX_NUMBER_A},
2374 @@ -1027,7 +1089,10 @@
2376 nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard)
2378 - nsVoidKey newKey (NS_STATIC_CAST(void *, aCard)) ;
2379 + nsCString uri ;
2381 + ExtractUriFromCard(aCard, uri) ;
2382 + nsCStringKey newKey(uri) ;
2383 nsresult retCode = NS_OK ;
2385 mCardList.Put(&newKey, aCard) ;
2386 @@ -1051,14 +1116,14 @@
2387 retCode = BuildRestriction(aArguments, arguments) ;
2388 NS_ENSURE_SUCCESS(retCode, retCode) ;
2389 nsCOMPtr<nsISupportsArray> resultsArray ;
2390 + nsCStringArray uriArray ;
2391 PRUint32 nbResults = 0 ;
2393 - retCode = GetChildCards(getter_AddRefs(resultsArray),
2394 + retCode = GetChildCards(uriArray,
2395 arguments.rt == RES_COMMENT ? nsnull : &arguments) ;
2396 DestroyRestriction(arguments) ;
2397 NS_ENSURE_SUCCESS(retCode, retCode) ;
2398 - retCode = resultsArray->Count(&nbResults) ;
2399 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2400 + nbResults = uriArray.Count() ;
2401 nsCOMPtr<nsIAbDirectoryQueryResult> result ;
2402 nsAbDirectoryQueryResult *newResult = nsnull ;
2404 @@ -1066,15 +1131,18 @@
2405 nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ;
2407 PRUint32 i = 0 ;
2408 - nsCOMPtr<nsISupports> element ;
2409 nsCOMPtr<nsISupportsArray> propertyValues ;
2411 + nsCAutoString uriName;
2412 + nsCOMPtr <nsIAbCard> card;
2414 for (i = 0 ; i < nbResults ; ++ i) {
2415 - retCode = resultsArray->GetElementAt(i, getter_AddRefs(element)) ;
2416 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2417 - nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
2418 + PRBool isNewCard = PR_FALSE ;
2420 + uriArray.CStringAt(i,uriName);
2421 + retCode = BuildCardFromURI(uriName,getter_AddRefs(card), PR_FALSE, isNewCard);
2422 NS_ENSURE_SUCCESS(retCode, retCode) ;
2424 FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
2425 newResult = new nsAbDirectoryQueryResult(0, aArguments,
2426 nsIAbDirectoryQueryResult::queryResultMatch,
2427 @@ -1099,13 +1167,43 @@
2428 if (!aCards) { return NS_ERROR_NULL_POINTER ; }
2429 *aCards = nsnull ;
2430 nsresult retCode = NS_OK ;
2431 - nsCOMPtr<nsISupportsArray> cards ;
2433 + nsCOMPtr<nsISupportsArray> cards;
2434 + retCode = NS_NewISupportsArray(getter_AddRefs(cards));
2435 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2437 + nsCStringArray uriList;
2438 + retCode = GetChildCards(uriList,aRestriction);
2439 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2441 + nsCAutoString uriName;
2442 + nsCOMPtr <nsIAbCard> childCard;
2443 + PRUint32 nbURIs = 0 ;
2444 + nbURIs = uriList.Count();
2445 + PRUint32 i = 0 ;
2447 + for (i = 0 ; i < nbURIs ; ++ i) {
2448 + PRBool isNewCard = PR_FALSE ;
2450 + uriList.CStringAt(i,uriName);
2451 + retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), PR_TRUE, isNewCard);
2452 + NS_ENSURE_SUCCESS(retCode, retCode) ;
2453 + cards->AppendElement(childCard);
2454 + }
2456 + NS_IF_ADDREF(*aCards = cards);
2457 + return retCode ;
2460 +nsresult nsAbOutlookDirectory::GetChildCards(nsCStringArray& aURI,
2461 + void *aRestriction)
2463 + nsresult retCode = NS_OK ;
2464 nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
2465 nsMapiEntryArray cardEntries ;
2466 LPSRestriction restriction = (LPSRestriction) aRestriction ;
2468 if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
2469 - retCode = NS_NewISupportsArray(getter_AddRefs(cards)) ;
2470 NS_ENSURE_SUCCESS(retCode, retCode) ;
2471 if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
2472 PRINTF(("Cannot get cards.\n")) ;
2473 @@ -1114,22 +1212,14 @@
2474 nsCAutoString entryId ;
2475 nsCAutoString uriName ;
2476 nsCOMPtr<nsIRDFResource> resource ;
2477 - nsCOMPtr <nsIAbCard> childCard;
2479 - for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) {
2480 - cardEntries.mEntries [card].ToString(entryId) ;
2481 + aURI.Clear();
2483 + for (ULONG card = 0 ; card < cardEntries.GetSize() ; ++ card) {
2484 + cardEntries [card].ToString(entryId) ;
2485 buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ;
2486 uriName.Append(entryId) ;
2487 - childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
2488 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2489 - resource = do_QueryInterface(childCard, &retCode) ;
2490 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2491 - retCode = resource->Init(uriName.get()) ;
2492 - NS_ENSURE_SUCCESS(retCode, retCode) ;
2493 - cards->AppendElement(childCard) ;
2494 + aURI.AppendCString(uriName);
2496 - *aCards = cards ;
2497 - NS_ADDREF(*aCards) ;
2498 return retCode ;
2501 @@ -1153,8 +1243,8 @@
2502 nsCAutoString uriName ;
2503 nsCOMPtr <nsIRDFResource> resource ;
2505 - for (ULONG node = 0 ; node < nodeEntries.mNbEntries ; ++ node) {
2506 - nodeEntries.mEntries [node].ToString(entryId) ;
2507 + for (ULONG node = 0 ; node < nodeEntries.GetSize() ; ++ node) {
2508 + nodeEntries [node].ToString(entryId) ;
2509 buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
2510 uriName.Append(entryId) ;
2511 retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ;
2512 @@ -1275,7 +1365,7 @@
2513 // In the case of a mailing list, we cannot directly create a new card,
2514 // we have to create a temporary one in a real folder (to be able to use
2515 // templates) and then copy it to the mailing list.
2516 - if (m_IsMailList) {
2517 + if (m_IsMailList && mAbWinType == nsAbWinType_OutlookExp) {
2518 nsMapiEntry parentEntry ;
2519 nsMapiEntry temporaryEntry ;
2521 --- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2004-04-17 20:32:14.000000000 +0200
2522 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h 2008-08-14 16:22:21.000000000 +0200
2523 @@ -46,6 +46,7 @@
2524 #include "nsHashtable.h"
2526 #include "nsISupportsArray.h"
2527 +#include "nsVoidArray.h"
2529 struct nsMapiEntry ;
2531 @@ -92,6 +93,8 @@
2532 protected:
2533 // Retrieve hierarchy as cards, with an optional restriction
2534 nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ;
2535 + // Retrieve hierarchy as URIs, with an optional restriction
2536 + nsresult GetChildCards(nsCStringArray& aURI, void *aRestriction) ;
2537 // Retrieve hierarchy as directories
2538 nsresult GetChildNodes(nsISupportsArray **aNodes) ;
2539 // Create a new card
2540 @@ -103,6 +106,9 @@
2541 nsresult CommitAddressList(void) ;
2542 // Read MAPI repository
2543 nsresult UpdateAddressList(void) ;
2544 + // Search for an existing card or build a new one
2545 + nsresult BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard,
2546 + PRBool aSearchForOld, PRBool& aIsNewCard) ;
2548 nsMapiEntry *mMapiData ;
2549 // Container for the query threads
2550 --- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2005-05-07 08:11:28.000000000 +0200
2551 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp 2008-08-14 16:22:21.000000000 +0200
2552 @@ -42,6 +42,9 @@
2553 #define USES_IID_IABContainer
2554 #define USES_IID_IMAPITable
2555 #define USES_IID_IDistList
2556 +#define USES_IID_IMsgStore
2557 +#define USES_IID_IMessage
2558 +#define USES_IID_IMAPIFolder
2560 #include "nsAbWinHelper.h"
2561 #include "nsMapiAddressBook.h"
2562 @@ -59,19 +62,6 @@
2564 #define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
2566 -// Small utility to ensure release of all MAPI interfaces
2567 -template <class tInterface> struct nsMapiInterfaceWrapper
2569 - tInterface mInterface ;
2571 - nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
2572 - ~nsMapiInterfaceWrapper(void) {
2573 - if (mInterface != NULL) { mInterface->Release() ; }
2575 - operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
2576 - tInterface operator -> (void) const { return mInterface ; }
2577 - operator tInterface *(void) { return &mInterface ; }
2578 -} ;
2580 static void assignEntryID(LPENTRYID& aTarget, LPENTRYID aSource, ULONG aByteCount)
2582 @@ -249,24 +239,28 @@
2583 MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray)
2585 nsMapiEntryArray::nsMapiEntryArray(void)
2586 -: mEntries(NULL), mNbEntries(0)
2588 MOZ_COUNT_CTOR(nsMapiEntryArray) ;
2591 nsMapiEntryArray::~nsMapiEntryArray(void)
2593 - if (mEntries) { delete [] mEntries ; }
2594 + CleanUp();
2595 MOZ_COUNT_DTOR(nsMapiEntryArray) ;
2598 +void nsMapiEntryArray::AddItem(nsMapiEntry * aEntries)
2600 + m_array.AppendElement(aEntries);
2602 void nsMapiEntryArray::CleanUp(void)
2604 - if (mEntries != NULL) {
2605 - delete [] mEntries ;
2606 - mEntries = NULL ;
2607 - mNbEntries = 0 ;
2608 + nsMapiEntry *pEntries;
2609 + for (int i = 0; i < m_array.Count(); i++)
2611 + pEntries = (nsMapiEntry *)m_array.ElementAt( i);
2612 + delete pEntries;
2614 + m_array.Clear();
2617 MOZ_DECL_CTOR_COUNTER(nsAbWinHelper)
2618 @@ -280,100 +274,55 @@
2619 // same protection (MAPI is supposed to be thread-safe).
2620 PRLock *nsAbWinHelper::mMutex = PR_NewLock() ;
2622 +int nsAbWinHelper::m_clients = 0;
2624 +PRUnichar * nsAbWinHelper::m_pUniBuff = NULL;
2625 +int nsAbWinHelper::m_uniBuffLen = 0;
2626 +char * nsAbWinHelper::m_pCStrBuff = NULL;
2627 +int nsAbWinHelper::m_cstrBuffLen = 0;
2629 nsAbWinHelper::nsAbWinHelper(void)
2630 -: mAddressBook(NULL), mLastError(S_OK)
2631 +:mLastError(S_OK)
2633 MOZ_COUNT_CTOR(nsAbWinHelper) ;
2634 + m_clients++;
2637 nsAbWinHelper::~nsAbWinHelper(void)
2639 MOZ_COUNT_DTOR(nsAbWinHelper) ;
2642 -BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders)
2643 + m_clients--;
2644 + if (!m_clients)
2646 - aFolders.CleanUp() ;
2647 - nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
2648 - nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
2649 - ULONG objType = 0 ;
2650 - ULONG rowCount = 0 ;
2651 - SRestriction restriction ;
2652 - SPropTagArray folderColumns ;
2654 - mLastError = mAddressBook->OpenEntry(0, NULL, NULL, 0, &objType,
2655 - rootFolder) ;
2656 - if (HR_FAILED(mLastError)) {
2657 - PRINTF(("Cannot open root %08x.\n", mLastError)) ;
2658 - return FALSE ;
2659 + delete [] m_pUniBuff;
2660 + m_pUniBuff = NULL;
2661 + m_uniBuffLen = 0;
2662 + delete [] m_pCStrBuff;
2663 + m_pCStrBuff = NULL;
2664 + m_cstrBuffLen = 0;
2666 - mLastError = rootFolder->GetHierarchyTable(0, folders) ;
2667 - if (HR_FAILED(mLastError)) {
2668 - PRINTF(("Cannot get hierarchy %08x.\n", mLastError)) ;
2669 - return FALSE ;
2671 - // We only take into account modifiable containers,
2672 - // otherwise, we end up with all the directory services...
2673 - restriction.rt = RES_BITMASK ;
2674 - restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
2675 - restriction.res.resBitMask.relBMR = BMR_NEZ ;
2676 - restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
2677 - mLastError = folders->Restrict(&restriction, 0) ;
2678 - if (HR_FAILED(mLastError)) {
2679 - PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
2681 - folderColumns.cValues = 1 ;
2682 - folderColumns.aulPropTag [0] = PR_ENTRYID ;
2683 - mLastError = folders->SetColumns(&folderColumns, 0) ;
2684 - if (HR_FAILED(mLastError)) {
2685 - PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
2686 - return FALSE ;
2688 - mLastError = folders->GetRowCount(0, &rowCount) ;
2689 - if (HR_SUCCEEDED(mLastError)) {
2690 - aFolders.mEntries = new nsMapiEntry [rowCount] ;
2691 - aFolders.mNbEntries = 0 ;
2692 - do {
2693 - LPSRowSet rowSet = NULL ;
2695 - rowCount = 0 ;
2696 - mLastError = folders->QueryRows(1, 0, &rowSet) ;
2697 - if (HR_SUCCEEDED(mLastError)) {
2698 - rowCount = rowSet->cRows ;
2699 - if (rowCount > 0) {
2700 - nsMapiEntry& current = aFolders.mEntries [aFolders.mNbEntries ++] ;
2701 - SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
2703 - current.Assign(currentValue.Value.bin.cb,
2704 - NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
2706 - MyFreeProws(rowSet) ;
2708 - else {
2709 - PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
2711 - } while (rowCount > 0) ;
2713 - return HR_SUCCEEDED(mLastError) ;
2717 BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
2718 nsMapiEntryArray& aCards)
2720 aCards.CleanUp() ;
2721 - return GetContents(aParent, aRestriction, &aCards.mEntries, aCards.mNbEntries, 0) ;
2722 + return GetContents(aParent, aRestriction, &aCards, 0) ;
2725 BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes)
2727 aNodes.CleanUp() ;
2728 - return GetContents(aParent, NULL, &aNodes.mEntries, aNodes.mNbEntries, MAPI_DISTLIST) ;
2729 + return GetContents(aParent, NULL, &aNodes, MAPI_DISTLIST) ;
2732 BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards)
2734 - aNbCards = 0 ;
2735 - return GetContents(aParent, NULL, NULL, aNbCards, 0) ;
2736 + nsMapiEntryArray aCards;
2737 + BOOL ret=GetContents(aParent, NULL, &aCards, 0) ;
2738 + aNbCards=aCards.GetSize();
2739 + return ret;
2742 BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject,
2743 @@ -390,7 +339,7 @@
2744 aName = values->Value.lpszA ;
2746 else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) {
2747 - aName.AssignWithConversion(values->Value.lpszW) ;
2748 + UnicodeToCStr(values->Value.lpszW,aName) ;
2751 FreeBuffer(values) ;
2752 @@ -410,7 +359,7 @@
2753 aName = values->Value.lpszW ;
2755 else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) {
2756 - aName.AssignWithConversion(values->Value.lpszA) ;
2757 + CStrToUnicode(values->Value.lpszA,aName) ;
2760 FreeBuffer(values) ;
2761 @@ -431,16 +380,22 @@
2762 ULONG i = 0 ;
2764 for (i = 0 ; i < valueCount ; ++ i) {
2765 - if (PROP_ID(values [i].ulPropTag) == PROP_ID(aPropertyTags [i])) {
2766 + if (PROP_TYPE( values [i].ulPropTag) != PT_ERROR && values [i].Value.l != MAPI_E_NOT_FOUND){
2767 if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) {
2768 nsAutoString temp ;
2770 - temp.AssignWithConversion (values [i].Value.lpszA) ;
2771 + CStrToUnicode(values [i].Value.lpszA,temp) ;
2772 aNames.AppendString(temp) ;
2774 else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) {
2775 aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ;
2777 + else if (aPropertyTags [i] == PR_EMAIL_ADDRESS_A) {
2778 + nsAutoString temp ;
2780 + CStrToUnicode (values [i].Value.lpszA,temp) ;
2781 + aNames.AppendString(temp) ;
2783 else {
2784 aNames.AppendString(nsAutoString((const PRUnichar *) "")) ;
2786 @@ -466,7 +421,6 @@
2787 if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) { return FALSE ; }
2788 if (valueCount == 1 && values != NULL && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
2789 SYSTEMTIME readableTime ;
2791 if (FileTimeToSystemTime(&values->Value.ft, &readableTime)) {
2792 aYear = readableTime.wYear ;
2793 aMonth = readableTime.wMonth ;
2794 @@ -518,7 +472,7 @@
2795 nsMapiInterfaceWrapper<LPMAPIPROP> subObject ;
2796 ULONG objType = 0 ;
2798 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2799 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2800 &IID_IMAPIContainer, 0, &objType,
2801 container) ;
2802 if (HR_FAILED(mLastError)) {
2803 @@ -537,7 +491,7 @@
2804 SBinary entry ;
2805 SBinaryArray entryArray ;
2807 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2808 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2809 &IID_IABContainer, MAPI_MODIFY, &objType,
2810 container) ;
2811 if (HR_FAILED(mLastError)) {
2812 @@ -567,14 +521,15 @@
2813 value.Value.lpszW = NS_CONST_CAST(WCHAR *, aValue) ;
2815 else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
2816 - alternativeValue.AssignWithConversion(aValue) ;
2817 + UnicodeToCStr(aValue,alternativeValue) ;
2818 value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ;
2820 else {
2821 PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ;
2822 return TRUE ;
2824 - return SetMAPIProperties(aObject, 1, &value) ;
2825 + LPSPropValue values=&value;
2826 + return SetMAPIProperties(aObject, 1, values) ;
2829 BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
2830 @@ -595,7 +550,7 @@
2831 values [currentValue ++].Value.lpszW = NS_CONST_CAST(WCHAR *, aValues [i].get()) ;
2833 else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
2834 - alternativeValue.AssignWithConversion(aValues [i].get()) ;
2835 + UnicodeToCStr(aValues [i].get(),alternativeValue) ;
2836 char *av = nsCRT::strdup(alternativeValue.get()) ;
2837 if (!av) {
2838 retCode = FALSE ;
2839 @@ -633,7 +588,8 @@
2840 readableTime.wSecond = 0 ;
2841 readableTime.wMilliseconds = 0 ;
2842 if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) {
2843 - return SetMAPIProperties(aObject, 1, &value) ;
2844 + LPSPropValue values=&value;
2845 + return SetMAPIProperties(aObject, 1, values) ;
2847 return TRUE ;
2849 @@ -645,7 +601,7 @@
2850 nsMapiInterfaceWrapper<LPABCONT> container ;
2851 ULONG objType = 0 ;
2853 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
2854 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
2855 &IID_IABContainer, MAPI_MODIFY, &objType,
2856 container) ;
2857 if (HR_FAILED(mLastError)) {
2858 @@ -708,7 +664,7 @@
2859 nsMapiInterfaceWrapper<LPABCONT> container ;
2860 ULONG objType = 0 ;
2862 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
2863 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
2864 &IID_IABContainer, MAPI_MODIFY, &objType,
2865 container) ;
2866 if (HR_FAILED(mLastError)) {
2867 @@ -773,7 +729,7 @@
2868 nsMapiInterfaceWrapper<LPABCONT> container ;
2869 ULONG objType = 0 ;
2871 - mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2872 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
2873 &IID_IABContainer, MAPI_MODIFY, &objType,
2874 container) ;
2875 if (HR_FAILED(mLastError)) {
2876 @@ -810,194 +766,77 @@
2877 return TRUE ;
2880 -BOOL nsAbWinHelper::GetDefaultContainer(nsMapiEntry& aContainer)
2882 - LPENTRYID entryId = NULL ;
2883 - ULONG byteCount = 0 ;
2885 - mLastError = mAddressBook->GetPAB(&byteCount, &entryId) ;
2886 - if (HR_FAILED(mLastError)) {
2887 - PRINTF(("Cannot get PAB %08x.\n", mLastError)) ;
2888 - return FALSE ;
2890 - aContainer.Assign(byteCount, entryId) ;
2891 - FreeBuffer(entryId) ;
2892 - return TRUE ;
2895 -enum
2897 - ContentsColumnEntryId = 0,
2898 - ContentsColumnObjectType,
2899 - ContentsColumnsSize
2900 -} ;
2902 -static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
2904 - ContentsColumnsSize,
2906 - PR_ENTRYID,
2907 - PR_OBJECT_TYPE
2909 -} ;
2911 -BOOL nsAbWinHelper::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
2912 - nsMapiEntry **aList, ULONG& aNbElements, ULONG aMapiType)
2913 +void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
2915 - if (aList != NULL) { *aList = NULL ; }
2916 - aNbElements = 0 ;
2917 - nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
2918 - nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
2919 - ULONG objType = 0 ;
2920 - ULONG rowCount = 0 ;
2921 + if (aRowset == NULL) { return ; }
2922 + ULONG i = 0 ;
2924 - mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
2925 - &IID_IMAPIContainer, 0, &objType,
2926 - parent) ;
2927 - if (HR_FAILED(mLastError)) {
2928 - PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
2929 - return FALSE ;
2931 - // Here, flags for WAB and MAPI could be different, so this works
2932 - // only as long as we don't want to use any flag in GetContentsTable
2933 - mLastError = parent->GetContentsTable(0, contents) ;
2934 - if (HR_FAILED(mLastError)) {
2935 - PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
2936 - return FALSE ;
2937 + for (i = 0 ; i < aRowset->cRows ; ++ i) {
2938 + FreeBuffer(aRowset->aRow [i].lpProps) ;
2940 - if (aRestriction != NULL) {
2941 - mLastError = contents->Restrict(aRestriction, 0) ;
2942 - if (HR_FAILED(mLastError)) {
2943 - PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
2944 - return FALSE ;
2947 - mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
2948 - if (HR_FAILED(mLastError)) {
2949 - PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
2950 - return FALSE ;
2952 - mLastError = contents->GetRowCount(0, &rowCount) ;
2953 - if (HR_FAILED(mLastError)) {
2954 - PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
2955 - return FALSE ;
2957 - if (aList != NULL) { *aList = new nsMapiEntry [rowCount] ; }
2958 - aNbElements = 0 ;
2959 - do {
2960 - LPSRowSet rowSet = NULL ;
2962 - rowCount = 0 ;
2963 - mLastError = contents->QueryRows(1, 0, &rowSet) ;
2964 - if (HR_FAILED(mLastError)) {
2965 - PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
2966 - return FALSE ;
2968 - rowCount = rowSet->cRows ;
2969 - if (rowCount > 0 &&
2970 - (aMapiType == 0 ||
2971 - rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)) {
2972 - if (aList != NULL) {
2973 - nsMapiEntry& current = (*aList) [aNbElements] ;
2974 - SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
2976 - current.Assign(currentValue.Value.bin.cb,
2977 - NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
2978 + FreeBuffer(aRowset) ;
2980 +void nsAbWinHelper::CStrToUnicode( const char *pStr, nsString& result)
2982 + result.Truncate( 0);
2983 + int wLen = MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, 0);
2984 + if (wLen >= m_uniBuffLen)
2986 + delete [] m_pUniBuff;
2987 + m_pUniBuff = new PRUnichar[wLen + 64];
2988 + m_uniBuffLen = wLen + 64;
2990 - ++ aNbElements ;
2991 + if (wLen)
2993 + MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, m_uniBuffLen);
2994 + result = m_pUniBuff;
2996 - MyFreeProws(rowSet) ;
2997 - } while (rowCount > 0) ;
2998 - return TRUE ;
3001 -BOOL nsAbWinHelper::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3002 - ULONG aNbProperties, LPSPropValue& aValue,
3003 - ULONG& aValueCount)
3004 +void nsAbWinHelper::UnicodeToCStr( const PRUnichar *pUStr,nsCString& result)
3006 - nsMapiInterfaceWrapper<LPMAPIPROP> object ;
3007 - ULONG objType = 0 ;
3008 - LPSPropTagArray properties = NULL ;
3009 - ULONG i = 0 ;
3011 - mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
3012 - &IID_IMAPIProp, 0, &objType,
3013 - object) ;
3014 - if (HR_FAILED(mLastError)) {
3015 - PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
3016 - return FALSE ;
3017 + result.Truncate( 0);
3018 + int cLen = WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, 0,NULL,NULL);
3019 + if (cLen >= m_cstrBuffLen) {
3020 + if (m_pCStrBuff)
3021 + delete [] m_pCStrBuff;
3022 + m_pCStrBuff = new char[cLen + 64];
3023 + m_cstrBuffLen = cLen + 64;
3025 - AllocateBuffer(CbNewSPropTagArray(aNbProperties),
3026 - NS_REINTERPRET_CAST(void **, &properties)) ;
3027 - properties->cValues = aNbProperties ;
3028 - for (i = 0 ; i < aNbProperties ; ++ i) {
3029 - properties->aulPropTag [i] = aPropertyTags [i] ;
3031 - mLastError = object->GetProps(properties, 0, &aValueCount, &aValue) ;
3032 - FreeBuffer(properties) ;
3033 - if (HR_FAILED(mLastError)) {
3034 - PRINTF(("Cannot get props %08x.\n", mLastError)) ;
3035 + if (cLen) {
3036 + WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, m_cstrBuffLen,NULL,NULL);
3037 + result = m_pCStrBuff;
3039 - return HR_SUCCEEDED(mLastError) ;
3042 -BOOL nsAbWinHelper::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3043 - const LPSPropValue& aValues)
3045 - nsMapiInterfaceWrapper<LPMAPIPROP> object ;
3046 - ULONG objType = 0 ;
3047 - LPSPropProblemArray problems = NULL ;
3048 +static nsAbWinHelper *getOutlookAddressBook(void) {
3049 + static nsMapiAddressBook *addressBook = NULL ;
3051 - mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
3052 - &IID_IMAPIProp, MAPI_MODIFY, &objType,
3053 - object) ;
3054 - if (HR_FAILED(mLastError)) {
3055 - PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
3056 - return FALSE ;
3058 - mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
3059 - if (HR_FAILED(mLastError)) {
3060 - PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
3061 - return FALSE ;
3063 - if (problems != NULL) {
3064 - for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
3065 - PRINTF(("Problem %d: index %d code %08x.\n", i,
3066 - problems->aProblem [i].ulIndex,
3067 - problems->aProblem [i].scode)) ;
3070 - mLastError = object->SaveChanges(0) ;
3071 - if (HR_FAILED(mLastError)) {
3072 - PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
3074 - return HR_SUCCEEDED(mLastError) ;
3075 + if (addressBook == NULL) { addressBook = new nsMapiAddressBook ; }
3076 + return addressBook ;
3079 -void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
3081 - if (aRowset == NULL) { return ; }
3082 - ULONG i = 0 ;
3083 +static nsAbWinHelper *getOutlookExpAddressBook(void) {
3084 + static nsWabAddressBook *addressBook = NULL ;
3086 - for (i = 0 ; i < aRowset->cRows ; ++ i) {
3087 - FreeBuffer(aRowset->aRow [i].lpProps) ;
3089 - FreeBuffer(aRowset) ;
3090 + if (addressBook == NULL) { addressBook = new nsWabAddressBook ; }
3091 + return addressBook ;
3094 nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType)
3095 : mHelper(NULL)
3097 switch(aType) {
3098 - case nsAbWinType_Outlook: mHelper = new nsMapiAddressBook ; break ;
3099 - case nsAbWinType_OutlookExp: mHelper = new nsWabAddressBook ; break ;
3100 + case nsAbWinType_Outlook: mHelper = getOutlookAddressBook() ; break ;
3101 + case nsAbWinType_OutlookExp: mHelper = getOutlookExpAddressBook() ; break ;
3102 default: break ;
3106 nsAbWinHelperGuard::~nsAbWinHelperGuard(void)
3108 - delete mHelper ;
3111 const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
3112 --- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2004-04-17 20:32:14.000000000 +0200
3113 +++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h 2008-08-14 16:22:21.000000000 +0200
3114 @@ -45,6 +45,24 @@
3115 #include "nsVoidArray.h"
3116 #include "nsXPIDLString.h"
3118 +#define PR_SECOND_EMAIL_ADDRESS_A 0x8033001E
3119 +#define PR_SCREEN_NAME_A 0x805B001E
3122 +// Small utility to ensure release of all MAPI interfaces
3123 +template <class tInterface> struct nsMapiInterfaceWrapper
3125 + tInterface mInterface ;
3127 + nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
3128 + ~nsMapiInterfaceWrapper(void) {
3129 + if (mInterface ) { mInterface->Release() ; }
3131 + operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
3132 + tInterface operator -> (void) const { return mInterface ; }
3133 + operator tInterface *(void) { return &mInterface ; }
3134 +} ;
3136 struct nsMapiEntry
3138 ULONG mByteCount ;
3139 @@ -62,14 +80,28 @@
3141 struct nsMapiEntryArray
3143 - nsMapiEntry *mEntries ;
3144 - ULONG mNbEntries ;
3146 nsMapiEntryArray(void) ;
3147 ~nsMapiEntryArray(void) ;
3149 - const nsMapiEntry& operator [] (int aIndex) const { return mEntries [aIndex] ; }
3150 + void AddItem(nsMapiEntry * aEntries);
3151 + void AddItem( ULONG mByteCount , LPENTRYID mEntryId )
3153 + nsMapiEntry * aEntries=new nsMapiEntry();
3154 + aEntries->Assign(mByteCount,mEntryId);
3155 + AddItem(aEntries);
3158 + ULONG GetSize( void) { return( m_array.Count());}
3159 + nsMapiEntry& operator [] (int aIndex) { return *(nsMapiEntry*)m_array.ElementAt(aIndex); }
3160 + nsMapiEntry* ElementAt(int aIndex) { return (nsMapiEntry*)m_array.ElementAt(aIndex); }
3161 void CleanUp(void) ;
3162 + void Remove(nsMapiEntry * aEntries){ m_array.RemoveElement(aEntries); }
3163 + void Remove(int index){ m_array.RemoveElementAt(index); }
3164 + ULONG IndexOf(nsMapiEntry * aEntries){return m_array.IndexOf(aEntries);};
3165 +private:
3166 + nsVoidArray m_array;
3170 class nsAbWinHelper
3171 @@ -79,7 +111,7 @@
3172 virtual ~nsAbWinHelper(void) ;
3174 // Get the top address books
3175 - BOOL GetFolders(nsMapiEntryArray& aFolders) ;
3176 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders) =0;
3177 // Get a list of entries for cards/mailing lists in a folder/mailing list
3178 BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3179 nsMapiEntryArray& aCards) ;
3180 @@ -97,18 +129,14 @@
3181 BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3182 ULONG aNbProperties, nsStringArray& aValues) ;
3183 // Get the value of a MAPI property of type SYSTIME
3184 - BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3185 + virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3186 WORD& aYear, WORD& aMonth, WORD& aDay) ;
3187 - // Get the value of a MAPI property of type LONG
3188 - BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
3189 // Get the value of a MAPI property of type BIN
3190 BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ;
3191 // Tests if a container contains an entry
3192 BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3193 - // Delete an entry in the address book
3194 - BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3195 // Set the value of a MAPI property of type string in unicode
3196 - BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
3197 + virtual BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag,
3198 const PRUnichar *aValue) ;
3199 // Same as previous, but with a bunch of properties in one call
3200 BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
3201 @@ -117,32 +145,44 @@
3202 BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
3203 WORD aYear, WORD aMonth, WORD aDay) ;
3204 // Create entry in the address book
3205 - BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3206 + virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3207 + // Delete an entry in the address book
3208 + virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
3209 // Create a distribution list in the address book
3210 - BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3211 + virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
3212 // Copy an existing entry in the address book
3213 - BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
3214 + virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
3215 // Get a default address book container
3216 - BOOL GetDefaultContainer(nsMapiEntry& aContainer) ;
3217 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer) =0;
3218 // Is the helper correctly initialised?
3219 - BOOL IsOK(void) const { return mAddressBook != NULL ; }
3220 + virtual BOOL IsOK(void) =0;/*const { return mAddressBook != NULL ; }*/
3222 + // Get the value of a MAPI property of type LONG
3223 + virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
3225 protected:
3226 HRESULT mLastError ;
3227 - LPADRBOOK mAddressBook ;
3228 static PRUint32 mEntryCounter ;
3229 static PRLock *mMutex ;
3231 + virtual HRESULT OpenEntry(ULONG cbEntryID,
3232 + LPENTRYID lpEntryID,
3233 + LPCIID lpInterface,
3234 + ULONG ulFlags,
3235 + ULONG FAR * lpulObjType,
3236 + LPUNKNOWN FAR * lppUnk
3237 + ) = 0;
3239 // Retrieve the contents of a container, with an optional restriction
3240 - BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3241 - nsMapiEntry **aList, ULONG &aNbElements, ULONG aMapiType) ;
3242 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
3243 + nsMapiEntryArray *aList, ULONG aMapiType) =0;
3244 // Retrieve the values of a set of properties on a MAPI object
3245 - BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3246 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
3247 ULONG aNbProperties,
3248 - LPSPropValue& aValues, ULONG& aValueCount) ;
3249 + LPSPropValue& aValues, ULONG& aValueCount) =0;
3250 // Set the values of a set of properties on a MAPI object
3251 - BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3252 - const LPSPropValue& aValues) ;
3253 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
3254 + LPSPropValue& aValues) =0;
3255 // Clean-up a rowset returned by QueryRows
3256 void MyFreeProws(LPSRowSet aSet) ;
3257 // Allocation of a buffer for transmission to interfaces
3258 @@ -150,7 +190,16 @@
3259 // Destruction of a buffer provided by the interfaces
3260 virtual void FreeBuffer(LPVOID aBuffer) = 0 ;
3262 + static void CStrToUnicode( const char *pStr, nsString& result);
3263 + static void UnicodeToCStr( const PRUnichar *pStr, nsCString& result);
3265 private:
3266 + static int m_clients;
3267 + static PRUnichar * m_pUniBuff;
3268 + static int m_uniBuffLen;
3269 + static char * m_pCStrBuff;
3270 + static int m_cstrBuffLen;
3274 enum nsAbWinType
3275 @@ -168,6 +217,7 @@
3277 nsAbWinHelper *operator ->(void) { return mHelper ; }
3279 + static void FreeWinAbLibrarys();
3280 private:
3281 nsAbWinHelper *mHelper ;
3283 --- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2006-12-22 14:51:39.000000000 +0100
3284 +++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp 2008-08-20 15:09:45.000000000 +0200
3285 @@ -100,6 +100,9 @@
3287 static const char kMailListAddressFormat[] = "Address%d";
3289 +extern int getMD5sum(const char * fileName,char * sum);
3290 +extern int testMD5sum(const char * fileName,char * sum);
3292 static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
3294 nsAddrDatabase::nsAddrDatabase()
3295 @@ -171,6 +174,7 @@
3296 m_LastRecordKey(0),
3297 m_dbDirectory(nsnull)
3299 + memset(m_dbMd5Sum,0,33);
3302 nsAddrDatabase::~nsAddrDatabase()
3303 @@ -790,7 +794,11 @@
3304 if (NS_FAILED(ret))
3305 ret = NS_ERROR_FILE_ACCESS_DENIED;
3309 + ret = getMD5sum(nativeFileName,m_dbMd5Sum);
3310 + if (ret == 1)
3311 + ret = NS_ERROR_FAILURE;
3313 nsCRT::free(nativeFileName);
3315 if (NS_SUCCEEDED(ret) && thumb)
3316 @@ -883,6 +891,17 @@
3318 nsresult err = NS_OK;
3319 nsIMdbThumb *commitThumb = nsnull;
3321 + const char *pFilename = m_dbName.GetCString(); /* do not free */
3322 + char *nativeFileName = nsCRT::strdup(pFilename);
3323 +#if defined(XP_PC) || defined(XP_MAC)
3324 + UnixToNative(nativeFileName);
3325 +#endif
3326 + if (testMD5sum(nativeFileName,m_dbMd5Sum))
3328 + nsCRT::free(nativeFileName);
3329 + return NS_ERROR_FILE_ACCESS_DENIED;
3332 if (commitType == nsAddrDBCommitType::kLargeCommit ||
3333 commitType == nsAddrDBCommitType::kSessionCommit)
3334 @@ -936,6 +955,10 @@
3335 // ### do something with error, but clear it now because mork errors out on commits.
3336 if (m_mdbEnv)
3337 m_mdbEnv->ClearErrors();
3338 + if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum))
3339 + err = NS_ERROR_FAILURE;
3340 + nsCRT::free(nativeFileName);
3342 return err;
3345 --- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2006-12-22 14:51:39.000000000 +0100
3346 +++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h 2008-08-14 16:29:20.000000000 +0200
3347 @@ -394,6 +394,7 @@
3348 nsIMdbTable *m_mdbPabTable;
3349 nsIMdbTable *m_mdbDeletedCardsTable;
3350 nsFileSpec m_dbName;
3351 + char m_dbMd5Sum[33];
3352 PRBool m_mdbTokensInitialized;
3353 nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners;
3355 --- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
3356 +++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
3357 @@ -40,6 +40,22 @@
3359 #include "prlog.h"
3361 +static char * stristr(const char *big, const char *little)
3363 + PRUint32 len;
3365 + if (!big || !little || !*big || !*little)
3366 + return 0;
3367 + len = strlen(little);
3369 + for( ; *big; big++ )
3370 + if(!_strnicmp (big, little, 1) && ! _strnicmp (big, little, len) )
3371 + return (char *)big;
3373 + return (char *)0;
3377 #ifdef PR_LOGGING
3378 static PRLogModuleInfo* gMapiAddressBookLog
3379 = PR_NewLogModule("nsMapiAddressBookLog");
3380 @@ -47,6 +63,60 @@
3382 #define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
3384 +#define OUTLOOK_EMAIL_DIAPLAY_MAPI_ID 0x00008005 //use to get and set display
3385 +#define OUTLOOK_EMAIL1_MAPI_ID 0x00008084 //use to get and set primary email address
3386 +#define OUTLOOK_EMAIL2_MAPI_ID 0x00008094 //use to get and set second email address
3387 +#define OUTLOOK_EMAIL_SCREEN_NAME 0x8061001E //use to get and set screen name
3388 +#define OUTLOOK_EMAIL_ORGID 0x00008085 //use to get orginal entryid to add to distlist
3389 +#define OUTLOOK_EMAIL_LIST1 0x00008054 //use to get distlist table
3390 +#define OUTLOOK_EMAIL_LIST2 0x00008055 //use to set distlist table
3392 +static const TagMap TagMaps[]={
3393 + {PR_DISPLAY_NAME_A, OUTLOOK_EMAIL_DIAPLAY_MAPI_ID, PT_STRING8},
3394 + {PR_EMAIL_ADDRESS_A, OUTLOOK_EMAIL1_MAPI_ID, PT_STRING8},
3395 + {PR_SECOND_EMAIL_ADDRESS_A, OUTLOOK_EMAIL2_MAPI_ID, PT_STRING8},
3396 + {PR_SCREEN_NAME_A, OUTLOOK_EMAIL_SCREEN_NAME, PT_STRING8}};
3398 +enum {
3399 + ieidPR_ENTRYID = 0,
3400 + ieidPR_OBJECT_TYPE,
3401 + ieidPR_DISPLAY_NAME,
3402 + ieidPR_MESSAGE_CLASS,
3403 + ieidPR_STORE_ENTRYID,
3404 + ieidPR_MESSAGE_RECIPIENTS,
3405 + ieidMax
3408 +static const SizedSPropTagArray(ieidMax, ptaEid)=
3410 + ieidMax,
3412 + PR_ENTRYID,
3413 + PR_OBJECT_TYPE,
3414 + PR_DISPLAY_NAME,
3415 + PR_MESSAGE_CLASS,
3416 + PR_STORE_ENTRYID,
3417 + PR_MESSAGE_RECIPIENTS
3421 +enum
3423 + ContentsColumnEntryId = 0,
3424 + ContentsColumnObjectType,
3425 + ContentsColumnMessageClass,
3426 + ContentsColumnsSize
3427 +} ;
3429 +static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
3431 + ContentsColumnsSize,
3433 + PR_ENTRYID,
3434 + PR_OBJECT_TYPE,
3435 + PR_MESSAGE_CLASS
3437 +} ;
3439 HMODULE nsMapiAddressBook::mLibrary = NULL ;
3440 PRInt32 nsMapiAddressBook::mLibUsage = 0 ;
3441 @@ -59,7 +129,7 @@
3442 BOOL nsMapiAddressBook::mInitialized = FALSE ;
3443 BOOL nsMapiAddressBook::mLogonDone = FALSE ;
3444 LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
3445 -LPADRBOOK nsMapiAddressBook::mRootBook = NULL ;
3446 +#define MAPI_NO_COINIT 8
3448 BOOL nsMapiAddressBook::LoadMapiLibrary(void)
3450 @@ -91,7 +161,7 @@
3451 mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX,
3452 GetProcAddress(mLibrary, "MAPILogonEx")) ;
3453 if (!mMAPILogonEx) { return FALSE ; }
3454 - MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS } ;
3455 + MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT } ;
3456 HRESULT retCode = mMAPIInitialize(&mapiInit) ;
3458 if (HR_FAILED(retCode)) {
3459 @@ -105,22 +175,19 @@
3460 MAPI_NEW_SESSION,
3461 &mRootSession) ;
3462 if (HR_FAILED(retCode)) {
3463 - PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; return FALSE ;
3464 + PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ;
3465 + return FALSE ;
3467 mLogonDone = TRUE ;
3468 - retCode = mRootSession->OpenAddressBook(0, NULL, 0, &mRootBook) ;
3469 - if (HR_FAILED(retCode)) {
3470 - PRINTF(("Cannot open MAPI address book %08x.\n", retCode)) ;
3473 return HR_SUCCEEDED(retCode) ;
3476 void nsMapiAddressBook::FreeMapiLibrary(void)
3478 if (mLibrary) {
3479 - if (-- mLibUsage == 0) {
3480 + if (--mLibUsage < 0) {
3482 - if (mRootBook) { mRootBook->Release() ; }
3483 if (mRootSession) {
3484 if (mLogonDone) {
3485 mRootSession->Logoff(NULL, 0, 0) ;
3486 @@ -134,6 +201,7 @@
3489 FreeLibrary(mLibrary) ;
3490 + mRootSession = NULL;
3491 mLibrary = NULL ;
3494 @@ -145,7 +213,6 @@
3495 : nsAbWinHelper()
3497 BOOL result = Initialize() ;
3499 NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ;
3500 MOZ_COUNT_CTOR(nsMapiAddressBook) ;
3502 @@ -153,22 +220,882 @@
3503 nsMapiAddressBook::~nsMapiAddressBook(void)
3505 nsAutoLock guard(mMutex) ;
3507 + CleanUpMDB();
3508 FreeMapiLibrary() ;
3509 MOZ_COUNT_DTOR(nsMapiAddressBook) ;
3512 +LPSPropValue nsMapiAddressBook::GetMapiProperty( LPMAPIPROP pProp, ULONG tag)
3514 + if (!pProp)
3515 + return( NULL);
3517 + int sz = CbNewSPropTagArray( 1);
3518 + SPropTagArray *pTag = (SPropTagArray *) new char[sz];
3519 + pTag->cValues = 1;
3520 + pTag->aulPropTag[0] = tag;
3521 + LPSPropValue lpProp = NULL;
3522 + ULONG cValues = 0;
3523 + HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp);
3524 + delete pTag;
3525 + if (HR_FAILED( hr) || (cValues != 1)) {
3526 + if (lpProp)
3527 + mMAPIFreeBuffer( lpProp);
3528 + return( NULL);
3530 + else {
3531 + if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) {
3532 + if (lpProp->Value.l == MAPI_E_NOT_FOUND) {
3533 + mMAPIFreeBuffer( lpProp);
3534 + lpProp = NULL;
3539 + return( lpProp);
3541 +BOOL nsMapiAddressBook::GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal)
3543 + if (!pVal)
3544 + return( FALSE);
3546 + BOOL bResult = TRUE;
3547 + switch (PROP_TYPE(pVal->ulPropTag))
3549 + case PT_BINARY:
3550 + cbEntryId = pVal->Value.bin.cb;
3551 + mMAPIAllocateBuffer( cbEntryId, (LPVOID *) &lpEntryId);
3552 + memcpy( lpEntryId, pVal->Value.bin.lpb, cbEntryId);
3553 + break;
3555 + default:
3556 + PRINTF(( "EntryId not in BINARY prop value\n"));
3557 + bResult = FALSE;
3558 + break;
3561 + if (pVal && delVal)
3562 + mMAPIFreeBuffer( pVal);
3564 + return( bResult);
3567 +BOOL nsMapiAddressBook::HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
3569 + LPMDB lpMsgStore;
3570 + ULONG objType=0;
3571 + HRESULT hr;
3573 + if (oType == MAPI_MESSAGE)
3574 + return FALSE;
3575 + if (oType == MAPI_STORE)
3577 + hr=mRootSession->OpenEntry(
3578 + cb,
3579 + pEntry,
3580 + &IID_IMsgStore,
3581 + MAPI_BEST_ACCESS,
3582 + &objType,
3583 + (IUnknown**)&lpMsgStore);
3584 + if (FAILED(hr))
3585 + return FALSE ;
3586 + //Add MDB to a list to make it can be released when class destroyed.
3587 + //We must leave it openned or else we can't open address store in it.
3588 + AddToMDBArray(lpMsgStore);
3590 + LPSPropValue pVal;
3591 + pVal=GetMapiProperty(lpMsgStore,PR_IPM_SUBTREE_ENTRYID);
3594 + if (pVal) {
3595 + ULONG cbEntry;
3596 + LPENTRYID pEntry;
3597 + nsMapiInterfaceWrapper<LPMAPICONTAINER> lpSubTree;
3599 + if (GetEntryIdFromProp( pVal, cbEntry, pEntry)) {
3600 + // Open up the folder!
3601 + BOOL bResult = TRUE;
3602 + bResult = lpMsgStore->OpenEntry(
3603 + cbEntry,
3604 + pEntry,
3605 + NULL,
3606 + MAPI_BEST_ACCESS,
3607 + &objType,
3608 + lpSubTree);
3609 + mMAPIFreeBuffer( pEntry);
3610 + if (!bResult && *(LPMAPICONTAINER*)&lpSubTree) {
3611 + // Iterate the subtree with the results going into the folder list
3612 + bResult = IterateHierarchy(*(LPMAPICONTAINER*)&lpSubTree,aFolders);
3614 + else {
3615 + PRINTF(( "GetStoreFolders: Error opening sub tree.\n"));
3618 + else {
3619 + PRINTF(( "GetStoreFolders: Error getting entryID from sub tree property val.\n"));
3622 + else {
3623 + PRINTF(( "GetStoreFolders: Error getting sub tree property.\n"));
3626 + else
3628 + PRINTF(("Type:%d\n",oType));
3631 + return TRUE ;
3634 +BOOL nsMapiAddressBook::IterateHierarchy(LPMAPICONTAINER pFolder,nsMapiEntryArray& aFolders, ULONG flags)
3636 + // flags can be CONVENIENT_DEPTH or 0
3637 + // CONVENIENT_DEPTH will return all depths I believe instead
3638 + // of just children
3639 + HRESULT hr;
3640 + nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
3641 + hr = pFolder->GetHierarchyTable( CONVENIENT_DEPTH , lpTable);
3642 + if (HR_FAILED(hr)) {
3643 + PRINTF(( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr));
3644 + return( FALSE);
3647 + ULONG rowCount;
3648 + hr = lpTable->GetRowCount( 0, &rowCount);
3649 + if (!rowCount) {
3650 + return( TRUE);
3653 + hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
3654 + if (HR_FAILED(hr)) {
3655 + PRINTF(( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr));
3656 + return( FALSE);
3659 + hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
3660 + if (HR_FAILED(hr)) {
3661 + PRINTF(( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr));
3662 + return( FALSE);
3665 + int cNumRows = 0;
3666 + LPSRowSet lpRow;
3667 + BOOL keepGoing = TRUE;
3668 + BOOL bResult = TRUE;
3669 + do {
3671 + lpRow = NULL;
3672 + hr = lpTable->QueryRows( 1, 0, &lpRow);
3674 + if (HR_FAILED(hr))
3676 + PRINTF(( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr));
3677 + bResult = FALSE;
3678 + break;
3681 + if (lpRow){
3682 + cNumRows = lpRow->cRows;
3684 + if (cNumRows) {
3685 + LPENTRYID lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
3686 + ULONG cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
3687 + ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
3689 + keepGoing = HandleHierarchyItem( oType, cb, lpEntry,aFolders);
3692 + MyFreeProws(lpRow);
3695 + } while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
3698 + if (bResult && !keepGoing)
3699 + bResult = FALSE;
3701 + return( bResult);
3703 +BOOL nsMapiAddressBook::HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
3705 + ULONG objType=0;
3706 + if (oType == MAPI_FOLDER)
3708 + nsMapiInterfaceWrapper<LPMAPICONTAINER> pFolder ;
3709 + if (!mRootSession->OpenEntry(
3710 + cb,
3711 + pEntry,
3712 + 0,
3713 + MAPI_BEST_ACCESS,
3714 + &objType,
3715 + pFolder))
3717 + LPSPropValue pVal;
3720 + pVal = GetMapiProperty(*(LPMAPICONTAINER*)&pFolder, PR_CONTAINER_CLASS);
3721 + if (pVal)
3723 + if (strcmp("IPF.Contact",pVal->Value.lpszA) == 0)
3725 + SPropValue *currentValue=GetMapiProperty( *(LPMAPICONTAINER*)&pFolder, PR_ENTRYID);
3727 + aFolders.AddItem(currentValue->Value.bin.cb,
3728 + NS_REINTERPRET_CAST(LPENTRYID, currentValue->Value.bin.lpb)) ;
3734 + else
3736 + PRINTF(( "GetStoreFolders - HandleHierarchyItem: Unhandled ObjectType: %ld\n", oType));
3739 + return( TRUE);
3743 +BOOL nsMapiAddressBook::GetFolders(nsMapiEntryArray& aFolders)
3745 + aFolders.CleanUp() ;
3746 + nsMapiInterfaceWrapper<LPMAPICONTAINER> rootFolder ;
3747 + nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
3748 + ULONG objType = 0 ;
3749 + ULONG rowCount = 0 ;
3751 + nsMapiInterfaceWrapper<LPMAPITABLE> lpTable;
3753 + mLastError = mRootSession->GetMsgStoresTable( 0, lpTable);
3754 + if (HR_FAILED(mLastError)) {
3755 + PRINTF(("Cannot open MAPI MsgStores %08x.\n", mLastError));
3756 + return mLastError;
3759 + mLastError = lpTable->GetRowCount( 0, &rowCount);
3761 + mLastError = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
3762 + if (FAILED(mLastError))
3763 + return( mLastError);
3764 + mLastError = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
3765 + if (FAILED(mLastError))
3766 + return mLastError;
3768 + int cNumRows = 0;
3769 + LPSRowSet lpRow;
3770 + BOOL keepGoing = TRUE;
3771 + BOOL bResult = TRUE;
3772 + do {
3774 + lpRow = NULL;
3775 + mLastError = lpTable->QueryRows( 1, 0, &lpRow);
3777 + if (HR_FAILED(mLastError)){
3778 + bResult = FALSE;
3779 + break;
3782 + if (lpRow){
3783 + cNumRows = lpRow->cRows;
3785 + if (cNumRows) {
3786 + LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
3787 + ULONG cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
3788 + ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
3791 + keepGoing = HandleContentsItem( oType, cbEID, lpEID,aFolders);
3793 + MyFreeProws( lpRow);
3796 + } while ( SUCCEEDED(mLastError) && cNumRows && lpRow && keepGoing);
3799 + return HR_SUCCEEDED(mLastError) ;
3801 +BOOL nsMapiAddressBook::CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction)
3803 + ULONG conditionType = 0 ;
3804 + ULONG ulResIndex;
3805 + if (!aRestriction)
3806 + return FALSE;
3807 + for (ulResIndex=0;ulResIndex < aRestrictionNum;ulResIndex++)
3809 + conditionType = aRestriction[ulResIndex].rt;
3810 + switch (conditionType)
3812 + case RES_EXIST :
3813 + aRestriction[ulResIndex].res.resExist.ulPropTag =
3814 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resExist.ulPropTag);
3815 + break ;
3816 + case RES_BITMASK :
3817 + aRestriction[ulResIndex].res.resBitMask.ulPropTag =
3818 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resBitMask.ulPropTag);
3819 + break ;
3820 + case RES_CONTENT :
3821 + aRestriction[ulResIndex].res.resContent.ulPropTag =
3822 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.ulPropTag);
3823 + aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag =
3824 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag);
3825 + break ;
3826 + case RES_PROPERTY :
3827 + aRestriction[ulResIndex].res.resProperty.ulPropTag =
3828 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.ulPropTag);
3829 + aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag =
3830 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag);
3831 + break ;
3832 + case RES_SIZE :
3833 + aRestriction[ulResIndex].res.resSize.ulPropTag =
3834 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resSize.ulPropTag);
3835 + break ;
3836 + case RES_COMPAREPROPS :
3837 + aRestriction[ulResIndex].res.resCompareProps.ulPropTag1 =
3838 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag1);
3839 + aRestriction[ulResIndex].res.resCompareProps.ulPropTag2 =
3840 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag2);
3841 + break ;
3842 + case RES_NOT :
3843 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resNot.lpRes);
3844 + break;
3845 + case RES_AND :
3846 + CorrectRestriction(aMapiProp,
3847 + aRestriction[ulResIndex].res.resAnd.cRes,
3848 + aRestriction[ulResIndex].res.resAnd.lpRes);
3849 + break;
3850 + case RES_OR :
3851 + CorrectRestriction(aMapiProp,
3852 + aRestriction[ulResIndex].res.resOr.cRes,
3853 + aRestriction[ulResIndex].res.resOr.lpRes);
3854 + break;
3856 + case RES_COMMENT :
3857 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resComment.lpRes);
3858 + aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag =
3859 + GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag);
3860 + break;
3861 + case RES_SUBRESTRICTION :
3862 + CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resSub.lpRes);
3863 + break;
3864 + default:
3865 + return FALSE;
3868 + return TRUE;
3870 +BOOL nsMapiAddressBook::Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList)
3872 + if (!aRestriction)
3873 + return FALSE;
3875 + ULONG conditionType = 0 ;
3877 + nsMapiEntryArray listOut;
3878 + ULONG listindex=0;
3880 + nsMapiEntryArray listDel;
3881 + ULONG delindex=0;
3883 + ULONG listsize;
3884 + ULONG resCount = 0;
3885 + ULONG resIndex = 0;
3887 + listsize = aList->GetSize();
3888 + conditionType = aRestriction->rt;
3889 + switch (conditionType)
3891 + case RES_EXIST :
3892 + case RES_BITMASK :
3893 + case RES_CONTENT :
3894 + case RES_PROPERTY :
3895 + case RES_SIZE :
3896 + case RES_COMPAREPROPS :
3897 + case RES_COMMENT :
3898 + case RES_SUBRESTRICTION :
3900 + while(listindex < aList->GetSize())
3902 + if (!FilterOnOneRow(aList->ElementAt(listindex),aRestriction))
3903 + aList->Remove(listindex);
3904 + else
3905 + listindex++;
3908 + break;
3909 + case RES_NOT :
3910 + aRestriction->res.resNot.ulReserved = 1;
3911 + case RES_AND :
3912 + case RES_OR :
3914 + if (conditionType == RES_OR)
3916 + for(listindex=0;listindex<aList->GetSize();listindex++)
3918 + listDel.AddItem(aList->ElementAt(listindex));
3922 + resCount = aRestriction->res.resAnd.cRes;
3923 + //notice that SAndRestriction ,SNotRestriction ,SOrRestriction
3924 + //use the same struct
3925 + for (resIndex = 0;resIndex < resCount;resIndex++)
3927 + //can't call listOut.CleanUp() here
3928 + //because it will destroy all Element too
3929 + while(listOut.GetSize())
3931 + listOut.Remove(0);
3934 + for(listindex=0;listindex<aList->GetSize();listindex++)
3936 + listOut.AddItem(aList->ElementAt(listindex));
3939 + Filter(&aRestriction->res.resAnd.lpRes[resIndex],&listOut);
3940 + if (conditionType == RES_NOT)
3942 + for(listindex=0;listindex<listOut.GetSize();listindex++)
3944 + aList->Remove(listOut.ElementAt(listindex));
3947 + else if (conditionType == RES_AND )
3949 + for(listindex=0;listindex<listOut.GetSize();listindex++)
3951 + if (!aList->IndexOf(listOut.ElementAt(listindex)))
3953 + aList->Remove(listOut.ElementAt(listindex));
3957 + else if (conditionType == RES_OR )
3959 + for(listindex=0;listindex<listOut.GetSize();listindex++)
3961 + listDel.Remove(listOut.ElementAt(listindex));
3963 + if (listDel.GetSize() == 0)
3965 + break;
3969 + if (conditionType == RES_OR)
3971 + for(listindex=0;listindex<listDel.GetSize();listindex++)
3973 + aList->Remove(listDel.ElementAt(listindex));
3979 + while(listDel.GetSize())
3981 + listDel.Remove(0);
3983 + while(listOut.GetSize())
3985 + listOut.Remove(0);
3989 + return TRUE;
3992 +BOOL nsMapiAddressBook::FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction)
3994 + LPMAPIPROP object ;
3995 + ULONG objType = 0 ;
3996 + LPSPropValue realValue = NULL ;
3997 + LPSPropValue resValue = NULL ;
3998 + ULONG valueCount = 0 ;
4000 + mLastError = OpenEntry(aEntry->mByteCount, aEntry->mEntryId,
4001 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4002 + (IUnknown **)&object) ;
4004 + if (HR_FAILED(mLastError)) {
4005 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4006 + return FALSE ;
4009 + ULONG conditionType = 0 ;
4010 + conditionType = aRestriction->rt;
4012 + switch (conditionType)
4014 + case RES_EXIST :
4015 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resExist.ulPropTag,1,realValue,valueCount))
4016 + return FALSE;
4017 + resValue = NULL;
4018 + break ;
4019 + case RES_CONTENT :
4020 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resContent.ulPropTag,1,realValue,valueCount))
4021 + return FALSE;
4022 + resValue = aRestriction->res.resContent.lpProp;
4023 + break ;
4024 + case RES_PROPERTY :
4025 + if (!GetMAPIProperties(*aEntry,&aRestriction->res.resProperty.ulPropTag,1,realValue,valueCount))
4026 + return FALSE;
4027 + resValue = aRestriction->res.resProperty.lpProp;
4028 + break ;
4029 + case RES_BITMASK :
4030 + return FALSE; //not support
4031 + break ;
4032 + case RES_SIZE :
4033 + return FALSE;//not been used now
4034 + break ;
4035 + case RES_COMPAREPROPS :
4036 + return FALSE;//not been used now
4037 + break ;
4038 + case RES_NOT :
4039 + return FALSE;//not need care here
4040 + break;
4041 + case RES_AND :
4042 + return FALSE;//not need care here
4043 + break;
4044 + case RES_OR :
4045 + return FALSE;//not need care here
4046 + break;
4047 + case RES_COMMENT :
4048 + return TRUE;//comment
4049 + break;
4050 + case RES_SUBRESTRICTION :
4051 + return FALSE;//not been used now
4052 + break ;
4054 + return AtomyFilter(aRestriction,realValue,resValue);
4058 +BOOL nsMapiAddressBook::AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue)
4060 + ULONG conditionType = 0 ;
4061 + conditionType = aRestriction->rt;
4063 + BOOL bTagEq=(aRealValue &&
4064 + PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) &&
4065 + aFilterValue;
4066 + // PROP_TYPE( aRealValue->ulPropTag ) == PROP_TYPE( aFilterValue->ulPropTag ));
4067 + switch (conditionType)
4069 + case RES_EXIST :
4070 + return (aRealValue && PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) ;
4071 + break ;
4072 + case RES_CONTENT :
4073 + if (bTagEq)
4075 + switch(aRestriction->res.resContent.ulFuzzyLevel)
4077 + case FL_FULLSTRING :
4078 + return !stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA);
4079 + break;
4080 + case FL_PREFIX :
4081 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == aRealValue->Value.lpszA;
4082 + break;
4083 + case FL_SUBSTRING :
4084 + default:
4085 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
4086 + break;
4089 + return FALSE;
4090 + break ;
4091 + case RES_PROPERTY :
4092 + if (bTagEq)
4094 + switch(aRestriction->res.resProperty.relop)
4096 + case RELOP_GE :
4097 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) >= 0;
4098 + break;
4099 + case RELOP_GT :
4100 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) > 0;
4101 + break;
4102 + case RELOP_LE :
4103 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) <= 0;
4104 + break;
4105 + case RELOP_LT :
4106 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) < 0;
4107 + break;
4108 + case RELOP_EQ :
4109 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == 0;
4110 + break;
4111 + case RELOP_NE :
4112 + return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != 0;
4113 + break;
4114 + case RELOP_RE :
4115 + default:
4116 + return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
4117 + break;
4121 + return FALSE;
4122 + break ;
4123 + case RES_BITMASK :
4124 + return FALSE; //not support
4125 + break ;
4126 + case RES_SIZE :
4127 + return FALSE;//not been used now
4128 + break ;
4129 + case RES_COMPAREPROPS :
4130 + return FALSE;//not been used now
4131 + break ;
4132 + case RES_NOT :
4133 + return FALSE;//not need care here
4134 + break;
4135 + case RES_AND :
4136 + return FALSE;//not need care here
4137 + break;
4138 + case RES_OR :
4139 + return FALSE;//not need care here
4140 + break;
4141 + case RES_COMMENT :
4142 + return TRUE;//comment
4143 + break;
4144 + case RES_SUBRESTRICTION :
4145 + return FALSE;//not been used now
4146 + break ;
4148 + return TRUE;
4151 +BOOL nsMapiAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
4152 + nsMapiEntryArray *aList, ULONG aMapiType)
4154 + if (aList)
4155 + aList->CleanUp();
4157 + nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
4158 + nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
4159 + ULONG objType = 0 ;
4160 + ULONG rowCount = 0 ;
4163 + nsMapiInterfaceWrapper<LPMAPIPROP> pFolder;
4164 + nsCString cs;
4165 + aParent.ToString(cs);
4167 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4168 + 0, MAPI_BEST_ACCESS, &objType, pFolder);
4169 + if (HR_FAILED(mLastError))
4171 + PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
4172 + return FALSE;
4176 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&pFolder,PR_MESSAGE_CLASS);
4177 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4179 + HRESULT hr;
4180 + LPSPropValue aValue = NULL ;
4181 + ULONG aValueCount = 0 ;
4183 + LPSPropTagArray properties = NULL ;
4184 + mMAPIAllocateBuffer(CbNewSPropTagArray(1),
4185 + (void **)&properties);
4186 + properties->cValues = 1;
4187 + properties->aulPropTag [0] = GetEmailPropertyTag(*(LPMAPIPROP*)&pFolder,OUTLOOK_EMAIL_LIST1);
4188 + hr = pFolder->GetProps(properties, 0, &aValueCount, &aValue) ;
4190 + SBinaryArray *sa=&aValue->Value.MVbin;
4192 + LPENTRYID lpEID;
4193 + ULONG cbEID;
4195 + ULONG idx;
4196 + nsMapiEntry testEntry;
4197 + nsCString sClass;
4198 + for (idx=0;sa->lpbin && idx<sa->cValues ;idx++)
4200 + lpEID= (LPENTRYID) sa->lpbin[idx].lpb;
4201 + cbEID = sa->lpbin[idx].cb;
4202 + testEntry.Assign(sa->lpbin[idx].cb,NS_REINTERPRET_CAST(LPENTRYID,sa->lpbin[idx].lpb));
4204 + if (GetPropertyString(testEntry,PR_MESSAGE_CLASS,sClass)) //Error get property
4206 + aList->AddItem(cbEID,lpEID);
4209 + Filter(aRestriction,aList);
4211 + else
4213 + if (aRestriction && !CorrectRestriction(*(LPMAPICONTAINER*)&pFolder,1,aRestriction))
4214 + return FALSE;
4215 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4216 + &IID_IMAPIContainer, MAPI_BEST_ACCESS, &objType,
4217 + parent) ;
4218 + if (HR_FAILED(mLastError)) {
4219 + PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
4220 + return FALSE ;
4223 + mLastError = parent->GetContentsTable(0, contents) ;
4224 + if (HR_FAILED(mLastError)) {
4225 + PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
4226 + return FALSE;
4228 + if (aRestriction) {
4229 + mLastError = contents->Restrict(aRestriction, TBL_BATCH) ;
4230 + if (HR_FAILED(mLastError)) {
4231 + PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
4232 + return FALSE ;
4235 + mLastError = contents->SetColumns((LPSPropTagArray)&ContentsColumns, 0);
4236 + if (HR_FAILED(mLastError)) {
4237 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
4238 + return FALSE ;
4240 + mLastError = contents->GetRowCount(0, &rowCount) ;
4241 + if (HR_FAILED(mLastError)) {
4242 + PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
4243 + return FALSE ;
4245 + do {
4246 + LPSRowSet rowSet = NULL ;
4248 + rowCount = 0 ;
4249 + mLastError = contents->QueryRows(1, 0, &rowSet) ;
4250 + if (HR_FAILED(mLastError)) {
4251 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
4252 + return FALSE ;
4254 + rowCount = rowSet->cRows ;
4255 + if (rowCount > 0 && aList)
4257 + if (aMapiType == 0 || rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)
4259 + SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
4260 + aList->AddItem(currentValue.Value.bin.cb,
4261 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
4263 + else if (aMapiType == MAPI_DISTLIST)
4265 + if (strcmp("IPM.DistList",rowSet->aRow->lpProps[ContentsColumnMessageClass].Value.lpszA)==0)
4267 + SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
4268 + aList->AddItem(currentValue.Value.bin.cb,
4269 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
4275 + MyFreeProws(rowSet) ;
4276 + } while (rowCount > 0) ;
4280 + return TRUE ;
4283 +BOOL nsMapiAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
4284 + ULONG aNbProperties, LPSPropValue& aValue,
4285 + ULONG& aValueCount)
4287 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
4288 + ULONG objType = 0 ;
4289 + LPSPropTagArray properties = NULL ;
4290 + ULONG i = 0 ;
4292 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
4293 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4294 + object) ;
4296 + if (HR_FAILED(mLastError)) {
4297 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4298 + return FALSE ;
4300 + AllocateBuffer(CbNewSPropTagArray(aNbProperties),
4301 + NS_REINTERPRET_CAST(void **, &properties));
4302 + properties->cValues = aNbProperties ;
4303 + for (i = 0 ; i < aNbProperties ; ++ i)
4305 + properties->aulPropTag [i] = GetRealMapiPropertyTag(*(LPMAPIPROP*)&object,aPropertyTags [i],TRUE);
4307 + mLastError = object->GetProps(properties, 0 , &aValueCount, &aValue) ;
4308 + FreeBuffer(properties) ;
4310 + if (HR_FAILED(mLastError)) {
4311 + PRINTF(("Error get props %08x.\n", mLastError)) ;
4313 + return HR_SUCCEEDED(mLastError);
4316 +BOOL nsMapiAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
4317 + LPSPropValue& aValues)
4319 + nsMapiInterfaceWrapper<LPMESSAGE> object;
4320 + ULONG objType = 0 ;
4321 + LPSPropProblemArray problems = NULL ;
4322 + ULONG i = 0 ;
4324 + LPMDB lpMsgStore=GetMsgStore(aObject);
4326 + if (!lpMsgStore)
4328 + return FALSE;
4330 + mLastError = lpMsgStore->OpenEntry(aObject.mByteCount, aObject.mEntryId,
4331 + &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
4332 + object) ;
4333 + lpMsgStore->Release();
4335 + if (HR_FAILED(mLastError)) {
4336 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4337 + return FALSE ;
4339 + for (i = 0 ; i < aNbProperties ; ++ i)
4341 + aValues[i].ulPropTag = GetRealMapiPropertyTag(*(LPMESSAGE*)&object,aValues[i].ulPropTag,TRUE);
4343 + mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
4344 + if (HR_FAILED(mLastError)) {
4345 + PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
4346 + return FALSE ;
4348 + if (problems) {
4349 + for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
4350 + PRINTF(("Problem %d: index %d code %08x.\n", i,
4351 + problems->aProblem [i].ulIndex,
4352 + problems->aProblem [i].scode)) ;
4355 + mLastError = object->SaveChanges(0) ;
4356 + if (MAPI_E_OBJECT_CHANGED == mLastError)
4358 + mLastError = object->SaveChanges(FORCE_SAVE ) ;
4360 + return HR_SUCCEEDED(mLastError) ;
4363 +BOOL nsMapiAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
4365 + return FALSE ;
4368 +BOOL nsMapiAddressBook::IsOK(void)
4370 + return mRootSession && mLibUsage;
4373 BOOL nsMapiAddressBook::Initialize(void)
4375 - if (mAddressBook) { return TRUE ; }
4377 nsAutoLock guard(mMutex) ;
4379 if (!LoadMapiLibrary()) {
4380 PRINTF(("Cannot load library.\n")) ;
4381 return FALSE ;
4383 - mAddressBook = mRootBook ;
4384 - return TRUE ;
4385 + return TRUE;
4388 void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
4389 @@ -181,7 +1108,803 @@
4390 mMAPIFreeBuffer(aBuffer) ;
4393 +ULONG nsMapiAddressBook::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID)
4395 + static GUID emailGUID =
4397 + 0x00062004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
4398 + };
4401 + MAPINAMEID mapiNameID;
4402 + mapiNameID.lpguid = &emailGUID;
4403 + mapiNameID.ulKind = MNID_ID;
4404 + mapiNameID.Kind.lID = nameID;
4406 + LPMAPINAMEID lpMapiNames = &mapiNameID;
4407 + LPSPropTagArray lpMailTagArray = NULL;
4409 + HRESULT result = lpProp->GetIDsFromNames(1L, &lpMapiNames, 0, &lpMailTagArray);
4410 + if (result == S_OK)
4412 + ULONG lTag = lpMailTagArray->aulPropTag[0];
4413 + mMAPIFreeBuffer(lpMailTagArray);
4414 + return lTag;
4416 + return 0L;
4418 +ULONG nsMapiAddressBook::GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest)
4420 + LPSPropValue addr;
4421 + ULONG upRealTag=aPropertyTag;
4422 + ULONG lSize=sizeof(TagMaps) / sizeof(TagMap);
4424 + for(int i=0; i<lSize; i++)
4426 + if (TagMaps[i].AddressTag == aPropertyTag)
4429 + ULONG kPriEmailColumn=GetEmailPropertyTag(lpProp,TagMaps[i].NameID);
4430 + if (aTest)
4432 + if (PR_DISPLAY_NAME_A == aPropertyTag)
4434 + //We need not change PR_DISPLAY_NAME_A tag if we are not using an address
4435 + LPSPropValue msgClass=GetMapiProperty(lpProp,PR_MESSAGE_CLASS);
4436 + if (msgClass && !strcmp("IPM.Contact",msgClass->Value.lpszA))
4438 + if (kPriEmailColumn)
4439 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4441 + else
4443 + FreeBuffer(msgClass);
4444 + upRealTag = aPropertyTag;
4447 + else //PR_DISPLAY_NAME_A == aPropertyTag
4449 + addr=GetMapiProperty(lpProp,aPropertyTag);
4450 + if (!addr || PROP_TYPE( addr->ulPropTag) == PT_ERROR ||
4451 + addr->Value.l == MAPI_E_NOT_FOUND)
4453 + if (kPriEmailColumn)
4454 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4458 + else //aTest
4460 + if (kPriEmailColumn)
4461 + upRealTag = kPriEmailColumn | TagMaps[i].TypeMask;
4464 + break; //we find it,exit
4468 + return upRealTag;
4471 +BOOL nsMapiAddressBook::GetPropertyLong(const nsMapiEntry& aObject,
4472 + ULONG aPropertyTag,
4473 + ULONG& aValue)
4475 + aValue = 0 ;
4476 + LPSPropValue values = NULL ;
4477 + ULONG valueCount = 0 ;
4479 + if (PR_OBJECT_TYPE == aPropertyTag)
4481 + nsMapiInterfaceWrapper<LPMAPIFOLDER> pFolder ;
4482 + ULONG objType=0;
4483 + mLastError = OpenEntry(aObject.mByteCount,aObject.mEntryId,
4484 + NULL,MAPI_BEST_ACCESS,&objType, pFolder);
4485 + if (HR_FAILED(mLastError))
4487 + PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
4488 + return FALSE;
4490 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIFOLDER*)&pFolder,PR_MESSAGE_CLASS);
4491 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4493 + FreeBuffer(msgClass);
4494 + aValue = MAPI_DISTLIST;
4495 + return TRUE;
4499 + if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
4500 + return FALSE ;
4502 + if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_LONG) {
4503 + aValue = values->Value.ul ;
4505 + FreeBuffer(values) ;
4506 + return TRUE ;
4509 +BOOL nsMapiAddressBook::GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
4510 + WORD& aYear, WORD& aMonth, WORD& aDay)
4512 + aYear = 0;
4513 + aMonth = 0;
4514 + aDay = 0;
4515 + LPSPropValue values = NULL ;
4516 + ULONG valueCount = 0 ;
4518 + if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
4519 + return FALSE ;
4521 + if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
4522 + SYSTEMTIME readableTime ;
4523 + FILETIME localTime ;
4524 + FileTimeToLocalFileTime(&values->Value.ft,&localTime);
4525 + if (FileTimeToSystemTime(&localTime, &readableTime)) {
4526 + aYear = readableTime.wYear ;
4527 + aMonth = readableTime.wMonth ;
4528 + aDay = readableTime.wDay ;
4531 + FreeBuffer(values) ;
4532 + return TRUE ;
4535 +HRESULT nsMapiAddressBook::OpenEntry(ULONG cbEntryID,
4536 + LPENTRYID lpEntryID,
4537 + LPCIID lpInterface,
4538 + ULONG ulFlags,
4539 + ULONG FAR * lpulObjType,
4540 + LPUNKNOWN FAR * lppUnk
4544 + int err;
4545 + HRESULT rv;
4546 + __try
4548 + rv=mRootSession->OpenEntry(cbEntryID,
4549 + lpEntryID,
4550 + lpInterface,
4551 + ulFlags ,
4552 + lpulObjType,
4553 + lppUnk
4554 + );
4555 + }__except(err)
4557 + return (-1);
4560 + if (HR_FAILED(rv) && !m_MDBArray.Count())
4562 + //There are no openned Message store,so we have to open them all
4563 + nsMapiEntryArray aFolders;
4564 + if (GetFolders(aFolders))
4566 + __try
4568 + rv=mRootSession->OpenEntry(cbEntryID,
4569 + lpEntryID,
4570 + lpInterface,
4571 + ulFlags ,
4572 + lpulObjType,
4573 + lppUnk
4574 + );
4575 + }__except(err)
4577 + return (-1);
4581 + return rv;
4585 +BOOL nsMapiAddressBook::AddEntryToList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
4587 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
4588 + ULONG objType = 0 ;
4590 + nsMapiEntry parentEntry;
4591 + if (!GetEntryParent(aDistlist,parentEntry))
4592 + return FALSE;
4594 + LPMDB lpMsgStore=GetMsgStore(parentEntry);
4596 + if (!lpMsgStore)
4597 + return FALSE;
4598 + mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
4599 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4600 + container) ;
4601 + lpMsgStore->Release();
4603 + if (HR_FAILED(mLastError))
4604 + return FALSE ;
4607 + /*
4608 + When add mail address to distlist,Mapi need update 2 tag.
4609 + */
4610 + //update OUTLOOK_EMAIL_LIST1
4611 + ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
4612 + SBinaryArray oldChilds;
4613 + LPSBinary bins=NULL;
4614 + SBinaryArray newChilds;
4615 + LPSPropValue oldChildValue = NULL ;
4616 + ULONG valueCount = 0 ;
4618 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4620 + PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
4621 + return FALSE;
4624 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4626 + oldChilds = oldChildValue->Value.MVbin;
4627 + newChilds.cValues=oldChilds.cValues + 1;
4628 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4629 + newChilds.lpbin = bins;
4630 + for (ULONG i=0;i<oldChilds.cValues;i++)
4632 + newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
4633 + newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
4636 + else
4638 + newChilds.cValues = 1;
4639 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4640 + newChilds.lpbin = bins;
4643 + nsMapiEntry orgEntryID;
4644 + if (!GetPropertyBin(aNewEntry,
4645 + GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_ORGID) | PT_BINARY,
4646 + orgEntryID))
4648 + return FALSE;
4650 + newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
4651 + newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
4653 + SPropValue childs;
4654 + childs.ulPropTag = listTag;
4655 + childs.Value.MVbin = newChilds;
4657 + LPSPropProblemArray problems = NULL ;
4658 + mLastError = container->SetProps(1, &childs, &problems) ;
4659 + if (HR_FAILED(mLastError)) {
4660 + PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
4661 + return FALSE ;
4664 + //update OUTLOOK_EMAIL_LIST2
4665 + listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
4666 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4668 + PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
4669 + return FALSE;
4672 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4674 + oldChilds = oldChildValue->Value.MVbin;
4675 + newChilds.cValues=oldChilds.cValues + 1;
4676 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4677 + newChilds.lpbin = bins;
4678 + for (ULONG i=0;i<oldChilds.cValues;i++)
4680 + newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
4681 + newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
4684 + else
4686 + newChilds.cValues = 1;
4687 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4688 + newChilds.lpbin = bins;
4691 + /*
4692 + Need more work here.
4693 + There are two kind of mail address in outlook DistList.
4694 + One is sample,not include in parent folder.
4695 + The other is a link to a unattached address in parents folders.
4696 + Currently we can only add first kind of address to a outlook distlist.
4697 + */
4699 + newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
4700 + newChilds.lpbin[newChilds.cValues-1].cb = orgEntryID.mByteCount;
4702 + childs.ulPropTag = listTag;
4703 + childs.Value.MVbin = newChilds;
4705 + mLastError = container->SetProps(1, &childs, &problems) ;
4706 + if (HR_FAILED(mLastError))
4708 + PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
4709 + return FALSE ;
4712 + mMAPIFreeBuffer(bins);
4714 + mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
4715 + if (HR_FAILED(mLastError)) {
4716 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
4717 + return FALSE ;
4720 + return TRUE ;
4722 +BOOL nsMapiAddressBook::DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
4724 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
4725 + ULONG objType = 0 ;
4727 + nsMapiEntry parentEntry;
4728 + if (!GetEntryParent(aDistlist,parentEntry))
4729 + return FALSE;
4731 + LPMDB lpMsgStore=GetMsgStore(parentEntry);
4732 + if (!lpMsgStore)
4733 + return FALSE;
4735 + mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
4736 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4737 + container) ;
4738 + lpMsgStore->Release();
4740 + if (HR_FAILED(mLastError))
4741 + return FALSE ;
4742 + /*
4743 + When delete mail address from distlist,Mapi need update 2 tag.
4744 + */
4745 + //update OUTLOOK_EMAIL_LIST1
4746 + ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
4748 + SBinaryArray oldChilds;
4749 + LPSBinary bins=NULL;
4750 + SBinaryArray newChilds;
4751 + LPSPropValue oldChildValue = NULL ;
4752 + ULONG valueCount = 0 ;
4754 + newChilds.lpbin=NULL;
4756 + ULONG lDeleteEntry=0;
4757 + ULONG newIndex=0;
4758 + ULONG oldIndex=0;
4759 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4761 + PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
4762 + return FALSE;
4765 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4767 + oldChilds = oldChildValue->Value.MVbin;
4768 + newChilds.cValues=oldChilds.cValues - 1;
4769 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4770 + newChilds.lpbin = bins;
4771 + for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
4773 + if ( oldChilds.lpbin[oldIndex].cb == aNewEntry.mByteCount &&
4774 + !memcmp((void*)(oldChilds.lpbin[oldIndex].lpb+4),
4775 + (void*)(aNewEntry.mEntryId->ab),
4776 + oldChilds.lpbin[oldIndex].cb-4))
4778 + lDeleteEntry=oldIndex;
4780 + else
4782 + newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
4783 + newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
4784 + newIndex++;
4788 + else
4789 + return FALSE;
4792 + SPropValue childs;
4793 + LPSPropProblemArray problems = NULL ;
4795 + if (newChilds.cValues == 0)
4797 + SPropTagArray delTags;
4798 + delTags.cValues = 1;
4799 + delTags.aulPropTag[0] = listTag;
4801 + mLastError = container->DeleteProps(&delTags, &problems) ;
4803 + else
4805 + childs.ulPropTag = listTag;
4806 + childs.Value.MVbin = newChilds;
4807 + mLastError = container->SetProps(1, &childs, &problems) ;
4810 + if (HR_FAILED(mLastError)) {
4811 + PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
4812 + return FALSE ;
4815 + //update OUTLOOK_EMAIL_LIST2
4816 + listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
4817 + if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
4819 + PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
4820 + return FALSE;
4823 + newIndex=0;
4824 + if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
4826 + oldChilds = oldChildValue->Value.MVbin;
4827 + newChilds.cValues=oldChilds.cValues - 1;
4828 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4829 + newChilds.lpbin = bins;
4830 + for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
4832 + if (oldIndex != lDeleteEntry)
4834 + newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
4835 + newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
4836 + newIndex++;
4840 + else
4842 + newChilds.cValues = 1;
4843 + mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
4844 + newChilds.lpbin = bins;
4849 + if (newChilds.cValues == 0)
4851 + SPropTagArray delTags;
4852 + delTags.cValues = 1;
4853 + delTags.aulPropTag[0] = listTag;
4855 + mLastError = container->DeleteProps(&delTags, &problems) ;
4857 + else
4859 + childs.ulPropTag = listTag;
4860 + childs.Value.MVbin = newChilds;
4861 + mLastError = container->SetProps(1, &childs, &problems) ;
4863 + if (HR_FAILED(mLastError)) {
4864 + PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
4865 + return FALSE ;
4868 + mMAPIFreeBuffer(bins);
4870 + mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
4871 + if (HR_FAILED(mLastError)) {
4872 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
4873 + return FALSE ;
4876 + return TRUE ;
4879 +BOOL nsMapiAddressBook::GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry)
4881 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
4882 + ULONG objType = 0 ;
4883 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4884 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4885 + (IUnknown **)&object) ;
4887 + if (HR_FAILED(mLastError)) {
4888 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4889 + return FALSE ;
4891 + SPropValue *parentID=GetMapiProperty(*(LPMAPIPROP*)&object, PR_PARENT_ENTRYID);
4893 + if (parentID->Value.l == MAPI_E_NOT_FOUND)
4894 + return FALSE;
4895 + aParentEntry.Assign(parentID->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, parentID->Value.bin.lpb));
4896 + return TRUE;
4898 +BOOL nsMapiAddressBook::CreateEntryInList(const nsMapiEntry& aDistlist, nsMapiEntry& aNewEntry)
4900 + nsMapiInterfaceWrapper<LPMAPIPROP> container ;
4901 + ULONG objType = 0 ;
4903 + nsMapiEntry parentEntry;
4904 + if (!GetEntryParent(aDistlist,parentEntry))
4906 + return FALSE;
4908 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
4909 + if (!CreateEntry(parentEntry,aNewEntry)) //Create a entry in parent folder
4910 + return FALSE;
4912 + return AddEntryToList(aDistlist,aNewEntry);
4915 +BOOL nsMapiAddressBook::CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
4917 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
4918 + ULONG objType = 0 ;
4920 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
4921 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
4922 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
4923 + object) ;
4925 + if (HR_FAILED(mLastError)) {
4926 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
4927 + return NULL ;
4929 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
4931 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
4932 + return CreateEntryInList(aParent,aNewEntry); //Create entry in DistList
4934 + LPMDB lpMsgStore=GetMsgStore(aParent);
4936 + if (!lpMsgStore)
4937 + return FALSE;
4939 + mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
4940 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
4941 + container) ;
4942 + lpMsgStore->Release();
4944 + if (HR_FAILED(mLastError))
4945 + return FALSE;
4947 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
4949 + mLastError = container->CreateMessage(&IID_IMessage,
4950 + 0,
4951 + newEntry) ;
4952 + if (HR_FAILED(mLastError)) {
4953 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
4954 + return FALSE ;
4956 + SPropValue messageclass ;
4957 + LPSPropProblemArray problems = NULL ;
4958 + nsCString tempName ;
4960 + messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
4961 + tempName.Assign("IPM.Contact") ;
4962 + messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
4963 + mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
4964 + if (HR_FAILED(mLastError)) {
4965 + PRINTF(("Cannot set temporary name %08x.\n", mLastError)) ;
4966 + return FALSE ;
4968 + mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
4969 + if (HR_FAILED(mLastError)) {
4970 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
4971 + return FALSE ;
4974 + SPropTagArray property ;
4975 + LPSPropValue value = NULL ;
4976 + ULONG valueCount = 0 ;
4978 + property.cValues = 1 ;
4979 + property.aulPropTag [0] = PR_ENTRYID ;
4980 + mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
4981 + if (HR_FAILED(mLastError) || valueCount != 1) {
4982 + PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
4983 + return FALSE ;
4985 + aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
4986 + FreeBuffer(value) ;
4987 + return TRUE ;
4990 +BOOL nsMapiAddressBook::CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
4992 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
4993 + ULONG objType = 0 ;
4995 + LPMDB lpMsgStore=GetMsgStore(aParent);
4996 + if (!lpMsgStore)
4997 + return FALSE;
4998 + mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
4999 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5000 + container) ;
5001 + lpMsgStore->Release();
5003 + if (HR_FAILED(mLastError)) {
5004 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5005 + return FALSE ;
5008 + nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
5009 + mLastError = container->CreateMessage(&IID_IMAPIProp,
5010 + 0,
5011 + newEntry) ;
5012 + if (HR_FAILED(mLastError)) {
5013 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5014 + return FALSE ;
5016 + SPropValue messageclass ;
5017 + LPSPropProblemArray problems = NULL ;
5018 + nsCString tempName ;
5020 + messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
5021 + tempName.Assign("IPM.DistList") ;
5022 + messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
5023 + mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
5024 + if (HR_FAILED(mLastError)) {
5025 + PRINTF(("Cannot set PR_MESSAGE_CLASS_A %08x.\n", mLastError)) ;
5026 + return FALSE ;
5028 + mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
5029 + if (HR_FAILED(mLastError)) {
5030 + PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
5031 + return FALSE ;
5034 + ULONG valueCount = 0 ;
5035 + SPropTagArray property ;
5036 + LPSPropValue value = NULL ;
5038 + property.cValues = 1 ;
5039 + property.aulPropTag [0] = PR_ENTRYID ;
5040 + mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
5041 + if (HR_FAILED(mLastError) || valueCount != 1) {
5042 + PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
5043 + return FALSE ;
5045 + aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
5047 + FreeBuffer(value) ;
5048 + return TRUE ;
5052 +BOOL nsMapiAddressBook::CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource,
5053 + nsMapiEntry& aTarget)
5055 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5056 + nsMapiInterfaceWrapper<LPMAPIFOLDER> targetFolder ;
5057 + ULONG objType = 0 ;
5058 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5059 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5060 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5061 + object) ;
5063 + if (HR_FAILED(mLastError)) {
5064 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5065 + return FALSE ;
5067 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5069 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5071 + //Add Entry To DistList
5072 + if (!AddEntryToList(aContainer,aSource))
5073 + return FALSE;
5074 + aTarget.Assign(aSource.mByteCount,aSource.mEntryId);
5075 + return TRUE;
5078 + SBinary entry ;
5079 + SBinaryArray entryArray ;
5081 + entry.cb = aSource.mByteCount ;
5082 + entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aSource.mEntryId) ;
5083 + entryArray.cValues = 1 ;
5084 + entryArray.lpbin = &entry ;
5086 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5087 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5088 + container) ;
5089 + if (HR_FAILED(mLastError)) {
5090 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5091 + return FALSE ;
5094 + mLastError = OpenEntry(aTarget.mByteCount, aTarget.mEntryId,
5095 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5096 + targetFolder) ;
5097 + if (HR_FAILED(mLastError)) {
5098 + PRINTF(("Cannot open Target folder %08x.\n", mLastError)) ;
5099 + return FALSE ;
5102 + nsMapiInterfaceWrapper<LPMAPIPROP> newEntry ;
5104 + mLastError = container->CopyMessages(&entryArray,
5105 + &IID_IMessage,
5106 + (void*)&targetFolder,
5107 + 0,
5108 + NULL,
5109 + NULL) ;
5110 + if (HR_FAILED(mLastError)) {
5111 + PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
5112 + return FALSE ;
5114 + return TRUE ;
5117 +BOOL nsMapiAddressBook::DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry)
5119 + nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
5120 + ULONG objType = 0 ;
5121 + SBinary entry ;
5122 + SBinaryArray entryArray ;
5125 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5126 + mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5127 + &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
5128 + object) ;
5130 + if (HR_FAILED(mLastError)) {
5131 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5132 + return FALSE ;
5134 + LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
5136 + if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
5137 + return DeleteEntryFromList(aContainer,aEntry); //Delete Entry from DistList
5139 + LPMDB lpMsgStore=GetMsgStore(aContainer);
5140 + if (!lpMsgStore)
5141 + return FALSE;
5143 + mLastError = lpMsgStore->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
5144 + &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
5145 + container) ;
5146 + lpMsgStore->Release();
5147 + if (HR_FAILED(mLastError)) {
5148 + PRINTF(("Cannot open container %08x.\n", mLastError)) ;
5149 + return FALSE ;
5151 + entry.cb = aEntry.mByteCount ;
5152 + entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aEntry.mEntryId) ;
5153 + entryArray.cValues = 1 ;
5154 + entryArray.lpbin = &entry ;
5155 + mLastError = container->DeleteMessages(&entryArray, 0,0,0) ;
5156 + if (HR_FAILED(mLastError)) {
5157 + PRINTF(("Cannot delete entry %08x.\n", mLastError)) ;
5158 + return FALSE ;
5160 + return TRUE ;
5163 +//Use to open message store in write mode
5164 +LPMDB nsMapiAddressBook::GetMsgStore(const nsMapiEntry& aEntry)
5166 + nsMapiInterfaceWrapper<LPMAPIPROP> object;
5167 + ULONG objType=0;
5169 + mLastError = OpenEntry(aEntry.mByteCount, aEntry.mEntryId,
5170 + &IID_IMAPIProp, MAPI_BEST_ACCESS , &objType,
5171 + object) ;
5172 + if (HR_FAILED(mLastError)) {
5173 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5174 + return NULL ;
5176 + SPropValue *svMsgSore=GetMapiProperty( *(LPMAPIPROP*)&object, PR_STORE_ENTRYID);;
5178 + LPMDB lpMsgStore=NULL;
5179 + mLastError=mRootSession->OpenMsgStore(0,
5180 + svMsgSore->Value.bin.cb,
5181 + (ENTRYID*)svMsgSore->Value.bin.lpb,
5182 + &IID_IMsgStore,
5183 + MAPI_BEST_ACCESS ,
5184 + &lpMsgStore);
5186 + if (HR_FAILED(mLastError)) {
5187 + PRINTF(("Cannot open MsgStore %08x.\n", mLastError)) ;
5188 + return NULL ;
5191 + return lpMsgStore;
5193 --- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2004-04-17 20:32:14.000000000 +0200
5194 +++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h 2008-08-14 16:22:21.000000000 +0200
5195 @@ -40,12 +40,42 @@
5197 #include "nsAbWinHelper.h"
5199 +struct TagMap
5201 + ULONG AddressTag;
5202 + ULONG NameID;
5203 + ULONG TypeMask;
5205 class nsMapiAddressBook : public nsAbWinHelper
5207 public :
5208 nsMapiAddressBook(void) ;
5209 virtual ~nsMapiAddressBook(void) ;
5211 + // Get the top address books
5212 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
5214 + // Get a default address book container
5215 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
5216 + // Is the helper correctly initialised?
5217 + virtual BOOL IsOK(void);
5218 + virtual BOOL GetPropertyLong(const nsMapiEntry& aObject,
5219 + ULONG aPropertyTag,
5220 + ULONG& aValue);
5221 + // Get the value of a MAPI property of type SYSTIME
5222 + virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
5223 + WORD& aYear, WORD& aMonth, WORD& aDay);
5224 + // Create entry in the address book
5225 + virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
5226 + // Delete an entry in the address book
5227 + virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
5228 + // Create a distribution list in the address book
5229 + virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
5230 + // Copy an existing entry in the address book
5231 + virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
5233 + static void FreeMapiLibrary(void) ;
5235 protected :
5236 // Class members to handle the library/entry points
5237 static HMODULE mLibrary ;
5238 @@ -67,19 +97,77 @@
5239 static BOOL mInitialized ;
5240 static BOOL mLogonDone ;
5241 static LPMAPISESSION mRootSession ;
5242 - static LPADRBOOK mRootBook ;
5245 // Load the MAPI environment
5246 BOOL Initialize(void) ;
5248 + virtual HRESULT OpenEntry(ULONG cbEntryID,
5249 + LPENTRYID lpEntryID,
5250 + LPCIID lpInterface,
5251 + ULONG ulFlags,
5252 + ULONG FAR * lpulObjType,
5253 + LPUNKNOWN FAR * lppUnk
5254 + );
5257 + // Retrieve the contents of a container, with an optional restriction
5258 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5259 + nsMapiEntryArray *aList, ULONG aMapiType) ;
5260 + // Retrieve the values of a set of properties on a MAPI object
5261 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5262 + ULONG aNbProperties,
5263 + LPSPropValue& aValues, ULONG& aValueCount) ;
5264 + // Set the values of a set of properties on a MAPI object
5265 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5266 + LPSPropValue& aValues);
5269 // Allocation of a buffer for transmission to interfaces
5270 virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
5271 // Destruction of a buffer provided by the interfaces
5272 virtual void FreeBuffer(LPVOID aBuffer) ;
5273 // Library management
5274 static BOOL LoadMapiLibrary(void) ;
5275 - static void FreeMapiLibrary(void) ;
5277 + BOOL HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
5278 + LPSPropValue GetMapiProperty( LPMAPIPROP pProp, ULONG tag);
5279 + BOOL GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal=FALSE);
5280 + BOOL HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
5281 + BOOL IterateHierarchy(IMAPIContainer * pFolder, nsMapiEntryArray& aFolders,ULONG flags=0);
5282 + ULONG GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID);
5283 + ULONG GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest=FALSE);
5284 + LPMDB GetMsgStore(const nsMapiEntry& aEntry);
5285 + BOOL CreateEntryInList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry);
5286 + BOOL AddEntryToList(const nsMapiEntry& aParent,const nsMapiEntry& aNewEntry);
5287 + BOOL DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry);
5288 + BOOL GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry);
5289 + BOOL CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction);
5291 + //filter
5292 + BOOL Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList);
5293 + BOOL FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction);
5294 + BOOL AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue);
5296 + void AddToMDBArray(LPMDB aMDB)
5298 + m_MDBArray.AppendElement(aMDB);
5300 + void CleanUpMDB()
5302 + LPMDB mdb;
5303 + for (int i = 0; i < m_MDBArray.Count(); i++)
5305 + mdb = (LPMDB)m_MDBArray.ElementAt(i);
5306 + mdb->Release();
5308 + m_MDBArray.Clear();
5311 private :
5312 + //use to keep all openned MsgStore,if we not open a message store,we can't open any thing on it
5313 + //so we have to kill message stores openned
5314 + nsVoidArray m_MDBArray;
5317 #endif // nsMapiAddressBook_h___
5318 --- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2004-11-05 16:13:32.000000000 +0100
5319 +++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp 2008-08-14 16:22:21.000000000 +0200
5320 @@ -46,6 +46,22 @@
5322 #define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
5324 +enum
5326 + ContentsColumnEntryId = 0,
5327 + ContentsColumnObjectType,
5328 + ContentsColumnsSize
5329 +} ;
5331 +static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
5333 + ContentsColumnsSize,
5335 + PR_ENTRYID,
5336 + PR_OBJECT_TYPE
5338 +} ;
5340 HMODULE nsWabAddressBook::mLibrary = NULL ;
5341 PRInt32 nsWabAddressBook::mLibUsage = 0 ;
5342 LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
5343 @@ -94,7 +110,7 @@
5344 MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
5346 nsWabAddressBook::nsWabAddressBook(void)
5347 -: nsAbWinHelper()
5348 +: nsAbWinHelper(),mAddressBook(NULL)
5350 BOOL result = Initialize() ;
5352 @@ -109,9 +125,254 @@
5353 MOZ_COUNT_DTOR(nsWabAddressBook) ;
5356 +BOOL nsWabAddressBook::GetFolders(nsMapiEntryArray& aFolders)
5358 + aFolders.CleanUp() ;
5359 + nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
5360 + nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
5361 + ULONG objType = 0 ;
5362 + ULONG rowCount = 0 ;
5363 + SRestriction restriction ;
5364 + SPropTagArray folderColumns ;
5366 + mLastError = OpenEntry(0, NULL, NULL, 0, &objType,
5367 + rootFolder);
5368 + if (HR_FAILED(mLastError)){
5369 + PRINTF(("Cannot open root %08x.\n", mLastError));
5370 + return FALSE;
5372 + mLastError = rootFolder->GetHierarchyTable(0, folders);
5373 + if (HR_FAILED(mLastError)){
5374 + PRINTF(("Cannot get hierarchy %08x.\n", mLastError));
5375 + return FALSE;
5377 + // We only take into account modifiable containers,
5378 + // otherwise, we end up with all the directory services...
5379 + restriction.rt = RES_BITMASK ;
5380 + restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
5381 + restriction.res.resBitMask.relBMR = BMR_NEZ ;
5382 + restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
5383 + mLastError = folders->Restrict(&restriction, 0) ;
5384 + if (HR_FAILED(mLastError)) {
5385 + PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
5387 + folderColumns.cValues = 1 ;
5388 + folderColumns.aulPropTag [0] = PR_ENTRYID ;
5389 + mLastError = folders->SetColumns(&folderColumns, 0) ;
5390 + if (HR_FAILED(mLastError)) {
5391 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5392 + return FALSE ;
5394 + mLastError = folders->GetRowCount(0, &rowCount) ;
5395 + if (HR_SUCCEEDED(mLastError)) {
5396 + do {
5397 + LPSRowSet rowSet = NULL ;
5399 + rowCount = 0 ;
5400 + mLastError = folders->QueryRows(1, 0, &rowSet) ;
5401 + if (HR_SUCCEEDED(mLastError)) {
5402 + rowCount = rowSet->cRows ;
5403 + if (rowCount > 0) {
5404 + SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
5406 + aFolders.AddItem(currentValue.Value.bin.cb,
5407 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
5409 + MyFreeProws(rowSet) ;
5411 + else {
5412 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
5414 + } while (rowCount > 0) ;
5416 + return HR_SUCCEEDED(mLastError) ;
5418 +BOOL nsWabAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5419 + nsMapiEntryArray *aList, ULONG aMapiType)
5421 + if (aList) { aList->CleanUp(); }
5422 + nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
5423 + nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
5424 + ULONG objType = 0 ;
5425 + ULONG rowCount = 0 ;
5427 + mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
5428 + &IID_IMAPIContainer, 0, &objType,
5429 + parent) ;
5430 + if (HR_FAILED(mLastError)) {
5431 + PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
5432 + return FALSE ;
5434 + // Here, flags for WAB and MAPI could be different, so this works
5435 + // only as long as we don't want to use any flag in GetContentsTable
5436 + mLastError = parent->GetContentsTable(0, contents) ;
5437 + if (HR_FAILED(mLastError)) {
5438 + PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
5439 + return FALSE ;
5441 + if (aRestriction) {
5442 + mLastError = contents->Restrict(aRestriction, 0) ;
5443 + if (HR_FAILED(mLastError)) {
5444 + PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
5445 + return FALSE ;
5448 + int entryId = ContentsColumnEntryId ;
5449 + int objectType = ContentsColumnObjectType ;
5451 + if (aRestriction)
5453 + LPSPropTagArray allColumns = NULL ;
5455 + mLastError = contents->QueryColumns(TBL_ALL_COLUMNS, &allColumns) ;
5456 + if (HR_FAILED(mLastError)) {
5457 + PRINTF(("Cannot query columns %08x.\n", mLastError)) ;
5458 + return FALSE ;
5461 + for (unsigned int j = 0 ; j < allColumns->cValues ; ++ j) {
5462 + if (allColumns->aulPropTag [j] == PR_ENTRYID) {
5463 + entryId = j ;
5465 + else if (allColumns->aulPropTag [j] == PR_OBJECT_TYPE) {
5466 + objectType = j ;
5469 + mLastError = contents->SetColumns(allColumns, 0) ;
5470 + if (HR_FAILED(mLastError)) {
5471 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5472 + return FALSE ;
5474 + FreeBuffer(allColumns) ;
5476 + else
5479 + mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
5480 + if (HR_FAILED(mLastError)) {
5481 + PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
5482 + return FALSE ;
5484 + }
5486 + mLastError = contents->GetRowCount(0, &rowCount) ;
5487 + if (HR_FAILED(mLastError)) {
5488 + PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
5489 + return FALSE ;
5491 + do {
5492 + LPSRowSet rowSet = NULL ;
5494 + rowCount = 0 ;
5495 + mLastError = contents->QueryRows(1, 0, &rowSet) ;
5496 + if (HR_FAILED(mLastError)) {
5497 + PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
5498 + return FALSE ;
5500 + rowCount = rowSet->cRows ;
5501 + if (rowCount > 0 &&
5502 + (aMapiType == 0 ||
5503 + rowSet->aRow->lpProps[objectType].Value.ul == aMapiType)) {
5504 + if (aList) {
5505 + SPropValue& currentValue = rowSet->aRow->lpProps[entryId] ;
5507 + aList->AddItem(currentValue.Value.bin.cb,
5508 + NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
5512 + MyFreeProws(rowSet) ;
5513 + } while (rowCount > 0) ;
5514 + return TRUE ;
5517 +BOOL nsWabAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5518 + ULONG aNbProperties, LPSPropValue& aValue,
5519 + ULONG& aValueCount)
5521 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
5522 + IMsgStore * mdb=NULL;
5523 + ULONG objType = 0 ;
5524 + LPSPropTagArray properties = NULL ;
5525 + ULONG i = 0 ;
5527 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
5528 + &IID_IMAPIProp, 0, &objType,
5529 + object) ;
5531 + if (HR_FAILED(mLastError)){
5532 + PRINTF(("Cannot open entry %08x.\n", mLastError));
5533 + return FALSE;
5535 + AllocateBuffer(CbNewSPropTagArray(aNbProperties),
5536 + NS_REINTERPRET_CAST(void **, &properties));
5537 + properties->cValues = aNbProperties;
5538 + for (i = 0 ; i < aNbProperties ; ++ i) {
5539 + properties->aulPropTag [i] = aPropertyTags [i];
5541 + mLastError = object->GetProps(properties, 0, &aValueCount, &aValue);
5542 + FreeBuffer(properties);
5543 + if (HR_FAILED(mLastError)){
5544 + PRINTF(("Cannot get props %08x.\n", mLastError));
5546 + return HR_SUCCEEDED(mLastError) ;
5549 +BOOL nsWabAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5550 + LPSPropValue& aValues)
5552 + nsMapiInterfaceWrapper<LPMAPIPROP> object ;
5553 + ULONG objType = 0 ;
5554 + LPSPropProblemArray problems = NULL ;
5556 + mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
5557 + &IID_IMAPIProp, MAPI_MODIFY, &objType,
5558 + object) ;
5559 + if (HR_FAILED(mLastError)) {
5560 + PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
5561 + return FALSE ;
5563 + mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
5564 + if (HR_FAILED(mLastError)) {
5565 + PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
5566 + return FALSE ;
5568 + if (problems) {
5569 + for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
5570 + PRINTF(("Problem %d: index %d code %08x.\n", i,
5571 + problems->aProblem [i].ulIndex,
5572 + problems->aProblem [i].scode));
5575 + mLastError = object->SaveChanges(0) ;
5576 + if (HR_FAILED(mLastError)) {
5577 + PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
5579 + return HR_SUCCEEDED(mLastError) ;
5582 +BOOL nsWabAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
5584 + LPENTRYID entryId = NULL;
5585 + ULONG byteCount = 0;
5587 + mLastError = mAddressBook->GetPAB(&byteCount, &entryId);
5588 + if (HR_FAILED(mLastError)){
5589 + PRINTF(("Cannot get PAB %08x.\n", mLastError));
5590 + return FALSE;
5592 + aContainer.Assign(byteCount, entryId);
5593 + FreeBuffer(entryId) ;
5594 + return TRUE ;
5597 +BOOL nsWabAddressBook::IsOK(void)
5599 + return mAddressBook != NULL ;
5602 BOOL nsWabAddressBook::Initialize(void)
5604 - if (mAddressBook) { return TRUE ; }
5605 nsAutoLock guard(mMutex) ;
5607 if (!LoadWabLibrary()) {
5608 --- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2004-04-17 20:32:14.000000000 +0200
5609 +++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h 2008-08-14 16:22:21.000000000 +0200
5610 @@ -47,6 +47,15 @@
5611 nsWabAddressBook(void) ;
5612 virtual ~nsWabAddressBook(void) ;
5614 + // Get the top address books
5615 + virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
5617 + // Get a default address book container
5618 + virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
5619 + // Is the helper correctly initialised?
5620 + virtual BOOL IsOK(void);
5621 + static void FreeWabLibrary(void) ;
5623 protected :
5624 // Session and address book that will be shared by all instances
5625 // (see nsMapiAddressBook.h for details)
5626 @@ -57,15 +66,46 @@
5627 static HMODULE mLibrary ;
5628 static LPWABOPEN mWABOpen ;
5630 + LPADRBOOK mAddressBook ;
5632 // Load the WAB environment
5633 BOOL Initialize(void) ;
5635 + virtual HRESULT OpenEntry(ULONG cbEntryID,
5636 + LPENTRYID lpEntryID,
5637 + LPCIID lpInterface,
5638 + ULONG ulFlags,
5639 + ULONG FAR * lpulObjType,
5640 + LPUNKNOWN FAR * lppUnk
5643 + return mAddressBook->OpenEntry(cbEntryID,
5644 + lpEntryID,
5645 + lpInterface,
5646 + ulFlags,
5647 + lpulObjType,
5648 + lppUnk
5649 + );
5653 + // Retrieve the contents of a container, with an optional restriction
5654 + virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
5655 + nsMapiEntryArray *aList, ULONG aMapiType) ;
5656 + // Retrieve the values of a set of properties on a MAPI object
5657 + virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
5658 + ULONG aNbProperties,
5659 + LPSPropValue& aValues, ULONG& aValueCount) ;
5660 + // Set the values of a set of properties on a MAPI object
5661 + virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties,
5662 + LPSPropValue& aValues) ;
5664 // Allocation of a buffer for transmission to interfaces
5665 virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
5666 // Destruction of a buffer provided by the interfaces
5667 virtual void FreeBuffer(LPVOID aBuffer) ;
5668 // Manage the library
5669 static BOOL LoadWabLibrary(void) ;
5670 - static void FreeWabLibrary(void) ;
5672 private :
5674 --- misc/mozilla/modules/libpref/src/Makefile.in 2006-02-03 15:44:52.000000000 +0100
5675 +++ misc/build/mozilla/modules/libpref/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
5676 @@ -91,7 +91,7 @@
5677 PREF_JS_EXPORTS += $(srcdir)/init/non-shared.txt
5678 endif
5680 -EXTRA_DSO_LDOPTS = \
5681 +EXTRA_DSO_LDOPTS += \
5682 $(LIBS_DIR) \
5683 $(MOZ_JS_LIBS) \
5684 $(MOZ_COMPONENT_LIBS) \
5685 --- misc/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2005-07-20 20:31:42.000000000 +0200
5686 +++ misc/build/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp 2008-08-20 15:45:06.000000000 +0200
5687 @@ -277,7 +277,7 @@
5688 nsresult
5689 nsHttpConnectionMgr::UpdateParam(nsParamName name, PRUint16 value)
5691 - PRUint32 param = (PRUint32(name) << 16) | PRUint32(value);
5692 + PRUint32 param = (NS_PTR_TO_INT32(name) << 16) | NS_PTR_TO_INT32(value);
5693 return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0, (void *) param);
5696 --- misc/mozilla/nsprpub/build/cygwin-wrapper 2006-12-22 14:47:17.000000000 +0100
5697 +++ misc/build/mozilla/nsprpub/build/cygwin-wrapper 2008-08-14 16:22:21.000000000 +0200
5698 @@ -1,4 +1,4 @@
5699 -#!/bin/sh
5700 +#!/bin/bash
5702 # Stupid wrapper to avoid win32 dospath/cygdrive issues
5703 # Try not to spawn programs from within this file. If the stuff in here looks royally
5704 --- misc/mozilla/nsprpub/config/autoconf.mk.in 2006-12-22 14:47:17.000000000 +0100
5705 +++ misc/build/mozilla/nsprpub/config/autoconf.mk.in 2008-08-14 16:22:21.000000000 +0200
5706 @@ -22,6 +22,7 @@
5707 RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
5708 OBJDIR_NAME = @OBJDIR_NAME@
5709 OBJDIR = @OBJDIR@
5710 +LIB_PREFIX = @LIB_PREFIX@
5711 OBJ_SUFFIX = @OBJ_SUFFIX@
5712 LIB_SUFFIX = @LIB_SUFFIX@
5713 DLL_SUFFIX = @DLL_SUFFIX@
5714 --- misc/mozilla/nsprpub/config/rules.mk 2006-12-22 14:47:17.000000000 +0100
5715 +++ misc/build/mozilla/nsprpub/config/rules.mk 2008-12-12 10:09:34.437500000 +0100
5716 @@ -111,9 +111,9 @@
5717 # other platforms do not.
5719 ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
5720 -LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
5721 +LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
5722 SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
5723 -IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
5724 +IMPORT_LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
5725 SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
5726 else
5727 LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
5728 @@ -340,6 +340,10 @@
5729 else # AIX 4.1
5730 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
5731 $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
5732 + @if test -f $@.manifest; then \
5733 + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
5734 + rm -f $@.manifest; \
5735 + fi
5736 else
5737 ifeq ($(MOZ_OS2_TOOLS),VACPP)
5738 $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
5739 --- misc/mozilla/nsprpub/configure 2008-01-29 20:27:43.000000000 +0100
5740 +++ misc/build/mozilla/nsprpub/configure 2008-08-14 16:22:21.000000000 +0200
5741 @@ -2737,6 +2737,7 @@
5742 LIB_SUFFIX=a
5743 DLL_SUFFIX=so
5744 ASM_SUFFIX=s
5745 +LIB_PREFIX=lib
5746 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
5747 PR_MD_ASFILES=
5748 PR_MD_CSRCS=
5749 @@ -3475,7 +3476,7 @@
5752 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
5753 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
5754 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
5755 if test "$MOZ_OBJFORMAT" = "elf"; then
5756 DLL_SUFFIX=so
5757 else
5758 @@ -3941,7 +3942,7 @@
5759 CC="$CC -mno-cygwin"
5760 CXX="$CXX -mno-cygwin"
5761 DLL_SUFFIX=dll
5762 - MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
5763 + MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
5764 RC=$WINDRES
5765 # Use temp file for windres (bug 213281)
5766 RCFLAGS='-O coff --use-temp-file'
5767 @@ -3958,6 +3959,7 @@
5768 OBJ_SUFFIX=obj
5769 LIB_SUFFIX=lib
5770 DLL_SUFFIX=dll
5771 + LIB_PREFIX=
5773 # Determine compiler version
5774 CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
5775 @@ -5766,6 +5768,7 @@
5776 CC="\$(CYGWIN_WRAPPER) $CC"
5777 CXX="\$(CYGWIN_WRAPPER) $CXX"
5778 RC="\$(CYGWIN_WRAPPER) $RC"
5779 + LD="\$(CYGWIN_WRAPPER) $LD"
5781 esac
5783 @@ -6127,6 +6130,7 @@
5784 s%@LIB_SUFFIX@%$LIB_SUFFIX%g
5785 s%@DLL_SUFFIX@%$DLL_SUFFIX%g
5786 s%@ASM_SUFFIX@%$ASM_SUFFIX%g
5787 +s%@LIB_PREFIX@%$LIB_PREFIX%g
5788 s%@MKSHLIB@%$MKSHLIB%g
5789 s%@DSO_CFLAGS@%$DSO_CFLAGS%g
5790 s%@DSO_LDOPTS@%$DSO_LDOPTS%g
5791 --- misc/mozilla/nsprpub/configure.in 2008-01-29 20:27:44.000000000 +0100
5792 +++ misc/build/mozilla/nsprpub/configure.in 2008-08-14 16:22:21.000000000 +0200
5793 @@ -1137,7 +1137,7 @@
5794 AC_DEFINE(HAVE_BSD_FLOCK)
5795 AC_DEFINE(HAVE_SOCKLEN_T)
5796 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
5797 - MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
5798 + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
5799 if test "$MOZ_OBJFORMAT" = "elf"; then
5800 DLL_SUFFIX=so
5801 else
5802 --- misc/mozilla/nsprpub/lib/ds/Makefile.in 2006-12-22 14:47:17.000000000 +0100
5803 +++ misc/build/mozilla/nsprpub/lib/ds/Makefile.in 2008-08-14 16:22:21.000000000 +0200
5804 @@ -79,18 +79,22 @@
5805 OS_LIBS = -lc
5806 endif
5808 +ifeq ($(OS_ARCH),Linux)
5809 +MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5810 +endif
5812 ifeq ($(OS_ARCH),SunOS)
5813 OS_LIBS = -lc
5814 MAPFILE = $(OBJDIR)/pldsmap.sun
5815 GARBAGE += $(MAPFILE)
5816 ifdef NS_USE_GCC
5817 ifdef GCC_USE_GNU_LD
5818 -MKSHLIB += -Wl,--version-script,$(MAPFILE)
5819 +MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5820 else
5821 -MKSHLIB += -Wl,-M,$(MAPFILE)
5822 +MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
5823 endif
5824 else
5825 -MKSHLIB += -M $(MAPFILE)
5826 +MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
5827 endif
5828 # The -R '$ORIGIN' linker option instructs this library to search for its
5829 # dependencies in the same directory where it resides.
5830 --- misc/mozilla/nsprpub/lib/libc/src/Makefile.in 2006-12-22 14:47:17.000000000 +0100
5831 +++ misc/build/mozilla/nsprpub/lib/libc/src/Makefile.in 2008-08-14 16:22:21.000000000 +0200
5832 @@ -89,18 +89,22 @@
5833 OS_LIBS = -lc
5834 endif
5836 +ifeq ($(OS_ARCH),Linux)
5837 +MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5838 +endif
5840 ifeq ($(OS_ARCH),SunOS)
5841 OS_LIBS = -lc
5842 MAPFILE = $(OBJDIR)/plcmap.sun
5843 GARBAGE += $(MAPFILE)
5844 ifdef NS_USE_GCC
5845 ifdef GCC_USE_GNU_LD
5846 -MKSHLIB += -Wl,--version-script,$(MAPFILE)
5847 +MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5848 else
5849 -MKSHLIB += -Wl,-M,$(MAPFILE)
5850 +MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
5851 endif
5852 else
5853 -MKSHLIB += -M $(MAPFILE)
5854 +MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
5855 endif
5856 # The -R '$ORIGIN' linker option instructs this library to search for its
5857 # dependencies in the same directory where it resides.
5858 --- misc/mozilla/nsprpub/pr/src/misc/prnetdb.c 2006-12-22 14:47:27.000000000 +0100
5859 +++ misc/build/mozilla/nsprpub/pr/src/misc/prnetdb.c 2008-08-14 16:22:21.000000000 +0200
5860 @@ -113,7 +113,8 @@
5861 #define _PR_HAVE_5_ARG_GETPROTO_R
5862 #endif
5864 -#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
5865 +#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) || \
5866 + (defined(__FreeBSD__) && __FreeBSD_version > 601103)
5867 #define _PR_HAVE_GETPROTO_R
5868 #define _PR_HAVE_5_ARG_GETPROTO_R
5869 #endif
5870 --- misc/mozilla/security/coreconf/FreeBSD.mk 2006-12-22 14:48:06.000000000 +0100
5871 +++ misc/build/mozilla/security/coreconf/FreeBSD.mk 2008-08-14 16:22:21.000000000 +0200
5872 @@ -65,7 +65,7 @@
5874 ARCH = freebsd
5876 -MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
5877 +MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
5879 ifeq ($(MOZ_OBJFORMAT),elf)
5880 DLL_SUFFIX = so
5881 --- misc/mozilla/security/coreconf/Linux.mk 2006-12-22 14:48:06.000000000 +0100
5882 +++ misc/build/mozilla/security/coreconf/Linux.mk 2008-08-18 10:16:15.000000000 +0200
5883 @@ -139,7 +139,7 @@
5885 ifeq ($(OS_RELEASE),2.0)
5886 OS_REL_CFLAGS += -DLINUX2_0
5887 - MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
5888 + MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
5889 ifdef MAPFILE
5890 MKSHLIB += -Wl,--version-script,$(MAPFILE)
5891 endif
5892 @@ -166,6 +166,7 @@
5894 DSO_CFLAGS = -fPIC
5895 DSO_LDOPTS = -shared $(ARCHFLAG)
5896 +DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5897 DSO_LDFLAGS =
5898 LDFLAGS += $(ARCHFLAG)
5900 --- misc/mozilla/security/coreconf/SunOS5.mk 2008-06-16 00:22:15.000000000 +0200
5901 +++ misc/build/mozilla/security/coreconf/SunOS5.mk 2008-08-14 16:22:21.000000000 +0200
5902 @@ -161,12 +161,14 @@
5904 # ld options:
5905 # -G: produce a shared object
5906 +# -R '$ORIGIN': search for dependencies in same directory
5907 # -z defs: no unresolved symbols allowed
5908 ifdef NS_USE_GCC
5909 ifeq ($(USE_64), 1)
5910 DSO_LDOPTS += -m64
5911 endif
5912 DSO_LDOPTS += -shared -h $(notdir $@)
5913 + DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
5914 else
5915 ifeq ($(USE_64), 1)
5916 ifeq ($(OS_TEST),i86pc)
5917 @@ -176,6 +178,7 @@
5918 endif
5919 endif
5920 DSO_LDOPTS += -G -h $(notdir $@)
5921 + DSO_LDOPTS += -R '$$ORIGIN'
5922 endif
5923 DSO_LDOPTS += -z combreloc -z defs -z ignore
5925 --- misc/mozilla/security/coreconf/WIN32.mk 2008-06-16 00:22:15.000000000 +0200
5926 +++ misc/build/mozilla/security/coreconf/WIN32.mk 2008-08-18 16:04:59.000000000 +0200
5927 @@ -43,24 +43,24 @@
5928 DEFAULT_COMPILER = cl
5930 ifdef NS_USE_GCC
5931 - CC = gcc
5932 - CCC = g++
5933 - LINK = ld
5934 - AR = ar
5935 + CC = $(CYGWIN_WRAPPER) gcc
5936 + CCC = $(CYGWIN_WRAPPER) g++
5937 + LINK = $(CYGWIN_WRAPPER) ld
5938 + AR = $(CYGWIN_WRAPPER) ar
5939 AR += cr $@
5940 - RANLIB = ranlib
5941 + RANLIB = $(CYGWIN_WRAPPER) ranlib
5942 BSDECHO = echo
5943 - RC = windres.exe -O coff --use-temp-file
5944 - LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
5945 + RC = $(CYGWIN_WRAPPER) windres.exe -O coff --use-temp-file
5946 + LINK_DLL = $(CYGWIN_WRAPPER) $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
5947 else
5948 - CC = cl
5949 - CCC = cl
5950 - LINK = link
5951 - AR = lib
5952 + CC = $(CYGWIN_WRAPPER) cl
5953 + CCC = $(CYGWIN_WRAPPER) cl
5954 + LINK = $(CYGWIN_WRAPPER) link
5955 + AR = $(CYGWIN_WRAPPER) lib
5956 AR += -NOLOGO -OUT:"$@"
5957 RANLIB = echo
5958 BSDECHO = echo
5959 - RC = rc.exe
5960 + RC = $(CYGWIN_WRAPPER) rc.exe
5961 MT = mt.exe
5962 endif
5964 @@ -69,7 +69,7 @@
5965 else
5966 NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
5967 endif
5968 -NSINSTALL = nsinstall
5969 +NSINSTALL = $(CYGWIN_WRAPPER) nsinstall
5971 MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
5972 MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
5973 @@ -95,7 +95,7 @@
5974 # dllimport cannot be used as as a constant address.
5975 OS_CFLAGS += -mno-cygwin -mms-bitfields -mnop-fun-dllimport
5976 _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
5977 - DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
5978 + DLLFLAGS += -mno-cygwin -o $@ -shared -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
5979 ifdef BUILD_OPT
5980 OPTIMIZER += -O2
5981 DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
5982 --- misc/mozilla/security/coreconf/WIN954.0.mk 2008-06-16 00:22:15.000000000 +0200
5983 +++ misc/build/mozilla/security/coreconf/WIN954.0.mk 2008-08-14 16:22:21.000000000 +0200
5984 @@ -72,3 +72,7 @@
5985 endif
5986 endif
5987 DEFINES += -DWIN95
5989 +ifdef NS_USE_GCC
5990 +NSPR31_LIB_PREFIX = lib
5991 +endif
5992 --- misc/mozilla/security/coreconf/command.mk 2008-06-16 00:22:15.000000000 +0200
5993 +++ misc/build/mozilla/security/coreconf/command.mk 2008-08-19 09:58:11.000000000 +0200
5994 @@ -45,7 +45,7 @@
5995 CCF = $(CC) $(CFLAGS)
5996 LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
5997 LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
5998 -CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
5999 +CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
6000 $(XCFLAGS)
6001 PERL = perl
6002 RANLIB = echo
6003 --- misc/mozilla/security/coreconf/rules.mk 2008-06-16 00:22:15.000000000 +0200
6004 +++ misc/build/mozilla/security/coreconf/rules.mk 2008-08-19 10:46:57.000000000 +0200
6005 @@ -284,7 +284,7 @@
6006 $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
6007 @$(MAKE_OBJDIR)
6008 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
6009 - $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
6010 + $(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
6011 ifdef MT
6012 if test -f $@.manifest; then \
6013 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
6014 @@ -305,11 +305,7 @@
6015 $(LIBRARY): $(OBJS)
6016 @$(MAKE_OBJDIR)
6017 rm -f $@
6018 -ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
6019 - $(AR) $(subst /,\\,$(OBJS))
6020 -else
6021 $(AR) $(OBJS)
6022 -endif
6023 $(RANLIB) $@
6026 @@ -344,7 +340,7 @@
6027 ifdef NS_USE_GCC
6028 $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
6029 else
6030 - $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
6031 + $(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
6032 ifdef MT
6033 if test -f $@.manifest; then \
6034 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
6035 @@ -429,15 +425,15 @@
6036 endif
6037 endif
6039 -core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
6040 +mozabspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
6042 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
6043 @$(MAKE_OBJDIR)
6044 ifdef USE_NT_C_SYNTAX
6045 - $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6046 + $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6047 else
6048 ifdef NEED_ABSOLUTE_PATH
6049 - $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6050 + $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6051 else
6052 $(CC) -o $@ -c $(CFLAGS) $<
6053 endif
6054 @@ -445,10 +441,10 @@
6056 $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
6057 ifdef USE_NT_C_SYNTAX
6058 - $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6059 + $(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6060 else
6061 ifdef NEED_ABSOLUTE_PATH
6062 - $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6063 + $(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6064 else
6065 $(CC) -o $@ -c $(CFLAGS) $<
6066 endif
6067 @@ -477,10 +473,10 @@
6068 $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
6069 @$(MAKE_OBJDIR)
6070 ifdef USE_NT_C_SYNTAX
6071 - $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6072 + $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6073 else
6074 ifdef NEED_ABSOLUTE_PATH
6075 - $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6076 + $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6077 else
6078 $(CCC) -o $@ -c $(CFLAGS) $<
6079 endif
6080 @@ -501,10 +497,10 @@
6081 rm -f $(OBJDIR)/t_$*.cc
6082 else
6083 ifdef USE_NT_C_SYNTAX
6084 - $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
6085 + $(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
6086 else
6087 ifdef NEED_ABSOLUTE_PATH
6088 - $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
6089 + $(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
6090 else
6091 $(CCC) -o $@ -c $(CFLAGS) $<
6092 endif
6093 --- misc/mozilla/security/manager/Makefile.in 2008-06-16 00:23:29.000000000 +0200
6094 +++ misc/build/mozilla/security/manager/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6095 @@ -123,8 +123,11 @@
6096 ifdef CYGDRIVE_MOUNT
6097 ABS_DIST := $(shell cygpath -w $(ABS_DIST) | sed -e 's|\\|/|g')
6098 endif
6099 +ifneq (,$(filter cygwin%,$(host_os)))
6100 +ABS_DIST := $(shell cygpath -u $(ABS_DIST))
6101 +endif
6102 ifneq (,$(filter mingw%,$(host_os)))
6103 -ABS_DIST := $(shell cd $(DIST) && pwd -W)
6104 +ABS_DIST := $(shell cygpath -u $(ABS_DIST))
6105 endif
6106 endif
6107 NSPR_INCLUDE_DIR = $(firstword $(filter -I%,$(NSPR_CFLAGS)))
6108 @@ -172,6 +175,7 @@
6109 endif
6110 ifeq ($(OS_ARCH),WINNT)
6111 DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
6112 +DEFAULT_GMAKE_FLAGS += CYGWIN_WRAPPER=@CYGWIN_WRAPPER@
6113 ifdef MOZ_DEBUG
6114 ifndef MOZ_NO_DEBUG_RTL
6115 DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
6116 --- misc/mozilla/security/nss/cmd/shlibsign/Makefile 2007-02-16 03:16:24.000000000 +0100
6117 +++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile 2009-02-12 15:42:13.033408000 +0100
6118 @@ -86,17 +86,42 @@
6120 include ../platrules.mk
6122 -SRCDIR = $(call core_abspath,.)
6124 +ifeq ($(OS_TARGET), Darwin)
6125 + SRCDIR = .
6126 +else
6127 +ifeq ($(OS_TARGET), Linux)
6128 + SRCDIR = .
6129 +else
6130 + SRCDIR = .
6131 +endif
6132 +endif
6133 %.chk: %.$(DLL_SUFFIX)
6134 ifeq ($(OS_TARGET), OS2)
6135 cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
6136 $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
6137 $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
6138 else
6139 - cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
6140 - $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
6141 - $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
6142 +ifeq ($(OS_TARGET), WIN95)
6143 + cd $(SRCDIR) ; sh $(CYGWIN_WRAPPER) ./sign.sh $(DIST) \
6144 + $(OBJDIR) $(OS_TARGET) \
6145 + $(NSPR_LIB_DIR) $<
6146 +else
6147 +ifeq ($(OS_TARGET), Darwin)
6148 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6149 + $(OBJDIR) $(OS_TARGET) \
6150 + $(NSPR_LIB_DIR) $<
6151 +else
6152 +ifeq ($(OS_TARGET), Linux)
6153 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6154 + $(OBJDIR) $(OS_TARGET) \
6155 + $(NSPR_LIB_DIR) $<
6156 +else
6157 + cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
6158 + $(OBJDIR) $(OS_TARGET) \
6159 + $(NSPR_LIB_DIR) $<
6160 +endif
6161 +endif
6162 +endif
6163 endif
6165 libs install :: $(CHECKLOC)
6166 --- misc/mozilla/security/nss/lib/ckfw/builtins/config.mk 2005-01-20 03:25:46.000000000 +0100
6167 +++ misc/build/mozilla/security/nss/lib/ckfw/builtins/config.mk 2008-08-14 16:22:21.000000000 +0200
6168 @@ -63,9 +63,4 @@
6169 DSO_LDOPTS = -bundle
6170 endif
6172 -ifeq ($(OS_TARGET),SunOS)
6173 -# The -R '$ORIGIN' linker option instructs this library to search for its
6174 -# dependencies in the same directory where it resides.
6175 -MKSHLIB += -R '$$ORIGIN'
6176 -endif
6178 --- misc/mozilla/security/nss/lib/freebl/Makefile 2008-06-16 00:22:09.000000000 +0200
6179 +++ misc/build/mozilla/security/nss/lib/freebl/Makefile 2008-08-18 14:31:08.000000000 +0200
6180 @@ -199,10 +199,6 @@
6181 endif
6183 ifeq ($(OS_TARGET),SunOS)
6185 -# The -R '$ORIGIN' linker option instructs this library to search for its
6186 -# dependencies in the same directory where it resides.
6187 -MKSHLIB += -R '$$ORIGIN'
6188 ifdef NS_USE_GCC
6189 ifdef GCC_USE_GNU_LD
6190 MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text
6191 @@ -210,7 +206,7 @@
6192 MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text
6193 endif # GCC_USE_GNU_LD
6194 else
6195 - MKSHLIB += -B symbolic -z now -z text
6196 + MKSHLIB += -z now -z text
6197 endif # NS_USE_GCC
6199 # Sun's WorkShop defines v8, v8plus and v9 architectures.
6200 --- misc/mozilla/security/nss/lib/nss/config.mk 2006-12-22 14:47:56.000000000 +0100
6201 +++ misc/build/mozilla/security/nss/lib/nss/config.mk 2008-08-19 17:07:42.000000000 +0200
6202 @@ -113,12 +113,10 @@
6203 # The -R '$ORIGIN' linker option instructs this library to search for its
6204 # dependencies in the same directory where it resides.
6205 ifeq ($(USE_64), 1)
6206 -MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
6207 +DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
6208 else
6209 -MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
6210 +DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
6211 endif
6212 -else
6213 -MKSHLIB += -R '$$ORIGIN'
6214 endif
6215 endif
6217 @@ -127,9 +125,9 @@
6218 # pa-risc
6219 ifeq ($(USE_64), 1)
6220 MKSHLIB += +b '$$ORIGIN'
6221 -endif
6222 -endif
6223 -endif
6224 +endif # USE_64
6225 +endif # OS_TEST
6226 +endif # OS_ARCH
6228 ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
6229 ifndef NS_USE_GCC
6230 --- misc/mozilla/security/nss/lib/nss/nss.def 2008-06-16 00:22:10.000000000 +0200
6231 +++ misc/build/mozilla/security/nss/lib/nss/nss.def 2008-08-14 16:22:21.000000000 +0200
6232 @@ -61,6 +61,7 @@
6233 CERT_CheckCertValidTimes;
6234 CERT_CreateCertificateRequest;
6235 CERT_ChangeCertTrust;
6236 +CERT_DecodeDERCertificate;
6237 CERT_DecodeDERCrl;
6238 CERT_DestroyCertificateRequest;
6239 CERT_DestroyCertList;
6240 --- misc/mozilla/security/nss/lib/smime/config.mk 2006-12-22 14:48:00.000000000 +0100
6241 +++ misc/build/mozilla/security/nss/lib/smime/config.mk 2008-08-19 17:01:53.000000000 +0200
6242 @@ -92,8 +92,3 @@
6243 ../pkcs7 \
6244 $(NULL)
6246 -ifeq ($(OS_TARGET),SunOS)
6247 -# The -R '$ORIGIN' linker option instructs this library to search for its
6248 -# dependencies in the same directory where it resides.
6249 -MKSHLIB += -R '$$ORIGIN'
6250 -endif
6251 --- misc/mozilla/security/nss/lib/softoken/config.mk 2006-12-22 14:48:00.000000000 +0100
6252 +++ misc/build/mozilla/security/nss/lib/softoken/config.mk 2008-08-20 10:36:17.000000000 +0200
6253 @@ -87,13 +87,6 @@
6254 $(NULL)
6255 endif
6257 -ifeq ($(OS_TARGET),SunOS)
6258 -# The -R '$ORIGIN' linker option instructs this library to search for its
6259 -# dependencies in the same directory where it resides.
6260 -MKSHLIB += -R '$$ORIGIN'
6261 -OS_LIBS += -lbsm
6262 -endif
6264 ifeq ($(OS_TARGET),WINCE)
6265 DEFINES += -DDBM_USING_NSPR
6266 endif
6267 --- misc/mozilla/security/nss/lib/ssl/config.mk 2008-06-16 00:22:12.000000000 +0200
6268 +++ misc/build/mozilla/security/nss/lib/ssl/config.mk 2008-08-19 17:03:03.000000000 +0200
6269 @@ -116,13 +116,6 @@
6270 EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib
6271 endif
6273 -ifeq ($(OS_TARGET),SunOS)
6274 -# The -R '$ORIGIN' linker option instructs this library to search for its
6275 -# dependencies in the same directory where it resides.
6276 -MKSHLIB += -R '$$ORIGIN'
6277 -#EXTRA_SHARED_LIBS += -ldl -lrt -lc -z defs
6278 -endif
6280 endif
6282 # indicates dependency on freebl static lib
6283 --- misc/mozilla/webshell/tests/viewer/Makefile.in 2006-06-17 18:27:10.000000000 +0200
6284 +++ misc/build/mozilla/webshell/tests/viewer/Makefile.in 2008-08-14 16:22:21.000000000 +0200
6285 @@ -181,7 +181,7 @@
6286 GTK_LIBS = unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS)
6288 XP_DIST_DEP_LIBS := $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS))
6289 -XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(LIB_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
6290 +XP_DIST_DEP_LIBS := $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(DLL_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
6292 EXTRA_DEPS = \
6293 $(XP_DIST_DEP_LIBS) \
6294 --- misc/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2004-04-18 16:18:20.000000000 +0200
6295 +++ misc/build/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h 2008-08-14 16:22:21.000000000 +0200
6296 @@ -132,7 +132,7 @@
6299 PRBool IsArray() const
6300 - {return (PRBool) TagPart() == T_ARRAY;}
6301 + {return (PRBool) (TagPart() == T_ARRAY);}
6303 // 'Dependent' means that params of this type are dependent upon other
6304 // params. e.g. an T_INTERFACE_IS is dependent upon some other param at
6305 @@ -152,7 +152,7 @@
6306 uint8 TagPart() const
6307 {return (uint8) (flags & XPT_TDP_TAGMASK);}
6309 - enum
6310 + enum _xpttype
6312 T_I8 = TD_INT8 ,
6313 T_I16 = TD_INT16 ,
6314 --- misc/mozilla/xpfe/bootstrap/Makefile.in 2007-10-08 21:09:58.000000000 +0200
6315 +++ misc/build/mozilla/xpfe/bootstrap/Makefile.in 2008-08-18 14:10:04.000000000 +0200
6316 @@ -115,11 +115,14 @@
6318 include $(topsrcdir)/config/config.mk
6320 +# reduce prerequisites by disabling mozilla binary
6321 +ifndef DISABLE_MOZ_EXECUTABLE
6322 ifeq ($(USE_SHORT_LIBNAME),1)
6323 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
6324 else
6325 PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
6326 endif
6327 +endif
6329 # Force applications to be built non-statically
6330 # when building the mozcomps meta component
6331 @@ -491,6 +494,7 @@
6332 APP_NAME = $(MOZ_APP_DISPLAYNAME)
6333 endif
6335 +ifdef PROGRAM
6336 libs:: $(PROGRAM)
6337 mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
6338 rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app
6339 @@ -505,6 +509,7 @@
6340 rsync -a --copy-unsafe-links $(DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
6341 cp -RL $(DIST)/package/mozillaSuite.rsrc $(DIST)/$(APP_NAME).app/Contents/Resources/$(PROGRAM).rsrc
6342 echo -n APPLMOZZ > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
6343 +endif
6345 clean clobber::
6346 rm -rf $(DIST)/$(APP_NAME).app