evolution-data-server r9328 - in branches/EXCHANGE_MAPI_BRANCH: camel/providers/mapi servers/mapi
- From: msuman svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9328 - in branches/EXCHANGE_MAPI_BRANCH: camel/providers/mapi servers/mapi
- Date: Tue, 12 Aug 2008 09:51:04 +0000 (UTC)
Author: msuman
Date: Tue Aug 12 09:51:04 2008
New Revision: 9328
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9328&view=rev
Log:
More code re-organization.
Modified:
branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c
branches/EXCHANGE_MAPI_BRANCH/servers/mapi/ChangeLog
branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-cal-utils.c
branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-cal-utils.h
Modified: branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c (original)
+++ branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c Tue Aug 12 09:51:04 2008
@@ -572,6 +572,7 @@
PR_MESSAGE_SIZE,
PR_MESSAGE_FLAGS,
PR_MESSAGE_DELIVERY_TIME,
+ PR_MSG_EDITOR_FORMAT,
PR_SUBJECT,
PR_SUBJECT_UNICODE,
Modified: branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-cal-utils.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-cal-utils.c (original)
+++ branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-cal-utils.c Tue Aug 12 09:51:04 2008
@@ -832,131 +832,6 @@
return comp;
}
-static gboolean
-capture_req_props (struct mapi_SPropValue_array *properties, const mapi_id_t fid, const mapi_id_t mid,
- GSList *streams, GSList *recipients, GSList *attachments, gpointer data)
-{
- struct cbdata *cbdata = (struct cbdata *) data;
- const uint32_t *ui32;
-
- ui32 = (const uint32_t *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_LONG, 0x8201));
- if (ui32)
- cbdata->appt_seq = *ui32;
- else
- cbdata->appt_seq = 0;
-
- return TRUE;
-}
-
-static void
-update_server_object (struct mapi_SPropValue_array *properties, GSList *attachments, ECalComponent *comp, mapi_id_t *mid)
-{
- const uint32_t *ui32 = NULL;
- uint32_t cur_seq;
- mapi_id_t fid;
- gboolean create_new = TRUE;
-
- fid = exchange_mapi_get_default_folder_id (olFolderCalendar);
-
- ui32 = (const uint32_t *) find_mapi_SPropValue_data(properties, PROP_TAG(PT_LONG, 0x8201));
- if (ui32)
- cur_seq = *ui32;
-
- if (*mid) {
- struct cbdata server_cbdata;
- server_cbdata.appt_seq = 0;
-
- exchange_mapi_connection_fetch_item (fid, *mid,
- NULL, 0,
- NULL, NULL,
- capture_req_props, &server_cbdata,
- 0);
-
- if (cur_seq > server_cbdata.appt_seq) {
- struct id_list idlist;
- GSList *ids = NULL;
-
- idlist.id = *mid;
- ids = g_slist_append (ids, &idlist);
-
- exchange_mapi_remove_items (olFolderCalendar, fid, ids);
- } else
- create_new = FALSE;
- }
-
- if (create_new) {
- struct cbdata cbdata;
- GSList *myrecipients = NULL;
- GSList *myattachments = NULL;
- icalcomponent_kind kind = icalcomponent_isa (e_cal_component_get_icalcomponent(comp));
-
- cbdata.comp = comp;
- cbdata.username = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME);
- cbdata.useridtype = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_ADDRTYPE);
- cbdata.userid = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS);
- cbdata.ownername = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME);
- cbdata.owneridtype = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
- cbdata.ownerid = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
- cbdata.is_modify = FALSE;
- cbdata.msgflags = MSGFLAG_READ;
- cbdata.meeting_type = MEETING_REQUEST_RCVD;
- 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));
-
- exchange_mapi_cal_util_fetch_recipients (comp, &myrecipients);
- myattachments = attachments;
- *mid = exchange_mapi_create_item (olFolderCalendar, 0,
- exchange_mapi_cal_util_build_name_id, GINT_TO_POINTER(kind),
- exchange_mapi_cal_util_build_props, &cbdata,
- myrecipients, myattachments, NULL, MAPI_OPTIONS_DONT_SUBMIT);
- g_free (cbdata.props);
- exchange_mapi_util_free_recipient_list (&myrecipients);
- }
-}
-
-static void
-check_server_for_object (struct mapi_SPropValue_array *properties, mapi_id_t *mid)
-{
- struct mapi_SRestriction res;
- struct SPropValue sprop;
- const struct SBinary *sb;
- uint32_t proptag = 0x0;
- struct SPropTagArray *array;
- GSList *ids = NULL, *l;
- mapi_id_t fid;
-
- *mid = 0;
-
- fid = exchange_mapi_get_default_folder_id (olFolderCalendar);
-
- array = exchange_mapi_util_resolve_named_prop (olFolderCalendar, fid, 0x0023, PSETID_Meeting);
- proptag = array->aulPropTag[0];
-
- res.rt = RES_PROPERTY;
- res.res.resProperty.relop = RELOP_EQ;
- res.res.resProperty.ulPropTag = proptag;
-
- sb = (const struct SBinary *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0023));
-
- set_SPropValue_proptag (&sprop, proptag, (const void *) sb);
- cast_mapi_SPropValue (&(res.res.resProperty.lpProp), &sprop);
-
- ids = exchange_mapi_util_check_restriction (fid, &res);
-
- if (ids && g_slist_length(ids) == 1) {
- struct id_list *idlist = (struct id_list *)(ids->data);
- *mid = idlist->id;
- } else
- /* FIXME: what to do here? */
- ;
-
- for (l = ids; l; l = l->next)
- g_free(l->data);
- g_slist_free(l);
-}
-
#define TEMP_ATTACH_STORE ".evolution/cache/tmp"
static void
@@ -1002,7 +877,7 @@
}
static gboolean
-update_cb (struct mapi_SPropValue_array *properties, const mapi_id_t fid, const mapi_id_t mid,
+fetch_server_data_cb (struct mapi_SPropValue_array *properties, const mapi_id_t fid, const mapi_id_t mid,
GSList *streams, GSList *recipients, GSList *attachments, gpointer data)
{
icalcomponent_kind kind = ICAL_VEVENT_COMPONENT;
@@ -1033,16 +908,29 @@
return TRUE;
}
-static ECalComponent *
-update_attendee_status (struct mapi_SPropValue_array *properties, mapi_id_t mid)
+static void
+fetch_server_data (mapi_id_t mid, struct cbdata *cbd)
{
icalcomponent_kind kind = ICAL_VEVENT_COMPONENT;
mapi_id_t fid;
+
+ fid = exchange_mapi_get_default_folder_id (olFolderCalendar);
+
+ exchange_mapi_connection_fetch_item (fid, mid,
+ cal_GetPropsList, G_N_ELEMENTS (cal_GetPropsList),
+ exchange_mapi_cal_util_build_name_id, GINT_TO_POINTER (kind),
+ fetch_server_data_cb, cbd,
+ MAPI_OPTIONS_FETCH_RECIPIENTS | MAPI_OPTIONS_FETCH_GENERIC_STREAMS);
+
+}
+
+static ECalComponent *
+update_attendee_status (struct mapi_SPropValue_array *properties, mapi_id_t mid)
+{
const gchar *att, *att_sentby, *addrtype;
icalparameter_partstat partstat = ICAL_PARTSTAT_NONE;
const gchar *state = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_MESSAGE_CLASS);
struct cbdata cbdata;
- gboolean status = FALSE;
gchar *matt, *matt_sentby;
uint32_t cur_seq;
const uint32_t *ui32;
@@ -1059,13 +947,7 @@
else
return NULL;
- fid = exchange_mapi_get_default_folder_id (olFolderCalendar);
-
- exchange_mapi_connection_fetch_item (fid, mid,
- cal_GetPropsList, G_N_ELEMENTS (cal_GetPropsList),
- exchange_mapi_cal_util_build_name_id, GINT_TO_POINTER (kind),
- update_cb, &cbdata,
- MAPI_OPTIONS_FETCH_ALL);
+ fetch_server_data (mid, &cbdata);
att = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
addrtype = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
@@ -1086,6 +968,11 @@
cur_seq = ui32 ? *ui32 : 0;
if (cbdata.appt_seq == cur_seq) {
+/*
+ * The itip-formatter provides an option to update the attendee's status.
+ * Hence, we need not update the server straight away.
+ */
+#if 0
gchar *filename = g_build_filename (g_get_home_dir (), TEMP_ATTACH_STORE, NULL);
gchar *fileuri = g_filename_to_uri (filename, NULL, NULL);
GSList *attachments = NULL, *recipients = NULL;
@@ -1112,7 +999,9 @@
exchange_mapi_util_free_attachment_list (&attachments);
g_free (fileuri);
g_free (filename);
+#endif
+ /* remove the other attendees so not to confuse itip-formatter */
remove_other_attendees (cbdata.comp, matt);
} else {
g_object_unref (cbdata.comp);
@@ -1125,6 +1014,109 @@
return cbdata.comp;
}
+static void
+update_server_object (struct mapi_SPropValue_array *properties, GSList *attachments, ECalComponent *comp, mapi_id_t *mid)
+{
+ const uint32_t *ui32 = NULL;
+ uint32_t cur_seq;
+ mapi_id_t fid;
+ gboolean create_new = TRUE;
+
+ fid = exchange_mapi_get_default_folder_id (olFolderCalendar);
+
+ ui32 = (const uint32_t *) find_mapi_SPropValue_data(properties, PROP_TAG(PT_LONG, 0x8201));
+ cur_seq = ui32 ? *ui32 : 0;
+
+ if (*mid) {
+ struct cbdata server_cbd;
+ fetch_server_data (*mid, &server_cbd);
+
+ if (cur_seq > server_cbd.appt_seq) {
+ struct id_list idlist;
+ GSList *ids = NULL;
+
+ idlist.id = *mid;
+ ids = g_slist_append (ids, &idlist);
+
+ exchange_mapi_remove_items (olFolderCalendar, fid, ids);
+ g_slist_free (ids);
+ } else
+ create_new = FALSE;
+ }
+
+ if (create_new) {
+ struct cbdata cbdata;
+ GSList *myrecipients = NULL;
+ GSList *myattachments = NULL;
+ icalcomponent_kind kind = icalcomponent_isa (e_cal_component_get_icalcomponent(comp));
+
+ cbdata.comp = comp;
+ cbdata.username = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME);
+ cbdata.useridtype = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_ADDRTYPE);
+ cbdata.userid = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS);
+ cbdata.ownername = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME);
+ cbdata.owneridtype = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
+ cbdata.ownerid = (const char *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
+ cbdata.is_modify = FALSE;
+ cbdata.msgflags = MSGFLAG_READ;
+ cbdata.meeting_type = MEETING_REQUEST_RCVD;
+ 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));
+
+ exchange_mapi_cal_util_fetch_recipients (comp, &myrecipients);
+ myattachments = attachments;
+ *mid = exchange_mapi_create_item (olFolderCalendar, 0,
+ exchange_mapi_cal_util_build_name_id, GINT_TO_POINTER(kind),
+ exchange_mapi_cal_util_build_props, &cbdata,
+ myrecipients, myattachments, NULL, MAPI_OPTIONS_DONT_SUBMIT);
+ g_free (cbdata.props);
+ exchange_mapi_util_free_recipient_list (&myrecipients);
+ }
+}
+
+static void
+check_server_for_object (struct mapi_SPropValue_array *properties, mapi_id_t *mid)
+{
+ struct mapi_SRestriction res;
+ struct SPropValue sprop;
+ const struct SBinary *sb;
+ uint32_t proptag = 0x0;
+ struct SPropTagArray *array;
+ GSList *ids = NULL, *l;
+ mapi_id_t fid;
+
+ *mid = 0;
+
+ fid = exchange_mapi_get_default_folder_id (olFolderCalendar);
+
+ array = exchange_mapi_util_resolve_named_prop (olFolderCalendar, fid, 0x0023, PSETID_Meeting);
+ proptag = array->aulPropTag[0];
+
+ res.rt = RES_PROPERTY;
+ res.res.resProperty.relop = RELOP_EQ;
+ res.res.resProperty.ulPropTag = proptag;
+
+ sb = (const struct SBinary *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0023));
+
+ set_SPropValue_proptag (&sprop, proptag, (const void *) sb);
+ cast_mapi_SPropValue (&(res.res.resProperty.lpProp), &sprop);
+
+ ids = exchange_mapi_util_check_restriction (fid, &res);
+
+ if (ids && g_slist_length(ids) == 1) {
+ struct id_list *idlist = (struct id_list *)(ids->data);
+ *mid = idlist->id;
+ } else
+ /* FIXME: what to do here? */
+ ;
+
+ for (l = ids; l; l = l->next)
+ g_free(l->data);
+ g_slist_free(l);
+}
+
char *
exchange_mapi_cal_util_camel_helper (struct mapi_SPropValue_array *properties,
GSList *streams, GSList *recipients, GSList *attachments)
@@ -1138,6 +1130,8 @@
icalcomponent *icalcomp = NULL;
char *str = NULL, *smid = NULL;
char *tmp;
+ gchar *filename;
+ gchar *fileuri;
msg_class = (const char *) exchange_mapi_util_find_array_propval (properties, PR_MESSAGE_CLASS);
g_return_val_if_fail (msg_class && *msg_class, NULL);
@@ -1153,10 +1147,22 @@
} else
return NULL;
+ filename = g_build_filename (g_get_home_dir (), TEMP_ATTACH_STORE, NULL);
+ fileuri = g_filename_to_uri (filename, NULL, NULL);
+
check_server_for_object (properties, &mid);
if (method == ICAL_METHOD_REPLY) {
- if (mid)
+ if (mid) {
comp = update_attendee_status (properties, mid);
+ set_attachments_to_cal_component (comp, attachments, fileuri);
+ }
+ } else if (method == ICAL_METHOD_CANCEL) {
+ if (mid) {
+ struct cbdata server_cbd;
+ fetch_server_data (mid, &server_cbd);
+ comp = server_cbd.comp;
+ set_attachments_to_cal_component (comp, attachments, fileuri);
+ }
} else {
if (mid)
smid = exchange_mapi_util_mapi_id_to_string (mid);
@@ -1166,9 +1172,10 @@
comp = exchange_mapi_cal_util_mapi_props_to_comp (kind, smid,
properties, streams, recipients,
NULL, NULL, NULL);
+ set_attachments_to_cal_component (comp, attachments, fileuri);
b = (const bool *) find_mapi_SPropValue_data(properties, PR_PROCESSED);
- if (!(b && *b) && method != ICAL_METHOD_CANCEL)
+ if (!(b && *b))
update_server_object (properties, attachments, comp, &mid);
tmp = exchange_mapi_util_mapi_id_to_string (mid);
@@ -1177,6 +1184,9 @@
g_free (smid);
}
+ g_free (fileuri);
+ g_free (filename);
+
icalcomp = e_cal_util_new_top_level ();
icalcomponent_set_method (icalcomp, method);
if (comp)
Modified: branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-cal-utils.h
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-cal-utils.h (original)
+++ branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-cal-utils.h Tue Aug 12 09:51:04 2008
@@ -118,6 +118,7 @@
PR_RESPONSE_REQUESTED,
PR_OWNER_APPT_ID,
PR_PROCESSED,
+ PR_MSG_EDITOR_FORMAT,
PR_SENT_REPRESENTING_NAME,
PR_SENT_REPRESENTING_NAME_UNICODE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]