[evolution-patches] Exchange: patch for bug #257802
- From: shakti <shprasad novell com>
- To: evolution-patches lists ximian com
- Subject: [evolution-patches] Exchange: patch for bug #257802
- Date: Fri, 05 Aug 2005 20:54:12 +0530
Hi,
I have attached a patch for bug #257802 (support for IM field for
exchange).
Please review it.
Thanks,
Shakti
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.367
diff -u -p -r1.367 ChangeLog
--- ChangeLog 2 Aug 2005 12:57:17 -0000 1.367
+++ ChangeLog 5 Aug 2005 15:21:16 -0000
@@ -1,3 +1,11 @@
+2005-08-05 Shakti Sen <shprasad novell com>
+
+ * addressbook/e-book-backend-exchange.c:
+ Added new functions proppatch_im(), populate_im().
+ In brief, contact editor (exchange) supports IM field.
+
+ Fixes bug #257802.
+
2005-08-02 Sarfraaz Ahmed <asarfraaz novell com>
* mail/mail-stub-exchange.c (get_folder_info) : Fetch only mail type
Index: addressbook/e-book-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/addressbook/e-book-backend-exchange.c,v
retrieving revision 1.32
diff -u -p -r1.32 e-book-backend-exchange.c
--- addressbook/e-book-backend-exchange.c 25 Jul 2005 11:03:16 -0000 1.32
+++ addressbook/e-book-backend-exchange.c 5 Aug 2005 15:21:17 -0000
@@ -103,6 +103,8 @@ static E2kRestriction *e_book_backend_ex
E2kRestriction *base_rn);
static const char *contact_name (EContact *contact);
+static void proppatch_im (PropMapping *prop_mapping, EContact *new_contact, EContact *cur_contact, E2kProperties *props);
+static void populate_im (EContactField field, EContact *new_contact, void *data);
static GPtrArray *field_names_array;
static const char **field_names;
@@ -133,6 +135,7 @@ http_status_to_pas (E2kHTTPStatus status
#define CAL_FIELD(x,z) { E_CONTACT_##x, E2K_PR_CALENDAR_##x, z, FLAG_UNLIKEABLE, NULL }
#define HTTPMAIL_FIELD(x,y,z) { E_CONTACT_##x, E2K_PR_HTTPMAIL_##y, z, FLAG_UNLIKEABLE | FLAG_PUT, NULL }
#define EXCHANGE_FIELD(x,y,z,w,v) { E_CONTACT_##x, E2K_PR_EXCHANGE_##y, z, FLAG_COMPOSITE, w, v }
+#define IM_FIELD(x,z) { E_CONTACT_##x, E2K_PR_OUTLOOK_CONTACT_IM_ADDR, z, FLAG_COMPOSITE, proppatch_im, populate_im }
struct PropMapping {
EContactField field;
@@ -200,6 +203,12 @@ prop_mappings[] = {
DATE_FIELD (BIRTH_DATE, "birth_date"),
DATE_FIELD (ANNIVERSARY, "anniversary"),
CAL_FIELD (FREEBUSY_URL, "fburl"),
+ IM_FIELD (IM_ICQ, "icq"),
+ IM_FIELD (IM_AIM, "aim"),
+ IM_FIELD (IM_MSN, "msn"),
+ IM_FIELD (IM_YAHOO, "yahoo"),
+ IM_FIELD (IM_JABBER, "jabber"),
+ IM_FIELD (IM_GROUPWISE, "nov"),
HTTPMAIL_FIELD (NOTE, TEXT_DESCRIPTION, "note"),
@@ -995,6 +1004,79 @@ proppatch_address (PropMapping *prop_map
e_contact_address_free (new_address);
if (cur_address)
e_contact_address_free (cur_address);
+}
+
+static void
+free_attr_list (GList *attr_list)
+{
+ GList *l;
+
+ for (l = attr_list; l; l = g_list_next (l)) {
+ EVCardAttribute *attr = l->data;
+ e_vcard_attribute_free (attr);
+ }
+
+ g_list_free (attr_list);
+}
+
+static void
+proppatch_im (PropMapping *prop_mapping,
+ EContact *new_contact, EContact *cur_contact,
+ E2kProperties *props)
+{
+ GList *new_list;
+
+ new_list = e_contact_get (new_contact, prop_mapping->field);
+ for (; new_list; new_list = g_list_next (new_list)) {
+ if (prop_mapping->field == E_CONTACT_IM_MSN) {
+ e2k_properties_set_string (props,
+ E2K_PR_OUTLOOK_CONTACT_IM_ADDR,
+ g_strdup (new_list->data));
+ }
+ }
+}
+
+static void
+populate_im (EContactField field, EContact *new_contact, void *data)
+{
+ GList *aim_list = NULL;
+ GList *icq_list = NULL;
+ GList *yahoo_list = NULL;
+ GList *msn_list = NULL;
+ GList *jabber_list = NULL;
+ GList *groupwise_list = NULL;
+ GList **im_attr_list = NULL;
+ EVCardAttribute *attr;
+
+ if (field == E_CONTACT_IM_ICQ)
+ im_attr_list = &icq_list;
+ else if (field == E_CONTACT_IM_AIM)
+ im_attr_list = &aim_list;
+ else if (field == E_CONTACT_IM_MSN)
+ im_attr_list = &msn_list;
+ else if (field == E_CONTACT_IM_YAHOO)
+ im_attr_list = &yahoo_list;
+ else if (field == E_CONTACT_IM_JABBER)
+ im_attr_list = &jabber_list;
+ else
+ im_attr_list = &groupwise_list;
+
+ attr = e_vcard_attribute_new ("", e_contact_vcard_attribute (field));
+ e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new (EVC_TYPE), "WORK");
+
+ if (field == E_CONTACT_IM_MSN)
+ e_vcard_attribute_add_value (attr, (const char *)data);
+
+ *im_attr_list = g_list_append (*im_attr_list, attr);
+
+ e_contact_set_attributes (new_contact, field, *im_attr_list);
+
+ free_attr_list (aim_list);
+ free_attr_list (jabber_list);
+ free_attr_list (icq_list);
+ free_attr_list (yahoo_list);
+ free_attr_list (msn_list);
+ free_attr_list (groupwise_list);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]