aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-04-26 23:05:33 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-04-26 23:05:33 +0800
commitc67695c6f2d5ea5450d90dbf0ecb5590744ec15a (patch)
treebaa4da652373f90b6d28779af6dfabc161697f93 /calendar/gui
parent67c0ce8617f12ee0a937ffe14fb40f390e4df86d (diff)
downloadgsoc2013-evolution-c67695c6f2d5ea5450d90dbf0ecb5590744ec15a.tar
gsoc2013-evolution-c67695c6f2d5ea5450d90dbf0ecb5590744ec15a.tar.gz
gsoc2013-evolution-c67695c6f2d5ea5450d90dbf0ecb5590744ec15a.tar.bz2
gsoc2013-evolution-c67695c6f2d5ea5450d90dbf0ecb5590744ec15a.tar.lz
gsoc2013-evolution-c67695c6f2d5ea5450d90dbf0ecb5590744ec15a.tar.xz
gsoc2013-evolution-c67695c6f2d5ea5450d90dbf0ecb5590744ec15a.tar.zst
gsoc2013-evolution-c67695c6f2d5ea5450d90dbf0ecb5590744ec15a.zip
itip-utils cleanups.
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/itip-utils.c88
-rw-r--r--calendar/gui/itip-utils.h64
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 */