evolution-mapi r12 - in trunk/src: calendar libexchangemapi



Author: jkerihuel
Date: Sun Nov 23 15:35:19 2008
New Revision: 12
URL: http://svn.gnome.org/viewvc/evolution-mapi?rev=12&view=rev

Log:
- This commit makes evolution-mapi work with libmapi-0.8 latest trunk revision
- exchange_mapi_util_ex_to_smtp temporarily moved to exchange-mapi-connection.c
  to use global_mapi_session
- various g_byte_array_append cast warnings fixed

Note: the current commit breaks the "set recipients" related routines and will
be fixed in a further commit.



Modified:
   trunk/src/calendar/e-cal-backend-mapi.c
   trunk/src/libexchangemapi/exchange-mapi-cal-recur-utils.c
   trunk/src/libexchangemapi/exchange-mapi-cal-tz-utils.c
   trunk/src/libexchangemapi/exchange-mapi-cal-tz-utils.h
   trunk/src/libexchangemapi/exchange-mapi-cal-utils.c
   trunk/src/libexchangemapi/exchange-mapi-cal-utils.h
   trunk/src/libexchangemapi/exchange-mapi-connection.c
   trunk/src/libexchangemapi/exchange-mapi-utils.c
   trunk/src/libexchangemapi/exchange-mapi-utils.h

Modified: trunk/src/calendar/e-cal-backend-mapi.c
==============================================================================
--- trunk/src/calendar/e-cal-backend-mapi.c	(original)
+++ trunk/src/calendar/e-cal-backend-mapi.c	Sun Nov 23 15:35:19 2008
@@ -1225,8 +1225,8 @@
 	ui32 = (const uint32_t *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_LONG, 0x8201));
 	if (ui32)
 		cbdata->appt_seq = *ui32;
-	cbdata->cleanglobalid = (const struct SBinary *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0023));
-	cbdata->globalid = (const struct SBinary *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0003));
+	cbdata->cleanglobalid = (const struct Binary_r *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0023));
+	cbdata->globalid = (const struct Binary_r *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0003));
 	cbdata->username = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME);
 	cbdata->useridtype = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
 	cbdata->userid = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
@@ -1245,7 +1245,7 @@
 	mapi_id_t mid;
 	struct mapi_SRestriction res;
 	struct SPropValue sprop;
-	struct SBinary sb;
+	struct Binary_r sb;
 	uint32_t proptag = 0x0;
 	struct SPropTagArray *array;
 
@@ -1293,7 +1293,7 @@
 	GSList *attachments = NULL;
 	GSList *streams = NULL;
 	struct cbdata cbdata;
-	struct SBinary globalid;
+	struct Binary_r globalid;
 
 	cbmapi = E_CAL_BACKEND_MAPI (backend);
 	priv = cbmapi->priv;

Modified: trunk/src/libexchangemapi/exchange-mapi-cal-recur-utils.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-cal-recur-utils.c	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-cal-recur-utils.c	Sun Nov 23 15:35:19 2008
@@ -235,7 +235,7 @@
 	guint32 flag32;
 	guint8 *ptr = ba->data;
 	gint i;
-	GSList *exdate_list = NULL, *modified_list = NULL; 
+	GSList *exdate_list = NULL;
 	gboolean repeats_until_date = FALSE; 
 
 	icalrecurrencetype_clear (&rt);
@@ -830,63 +830,63 @@
 
 	/* Reader Version */
 	flag16 = READER_VERSION;
-	ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 	/* Writer Version */
 	flag16 = WRITER_VERSION;
-	ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 	if (rt->freq == ICAL_DAILY_RECURRENCE) {
 		flag16 = RecurFrequency_Daily;
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* Pattern Type - it would be PatternType_Day since we have only "Daily every N days" 
 		 * The other type would be parsed as a weekly recurrence. 
 		 */
 		flag16 = PatternType_Day;
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* Calendar Type */
 		flag16 = CAL_DEFAULT; 
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* FirstDateTime */
 		flag32 = compute_rdaily_firstdatetime (comp, (rt->interval * (60 * 24)));
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* INTERVAL */
 		flag32 = (rt->interval * (60 * 24)); 
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* This would be 0 for the stuff we handle */
 		flag32 = 0x0;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* No PatternTypeSpecific for PatternType_Day */
 
 	} else if (rt->freq == ICAL_WEEKLY_RECURRENCE) {
 		flag16 = RecurFrequency_Weekly;
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* Pattern Type - it would be PatternType_Week since we don't support any other type. */
 		flag16 = PatternType_Week;
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* Calendar Type */
 		flag16 = CAL_DEFAULT; 
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* FirstDateTime */
 		flag32 = compute_rweekly_firstdatetime (comp, rt->week_start, (rt->interval * (60 * 24 * 7)));
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* INTERVAL */
 		flag32 = rt->interval; 
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* This would be 0 for the stuff we handle */
 		flag32 = 0x0;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* BITMASK */
 		for (flag32 = 0x0, i = 0; i < ICAL_BY_DAY_SIZE; ++i) {
@@ -907,13 +907,13 @@
 			else 
 				break; 
 		}
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	} else if (rt->freq == ICAL_MONTHLY_RECURRENCE) {
 		guint16 pattern = 0x0; guint32 mask = 0x0, flag = 0x0; 
 
 		flag16 = RecurFrequency_Monthly;
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		if (rt->by_month_day[0] >= 1 && rt->by_month_day[0] <= 31) {
 			pattern = PatternType_Month;
@@ -930,36 +930,36 @@
 
 		/* Pattern Type */
 		flag16 = pattern;
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* Calendar Type */
 		flag16 = CAL_DEFAULT; 
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* FirstDateTime */
 		flag32 = compute_rmonthly_firstdatetime (comp, rt->interval);
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* INTERVAL */
 		flag32 = rt->interval; 
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* This would be 0 for the stuff we handle */
 		flag32 = 0x0;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		if (pattern == PatternType_Month) {
 			flag32 = flag;
-			ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+			ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 			if (!(flag))
 				g_warning ("Possibly setting incorrect values in the stream. "); 
 		} else if (pattern == PatternType_MonthNth) {
 			flag32 = mask;
-			ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+			ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 			flag32 = flag;
-			ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+			ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 			if (!(flag && mask))
 				g_warning ("Possibly setting incorrect values in the stream. "); 
@@ -968,27 +968,27 @@
 
 	} else if (rt->freq == ICAL_YEARLY_RECURRENCE) {
 		flag16 = RecurFrequency_Yearly;
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* Pattern Type - it would be PatternType_Month since we don't support any other type. */
 		flag16 = PatternType_Month;
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* Calendar Type */
 		flag16 = CAL_DEFAULT; 
-		ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 		/* FirstDateTime - uses the same function as monthly recurrence */
 		flag32 = compute_rmonthly_firstdatetime (comp, 0xC);
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* INTERVAL - should be 12 for yearly recurrence */
 		flag32 = 0xC; 
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* This would be 0 for the stuff we handle */
 		flag32 = 0x0;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		/* MONTH_DAY */
 		{
@@ -997,44 +997,44 @@
 			flag32 = dtstart.value->day; 
 			e_cal_component_free_datetime (&dtstart); 
 		}
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	} 
 
 	/* End Type followed by Occurence count */
 	if (!icaltime_is_null_time (rt->until)) {
 		flag32 = END_AFTER_DATE;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		flag32 = calculate_no_of_occurrences (comp, rt); 
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		end_type = END_AFTER_DATE;
 	} else if (rt->count) {
 		flag32 = END_AFTER_N_OCCURRENCES;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		flag32 = rt->count;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		end_type = END_AFTER_N_OCCURRENCES;
 	} else {
 		flag32 = END_NEVER_END;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		flag32 = 0x0;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 		end_type = END_NEVER_END;
 	}
 
 	/* FirstDOW */
 	flag32 = get_mapi_weekstart (rt->week_start); 
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* DeletedInstances */
 	flag32 = g_slist_length (exdate_list);
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 	if (flag32) {
 		GSList *l; 
 		guint32 *sorted_list = g_new0(guint32, flag32);
@@ -1048,7 +1048,7 @@
 		g_qsort_with_data (sorted_list, flag32, sizeof (guint32), compare_guint32, NULL); 
 
 		for (i = 0; i < flag32; ++i)
-			ba = g_byte_array_append (ba, &(sorted_list[i]), sizeof (guint32));
+			ba = g_byte_array_append (ba, (const guint8 *)&(sorted_list[i]), sizeof (guint32));
 
 		g_free (sorted_list);
 	}
@@ -1056,13 +1056,13 @@
 	/* FIXME: Add support for modified instances */
 	/* ModifiedInstanceCount */
 	flag32 = 0x0;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 	if (flag32) {
 	}
 
 	/* StartDate */
 	flag32 = compute_startdate (comp); 
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* EndDate */
 	{
@@ -1091,15 +1091,15 @@
 		} else 
 			flag32 = 0x0; 
 	}
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* Reader Version 2 */
 	flag32 = READER_VERSION2;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* Writer Version 2 */
 	flag32 = WRITER_VERSION2;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* StartTimeOffset */
 	{
@@ -1108,7 +1108,7 @@
 		flag32 = (dtstart.value->hour * 60) + dtstart.value->minute; 
 		e_cal_component_free_datetime (&dtstart); 
 	}
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* EndTimeOffset */
 	{
@@ -1117,24 +1117,24 @@
 		flag32 = (dtend.value->hour * 60) + dtend.value->minute; 
 		e_cal_component_free_datetime (&dtend); 
 	}
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* FIXME: Add support for modified instances */
 	/* ModifiedExceptionCount */
 	flag16 = 0x0; 
-	ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 	/* FIXME: Add the ExceptionInfo here */
 
 	/* Reserved Block 1 Size */
 	flag32 = 0x0;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* FIXME: Add the ExtendedExceptionInfo here */
 
 	/* Reserved Block 2 Size */
 	flag32 = 0x0;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 cleanup: 
 	e_cal_component_free_exdate_list (exdate_list);

Modified: trunk/src/libexchangemapi/exchange-mapi-cal-tz-utils.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-cal-tz-utils.c	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-cal-tz-utils.c	Sun Nov 23 15:35:19 2008
@@ -433,7 +433,7 @@
 #define TZ_BIN_VERSION_MINOR  0x01 
 
 void
-exchange_mapi_cal_util_mapi_tz_to_bin (const char *mapi_tzid, struct SBinary *sb)
+exchange_mapi_cal_util_mapi_tz_to_bin (const char *mapi_tzid, struct Binary_r *sb)
 {
 	GByteArray *ba;
 	guint8 flag8;
@@ -446,31 +446,31 @@
 
 	/* UTF-8 length of the keyname */
 	flag16 = g_utf8_strlen (mapi_tzid, -1);
-	ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 	/* Keyname */
 	buf = g_utf8_to_utf16 (mapi_tzid, flag16, NULL, &items_written, NULL);
-	ba = g_byte_array_append (ba, buf, (sizeof (gunichar2) * items_written));
+	ba = g_byte_array_append (ba, (const guint8 *)buf, (sizeof (gunichar2) * items_written));
 	g_free (buf);
 
 	/* number of rules *//* FIXME: Need to support rules */
 	flag16 = 0x0000;
-	ba = g_byte_array_append (ba, &flag16, sizeof (guint16));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 	/* wFlags: we know only keyname based names */
 	flag16 = TZDEFINITION_FLAG_VALID_KEYNAME;
-	ba = g_byte_array_prepend (ba, &flag16, sizeof (guint16));
+	ba = g_byte_array_prepend (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 	/* Length in bytes until rules info */
 	flag16 = (guint16) (ba->len);
-	ba = g_byte_array_prepend (ba, &flag16, sizeof (guint16));
+	ba = g_byte_array_prepend (ba, (const guint8 *)&flag16, sizeof (guint16));
 
 	/* Minor version */
 	flag8 = TZ_BIN_VERSION_MINOR;
-	ba = g_byte_array_prepend (ba, &flag8, sizeof (guint8));
+	ba = g_byte_array_prepend (ba, (const guint8 *)&flag8, sizeof (guint8));
 
 	/* Major version */
 	flag8 = TZ_BIN_VERSION_MAJOR;
-	ba = g_byte_array_prepend (ba, &flag8, sizeof (guint8));
+	ba = g_byte_array_prepend (ba, (const guint8 *)&flag8, sizeof (guint8));
 
 	/* Rules may now be appended here */
 

Modified: trunk/src/libexchangemapi/exchange-mapi-cal-tz-utils.h
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-cal-tz-utils.h	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-cal-tz-utils.h	Sun Nov 23 15:35:19 2008
@@ -46,7 +46,7 @@
 exchange_mapi_cal_tz_util_dump (void);
 
 void
-exchange_mapi_cal_util_mapi_tz_to_bin (const char *mapi_tzid, struct SBinary *sb);
+exchange_mapi_cal_util_mapi_tz_to_bin (const char *mapi_tzid, struct Binary_r *sb);
 
 gchar *
 exchange_mapi_cal_util_bin_to_mapi_tz (GByteArray *ba);

Modified: trunk/src/libexchangemapi/exchange-mapi-cal-utils.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-cal-utils.c	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-cal-utils.c	Sun Nov 23 15:35:19 2008
@@ -538,7 +538,7 @@
 };
 
 void
-exchange_mapi_cal_util_generate_globalobjectid (gboolean is_clean, const char *uid, struct SBinary *sb)
+exchange_mapi_cal_util_generate_globalobjectid (gboolean is_clean, const char *uid, struct Binary_r *sb)
 {
 	GByteArray *ba;
 	guint32 flag32;
@@ -553,20 +553,20 @@
 	/* FIXME for exceptions */
 	if (is_clean || TRUE) {
 		flag32 = 0;
-		ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+		ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 	}
 
 	/* creation time - may be all 0's  */
 	flag32 = 0;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 	flag32 = 0;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* RESERVED - should be all 0's  */
 	flag32 = 0;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 	flag32 = 0;
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 
 	/* FIXME: cleanup the UID first */
 
@@ -577,9 +577,9 @@
 	flag32 = len;
 
 	/* Size in bytes of the following data */
-	ba = g_byte_array_append (ba, &flag32, sizeof (guint32));
+	ba = g_byte_array_append (ba, (const guint8 *)&flag32, sizeof (guint32));
 	/* Data */
-	ba = g_byte_array_append (ba, buf, flag32);
+	ba = g_byte_array_append (ba, (const guint8 *)buf, flag32);
 	g_free (buf);
 
 	sb->lpb = ba->data;
@@ -770,7 +770,7 @@
 		}
 
 		if (get_mapi_SPropValue_array_date_timeval (&t, properties, PROP_TAG(PT_SYSTIME, 0x820D)) == MAPI_E_SUCCESS) {
-			icaltimezone *zone = dtstart_tz ? icaltimezone_get_builtin_timezone_from_tzid (dtstart_tz) : default_zone;
+			icaltimezone *zone = dtstart_tz ? icaltimezone_get_builtin_timezone_from_tzid (dtstart_tz) : (icaltimezone *)default_zone;
 			prop = icalproperty_new_dtstart (icaltime_from_timet_with_zone (t.tv_sec, (b && *b), zone));
 			icalproperty_add_parameter (prop, icalparameter_new_tzid(dtstart_tz));
 			icalcomponent_add_property (ical_comp, prop);
@@ -784,7 +784,7 @@
 		}
 
 		if (get_mapi_SPropValue_array_date_timeval (&t, properties, PROP_TAG(PT_SYSTIME, 0x820E)) == MAPI_E_SUCCESS) {
-			icaltimezone *zone = dtend_tz ? icaltimezone_get_builtin_timezone_from_tzid (dtend_tz) : default_zone;
+			icaltimezone *zone = dtend_tz ? icaltimezone_get_builtin_timezone_from_tzid (dtend_tz) : (icaltimezone *)default_zone;
 			prop = icalproperty_new_dtend (icaltime_from_timet_with_zone (t.tv_sec, (b && *b), zone));
 			icalproperty_add_parameter (prop, icalparameter_new_tzid(dtend_tz));
 			icalcomponent_add_property (ical_comp, prop);
@@ -1187,8 +1187,8 @@
 		cbdata.resp = olResponseNone;
 		cbdata.appt_seq = (*(const uint32_t *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_LONG, 0x8201)));
 		cbdata.appt_id = (*(const uint32_t *)find_mapi_SPropValue_data(properties, PR_OWNER_APPT_ID));
-		cbdata.globalid = (const struct SBinary *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0003));
-		cbdata.cleanglobalid = (const struct SBinary *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0023));
+		cbdata.globalid = (const struct Binary_r *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0003));
+		cbdata.cleanglobalid = (const struct Binary_r *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0023));
 
 		exchange_mapi_cal_util_fetch_recipients (comp, &myrecipients);
 		myattachments = attachments;
@@ -1604,8 +1604,8 @@
 	dtstart_tzid = icaltime_get_tzid (dtstart);
 	dtend_tzid = icaltime_get_tzid (dtend);
 
-	utc_dtstart = icaltime_convert_to_zone (dtstart, utc_zone);
-	utc_dtend = icaltime_convert_to_zone (dtend, utc_zone);
+	utc_dtstart = icaltime_convert_to_zone (dtstart, (icaltimezone *)utc_zone);
+	utc_dtend = icaltime_convert_to_zone (dtend, (icaltimezone *)utc_zone);
 
 	text = icalcomponent_get_summary (ical_comp);
 	if (!(text && *text)) 
@@ -1732,7 +1732,7 @@
 
 	if (kind == ICAL_VEVENT_COMPONENT) {
 		const char *mapi_tzid;
-		struct SBinary start_tz, end_tz; 
+		struct Binary_r start_tz, end_tz; 
 
 		set_SPropValue_proptag(&props[i++], proptag_array->aulPropTag[I_MEET_APPTMSGCLASS], (const void *) IPM_APPOINTMENT);
 

Modified: trunk/src/libexchangemapi/exchange-mapi-cal-utils.h
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-cal-utils.h	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-cal-utils.h	Sun Nov 23 15:35:19 2008
@@ -57,8 +57,8 @@
 	MAPIMeetingOptions meeting_type;
 	uint32_t appt_id;
 	uint32_t appt_seq;
-	struct SBinary *globalid;
-	struct SBinary *cleanglobalid;
+	const struct Binary_r *globalid;
+	const struct Binary_r *cleanglobalid;
 
 	uint32_t msgflags;
 	OlResponseStatus resp; 
@@ -88,7 +88,7 @@
 exchange_mapi_cal_util_build_props (struct SPropValue **value, struct SPropTagArray *proptag_array, gpointer data);
 
 void
-exchange_mapi_cal_util_generate_globalobjectid (gboolean is_clean, const char *uid, struct SBinary *sb);
+exchange_mapi_cal_util_generate_globalobjectid (gboolean is_clean, const char *uid, struct Binary_r *sb);
 
 gchar *
 exchange_mapi_cal_util_camel_helper (struct mapi_SPropValue_array *properties, 

Modified: trunk/src/libexchangemapi/exchange-mapi-connection.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-connection.c	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-connection.c	Sun Nov 23 15:35:19 2008
@@ -497,9 +497,9 @@
 		goto cleanup;
 	}
 
-	retval = GetRowCount(&obj_tb_attach, &attach_count);
+	retval = QueryPosition(&obj_tb_attach, NULL, &attach_count);
 	if (retval != MAPI_E_SUCCESS) {
-		mapi_errstr("GetRowCount", GetLastError());
+		mapi_errstr("QueryPosition", GetLastError());
 		goto cleanup;
 	}
 
@@ -631,9 +631,9 @@
 		goto cleanup;
 	}
 
-	retval = GetRowCount(&obj_tb_attach, &attach_count);
+	retval = QueryPosition(&obj_tb_attach, NULL, &attach_count);
 	if (retval != MAPI_E_SUCCESS) {
-		mapi_errstr("GetRowCount", GetLastError());
+		mapi_errstr("QueryPosition", GetLastError());
 		goto cleanup;
 	}
 
@@ -763,7 +763,7 @@
 	uint32_t i;
 
 	if (is_external && recipient->in.ext_lpProps) {
-		struct SBinary *oneoff_eid;
+		struct Binary_r *oneoff_eid;
 		struct SPropValue sprop; 
 		const gchar *dn = NULL, *email = NULL; 
 
@@ -792,7 +792,7 @@
 	enum MAPISTATUS 	retval;
 	struct SPropTagArray 	*SPropTagArray = NULL;
 	struct SRowSet 		*SRowSet = NULL;
-	struct FlagList 	*FlagList = NULL;
+	struct SPropTagArray 	*FlagList = NULL;
 	GSList 			*l;
 	const char 		**users = NULL;
 	uint32_t 		i, j, count = 0;
@@ -814,7 +814,6 @@
 //					  PR_TRANSMITTABLE_DISPLAY_NAME);
 
 	SRowSet = talloc_zero(mem_ctx, struct SRowSet);
-	FlagList = talloc_zero(mem_ctx, struct FlagList);
 	count = g_slist_length (recipients);
 	users = g_new0 (const char *, count + 1);
 
@@ -824,38 +823,34 @@
 	}
 
 	/* Attempt to resolve names from the server */
-	retval = ResolveNames (users, SPropTagArray, &SRowSet, &FlagList, 0);
+	retval = ResolveNames (global_mapi_session, users, SPropTagArray, &SRowSet, &FlagList, 0);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("ResolveNames", GetLastError());
 		goto cleanup;
 	}
 
-	g_assert (count == FlagList->cFlags);
+	g_assert (count == FlagList->cValues);
 
 	for (i = 0, l = recipients, j = 0; (i < count && l != NULL); ++i, l = l->next) {
 		ExchangeMAPIRecipient *recipient = (ExchangeMAPIRecipient *)(l->data);
 		uint32_t last;
 
-		switch (FlagList->ulFlags[i]) {
-		case MAPI_AMBIGUOUS:
-		/* We should never get an ambiguous resolution as we use the email-id for resolving. 
-		 * However, if we do still get an ambiguous entry, we can't handle it :-( */
+		if (FlagList->aulPropTag[i] == MAPI_AMBIGUOUS) {
+			/* We should never get an ambiguous resolution as we use the email-id for resolving. 
+			 * However, if we do still get an ambiguous entry, we can't handle it :-( */
 			g_warning ("\n%s:%d %s() - '%s' is ambiguous ", __FILE__, __LINE__, __PRETTY_FUNCTION__, recipient->email_id);
-			break;
-		case MAPI_UNRESOLVED:
-		/* This is currently a bug in libmapi that unresolved recipients are not added to the SRowSet. 
-		 * Julien knows about it and would fix it. */
+		} else if (FlagList->aulPropTag[i] == MAPI_UNRESOLVED) {
+			/* This is currently a bug in libmapi that unresolved recipients are not added to the SRowSet. 
+			 * Julien knows about it and would fix it. */
 			SRowSet->aRow = talloc_realloc(mem_ctx, SRowSet->aRow, struct SRow, SRowSet->cRows + 1);
 			last = SRowSet->cRows;
 			SRowSet->aRow[last].cValues = 0;
 			SRowSet->aRow[last].lpProps = talloc_zero(mem_ctx, struct SPropValue);
 			set_recipient_properties (mem_ctx, &SRowSet->aRow[last], recipient, TRUE);
 			SRowSet->cRows += 1;
-			break;
-		case MAPI_RESOLVED:
+		} else if (FlagList->aulPropTag[i] == MAPI_RESOLVED) {
 			set_recipient_properties (mem_ctx, &SRowSet->aRow[j], recipient, FALSE);
 			j += 1;
-			break;
 		}
 	}
 
@@ -903,7 +898,7 @@
 	mapi_object_init(&obj_table);
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -949,7 +944,7 @@
 
 	if (res) {
 		/* Applying any restriction that are set. */
-		retval = Restrict(&obj_table, res);
+		retval = Restrict(&obj_table, res, NULL);
 		if (retval != MAPI_E_SUCCESS) {
 			mapi_errstr("Restrict", GetLastError());
 			goto cleanup;
@@ -957,7 +952,7 @@
 	}
 
 	/* Number of items in the container */
-	retval = GetRowCount(&obj_table, &count);
+	retval = QueryPosition(&obj_table, NULL, &count);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("GetRowCount", GetLastError());
 		goto cleanup;
@@ -1018,7 +1013,8 @@
 	mapi_object_init(&obj_table);
 
 	/* Open the message store */
-	retval = ((options & MAPI_OPTIONS_USE_PFSTORE) ? OpenPublicFolder(&obj_store) : OpenMsgStore(&obj_store));
+	retval = ((options & MAPI_OPTIONS_USE_PFSTORE) ? 
+		  OpenPublicFolder(global_mapi_session, &obj_store) : OpenMsgStore(global_mapi_session, &obj_store));
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore / OpenPublicFolder", GetLastError());
 		goto cleanup;
@@ -1056,7 +1052,7 @@
 
 	if (res) {
 		/* Applying any restriction that are set. */
-		retval = Restrict(&obj_table, res);
+		retval = Restrict(&obj_table, res, NULL);
 		if (retval != MAPI_E_SUCCESS) {
 			mapi_errstr("Restrict", GetLastError());
 			goto cleanup;
@@ -1064,9 +1060,9 @@
 	}
 
 	/* Number of items in the container */
-	retval = GetRowCount(&obj_table, &count);
+	retval = QueryPosition(&obj_table, NULL, &count);
 	if (retval != MAPI_E_SUCCESS) {
-		mapi_errstr("GetRowCount", GetLastError());
+		mapi_errstr("QueryPosition", GetLastError());
 		goto cleanup;
 	}
 
@@ -1246,7 +1242,8 @@
 	mapi_object_init(&obj_message);
 
 	/* Open the message store */
-	retval = ((options & MAPI_OPTIONS_USE_PFSTORE) ? OpenPublicFolder(&obj_store) : OpenMsgStore(&obj_store));
+	retval = ((options & MAPI_OPTIONS_USE_PFSTORE) ? 
+		  OpenPublicFolder(global_mapi_session, &obj_store) : OpenMsgStore(global_mapi_session, &obj_store));
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1406,7 +1403,7 @@
 	mapi_object_init(&obj_top);
 	mapi_object_init(&obj_folder);
 
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1486,7 +1483,7 @@
 	mapi_object_init(&obj_store);
 	mapi_object_init(&obj_folder);
 
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1543,7 +1540,7 @@
 	mapi_object_init(&obj_top);
 	mapi_object_init(&obj_folder);
 
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1577,7 +1574,7 @@
 	}
 
 	/* Call DeleteFolder on the folder to be removed */
-	retval = DeleteFolder(&obj_top, fid);
+	retval = DeleteFolder(&obj_top, fid, DEL_FOLDERS, NULL);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("DeleteFolder", GetLastError());
 		goto cleanup;
@@ -1617,7 +1614,7 @@
 	mapi_object_init(&obj_store);
 	mapi_object_init(&obj_folder);
 
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1677,7 +1674,7 @@
 	SPropTagArray = talloc_zero(mem_ctx, struct SPropTagArray);
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1754,7 +1751,7 @@
 	SPropTagArray = talloc_zero(mem_ctx, struct SPropTagArray);
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1833,7 +1830,7 @@
 	nameid[0].kind.lpwstr.Name = named_prop_name;
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1890,7 +1887,7 @@
 	mapi_object_init(&obj_store);
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -1943,7 +1940,7 @@
 	SPropTagArray = talloc_zero(mem_ctx, struct SPropTagArray);
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -2019,7 +2016,7 @@
 	}
 
 	/* Finally, save all changes */
-	retval = SaveChangesMessage(&obj_folder, &obj_message);
+	retval = SaveChangesMessage(&obj_folder, &obj_message, KeepOpenReadWrite);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("SaveChangesMessage", GetLastError());
 		goto cleanup;
@@ -2080,7 +2077,7 @@
 	SPropTagArray = talloc_zero(mem_ctx, struct SPropTagArray);
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -2156,7 +2153,7 @@
 	}
  
 	/* Finally, save all changes */
-	retval = SaveChangesMessage(&obj_folder, &obj_message);
+	retval = SaveChangesMessage(&obj_folder, &obj_message, KeepOpenReadWrite);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("SaveChangesMessage", GetLastError());
 		goto cleanup;
@@ -2211,7 +2208,8 @@
 		id_messages[i] = *((mapi_id_t *)tmp->data);
 
 	/* Open the message store */
-	retval = ((options & MAPI_OPTIONS_USE_PFSTORE) ? OpenPublicFolder(&obj_store) : OpenMsgStore(&obj_store)) ;
+	retval = ((options & MAPI_OPTIONS_USE_PFSTORE) ? 
+		  OpenPublicFolder(global_mapi_session, &obj_store) : OpenMsgStore(global_mapi_session, &obj_store)) ;
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore / OpenPublicFolder", GetLastError());
 		goto cleanup;
@@ -2263,7 +2261,7 @@
 	for (l = mid_list; l != NULL; l = g_slist_next (l))
 		mapi_id_array_add_id (&msg_id_array, *((mapi_id_t *)l->data));
 
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -2361,7 +2359,7 @@
 	}
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -2496,7 +2494,7 @@
 {
 	GSList *folder_list = *mapi_folders;
 	
-	while (folder_list = g_slist_next (folder_list)) {
+	while ((folder_list = g_slist_next (folder_list))) {
 		ExchangeMAPIFolder *folder = NULL;
 		guint32 default_type = 0;
 		folder = folder_list->data;
@@ -2511,14 +2509,14 @@
 set_owner_name (gpointer data, gpointer user_data)
 {
 	ExchangeMAPIFolder *folder = (ExchangeMAPIFolder *)(data);
-	folder->owner_name = (const gchar *)(user_data);
+	folder->owner_name = (gchar *)(user_data);
 }
 
 static void 
 set_user_name (gpointer data, gpointer user_data)
 {
 	ExchangeMAPIFolder *folder = (ExchangeMAPIFolder *)(data);
-	folder->user_name = (const gchar *)(user_data);
+	folder->user_name = (gchar *)(user_data);
 }
 
 gboolean 
@@ -2547,7 +2545,7 @@
 	mapi_object_init(&obj_store);
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = OpenMsgStore(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenMsgStore", GetLastError());
 		goto cleanup;
@@ -2633,7 +2631,7 @@
 	mapi_object_init(&obj_store);
 
 	/* Open the PF message store */
-	retval = OpenPublicFolder(&obj_store);
+	retval = OpenPublicFolder(global_mapi_session, &obj_store);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("OpenPublicFolder", GetLastError());
 		goto cleanup;
@@ -2667,3 +2665,48 @@
 	return result;
 }
 
+
+/**
+   This function has temporarily been moved here for convenient
+   purposes. This is the only routine outside exchange-mapi-connection
+   using libmapi calls whih require to have a pointer on MAPI session.
+
+   The function will be moved back to its original location when the
+   session context is fixed.
+ */
+const gchar *
+exchange_mapi_util_ex_to_smtp (const gchar *ex_address)
+{
+	enum MAPISTATUS 	retval;
+	TALLOC_CTX 		*mem_ctx;
+	struct SPropTagArray	*SPropTagArray;
+	struct SRowSet 		*SRowSet = NULL;
+	struct SPropTagArray   	*flaglist = NULL;
+	const gchar 		*str_array[2];
+	const gchar 		*smtp_addr = NULL;
+
+	g_return_val_if_fail (ex_address != NULL, NULL);
+
+	str_array[0] = ex_address;
+	str_array[1] = NULL;
+
+	mem_ctx = talloc_init("ExchangeMAPI_EXtoSMTP");
+
+	SPropTagArray = set_SPropTagArray(mem_ctx, 0x2,
+					  PR_SMTP_ADDRESS,
+					  PR_SMTP_ADDRESS_UNICODE);
+
+	retval = ResolveNames(global_mapi_session, (const char **)str_array, SPropTagArray, &SRowSet, &flaglist, 0);
+	if (retval != MAPI_E_SUCCESS)
+		retval = ResolveNames(global_mapi_session, (const char **)str_array, SPropTagArray, &SRowSet, &flaglist, MAPI_UNICODE);
+
+	if (retval == MAPI_E_SUCCESS && SRowSet && SRowSet->cRows == 1) {
+		smtp_addr = (const char *) find_SPropValue_data(SRowSet->aRow, PR_SMTP_ADDRESS);
+		if (!smtp_addr)
+			smtp_addr = (const char *) find_SPropValue_data(SRowSet->aRow, PR_SMTP_ADDRESS_UNICODE);
+	}
+
+	talloc_free (mem_ctx);
+
+	return smtp_addr;
+}

Modified: trunk/src/libexchangemapi/exchange-mapi-utils.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-utils.c	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-utils.c	Sun Nov 23 15:35:19 2008
@@ -289,42 +289,6 @@
 	l = NULL;
 }
 
-const gchar *
-exchange_mapi_util_ex_to_smtp (const gchar *ex_address)
-{
-	enum MAPISTATUS 	retval;
-	TALLOC_CTX 		*mem_ctx;
-	struct SPropTagArray	*SPropTagArray;
-	struct SRowSet 		*SRowSet = NULL;
-	struct FlagList		*flaglist = NULL;
-	const gchar 		*str_array[2];
-	const gchar 		*smtp_addr = NULL;
-
-	g_return_val_if_fail (ex_address != NULL, NULL);
-
-	str_array[0] = ex_address;
-	str_array[1] = NULL;
-
-	mem_ctx = talloc_init("ExchangeMAPI_EXtoSMTP");
-
-	SPropTagArray = set_SPropTagArray(mem_ctx, 0x2,
-					  PR_SMTP_ADDRESS,
-					  PR_SMTP_ADDRESS_UNICODE);
-
-	retval = ResolveNames((const char **)str_array, SPropTagArray, &SRowSet, &flaglist, 0);
-	if (retval != MAPI_E_SUCCESS)
-		retval = ResolveNames((const char **)str_array, SPropTagArray, &SRowSet, &flaglist, MAPI_UNICODE);
-
-	if (retval == MAPI_E_SUCCESS && SRowSet && SRowSet->cRows == 1) {
-		smtp_addr = (const char *) find_SPropValue_data(SRowSet->aRow, PR_SMTP_ADDRESS);
-		if (!smtp_addr)
-			smtp_addr = (const char *) find_SPropValue_data(SRowSet->aRow, PR_SMTP_ADDRESS_UNICODE);
-	}
-
-	talloc_free (mem_ctx);
-
-	return smtp_addr;
-}
 
 void
 exchange_mapi_debug_property_dump (struct mapi_SPropValue_array *properties)
@@ -355,7 +319,7 @@
 				g_print (" (double) -  %lf", (double)lpProp->value.dbl);
 				break;
 			case PT_I8:
-				g_print (" (int) - 0x%016lX", lpProp->value.d);
+				g_print (" (int) - 0x%016llX", lpProp->value.d);
 				break;
 			case PT_SYSTIME: {
 					struct timeval t;
@@ -396,7 +360,7 @@
 /* Attention: Devs at work ;-) */
 
 static void 
-exchange_mapi_util_bin_append_uint16 (TALLOC_CTX *mem_ctx, struct SBinary *bin, const uint16_t val)
+exchange_mapi_util_bin_append_uint16 (TALLOC_CTX *mem_ctx, struct Binary_r *bin, const uint16_t val)
 {
 	uint8_t *ptr = NULL;
 
@@ -410,7 +374,7 @@
 }
 
 static void 
-exchange_mapi_util_bin_append_uint32 (TALLOC_CTX *mem_ctx, struct SBinary *bin, const uint32_t val)
+exchange_mapi_util_bin_append_uint32 (TALLOC_CTX *mem_ctx, struct Binary_r *bin, const uint32_t val)
 {
 	uint8_t *ptr = NULL;
 
@@ -426,7 +390,7 @@
 }
 
 static void 
-exchange_mapi_util_bin_append_string (TALLOC_CTX *mem_ctx, struct SBinary *bin, const char *val)
+exchange_mapi_util_bin_append_string (TALLOC_CTX *mem_ctx, struct Binary_r *bin, const char *val)
 {
 	size_t len = strlen (val);
 	char *ptr = NULL;
@@ -440,13 +404,13 @@
 }
 
 static void 
-exchange_mapi_util_bin_append_unicode (TALLOC_CTX *mem_ctx, struct SBinary *bin, const char *val)
+exchange_mapi_util_bin_append_unicode (TALLOC_CTX *mem_ctx, struct Binary_r *bin, const char *val)
 {
 	/* WRITE ME */
 }
 
 static void 
-exchange_mapi_util_bin_append_val (TALLOC_CTX *mem_ctx, struct SBinary *bin, const uint8_t *val, size_t len)
+exchange_mapi_util_bin_append_val (TALLOC_CTX *mem_ctx, struct Binary_r *bin, const uint8_t *val, size_t len)
 {
 	uint8_t *ptr = NULL;
 
@@ -480,12 +444,12 @@
  *
  * Return value: the recipient ENTRYID
  **/
-struct SBinary *
+struct Binary_r *
 exchange_mapi_util_entryid_generate_oneoff (TALLOC_CTX *mem_ctx, const char *display_name, const char *email, gboolean unicode)
 {
-	struct SBinary *entryid;
+	struct Binary_r *entryid;
 
-	entryid = talloc_zero (mem_ctx, struct SBinary);
+	entryid = talloc_zero (mem_ctx, struct Binary_r);
 
 	exchange_mapi_util_bin_append_uint32 (mem_ctx, entryid, 0);
 	exchange_mapi_util_bin_append_val (mem_ctx, entryid, MAPI_ONE_OFF_UID, sizeof(MAPI_ONE_OFF_UID));
@@ -523,12 +487,12 @@
  *
  * Return value: the recipient ENTRYID
  **/
-struct SBinary *
+struct Binary_r *
 exchange_mapi_util_entryid_generate_local (TALLOC_CTX *mem_ctx, const char *exchange_dn)
 {
-	struct SBinary *entryid;
+	struct Binary_r *entryid;
 
-	entryid = talloc_zero (mem_ctx, struct SBinary);
+	entryid = talloc_zero (mem_ctx, struct Binary_r);
 
 	exchange_mapi_util_bin_append_uint32 (mem_ctx, entryid, 0);
 	exchange_mapi_util_bin_append_val (mem_ctx, entryid, MAPI_LOCAL_UID, sizeof(MAPI_LOCAL_UID));

Modified: trunk/src/libexchangemapi/exchange-mapi-utils.h
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-utils.h	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-utils.h	Sun Nov 23 15:35:19 2008
@@ -62,9 +62,9 @@
 void
 exchange_mapi_debug_property_dump (struct mapi_SPropValue_array *properties);
 
-struct SBinary *
+struct Binary_r *
 exchange_mapi_util_entryid_generate_oneoff (TALLOC_CTX *mem_ctx, const char *display_name, const char *email, gboolean unicode);
-struct SBinary *
+struct Binary_r *
 exchange_mapi_util_entryid_generate_local (TALLOC_CTX *mem_ctx, const char *exchange_dn);
 
 char *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]