diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-04-26 23:05:33 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:57 +0800 |
commit | 4d02935fbb960375d57912bdd6ca20d2ba73b233 (patch) | |
tree | c85f7a1964ddb9e8963b2223e2859c630604dd17 /calendar/gui | |
parent | 5294ca6fc8ae393c88678b8a61cb71a22ee067af (diff) | |
download | gsoc2013-evolution-4d02935fbb960375d57912bdd6ca20d2ba73b233.tar gsoc2013-evolution-4d02935fbb960375d57912bdd6ca20d2ba73b233.tar.gz gsoc2013-evolution-4d02935fbb960375d57912bdd6ca20d2ba73b233.tar.bz2 gsoc2013-evolution-4d02935fbb960375d57912bdd6ca20d2ba73b233.tar.lz gsoc2013-evolution-4d02935fbb960375d57912bdd6ca20d2ba73b233.tar.xz gsoc2013-evolution-4d02935fbb960375d57912bdd6ca20d2ba73b233.tar.zst gsoc2013-evolution-4d02935fbb960375d57912bdd6ca20d2ba73b233.zip |
itip-utils cleanups.
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/itip-utils.c | 88 | ||||
-rw-r--r-- | calendar/gui/itip-utils.h | 64 |
2 files changed, 96 insertions, 56 deletions
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 8e96deb3e4..1ce299e18b 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -62,7 +62,16 @@ static icalproperty_method itip_methods_enum[] = { }; gboolean -itip_organizer_is_user_ex (ECalComponent *comp, ECal *client, gboolean skip_cap_test) +itip_organizer_is_user (ECalComponent *comp, + ECal *client) +{ + return itip_organizer_is_user_ex (comp, client, FALSE); +} + +gboolean +itip_organizer_is_user_ex (ECalComponent *comp, + ECal *client, + gboolean skip_cap_test) { ECalComponentOrganizer organizer; const gchar *strip; @@ -102,13 +111,8 @@ itip_organizer_is_user_ex (ECalComponent *comp, ECal *client, gboolean skip_cap_ } gboolean -itip_organizer_is_user (ECalComponent *comp, ECal *client) -{ - return itip_organizer_is_user_ex (comp, client, FALSE); -} - -gboolean -itip_sentby_is_user (ECalComponent *comp, ECal *client) +itip_sentby_is_user (ECalComponent *comp, + ECal *client) { ECalComponentOrganizer organizer; const gchar *strip; @@ -131,7 +135,8 @@ itip_sentby_is_user (ECalComponent *comp, ECal *client) } static ECalComponentAttendee * -get_attendee (GSList *attendees, gchar *address) +get_attendee (GSList *attendees, + gchar *address) { GSList *l; @@ -150,7 +155,8 @@ get_attendee (GSList *attendees, gchar *address) } static ECalComponentAttendee * -get_attendee_if_attendee_sentby_is_user (GSList *attendees, gchar *address) +get_attendee_if_attendee_sentby_is_user (GSList *attendees, + gchar *address) { GSList *l; @@ -180,7 +186,8 @@ html_new_lines_for (const gchar *string) } gchar * -itip_get_comp_attendee (ECalComponent *comp, ECal *client) +itip_get_comp_attendee (ECalComponent *comp, + ECal *client) { GSList *attendees; EAccountList *al; @@ -236,8 +243,9 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client) return user_email; } - /* If the account was not found in the attendees list, then let's - check the 'sentby' fields of the attendees if we can find the account */ + /* If the account was not found in the attendees list, then + * let's check the 'sentby' fields of the attendees if we can + * find the account. */ attendee = get_attendee_if_attendee_sentby_is_user (attendees, a->id->address); if (attendee) { gchar *user_email = g_strdup (itip_strip_mailto (attendee->sentby)); @@ -247,8 +255,9 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client) } } - /* We could not find the attendee in the component, so just give the default - account address if the email address is not set in the backend */ + /* We could not find the attendee in the component, so just give + * the default account address if the email address is not set in + * the backend. */ /* FIXME do we have a better way ? */ a = e_get_default_account (); address = g_strdup ((a != NULL) ? a->id->address : ""); @@ -358,7 +367,8 @@ comp_toplevel_with_zones (ECalComponentItipMethod method, } static gboolean -users_has_attendee (GList *users, const gchar *address) +users_has_attendee (GList *users, + const gchar *address) { GList *l; @@ -371,7 +381,8 @@ users_has_attendee (GList *users, const gchar *address) } static gchar * -comp_from (ECalComponentItipMethod method, ECalComponent *comp) +comp_from (ECalComponentItipMethod method, + ECalComponent *comp) { ECalComponentOrganizer organizer; ECalComponentAttendee *attendee; @@ -620,7 +631,8 @@ comp_to_list (ECalComponentItipMethod method, } static gchar * -comp_subject (ECalComponentItipMethod method, ECalComponent *comp) +comp_subject (ECalComponentItipMethod method, + ECalComponent *comp) { ECalComponentText caltext; const gchar *description, *prefix = NULL; @@ -762,12 +774,19 @@ comp_subject (ECalComponentItipMethod method, ECalComponent *comp) } static gchar * -comp_content_type (ECalComponent *comp, ECalComponentItipMethod method) +comp_content_type (ECalComponent *comp, + ECalComponentItipMethod method) { + const gchar *name; + + if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_FREEBUSY) + name = "freebusy.ifb"; + else + name = "calendar.ics"; + return g_strdup_printf ( "text/calendar; name=\"%s\"; charset=utf-8; METHOD=%s", - e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_FREEBUSY ? - "freebusy.ifb" : "calendar.ics", itip_methods[method]); + name, itip_methods[method]); } static const gchar * @@ -1243,7 +1262,8 @@ append_cal_attachments (EMsgComposer *composer, attachment, mime_attach->encoded_data, mime_attach->length, mime_attach->content_type); if (mime_attach->content_id) - camel_mime_part_set_content_id (attachment, mime_attach->content_id); + camel_mime_part_set_content_id ( + attachment, mime_attach->content_id); if (mime_attach->filename != NULL) camel_mime_part_set_filename ( attachment, mime_attach->filename); @@ -1271,7 +1291,8 @@ append_cal_attachments (EMsgComposer *composer, } static EAccount * -find_enabled_account (EAccountList *accounts, const gchar *id_address) +find_enabled_account (EAccountList *accounts, + const gchar *id_address) { EIterator *it; EAccount *account = NULL; @@ -1468,7 +1489,7 @@ itip_send_comp (ECalComponentItipMethod method, retval = TRUE; - cleanup: +cleanup: if (comp != NULL) g_object_unref (comp); if (top_level != NULL) @@ -1657,8 +1678,10 @@ reply_to_calendar_comp (ECalComponentItipMethod method, } gboolean -itip_publish_begin (ECalComponent *pub_comp, ECal *client, - gboolean cloned, ECalComponent **clone) +itip_publish_begin (ECalComponent *pub_comp, + ECal *client, + gboolean cloned, + ECalComponent **clone) { icalcomponent *icomp =NULL, *icomp_clone = NULL; icalproperty *prop; @@ -1795,14 +1818,14 @@ comp_fb_normalize (icalcomponent *icomp) } return iclone; - /* this will never be reached */ - g_object_unref (iclone); - return NULL; } gboolean -itip_publish_comp (ECal *client, gchar *uri, gchar *username, - gchar *password, ECalComponent **pub_comp) +itip_publish_comp (ECal *client, + gchar *uri, + gchar *username, + gchar *password, + ECalComponent **pub_comp) { icalcomponent *toplevel = NULL, *icalcomp = NULL; icalcomponent *icomp = NULL; @@ -1869,7 +1892,8 @@ itip_publish_comp (ECal *client, gchar *uri, gchar *username, } static gboolean -check_time (const struct icaltimetype tmval, gboolean can_null_time) +check_time (const struct icaltimetype tmval, + gboolean can_null_time) { if (icaltime_is_null_time (tmval)) return can_null_time; diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h index 5f320f871e..0362cb0314 100644 --- a/calendar/gui/itip-utils.h +++ b/calendar/gui/itip-utils.h @@ -17,8 +17,8 @@ * */ -#ifndef ITIP_UTILS_HEADER -#define ITIP_UTILS_HEADER +#ifndef ITIP_UTILS_H +#define ITIP_UTILS_H #include <libical/ical.h> #include <string.h> @@ -27,6 +27,8 @@ #include <libecal/e-cal-component.h> #include <libedataserver/e-account-list.h> +G_BEGIN_DECLS + typedef enum { E_CAL_COMPONENT_METHOD_PUBLISH, E_CAL_COMPONENT_METHOD_REQUEST, @@ -48,27 +50,41 @@ struct CalMimeAttach { guint length; }; -gboolean itip_organizer_is_user (ECalComponent *comp, ECal *client); -gboolean itip_organizer_is_user_ex (ECalComponent *comp, ECal *client, gboolean skip_cap_test); -gboolean itip_sentby_is_user (ECalComponent *comp, ECal *client); - -const gchar *itip_strip_mailto (const gchar *address); - -gchar *itip_get_comp_attendee (ECalComponent *comp, ECal *client); - -gboolean itip_send_comp (ECalComponentItipMethod method, ECalComponent *comp, - ECal *client, icalcomponent *zones, GSList *attachments_list, GList *users, - gboolean strip_alarms, gboolean only_new_attendees); - -gboolean itip_publish_comp (ECal *client, gchar * uri, gchar * username, - gchar * password, ECalComponent **pub_comp); - -gboolean itip_publish_begin (ECalComponent *pub_comp, ECal *client, - gboolean cloned, ECalComponent **clone); - -gboolean reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp, - ECal *client, gboolean reply_all, icalcomponent *zones, GSList *attachments_list); +gboolean itip_organizer_is_user (ECalComponent *comp, + ECal *client); +gboolean itip_organizer_is_user_ex (ECalComponent *comp, + ECal *client, + gboolean skip_cap_test); +gboolean itip_sentby_is_user (ECalComponent *comp, + ECal *client); +const gchar * itip_strip_mailto (const gchar *address); +gchar * itip_get_comp_attendee (ECalComponent *comp, + ECal *client); +gboolean itip_send_comp (ECalComponentItipMethod method, + ECalComponent *comp, + ECal *client, + icalcomponent *zones, + GSList *attachments_list, + GList *users, + gboolean strip_alarms, + gboolean only_new_attendees); +gboolean itip_publish_comp (ECal *client, + gchar *uri, + gchar *username, + gchar *password, + ECalComponent **pub_comp); +gboolean itip_publish_begin (ECalComponent *pub_comp, + ECal *client, + gboolean cloned, + ECalComponent **clone); +gboolean reply_to_calendar_comp (ECalComponentItipMethod method, + ECalComponent *send_comp, + ECal *client, + gboolean reply_all, + icalcomponent *zones, + GSList *attachments_list); +gboolean is_icalcomp_valid (icalcomponent *icalcomp); -gboolean is_icalcomp_valid (icalcomponent *icalcomp); +G_END_DECLS -#endif +#endif /* ITIP_UTILS_H */ |