From: Parthasarathi Susarla Date: Wed, 6 Jul 2005 09:33:18 +0000 (+0000) Subject: added padding to 'struct _EGwItemPrivate' (free_link_info): X-Git-Tag: upstream/3.7.4~7279 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=361932b04423052e2466f522b4e1078eacce22cb;p=platform%2Fupstream%2Fevolution-data-server.git added padding to 'struct _EGwItemPrivate' (free_link_info): 2005-07-06 Parthasarathi Susarla * e-gw-connection.[ch] : (e_gw_connection_forward_item): * e-gw-item.[ch]: added padding to 'struct _EGwItemPrivate' (free_link_info): (e_gw_item_new_from_soap_parameter): Support for Groupwise Notes. Adds size of the mail, for display in summary. Support for message body > 64 K Added linkInfo element for thread information to the server (add_attachment_to_soap_message): set itemReference in case of forwarded mails. --- diff --git a/servers/groupwise/ChangeLog b/servers/groupwise/ChangeLog index 1df0d5c..ca5926c 100644 --- a/servers/groupwise/ChangeLog +++ b/servers/groupwise/ChangeLog @@ -1,3 +1,19 @@ +2005-07-06 Parthasarathi Susarla + + * e-gw-connection.[ch] : + (e_gw_connection_forward_item): + * e-gw-item.[ch]: + added padding to 'struct _EGwItemPrivate' + (free_link_info): + (e_gw_item_new_from_soap_parameter): + Support for Groupwise Notes. + Adds size of the mail, for display in summary. + Support for message body > 64 K + Added linkInfo element for thread information to the server + (add_attachment_to_soap_message): + set itemReference in case of forwarded mails. + + 2005-07-05 Harish Krishnaswamy * e-gw-item.c: (e_gw_item_new_from_soap_parameter), diff --git a/servers/groupwise/e-gw-connection.c b/servers/groupwise/e-gw-connection.c index 83b0c6b..466da76 100644 --- a/servers/groupwise/e-gw-connection.c +++ b/servers/groupwise/e-gw-connection.c @@ -2382,6 +2382,10 @@ EGwConnectionStatus e_gw_connection_get_quick_messages (EGwConnection *cnc, cons } if (!strcmp (message_list, "All")) { + gboolean view_is_id = FALSE; + + if (!strcmp (view, "id")) + view_is_id = TRUE; /* We are interested only in getting the ids */ for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item"); subparam != NULL; @@ -2389,14 +2393,20 @@ EGwConnectionStatus e_gw_connection_get_quick_messages (EGwConnection *cnc, cons SoupSoapParameter *param_id; char *id; - param_id = soup_soap_parameter_get_first_child_by_name (subparam, "iCalId"); - if (!param_id) { + if (view_is_id) { param_id = soup_soap_parameter_get_first_child_by_name (subparam, "id"); if (!param_id) { g_object_unref (response); g_object_unref (msg); return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; } + } else { + param_id = soup_soap_parameter_get_first_child_by_name (subparam, "iCalId"); + if (!param_id) { + g_object_unref (response); + g_object_unref (msg); + return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; + } } id = g_strdup (soup_soap_parameter_get_string_value (param_id)); @@ -2908,6 +2918,66 @@ e_gw_connection_reply_item (EGwConnection *cnc, const char *id, const char *view return E_GW_CONNECTION_STATUS_OK; } +EGwConnectionStatus +e_gw_connection_forward_item (EGwConnection *cnc, const char *id, const char *view, gboolean embed, EGwItem **item) +{ + SoupSoapMessage *msg; + SoupSoapResponse *response; + EGwConnectionStatus status; + SoupSoapParameter *param; + + g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT); + + /* build the SOAP message */ + msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "forwardRequest"); + if (!msg) { + g_warning (G_STRLOC ": Could not build SOAP message"); + return E_GW_CONNECTION_STATUS_UNKNOWN; + } + + e_gw_message_write_string_parameter (msg, "id", NULL, id); + + if (view) + e_gw_message_write_string_parameter (msg, "view", NULL, view) ; + + if (embed) + e_gw_message_write_int_parameter (msg, "embed", NULL,1); + + e_gw_message_write_footer (msg); + /* send message to server */ + response = e_gw_connection_send_message (cnc, msg); + if (!response) { + g_object_unref (msg); + return E_GW_CONNECTION_STATUS_NO_RESPONSE; + } + + status = e_gw_connection_parse_response_status (response); + if (status != E_GW_CONNECTION_STATUS_OK) { + if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION) + reauthenticate (cnc); + g_object_unref (response); + g_object_unref (msg); + return status; + } + + /* if status is OK - parse result. return the list */ + param = soup_soap_response_get_first_parameter_by_name (response, "item"); + if (!param) { + g_object_unref (response); + g_object_unref (msg); + return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; + } + + *item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, "", param); + + + /* free memory */ + g_object_unref (response); + g_object_unref (msg); + + return E_GW_CONNECTION_STATUS_OK; +} + /* e_gw_connection_create_junk_entry :creates a junk entry in the list * @cnc * @value : to be added in the list diff --git a/servers/groupwise/e-gw-connection.h b/servers/groupwise/e-gw-connection.h index 4f8336c..7fe10ff 100644 --- a/servers/groupwise/e-gw-connection.h +++ b/servers/groupwise/e-gw-connection.h @@ -157,6 +157,7 @@ EGwConnectionStatus e_gw_connection_purge_deleted_items (EGwConnection *cnc); EGwConnectionStatus e_gw_connection_mark_read(EGwConnection *cnc, GList *item_ids) ; EGwConnectionStatus e_gw_connection_mark_unread(EGwConnection *cnc, GList *item_ids) ; EGwConnectionStatus e_gw_connection_reply_item (EGwConnection *cnc, const char *id, const char *view, EGwItem **item) ; +EGwConnectionStatus e_gw_connection_forward_item (EGwConnection *cnc, const char *id, const char *view, gboolean embed, EGwItem **item); EGwConnectionStatus e_gw_connection_create_junk_entry (EGwConnection *cnc, const char *value, const char *match_type , const char *list_type); EGwConnectionStatus e_gw_connection_get_junk_settings (EGwConnection *cnc, int *use_junk, int *use_block, int *use_pab, int *persistence); EGwConnectionStatus e_gw_connection_modify_junk_settings (EGwConnection *cnc, int use_junk, int use_block, int use_pab , int persistence); diff --git a/servers/groupwise/e-gw-item.c b/servers/groupwise/e-gw-item.c index 6ec9b41..291cdcd 100644 --- a/servers/groupwise/e-gw-item.c +++ b/servers/groupwise/e-gw-item.c @@ -56,15 +56,20 @@ struct _EGwItemPrivate { GSList *recipient_list; GSList *recurrence_dates; int trigger; /* alarm */ + /*message size*/ + int size; EGwItemOrganizer *organizer; /*properties for mail*/ char *from ; char *to ; char *content_type ; + char *msg_body_id; int item_status; /*Attachments*/ - GSList *attach_list ; + GSList *attach_list ; + /*linkInfo for replies*/ + EGwItemLinkInfo *link_info; /* properties for tasks/calendars */ char *icalid; @@ -112,6 +117,8 @@ struct _EGwItemPrivate { GHashTable *additions; GHashTable *updates; GHashTable *deletions; + /*padding*/ + unsigned int padding[10]; }; static GObjectClass *parent_class = NULL; @@ -215,6 +222,21 @@ free_im_address ( gpointer address, gpointer data) } } +static void +free_link_info (EGwItemLinkInfo *info) +{ + if (info) { + if (info->id ) + g_free (info->id), info->id = NULL; + if (info->type) + g_free (info->type), info->type = NULL; + if (info->thread) + g_free (info->thread), info->thread = NULL; + g_free (info); + info = NULL; + } +} + static void free_changes ( GHashTable *changes) { @@ -305,7 +327,11 @@ e_gw_item_dispose (GObject *object) if (priv->content_type) { g_free (priv->content_type) ; - priv->to = NULL ; + priv->content_type = NULL ; + } + if (priv->msg_body_id) { + g_free (priv->msg_body_id); + priv->msg_body_id = NULL; } if (priv->icalid) { @@ -367,24 +393,34 @@ e_gw_item_dispose (GObject *object) g_list_free (priv->im_list); priv->im_list = NULL; } + if (priv->category_list) { g_list_foreach (priv->category_list, free_string, NULL); g_list_free (priv->category_list); priv->category_list = NULL; } + if(priv->attach_list) { g_slist_foreach (priv->attach_list, free_attach, NULL); g_slist_free (priv->attach_list) ; priv->attach_list = NULL ; } + if (priv->category_name) { g_free (priv->category_name); priv->category_name = NULL; } + if (priv->source) { g_free (priv->source); priv->source = NULL; } + + if (priv->link_info) { + free_link_info (priv->link_info); + priv->link_info = NULL; + } + free_changes (priv->additions); free_changes (priv->deletions); free_changes (priv->updates); @@ -461,6 +497,8 @@ e_gw_item_init (EGwItem *item, EGwItemClass *klass) priv->updates = g_hash_table_new (g_str_hash, g_str_equal); priv->deletions = g_hash_table_new (g_str_hash, g_str_equal); priv->self_status = 0; + priv->link_info = NULL; + priv->msg_body_id = NULL; item->priv = priv; @@ -1546,6 +1584,8 @@ e_gw_item_new_from_soap_parameter (const char *email, const char *container, Sou item->priv->item_type = E_GW_ITEM_TYPE_APPOINTMENT; else if (!g_ascii_strcasecmp (item_type, "Task")) item->priv->item_type = E_GW_ITEM_TYPE_TASK; + else if (!g_ascii_strcasecmp (item_type, "Note")) + item->priv->item_type = E_GW_ITEM_TYPE_NOTE; else if (!g_ascii_strcasecmp (item_type, "Contact") ) { item->priv->item_type = E_GW_ITEM_TYPE_CONTACT; set_contact_fields_from_soap_parameter (item, param); @@ -1697,18 +1737,16 @@ e_gw_item_new_from_soap_parameter (const char *email, const char *container, Sou organizer->email = soup_soap_parameter_get_string_value (subparam); e_gw_item_set_organizer (item, organizer); } + } else if (!g_ascii_strcasecmp (name, "size")) { + item->priv->size = soup_soap_parameter_get_int_value (child); } else if (!g_ascii_strcasecmp (name, "options")) { SoupSoapParameter *subparam; - char *value = NULL; subparam = soup_soap_parameter_get_first_child_by_name (child, "priority"); - if (subparam) - value = soup_soap_parameter_get_string_value (subparam); - if (value) - item->priv->priority = g_strdup (value); - - g_free (value), value = NULL; + if (subparam) { + item->priv->priority = soup_soap_parameter_get_string_value (subparam); + } subparam = soup_soap_parameter_get_first_child_by_name (child, "expires"); if (subparam) @@ -1763,7 +1801,7 @@ e_gw_item_new_from_soap_parameter (const char *email, const char *container, Sou } } - } else if (!g_ascii_strcasecmp (name, "id")) + } else if (!g_ascii_strcasecmp (name, "id")) item->priv->id = soup_soap_parameter_get_string_value (child); else if (!g_ascii_strcasecmp (name, "message")) { @@ -1779,8 +1817,11 @@ e_gw_item_new_from_soap_parameter (const char *email, const char *container, Sou if (msg && length) { len = atoi (length); item->priv->message = soup_base64_decode (msg, &len); + if (!(item->priv->message)) { + item->priv->msg_body_id = soup_soap_parameter_get_property (part, "id") ; + } item->priv->content_type = soup_soap_parameter_get_property (part, "contentType") ; - } + } g_free (length); g_free (msg); @@ -1792,15 +1833,11 @@ e_gw_item_new_from_soap_parameter (const char *email, const char *container, Sou SoupSoapParameter *temp ; EGwItemAttachment *attach = g_new0 (EGwItemAttachment, 1) ; + temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "id") ; if (temp) { - char *ref = NULL; attach->id = soup_soap_parameter_get_string_value (temp) ; - ref = soup_soap_parameter_get_property (temp, "itemReference"); - if (ref) { - attach->contentType = g_strdup_printf ("gw:%s",ref); - g_free (ref); - } + attach->item_reference = soup_soap_parameter_get_property (temp, "itemReference"); } temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "name") ; @@ -1850,9 +1887,25 @@ e_gw_item_new_from_soap_parameter (const char *email, const char *container, Sou if (!strcmp (value, "personal")) is_group_item = FALSE; g_free (value); - } + } else if (!g_ascii_strcasecmp (name, "link")){ + SoupSoapParameter *subparam; + EGwItemLinkInfo *info = g_new0 (EGwItemLinkInfo, 1); + + subparam = soup_soap_parameter_get_first_child_by_name (child, "id") ; + if (subparam) + info->id = soup_soap_parameter_get_string_value (subparam); + + subparam = soup_soap_parameter_get_first_child_by_name (child, "type") ; + if (subparam) + info->type =soup_soap_parameter_get_string_value (subparam); - else if (!g_ascii_strcasecmp (name, "alarm")) { + subparam = soup_soap_parameter_get_first_child_by_name (child, "thread") ; + if (subparam) + info->thread =soup_soap_parameter_get_string_value (subparam); + + e_gw_item_set_link_info (item, info); + + } else if (!g_ascii_strcasecmp (name, "alarm")) { char *enabled; enabled = soup_soap_parameter_get_property (child, "enabled"); if (!g_ascii_strcasecmp (enabled, "1") ) { @@ -1940,6 +1993,14 @@ e_gw_item_set_id (EGwItem *item, const char *new_id) item->priv->id = g_strdup (new_id); } +int +e_gw_item_get_mail_size (EGwItem *item) +{ + g_return_val_if_fail (E_IS_GW_ITEM (item), 0); + + return item->priv->size; +} + char * e_gw_item_get_creation_date (EGwItem *item) { @@ -2156,7 +2217,6 @@ const char * e_gw_item_get_priority (EGwItem *item) { g_return_val_if_fail (E_IS_GW_ITEM (item), NULL); - return (const char *) item->priv->priority; } @@ -2291,6 +2351,14 @@ e_gw_item_get_msg_content_type (EGwItem *item) return item->priv->content_type ; } +const char * +e_gw_item_get_msg_body_id (EGwItem *item) +{ + g_return_val_if_fail (E_IS_GW_ITEM (item), NULL); + + return item->priv->msg_body_id; +} + void e_gw_item_set_sendoptions (EGwItem *item, gboolean set) { @@ -2501,6 +2569,20 @@ e_gw_item_get_content_type (EGwItem *item) return item->priv->content_type ; } +void +e_gw_item_set_link_info (EGwItem *item, EGwItemLinkInfo *info) +{ + g_return_if_fail (E_IS_GW_ITEM (item)); + item->priv->link_info = info; +} + +EGwItemLinkInfo * +e_gw_item_get_link_info (EGwItem *item) +{ + g_return_val_if_fail (E_IS_GW_ITEM (item), NULL); + return item->priv->link_info; +} + static void add_return_notification (SoupSoapMessage *msg, char *option, EGwItemReturnNotify value) { @@ -2659,10 +2741,12 @@ add_attachment_to_soap_message(EGwItemAttachment *attachment, SoupSoapMessage *m soup_soap_message_start_element (msg, "attachment", NULL, NULL) ; /*id*/ - if (attachment->id) - e_gw_message_write_string_parameter (msg, "id", NULL, attachment->id) ; + if (attachment->id && attachment->item_reference) + e_gw_message_write_string_parameter_with_attribute (msg,"id", NULL, attachment->id, "itemReference", attachment->item_reference); + else if (attachment->id) + e_gw_message_write_string_parameter (msg, "id", NULL, attachment->id); else - e_gw_message_write_string_parameter (msg, "id", NULL, "") ; + e_gw_message_write_string_parameter (msg, "id", NULL, ""); /*name*/ e_gw_message_write_string_parameter (msg, "name", NULL, attachment->name) ; /*content type*/ @@ -2835,13 +2919,22 @@ e_gw_item_append_to_soap_message (EGwItem *item, SoupSoapMessage *msg) /*attachments*/ if (priv->attach_list) { - soup_soap_message_start_element (msg, "attachments", NULL, NULL) ; - GSList *al ; + GSList *al; + soup_soap_message_start_element (msg, "attachments", NULL, NULL); for (al = priv->attach_list ; al != NULL ; al = al->next) { - EGwItemAttachment *attachment = (EGwItemAttachment *)al->data ; - add_attachment_to_soap_message (attachment, msg) ; + EGwItemAttachment *attachment = (EGwItemAttachment *)al->data; + add_attachment_to_soap_message (attachment, msg); } - soup_soap_message_end_element (msg) ; + soup_soap_message_end_element (msg); + } + + /*Link info - used when a mail is being replied to or forwarded*/ + if (priv->link_info) { + soup_soap_message_start_element (msg, "link", NULL, NULL); + e_gw_message_write_string_parameter (msg, "id", NULL, priv->link_info->id) ; + e_gw_message_write_string_parameter (msg, "type", NULL, priv->link_info->type) ; + e_gw_message_write_string_parameter (msg, "thread", NULL, priv->link_info->thread) ; + soup_soap_message_end_element (msg); } break; diff --git a/servers/groupwise/e-gw-item.h b/servers/groupwise/e-gw-item.h index 670a585..34a56b8 100644 --- a/servers/groupwise/e-gw-item.h +++ b/servers/groupwise/e-gw-item.h @@ -49,6 +49,7 @@ typedef enum { E_GW_ITEM_TYPE_RESOURCE, E_GW_ITEM_TYPE_CATEGORY, E_GW_ITEM_TYPE_NOTIFICATION, + E_GW_ITEM_TYPE_NOTE, E_GW_ITEM_TYPE_UNKNOWN } EGwItemType; @@ -122,6 +123,7 @@ typedef struct { typedef struct { char *id ; char *name ; + char *item_reference; char *contentType ; int size ; char *date ; @@ -140,6 +142,12 @@ typedef enum { E_GW_ITEM_ALL } EGwItemTrack; +typedef struct { + char *id; + char *type; + char *thread; +} EGwItemLinkInfo; + GType e_gw_item_get_type (void); EGwItem *e_gw_item_new_empty (void); EGwItem *e_gw_item_new_from_soap_parameter (const char *email, const char *container, SoupSoapParameter *param); @@ -191,7 +199,11 @@ const char* e_gw_item_get_to (EGwItem *item) ; const char *e_gw_item_get_msg_content_type (EGwItem *item) ; guint32 e_gw_item_get_item_status (EGwItem *item); void e_gw_item_set_content_type (EGwItem *item, const char *content_type) ; +void e_gw_item_set_link_info (EGwItem *item, EGwItemLinkInfo *info); +EGwItemLinkInfo *e_gw_item_get_link_info (EGwItem *item); char *e_gw_item_get_content_type (EGwItem *item) ; +const char *e_gw_item_get_msg_body_id (EGwItem *item); +int e_gw_item_get_mail_size (EGwItem *item); void e_gw_item_set_change (EGwItem *item, EGwItemChangeType change_type, char *field_name, gpointer field_value); gboolean e_gw_item_append_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg); void e_gw_item_set_category_name (EGwItem *item, char *cateogry_name); @@ -241,6 +253,7 @@ void e_gw_item_set_accept_level (EGwItem *item, const char *new_level); const char *e_gw_item_get_priority (EGwItem *item); void e_gw_item_set_priority (EGwItem *item, const char *new_priority); + const char *e_gw_item_get_task_priority (EGwItem *item); void e_gw_item_set_task_priority (EGwItem *item, const char *new_priority);