/* This module provides some helper APIs for creating a VCalendar object. Note on APIs: 1. The APIs does not attempt to verify if the arguments passed are correct. 2. Where the argument to an API is not applicable, pass the value 0. 3. See the test program at the bottom of this file as an example of usage. 4. This code calls APIs in vobject.c. */ /*************************************************************************** (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International Business Machines Corporation and Siemens Rolm Communications Inc. For purposes of this license notice, the term Licensors shall mean, collectively, Apple Computer, Inc., AT&T Corp., International Business Machines Corporation and Siemens Rolm Communications Inc. The term Licensor shall mean any of the Licensors. Subject to acceptance of the following conditions, permission is hereby granted by Licensors without the need for written agreement and without license or royalty fees, to use, copy, modify and distribute this software for any purpose. The above copyright notice and the following four paragraphs must be reproduced in all copies of this software and any software including this software. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS. IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The software is provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the government are subject to restrictions set forth in DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. ***************************************************************************/ #include #include #include "vcaltmp.h" DLLEXPORT(VObject*) vcsCreateVCal( char *date_created, char *location, char *product_id, char *time_zone, char *version ) { VObject *vcal = newVObject(VCCalProp); #define Z(p,v) if (v) addPropValue(vcal,p,v); Z(VCDCreatedProp, date_created); Z(VCLocationProp, location) Z(VCProdIdProp, product_id) Z(VCTimeZoneProp, time_zone) Z(VCVersionProp, version) #undef Z return vcal; } DLLEXPORT(VObject*) vcsAddEvent( VObject *vcal, char *start_date_time, char *end_date_time, char *description, char *summary, char *categories, char *classification, char *status, char *transparency, char *uid, char *url ) { VObject *vevent = addProp(vcal,VCEventProp); #define Z(p,v) if (v) addPropValue(vevent,p,v); Z(VCDTstartProp,start_date_time); Z(VCDTendProp,end_date_time); if (description) { VObject *p = addPropValue(vevent,VCDescriptionProp,description); if (strchr(description,'\n')) addProp(p,VCQuotedPrintableProp); } Z(VCSummaryProp,summary); Z(VCCategoriesProp,categories); Z(VCClassProp,classification); Z(VCStatusProp,status); Z(VCTranspProp,transparency); Z(VCUniqueStringProp,uid); Z(VCURLProp,url); #undef Z return vevent; } DLLEXPORT(VObject*) vcsAddTodo( VObject *vcal, char *start_date_time, char *due_date_time, char *date_time_complete, char *description, char *summary, char *priority, char *classification, char *status, char *uid, char *url ) { VObject *vtodo = addProp(vcal,VCTodoProp); #define Z(p,v) if (v) addPropValue(vtodo,p,v); Z(VCDTstartProp,start_date_time); Z(VCDueProp,due_date_time); Z(VCCompletedProp,date_time_complete); if (description) { VObject *p = addPropValue(vtodo,VCDescriptionProp,description); if (strchr(description,'\n')) addProp(p,VCQuotedPrintableProp); } Z(VCSummaryProp,summary); Z(VCPriorityProp,priority); Z(VCClassProp,classification); Z(VCStatusProp,status); Z(VCUniqueStringProp,uid); Z(VCURLProp,url); #undef Z return vtodo; } DLLEXPORT(VObject*) vcsAddAAlarm( VObject *vevent, char *run_time, char *snooze_time, char *repeat_count, char *audio_content ) { VObject *aalarm= addProp(vevent,VCAAlarmProp); #define Z(p,v) if (v) addPropValue(aalarm,p,v); Z(VCRunTimeProp,run_time); Z(VCSnoozeTimeProp,snooze_time); Z(VCRepeatCountProp,repeat_count); Z(VCAudioContentProp,audio_content); #undef Z return aalarm; } DLLEXPORT(VObject*) vcsAddMAlarm( VObject *vevent, char *run_time, char *snooze_time, char *repeat_count, char *email_address, char *note ) { VObject *malarm= addProp(vevent,VCMAlarmProp); #define Z(p,v) if (v) addPropValue(malarm,p,v); Z(VCRunTimeProp,run_time); Z(VCSnoozeTimeProp,snooze_time); Z(VCRepeatCountProp,repeat_count); Z(VCEmailAddressProp,email_address); Z(VCNoteProp,note); #undef Z return malarm; } DLLEXPORT(VObject*) vcsAddDAlarm( VObject *vevent, char *run_time, char *snooze_time, char *repeat_count, char *display_string ) { VObject *dalarm= addProp(vevent,VCDAlarmProp); #define Z(p,v) if (v) addPropValue(dalarm,p,v); Z(VCRunTimeProp,run_time); Z(VCSnoozeTimeProp,snooze_time); Z(VCRepeatCountProp,repeat_count); Z(VCDisplayStringProp,display_string); #undef Z return dalarm; } DLLEXPORT(VObject*) vcsAddPAlarm( VObject *vevent, char *run_time, char *snooze_time, char *repeat_count, char *procedure_name ) { VObject *palarm= addProp(vevent,VCPAlarmProp); #define Z(p,v) if (v) addPropValue(palarm,p,v); Z(VCRunTimeProp,run_time); Z(VCSnoozeTimeProp,snooze_time); Z(VCRepeatCountProp,repeat_count); Z(VCProcedureNameProp,procedure_name); #undef Z return palarm; } #ifdef _TEST #if 0 This testcase would generate a file call "frankcal.vcf" with the following content: BEGIN:VCALENDAR DCREATED:19960523T100522 GEO:37.24,-17.87 PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN VERSION:0.3 BEGIN:VEVENT DTSTART:19960523T120000 DTEND:19960523T130000 DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A= With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A= activities with European Press representatives. SUMMARY:VERSIT PDI PR Teleconference/Interview CATEGORIES:PHONE CALL STATUS:CONFIRMED TRANSP:19960523T100522-4000F100582713-009251 UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2 DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!; MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!; PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2; X-LDC-OR2-OLE:c:\temp\agenda.doc END:VEVENT BEGIN:VTODO DUE:19960614T0173000 DESCRIPTION:Review VCalendar helper API. END:VTODO END:VCALENDAR #endif void testVcalAPIs() { FILE *fp; VObject *vcal = vcsCreateVCal( "19960523T100522", "37.24,-17.87", "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN", 0, "0.3" ); VObject *vevent = vcsAddEvent( vcal, "19960523T120000", "19960523T130000", "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.", "VERSIT PDI PR Teleconference/Interview", "PHONE CALL", 0, "CONFIRMED", "19960523T100522-4000F100582713-009251", "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2", 0 ); vcsAddDAlarm(vevent, "19960523T114500", "5", "3", "Your Telecon Starts At Noon!!!"); vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com", "Remember 05/23 Noon Telecon!!!"); vcsAddPAlarm(vevent, "19960523T115500", 0 ,0, "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2"); addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc"); vcsAddTodo( vcal, 0, "19960614T0173000", 0, "Review VCalendar helper API.", 0, 0, 0, 0, 0, 0 ); /* now do something to the resulting VObject */ /* pretty print on stdout for fun */ printVObject(vcal); /* open the output text file */ #define OUTFILE "frankcal.vcf" fp = fopen(OUTFILE, "w"); if (fp) { /* write it in text form */ writeVObject(fp,vcal); fclose(fp); } else { printf("open output file '%s' failed\n", OUTFILE); } } void main() { testVcalAPIs(); } #endif // end of source file vcaltmp.c git.cgi/freebsd-ports-gnome/commit/Keywords?id=9985e903760e223ff15572b4c2a1f2286d1a3e5b'>Add a new keywork xmlcatmgrbapt2016-05-251-0/+34 * Make @info cross install friendlybapt2015-10-221-2/+2 * Add a way to cleanly handle terminfo.db file used by devel/ncursesamdmi32015-10-081-0/+22 * Do not use contractions.mat2015-10-011-1/+1 * Extend @sample to accept argumentsbapt2015-09-261-7/+29 * Add "fc", "fcfontsdir", "fontsdir", and "none" arguments to USES=fonts.hrs2015-09-142-0/+46 * Add -f flag to force scanning of font directoriesfeld2015-04-071-2/+2 * Remove @fc and @fontsdir they are confusing all should use @fcfontsdirbapt2015-03-222-46/+0 * When updating /etc/shells, only remove existing entries that match the newmarkj2015-02-171-2/+2 * Use a custom keyword for kldxref, that allows to control exactly when it is runbapt2014-12-261-0/+24 * Add new keyword for to run glib-compile-schemas.kwm2014-12-031-0/+16 * - Accept absolute path for @fc, @fontsdir, @fcfontsdir, @shell keywordsak2014-10-094-22/+54 * Accept absolute path for @info keywordbapt2014-10-081-2/+8 * @sample: chmod u+w to ensure user may write to it.bdrewery2014-10-041-1/+2 * Replace the dirrmtry action with dir.mat2014-10-023-3/+3 * Use keywords to control exactly when is excutiedbapt2014-09-222-0/+22 * Remove the yaml files as pkg 1.3.8 is now the minimal required versionbapt2014-09-227-128/+0 * @sample: Alert user that there is a stale file to be removed.bdrewery2014-09-122-0/+4 * Convert rmtry into regular Keywordbapt2014-09-031-0/+11 * - Make it possible to use sample keyword with a full pathantoine2014-09-022-4/+16 * Remove support for pkg_installbapt2014-09-011-111/+0 * Fix fmtutil keyword with pkg_installantoine2014-08-061-0/+1 * Add support for @fmtutil for pkg_installbapt2014-07-251-0/+8 * Convert keywords in pure ucl formatbapt2014-07-257-0/+134 * Support stage for texlive, given it is impossible to rebuild the fmt files intobapt2014-07-051-0/+13 * Use print/indexinfo to generate index of info pagesantoine2014-06-281-8/+2 * Use print/texinfo-lite to install info pagesbapt2014-06-251-3/+3 * Make @dirrmtry handling in pkg_install closer to what pkg doesantoine2014-06-211-0/+12 * Add missing font_dir initialization for @fontsdirantoine2014-06-181-0/+1 * Remove another extra '`'bapt2014-06-161-1/+1 * Remove extra '`'bapt2014-06-161-1/+1 * Cosmeticbapt2014-06-121-9/+9 * Make pkg_install aware of @fc @fcfontsdir and @fontsdirbapt2014-06-121-0/+39 * Add an @shell keyword to handle adding and remove a shell path in /etc/shellbapt2014-06-122-0/+41 * - Add a @sample plist keywordbdrewery2014-04-122-0/+60 * Fix fontdir handling to work properly.zeising2013-12-211-4/+4 * Try to fix font handling for xorg fonts when using staging and pkgng.zeising2013-12-193-0/+45 * Fix handling of info files with pkgng, when dealing with .info-X files and al...bapt2013-11-231-2/+2 * Fix leftovers with INFO_SUBDIRbapt2013-11-181-0/+3