static gboolean is_meeting_owner (ECalComponent *comp, ECalClient *client) { ECalComponentOrganizer org; gchar *email = NULL; const gchar *strip = NULL; gboolean ret_val = FALSE; if (!(e_cal_component_has_attendees (comp) && e_cal_client_check_save_schedules (client))) return ret_val; e_cal_component_get_organizer (comp, &org); strip = itip_strip_mailto (org.value); if (e_client_get_backend_property_sync (E_CLIENT (client), CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &email, NULL, NULL) && !g_ascii_strcasecmp (email, strip)) { ret_val = TRUE; } if (!ret_val) ret_val = itip_address_is_user (strip); g_free (email); return ret_val; }
/** * cancel_component_dialog: * * Pops up a dialog box asking the user whether he wants to send a * cancel and delete an iTip/iMip message * * Return value: TRUE if the user clicked Yes, FALSE otherwise. **/ gboolean cancel_component_dialog (GtkWindow *parent, ECalClient *cal_client, ECalComponent *comp, gboolean deleting) { ECalComponentVType vtype; const gchar *id; if (deleting && e_cal_client_check_save_schedules (cal_client)) return TRUE; vtype = e_cal_component_get_vtype (comp); switch (vtype) { case E_CAL_COMPONENT_EVENT: if (is_past_event (comp)) { /* don't ask neither send notification to others on past events */ return FALSE; } if (deleting) id = "calendar:prompt-cancel-meeting"; else id = "calendar:prompt-delete-meeting"; break; case E_CAL_COMPONENT_TODO: if (deleting) id = "calendar:prompt-cancel-task"; else id = "calendar:prompt-delete-task"; break; case E_CAL_COMPONENT_JOURNAL: if (deleting) id = "calendar:prompt-cancel-memo"; else id = "calendar:prompt-delete-memo"; break; default: g_message (G_STRLOC ": Cannot handle object of type %d", vtype); return FALSE; } if (e_alert_run_dialog_for_args (parent, id, NULL) == GTK_RESPONSE_YES) return TRUE; else return FALSE; }