1
=== modified file 'configure.ac'
2
--- old/configure.ac 2010-09-27 10:28:11 +0000
3
+++ new/configure.ac 2011-01-25 18:44:56 +0000
7
dnl ****************************
8
+dnl Check for MAPIInitialize function with two params
9
+dnl ****************************
10
+AC_MSG_CHECKING([libmapi MAPIInitialize function with two params])
11
+save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
12
+save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
13
+AC_LINK_IFELSE([AC_LANG_PROGRAM(
14
+ [[#include <libmapi/libmapi.h>]],
15
+ [[MAPIInitialize (NULL, NULL)]])],
16
+ [AC_DEFINE(HAVE_LIBMAPI_CONTEXT_PARAM, 1, [libmapi uses context parameters]) ac_cv_have_lcp=yes],[ac_cv_have_lcp=no])
19
+AC_MSG_RESULT([$ac_cv_have_lcp])
21
+dnl ****************************
22
dnl Expose version information
23
dnl ****************************
24
API_VERSION=$EDS_PACKAGE
26
=== modified file 'src/libexchangemapi/exchange-mapi-connection.c'
27
--- old/src/libexchangemapi/exchange-mapi-connection.c 2010-10-19 10:33:25 +0000
28
+++ new/src/libexchangemapi/exchange-mapi-connection.c 2011-01-25 19:24:59 +0000
30
g_propagate_error (perror, error);
33
+#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
34
+struct mapi_context *mapi_ctx = NULL;
37
typedef struct _ExchangeMapiConnectionPrivate ExchangeMapiConnectionPrivate;
39
struct _ExchangeMapiConnectionPrivate {
40
@@ -2808,7 +2812,11 @@
42
mapi_object_init(&obj_folder_src);
43
mapi_object_init(&obj_folder_dst);
44
- mapi_id_array_init(&msg_id_array);
45
+ mapi_id_array_init (
46
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
51
for (l = mid_list; l != NULL; l = g_slist_next (l))
52
mapi_id_array_add_id (&msg_id_array, *((mapi_id_t *)l->data));
53
@@ -3602,7 +3610,11 @@
57
- ms = MAPIInitialize (profpath);
58
+ ms = MAPIInitialize (
59
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
63
if (ms == MAPI_E_SESSION_LIMIT) {
64
/* do nothing, the profile store is already initialized */
65
/* but this shouldn't happen */
66
@@ -3664,15 +3676,31 @@
67
/* Initialize libmapi logger*/
68
if (g_getenv ("MAPI_DEBUG")) {
69
debug_log_level = atoi (g_getenv ("MAPI_DEBUG"));
70
- SetMAPIDumpData(TRUE);
71
- SetMAPIDebugLevel(debug_log_level);
73
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
78
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
84
g_debug("Loading profile %s ", profname);
86
- ms = MapiLogonEx (&session, profname, password);
88
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
91
+ &session, profname, password);
92
if (ms == MAPI_E_NOT_FOUND && try_create_profile (profname, password))
93
- ms = MapiLogonEx (&session, profname, password);
95
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
98
+ &session, profname, password);
100
if (ms != MAPI_E_SUCCESS) {
101
make_mapi_error (perror, "MapiLogonEx", ms);
102
@@ -3717,34 +3745,60 @@
103
profname = exchange_mapi_util_profile_name (username, domain, server, TRUE);
105
/* Delete any existing profiles with the same profilename */
106
- ms = DeleteProfile (profname);
107
+ ms = DeleteProfile (
108
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
112
/* don't bother to check error - it would be valid if we got an error */
114
- ms = CreateProfile (profname, username, password, OC_PROFILE_NOPASSWORD);
115
+ ms = CreateProfile (
116
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
119
+ profname, username, password, OC_PROFILE_NOPASSWORD);
120
if (ms != MAPI_E_SUCCESS) {
121
make_mapi_error (perror, "CreateProfile", ms);
125
- mapi_profile_add_string_attr(profname, "binding", server);
126
- mapi_profile_add_string_attr(profname, "workstation", workstation);
127
- mapi_profile_add_string_attr(profname, "domain", domain);
128
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
129
+ #define add_string_attr(_prof,_aname,_val) \
130
+ mapi_profile_add_string_attr (mapi_ctx, _prof, _aname, _val)
132
+ #define add_string_attr(_prof,_aname,_val) \
133
+ mapi_profile_add_string_attr (_prof, _aname, _val)
136
+ add_string_attr (profname, "binding", server);
137
+ add_string_attr (profname, "workstation", workstation);
138
+ add_string_attr (profname, "domain", domain);
140
if ((flags & CREATE_PROFILE_FLAG_USE_SSL) != 0)
141
- mapi_profile_add_string_attr (profname, "seal", "true");
142
+ add_string_attr (profname, "seal", "true");
144
/* This is only convenient here and should be replaced at some point */
145
- mapi_profile_add_string_attr(profname, "codepage", "0x4e4");
146
- mapi_profile_add_string_attr(profname, "language", "0x409");
147
- mapi_profile_add_string_attr(profname, "method", "0x409");
148
+ add_string_attr (profname, "codepage", "0x4e4");
149
+ add_string_attr (profname, "language", "0x409");
150
+ add_string_attr (profname, "method", "0x409");
152
+ #undef add_string_attr
155
g_debug("Logging into the server... ");
156
- ms = MapiLogonProvider (&session, profname, password, PROVIDER_ID_NSPI);
157
+ ms = MapiLogonProvider (
158
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
161
+ &session, profname, password, PROVIDER_ID_NSPI);
162
if (ms != MAPI_E_SUCCESS) {
163
make_mapi_error (perror, "MapiLogonProvider", ms);
164
g_debug ("Deleting profile %s ", profname);
165
- DeleteProfile (profname);
167
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
173
g_debug("MapiLogonProvider : succeeded \n");
174
@@ -3753,7 +3807,11 @@
175
if (ms != MAPI_E_SUCCESS) {
176
make_mapi_error (perror, "ProcessNetworkProfile", ms);
177
g_debug ("Deleting profile %s ", profname);
178
- DeleteProfile (profname);
180
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
186
g_debug("ProcessNetworkProfile : succeeded \n");
187
@@ -3807,7 +3865,11 @@
189
g_debug ("Deleting profile %s ", profile);
191
- ms = DeleteProfile (profile);
192
+ ms = DeleteProfile (
193
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
197
if (ms == MAPI_E_SUCCESS) {
200
@@ -3820,4 +3882,21 @@
205
+exchange_mapi_rename_profile (const gchar *old_name, const gchar *new_name)
207
+ g_return_if_fail (old_name != NULL);
208
+ g_return_if_fail (new_name != NULL);
210
+ g_static_rec_mutex_lock (&profile_mutex);
213
+ #ifdef HAVE_LIBMAPI_CONTEXT_PARAM
216
+ old_name, new_name);
218
+ g_static_rec_mutex_unlock (&profile_mutex);
221
/* profile related functions - end */
223
=== modified file 'src/libexchangemapi/exchange-mapi-connection.h'
224
--- old/src/libexchangemapi/exchange-mapi-connection.h 2010-08-02 22:02:21 +0000
225
+++ new/src/libexchangemapi/exchange-mapi-connection.h 2011-01-25 18:44:56 +0000
227
mapi_profile_callback_t cb, gpointer data, GError **perror);
229
gboolean exchange_mapi_delete_profile (const gchar *profile, GError **perror);
230
+void exchange_mapi_rename_profile (const gchar *old_name, const gchar *new_name);
232
/* utility functions */
235
=== modified file 'src/libexchangemapi/exchange-mapi-utils.c'
236
--- old/src/libexchangemapi/exchange-mapi-utils.c 2010-11-02 17:03:41 +0000
237
+++ new/src/libexchangemapi/exchange-mapi-utils.c 2011-01-25 18:44:56 +0000
239
old_name = g_strdup_printf ("%s@%s", username, domain);
240
old_name = g_strcanon (old_name, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@", '_');
242
- RenameProfile (old_name, res);
243
+ exchange_mapi_rename_profile (old_name, res);