本文整理汇总了C++中icalcomponent_get_first_property函数的典型用法代码示例。如果您正苦于以下问题:C++ icalcomponent_get_first_property函数的具体用法?C++ icalcomponent_get_first_property怎么用?C++ icalcomponent_get_first_property使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icalcomponent_get_first_property函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_vtimezone
/**
* get ICalendar VTIMEZONE block from ECalComponentWithTZ
*
* @param ectz
* An evolution event/task/note type which may contain a time zone.
*
* @return the ICalendar VTIMEZONE block
*/
static gchar*
get_vtimezone (const ECalComponentWithTZ *ectz)
{
icalcomponent *icc = NULL;
icalcomponent *cloned_icc = NULL;
icalproperty *dtstamp = NULL;
icalproperty *uid = NULL;
gchar *ical_str = NULL;
if (ectz == NULL || ectz->maincomp == NULL || ectz->timezone == NULL)
return NULL;
icc = e_cal_component_get_icalcomponent (ectz->timezone);
cloned_icc = icalcomponent_new_clone (icc);
/* uid and dtstamp are not needed (nor wanted) in timezone block */
uid = icalcomponent_get_first_property(cloned_icc, ICAL_UID_PROPERTY);
icalcomponent_remove_property (cloned_icc, uid);
free(uid);
dtstamp = icalcomponent_get_first_property(cloned_icc, ICAL_DTSTAMP_PROPERTY);
icalcomponent_remove_property (cloned_icc, dtstamp);
free(dtstamp);
/* memory returned by *_as_ical_string() is owned by libical */
ical_str = g_strdup (icalcomponent_as_ical_string (cloned_icc));
icalcomponent_free (cloned_icc);
return ical_str;
}
示例2: icaltimezone_get_location_from_vtimezone
/** Gets the LOCATION or X-LIC-LOCATION property from a VTIMEZONE. */
static char*
icaltimezone_get_location_from_vtimezone (icalcomponent *component)
{
icalproperty *prop;
const char *location;
const char *name;
prop = icalcomponent_get_first_property (component,
ICAL_LOCATION_PROPERTY);
if (prop) {
location = icalproperty_get_location (prop);
if (location)
return strdup (location);
}
prop = icalcomponent_get_first_property (component, ICAL_X_PROPERTY);
while (prop) {
name = icalproperty_get_x_name (prop);
if (name && !strcasecmp (name, "X-LIC-LOCATION")) {
location = icalproperty_get_x (prop);
if (location)
return strdup (location);
}
prop = icalcomponent_get_next_property (component,
ICAL_X_PROPERTY);
}
return NULL;
}
示例3: create_simple_component
void create_simple_component(void)
{
icalcomponent* calendar;
icalproperty *version, *bogus;
/* Create calendar and add properties */
calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
ok("create vcalendar component", (calendar!=NULL));
icalcomponent_add_property(
calendar,
icalproperty_new_version("2.0")
);
version = icalcomponent_get_first_property(calendar,ICAL_VERSION_PROPERTY);
ok("version property added", (version!=NULL));
bogus = icalcomponent_get_first_property(calendar,ICAL_DTSTART_PROPERTY);
ok("bogus dtstart not found", (bogus == NULL));
if (VERBOSE && calendar)
printf("%s\n",icalcomponent_as_ical_string(calendar));
icalcomponent_free(calendar);
}
示例4: icalproperty_string_to_kind
icalproperty *icallangbind_get_first_property(icalcomponent *c, const char *prop)
{
icalproperty_kind kind = icalproperty_string_to_kind(prop);
icalproperty *p;
if (kind == ICAL_NO_PROPERTY) {
return 0;
}
if (kind == ICAL_X_PROPERTY) {
for (p = icalcomponent_get_first_property(c, kind);
p != 0; p = icalcomponent_get_next_property(c, kind)) {
if (strcmp(icalproperty_get_x_name(p), prop) == 0) {
return p;
}
}
} else {
p = icalcomponent_get_first_property(c, kind);
return p;
}
return 0;
}
示例5: find_attendee
static icalproperty *
find_attendee (icalcomponent *ical_comp, const char *address)
{
icalproperty *prop;
if (address == NULL)
return NULL;
for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
prop != NULL;
prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY)) {
icalvalue *value;
const char *attendee;
char *text;
value = icalproperty_get_value (prop);
if (!value)
continue;
attendee = icalvalue_get_string (value);
text = g_strdup (itip_strip_mailto (attendee));
text = g_strstrip (text);
if (!g_ascii_strcasecmp (address, text)) {
g_free (text);
break;
}
g_free (text);
}
return prop;
}
示例6: icalmessage_get_inner
static icalproperty *icalmessage_find_attendee(icalcomponent *comp, const char *user)
{
icalcomponent *inner = icalmessage_get_inner(comp);
icalproperty *p, *attendee = 0;
char *luser = lowercase(user);
for (p = icalcomponent_get_first_property(inner, ICAL_ATTENDEE_PROPERTY);
p != 0;
p = icalcomponent_get_next_property(inner, ICAL_ATTENDEE_PROPERTY)) {
char *lattendee;
lattendee = lowercase(icalproperty_get_attendee(p));
if (strstr(lattendee, user) != 0) {
free(lattendee);
attendee = p;
break;
}
free(lattendee);
}
free(luser);
return attendee;
}
示例7: icalerror_check_arg_rz
icalcomponent *icalmessage_new_delegate_request(icalcomponent *c,
const char *user,
const char *delegatee, const char *msg)
{
icalcomponent *reply;
icalproperty *attendee;
icalcomponent *inner;
icalparameter *delegateeParam;
icalerror_check_arg_rz(c, "c");
reply = icalmessage_new_reply_base(c, user, msg);
inner = icalmessage_get_inner(reply);
if (reply == 0) {
return 0;
}
icalcomponent_set_method(reply, ICAL_METHOD_REQUEST);
attendee = icalcomponent_get_first_property(inner, ICAL_ATTENDEE_PROPERTY);
icalproperty_set_parameter(attendee, icalparameter_new_partstat(ICAL_PARTSTAT_DELEGATED));
icalproperty_set_parameter(attendee, icalparameter_new_delegatedto(delegatee));
delegateeParam = icalparameter_new_delegatedfrom(icalproperty_get_attendee(attendee));
icalcomponent_add_property(
inner,
icalproperty_vanew_attendee(delegatee, delegateeParam, 0));
icalparameter_free(delegateeParam);
return reply;
}
示例8: icomp_x_prop_set
/** Set icalcomponent X-* property.
*
* @param comp iCal component.
* @param key Property name (i.e. X-EEE-WHATEVER).
* @param value Property value.
*/
static void icomp_x_prop_set(icalcomponent *comp, const char *key, const char *value)
{
icalproperty *iter;
g_return_if_fail(comp != NULL);
g_return_if_fail(key != NULL);
again:
for (iter = icalcomponent_get_first_property(comp, ICAL_X_PROPERTY);
iter;
iter = icalcomponent_get_next_property(comp, ICAL_X_PROPERTY))
{
const char *str = icalproperty_get_x_name(iter);
if (str && !g_strcmp0(str, key))
{
icalcomponent_remove_property(comp, iter);
icalproperty_free(iter);
goto again;
}
}
if (value)
{
iter = icalproperty_new_x(value);
icalproperty_set_x_name(iter, key);
icalcomponent_add_property(comp, iter);
}
}
示例9: icalcomponent_get_first_component
icalproperty *icalcomponent_get_first_invitee(icalcomponent *comp)
{
icalproperty *prop;
if (icalcomponent_isa(comp) == ICAL_VPOLL_COMPONENT) {
icalcomponent *vvoter =
icalcomponent_get_first_component(comp, ICAL_VVOTER_COMPONENT);
prop = icalcomponent_get_first_property(vvoter, ICAL_VOTER_PROPERTY);
}
else {
prop = icalcomponent_get_first_property(comp, ICAL_ATTENDEE_PROPERTY);
}
return prop;
}
示例10: update_objects
static gboolean
update_objects (ECal *client, icalcomponent *icalcomp)
{
icalcomponent_kind kind;
icalcomponent *vcal;
gboolean success = TRUE;
kind = icalcomponent_isa (icalcomp);
if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT) {
vcal = e_cal_util_new_top_level ();
if (icalcomponent_get_method (icalcomp) == ICAL_METHOD_CANCEL)
icalcomponent_set_method (vcal, ICAL_METHOD_CANCEL);
else
icalcomponent_set_method (vcal, ICAL_METHOD_PUBLISH);
icalcomponent_add_component (vcal, icalcomponent_new_clone (icalcomp));
} else if (kind == ICAL_VCALENDAR_COMPONENT) {
vcal = icalcomponent_new_clone (icalcomp);
if (!icalcomponent_get_first_property (vcal, ICAL_METHOD_PROPERTY))
icalcomponent_set_method (vcal, ICAL_METHOD_PUBLISH);
} else
return FALSE;
if (!e_cal_receive_objects (client, vcal, NULL))
success = FALSE;
icalcomponent_free (vcal);
return success;
}
示例11: view_event
void view_event(icalcomponent* calendar)
{
//Ask user if they want null fields in addition to filled ones
bool show_null_fields_too = yes_no_prompt("Do you want to view empty fields? (y/n)");
icalcomponent* event = find_event(calendar);
if (event == NULL)
{
append_action_to_closed_log("View event", false);
}
//Once user selects desired one, displays all needed fields
icalproperty* p;
for(p = icalcomponent_get_first_property(event,ICAL_ANY_PROPERTY); p != 0; p = icalcomponent_get_next_property(event,ICAL_ANY_PROPERTY))
{
if ((icalproperty_get_comment(p) != NULL) || (show_null_fields_too))
{
cout << icalproperty_get_x_name(p) << ": ";
cout << icalproperty_get_comment(p) << endl;
}
}
append_action_to_closed_log("View event", true);
}
示例12: icaldirset_add_uid
static void icaldirset_add_uid(icalcomponent* comp)
{
char uidstring[ICAL_PATH_MAX];
icalproperty *uid;
#ifndef WIN32
struct utsname unamebuf;
#endif
icalerror_check_arg_rv( (comp!=0), "comp");
uid = icalcomponent_get_first_property(comp,ICAL_UID_PROPERTY);
if (uid == 0) {
#ifndef WIN32
uname(&unamebuf);
snprintf(uidstring,sizeof(uidstring),"%d-%s",(int)getpid(),unamebuf.nodename);
#else
snprintf(uidstring,sizeof(uidstring),"%d-%s",(int)getpid(),"WINDOWS"); /* FIX: There must be an easy get the system name */
#endif
uid = icalproperty_new_uid(uidstring);
icalcomponent_add_property(comp,uid);
} else {
strcpy(uidstring,icalproperty_get_uid(uid));
}
}
示例13: scalix_appointment_get
gboolean
scalix_appointment_get (ScalixAppointment * comp, const char *key, char **value)
{
icalcomponent *icomp;
icalproperty *icalprop;
const char *x_val;
icomp = e_cal_component_get_icalcomponent (E_CAL_COMPONENT (comp));
icalprop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY);
while (icalprop) {
const char *x_name;
x_name = icalproperty_get_x_name (icalprop);
x_val = icalproperty_get_x (icalprop);
if (!strcmp (x_name, key)) {
break;
}
icalprop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY);
}
if (icalprop) {
*value = g_strdup (x_val);
return TRUE;
}
*value = NULL;
return FALSE;
}
示例14: scalix_appointment_unset
void
scalix_appointment_unset (ScalixAppointment * comp, const char *key)
{
icalcomponent *icomp;
icalproperty *icalprop;
const char *x_val;
GSList *list, *iter;
list = NULL;
icomp = e_cal_component_get_icalcomponent (E_CAL_COMPONENT (comp));
icalprop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY);
while (icalprop) {
const char *x_name;
x_name = icalproperty_get_x_name (icalprop);
x_val = icalproperty_get_x (icalprop);
if (!strcmp (x_name, key)) {
list = g_slist_prepend (list, icalprop);
}
icalprop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY);
}
for (iter = list; iter; iter = iter->next) {
icalprop = iter->data;
icalcomponent_remove_property (icomp, icalprop);
icalproperty_free (icalprop);
}
return;
}
示例15: action_calendar_taskpad_open_url_cb
static void
action_calendar_taskpad_open_url_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
EShellView *shell_view;
EShellWindow *shell_window;
ECalShellContent *cal_shell_content;
ECalModelComponent *comp_data;
ETaskTable *task_table;
icalproperty *prop;
const gchar *uri;
GSList *list;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
cal_shell_content = cal_shell_view->priv->cal_shell_content;
task_table = e_cal_shell_content_get_task_table (cal_shell_content);
list = e_task_table_get_selected (task_table);
g_return_if_fail (list != NULL);
comp_data = list->data;
/* XXX We only open the URI of the first selected task. */
prop = icalcomponent_get_first_property (
comp_data->icalcomp, ICAL_URL_PROPERTY);
g_return_if_fail (prop != NULL);
uri = icalproperty_get_url (prop);
e_show_uri (GTK_WINDOW (shell_window), uri);
}