tcladdressbook-commits Mailing List for TclAddressBook (Page 6)
Status: Alpha
Brought to you by:
bdesgraupes
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(114) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(37) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(52) |
Aug
(70) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2005 |
Jan
|
Feb
|
Mar
(2) |
Apr
(9) |
May
|
Jun
(8) |
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Bernard D. <bde...@us...> - 2004-07-30 13:06:57
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4184/Source Modified Files: TclAddressBookUtils.h Log Message: TclAB_CheckMultiString() Index: TclAddressBookUtils.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- TclAddressBookUtils.h 30 Jul 2004 11:14:54 -0000 1.10 +++ TclAddressBookUtils.h 30 Jul 2004 13:06:48 -0000 1.11 @@ -135,6 +135,10 @@ ABRecordRef * outItemRef, int inRecordType); +Boolean TclAB_CheckMultiString(ABAddressBookRef ab, + CFStringRef inPropertyRef, + int inRecordType); + Boolean TclAB_RecordAndTypeFromUID(ABAddressBookRef ab, CFStringRef inUID, Tcl_Obj *resultPtr, |
|
From: Bernard D. <bde...@us...> - 2004-07-30 13:06:48
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3950/Source Modified Files: TclAddressBookUtils.c Log Message: TclAB_CheckMultiString() Index: TclAddressBookUtils.c =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- TclAddressBookUtils.c 30 Jul 2004 11:14:46 -0000 1.16 +++ TclAddressBookUtils.c 30 Jul 2004 13:05:58 -0000 1.17 @@ -686,7 +686,44 @@ return result; } - + +/* + *---------------------------------------------------------------------- + * + * TclAB_CheckMultiString -- + * + * This function is invoked to check if property is a multi-value + * property. Used with the [addressbook identifier] command. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +// // kABMultiArrayProperty +// // kABMultiDateProperty +// // kABMultiIntegerProperty +// // kABMultiRealProperty +// // kABMultiStringProperty + +Boolean +TclAB_CheckMultiString(ABAddressBookRef ab, CFStringRef inPropertyRef, int inRecordType) +{ + ABPropertyType thePropType; + + if (inRecordType == rec_person) { + thePropType = ABTypeOfProperty(ab, kABPersonRecordType, inPropertyRef); + } else { + thePropType = ABTypeOfProperty(ab, kABGroupRecordType, inPropertyRef); + } + + return (thePropType == kABMultiStringProperty); +} + + /* *---------------------------------------------------------------------- * @@ -1360,7 +1397,6 @@ CONST84 char * theProperty, * theUID; CFStringRef propertyRef, valueRef; ABRecordRef personRecord; -// ABPropertyType thePropType; int length, result = TCL_OK; unsigned int mvCount; @@ -1391,22 +1427,14 @@ goto DONE; } -// // Check the property type (string, date, multivalue...) -// // kABMultiArrayProperty -// // kABMultiDateProperty -// // kABMultiIntegerProperty -// // kABMultiRealProperty -// // kABMultiStringProperty - -// thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); -// if (thePropType == kABErrorInProperty) { -// Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, -// "' for Person records", (char *) NULL); -// CFRelease(propertyRef); -// result = TCL_ERROR; -// goto DONE; -// } - + // Check the property's type + if ( ! TclAB_CheckMultiString(ab, propertyRef, rec_person) ) { + Tcl_AppendStringsToObj(resultPtr, "Not a multi-string list property", (char *) NULL); + CFRelease(propertyRef); + result = TCL_ERROR; + goto DONE; + } + valueRef = ABRecordCopyValue(personRecord, propertyRef); if (!valueRef) { Tcl_AppendStringsToObj(resultPtr, "Couldn't get value for '", @@ -1459,7 +1487,6 @@ CONST84 char * theProperty, * theUID, * theIndex; CFStringRef propertyRef, valueRef, identRef; ABRecordRef personRecord; -// ABPropertyType thePropType; char theString[256]; int index, length, result = TCL_OK; @@ -1493,22 +1520,15 @@ Tcl_IncrRefCount(objv[5]); theIndex = Tcl_GetStringFromObj(objv[5], &length); index = atoi(theIndex); - -// // Check the property type (string, date, multivalue...) -// // kABMultiArrayProperty -// // kABMultiDateProperty -// // kABMultiIntegerProperty -// // kABMultiRealProperty -// // kABMultiStringProperty -// thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); -// if (thePropType == kABErrorInProperty) { -// Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, -// "' for Person records", (char *) NULL); -// CFRelease(propertyRef); -// result = TCL_ERROR; -// goto DONE; -// } - + + // Check the property's type + if ( ! TclAB_CheckMultiString(ab, propertyRef, rec_person) ) { + Tcl_AppendStringsToObj(resultPtr, "Not a multi-string list property", (char *) NULL); + CFRelease(propertyRef); + result = TCL_ERROR; + goto DONE; + } + valueRef = ABRecordCopyValue(personRecord, propertyRef); if (!valueRef) { Tcl_AppendStringsToObj(resultPtr, "Couldn't get value for '", theProperty, "' property", (char *) NULL); @@ -1570,7 +1590,6 @@ CONST84 char * theProperty, * theUID; CFStringRef propertyRef, valueRef, identRef; ABRecordRef personRecord; -// ABPropertyType thePropType; char theString[256]; int length, result = TCL_OK; @@ -1600,21 +1619,14 @@ goto DONE; } -// // Check the property type (string, date, multivalue...) -// // kABMultiArrayProperty -// // kABMultiDateProperty -// // kABMultiIntegerProperty -// // kABMultiRealProperty -// // kABMultiStringProperty -// thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); -// if (thePropType == kABErrorInProperty) { -// Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, -// "' for Person records", (char *) NULL); -// CFRelease(propertyRef); -// result = TCL_ERROR; -// goto DONE; -// } - + // Check the property's type + if ( ! TclAB_CheckMultiString(ab, propertyRef, rec_person) ) { + Tcl_AppendStringsToObj(resultPtr, "Not a multi-string list property", (char *) NULL); + CFRelease(propertyRef); + result = TCL_ERROR; + goto DONE; + } + valueRef = ABRecordCopyValue(personRecord, propertyRef); if (!valueRef) { Tcl_AppendStringsToObj(resultPtr, "Couldn't get value for '", theProperty, "' property", (char *) NULL); @@ -1720,16 +1732,14 @@ goto DONE; } - // Check the property type (string, date, multivalue...) - thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); - if (thePropType == kABErrorInProperty) { - Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, - "' for Person records", (char *) NULL); + // Check the property's type + if ( ! TclAB_CheckMultiString(ab, propertyRef, rec_person) ) { + Tcl_AppendStringsToObj(resultPtr, "Not a multi-string list property", (char *) NULL); CFRelease(propertyRef); result = TCL_ERROR; goto DONE; } - + if (objc == 7) { Tcl_IncrRefCount(objv[6]); theNewVal = Tcl_GetStringFromObj(objv[6], &length); |
|
From: Bernard D. <bde...@us...> - 2004-07-30 13:05:55
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3897/Source Modified Files: TclAddressBook.c Log Message: TclAB_CheckMultiString() |
|
From: Bernard D. <bde...@us...> - 2004-07-30 11:17:15
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18842/Help Modified Files: TclAddressBookHelp.html Log Message: Doc [identifier] subcommands (count, get, primary, set) Index: TclAddressBookHelp.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.html,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- TclAddressBookHelp.html 29 Jul 2004 20:15:15 -0000 1.18 +++ TclAddressBookHelp.html 30 Jul 2004 11:17:03 -0000 1.19 @@ -8,7 +8,7 @@ <P><IMG SRC="Images/TclAB_logo.gif " ALT="TclAB Logo" ALIGN=bottom></P> <P> <A HREF="TclAB.html"> Home Page</A> | <A HREF="http://sourceforge.net/projects/tcladdressbook"> Project Page at SourceForge</A><P><HR><BLOCKQUOTE><P><I> This is a manual page for the Tcladdressbook extension for Tcl. It -documents version 1.1b2. +documents version 1.1b3. </I></P></BLOCKQUOTE><HR> <UL> <LI><A HREF="#M1">NAME</A> @@ -23,31 +23,35 @@ <UL><UL><LI><A HREF="#M10">addressbook export <I>personID</I></A></UL></UL> <UL><UL><LI><A HREF="#M11">addressbook getme ?<I>-id</I>?</A></UL></UL> <UL><UL><LI><A HREF="#M12">addressbook groups ?-ids? ?-ingroup <I>groupID</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M13">addressbook identifier <I>personID</I> <I>groupID</I> <I>propName</I> ?<I>label</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M14">addressbook image <I>personID</I> ?<I>imageData</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M15">addressbook import <I>vCardData</I></A></UL></UL> -<UL><UL><LI><A HREF="#M16">addressbook parents ?-ids? <I>recordID</I></A></UL></UL> -<UL><UL><LI><A HREF="#M17">addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M18">addressbook property names (-groups | -persons)</A></UL></UL> -<UL><UL><LI><A HREF="#M19">addressbook property type (-groups | -persons) <I>propName</I></A></UL></UL> -<UL><UL><LI><A HREF="#M20">addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></A></UL></UL> -<UL><UL><LI><A HREF="#M21">addressbook property remove (-groups | -persons | recordID) <I>propName</I></A></UL></UL> -<UL><UL><LI><A HREF="#M22">addressbook record <I>recordID</I></A></UL></UL> -<UL><UL><LI><A HREF="#M23">addressbook remove <I>recordID</I> <I>groupID</I></A></UL></UL> -<UL><UL><LI><A HREF="#M24">addressbook save</A></UL></UL> -<UL><UL><LI><A HREF="#M25">addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></A></UL></UL> -<UL><UL><LI><A HREF="#M26">addressbook set <I>recordID propertyName</I> ?<I>value</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M27">addressbook setme <I>recordID</I></A></UL></UL> -<UL><UL><LI><A HREF="#M28">addressbook type <I>recordID</I></A></UL></UL> -<LI><A HREF="#M29">INSTALLATION</A> -<LI><A HREF="#M30">VERSION HISTORY</A> -<LI><A HREF="#M31">REQUIREMENTS AND PORTABILITY</A> -<LI><A HREF="#M32">KNOW ISSUES</A> -<LI><A HREF="#M33">SOURCE CODE</A> -<LI><A HREF="#M34">CONTRIBUTIONS</A> -<LI><A HREF="#M35">LICENSE AND DISCLAIMER</A> -<LI><A HREF="#M36">SEE ALSO</A> -<LI><A HREF="#M37">KEYWORDS</A> +<UL><UL><LI><A HREF="#M13">addressbook identifier count <I>personID</I> <I>propName</I></A></UL></UL> +<UL><UL><LI><A HREF="#M14">addressbook identifier get <I>personID</I> <I>propName</I> <I>index</I></A></UL></UL> +<UL><UL><LI><A HREF="#M15">addressbook identifier primary <I>personID</I> <I>propName</I></A></UL></UL> +<UL><UL><LI><A HREF="#M16">addressbook identifier set <I>groupID</I> <I>personID</I> <I>propName</I> ?<I>ident</I>?</A></UL></UL> +<UL><UL><LI><A HREF="#M17">addressbook image <I>personID</I> ?<I>imageData</I>?</A></UL></UL> +<UL><UL><LI><A HREF="#M18">addressbook import <I>vCardData</I></A></UL></UL> +<UL><UL><LI><A HREF="#M19">addressbook parents ?-ids? <I>recordID</I></A></UL></UL> +<UL><UL><LI><A HREF="#M20">addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</A></UL></UL> +<UL><UL><LI><A HREF="#M21">addressbook property names (-groups | -persons)</A></UL></UL> +<UL><UL><LI><A HREF="#M22">addressbook property type (-groups | -persons) <I>propName</I></A></UL></UL> +<UL><UL><LI><A HREF="#M23">addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></A></UL></UL> +<UL><UL><LI><A HREF="#M24">addressbook property remove (-groups | -persons | recordID) <I>propName</I></A></UL></UL> +<UL><UL><LI><A HREF="#M25">addressbook record <I>recordID</I></A></UL></UL> +<UL><UL><LI><A HREF="#M26">addressbook remove <I>recordID</I> <I>groupID</I></A></UL></UL> +<UL><UL><LI><A HREF="#M27">addressbook save</A></UL></UL> +<UL><UL><LI><A HREF="#M28">addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></A></UL></UL> +<UL><UL><LI><A HREF="#M29">addressbook set <I>recordID propertyName</I> ?<I>value</I>?</A></UL></UL> +<UL><UL><LI><A HREF="#M30">addressbook setme <I>recordID</I></A></UL></UL> +<UL><UL><LI><A HREF="#M31">addressbook type <I>recordID</I></A></UL></UL> +<LI><A HREF="#M32">DISTRIBUTION LIST AND IDENTIFIERS</A> +<LI><A HREF="#M33">INSTALLATION</A> +<LI><A HREF="#M34">VERSION HISTORY</A> +<LI><A HREF="#M35">REQUIREMENTS AND PORTABILITY</A> +<LI><A HREF="#M36">KNOW ISSUES</A> +<LI><A HREF="#M37">SOURCE CODE</A> +<LI><A HREF="#M38">CONTRIBUTIONS</A> +<LI><A HREF="#M39">LICENSE AND DISCLAIMER</A> +<LI><A HREF="#M40">SEE ALSO</A> +<LI><A HREF="#M41">KEYWORDS</A> </UL> <P><H2><A NAME="M1"></A>NAME</H2> addressbook - manipulate the Macintosh OSX Address Book database<P><H2><A NAME="M2"></A>SYNOPSIS</H2> @@ -93,51 +97,67 @@ the second is its name. If the <I>-ids</I> argument is specified, the returned list will contain only the unique IDs of the groups. If the <I>-ingroup</I> option is specified, only the subgroups contained in the group -with ID <I>groupID</I> will be returned.<P><H4><A NAME="M13"></A>addressbook identifier <I>personID</I> <I>groupID</I> <I>propName</I> ?<I>label</I>?</H4> -This command lets you get or set the distribution identifier for a -multi-value list property of a person in a group. -<P> Used without a <I>label</I> argument, this will return the -distribution identifier for the person <I>personID</I> belonging to the +with ID <I>groupID</I> will be returned.<P><H4><A NAME="M13"></A>addressbook identifier count <I>personID</I> <I>propName</I></H4> +This command returns the number of items in a multi-value list property +(such as Address, Phone, Email). <P><H4><A NAME="M14"></A>addressbook identifier get <I>personID</I> <I>propName</I> <I>index</I></H4> +This command gets the unique identifier of an item in a multi-value list +property (such as Address, Phone, Email). It returns the identifier of the +item at index <I>index</I> in the multi-value list of property +<I>propName</I> for the record corresponding to <I>personID</I>. One can +get the count of identifiers using the <B>addressbook identifier count</B> +command. Identifiers are used by the <B>addressbook identifier set</B> +command. See the section <A HREF="#dist">Distribution list and identifiers</A> +below for explanations about identifiers.<P><H4><A NAME="M15"></A>addressbook identifier primary <I>personID</I> <I>propName</I></H4> +This command returns the primary identifier of property <I>propName</I> in +the record <I>personID</I>. This is the identifier which will be used by +default if no <I>distribution identifier</I> has been specified using the +<B>addressbook identifier set</B> command. Property <I>propName</I> must +be a multi-value list property (such as <I>Address, Phone, Email</I>).<P><H4><A NAME="M16"></A>addressbook identifier set <I>groupID</I> <I>personID</I> <I>propName</I> ?<I>ident</I>?</H4> +This command lets you get or set the <I>distribution identifier</I> for a +multi-value list property of a person in a group. See the section +<A HREF="#dist"> Distribution list and identifiers</A> below for +explanations about identifiers. +<P> Used without the <I>ident</I> argument, the command will return the +<I>distribution identifier</I> for the person <I>personID</I> belonging to the group <I>groupID</I> concerning property <I>propName</I> if it was set, -otherwise the property¹s primary identifier. Property <I>propName</I> must -be a multi-value list property -<P> If the <I>label</I> argument is specified, this will assign a -specific distribution identifier for the person¹s multi-value list property -so that the group can be used as a distribution list (a mailing list for -instance, in the case of an email property). This value must be a label -used by the multi-value list (such as <I>home</I> for an <I>address</I> -property). If <I>label</I> is an empty string, this command resets the -distribution identifier to its default, i-e the multi-value list¹s primary -identifier.<P><H4><A NAME="M14"></A>addressbook image <I>personID</I> ?<I>imageData</I>?</H4> +otherwise the property's primary identifier. Property <I>propName</I> must +be a multi-value list property (such as <I>Address, Phone, Email</I>). +<P> If the <I>ident</I> argument is specified, this will assign a +specific <I>distribution identifier</I> for the person's multi-value list +property so that the group can be used as a distribution list (a mailing +list for instance, in the case of an email property). This value must be a +valid identifier used by the multi-value list: one can get the identifiers +of any element of a multi-value list using the <B>addressbook identifier +get</B> command.<P><H4><A NAME="M17"></A>addressbook image <I>personID</I> ?<I>imageData</I>?</H4> If no <I>imageData</I> argument is specified, this command returns the custom image associated with the record corresponding to the unique ID <I>personID</I>. The returned bytes are binary data. If no image exists, it raises an error. If an <I>imageData</I> argument is specified, it should contain valid binary data defining an image which will be associated the -record with unique ID <I>personID</I>.<P><H4><A NAME="M15"></A>addressbook import <I>vCardData</I></H4> +record with unique ID <I>personID</I>.<P><H4><A NAME="M18"></A>addressbook import <I>vCardData</I></H4> This command imports data in VCard format. The data specified by the <I>vCardData</I> argument must be valid data in VCard format: a new record is created in the database corresponding to the information contained in the -VCard. Note that the data can be binary if the VCard contains an image.<P><H4><A NAME="M16"></A>addressbook parents ?-ids? <I>recordID</I></H4> +VCard. Note that the data can be binary if the VCard contains an image.<P><H4><A NAME="M19"></A>addressbook parents ?-ids? <I>recordID</I></H4> This command returns a list of all the groups the record with unique ID <I>recordID</I> belongs to. The elements of this list are sublists made of one or two items: the unique ID and, possibly, the name of the record if this field exists. If the <I>-ids</I> option is specified, only IDs are -returned. <P><H4><A NAME="M17"></A>addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</H4> +returned. <P><H4><A NAME="M20"></A>addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</H4> This command returns a list of all the existing person records: if no option is specified, it is a list whose elements are sublists made of one or two items: the unique ID and, possibly, the name of the record if this field exists. If the <I>-ids</I> argument is specified, the returned list will contain only the unique IDs. If the <I>-ingroup</I> option is specified, only the members belonging to the group with ID <I>groupID</I> -will be returned.<P><H4><A NAME="M18"></A>addressbook property names (-groups | -persons)</H4> +will be returned.<P><H4><A NAME="M21"></A>addressbook property names (-groups | -persons)</H4> This command returns a list of all the properties defined in the database for group or person records. New properties can be created or removed with -the <B>addressbook property add</B> and <B>addressbook property remove</B> commands.<P><H4><A NAME="M19"></A>addressbook property type (-groups | -persons) <I>propName</I></H4> +the <B>addressbook property add</B> and <B>addressbook property remove</B> commands.<P><H4><A NAME="M22"></A>addressbook property type (-groups | -persons) <I>propName</I></H4> This command returns the type of the property specified by the <I>propName</I> argument. The returned type is one of the values listed with the <B>addressbook property add</B> command below -or <I>Unknown</I>. <P><H4><A NAME="M20"></A>addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></H4> +or <I>Unknown</I>. <P><H4><A NAME="M23"></A>addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></H4> This command lets you add a new property to the database, either for person or for group records. The name of the new property is specified by the <I>propName</I> argument: it must be unique. One can get the list of all the @@ -145,7 +165,7 @@ The type of the property is specified by the <I>propType</I> argument. This argument can have one of the following values: <I>Array, Data, Date, Dictionary, Integer, Real, String, MultiArray, MultiData, MultiDate, -MultiDictionary, MultiInteger, MultiReal, MultiString.</I><P><H4><A NAME="M21"></A>addressbook property remove (-groups | -persons | recordID) <I>propName</I></H4> +MultiDictionary, MultiInteger, MultiReal, MultiString.</I><P><H4><A NAME="M24"></A>addressbook property remove (-groups | -persons | recordID) <I>propName</I></H4> This command lets you remove a property from the database, either for person or for group records. The name of the property is specified in the <I>propName</I> argument. If the third argument is either <B>-groups</B> or @@ -156,7 +176,7 @@ property is removed for this record only and the command returns an empty string. <P> One can get the list of all the existing -properties with the <B>addressbook property names</B> command.<P><H4><A NAME="M22"></A>addressbook record <I>recordID</I></H4> +properties with the <B>addressbook property names</B> command.<P><H4><A NAME="M25"></A>addressbook record <I>recordID</I></H4> This command returns all the data available in the database concerning the record with unique ID <I>recordID</I>. The returned value takes the form of a keyed list. @@ -186,16 +206,16 @@ 00:00:00 CET 1970". <P> Note that keyed lists can be easily manipulated using the <B>keylget</B> and <B>keylset</B> commands defined in the TclX -extension.<P><H4><A NAME="M23"></A>addressbook remove <I>recordID</I> <I>groupID</I></H4> +extension.<P><H4><A NAME="M26"></A>addressbook remove <I>recordID</I> <I>groupID</I></H4> This command lets you remove an already existing item (person or group) designated by its unique ID <I>recordID</I> from the group with ID -<I>groupID</I>.<P><H4><A NAME="M24"></A>addressbook save</H4> +<I>groupID</I>.<P><H4><A NAME="M27"></A>addressbook save</H4> This command lets you save the changes made in the database. Commands such as <B>addressbook set</B>, <B>addressbook create</B> or <B>addressbook delete</B> modify the data in memory: to make the changes definitive in the database, one must call explicitely the <B>addressbook save</B> command. To check whether there has been changes in the database, use the -<B>addressbook changed</B> command.<P><H4><A NAME="M25"></A>addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></H4> +<B>addressbook changed</B> command.<P><H4><A NAME="M28"></A>addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></H4> This command returns all the records corresponding to the criterion described by the last three arguments: <UL> @@ -251,17 +271,31 @@ that no distinction be made between uppercase and lowercase letters. <P> To get a list of all possible properties, use the <B>addressbook property names</B> command. To know the type of a particular property, use -the <B>addressbook property type</B> command.<P><H4><A NAME="M26"></A>addressbook set <I>recordID propertyName</I> ?<I>value</I>?</H4> +the <B>addressbook property type</B> command.<P><H4><A NAME="M29"></A>addressbook set <I>recordID propertyName</I> ?<I>value</I>?</H4> This command lets you get or set the value of a particular property for the record with unique ID <I>recordID</I>. If the <I>value</I> argument is not specified, it returns the current value of the property specified in the <I>propertyName</I> argument. If <I>value</I> is specified, the property <I>propertyName</I> will be set to this value. See the <B>addressbook record</B> command for a description of the format used for the -various kinds of properties.<P><H4><A NAME="M27"></A>addressbook setme <I>recordID</I></H4> -This command sets the record that represents the logged-in user. <P><H4><A NAME="M28"></A>addressbook type <I>recordID</I></H4> +various kinds of properties.<P><H4><A NAME="M30"></A>addressbook setme <I>recordID</I></H4> +This command sets the record that represents the logged-in user. <P><H4><A NAME="M31"></A>addressbook type <I>recordID</I></H4> This command returns the type (<I>ABPerson</I> or <I>ABGroup</I>) of the record with -unique ID <I>recordID</I>.<P><H2><A NAME="M29"></A>INSTALLATION</H2> +unique ID <I>recordID</I>.<P><A NAME="dist"></A> +<H2><A NAME="M32"></A>DISTRIBUTION LIST AND IDENTIFIERS</H2> +Identifiers are necessary when one wants to use a group as a distribution +list, that is send something to all the members of the group. The members +can be addressed by <I>Phone, Email, Address</I> etc. For instance, a group could +be used as a mailing list. The <I>Phone, Email, Address</I> properties are +multi-value list properties: since a person can have several e-mail +addresses, one must specify which one is to be used in the distribution list. +Labels (such as Home, Work etc.) are not sufficient to specify precisely an +e-mail because they are not unique: one can have several e-mails with the +label Work. Here the identifiers come in: each value of a multi-value list +property has an identifier. One of them can be designated as the <I>distribution identifier</I>. The AddressBook database also has a notion of +a <I>primary identifier</I>: it is the identifier which will be used by +default by the distribution list if no <I>distribution identifier</I> as +been specified.<P><H2><A NAME="M33"></A>INSTALLATION</H2> The extension is made of two files: the dynamic library (called addressbook1.0.dylib in version 1.0) and a file pkgIndex.tcl necessary for Tcl to be able to locate the extension upon request. Both files are @@ -271,20 +305,22 @@ <B>auto_path</B> Tcl variable. If you use the extension within the AlphaX editor (version 8.0b11 or greater), you can also install it in the <I>Tclextensions</I> folder which is located at the same level as the -application. <P><H2><A NAME="M30"></A>VERSION HISTORY</H2> +application. <P><H2><A NAME="M34"></A>VERSION HISTORY</H2> <UL> <LI> 1.0b1 -- 2004/01/25 -- First public release. <LI> 1.1b1 -- 2004/07/28 -- New commands [add] and [remove]. Modified -[delete] command. New command [identifier]. Modified [property remove] +[delete] command. Modified [property remove] command. <LI> 1.1b2 -- 2004/07/29 -- New command [setme]. -</UL><P><H2><A NAME="M31"></A>REQUIREMENTS AND PORTABILITY</H2> + <LI> 1.1b3 -- 2004/07/30 -- New command [identifier] to handle +distribution lists. +</UL><P><H2><A NAME="M35"></A>REQUIREMENTS AND PORTABILITY</H2> This extension is only useful on Macintosh platforms. Version 10.2 or greater of the system is required: the AddressBook framework was introduced -in version 10.2 of the System (aka Jaguar).<P><H2><A NAME="M32"></A>KNOW ISSUES</H2> +in version 10.2 of the System (aka Jaguar).<P><H2><A NAME="M36"></A>KNOW ISSUES</H2> Tcladdressbook was written by Bernard Desgraupes. Please e-mail any bug or problem you encounter: -<A HREF="mailto:bde...@us...">bde...@us...</A><P><H2><A NAME="M33"></A>SOURCE CODE</H2> +<A HREF="mailto:bde...@us...">bde...@us...</A><P><H2><A NAME="M37"></A>SOURCE CODE</H2> Tcladdressbook is an Open Source Project. Its source code is public and can be found on the SourceForge site at the following address: <P> <A HREF="http://sourceforge.net/projects/tcladdressbook">http://sourceforge.net/projects/tcladdressbook</A><P><P> Tcladdressbook binary releases are available at @@ -293,17 +329,17 @@ <P> <A HREF="http://webperso.easyconnect.fr/bdesgraupes/tcl.html">http://webperso.easyconnect.fr/bdesgraupes/tcl.html</A><P><P> The code is under CVS control. You can retrieve the latest stage of development using any CVS client. See instructions at: <P> <A HREF="http://sourceforge.net/cvs/?group_id=96169">http://sourceforge.net/cvs/?group_id=96169</A><P><P> You can also browse the cvs repository online at -<P> <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook</A> <P><H2><A NAME="M34"></A>CONTRIBUTIONS</H2> +<P> <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook</A> <P><H2><A NAME="M38"></A>CONTRIBUTIONS</H2> Code contributions (Tcl scripts making use of the Tcladdressbook extension) are very welcome. There is a "Contribs" directory in the Tcladdressbook project on SourceForge for code contributions. They must be free software, distributed under an Open Source license acceptable by the SourceForge site -(for instance, the same licensing terms as the Tcl language itself).<P><H2><A NAME="M35"></A>LICENSE AND DISCLAIMER</H2> +(for instance, the same licensing terms as the Tcl language itself).<P><H2><A NAME="M39"></A>LICENSE AND DISCLAIMER</H2> This software is free software and distributed under the same licensing terms -as the Tcl language itself. See license.terms in the Tcl distribution.<P><P> © Copyright Bernard Desgraupes 2003-2004<P><H2><A NAME="M36"></A>SEE ALSO</H2> +as the Tcl language itself. See license.terms in the Tcl distribution.<P><P> © Copyright Bernard Desgraupes 2003-2004<P><H2><A NAME="M40"></A>SEE ALSO</H2> See the TclX extension for keyed lists: TclX(n). See the Mk4Tcl extension for -commands to open directly the database file.<P><H2><A NAME="M37"></A>KEYWORDS</H2> +commands to open directly the database file.<P><H2><A NAME="M41"></A>KEYWORDS</H2> Address book, data base.<P><HR> -<P> Last updated 2004-07-29 22:00:15<P> +<P> Last updated 2004-07-30 13:05:27<P> </BODY> </HTML> \ No newline at end of file |
|
From: Bernard D. <bde...@us...> - 2004-07-30 11:17:05
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18808/Help Modified Files: TclAddressBookHelp.aida Log Message: Doc [identifier] subcommands (count, get, primary, set) Index: TclAddressBookHelp.aida =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.aida,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- TclAddressBookHelp.aida 29 Jul 2004 20:15:05 -0000 1.15 +++ TclAddressBookHelp.aida 30 Jul 2004 11:16:53 -0000 1.16 @@ -5,7 +5,7 @@ :Author: Bernard Desgraupes <bde...@ea...> :Homepage: <http://webperso.easyconnect.fr/bdesgraupes/> :Created: 2003-11-26 14:30:03 -:Modified: 2004-07-29 21:50:14 +:Modified: 2004-07-30 12:56:43 :Keywords: Address book, data base ((if $aida_params(target) eq "Pdf" @@ -100,22 +100,44 @@ ((i -ingroup i)) option is specified, only the subgroups contained in the group with ID ((i groupID i)) will be returned. -((s3 addressbook identifier ((i personID i)) ((i groupID i)) ((i propName i)) ?((i label i))? -This command lets you get or set the distribution identifier for a -multi-value list property of a person in a group. -((nl Used without a ((i label i)) argument, this will return the -distribution identifier for the person ((i personID i)) belonging to the +((s3 addressbook identifier count ((i personID i)) ((i propName i)) +This command returns the number of items in a multi-value list property +(such as Address, Phone, Email). + +((s3 addressbook identifier get ((i personID i)) ((i propName i)) ((i index i)) +This command gets the unique identifier of an item in a multi-value list +property (such as Address, Phone, Email). It returns the identifier of the +item at index ((i index i)) in the multi-value list of property +((i propName i)) for the record corresponding to ((i personID i)). One can +get the count of identifiers using the ((b addressbook identifier count b)) +command. Identifiers are used by the ((b addressbook identifier set b)) +command. See the section ((lk #dist ))Distribution list and identifiers lk)) +below for explanations about identifiers. + +((s3 addressbook identifier primary ((i personID i)) ((i propName i)) +This command returns the primary identifier of property ((i propName i)) in +the record ((i personID i)). This is the identifier which will be used by +default if no ((i distribution identifier i)) has been specified using the +((b addressbook identifier set b)) command. Property ((i propName i)) must +be a multi-value list property (such as ((i Address, Phone, Email i))). + +((s3 addressbook identifier set ((i groupID i)) ((i personID i)) ((i propName i)) ?((i ident i))? +This command lets you get or set the ((i distribution identifier i)) for a +multi-value list property of a person in a group. See the section +((lk #dist )) Distribution list and identifiers lk)) below for +explanations about identifiers. +((nl Used without the ((i ident i)) argument, the command will return the +((i distribution identifier i)) for the person ((i personID i)) belonging to the group ((i groupID i)) concerning property ((i propName i)) if it was set, -otherwise the property¹s primary identifier. Property ((i propName i)) must -be a multi-value list property -((nl If the ((i label i)) argument is specified, this will assign a -specific distribution identifier for the person¹s multi-value list property -so that the group can be used as a distribution list (a mailing list for -instance, in the case of an email property). This value must be a label -used by the multi-value list (such as ((i home i)) for an ((i address i)) -property). If ((i label i)) is an empty string, this command resets the -distribution identifier to its default, i-e the multi-value list¹s primary -identifier. +otherwise the property's primary identifier. Property ((i propName i)) must +be a multi-value list property (such as ((i Address, Phone, Email i))). +((nl If the ((i ident i)) argument is specified, this will assign a +specific ((i distribution identifier i)) for the person's multi-value list +property so that the group can be used as a distribution list (a mailing +list for instance, in the case of an email property). This value must be a +valid identifier used by the multi-value list: one can get the identifiers +of any element of a multi-value list using the ((b addressbook identifier +get b)) command. ((s3 addressbook image ((i personID i)) ?((i imageData i))? If no ((i imageData i)) argument is specified, this command returns the @@ -306,6 +328,23 @@ This command returns the type (((i ABPerson i)) or ((i ABGroup i))) of the record with unique ID ((i recordID i)). +((a dist )) a)) +((s1 DISTRIBUTION LIST AND IDENTIFIERS +Identifiers are necessary when one wants to use a group as a distribution +list, that is send something to all the members of the group. The members +can be addressed by ((i Phone, Email, Address i)) etc. For instance, a group could +be used as a mailing list. The ((i Phone, Email, Address i)) properties are +multi-value list properties: since a person can have several e-mail +addresses, one must specify which one is to be used in the distribution list. +Labels (such as Home, Work etc.) are not sufficient to specify precisely an +e-mail because they are not unique: one can have several e-mails with the +label Work. Here the identifiers come in: each value of a multi-value list +property has an identifier. One of them can be designated as the ((i +distribution identifier i)). The AddressBook database also has a notion of +a ((i primary identifier i)): it is the identifier which will be used by +default by the distribution list if no ((i distribution identifier i)) as +been specified. + ((s1 INSTALLATION The extension is made of two files: the dynamic library (called @@ -324,9 +363,11 @@ ((lu ((li 1.0b1 -- 2004/01/25 -- First public release. ((li 1.1b1 -- 2004/07/28 -- New commands [add] and [remove]. Modified -[delete] command. New command [identifier]. Modified [property remove] +[delete] command. Modified [property remove] command. ((li 1.1b2 -- 2004/07/29 -- New command [setme]. +((li 1.1b3 -- 2004/07/30 -- New command [identifier] to handle +distribution lists. lu)) |
|
From: Bernard D. <bde...@us...> - 2004-07-30 11:15:05
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18451/Source Modified Files: TclAddressBookUtils.h Log Message: Subcommands to [identifier] command Index: TclAddressBookUtils.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- TclAddressBookUtils.h 29 Jul 2004 09:12:23 -0000 1.9 +++ TclAddressBookUtils.h 30 Jul 2004 11:14:54 -0000 1.10 @@ -1,7 +1,7 @@ /* * File : "TclAddressBookUtils.h" * Created: 2003-12-05 10:05:19 - * Last modification: 2004-07-29 11:07:37 + * Last modification: 2004-07-30 11:36:23 * Author: Bernard Desgraupes * e-mail: <bde...@ea...> * @@ -106,6 +106,26 @@ Tcl_Obj *resultPtr, int inRecordType); +int TclAB_IdentifierCount(Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + Tcl_Obj *resultPtr); + +int TclAB_IdentifierGet(Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + Tcl_Obj *resultPtr); + +int TclAB_IdentifierPrimary(Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + Tcl_Obj *resultPtr); + +int TclAB_IdentifierSet(Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + Tcl_Obj *resultPtr); + void TclAB_PutValueInResult(Tcl_Interp *interp, char * inPropName, char * inStr, Boolean allValues); Boolean TclAB_CheckItem(Tcl_Interp *interp, |
|
From: Bernard D. <bde...@us...> - 2004-07-30 11:14:55
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18389/Source Modified Files: TclAddressBookUtils.c Log Message: Subcommands to [identifier] command Index: TclAddressBookUtils.c =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- TclAddressBookUtils.c 29 Jul 2004 13:30:36 -0000 1.15 +++ TclAddressBookUtils.c 30 Jul 2004 11:14:46 -0000 1.16 @@ -1,7 +1,7 @@ /* * File : "TclAddressBookUtils.c" * Created: 2003-12-05 10:08:03 - * Last modification: 2004-07-29 11:07:23 + * Last modification: 2004-07-30 10:51:55 * Author: Bernard Desgraupes * e-mail: <bde...@ea...> * @@ -1331,6 +1331,458 @@ /* *---------------------------------------------------------------------- * + * TclAB_IdentifierCount -- + * + * This function is invoked to process the [addressbook identifier count] + * Tcl command. + * See the user documentation for details on what it does. + * + * Syntax: + * addressbook identifier count personID propName + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +int +TclAB_IdentifierCount( + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[], /* Argument values. */ + Tcl_Obj *resultPtr) /* Pointer to store the result. */ +{ + ABAddressBookRef ab; + CONST84 char * theProperty, * theUID; + CFStringRef propertyRef, valueRef; + ABRecordRef personRecord; +// ABPropertyType thePropType; + int length, result = TCL_OK; + unsigned int mvCount; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 2, objv, "recordID propName"); + return TCL_ERROR; + } + + Tcl_ResetResult(interp); + + // Get the address book + ab = ABGetSharedAddressBook(); + + // Check if third argument is a person and get the corresponding record + theUID = Tcl_GetStringFromObj(objv[3], &length); + if ( !TclAB_CheckItem(interp, ab, theUID, "third", &personRecord, rec_person) ) { + return TCL_ERROR; + } + + Tcl_IncrRefCount(objv[4]); + theProperty = Tcl_GetStringFromObj(objv[4], &length); + + // Make CFString object for property + propertyRef = CFStringCreateWithCString(NULL, theProperty, kCFStringEncodingUTF8); + if (!propertyRef) { + Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for property", (char *) NULL); + result = TCL_ERROR; + goto DONE; + } + +// // Check the property type (string, date, multivalue...) +// // kABMultiArrayProperty +// // kABMultiDateProperty +// // kABMultiIntegerProperty +// // kABMultiRealProperty +// // kABMultiStringProperty + +// thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); +// if (thePropType == kABErrorInProperty) { +// Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, +// "' for Person records", (char *) NULL); +// CFRelease(propertyRef); +// result = TCL_ERROR; +// goto DONE; +// } + + valueRef = ABRecordCopyValue(personRecord, propertyRef); + if (!valueRef) { + Tcl_AppendStringsToObj(resultPtr, "Couldn't get value for '", + theProperty, "' property", (char *) NULL); + result = TCL_ERROR; + } else { + mvCount = ABMultiValueCount((ABMutableMultiValueRef) valueRef); + CFRelease(valueRef); + Tcl_SetObjResult(interp, Tcl_NewIntObj(mvCount)); + } + CFRelease(propertyRef); + +DONE: + Tcl_DecrRefCount(objv[4]); + CFRelease(personRecord); + return result; +} + + +/* + *---------------------------------------------------------------------- + * + * TclAB_IdentifierGet -- + * + * This function is invoked to process the [addressbook identifier get] + * Tcl command. + * See the user documentation for details on what it does. + * + * Syntax: + * addressbook identifier get personID propName index + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +int +TclAB_IdentifierGet( + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[], /* Argument values. */ + Tcl_Obj *resultPtr) /* Pointer to store the result. */ +{ + ABAddressBookRef ab; + Tcl_DString ds; + CONST84 char * theProperty, * theUID, * theIndex; + CFStringRef propertyRef, valueRef, identRef; + ABRecordRef personRecord; +// ABPropertyType thePropType; + char theString[256]; + int index, length, result = TCL_OK; + + if (objc != 6) { + Tcl_WrongNumArgs(interp, 2, objv, "personID propName index"); + return TCL_ERROR; + } + + Tcl_ResetResult(interp); + + // Get the address book + ab = ABGetSharedAddressBook(); + + // Check if third argument is a person and get the corresponding record + theUID = Tcl_GetStringFromObj(objv[3], &length); + if ( !TclAB_CheckItem(interp, ab, theUID, "third", &personRecord, rec_person) ) { + return TCL_ERROR; + } + + // Make CFString object for property + Tcl_IncrRefCount(objv[4]); + theProperty = Tcl_GetStringFromObj(objv[4], &length); + propertyRef = CFStringCreateWithCString(NULL, theProperty, kCFStringEncodingUTF8); + if (!propertyRef) { + Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for property", (char *) NULL); + result = TCL_ERROR; + goto DONE; + } + + // Retrieve the index + Tcl_IncrRefCount(objv[5]); + theIndex = Tcl_GetStringFromObj(objv[5], &length); + index = atoi(theIndex); + +// // Check the property type (string, date, multivalue...) +// // kABMultiArrayProperty +// // kABMultiDateProperty +// // kABMultiIntegerProperty +// // kABMultiRealProperty +// // kABMultiStringProperty +// thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); +// if (thePropType == kABErrorInProperty) { +// Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, +// "' for Person records", (char *) NULL); +// CFRelease(propertyRef); +// result = TCL_ERROR; +// goto DONE; +// } + + valueRef = ABRecordCopyValue(personRecord, propertyRef); + if (!valueRef) { + Tcl_AppendStringsToObj(resultPtr, "Couldn't get value for '", theProperty, "' property", (char *) NULL); + result = TCL_ERROR; + } else { + identRef = ABMultiValueCopyIdentifierAtIndex((ABMutableMultiValueRef) valueRef, index); + if (!identRef) { + Tcl_AppendStringsToObj(resultPtr, "Couldn't get identifier at index ", theIndex, (char *) NULL); + result = TCL_ERROR; + } else { + CFStringGetCString(identRef, theString, sizeof(theString), NULL); + Tcl_ExternalToUtfDString(gMacRomanEnc, theString, strlen(theString), &ds); + Tcl_DStringResult(interp, &ds); + Tcl_DStringFree(&ds); + CFRelease(identRef); + } + CFRelease(valueRef); + } + CFRelease(propertyRef); + +DONE: + Tcl_DecrRefCount(objv[4]); + Tcl_DecrRefCount(objv[5]); + CFRelease(personRecord); + return result; +} + + +/* + *---------------------------------------------------------------------- + * + * TclAB_IdentifierPrimary -- + * + * This function is invoked to process the [addressbook identifier primary] + * Tcl command. + * See the user documentation for details on what it does. + * + * Syntax: + * addressbook identifier primary personID propName + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +int +TclAB_IdentifierPrimary( + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[], /* Argument values. */ + Tcl_Obj *resultPtr) /* Pointer to store the result. */ +{ + ABAddressBookRef ab; + Tcl_DString ds; + CONST84 char * theProperty, * theUID; + CFStringRef propertyRef, valueRef, identRef; + ABRecordRef personRecord; +// ABPropertyType thePropType; + char theString[256]; + int length, result = TCL_OK; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 2, objv, "personID propName"); + return TCL_ERROR; + } + + Tcl_ResetResult(interp); + + // Get the address book + ab = ABGetSharedAddressBook(); + + // Check if third argument is a person and get the corresponding record + theUID = Tcl_GetStringFromObj(objv[3], &length); + if ( !TclAB_CheckItem(interp, ab, theUID, "third", &personRecord, rec_person) ) { + return TCL_ERROR; + } + + // Make CFString object for property + Tcl_IncrRefCount(objv[4]); + theProperty = Tcl_GetStringFromObj(objv[4], &length); + propertyRef = CFStringCreateWithCString(NULL, theProperty, kCFStringEncodingUTF8); + if (!propertyRef) { + Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for property", (char *) NULL); + result = TCL_ERROR; + goto DONE; + } + +// // Check the property type (string, date, multivalue...) +// // kABMultiArrayProperty +// // kABMultiDateProperty +// // kABMultiIntegerProperty +// // kABMultiRealProperty +// // kABMultiStringProperty +// thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); +// if (thePropType == kABErrorInProperty) { +// Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, +// "' for Person records", (char *) NULL); +// CFRelease(propertyRef); +// result = TCL_ERROR; +// goto DONE; +// } + + valueRef = ABRecordCopyValue(personRecord, propertyRef); + if (!valueRef) { + Tcl_AppendStringsToObj(resultPtr, "Couldn't get value for '", theProperty, "' property", (char *) NULL); + result = TCL_ERROR; + } else { + identRef = ABMultiValueCopyPrimaryIdentifier((ABMutableMultiValueRef) valueRef); + if (!identRef) { + Tcl_AppendStringsToObj(resultPtr, "Couldn't get primary identifier for '", theProperty, "' property", (char *) NULL); + result = TCL_ERROR; + } else { + CFStringGetCString(identRef, theString, sizeof(theString), NULL); + Tcl_ExternalToUtfDString(gMacRomanEnc, theString, strlen(theString), &ds); + Tcl_DStringResult(interp, &ds); + Tcl_DStringFree(&ds); + CFRelease(identRef); + } + CFRelease(valueRef); + } + CFRelease(propertyRef); + +DONE: + Tcl_DecrRefCount(objv[4]); + CFRelease(personRecord); + return result; +} + + +/* + *---------------------------------------------------------------------- + * + * TclAB_IdentifierSet -- + * + * This function is invoked to process the [addressbook identifier set] + * Tcl command. + * See the user documentation for details on what it does. + * + * Syntax: + * addressbook identifier set groupID personID propName ?identifier? + * + * If the ?identifier? argument is specified, the command tries to set the + * distribution identifier of the property to that value, otherwise it returns + * the current value of the distribution identifier. It concerns + * multi-value list properties and applies to a particular person belonging to + * a particular group. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +int +TclAB_IdentifierSet( + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[], /* Argument values. */ + Tcl_Obj *resultPtr) /* Pointer to store the result. */ +{ + ABAddressBookRef ab; + Tcl_DString ds; + CONST84 char * theProperty, * theGroupUID, * thePersonUID, * theNewVal; + CFStringRef propertyRef, valueRef; + ABRecordRef groupRecord, personRecord; + ABPropertyType thePropType; + int length, result = TCL_OK; + Boolean setIt = false; + + if (objc != 6 && objc != 7) { + Tcl_WrongNumArgs(interp, 2, objv, "groupID personID propName ?identifier?"); + return TCL_ERROR; + } + + Tcl_ResetResult(interp); + + theGroupUID = Tcl_GetStringFromObj(objv[3], &length); + thePersonUID = Tcl_GetStringFromObj(objv[4], &length); + + // Get the address book + ab = ABGetSharedAddressBook(); + + // Check if third argument is a group and get the corresponding record + if ( !TclAB_CheckItem(interp, ab, theGroupUID, "third", &groupRecord, rec_group) ) { + return TCL_ERROR; + } + + // Check if fourth argument is a person and get the corresponding record + if ( !TclAB_CheckItem(interp, ab, thePersonUID, "fourth", &personRecord, rec_person) ) { + CFRelease(groupRecord); + return TCL_ERROR; + } + + Tcl_IncrRefCount(objv[5]); + theProperty = Tcl_GetStringFromObj(objv[5], &length); + + // Make CFString object for property + propertyRef = CFStringCreateWithCString(NULL, theProperty, kCFStringEncodingUTF8); + if (!propertyRef) { + Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for property", (char *) NULL); + result = TCL_ERROR; + goto DONE; + } + + // Check the property type (string, date, multivalue...) + thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); + if (thePropType == kABErrorInProperty) { + Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, + "' for Person records", (char *) NULL); + CFRelease(propertyRef); + result = TCL_ERROR; + goto DONE; + } + + if (objc == 7) { + Tcl_IncrRefCount(objv[6]); + theNewVal = Tcl_GetStringFromObj(objv[6], &length); + valueRef = CFStringCreateWithCString(NULL, theNewVal, kCFStringEncodingUTF8); + if (!valueRef) { + Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for identifier", (char *) NULL); + CFRelease(propertyRef); + result = TCL_ERROR; + goto DONE; + } + setIt = true; + } + + if (setIt) { + if (!ABGroupSetDistributionIdentifier(groupRecord, personRecord, propertyRef, valueRef)) { + Tcl_AppendStringsToObj(resultPtr, "Couldn't set distribution identifier for '", + theProperty, "' property", (char *) NULL); + result = TCL_ERROR; + } else { + Tcl_ExternalToUtfDString(gMacRomanEnc, theNewVal, strlen(theNewVal), &ds); + Tcl_DStringResult(interp, &ds); + Tcl_DStringFree(&ds); + } + CFRelease(valueRef); + } else { + CFStringRef identRef = ABGroupCopyDistributionIdentifier(groupRecord, personRecord, propertyRef); + if (!identRef) { + Tcl_AppendStringsToObj(resultPtr, "Couldn't get distribution identifier of '", + theProperty, "' property for this record", (char *) NULL); + result = TCL_ERROR; + } else { + char theString[256]; + CFStringGetCString(identRef, theString, sizeof(theString), NULL); + CFRelease(identRef); + Tcl_ExternalToUtfDString(gMacRomanEnc, theString, strlen(theString), &ds); + Tcl_DStringResult(interp, &ds); + Tcl_DStringFree(&ds); + } + } + CFRelease(propertyRef); + +DONE: + Tcl_DecrRefCount(objv[5]); + if (objc == 7) Tcl_DecrRefCount(objv[6]); + CFRelease(groupRecord); + CFRelease(personRecord); + return result; +} + + +/* + *---------------------------------------------------------------------- + * * TclAB_MakeSearchRefFromTcl -- * * This function is invoked to build a CF object representing a value to |
|
From: Bernard D. <bde...@us...> - 2004-07-30 11:14:45
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18328/Source Modified Files: TclAddressBook.c Log Message: Subcommands to [identifier] command Index: TclAddressBook.c =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- TclAddressBook.c 29 Jul 2004 20:14:04 -0000 1.28 +++ TclAddressBook.c 30 Jul 2004 11:14:34 -0000 1.29 @@ -1,7 +1,7 @@ /* * File : "TclAddressBook.c" * Created: 2003-11-26 12:54:15 - * Last modification: 2004-07-29 11:06:58 + * Last modification: 2004-07-30 11:36:35 * Author: Bernard Desgraupes * e-mail: <bde...@ea...> * @@ -787,14 +787,11 @@ * See the user documentation for details on what it does. * * Syntax: - * addressbook identifier personID groupID property ?label? + * addressbook identifier count personID propName + * addressbook identifier get personID propName index + * addressbook identifier primary personID propName + * addressbook identifier set groupID personID propName ?identifier? * - * If the ?label? argument is specified, the command tries to set the - * distribution identifier of the property to that value, otherwise it returns - * the current value of the distribution identifier. It concerns - * multi-value list properties and applies to a particular person belonging to - * a particular group. If ?label? is empty, the primary default value is - * reset. * * Results: * A standard Tcl result. @@ -813,104 +810,45 @@ Tcl_Obj *CONST objv[], /* Argument values. */ Tcl_Obj *resultPtr) /* Pointer to store the result. */ { - ABAddressBookRef ab; - CONST84 char * theProperty, * thePersonUID, * theGroupUID, * theNewVal; - CFStringRef propertyRef, valueRef; - ABRecordRef personRecord, groupRecord; - ABPropertyType thePropType; - int length, result; - Boolean setIt = false; - - if (objc != 5 && objc != 6) { - Tcl_WrongNumArgs(interp, 2, objv, "recordID groupID property ?label?"); - return TCL_ERROR; - } - - Tcl_ResetResult(interp); - - thePersonUID = Tcl_GetStringFromObj(objv[2], &length); - theGroupUID = Tcl_GetStringFromObj(objv[3], &length); - - // Get the address book - ab = ABGetSharedAddressBook(); + int result = TCL_ERROR, index, kind; - // Check if second argument is a person and get the corresponding record - if ( !TclAB_CheckItem(interp, ab, thePersonUID, "second", &personRecord, rec_person) ) { - return TCL_ERROR; - } + static CONST char *identSubcmdSwitches[] = { + "count", "get", "primary", "set", (char *) NULL + }; - // Check if third argument is a group and get the corresponding record - if ( !TclAB_CheckItem(interp, ab, theGroupUID, "third", &groupRecord, rec_group) ) { - CFRelease(personRecord); + enum { + TCLAB_IDENTIFIER_COUNT, TCLAB_IDENTIFIER_GET, + TCLAB_IDENTIFIER_PRIMARY, TCLAB_IDENTIFIER_SET + }; + + if (objc < 5) { + Tcl_WrongNumArgs(interp, 2, objv, "(count|get|set) ?args?"); return TCL_ERROR; } - Tcl_IncrRefCount(objv[4]); - theProperty = Tcl_GetStringFromObj(objv[4], &length); - - // Make CFString object for property - propertyRef = CFStringCreateWithCString(NULL, theProperty, kCFStringEncodingUTF8); - if (!propertyRef) { - Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for property", (char *) NULL); - result = TCL_ERROR; - goto DONE; + if (Tcl_GetIndexFromObj(interp, objv[2], identSubcmdSwitches, + "subcommand", 0, &index) != TCL_OK) { + return TCL_ERROR; } - - // Find the property type (string, date, multivalue...) - thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); - if (thePropType == kABErrorInProperty) { - Tcl_AppendStringsToObj(resultPtr, "Unknown property '", theProperty, - "' for Person records", (char *) NULL); - CFRelease(propertyRef); - result = TCL_ERROR; - goto DONE; - } - if (objc == 6) { - theNewVal = Tcl_GetStringFromObj(objv[5], &length); - if (length == 0) { - valueRef = NULL; - } else { - valueRef = CFStringCreateWithCString(NULL, theNewVal, kCFStringEncodingUTF8); - } - setIt = true; - } - - if (setIt) { -// ABGroupSetDistributionIdentifier(groupRecord, personRecord, propertyRef, valueRef) -// ABGroupSetDistributionIdentifier(groupRecord, personRecord, kABAddressProperty, kABAddressHomeLabel) - if (!ABGroupSetDistributionIdentifier(groupRecord, personRecord, propertyRef, valueRef)) { - Tcl_AppendStringsToObj(resultPtr, "Couldn't set distribution identifier for '", - theProperty, "' property", (char *) NULL); - CFRelease(propertyRef); - if (valueRef != NULL) CFRelease(valueRef); - result = TCL_ERROR; - goto DONE; - } - } else { - char theString[256]; - Tcl_DString ds; + switch (index) { + case TCLAB_IDENTIFIER_COUNT: + result = TclAB_IdentifierCount(interp, objc, objv, resultPtr); + break; - valueRef = ABGroupCopyDistributionIdentifier(groupRecord, personRecord, propertyRef); - if (!valueRef) { - Tcl_AppendStringsToObj(resultPtr, "Couldn't get distribution identifier of '", - theProperty, "' property for this record", (char *) NULL); - CFRelease(propertyRef); - result = TCL_ERROR; - goto DONE; - } - CFStringGetCString(valueRef, theString, sizeof(theString), NULL); - Tcl_ExternalToUtfDString(gMacRomanEnc, theString, strlen(theString), &ds); - Tcl_DStringResult(interp, &ds); - Tcl_DStringFree(&ds); - CFRelease(valueRef); + case TCLAB_IDENTIFIER_GET: + result = TclAB_IdentifierGet(interp, objc, objv, resultPtr); + break; + + case TCLAB_IDENTIFIER_PRIMARY: + result = TclAB_IdentifierPrimary(interp, objc, objv, resultPtr); + break; + + case TCLAB_IDENTIFIER_SET: + result = TclAB_IdentifierSet(interp, objc, objv, resultPtr); + break; } - CFRelease(propertyRef); -DONE: - Tcl_DecrRefCount(objv[4]); - CFRelease(groupRecord); - CFRelease(personRecord); return result; } |
|
From: Bernard D. <bde...@us...> - 2004-07-30 11:14:10
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18180/Source Modified Files: Changes.Log Log Message: Version 1.1b3 Index: Changes.Log =================================================================== RCS file: /cvsroot/tcladdressbook/Source/Changes.Log,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Changes.Log 29 Jul 2004 20:13:49 -0000 1.15 +++ Changes.Log 30 Jul 2004 11:14:01 -0000 1.16 @@ -31,14 +31,21 @@ Last modification: $Date$ ================================================================================ -= 1.1b2 last update: += 1.1b3 last update: ================================================================================ - Added a new [addressbook identifier] command to set the record that - represents the logged-in user. + Extended the [addressbook identifier] command with subcommands to + manage distribution lists. New subcommands are: count, get, + primary, and set. ================================================================================ -= 1.1b1 last update: 2004-07-29 22:07:10 += 1.1b2 last update: 2004-07-29 22:07:10 +================================================================================ + Added a new [addressbook setme] command to set the record that + represents the logged-in user. + +================================================================================ += 1.1b1 last update: 2004-07-29 12:18:05 ================================================================================ Added an [addressbook add] and an [addressbook remove] command to add or remove an item (person or group) to or from a group. |
|
From: Bernard D. <bde...@us...> - 2004-07-29 20:15:26
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18004/Help Modified Files: TclAddressBookHelp.html Log Message: Documenting new "setme" command Index: TclAddressBookHelp.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.html,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- TclAddressBookHelp.html 29 Jul 2004 13:32:36 -0000 1.17 +++ TclAddressBookHelp.html 29 Jul 2004 20:15:15 -0000 1.18 @@ -8,7 +8,7 @@ <P><IMG SRC="Images/TclAB_logo.gif " ALT="TclAB Logo" ALIGN=bottom></P> <P> <A HREF="TclAB.html"> Home Page</A> | <A HREF="http://sourceforge.net/projects/tcladdressbook"> Project Page at SourceForge</A><P><HR><BLOCKQUOTE><P><I> This is a manual page for the Tcladdressbook extension for Tcl. It -documents version 1.1b1. +documents version 1.1b2. </I></P></BLOCKQUOTE><HR> <UL> <LI><A HREF="#M1">NAME</A> @@ -37,16 +37,17 @@ <UL><UL><LI><A HREF="#M24">addressbook save</A></UL></UL> <UL><UL><LI><A HREF="#M25">addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></A></UL></UL> <UL><UL><LI><A HREF="#M26">addressbook set <I>recordID propertyName</I> ?<I>value</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M27">addressbook type <I>recordID</I></A></UL></UL> -<LI><A HREF="#M28">INSTALLATION</A> -<LI><A HREF="#M29">VERSION HISTORY</A> -<LI><A HREF="#M30">REQUIREMENTS AND PORTABILITY</A> -<LI><A HREF="#M31">KNOW ISSUES</A> -<LI><A HREF="#M32">SOURCE CODE</A> -<LI><A HREF="#M33">CONTRIBUTIONS</A> -<LI><A HREF="#M34">LICENSE AND DISCLAIMER</A> -<LI><A HREF="#M35">SEE ALSO</A> -<LI><A HREF="#M36">KEYWORDS</A> +<UL><UL><LI><A HREF="#M27">addressbook setme <I>recordID</I></A></UL></UL> +<UL><UL><LI><A HREF="#M28">addressbook type <I>recordID</I></A></UL></UL> +<LI><A HREF="#M29">INSTALLATION</A> +<LI><A HREF="#M30">VERSION HISTORY</A> +<LI><A HREF="#M31">REQUIREMENTS AND PORTABILITY</A> +<LI><A HREF="#M32">KNOW ISSUES</A> +<LI><A HREF="#M33">SOURCE CODE</A> +<LI><A HREF="#M34">CONTRIBUTIONS</A> +<LI><A HREF="#M35">LICENSE AND DISCLAIMER</A> +<LI><A HREF="#M36">SEE ALSO</A> +<LI><A HREF="#M37">KEYWORDS</A> </UL> <P><H2><A NAME="M1"></A>NAME</H2> addressbook - manipulate the Macintosh OSX Address Book database<P><H2><A NAME="M2"></A>SYNOPSIS</H2> @@ -257,9 +258,10 @@ the <I>propertyName</I> argument. If <I>value</I> is specified, the property <I>propertyName</I> will be set to this value. See the <B>addressbook record</B> command for a description of the format used for the -various kinds of properties.<P><H4><A NAME="M27"></A>addressbook type <I>recordID</I></H4> +various kinds of properties.<P><H4><A NAME="M27"></A>addressbook setme <I>recordID</I></H4> +This command sets the record that represents the logged-in user. <P><H4><A NAME="M28"></A>addressbook type <I>recordID</I></H4> This command returns the type (<I>ABPerson</I> or <I>ABGroup</I>) of the record with -unique ID <I>recordID</I>.<P><H2><A NAME="M28"></A>INSTALLATION</H2> +unique ID <I>recordID</I>.<P><H2><A NAME="M29"></A>INSTALLATION</H2> The extension is made of two files: the dynamic library (called addressbook1.0.dylib in version 1.0) and a file pkgIndex.tcl necessary for Tcl to be able to locate the extension upon request. Both files are @@ -269,18 +271,20 @@ <B>auto_path</B> Tcl variable. If you use the extension within the AlphaX editor (version 8.0b11 or greater), you can also install it in the <I>Tclextensions</I> folder which is located at the same level as the -application. <P><H2><A NAME="M29"></A>VERSION HISTORY</H2> +application. <P><H2><A NAME="M30"></A>VERSION HISTORY</H2> <UL> <LI> 1.0b1 -- 2004/01/25 -- First public release. - <LI> 1.1b1 -- 2004/08/01 -- New commands "add" and "remove". Modified -"delete" command. -</UL><P><H2><A NAME="M30"></A>REQUIREMENTS AND PORTABILITY</H2> + <LI> 1.1b1 -- 2004/07/28 -- New commands [add] and [remove]. Modified +[delete] command. New command [identifier]. Modified [property remove] +command. + <LI> 1.1b2 -- 2004/07/29 -- New command [setme]. +</UL><P><H2><A NAME="M31"></A>REQUIREMENTS AND PORTABILITY</H2> This extension is only useful on Macintosh platforms. Version 10.2 or greater of the system is required: the AddressBook framework was introduced -in version 10.2 of the System (aka Jaguar).<P><H2><A NAME="M31"></A>KNOW ISSUES</H2> +in version 10.2 of the System (aka Jaguar).<P><H2><A NAME="M32"></A>KNOW ISSUES</H2> Tcladdressbook was written by Bernard Desgraupes. Please e-mail any bug or problem you encounter: -<A HREF="mailto:bde...@us...">bde...@us...</A><P><H2><A NAME="M32"></A>SOURCE CODE</H2> +<A HREF="mailto:bde...@us...">bde...@us...</A><P><H2><A NAME="M33"></A>SOURCE CODE</H2> Tcladdressbook is an Open Source Project. Its source code is public and can be found on the SourceForge site at the following address: <P> <A HREF="http://sourceforge.net/projects/tcladdressbook">http://sourceforge.net/projects/tcladdressbook</A><P><P> Tcladdressbook binary releases are available at @@ -289,17 +293,17 @@ <P> <A HREF="http://webperso.easyconnect.fr/bdesgraupes/tcl.html">http://webperso.easyconnect.fr/bdesgraupes/tcl.html</A><P><P> The code is under CVS control. You can retrieve the latest stage of development using any CVS client. See instructions at: <P> <A HREF="http://sourceforge.net/cvs/?group_id=96169">http://sourceforge.net/cvs/?group_id=96169</A><P><P> You can also browse the cvs repository online at -<P> <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook</A> <P><H2><A NAME="M33"></A>CONTRIBUTIONS</H2> +<P> <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook</A> <P><H2><A NAME="M34"></A>CONTRIBUTIONS</H2> Code contributions (Tcl scripts making use of the Tcladdressbook extension) are very welcome. There is a "Contribs" directory in the Tcladdressbook project on SourceForge for code contributions. They must be free software, distributed under an Open Source license acceptable by the SourceForge site -(for instance, the same licensing terms as the Tcl language itself).<P><H2><A NAME="M34"></A>LICENSE AND DISCLAIMER</H2> +(for instance, the same licensing terms as the Tcl language itself).<P><H2><A NAME="M35"></A>LICENSE AND DISCLAIMER</H2> This software is free software and distributed under the same licensing terms -as the Tcl language itself. See license.terms in the Tcl distribution.<P><P> © Copyright Bernard Desgraupes 2003-2004<P><H2><A NAME="M35"></A>SEE ALSO</H2> +as the Tcl language itself. See license.terms in the Tcl distribution.<P><P> © Copyright Bernard Desgraupes 2003-2004<P><H2><A NAME="M36"></A>SEE ALSO</H2> See the TclX extension for keyed lists: TclX(n). See the Mk4Tcl extension for -commands to open directly the database file.<P><H2><A NAME="M36"></A>KEYWORDS</H2> +commands to open directly the database file.<P><H2><A NAME="M37"></A>KEYWORDS</H2> Address book, data base.<P><HR> -<P> Last updated 2004-07-29 14:00:56<P> +<P> Last updated 2004-07-29 22:00:15<P> </BODY> </HTML> \ No newline at end of file |
|
From: Bernard D. <bde...@us...> - 2004-07-29 20:15:14
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17949/Help Modified Files: TclAddressBookHelp.aida Log Message: Documenting new "setme" command Index: TclAddressBookHelp.aida =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.aida,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- TclAddressBookHelp.aida 29 Jul 2004 13:32:27 -0000 1.14 +++ TclAddressBookHelp.aida 29 Jul 2004 20:15:05 -0000 1.15 @@ -5,7 +5,7 @@ :Author: Bernard Desgraupes <bde...@ea...> :Homepage: <http://webperso.easyconnect.fr/bdesgraupes/> :Created: 2003-11-26 14:30:03 -:Modified: 2004-07-29 01:05:03 +:Modified: 2004-07-29 21:50:14 :Keywords: Address book, data base ((if $aida_params(target) eq "Pdf" @@ -299,6 +299,9 @@ ((b addressbook record b)) command for a description of the format used for the various kinds of properties. +((s3 addressbook setme ((i recordID i)) +This command sets the record that represents the logged-in user. + ((s3 addressbook type ((i recordID i)) This command returns the type (((i ABPerson i)) or ((i ABGroup i))) of the record with unique ID ((i recordID i)). @@ -320,8 +323,10 @@ ((s1 VERSION HISTORY ((lu ((li 1.0b1 -- 2004/01/25 -- First public release. -((li 1.1b1 -- 2004/08/01 -- New commands "add" and "remove". Modified -"delete" command. +((li 1.1b1 -- 2004/07/28 -- New commands [add] and [remove]. Modified +[delete] command. New command [identifier]. Modified [property remove] +command. +((li 1.1b2 -- 2004/07/29 -- New command [setme]. lu)) |
|
From: Bernard D. <bde...@us...> - 2004-07-29 20:15:06
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17787/Help Modified Files: TclAddressBookHelp Log Message: Documenting new "setme" command Index: TclAddressBookHelp =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- TclAddressBookHelp 29 Jul 2004 13:32:18 -0000 1.15 +++ TclAddressBookHelp 29 Jul 2004 20:14:55 -0000 1.16 @@ -5,7 +5,7 @@ Abstract This is a manual page for the Tcladdressbook extension for Tcl. It -documents version 1.1b1. +documents version 1.1b2. 1. NAME @@ -34,6 +34,7 @@ addressbook save addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? property op value addressbook set recordID propertyName ?value? + addressbook setme recordID addressbook type recordID 5. INSTALLATION 6. VERSION HISTORY @@ -315,6 +316,9 @@ addressbook record command for a description of the format used for the various kinds of properties. + addressbook setme recordID +This command sets the record that represents the logged-in user. + addressbook type recordID This command returns the type (ABPerson or ABGroup) of the record with unique ID recordID. @@ -335,8 +339,10 @@ 6. VERSION HISTORY 1.0b1 -- 2004/01/25 -- First public release. - 1.1b1 -- 2004/08/01 -- New commands "add" and "remove". Modified -"delete" command. + 1.1b1 -- 2004/07/28 -- New commands [add] and [remove]. Modified +[delete] command. New command [identifier]. Modified [property remove] +command. + 1.1b2 -- 2004/07/29 -- New command [setme]. @@ -391,7 +397,7 @@ ---------------------------------------------------------------------- - Last updated 2004-07-29 15:28:58 + Last updated 2004-07-29 22:00:33 |
|
From: Bernard D. <bde...@us...> - 2004-07-29 20:14:54
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17728/Help Modified Files: tcladdressbook.n Log Message: Documenting new "setme" command Index: tcladdressbook.n =================================================================== RCS file: /cvsroot/tcladdressbook/Help/tcladdressbook.n,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- tcladdressbook.n 29 Jul 2004 13:32:09 -0000 1.5 +++ tcladdressbook.n 29 Jul 2004 20:14:46 -0000 1.6 @@ -301,6 +301,9 @@ property \fI propertyName\fP will be set to this value. See the \fBaddressbook record\fP command for a description of the format used for the various kinds of properties. +.SS addressbook setme \fI recordID\fP +.PP +This command sets the record that represents the logged-in user. .SS addressbook type \fI recordID\fP .PP This command returns the type (\fI ABPerson\fP or \fI ABGroup\fP) of the record with @@ -323,8 +326,11 @@ .IP * 4 1.0b1 -- 2004/01/25 -- First public release. .IP * 4 -1.1b1 -- 2004/08/01 -- New commands "add" and "remove". Modified -"delete" command. +1.1b1 -- 2004/07/28 -- New commands [add] and [remove]. Modified +[delete] command. New command [identifier]. Modified [property remove] +command. +.IP * 4 +1.1b2 -- 2004/07/29 -- New command [setme]. .RE .SH REQUIREMENTS AND PORTABILITY .PP |
|
From: Bernard D. <bde...@us...> - 2004-07-29 20:14:14
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17541/Source Modified Files: TclAddressBook.c Log Message: New setme command Index: TclAddressBook.c =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- TclAddressBook.c 29 Jul 2004 13:30:21 -0000 1.27 +++ TclAddressBook.c 29 Jul 2004 20:14:04 -0000 1.28 @@ -45,6 +45,7 @@ static int TclABCmd_Save(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); static int TclABCmd_Search(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); static int TclABCmd_Set(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); +static int TclABCmd_SetMe(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); static int TclABCmd_Type(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); @@ -147,14 +148,14 @@ "add", "changed", "count", "create", "delete", "export", "getme", "groups", "identifier", "image", "import", "parents", "persons", "property", "record", "remove", "save", "search", - "set", "type", (char *) NULL + "set", "setme", "type", (char *) NULL }; enum { TCLAB_ADD, TCLAB_CHANGED, TCLAB_COUNT, TCLAB_CREATE, TCLAB_DELETE, TCLAB_EXPORT, TCLAB_GETME, TCLAB_GROUPS, TCLAB_IDENTIFIER, TCLAB_IMAGE, TCLAB_IMPORT, TCLAB_PARENTS, TCLAB_PERSONS, TCLAB_PROPERTY, TCLAB_RECORD, TCLAB_REMOVE, TCLAB_SAVE, TCLAB_SEARCH, - TCLAB_SET, TCLAB_TYPE + TCLAB_SET, TCLAB_SETME, TCLAB_TYPE }; resultPtr = Tcl_GetObjResult(interp); @@ -246,6 +247,10 @@ result = TclABCmd_Set(clientData, interp, objc, objv, resultPtr); break; + case TCLAB_SETME: + result = TclABCmd_SetMe(clientData, interp, objc, objv, resultPtr); + break; + case TCLAB_TYPE: result = TclABCmd_Type(clientData, interp, objc, objv, resultPtr); break; @@ -676,7 +681,6 @@ } - /* *---------------------------------------------------------------------- * @@ -1837,6 +1841,61 @@ /* *---------------------------------------------------------------------- * + * TclABCmd_SetMe -- + * + * This procedure is invoked to process the [addressbook setme] Tcl command. + * It sets the record that represents the logged-in user. + * + * Syntax: + * addressbook setme recordID + * + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +int +TclABCmd_SetMe( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST objv[], /* Argument values. */ + Tcl_Obj *resultPtr) /* Pointer to store the result. */ +{ + ABAddressBookRef ab; + ABRecordRef theRecord; + int length; + + if (objc != 3) { + Tcl_WrongNumArgs(interp, 2, objv, "recordID"); + return TCL_ERROR; + } + + Tcl_ResetResult(interp); + + // Get the address book + ab = ABGetSharedAddressBook(); + + // Check if the second argument is a person and get the corresponding record + if ( !TclAB_CheckItem(interp, ab, Tcl_GetStringFromObj(objv[2], &length), "second", &theRecord, rec_person) ) { + return TCL_ERROR; + } + + ABSetMe(ab, theRecord); + + CFRelease(theRecord); + return TCL_OK; +} + + +/* + *---------------------------------------------------------------------- + * * TclABCmd_Type -- * * This procedure is invoked to process the [addressbook type] Tcl command. |
|
From: Bernard D. <bde...@us...> - 2004-07-29 20:14:01
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17493/Source Modified Files: Changes.Log Log Message: New setme command Index: Changes.Log =================================================================== RCS file: /cvsroot/tcladdressbook/Source/Changes.Log,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Changes.Log 29 Jul 2004 13:30:52 -0000 1.14 +++ Changes.Log 29 Jul 2004 20:13:49 -0000 1.15 @@ -31,7 +31,14 @@ Last modification: $Date$ ================================================================================ -= 1.1b1 last update: += 1.1b2 last update: +================================================================================ + Added a new [addressbook identifier] command to set the record that + represents the logged-in user. + + +================================================================================ += 1.1b1 last update: 2004-07-29 22:07:10 ================================================================================ Added an [addressbook add] and an [addressbook remove] command to add or remove an item (person or group) to or from a group. @@ -46,7 +53,6 @@ identifier of a person¹s multi-value list property in a group. The [addressbook getme] command now accepts an optional -id argument to return the unique ID of the "Me" record. - ================================================================================ = 1.0b1 released last update: 2004-01-27 21:50:42 |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:32:45
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5758/Help Modified Files: TclAddressBookHelp.html Log Message: Documents new 1.1b1 commands Index: TclAddressBookHelp.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.html,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- TclAddressBookHelp.html 28 Jul 2004 23:11:40 -0000 1.16 +++ TclAddressBookHelp.html 29 Jul 2004 13:32:36 -0000 1.17 @@ -21,31 +21,32 @@ <UL><UL><LI><A HREF="#M8">addressbook create (group | person) <I>name</I> ?-ingroup <I>groupID</I>?</A></UL></UL> <UL><UL><LI><A HREF="#M9">addressbook delete <I>recordID</I></A></UL></UL> <UL><UL><LI><A HREF="#M10">addressbook export <I>personID</I></A></UL></UL> -<UL><UL><LI><A HREF="#M11">addressbook getme</A></UL></UL> +<UL><UL><LI><A HREF="#M11">addressbook getme ?<I>-id</I>?</A></UL></UL> <UL><UL><LI><A HREF="#M12">addressbook groups ?-ids? ?-ingroup <I>groupID</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M13">addressbook image <I>personID</I> ?<I>imageData</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M14">addressbook import <I>vCardData</I></A></UL></UL> -<UL><UL><LI><A HREF="#M15">addressbook parents ?-ids? <I>recordID</I></A></UL></UL> -<UL><UL><LI><A HREF="#M16">addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M17">addressbook property names (-groups | -persons)</A></UL></UL> -<UL><UL><LI><A HREF="#M18">addressbook property type (-groups | -persons) <I>propName</I></A></UL></UL> -<UL><UL><LI><A HREF="#M19">addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></A></UL></UL> -<UL><UL><LI><A HREF="#M20">addressbook property remove (-groups | -persons) <I>propName</I></A></UL></UL> -<UL><UL><LI><A HREF="#M21">addressbook record <I>recordID</I></A></UL></UL> -<UL><UL><LI><A HREF="#M22">addressbook remove <I>recordID</I> <I>groupID</I></A></UL></UL> -<UL><UL><LI><A HREF="#M23">addressbook save</A></UL></UL> -<UL><UL><LI><A HREF="#M24">addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></A></UL></UL> -<UL><UL><LI><A HREF="#M25">addressbook set <I>recordID propertyName</I> ?<I>value</I>?</A></UL></UL> -<UL><UL><LI><A HREF="#M26">addressbook type <I>recordID</I></A></UL></UL> -<LI><A HREF="#M27">INSTALLATION</A> -<LI><A HREF="#M28">VERSION HISTORY</A> -<LI><A HREF="#M29">REQUIREMENTS AND PORTABILITY</A> -<LI><A HREF="#M30">KNOW ISSUES</A> -<LI><A HREF="#M31">SOURCE CODE</A> -<LI><A HREF="#M32">CONTRIBUTIONS</A> -<LI><A HREF="#M33">LICENSE AND DISCLAIMER</A> -<LI><A HREF="#M34">SEE ALSO</A> -<LI><A HREF="#M35">KEYWORDS</A> +<UL><UL><LI><A HREF="#M13">addressbook identifier <I>personID</I> <I>groupID</I> <I>propName</I> ?<I>label</I>?</A></UL></UL> +<UL><UL><LI><A HREF="#M14">addressbook image <I>personID</I> ?<I>imageData</I>?</A></UL></UL> +<UL><UL><LI><A HREF="#M15">addressbook import <I>vCardData</I></A></UL></UL> +<UL><UL><LI><A HREF="#M16">addressbook parents ?-ids? <I>recordID</I></A></UL></UL> +<UL><UL><LI><A HREF="#M17">addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</A></UL></UL> +<UL><UL><LI><A HREF="#M18">addressbook property names (-groups | -persons)</A></UL></UL> +<UL><UL><LI><A HREF="#M19">addressbook property type (-groups | -persons) <I>propName</I></A></UL></UL> +<UL><UL><LI><A HREF="#M20">addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></A></UL></UL> +<UL><UL><LI><A HREF="#M21">addressbook property remove (-groups | -persons | recordID) <I>propName</I></A></UL></UL> +<UL><UL><LI><A HREF="#M22">addressbook record <I>recordID</I></A></UL></UL> +<UL><UL><LI><A HREF="#M23">addressbook remove <I>recordID</I> <I>groupID</I></A></UL></UL> +<UL><UL><LI><A HREF="#M24">addressbook save</A></UL></UL> +<UL><UL><LI><A HREF="#M25">addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></A></UL></UL> +<UL><UL><LI><A HREF="#M26">addressbook set <I>recordID propertyName</I> ?<I>value</I>?</A></UL></UL> +<UL><UL><LI><A HREF="#M27">addressbook type <I>recordID</I></A></UL></UL> +<LI><A HREF="#M28">INSTALLATION</A> +<LI><A HREF="#M29">VERSION HISTORY</A> +<LI><A HREF="#M30">REQUIREMENTS AND PORTABILITY</A> +<LI><A HREF="#M31">KNOW ISSUES</A> +<LI><A HREF="#M32">SOURCE CODE</A> +<LI><A HREF="#M33">CONTRIBUTIONS</A> +<LI><A HREF="#M34">LICENSE AND DISCLAIMER</A> +<LI><A HREF="#M35">SEE ALSO</A> +<LI><A HREF="#M36">KEYWORDS</A> </UL> <P><H2><A NAME="M1"></A>NAME</H2> addressbook - manipulate the Macintosh OSX Address Book database<P><H2><A NAME="M2"></A>SYNOPSIS</H2> @@ -78,48 +79,64 @@ subgroup. This is achieved now by the <B>addressbook remove</B> command.<P><H4><A NAME="M10"></A>addressbook export <I>personID</I></H4> This command lets you export the record with unique ID <I>personID</I> as a VCard. The result should be considered as binary data since it can -contain an image associated to the record.<P><H4><A NAME="M11"></A>addressbook getme</H4> -This command returns all the data available in the database concerning -the logged-in user ("Me"). The returned value takes the form of -a keyed list: see the <B>addressbook record</B> command for a description -of this format. Keyed lists can be easily manipulated with the -<B>keylget</B> and <B>keylset</B> commands defined in the TclX extension.<P><H4><A NAME="M12"></A>addressbook groups ?-ids? ?-ingroup <I>groupID</I>?</H4> +contain an image associated to the record.<P><H4><A NAME="M11"></A>addressbook getme ?<I>-id</I>?</H4> +This command returns the ID or the data corresponding to the logged-in user +("Me"). If the <I>-id</I> option is specified, it returns the unique ID of +the logged-in user. Otherwise the returned value takes the form of a keyed +list: see the <B>addressbook record</B> command for a description of this +format. Keyed lists can be easily manipulated with the <B>keylget</B> and +<B>keylset</B> commands defined in the TclX extension.<P><H4><A NAME="M12"></A>addressbook groups ?-ids? ?-ingroup <I>groupID</I>?</H4> This command returns a list of all the existing group records: if no option is specified, it is a list whose elements are sublists made of two elements. The first element is the unique ID associated with the group and the second is its name. If the <I>-ids</I> argument is specified, the returned list will contain only the unique IDs of the groups. If the <I>-ingroup</I> option is specified, only the subgroups contained in the group -with ID <I>groupID</I> will be returned.<P><H4><A NAME="M13"></A>addressbook image <I>personID</I> ?<I>imageData</I>?</H4> +with ID <I>groupID</I> will be returned.<P><H4><A NAME="M13"></A>addressbook identifier <I>personID</I> <I>groupID</I> <I>propName</I> ?<I>label</I>?</H4> +This command lets you get or set the distribution identifier for a +multi-value list property of a person in a group. +<P> Used without a <I>label</I> argument, this will return the +distribution identifier for the person <I>personID</I> belonging to the +group <I>groupID</I> concerning property <I>propName</I> if it was set, +otherwise the property¹s primary identifier. Property <I>propName</I> must +be a multi-value list property +<P> If the <I>label</I> argument is specified, this will assign a +specific distribution identifier for the person¹s multi-value list property +so that the group can be used as a distribution list (a mailing list for +instance, in the case of an email property). This value must be a label +used by the multi-value list (such as <I>home</I> for an <I>address</I> +property). If <I>label</I> is an empty string, this command resets the +distribution identifier to its default, i-e the multi-value list¹s primary +identifier.<P><H4><A NAME="M14"></A>addressbook image <I>personID</I> ?<I>imageData</I>?</H4> If no <I>imageData</I> argument is specified, this command returns the custom image associated with the record corresponding to the unique ID <I>personID</I>. The returned bytes are binary data. If no image exists, it raises an error. If an <I>imageData</I> argument is specified, it should contain valid binary data defining an image which will be associated the -record with unique ID <I>personID</I>.<P><H4><A NAME="M14"></A>addressbook import <I>vCardData</I></H4> +record with unique ID <I>personID</I>.<P><H4><A NAME="M15"></A>addressbook import <I>vCardData</I></H4> This command imports data in VCard format. The data specified by the <I>vCardData</I> argument must be valid data in VCard format: a new record is created in the database corresponding to the information contained in the -VCard. Note that the data can be binary if the VCard contains an image.<P><H4><A NAME="M15"></A>addressbook parents ?-ids? <I>recordID</I></H4> +VCard. Note that the data can be binary if the VCard contains an image.<P><H4><A NAME="M16"></A>addressbook parents ?-ids? <I>recordID</I></H4> This command returns a list of all the groups the record with unique ID <I>recordID</I> belongs to. The elements of this list are sublists made of one or two items: the unique ID and, possibly, the name of the record if this field exists. If the <I>-ids</I> option is specified, only IDs are -returned. <P><H4><A NAME="M16"></A>addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</H4> +returned. <P><H4><A NAME="M17"></A>addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</H4> This command returns a list of all the existing person records: if no option is specified, it is a list whose elements are sublists made of one or two items: the unique ID and, possibly, the name of the record if this field exists. If the <I>-ids</I> argument is specified, the returned list will contain only the unique IDs. If the <I>-ingroup</I> option is specified, only the members belonging to the group with ID <I>groupID</I> -will be returned.<P><H4><A NAME="M17"></A>addressbook property names (-groups | -persons)</H4> +will be returned.<P><H4><A NAME="M18"></A>addressbook property names (-groups | -persons)</H4> This command returns a list of all the properties defined in the database for group or person records. New properties can be created or removed with -the <B>addressbook property add</B> and <B>addressbook property remove</B> commands.<P><H4><A NAME="M18"></A>addressbook property type (-groups | -persons) <I>propName</I></H4> +the <B>addressbook property add</B> and <B>addressbook property remove</B> commands.<P><H4><A NAME="M19"></A>addressbook property type (-groups | -persons) <I>propName</I></H4> This command returns the type of the property specified by the <I>propName</I> argument. The returned type is one of the values listed with the <B>addressbook property add</B> command below -or <I>Unknown</I>. <P><H4><A NAME="M19"></A>addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></H4> +or <I>Unknown</I>. <P><H4><A NAME="M20"></A>addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></H4> This command lets you add a new property to the database, either for person or for group records. The name of the new property is specified by the <I>propName</I> argument: it must be unique. One can get the list of all the @@ -127,11 +144,18 @@ The type of the property is specified by the <I>propType</I> argument. This argument can have one of the following values: <I>Array, Data, Date, Dictionary, Integer, Real, String, MultiArray, MultiData, MultiDate, -MultiDictionary, MultiInteger, MultiReal, MultiString.</I><P><H4><A NAME="M20"></A>addressbook property remove (-groups | -persons) <I>propName</I></H4> +MultiDictionary, MultiInteger, MultiReal, MultiString.</I><P><H4><A NAME="M21"></A>addressbook property remove (-groups | -persons | recordID) <I>propName</I></H4> This command lets you remove a property from the database, either for person or for group records. The name of the property is specified in the -<I>propName</I> argument. One can get the list of all the existing -properties with the <B>addressbook property names</B> command.<P><H4><A NAME="M21"></A>addressbook record <I>recordID</I></H4> +<I>propName</I> argument. If the third argument is either <B>-groups</B> or +<B>-persons</B>, the command should remove the given property from all +the records of this type in the Address Book database and return the +number of properties successfully removed. Otherwise the third +argument should be the record ID of a particular person or group: the +property is removed for this record only and the command returns an +empty string. +<P> One can get the list of all the existing +properties with the <B>addressbook property names</B> command.<P><H4><A NAME="M22"></A>addressbook record <I>recordID</I></H4> This command returns all the data available in the database concerning the record with unique ID <I>recordID</I>. The returned value takes the form of a keyed list. @@ -161,16 +185,16 @@ 00:00:00 CET 1970". <P> Note that keyed lists can be easily manipulated using the <B>keylget</B> and <B>keylset</B> commands defined in the TclX -extension.<P><H4><A NAME="M22"></A>addressbook remove <I>recordID</I> <I>groupID</I></H4> +extension.<P><H4><A NAME="M23"></A>addressbook remove <I>recordID</I> <I>groupID</I></H4> This command lets you remove an already existing item (person or group) designated by its unique ID <I>recordID</I> from the group with ID -<I>groupID</I>.<P><H4><A NAME="M23"></A>addressbook save</H4> +<I>groupID</I>.<P><H4><A NAME="M24"></A>addressbook save</H4> This command lets you save the changes made in the database. Commands such as <B>addressbook set</B>, <B>addressbook create</B> or <B>addressbook delete</B> modify the data in memory: to make the changes definitive in the database, one must call explicitely the <B>addressbook save</B> command. To check whether there has been changes in the database, use the -<B>addressbook changed</B> command.<P><H4><A NAME="M24"></A>addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></H4> +<B>addressbook changed</B> command.<P><H4><A NAME="M25"></A>addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></H4> This command returns all the records corresponding to the criterion described by the last three arguments: <UL> @@ -226,16 +250,16 @@ that no distinction be made between uppercase and lowercase letters. <P> To get a list of all possible properties, use the <B>addressbook property names</B> command. To know the type of a particular property, use -the <B>addressbook property type</B> command.<P><H4><A NAME="M25"></A>addressbook set <I>recordID propertyName</I> ?<I>value</I>?</H4> +the <B>addressbook property type</B> command.<P><H4><A NAME="M26"></A>addressbook set <I>recordID propertyName</I> ?<I>value</I>?</H4> This command lets you get or set the value of a particular property for the record with unique ID <I>recordID</I>. If the <I>value</I> argument is not specified, it returns the current value of the property specified in the <I>propertyName</I> argument. If <I>value</I> is specified, the property <I>propertyName</I> will be set to this value. See the <B>addressbook record</B> command for a description of the format used for the -various kinds of properties.<P><H4><A NAME="M26"></A>addressbook type <I>recordID</I></H4> +various kinds of properties.<P><H4><A NAME="M27"></A>addressbook type <I>recordID</I></H4> This command returns the type (<I>ABPerson</I> or <I>ABGroup</I>) of the record with -unique ID <I>recordID</I>.<P><H2><A NAME="M27"></A>INSTALLATION</H2> +unique ID <I>recordID</I>.<P><H2><A NAME="M28"></A>INSTALLATION</H2> The extension is made of two files: the dynamic library (called addressbook1.0.dylib in version 1.0) and a file pkgIndex.tcl necessary for Tcl to be able to locate the extension upon request. Both files are @@ -245,18 +269,18 @@ <B>auto_path</B> Tcl variable. If you use the extension within the AlphaX editor (version 8.0b11 or greater), you can also install it in the <I>Tclextensions</I> folder which is located at the same level as the -application. <P><H2><A NAME="M28"></A>VERSION HISTORY</H2> +application. <P><H2><A NAME="M29"></A>VERSION HISTORY</H2> <UL> <LI> 1.0b1 -- 2004/01/25 -- First public release. <LI> 1.1b1 -- 2004/08/01 -- New commands "add" and "remove". Modified "delete" command. -</UL><P><H2><A NAME="M29"></A>REQUIREMENTS AND PORTABILITY</H2> +</UL><P><H2><A NAME="M30"></A>REQUIREMENTS AND PORTABILITY</H2> This extension is only useful on Macintosh platforms. Version 10.2 or greater of the system is required: the AddressBook framework was introduced -in version 10.2 of the System (aka Jaguar).<P><H2><A NAME="M30"></A>KNOW ISSUES</H2> +in version 10.2 of the System (aka Jaguar).<P><H2><A NAME="M31"></A>KNOW ISSUES</H2> Tcladdressbook was written by Bernard Desgraupes. Please e-mail any bug or problem you encounter: -<A HREF="mailto:bde...@us...">bde...@us...</A><P><H2><A NAME="M31"></A>SOURCE CODE</H2> +<A HREF="mailto:bde...@us...">bde...@us...</A><P><H2><A NAME="M32"></A>SOURCE CODE</H2> Tcladdressbook is an Open Source Project. Its source code is public and can be found on the SourceForge site at the following address: <P> <A HREF="http://sourceforge.net/projects/tcladdressbook">http://sourceforge.net/projects/tcladdressbook</A><P><P> Tcladdressbook binary releases are available at @@ -265,17 +289,17 @@ <P> <A HREF="http://webperso.easyconnect.fr/bdesgraupes/tcl.html">http://webperso.easyconnect.fr/bdesgraupes/tcl.html</A><P><P> The code is under CVS control. You can retrieve the latest stage of development using any CVS client. See instructions at: <P> <A HREF="http://sourceforge.net/cvs/?group_id=96169">http://sourceforge.net/cvs/?group_id=96169</A><P><P> You can also browse the cvs repository online at -<P> <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook</A> <P><H2><A NAME="M32"></A>CONTRIBUTIONS</H2> +<P> <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook</A> <P><H2><A NAME="M33"></A>CONTRIBUTIONS</H2> Code contributions (Tcl scripts making use of the Tcladdressbook extension) are very welcome. There is a "Contribs" directory in the Tcladdressbook project on SourceForge for code contributions. They must be free software, distributed under an Open Source license acceptable by the SourceForge site -(for instance, the same licensing terms as the Tcl language itself).<P><H2><A NAME="M33"></A>LICENSE AND DISCLAIMER</H2> +(for instance, the same licensing terms as the Tcl language itself).<P><H2><A NAME="M34"></A>LICENSE AND DISCLAIMER</H2> This software is free software and distributed under the same licensing terms -as the Tcl language itself. See license.terms in the Tcl distribution.<P><P> © Copyright Bernard Desgraupes 2003-2004<P><H2><A NAME="M34"></A>SEE ALSO</H2> +as the Tcl language itself. See license.terms in the Tcl distribution.<P><P> © Copyright Bernard Desgraupes 2003-2004<P><H2><A NAME="M35"></A>SEE ALSO</H2> See the TclX extension for keyed lists: TclX(n). See the Mk4Tcl extension for -commands to open directly the database file.<P><H2><A NAME="M35"></A>KEYWORDS</H2> +commands to open directly the database file.<P><H2><A NAME="M36"></A>KEYWORDS</H2> Address book, data base.<P><HR> -<P> Last updated 2004-07-29 01:08:28<P> +<P> Last updated 2004-07-29 14:00:56<P> </BODY> </HTML> \ No newline at end of file |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:32:35
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5724/Help Modified Files: TclAddressBookHelp.aida Log Message: Documents new 1.1b1 commands Index: TclAddressBookHelp.aida =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.aida,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- TclAddressBookHelp.aida 28 Jul 2004 23:11:30 -0000 1.13 +++ TclAddressBookHelp.aida 29 Jul 2004 13:32:27 -0000 1.14 @@ -83,12 +83,13 @@ a VCard. The result should be considered as binary data since it can contain an image associated to the record. -((s3 addressbook getme -This command returns all the data available in the database concerning -the logged-in user ("Me"). The returned value takes the form of -a keyed list: see the ((b addressbook record b)) command for a description -of this format. Keyed lists can be easily manipulated with the -((b keylget b)) and ((b keylset b)) commands defined in the TclX extension. +((s3 addressbook getme ?((i -id i))? +This command returns the ID or the data corresponding to the logged-in user +("Me"). If the ((i -id i)) option is specified, it returns the unique ID of +the logged-in user. Otherwise the returned value takes the form of a keyed +list: see the ((b addressbook record b)) command for a description of this +format. Keyed lists can be easily manipulated with the ((b keylget b)) and +((b keylset b)) commands defined in the TclX extension. ((s3 addressbook groups ?-ids? ?-ingroup ((i groupID i))? This command returns a list of all the existing group records: if no option @@ -99,6 +100,23 @@ ((i -ingroup i)) option is specified, only the subgroups contained in the group with ID ((i groupID i)) will be returned. +((s3 addressbook identifier ((i personID i)) ((i groupID i)) ((i propName i)) ?((i label i))? +This command lets you get or set the distribution identifier for a +multi-value list property of a person in a group. +((nl Used without a ((i label i)) argument, this will return the +distribution identifier for the person ((i personID i)) belonging to the +group ((i groupID i)) concerning property ((i propName i)) if it was set, +otherwise the property¹s primary identifier. Property ((i propName i)) must +be a multi-value list property +((nl If the ((i label i)) argument is specified, this will assign a +specific distribution identifier for the person¹s multi-value list property +so that the group can be used as a distribution list (a mailing list for +instance, in the case of an email property). This value must be a label +used by the multi-value list (such as ((i home i)) for an ((i address i)) +property). If ((i label i)) is an empty string, this command resets the +distribution identifier to its default, i-e the multi-value list¹s primary +identifier. + ((s3 addressbook image ((i personID i)) ?((i imageData i))? If no ((i imageData i)) argument is specified, this command returns the custom image associated with the record corresponding to the unique ID @@ -150,10 +168,17 @@ Dictionary, Integer, Real, String, MultiArray, MultiData, MultiDate, MultiDictionary, MultiInteger, MultiReal, MultiString. i)) -((s3 addressbook property remove (-groups | -persons) ((i propName i)) +((s3 addressbook property remove (-groups | -persons | recordID) ((i propName i)) This command lets you remove a property from the database, either for person or for group records. The name of the property is specified in the -((i propName i)) argument. One can get the list of all the existing +((i propName i)) argument. If the third argument is either ((b -groups b)) or +((b -persons b)), the command should remove the given property from all +the records of this type in the Address Book database and return the +number of properties successfully removed. Otherwise the third +argument should be the record ID of a particular person or group: the +property is removed for this record only and the command returns an +empty string. +((nl One can get the list of all the existing properties with the ((b addressbook property names b)) command. ((s3 addressbook record ((i recordID i)) |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:32:26
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5692/Help Modified Files: TclAddressBookHelp Log Message: Documents new 1.1b1 commands Index: TclAddressBookHelp =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- TclAddressBookHelp 28 Jul 2004 23:11:06 -0000 1.14 +++ TclAddressBookHelp 29 Jul 2004 13:32:18 -0000 1.15 @@ -18,8 +18,9 @@ addressbook create (group | person) name ?-ingroup groupID? addressbook delete recordID addressbook export personID - addressbook getme + addressbook getme ?-id? addressbook groups ?-ids? ?-ingroup groupID? + addressbook identifier personID groupID propName ?label? addressbook image personID ?imageData? addressbook import vCardData addressbook parents ?-ids? recordID @@ -27,7 +28,7 @@ addressbook property names (-groups | -persons) addressbook property type (-groups | -persons) propName addressbook property add (-groups | -persons) propName propType - addressbook property remove (-groups | -persons) propName + addressbook property remove (-groups | -persons | recordID) propName addressbook record recordID addressbook remove recordID groupID addressbook save @@ -101,12 +102,13 @@ a VCard. The result should be considered as binary data since it can contain an image associated to the record. - addressbook getme -This command returns all the data available in the database concerning -the logged-in user ("Me"). The returned value takes the form of -a keyed list: see the addressbook record command for a description -of this format. Keyed lists can be easily manipulated with the -keylget and keylset commands defined in the TclX extension. + addressbook getme ?-id? +This command returns the ID or the data corresponding to the logged-in user +("Me"). If the -id option is specified, it returns the unique ID of +the logged-in user. Otherwise the returned value takes the form of a keyed +list: see the addressbook record command for a description of this +format. Keyed lists can be easily manipulated with the keylget and +keylset commands defined in the TclX extension. addressbook groups ?-ids? ?-ingroup groupID? This command returns a list of all the existing group records: if no option @@ -117,6 +119,23 @@ -ingroup option is specified, only the subgroups contained in the group with ID groupID will be returned. + addressbook identifier personID groupID propName ?label? +This command lets you get or set the distribution identifier for a +multi-value list property of a person in a group. + Used without a label argument, this will return the +distribution identifier for the person personID belonging to the +group groupID concerning property propName if it was set, +otherwise the property¹s primary identifier. Property propName must +be a multi-value list property + If the label argument is specified, this will assign a +specific distribution identifier for the person¹s multi-value list property +so that the group can be used as a distribution list (a mailing list for +instance, in the case of an email property). This value must be a label +used by the multi-value list (such as home for an address +property). If label is an empty string, this command resets the +distribution identifier to its default, i-e the multi-value list¹s primary +identifier. + addressbook image personID ?imageData? If no imageData argument is specified, this command returns the custom image associated with the record corresponding to the unique ID @@ -168,10 +187,17 @@ Dictionary, Integer, Real, String, MultiArray, MultiData, MultiDate, MultiDictionary, MultiInteger, MultiReal, MultiString. - addressbook property remove (-groups | -persons) propName + addressbook property remove (-groups | -persons | recordID) propName This command lets you remove a property from the database, either for person or for group records. The name of the property is specified in the -propName argument. One can get the list of all the existing +propName argument. If the third argument is either -groups or +-persons, the command should remove the given property from all +the records of this type in the Address Book database and return the +number of properties successfully removed. Otherwise the third +argument should be the record ID of a particular person or group: the +property is removed for this record only and the command returns an +empty string. + One can get the list of all the existing properties with the addressbook property names command. addressbook record recordID @@ -365,7 +391,7 @@ ---------------------------------------------------------------------- - Last updated 2004-07-29 01:09:25 + Last updated 2004-07-29 15:28:58 |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:32:17
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5650/Help Modified Files: tcladdressbook.n Log Message: Documents new 1.1b1 commands Index: tcladdressbook.n =================================================================== RCS file: /cvsroot/tcladdressbook/Help/tcladdressbook.n,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- tcladdressbook.n 28 Jul 2004 23:10:57 -0000 1.4 +++ tcladdressbook.n 29 Jul 2004 13:32:09 -0000 1.5 @@ -56,13 +56,14 @@ This command lets you export the record with unique ID \fI personID\fP as a VCard. The result should be considered as binary data since it can contain an image associated to the record. -.SS addressbook getme +.SS addressbook getme ?\fI -id\fP? .PP -This command returns all the data available in the database concerning -the logged-in user ("Me"). The returned value takes the form of -a keyed list: see the \fBaddressbook record\fP command for a description -of this format. Keyed lists can be easily manipulated with the -\fBkeylget\fP and \fBkeylset\fP commands defined in the TclX extension. +This command returns the ID or the data corresponding to the logged-in user +("Me"). If the \fI -id\fP option is specified, it returns the unique ID of +the logged-in user. Otherwise the returned value takes the form of a keyed +list: see the \fBaddressbook record\fP command for a description of this +format. Keyed lists can be easily manipulated with the \fBkeylget\fP and +\fBkeylset\fP commands defined in the TclX extension. .SS addressbook groups ?-ids? ?-ingroup \fI groupID\fP? .PP This command returns a list of all the existing group records: if no option @@ -72,6 +73,25 @@ returned list will contain only the unique IDs of the groups. If the \fI -ingroup\fP option is specified, only the subgroups contained in the group with ID \fI groupID\fP will be returned. +.SS addressbook identifier \fI personID\fP \fI groupID\fP \fI propName\fP ?\fI label\fP? +.PP +This command lets you get or set the distribution identifier for a +multi-value list property of a person in a group. +.PP + Used without a \fI label\fP argument, this will return the +distribution identifier for the person \fI personID\fP belonging to the +group \fI groupID\fP concerning property \fI propName\fP if it was set, +otherwise the property¹s primary identifier. Property \fI propName\fP must +be a multi-value list property +.PP + If the \fI label\fP argument is specified, this will assign a +specific distribution identifier for the person¹s multi-value list property +so that the group can be used as a distribution list (a mailing list for +instance, in the case of an email property). This value must be a label +used by the multi-value list (such as \fI home\fP for an \fI address\fP +property). If \fI label\fP is an empty string, this command resets the +distribution identifier to its default, i-e the multi-value list¹s primary +identifier. .SS addressbook image \fI personID\fP ?\fI imageData\fP? .PP If no \fI imageData\fP argument is specified, this command returns the @@ -123,11 +143,19 @@ This argument can have one of the following values: \fI Array, Data, Date, Dictionary, Integer, Real, String, MultiArray, MultiData, MultiDate, MultiDictionary, MultiInteger, MultiReal, MultiString.\fP -.SS addressbook property remove (-groups | -persons) \fI propName\fP +.SS addressbook property remove (-groups | -persons | recordID) \fI propName\fP .PP This command lets you remove a property from the database, either for person or for group records. The name of the property is specified in the -\fI propName\fP argument. One can get the list of all the existing +\fI propName\fP argument. If the third argument is either \fB-groups\fP or +\fB-persons\fP, the command should remove the given property from all +the records of this type in the Address Book database and return the +number of properties successfully removed. Otherwise the third +argument should be the record ID of a particular person or group: the +property is removed for this record only and the command returns an +empty string. +.PP + One can get the list of all the existing properties with the \fBaddressbook property names\fP command. .SS addressbook record \fI recordID\fP .PP |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:31:54
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5549/Help Modified Files: TclAB_QuickStart.html Log Message: New 1.1b1 commands Index: TclAB_QuickStart.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAB_QuickStart.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TclAB_QuickStart.html 26 Jan 2004 23:07:23 -0000 1.6 +++ TclAB_QuickStart.html 29 Jul 2004 13:31:45 -0000 1.7 @@ -9,7 +9,7 @@ <P> <A HREF="TclAB.html">Home Page</A> | <A HREF="http://sourceforge.net/projects/tcladdressbook"> Project Page at SourceForge</A><P><HR><BLOCKQUOTE><P><I> This file is a tutorial that demonstrates the [addressbook] command defined by the Tcladdressbook extension for Tcl. It documents -version 1.0b1. All the Tcl instructions in the sections +version 1.1b1. All the Tcl instructions in the sections below are very short one-line commands which you can try in any Tcl shell, like tclsh for instance. <P> For a detailed and complete description of the syntax of each subcommand, @@ -25,19 +25,21 @@ <UL><LI><A HREF="#M5">The [getme] subcommand</A></UL> <UL><LI><A HREF="#M6">The [record] subcommand</A></UL> <UL><LI><A HREF="#M7">The [type] subcommand</A></UL> -<UL><LI><A HREF="#M8">The [remove] subcommand</A></UL> -<UL><LI><A HREF="#M9">The [parents] subcommand</A></UL> -<UL><LI><A HREF="#M10">The [create] subcommand</A></UL> -<UL><LI><A HREF="#M11">The [property names] subcommand</A></UL> -<UL><LI><A HREF="#M12">The [property type] subcommand</A></UL> -<UL><LI><A HREF="#M13">The [property add] subcommand</A></UL> -<UL><LI><A HREF="#M14">The [property remove] subcommand</A></UL> -<UL><LI><A HREF="#M15">The [export] subcommand</A></UL> -<UL><LI><A HREF="#M16">The [import] subcommand</A></UL> -<UL><LI><A HREF="#M17">The [image] subcommand</A></UL> -<UL><LI><A HREF="#M18">The [set] subcommand</A></UL> -<UL><LI><A HREF="#M19">The [search] subcommand</A></UL> -<LI><A HREF="#M20">Using keyed lists</A> +<UL><LI><A HREF="#M8">The [delete] subcommand</A></UL> +<UL><LI><A HREF="#M9">The [add] subcommand</A></UL> +<UL><LI><A HREF="#M10">The [remove] subcommand</A></UL> +<UL><LI><A HREF="#M11">The [parents] subcommand</A></UL> +<UL><LI><A HREF="#M12">The [create] subcommand</A></UL> +<UL><LI><A HREF="#M13">The [property names] subcommand</A></UL> +<UL><LI><A HREF="#M14">The [property type] subcommand</A></UL> +<UL><LI><A HREF="#M15">The [property add] subcommand</A></UL> +<UL><LI><A HREF="#M16">The [property remove] subcommand</A></UL> +<UL><LI><A HREF="#M17">The [export] subcommand</A></UL> +<UL><LI><A HREF="#M18">The [import] subcommand</A></UL> +<UL><LI><A HREF="#M19">The [image] subcommand</A></UL> +<UL><LI><A HREF="#M20">The [set] subcommand</A></UL> +<UL><LI><A HREF="#M21">The [search] subcommand</A></UL> +<LI><A HREF="#M22">Using keyed lists</A> </UL> First load the extension like this <PRE> @@ -81,7 +83,12 @@ </PRE> The value of <I>myrecord</I> is a keyed list. One can use the usual Tcl list commands to parse this value or special commands defined in the TclX -extension (see section <A HREF="#ukl">Using keyed lists</A> below).<P><H3><A NAME="M6"></A>The [record] subcommand</H3> +extension (see section <A HREF="#ukl">Using keyed lists</A> below). +<P> The <I>getme</I> command can also be used with an <I>-id</I> option. +In that case the unique ID of the "Me" record is returned: +<PRE> + set myID [addressbook getme -id] +</PRE><P><H3><A NAME="M6"></A>The [record] subcommand</H3> Store the ID of the first record in the variable <I>theid</I> <PRE> set theid [lindex [addressbook persons -ids] 0] @@ -102,7 +109,7 @@ to the ID <I>$theid</I> <PRE> addressbook type $theid -</PRE><P><H3><A NAME="M8"></A>The [remove] subcommand</H3> +</PRE><P><H3><A NAME="M8"></A>The [delete] subcommand</H3> Remove from the database the record corresponding to the ID <I>$theid</I> <PRE> addressbook delete $theid @@ -114,14 +121,22 @@ Save the changes to make them permanent <PRE> addressbook save -</PRE><P>Remove from a specific group the record corresponding to the ID <I>$theid</I>: -it is removed as member of this subgroup but will be removed from the -database only if it does not belong to other groups. +</PRE><P><H3><A NAME="M9"></A>The [add] subcommand</H3> +Add to a specific group the record corresponding to the ID <I>$theid</I>: +this can be a person as well as a group (which would then become a +subgroup of the group to which it is added). <PRE> set groupid [lindex [addressbook groups -ids] 0] set theid [lindex [addressbook persons -ids] 0] - addressbook delete $theid -fromgroup $groupid -</PRE><P><H3><A NAME="M9"></A>The [parents] subcommand</H3> + addressbook add $theid $groupid +</PRE><P><H3><A NAME="M10"></A>The [remove] subcommand</H3> +Remove from a specific group the record corresponding to the ID <I>$theid</I>: +this can be a person as well as a group. +<PRE> + set groupid [lindex [addressbook groups -ids] 0] + set theid [lindex [addressbook persons -ids] 0] + addressbook remove $theid $groupid +</PRE><P><H3><A NAME="M11"></A>The [parents] subcommand</H3> List the parents of a person record (the various groups it belongs to). <PRE> set theid [lindex [addressbook persons -ids] 0] @@ -130,7 +145,7 @@ List the parents of a person record (only ID) <PRE> addressbook parents -ids $theid -</PRE><P>One can also find the parents of a group using this command.<P><H3><A NAME="M10"></A>The [create] subcommand</H3> +</PRE><P>One can also find the parents of a group using this command.<P><H3><A NAME="M12"></A>The [create] subcommand</H3> One can create either a group's or a person's record. The third argument will be the "name" of the new record, that is to say the name of the new group or the last name of the new person respectively. The command returns @@ -145,37 +160,47 @@ set grpid [lindex [addressbook groups -ids] 0] set subgrpid [addressbook create group Composers -ingroup $grpid] addressbook create person Beethoven -ingroup $subgrpid -</PRE><P><H3><A NAME="M11"></A>The [property names] subcommand</H3> +</PRE><P><H3><A NAME="M13"></A>The [property names] subcommand</H3> Get the list of all existing properties for groups or for persons <PRE> addressbook property names -groups addressbook property names -persons -</PRE><P><H3><A NAME="M12"></A>The [property type] subcommand</H3> +</PRE><P><H3><A NAME="M14"></A>The [property type] subcommand</H3> Get the type of a particular property <PRE> addressbook property type -groups UID addressbook property type -persons Address </PRE> For the two examples above, the result is respectively -<I>String</I> and <I>MultiDictionary</I>.<P><H3><A NAME="M13"></A>The [property add] subcommand</H3> +<I>String</I> and <I>MultiDictionary</I>.<P><H3><A NAME="M15"></A>The [property add] subcommand</H3> Add a new person's property called <I>Instrument</I> with type <I>String</I> <PRE> addressbook property add -persons Instrument String </PRE><P>Add a new group's property called <I>Meeting</I> with type <I>Date</I> <PRE> addressbook property add -groups Meeting Date -</PRE><P><H3><A NAME="M14"></A>The [property remove] subcommand</H3> -Remove the properties created above: +</PRE><P><H3><A NAME="M16"></A>The [property remove] subcommand</H3> +The third argument of this command can be either a record ID or the +-persons and -groups keywords. If it is the former, the property is removed +from the specified record, otherwise it is removed from all the records of +this type and the return value is now the number of properties successfully +removed. +<PRE> + set theid [addressbook getme -id] + addressbook set $theid MaidenName Violet + addressbook save + addressbook property remove $theid MaidenName +</PRE><P>Remove the properties created above: <PRE> addressbook property remove -persons Instrument addressbook property remove -groups Meeting -</PRE><P><H3><A NAME="M15"></A>The [export] subcommand</H3> +</PRE><P><H3><A NAME="M17"></A>The [export] subcommand</H3> Create a VCard corresponding to a particular record: <PRE> set theid [lindex [addressbook persons -ids] 0] set vcardData [addressbook export $theid] </PRE> -The data returned is binary. You can store it in a file for instance.<P><H3><A NAME="M16"></A>The [import] subcommand</H3> +The data returned is binary. You can store it in a file for instance.<P><H3><A NAME="M18"></A>The [import] subcommand</H3> Import in the database some information stored in a .vcf file. A new record containing this info, is created in the database: <PRE> @@ -184,14 +209,14 @@ set vcard [read $fid] close $fid addressbook import $vcard -</PRE><P><H3><A NAME="M17"></A>The [image] subcommand</H3> +</PRE><P><H3><A NAME="M19"></A>The [image] subcommand</H3> Get the custom image corresponding to a particular record: <PRE> set theid [lindex [addressbook persons -ids] 0] set img [addressbook image $theid] </PRE> The data returned is binary. You can store it in a file for instance. -An error is raised if there is no custom image for this record.<P><H3><A NAME="M18"></A>The [set] subcommand</H3> +An error is raised if there is no custom image for this record.<P><H3><A NAME="M20"></A>The [set] subcommand</H3> This command lets you get or set the value of a particular field. For instance, to get the first name, dates and address fields of the first record: <PRE> @@ -228,7 +253,7 @@ <PRE> addressbook set $theid Address [list [list Home [list {CountryCode fr} {City Paris} {Country France} {ZIP 75001} {Street "1, avenue de l'Opéra"}]]] </PRE> -</UL><P><H3><A NAME="M19"></A>The [search] subcommand</H3> +</UL><P><H3><A NAME="M21"></A>The [search] subcommand</H3> This command can be used to report the IDs of the records corresponding to a single criterion. The criterion is expressed by a three elements list: the first element is the name of a property, the second is a comparison operator and @@ -272,8 +297,8 @@ addressbook search -persons -nocase Address >= {"" {"" abc}} </PRE> </UL><P><A NAME="ukl"></A> -<H2><A NAME="M20"></A>Using keyed lists</H2> -Keyed lists can be easily manipulated using the <B> keylget </B> and +<H2><A NAME="M22"></A>Using keyed lists</H2> +Keyed lists can be easily manipulated using the <B>keylget</B> and <B>keylset</B> commands defined by the TclX extension. For instance, if a record has been stored in some variable <I>myrecord</I>, one can extract various fields like this: @@ -292,6 +317,6 @@ keylget grp GroupName clock format [keylget grp Modification] </PRE><P><HR> -<P> Last updated 2004-01-24 08:09:04<P> +<P> Last updated 2004-07-29 15:11:20<P> </BODY> </HTML> \ No newline at end of file |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:31:45
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5493/Help Modified Files: TclAB_QuickStart.aida Log Message: New 1.1b1 commands Index: TclAB_QuickStart.aida =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAB_QuickStart.aida,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TclAB_QuickStart.aida 26 Jan 2004 23:07:07 -0000 1.6 +++ TclAB_QuickStart.aida 29 Jul 2004 13:31:36 -0000 1.7 @@ -6,7 +6,7 @@ :Author: Bernard Desgraupes <bde...@ea...> :Homepage: <http://webperso.easyconnect.fr/bdesgraupes/> :Created: 2003-12-14 18:26:47 -:Modified: 2004-01-23 22:03:14 +:Modified: 2004-07-29 01:35:42 :Keywords: Address book, data base @@ -86,6 +86,11 @@ The value of ((i myrecord i)) is a keyed list. One can use the usual Tcl list commands to parse this value or special commands defined in the TclX extension (see section ((rf ukl ))Using keyed lists rf)) below). +((nl The ((i getme i)) command can also be used with an ((i -id i)) option. +In that case the unique ID of the "Me" record is returned: +((| + set myID [addressbook getme -id] +|)) ((s2 The [record] subcommand @@ -99,7 +104,6 @@ set person [addressbook record $theid] |)) - Similarly with a group: store the ID of the first group in the variable ((i theid i)) ((| set theid [lindex [addressbook groups -ids] 0] @@ -118,7 +122,7 @@ |)) -((s2 The [remove] subcommand +((s2 The [delete] subcommand Remove from the database the record corresponding to the ID ((i $theid i)) ((| addressbook delete $theid @@ -132,13 +136,25 @@ addressbook save |)) + +((s2 The [add] subcommand +Add to a specific group the record corresponding to the ID ((i $theid i)): +this can be a person as well as a group (which would then become a +subgroup of the group to which it is added). +((| + set groupid [lindex [addressbook groups -ids] 0] + set theid [lindex [addressbook persons -ids] 0] + addressbook add $theid $groupid +|)) + + +((s2 The [remove] subcommand Remove from a specific group the record corresponding to the ID ((i $theid i)): -it is removed as member of this subgroup but will be removed from the -database only if it does not belong to other groups. +this can be a person as well as a group. ((| set groupid [lindex [addressbook groups -ids] 0] set theid [lindex [addressbook persons -ids] 0] - addressbook delete $theid -fromgroup $groupid + addressbook remove $theid $groupid |)) @@ -155,6 +171,7 @@ One can also find the parents of a group using this command. + ((s2 The [create] subcommand One can create either a group's or a person's record. The third argument will be the "name" of the new record, that is to say the name of the new @@ -190,6 +207,7 @@ For the two examples above, the result is respectively ((i String i)) and ((i MultiDictionary i)). + ((s2 The [property add] subcommand Add a new person's property called ((i Instrument i)) with type ((i String i)) ((| @@ -201,7 +219,20 @@ addressbook property add -groups Meeting Date |)) + ((s2 The [property remove] subcommand +The third argument of this command can be either a record ID or the +-persons and -groups keywords. If it is the former, the property is removed +from the specified record, otherwise it is removed from all the records of +this type and the return value is now the number of properties successfully +removed. +((| + set theid [addressbook getme -id] + addressbook set $theid MaidenName Violet + addressbook save + addressbook property remove $theid MaidenName +|)) + Remove the properties created above: ((| addressbook property remove -persons Instrument @@ -239,6 +270,7 @@ The data returned is binary. You can store it in a file for instance. An error is raised if there is no custom image for this record. + ((s2 The [set] subcommand This command lets you get or set the value of a particular field. For instance, to get the first name, dates and address fields of the first record: |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:31:01
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5331/Source Modified Files: Changes.Log Log Message: getme -id Index: Changes.Log =================================================================== RCS file: /cvsroot/tcladdressbook/Source/Changes.Log,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Changes.Log 28 Jul 2004 23:23:40 -0000 1.13 +++ Changes.Log 29 Jul 2004 13:30:52 -0000 1.14 @@ -7,8 +7,11 @@ to make it available in Tcl scripts, load it with the following instruction: package require addressbook +The main home page for the Tcladdressbook project is at <http://tcladdressbook.sourceforge.net/>. + This is an Open Source project. The source code for this extension can be found on the SourceForge site at: <http://sourceforge.net/projects/tcladdressbook> + Tcladdressbook binary releases are available at <http://sourceforge.net/project/showfiles.php?group_id=96169> or on my web page at <http://webperso.easyconnect.fr/bdesgraupes/tcl.html> @@ -21,7 +24,7 @@ <http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook> Please e-mail about any problems you might encounter: -<bde...@ea...> +<bde...@us...> This changes log is in reverse chronological order (from bottom to top). @@ -31,17 +34,27 @@ = 1.1b1 last update: ================================================================================ Added an [addressbook add] and an [addressbook remove] command to add -or remove an item (person or group) to or from a group. - Modified the [addressbook delete] command. It does not have an -optional argument anymore (this is replaced by [addressbook remove]). + or remove an item (person or group) to or from a group. + Modified the [addressbook delete] command: it does not have the + -ingroup optional argument anymore (this functionality is replaced + by [addressbook remove]). + Modified the [addressbook property remove] command: the third + argument can now also be a record ID so that the property is removed + only for this record. If the third argument is -persons or -groups, the + return value is now the number of properties successfully removed. + Added a new [addressbook identifier] command to get/set the distribution + identifier of a person¹s multi-value list property in a group. + The [addressbook getme] command now accepts an optional -id argument to return + the unique ID of the "Me" record. ================================================================================ -= 1.0b1 released last update: 2004-01-05 09:00:50 += 1.0b1 released last update: 2004-01-27 21:50:42 ================================================================================ Added a "Contribs" directory to the project on SourceForge for code contributions (Tcl scripts making use of the Tcladdressbook extension...). - Completed documentation and example files. + Completed documentation and example files. Html and Pdf files. + Added Unix man page. First public beta release. ================================================================================ |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:30:45
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5266/Source Modified Files: TclAddressBookUtils.c Log Message: Debugging return values Index: TclAddressBookUtils.c =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- TclAddressBookUtils.c 29 Jul 2004 09:12:14 -0000 1.14 +++ TclAddressBookUtils.c 29 Jul 2004 13:30:36 -0000 1.15 @@ -1037,7 +1037,7 @@ ABAddressBookRef ab; CFStringRef theKey, theValue; CFMutableDictionaryRef theDict; - int index, length, result; + int index, length, result = TCL_OK; int theInt; char * propName; @@ -1072,9 +1072,7 @@ Tcl_AppendStringsToObj(resultPtr, "Couldn't add property '", propName, "' to ", inRecordType ? "Person":"Group" , " records", (char *) NULL); result = TCL_ERROR; - } else { - result = TCL_OK; - } + } } else { Tcl_AppendStringsToObj(resultPtr, "CFCreate error", (char *) NULL); result = TCL_ERROR; @@ -1191,13 +1189,13 @@ ABAddressBookRef ab; CFStringRef theProp; CFMutableArrayRef theArray; - int length, result; + int length, num, result = TCL_OK; char * propName; Tcl_ResetResult(interp); if (objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "remove (-groups|-persons) propName"); + Tcl_WrongNumArgs(interp, 2, objv, "remove (-groups|-persons|recordID) propName"); return TCL_ERROR; } @@ -1209,23 +1207,39 @@ // Get the address book ab = ABGetSharedAddressBook(); - // Create a CFArray and store the property therein - theArray = CFArrayCreateMutable(NULL, 0, NULL); - CFArrayAppendValue(theArray, theProp); - CFRelease(theProp); - - // Remove the property from the Address Book - result = ABRemoveProperties(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType, theArray); - CFRelease(theArray); - if ( !result ) { - Tcl_AppendStringsToObj(resultPtr, "Couldn't remove property '", propName, - "' for ", inRecordType ? "Person":"Group" , " records", (char *) NULL); - result = TCL_ERROR; + if (inRecordType == rec_undefined) { + // The third argument was a record ID + CONST84 char * theUID; + CFStringRef theCFStr; + ABRecordRef theRecord; + + theUID = Tcl_GetStringFromObj(objv[3], &length); + theCFStr = CFStringCreateWithCString(NULL, theUID, NULL); + + // Find the record corresponding to the UID + theRecord = ABCopyRecordForUniqueId(ab, theCFStr); + CFRelease(theCFStr); + if (!ABRecordRemoveValue(theRecord, theProp)) { + Tcl_AppendStringsToObj(resultPtr, "Couldn't remove property '", propName, + "' from the record", (char *) NULL); + result = TCL_ERROR; + } + CFRelease(theRecord); } else { + // The third argument was -groups or -persons. + // Create a CFArray to store the property. + theArray = CFArrayCreateMutable(NULL, 0, NULL); + CFArrayAppendValue(theArray, theProp); + CFRelease(theProp); + + // Remove the property from all the records of this type in the Address Book + num = ABRemoveProperties(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType, theArray); + CFRelease(theArray); + Tcl_SetObjResult(interp, Tcl_NewIntObj(num)); result = TCL_OK; } } else { - Tcl_AppendStringsToObj(resultPtr, "CFStringCreateWithCString error", (char *) NULL); + Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for property", (char *) NULL); result = TCL_ERROR; } |
|
From: Bernard D. <bde...@us...> - 2004-07-29 13:30:34
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5166/Source Modified Files: TclAddressBook.c Log Message: Debugging return values Index: TclAddressBook.c =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- TclAddressBook.c 29 Jul 2004 09:11:34 -0000 1.26 +++ TclAddressBook.c 29 Jul 2004 13:30:21 -0000 1.27 @@ -286,7 +286,7 @@ Tcl_Obj *CONST objv[], /* Argument values. */ Tcl_Obj *resultPtr) /* Pointer to store the result. */ { - int kind, length, result; + int kind, length, result = TCL_OK, success; CONST84 char * groupID; CFStringRef strRef; ABAddressBookRef ab; @@ -303,9 +303,9 @@ // Second argument is a person or a group ID strRef = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(objv[2], &length), NULL); // Find the record corresponding to the UID - result = TclAB_RecordFromUID(ab, strRef, resultPtr, &objRecord); + success = TclAB_RecordFromUID(ab, strRef, resultPtr, &objRecord); CFRelease(strRef); - if (!result) {return TCL_ERROR;} + if (!success) {return TCL_ERROR;} // Third argument is a group ID groupID = Tcl_GetStringFromObj(objv[3], &length); @@ -707,8 +707,12 @@ { ABAddressBookRef ab; - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); + static CONST char *getmeSwitches[] = { + "-id", (char *) NULL + }; + + if (objc != 2 && objc != 3) { + Tcl_WrongNumArgs(interp, 2, objv, "?-id?"); return TCL_ERROR; } @@ -717,8 +721,22 @@ // Get the address book ab = ABGetSharedAddressBook(); - // Store the record's data in the result object - TclAB_GetAllValues(interp, ab, ABGetMe(ab), rec_person); + if (objc == 3) { + char theUID[256]; + CFStringRef uniqueId; + int index; + + if (Tcl_GetIndexFromObj(interp, objv[2], getmeSwitches, "option", 0, &index) != TCL_OK) { + return TCL_ERROR; + } + uniqueId = ABRecordCopyUniqueId(ABGetMe(ab)); + CFStringGetCString(uniqueId, theUID, sizeof(theUID), NULL); + CFRelease(uniqueId); + Tcl_SetObjResult(interp, Tcl_NewStringObj(theUID, strlen(theUID))); + } else { + // Store the record's data in the result object + TclAB_GetAllValues(interp, ab, ABGetMe(ab), rec_person); + } return TCL_OK; } @@ -808,25 +826,7 @@ thePersonUID = Tcl_GetStringFromObj(objv[2], &length); theGroupUID = Tcl_GetStringFromObj(objv[3], &length); - theProperty = Tcl_GetStringFromObj(objv[4], &length); - - if (objc == 6) { - theNewVal = Tcl_GetStringFromObj(objv[5], &length); - if (length == 0) { - valueRef = NULL; - } else { - valueRef = CFStringCreateWithCString(NULL, theNewVal, kCFStringEncodingUTF8); - } - setIt = true; - } - // Make CFString object for property - propertyRef = CFStringCreateWithCString(NULL, theProperty, kCFStringEncodingUTF8); - if (!propertyRef) { - Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for property", (char *) NULL); - return TCL_ERROR; - } - // Get the address book ab = ABGetSharedAddressBook(); @@ -837,10 +837,21 @@ // Check if third argument is a group and get the corresponding record if ( !TclAB_CheckItem(interp, ab, theGroupUID, "third", &groupRecord, rec_group) ) { + CFRelease(personRecord); + return TCL_ERROR; + } + + Tcl_IncrRefCount(objv[4]); + theProperty = Tcl_GetStringFromObj(objv[4], &length); + + // Make CFString object for property + propertyRef = CFStringCreateWithCString(NULL, theProperty, kCFStringEncodingUTF8); + if (!propertyRef) { + Tcl_AppendStringsToObj(resultPtr, "Problem getting CFString for property", (char *) NULL); result = TCL_ERROR; goto DONE; } - + // Find the property type (string, date, multivalue...) thePropType = ABTypeOfProperty(ab, kABPersonRecordType, propertyRef); if (thePropType == kABErrorInProperty) { @@ -851,6 +862,16 @@ goto DONE; } + if (objc == 6) { + theNewVal = Tcl_GetStringFromObj(objv[5], &length); + if (length == 0) { + valueRef = NULL; + } else { + valueRef = CFStringCreateWithCString(NULL, theNewVal, kCFStringEncodingUTF8); + } + setIt = true; + } + if (setIt) { // ABGroupSetDistributionIdentifier(groupRecord, personRecord, propertyRef, valueRef) // ABGroupSetDistributionIdentifier(groupRecord, personRecord, kABAddressProperty, kABAddressHomeLabel) @@ -883,6 +904,7 @@ CFRelease(propertyRef); DONE: + Tcl_DecrRefCount(objv[4]); CFRelease(groupRecord); CFRelease(personRecord); return result; @@ -1247,7 +1269,7 @@ Tcl_Obj *CONST objv[], /* Argument values. */ Tcl_Obj *resultPtr) /* Pointer to store the result. */ { - int result, index, kind; + int result = TCL_ERROR, index, kind; static CONST char *propSubcmdSwitches[] = { "add", "names", "remove", "type", (char *) NULL @@ -1274,7 +1296,13 @@ if (Tcl_GetIndexFromObj(interp, objv[3], propertySwitches, "option", 0, &kind) != TCL_OK) { - return TCL_ERROR; + if (index != TCLAB_PROPERTY_REMOVE) { + return TCL_ERROR; + } else { + // For the [remove] subcommand, the third argument + // can also be a record ID. Pass rec_undefined in that case. + kind = rec_undefined; + } } switch (index) { @@ -1394,7 +1422,7 @@ Tcl_Obj *CONST objv[], /* Argument values. */ Tcl_Obj *resultPtr) /* Pointer to store the result. */ { - int kind, length, result; + int kind, length, result = TCL_OK, success; CONST84 char * groupID; CFStringRef strRef; ABAddressBookRef ab; @@ -1411,9 +1439,9 @@ // Second argument is a person or a group ID strRef = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(objv[2], &length), NULL); // Find the record corresponding to the UID - result = TclAB_RecordFromUID(ab, strRef, resultPtr, &objRecord); + success = TclAB_RecordFromUID(ab, strRef, resultPtr, &objRecord); CFRelease(strRef); - if (!result) {return TCL_ERROR;} + if (!success) {return TCL_ERROR;} // Third argument is a group ID groupID = Tcl_GetStringFromObj(objv[3], &length); |
|
From: Bernard D. <bde...@us...> - 2004-07-29 09:12:31
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31396/Source Modified Files: TclAddressBookUtils.h Log Message: TclAB_CheckItem() function Index: TclAddressBookUtils.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- TclAddressBookUtils.h 28 Dec 2003 07:50:02 -0000 1.8 +++ TclAddressBookUtils.h 29 Jul 2004 09:12:23 -0000 1.9 @@ -1,13 +1,13 @@ /* * File : "TclAddressBookUtils.h" * Created: 2003-12-05 10:05:19 - * Last modification: 2003-12-09 10:29:16 + * Last modification: 2004-07-29 11:07:37 * Author: Bernard Desgraupes * e-mail: <bde...@ea...> * * Header file for TclAddressBookUtils.c * - * (c) Copyright : Bernard Desgraupes, 2003 + * (c) Copyright : Bernard Desgraupes, 2003-2004 * All rights reserved. * This software is free software with BSD licence. * Versions history: see the Changes.Log file. @@ -108,11 +108,12 @@ void TclAB_PutValueInResult(Tcl_Interp *interp, char * inPropName, char * inStr, Boolean allValues); -Boolean TclAB_CheckGroup(Tcl_Interp *interp, - ABAddressBookRef ab, - CONST84 char * inGroupUID, - CONST84 char * option, - ABRecordRef * outGroupRef); +Boolean TclAB_CheckItem(Tcl_Interp *interp, + ABAddressBookRef ab, + CONST84 char * inUID, + CONST84 char * option, + ABRecordRef * outItemRef, + int inRecordType); Boolean TclAB_RecordAndTypeFromUID(ABAddressBookRef ab, CFStringRef inUID, |