static ECalComponent* create_test_component (time_t start, time_t end) { ECalComponent *comp = e_cal_component_new (); ECalComponentText summary; struct icaltimetype current; e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT); /* ECalComponentDateTime dtstart, dtend; struct icaltimetype time_start, time_end; time_start = icaltime_from_timet (start, 0); dtstart.value = icaltime_from_timet (start, 0); dtstart.zone = icaltimezone_get_utc_timezone (); dtend.value = icaltime_from_timet (end, 0); dtend.value = icaltimezone_get_utc_timezone (); e_cal_component_set_dtstart (comp, &dtstart); e_cal_component_set_dtend (comp, &dtend); */ summary.value = g_strdup_printf ("%ld - %ld", start, end); summary.altrep = NULL; e_cal_component_set_summary (comp, &summary); g_free ((gchar *) summary.value); current = icaltime_from_timet (time (NULL), 0); e_cal_component_set_created (comp, ¤t); e_cal_component_set_last_modified (comp, ¤t); return comp; }
void evo_cal_component_set_modified(ECalComponent *obj, glong seconds) { struct icaltimetype tt; tt = icaltime_from_timet(seconds, TRUE); e_cal_component_set_last_modified(obj, &tt); }
void kolab_util_backend_modtime_set_on_ecalcomp (ECalComponent *ecalcomp) { struct icaltimetype itt; g_assert (E_IS_CAL_COMPONENT (ecalcomp)); itt = icaltime_current_time_with_zone (NULL); /* need UTC here, hence NULL timezone */ e_cal_component_set_last_modified (ecalcomp, &itt); } /* kolab_util_backend_modtime_set_on_ecalcomp () */
static ECalComponent * comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, GnomePilotRecord *remote, ECalComponent *in_comp, icaltimezone *timezone, struct MemoAppInfo *ai) { ECalComponent *comp; struct Memo memo; struct icaltimetype now; icaltimezone *utc_zone; char *txt, *txt2, *txt3; int i; #ifdef PILOT_LINK_0_12 pi_buffer_t * buffer; #endif g_return_val_if_fail (remote != NULL, NULL); #ifdef PILOT_LINK_0_12 buffer = pi_buffer_new(DLP_BUF_SIZE); if(buffer == NULL){ return NULL; } if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){ return NULL; } unpack_Memo (&memo, buffer, memo_v1); pi_buffer_free(buffer); #else memset (&memo, 0, sizeof (struct Memo)); unpack_Memo (&memo, remote->record, remote->length); #endif utc_zone = icaltimezone_get_utc_timezone (); now = icaltime_from_timet_with_zone (time (NULL), FALSE, utc_zone); if (in_comp == NULL) { comp = e_cal_component_new (); e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_JOURNAL); e_cal_component_set_created (comp, &now); } else { comp = e_cal_component_clone (in_comp); } e_cal_component_set_last_modified (comp, &now); /*Category support*/ e_pilot_remote_category_to_local(remote->category, comp, &(ai->category)); /* The iCal description field */ if (!memo.text) { e_cal_component_set_comment_list (comp, NULL); e_cal_component_set_summary(comp, NULL); } else { int idxToUse = -1, ntext = strlen(memo.text); gboolean foundNL = FALSE; GSList l; ECalComponentText text, sumText; for(i = 0; i<ntext && i<50; i++){ if(memo.text[i] == '\n'){ idxToUse = i; foundNL = TRUE; break; } } if(foundNL == FALSE){ if(ntext > 50){ txt2 = g_strndup(memo.text, 50); } else{ txt2 = g_strdup(memo.text); } } else{ txt2 = g_strndup(memo.text, idxToUse); /* cuts off '\n' */ } sumText.value = txt3 = e_pilot_utf8_from_pchar(txt2); sumText.altrep = NULL; text.value = txt = e_pilot_utf8_from_pchar (memo.text); text.altrep = NULL; l.data = &text; l.next = NULL; e_cal_component_set_summary(comp, &sumText); e_cal_component_set_description_list (comp, &l); free (txt); g_free(txt2); free(txt3); } e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_NONE); if (remote->secret) e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PRIVATE); else e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC); e_cal_component_commit_sequence (comp); free_Memo(&memo); return comp; }