本文整理汇总了C++中icalcomponent_add_property函数的典型用法代码示例。如果您正苦于以下问题:C++ icalcomponent_add_property函数的具体用法?C++ icalcomponent_add_property怎么用?C++ icalcomponent_add_property使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icalcomponent_add_property函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ical_property_DTEND
void ical_property_DTEND(struct exchange2ical *exchange2ical)
{
icalproperty *prop;
icalparameter *tzid;
struct icaltimetype icaltime;
/* Sanity check */
if (!exchange2ical->apptEndWhole) return;
/* If this is an all-day appointment */
if (exchange2ical->apptSubType && (*exchange2ical->apptSubType == 0x1)) {
icaltime = get_icaldate_from_FILETIME(exchange2ical->apptEndWhole);
prop = icalproperty_new_dtend(icaltime);
icalcomponent_add_property(exchange2ical->vevent, prop);
} else {
if (exchange2ical->TimeZoneDesc) {
icaltime = get_icaltime_from_FILETIME(exchange2ical->apptEndWhole);
prop = icalproperty_new_dtend(icaltime);
icalcomponent_add_property(exchange2ical->vevent, prop);
tzid = icalparameter_new_tzid(exchange2ical->TimeZoneDesc);
icalproperty_add_parameter(prop, tzid);
} else {
icaltime = get_icaltime_from_FILETIME_UTC(exchange2ical->apptEndWhole);
prop = icalproperty_new_dtend(icaltime);
icalcomponent_add_property(exchange2ical->vevent, prop);
}
}
}
示例2: ical_property_DTSTAMP
void ical_property_DTSTAMP(struct exchange2ical *exchange2ical)
{
icalproperty *prop;
struct icaltimetype icaltime;
struct tm *tm;
icalparameter *tzid;
time_t t;
/* Sanity check */
/*If OwnerCriticalChange field is null, get time system time*/
if (!exchange2ical->OwnerCriticalChange) {
t=time(NULL);
tm = gmtime(&t);
icaltime = get_icaltimetype_from_tm_UTC(tm);
prop = icalproperty_new_dtstamp(icaltime);
icalcomponent_add_property(exchange2ical->vevent, prop);
return;
} else {
icaltime = get_icaltime_from_FILETIME_UTC(exchange2ical->OwnerCriticalChange);
prop = icalproperty_new_dtstamp(icaltime);
icalcomponent_add_property(exchange2ical->vevent, prop);
if (exchange2ical->TimeZoneDesc) {
tzid = icalparameter_new_tzid(exchange2ical->TimeZoneDesc);
icalproperty_add_parameter(prop, tzid);
}
}
}
示例3: icalcomponent_vanew
static icalcomponent *icalmessage_new_reply_base(icalcomponent *c,
const char *user, const char *msg)
{
icalproperty *attendee;
char tmp[45];
icalcomponent *reply =
icalcomponent_vanew(
ICAL_VCALENDAR_COMPONENT, icalproperty_new_method(ICAL_METHOD_REPLY),
icalcomponent_vanew(
ICAL_VEVENT_COMPONENT,
icalproperty_new_dtstamp(icaltime_from_timet_with_zone(time(0), 0, NULL)),
0),
0);
icalcomponent *inner = icalmessage_get_inner(reply);
icalerror_check_arg_rz(c, "c");
icalmessage_copy_properties(reply, c, ICAL_UID_PROPERTY);
icalmessage_copy_properties(reply, c, ICAL_ORGANIZER_PROPERTY);
icalmessage_copy_properties(reply, c, ICAL_RECURRENCEID_PROPERTY);
icalmessage_copy_properties(reply, c, ICAL_SUMMARY_PROPERTY);
icalmessage_copy_properties(reply, c, ICAL_SEQUENCE_PROPERTY);
icalcomponent_set_dtstamp(reply, icaltime_from_timet_with_zone(time(0), 0, NULL));
if (msg != 0) {
icalcomponent_add_property(inner, icalproperty_new_comment(msg));
}
/* Copy this user's attendee property */
attendee = icalmessage_find_attendee(c, user);
if (attendee == 0) {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
icalcomponent_free(reply);
return 0;
}
icalcomponent_add_property(inner, icalproperty_new_clone(attendee));
/* Add PRODID and VERSION */
icalcomponent_add_property(reply, icalproperty_new_version("2.0"));
snprintf(tmp, sizeof(tmp), "-//SoftwareStudio//NONSGML %s %s //EN", ICAL_PACKAGE, ICAL_VERSION);
icalcomponent_add_property(reply, icalproperty_new_prodid(tmp));
return reply;
}
示例4: ical_property_TRIGGER
void ical_property_TRIGGER(struct exchange2ical *exchange2ical)
{
struct icaltriggertype duration;
icalproperty *prop;
if (!exchange2ical->ReminderDelta) return;
if (*exchange2ical->ReminderDelta == 0x5AE980E1) {
duration = icaltriggertype_from_int(-15 * 60);
prop = icalproperty_new_trigger(duration);
icalcomponent_add_property(exchange2ical->valarm, prop);
} else {
duration = icaltriggertype_from_int(*(exchange2ical->ReminderDelta) * -1 * 60);
prop = icalproperty_new_trigger(duration);
icalcomponent_add_property(exchange2ical->valarm, prop);
}
}
示例5: ical_property_RRULE_Yearly
void ical_property_RRULE_Yearly(struct exchange2ical *exchange2ical)
{
struct icalrecurrencetype recurrence;
icalproperty *prop;
struct RecurrencePattern *pat = exchange2ical->RecurrencePattern;
uint32_t day = pat->PatternTypeSpecific.Day;
struct icaltimetype icaltime;
icalrecurrencetype_clear(&recurrence);
recurrence.freq = ICAL_YEARLY_RECURRENCE;
recurrence.interval = (pat->Period / 12);
if (day == 0x0000001F) {
recurrence.by_month_day[0] = -1;
} else {
recurrence.by_month_day[0] = day;
}
recurrence.by_month_day[1] = ICAL_RECURRENCE_ARRAY_MAX;
icaltime = get_icaltime_from_FILETIME_UTC(exchange2ical->apptStartWhole);
recurrence.by_month[0] = icaltime.month;
recurrence.by_month[1] = ICAL_RECURRENCE_ARRAY_MAX;
if (pat->EndType == END_AFTER_N_OCCURRENCES || pat->EndType == END_AFTER_DATE) {
recurrence.count = pat->OccurrenceCount;
}
prop = icalproperty_new_rrule(recurrence);
icalcomponent_add_property(exchange2ical->vevent, prop);
}
示例6: 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);
}
示例7: 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);
}
}
示例8: ical_property_RRULE_daylight_standard
void ical_property_RRULE_daylight_standard(icalcomponent* component , struct SYSTEMTIME st)
{
struct icalrecurrencetype recurrence;
icalproperty *prop;
icalrecurrencetype_clear(&recurrence);
recurrence.freq = ICAL_YEARLY_RECURRENCE;
if(st.wYear ==0x0000){
recurrence.by_month[0]=st.wMonth;
/* Microsoft day of week = libIcal day of week +1; */
/* Day encode = day + occurrence*8 */
if (st.wDay==5){
/* Last occurrence of day in the month*/
recurrence.by_day[0] = -1 * (st.wDayOfWeek + 9);
}else{
/* st.wDay occurrence of day in the month */
recurrence.by_day[0] = (st.wDayOfWeek + 1 + st.wDay*8);
}
}else{
recurrence.by_month_day[0]=st.wDay;
recurrence.by_month[0]=st.wMonth;
}
prop = icalproperty_new_rrule(recurrence);
icalcomponent_add_property(component, prop);
}
示例9: change_status
static void
change_status (icalcomponent *ical_comp, const char *address, icalparameter_partstat status)
{
icalproperty *prop;
prop = find_attendee (ical_comp, address);
if (prop) {
icalparameter *param;
icalproperty_remove_parameter (prop, ICAL_PARTSTAT_PARAMETER);
param = icalparameter_new_partstat (status);
icalproperty_add_parameter (prop, param);
} else {
icalparameter *param;
prop = icalproperty_new_attendee (address);
icalcomponent_add_property (ical_comp, prop);
param = icalparameter_new_role (ICAL_ROLE_OPTPARTICIPANT);
icalproperty_add_parameter (prop, param);
param = icalparameter_new_partstat (status);
icalproperty_add_parameter (prop, param);
}
}
示例10: 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));
}
}
示例11: 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;
}
示例12: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
calIcalComponent::AddProperty(calIIcalProperty * aProp)
{
NS_ENSURE_ARG_POINTER(aProp);
// We assume a calIcalProperty is passed in (else the cast wouldn't run and
// we are about to crash), so we assume that this ICS service code has created
// the property.
nsresult rv;
nsCOMPtr<calIIcalPropertyLibical> icalprop = do_QueryInterface(aProp, &rv);
NS_ENSURE_SUCCESS(rv, rv);
calIcalProperty * const ical = toIcalProperty(icalprop);
if (ical->mParent) {
ical->mProperty = icalproperty_new_clone(ical->mProperty);
}
ical->mParent = this;
icalcomponent_add_property(mComponent, ical->mProperty);
nsCOMPtr<calIDateTime> dt;
if (NS_SUCCEEDED(aProp->GetValueAsDatetime(getter_AddRefs(dt))) && dt) {
// make sure timezone definition will be included:
nsCOMPtr<calITimezone> tz;
if (NS_SUCCEEDED(dt->GetTimezone(getter_AddRefs(tz))) && tz) {
getParentVCalendarOrThis()->AddTimezoneReference(tz);
}
}
return NS_OK;
}
示例13: ical_property_RRULE_Monthly
void ical_property_RRULE_Monthly(struct exchange2ical *exchange2ical)
{
struct icalrecurrencetype recurrence;
icalproperty *prop;
struct RecurrencePattern *pat = exchange2ical->RecurrencePattern;
uint32_t day = pat->PatternTypeSpecific.Day;
icalrecurrencetype_clear(&recurrence);
recurrence.freq = ICAL_MONTHLY_RECURRENCE;
recurrence.interval = pat->Period;
if (day == 0x0000001F) {
recurrence.by_month_day[0] = -1;
} else {
recurrence.by_month_day[0] = day;
}
recurrence.by_month_day[1] = ICAL_RECURRENCE_ARRAY_MAX;
if (pat->EndType == END_AFTER_N_OCCURRENCES || pat->EndType == END_AFTER_DATE) {
recurrence.count = pat->OccurrenceCount;
}
prop = icalproperty_new_rrule(recurrence);
icalcomponent_add_property(exchange2ical->vevent, prop);
}
示例14: ical_property_ORGANIZER
void ical_property_ORGANIZER(struct exchange2ical *exchange2ical)
{
const char *smtp;
const char *display_name;
uint32_t *RecipientFlags;
uint32_t *RecipientType;
uint32_t i;
struct SRowSet *SRowSet;
/* Sanity check */
if (!exchange2ical->apptStateFlags) return;
if (!(*exchange2ical->apptStateFlags & 0x1)) return;
SRowSet = &(exchange2ical->Recipients.SRowSet);
/* Loop over the recipient table */
for (i = 0; i < SRowSet->cRows; i++) {
smtp = (const char *) octool_get_propval(&(SRowSet->aRow[i]), PR_SMTP_ADDRESS);
display_name = (const char *) octool_get_propval(&(SRowSet->aRow[i]), PR_RECIPIENT_DISPLAY_NAME);
RecipientFlags = (uint32_t *) octool_get_propval(&(SRowSet->aRow[i]), PR_RECIPIENT_FLAGS);
RecipientType = (uint32_t *) octool_get_propval(&(SRowSet->aRow[i]), PR_RECIPIENT_TYPE);
if (RecipientFlags && !(*RecipientFlags & 0x20) &&
((*RecipientFlags & 0x2) || (RecipientType && !*RecipientType))) {
icalproperty *prop;
icalparameter *cn;
if (smtp) {
char *mailtoURL;
mailtoURL = talloc_strdup(exchange2ical->mem_ctx, "mailto:");
mailtoURL = talloc_strdup_append(mailtoURL, smtp);
prop = icalproperty_new_organizer(mailtoURL);
icalcomponent_add_property(exchange2ical->vevent, prop);
talloc_free(mailtoURL);
} else {
prop = icalproperty_new_organizer("invalid:nomail");
icalcomponent_add_property(exchange2ical->vevent, prop);
}
if (display_name) {
cn = icalparameter_new_cn(display_name);
icalproperty_add_parameter(prop, cn);
}
}
}
}
示例15: ical_property_LOCATION
void ical_property_LOCATION(struct exchange2ical *exchange2ical)
{
icalproperty *prop;
/* Sanity check */
if (!exchange2ical->Location) return;
prop = icalproperty_new_location(exchange2ical->Location);
icalcomponent_add_property(exchange2ical->vevent, prop);
}