tcladdressbook-commits Mailing List for TclAddressBook (Page 12)
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: <bde...@us...> - 2003-12-09 09:06:12
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv16114/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
CreateCmd does not save anymore.
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- TclAddressBookUtils.c 9 Dec 2003 08:08:20 -0000 1.4
+++ TclAddressBookUtils.c 9 Dec 2003 09:06:08 -0000 1.5
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBookUtils.c"
* Created: 2003-12-05 10:08:03
- * Last modification: 2003-12-09 08:50:24
+ * Last modification: 2003-12-09 09:19:04
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -335,7 +335,7 @@
Boolean TclAB_SetValue(Tcl_Interp *interp, ABRecordRef theRecord, CFStringRef inProperty,
CONST84 char * inValue, ABPropertyType inPropType)
{
- CFStringRef theValue, subLabel, subKey, subValue;
+ CFStringRef theValue = NULL, subLabel, subKey, subValue;
ABMutableMultiValueRef multiValue;
CFMutableDictionaryRef theDict;
int j, k, listLen, subListLen, length, result = true;
@@ -894,18 +894,12 @@
Tcl_AppendStringsToObj(resultPtr, "Couldn't add the new record to the Address Book", (char *) NULL);
result = TCL_ERROR;
} else {
- // Save the Address Book
- if ( !ABSave(ab) ) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't save the Address Book", (char *) NULL);
- result = TCL_ERROR;
- } else {
- // Retrieve the UID for the newly created record
- uniqueId = ABRecordCopyUniqueId(theRecord);
- CFStringGetCString(uniqueId, theUID, sizeof(theUID), theEncoding);
- CFRelease(uniqueId);
- Tcl_AppendStringsToObj(resultPtr, theUID, (char *) NULL);
- result = TCL_OK;
- }
+ // Retrieve the UID for the newly created record
+ uniqueId = ABRecordCopyUniqueId(theRecord);
+ CFStringGetCString(uniqueId, theUID, sizeof(theUID), theEncoding);
+ CFRelease(uniqueId);
+ Tcl_AppendStringsToObj(resultPtr, theUID, (char *) NULL);
+ result = TCL_OK;
}
DONE:
|
|
From: <bde...@us...> - 2003-12-09 08:08:23
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv7644/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
Improved objc checks
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- TclAddressBookUtils.c 7 Dec 2003 16:43:15 -0000 1.3
+++ TclAddressBookUtils.c 9 Dec 2003 08:08:20 -0000 1.4
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBookUtils.c"
* Created: 2003-12-05 10:08:03
- * Last modification: 2003-12-07 16:58:34
+ * Last modification: 2003-12-09 08:50:24
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -919,12 +919,12 @@
*
* TclAB_PropertyAdd --
*
- * This function is invoked to process the [addressbook add property]
+ * This function is invoked to process the [addressbook property add]
* Tcl command.
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook add property (-groups|-persons) propName propType
+ * addressbook property add (-groups|-persons) propName propType
*
* Results:
* A standard Tcl result.
@@ -948,7 +948,6 @@
CFMutableDictionaryRef theDict;
int index, length, result;
int theInt;
- SInt32 theSInt32;
TextEncoding theEncoding = GetApplicationTextEncoding();
static CONST char *typeSwitches[] = {
@@ -983,7 +982,7 @@
Tcl_IncrRefCount(objv[4]);
- if (Tcl_GetIndexFromObj(interp, objv[5], typeSwitches, "property", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[5], typeSwitches, "type", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -1000,8 +999,9 @@
// Add the property to the Address Book
if ( !ABAddPropertiesAndTypes(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType, theDict) ) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't add new property for ",
- inRecordType ? "Person":"Group" , " records", (char *) NULL);
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't add property '",
+ Tcl_GetStringFromObj(objv[4], &length), "' to ",
+ inRecordType ? "Person":"Group" , " records", (char *) NULL);
result = TCL_ERROR;
} else {
result = TCL_OK;
@@ -1053,6 +1053,11 @@
int i, result;
ABAddressBookRef ab;
+ if (objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "names (-groups|-persons)");
+ return TCL_ERROR;
+ }
+
// Get the address book
ab = ABGetSharedAddressBook();
@@ -1091,12 +1096,12 @@
*
* TclAB_PropertyRemove --
*
- * This function is invoked to process the [addressbook remove property]
+ * This function is invoked to process the [addressbook property remove]
* Tcl command.
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook remove property (-groups|-persons) propName
+ * addressbook property remove (-groups|-persons) propName
*
* Results:
* A standard Tcl result.
@@ -1118,9 +1123,7 @@
ABAddressBookRef ab;
CFStringRef theProp;
CFMutableArrayRef theArray;
- int index, length, result;
- int theInt;
- SInt32 theSInt32;
+ int length, result;
char * propName;
Tcl_ResetResult(interp);
|
|
From: <bde...@us...> - 2003-12-09 08:08:15
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv7605/Source
Modified Files:
TclAddressBook.c
Log Message:
Improved objc checks
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- TclAddressBook.c 8 Dec 2003 23:14:24 -0000 1.13
+++ TclAddressBook.c 9 Dec 2003 08:08:12 -0000 1.14
@@ -232,7 +232,7 @@
* a new property.
*
* Syntax:
- * addressbook create (group | person) name ?-ingroup groupID?
+ * addressbook create (group|person) name ?-ingroup groupID?
*
* Results:
* A standard Tcl result.
@@ -261,8 +261,8 @@
TCLAB_ADD_GROUP, TCLAB_ADD_PERSON
};
- if (objc < 4 || objc > 6) {
- Tcl_WrongNumArgs(interp, 2, objv, "(group|person) args");
+ if (objc != 4 && objc != 6) {
+ Tcl_WrongNumArgs(interp, 2, objv, "(group|person) name ?-ingroup groupID?");
return TCL_ERROR;
}
@@ -270,14 +270,7 @@
return TCL_ERROR;
}
- switch (index) {
- case TCLAB_ADD_GROUP:
- result = TclAB_CreateRecord(interp, objc, objv, resultPtr, rec_group);
-
- case TCLAB_ADD_PERSON:
- result = TclAB_CreateRecord(interp, objc, objv, resultPtr, rec_person);
- }
- return result;
+ return TclAB_CreateRecord(interp, objc, objv, resultPtr, index);
}
@@ -387,16 +380,15 @@
switch (index) {
case TCLAB_COUNT_GROUPS:
theItems = ABCopyArrayOfAllGroups(ab);
- theCount = CFArrayGetCount(theItems);
break;
case TCLAB_COUNT_PERSONS:
theItems = ABCopyArrayOfAllPeople(ab);
- theCount = CFArrayGetCount(theItems);
break;
}
CFRelease(theItems);
+ theCount = CFArrayGetCount(theItems);
objPtr = Tcl_NewIntObj(theCount);
result = Tcl_ListObjAppendElement(interp, resultPtr, objPtr);
if (result != TCL_OK) {
@@ -948,8 +940,8 @@
"-groups", "-persons", (char *) NULL
};
- if (objc < 4 || objc > 6) {
- Tcl_WrongNumArgs(interp, 2, objv, "(add|names|remove) (-groups|-persons) args");
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "(add|names|remove) (-groups|-persons) ?args?");
return TCL_ERROR;
}
@@ -1090,7 +1082,7 @@
CONST84 char * directUID;
CONST84 char * fromUID;
CFStringRef directCFStr;
- int length, kind, result;
+ int index, length, kind, result;
TextEncoding theEncoding = GetApplicationTextEncoding();
Boolean removingFromGroup = false;
@@ -1099,7 +1091,7 @@
};
if (objc != 3 && objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "record recordID ?-fromgroup groupID?");
+ Tcl_WrongNumArgs(interp, 2, objv, "recordID ?-fromgroup groupID?");
return TCL_ERROR;
}
|
|
From: <bde...@us...> - 2003-12-09 08:05:06
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv6562/Help Added Files: TclAddressBookHelp.aida Log Message: Base file for doc written in AIDA. First checkin. --- NEW FILE: TclAddressBookHelp.aida --- :Title: Tcladdressbook Help :Project: addressbook extension for Tcl :Version: $Revision: 1.1 $ :CVSDate: $Date: 2003/12/09 08:05:00 $ :Author: Bernard Desgraupes <bde...@ea...> :Homepage: <http://webperso.easyconnect.fr/bdesgraupes/> :Created: 2003-11-26 14:30:03 :Modified: 2003-12-08 08:21:01 :Keywords: Address book, data base ((/ This is a manual page for the Tcladdressbook extension for Tcl. /)) ((toc ((np ((s1 NAME addressbook - manipulate the Macintosh OSX Address Book database ((s1 SYNOPSIS ((| (| package require addressbook (| addressbook subcommand ?arg arg ...? |)) ((s1 INTRODUCTION The argument ((i subcommand i)) indicates what operation to perform. Any unique abbreviation for each subcommand is acceptable. The valid subcommands are explained in the next sections. ((s1 SUBCOMMANDS ((s4 addressbook changed This command returns 1 if there has been changes made to the database, 0 otherwise. Changes are made in memory with commands such as ((b addressbook value b)), ((b addressbook create b)), ((b addressbook remove b)). To make these changes permanent, one must call the ((b addressbook save b)) command. ((s4 addressbook count !! ((s4 addressbook count (-groups | -persons) This command returns the count of existing groups or persons in the database. !! One can specify a particular group with the -ingroup option !! to count only the subgroups or members of this group. ((s4 addressbook create (group | person) ((i name i)) ?-ingroup ((i groupID i))? This command lets you create a new group or a new person record. The ((i name i)) argument is the name to give to the new group or the last name of the person for which a new record is created. With the ((i -ingroup i)) option one can make the newly created record a subgroup or a member of the particular group with unique ID ((i groupID i)). If no error occurs, the command returns the unique ID of the created record. ((s4 addressbook export ((i personID i)) 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. ((s4 addressbook getme ((i arrayvar i)) This command retrieves all the data available in the database concerning the logged-in user ("Me") and stores it in the array variable specified by the ((i arrayvar i)) argument. See the ((b addressbook record b)) command for a description of the format of the various kinds of properties. ((s4 addressbook groups ?-ids? ?-ingroup ((i groupID i))? 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. ((s4 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 ((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)). ((s4 addressbook import ((i vCardData i)) 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. ((s4 addressbook parents ?-ids? ((i recordID i)) 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. ((s4 addressbook persons ?-ids? ?-ingroup ((i groupID i))? 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. ((s4 addressbook property names (-groups | -persons) 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. ((s4 addressbook property add (-groups | -persons) ((i propName i)) ((i propType i)) 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 existing properties with the ((b addressbook property names b)) command. 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)) ((s4 addressbook property remove (-groups | -persons) ((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 properties with the ((b addressbook property names b)) command. ((s4 addressbook record ((i recordID arrayvar i)) This command retrieves all the data available in the database concerning the record with unique ID ((i recordID i)) and stores it in the array variable specified by the ((i arrayvar i)) argument. The keys of the array (as returned by the ((b array names b)) Tcl command) are the names of the properties: the values are the current values of the corresponding property. Only existing properties for the specified record are returned by this command: you should unset the ((i arrayvar i)) variable before invoking ((b addressbook record b)) in case you use this command repeatedly in order to be sure it does not keep stale information. ((nl The format used to return a particular value depends on the type of the property (string, integer, date, multivalue etc.). Some properties have a multiple type: MultiString for fields like Email, Phone etc., MultiDate for fields like ABDate, MultiDictionary for the Address field. In case of a multivalue, the returned value is a Tcl list. Each element of the list corresponds to a single property. For instance: ((lu ((li the elements of a MultiString or MultiDate value list are two-elements sublists: the first element is the label of the corresponding property (like Home, Work etc.) and the second is the value itself. ((li the elements of a MultiDictionary value list are lists themselves, representing a Label/Dictionary pair (dictionary in the AddressBook sense, not a Tcl dictionary as defined in version 8.5 of Tcl). Each element of this list has two elements: the first one is the label describing the address (like Home, Work etc.) and the second one is a list representing the dictionary. The lists representing dictionaries contain two-elements sublists: the first item is the key in the dictionary and the second one is the value associated with this key. For instance a person could have two addresses: each address will be returned as a Label/Dictionary pair; the elements of the dictionary are pairs like {City Paris} or {CountryCode fr}. lu)) ((nl Dates are returned as values suitable for use with the ((b clock format b)) Tcl command. It is the number of seconds relative to "Thu Jan 01 00:00:00 CET 1970". ((s4 addressbook remove ((i recordID i)) ?-fromgroup ((i groupID i))? This command removes the record with unique ID ((i recordID i)) from the database or from a particular subgroup specified by its unique ID with the ((i -fromgroup i)) option. Note that any changes made to the database won't be definitive until you invoke the ((b addressbook save b)) command. ((s4 addressbook save This command lets you save the changes made in the database. Commands such as ((b addressbook value b)), ((b addressbook create b)) or ((b addressbook remove 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. ((s4 addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? ((i property op value i)) This command returns all the records corresponding to the criterion described by the last three arguments: ((lu ((li ((i property i)) is the name of the property whose value will be compared to the ((i value i)) argument ((li ((i op i)) is an operator specifying the type of comparison. It can be one of the following symbols: ((| ==, !=, <, <=, >, >= |)) ((li ((i value i)) is the value property you are searching lu)) ((nl The ((i -groups i)) or ((i -persons i)) arguments let you specify the kind of records you want to search. If it is not specified, the default is ((i -person i)). If the ((i -ids i)) option is specified, only IDs of the matching records are returned, rather than pairs made of the ID and the name. The ((i -nocase i)) argument concerns string comparisons and requires that no distinction be made between uppercase and lowercase letters. ((s4 addressbook type ((i recordID i)) This command returns the type (ABPerson or ABGroup) of the record with unique ID ((i recordID i)). ((s4 addressbook value ((i recordID propertyName i)) ?((i value i))? 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. ((s1 INSTALLATION 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 contained in a folder called, in version 1.0, TclAddressBook1.0. This folder should be installed on your system in /Library/Tcl or in ~/Library/Tcl or, more generally, in any folder contained in your ((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. ((s1 VERSION HISTORY ((lu ((li 1.0 - lu)) ((s1 REQUIREMENTS AND PORTABILITY 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). ((s1 KNOW ISSUES Please e-mail any bug or problem you encounter: <bde...@us...> ((s1 LICENSE AND DISCLAIMER This software is free software and distributed under the same licensing terms as the Tcl language itself. See license.terms in the Tcl distribution. ((| © Copyright Bernard Desgraupes 2003 |)) ((s1 SOURCE CODE Tcladdressbook is an Open Source Project. Its source code is public and can be found on the SourceForge site at the following address: <http://sourceforge.net/projects/tcladdressbook> ((nl 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> ((nl The code is under CVS control. You can retrieve the latest stage of development using any CVS client. See instructions at: <http://sourceforge.net/cvs/?group_id=96169> ((nl You can also browse the cvs repository online at <http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook> ((s1 SEE ALSO The Mk4Tcl extension. ((s1 KEYWORDS Address book, data base |
|
From: <bde...@us...> - 2003-12-08 23:14:28
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv24167/Source
Modified Files:
TclAddressBook.c
Log Message:
Inverted index in objv for PropertyCmd
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- TclAddressBook.c 7 Dec 2003 16:42:57 -0000 1.12
+++ TclAddressBook.c 8 Dec 2003 23:14:24 -0000 1.13
@@ -122,7 +122,7 @@
static CONST char *switches[] = {
"changed", "count", "create", "export", "getme", "groups",
- "image", "import", "parents", "persons", "properties",
+ "image", "import", "parents", "persons", "property",
"record", "remove", "save", "search", "type", "value", (char *) NULL
};
@@ -953,12 +953,12 @@
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[3], propSubcmdSwitches,
+ if (Tcl_GetIndexFromObj(interp, objv[2], propSubcmdSwitches,
"subcommand", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[2], propertySwitches,
+ if (Tcl_GetIndexFromObj(interp, objv[3], propertySwitches,
"option", 0, &kind) != TCL_OK) {
return TCL_ERROR;
}
|
|
From: <bde...@us...> - 2003-12-08 23:12:33
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv23749/Help Modified Files: TclAddressBookHelp.html Log Message: Doc for all the subcommands Index: TclAddressBookHelp.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TclAddressBookHelp.html 6 Dec 2003 06:23:22 -0000 1.3 +++ TclAddressBookHelp.html 8 Dec 2003 23:12:30 -0000 1.4 @@ -11,7 +11,7 @@ <!-- :Author: Bernard Desgraupes <A HREF="mailto:bde...@ea...">bde...@ea...</A> --> <!-- :Homepage: <A HREF="http://webperso.easyconnect.fr/bdesgraupes/">http://webperso.easyconnect.fr/bdesgraupes/</A> --> <!-- :Created: 2003-11-26 14:30:03 --> -<!-- :Modified: 2003-12-04 14:12:26 --> +<!-- :Modified: 2003-12-08 08:21:01 --> <!-- :Keywords: Address book, data base --> @@ -23,19 +23,20 @@ <LI><A HREF="#M2">SYNOPSIS</A> <LI><A HREF="#M3">INTRODUCTION</A> <LI><A HREF="#M4">SUBCOMMANDS</A> -<LI><A HREF="#M5">PORTABILITY ISSUES</A> +<LI><A HREF="#M5">INSTALLATION</A> <LI><A HREF="#M6">VERSION HISTORY</A> -<LI><A HREF="#M7">KNOW ISSUES</A> -<LI><A HREF="#M8">LICENSE AND DISCLAIMER</A> -<LI><A HREF="#M9">SOURCE CODE</A> -<LI><A HREF="#M10">SEE ALSO</A> -<LI><A HREF="#M11">KEYWORDS</A> +<LI><A HREF="#M7">REQUIREMENTS AND PORTABILITY</A> +<LI><A HREF="#M8">KNOW ISSUES</A> +<LI><A HREF="#M9">LICENSE AND DISCLAIMER</A> +<LI><A HREF="#M10">SOURCE CODE</A> +<LI><A HREF="#M11">SEE ALSO</A> +<LI><A HREF="#M12">KEYWORDS</A> </UL> <H2><A NAME="M1"></A> NAME</H2> -addressbook - Manipulate the Macintosh OSX Address Book +addressbook - manipulate the Macintosh OSX Address Book database <H2><A NAME="M2"></A> SYNOPSIS</H2> <PRE> @@ -44,63 +45,202 @@ </PRE> <H2><A NAME="M3"></A> INTRODUCTION</H2> -<PRE> - package require addressbook -</PRE> -The argument <I>subcommand</I> indicates what operation to perform. Any unique abbreviation -for each subcommand is acceptable. The valid subcommands are explained in the next -sections. +The argument <I>subcommand</I> indicates what operation to perform. Any +unique abbreviation for each subcommand is acceptable. The valid +subcommands are explained in the next sections. + <H2><A NAME="M4"></A> SUBCOMMANDS</H2> -<H5>addressbook add (group | person) <I>name</I> ?-ingroup <I>groupID</I>?</H5> +<H5>addressbook changed</H5> +This command returns 1 if there has been changes made to the database, 0 +otherwise. Changes are made in memory with commands such as <B>addressbook value</B>, +<B>addressbook create</B>, <B>addressbook remove</B>. To make these changes permanent, +one must call the <B>addressbook save</B> command. -<H5>addressbook add property (-groups|-persons) <I>propName</I> <I>propType</I></H5> +<H5>addressbook count</H5> +<!-- ((s4 addressbook count (-groups | -persons) --> +This command returns the count of existing groups or persons in the +database. +<!-- One can specify a particular group with the -ingroup option --> +<!-- to count only the subgroups or members of this group. --> -<H5>addressbook changed</H5> -<H5>addressbook count (-groups | -persons)</H5> +<H5>addressbook create (group | person) <I>name</I> ?-ingroup <I>groupID</I>?</H5> +This command lets you create a new group or a new person record. The <I>name</I> +argument is the name to give to the new group or the last name of the +person for which a new record is created. With the <I>-ingroup</I> option one can +make the newly created record a subgroup or a member of the particular +group with unique ID <I>groupID</I>. If no error occurs, the command returns +the unique ID of the created record. -<H5>addressbook export <I>recordID</I></H5> +<H5>addressbook export <I>personID</I></H5> +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. <H5>addressbook getme <I>arrayvar</I></H5> +This command retrieves all the data available in the database concerning the logged-in user +("Me") and stores it in the array variable specified by the <I>arrayvar</I> +argument. See the <B>addressbook record</B> +command for a description of the format of the various kinds of +properties. <H5>addressbook groups ?-ids? ?-ingroup <I>groupID</I>?</H5> +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. -<H5>addressbook image <I>recordID</I> ?<I>imageData</I>?</H5> +<H5>addressbook image <I>personID</I> ?<I>imageData</I>?</H5> +This command returns the custom image associated with the record +corresponding to the unique ID <I>personID</I>. If no +image exists, it raises an error. The returned bytes are binary data. <H5>addressbook import <I>vCardData</I></H5> +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. -<H5>addressbook parents <I>recordID</I> ?-ids?</H5> +<H5>addressbook parents ?-ids? <I>recordID</I></H5> +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. <H5>addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</H5> +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. -<H5>addressbook properties (-groups | -persons)</H5> +<H5>addressbook property names (-groups | -persons)</H5> +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. + +<H5>addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></H5> +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 existing properties with the <B>addressbook property names</B> command. +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> + +<H5>addressbook property remove (-groups | -persons) <I>propName</I></H5> +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. <H5>addressbook record <I>recordID arrayvar</I></H5> +This command retrieves all the data available in the database concerning +the record with unique ID <I>recordID</I> and stores it in the array +variable specified by the <I>arrayvar</I> argument. The keys of the array +(as returned by the <B>array names</B> Tcl command) are the names of the +properties: the values are the current values of the corresponding +property. Only existing properties for the specified record are returned +by this command: you should unset the <I>arrayvar</I> variable before +invoking <B>addressbook record</B> in case you use this command repeatedly +in order to be sure it does not keep stale information. +<P> The format used to return a particular value depends on the type of +the property (string, integer, date, multivalue etc.). Some properties have +a multiple type: MultiString for fields like Email, Phone etc., MultiDate +for fields like ABDate, MultiDictionary for the Address field. In case of a +multivalue, the returned value is a Tcl list. Each element of the list +corresponds to a single property. For instance: +<UL> + <LI> the elements of a MultiString or MultiDate value list are two-elements +sublists: the first element is the label of the corresponding +property (like Home, Work etc.) and the second is the value itself. + <LI> the elements of a MultiDictionary value list are lists themselves, +representing a Label/Dictionary pair (dictionary in the AddressBook sense, not a Tcl +dictionary as defined in version 8.5 of Tcl). Each element of this list +has two elements: the first one is the label describing the address (like +Home, Work etc.) and the second one is a list representing the dictionary. +The lists representing dictionaries contain two-elements sublists: the +first item is the key in the dictionary and the second one is the value +associated with this key. For instance a person could have two addresses: +each address will be returned as a Label/Dictionary pair; the +elements of the dictionary are pairs like {City Paris} or {CountryCode fr}. -<H5>addressbook remove record <I>recordID</I> ?-fromgroup <I>groupID</I>?</H5> +</UL> +<P> Dates are returned as values suitable for use with the <B>clock format</B> +Tcl command. It is the number of seconds relative to "Thu Jan 01 00:00:00 +CET 1970". -<H5>addressbook remove property (-groups|-persons) <I>propName</I></H5> +<H5>addressbook remove <I>recordID</I> ?-fromgroup <I>groupID</I>?</H5> +This command removes the record with unique ID <I>recordID</I> from the +database or from a particular subgroup specified by its unique ID with the +<I>-fromgroup</I> option. Note that any changes made to the database +won't be definitive until you invoke the <B>addressbook save</B> command. <H5>addressbook save</H5> +This command lets you save the changes made in the database. Commands such +as <B>addressbook value</B>, <B>addressbook create</B> or <B>addressbook +remove</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. -<H5>addressbook search <I>property value</I> ?<I>property value</I> ...?</H5> +<H5>addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></H5> +This command returns all the records corresponding to the criterion +described by the last three arguments: +<UL> + <LI> <I>property</I> is the name of the property whose value will be +compared to the <I>value</I> argument + <LI> <I>op</I> is an operator specifying the type of comparison. It can be +one of the following symbols: +<PRE> + ==, !=, <, <=, >, >= +</PRE> + <LI> <I>value</I> is the value property you are searching -<H5>addressbook type <I>recordID</I></H5> +</UL> +<P> The <I>-groups</I> or <I>-persons</I> arguments let you specify the kind of records +you want to search. If it is not specified, the default is <I>-person</I>. +If the <I>-ids</I> option is specified, only IDs of the matching records are +returned, rather than pairs made of the ID and the name. The <I>-nocase</I> +argument concerns string comparisons and requires that no distinction be +made between uppercase and lowercase letters. -<H5>addressbook value <I>recordID property</I> ?<I>value</I>?</H5> +<H5>addressbook type <I>recordID</I></H5> +This command returns the type (ABPerson or ABGroup) of the record with +unique ID <I>recordID</I>. +<H5>addressbook value <I>recordID propertyName</I> ?<I>value</I>?</H5> +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. -<H2><A NAME="M5"></A> PORTABILITY ISSUES</H2> -The [addressbook] command is only available on Macintosh. It is made -available as an extension which should be loaded by Tcl scripts with the -following instruction: -<PRE> - package require addressbook -</PRE> +<H2><A NAME="M5"></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 +contained in a folder called, in version 1.0, TclAddressBook1.0. This folder +should be installed on your system in /Library/Tcl or in ~/Library/Tcl or, +more generally, in any folder contained in your <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. <H2><A NAME="M6"></A> VERSION HISTORY</H2> @@ -109,12 +249,19 @@ </UL> -<H2><A NAME="M7"></A> KNOW ISSUES</H2> -The [addressbook] command has been created on OSX as a Tcl extension by Bernard -Desgraupes. Please e-mail any bug or problem you encounter: -<A HREF="mailto:bde...@ea...">bde...@ea...</A> -<H2><A NAME="M8"></A> LICENSE AND DISCLAIMER</H2> +<H2><A NAME="M7"></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). + + +<H2><A NAME="M8"></A> KNOW ISSUES</H2> +Please e-mail any bug or problem you encounter: +<A HREF="mailto:bde...@us...">bde...@us...</A> + + +<H2><A NAME="M9"></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. @@ -122,7 +269,8 @@ © Copyright Bernard Desgraupes 2003 </PRE> -<H2><A NAME="M9"></A> SOURCE CODE</H2> + +<H2><A NAME="M10"></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: <A HREF="http://sourceforge.net/projects/tcladdressbook">http://sourceforge.net/projects/tcladdressbook</A> @@ -135,14 +283,14 @@ development using any CVS client. See instructions at: <A HREF="http://sourceforge.net/cvs/?group_id=96169">http://sourceforge.net/cvs/?group_id=96169</A> -<P> You can browse the cvs repository online at +<P> You can also browse the cvs repository online at <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook</A> -<H2><A NAME="M10"></A> SEE ALSO</H2> - +<H2><A NAME="M11"></A> SEE ALSO</H2> +The Mk4Tcl extension. -<H2><A NAME="M11"></A> KEYWORDS</H2> +<H2><A NAME="M12"></A> KEYWORDS</H2> Address book, data base |
|
From: <bde...@us...> - 2003-12-08 23:12:27
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv23720/Help Modified Files: TclAddressBookHelp Log Message: Doc for all the subcommands Index: TclAddressBookHelp =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TclAddressBookHelp 6 Dec 2003 06:23:15 -0000 1.3 +++ TclAddressBookHelp 8 Dec 2003 23:12:24 -0000 1.4 @@ -5,7 +5,7 @@ Author: Bernard Desgraupes <bde...@ea...> Homepage: <http://webperso.easyconnect.fr/bdesgraupes/> Created: 2003-11-26 14:30:03 -Modified: 2003-12-04 14:12:26 +Modified: 2003-12-08 08:21:01 Keywords: Address book, data base @@ -18,20 +18,21 @@ 2. SYNOPSIS 3. INTRODUCTION 4. SUBCOMMANDS -5. PORTABILITY ISSUES +5. INSTALLATION 6. VERSION HISTORY -7. KNOW ISSUES -8. LICENSE AND DISCLAIMER -9. SOURCE CODE -10. SEE ALSO -11. KEYWORDS +7. REQUIREMENTS AND PORTABILITY +8. KNOW ISSUES +9. LICENSE AND DISCLAIMER +10. SOURCE CODE +11. SEE ALSO +12. KEYWORDS =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 1. NAME -addressbook - Manipulate the Macintosh OSX Address Book +addressbook - manipulate the Macintosh OSX Address Book database 2. SYNOPSIS @@ -41,62 +42,196 @@ 3. INTRODUCTION - package require addressbook - +The argument subcommand indicates what operation to perform. Any +unique abbreviation for each subcommand is acceptable. The valid +subcommands are explained in the next sections. -The argument subcommand indicates what operation to perform. Any unique abbreviation -for each subcommand is acceptable. The valid subcommands are explained in the next -sections. 4. SUBCOMMANDS -addressbook add (group | person) name ?-ingroup groupID? +addressbook changed +This command returns 1 if there has been changes made to the database, 0 +otherwise. Changes are made in memory with commands such as addressbook value, +addressbook create, addressbook remove. To make these changes permanent, +one must call the addressbook save command. -addressbook add property (-groups|-persons) propName propType +addressbook count +This command returns the count of existing groups or persons in the +database. -addressbook changed -addressbook count (-groups | -persons) +addressbook create (group | person) name ?-ingroup groupID? +This command lets you create a new group or a new person record. The name +argument is the name to give to the new group or the last name of the +person for which a new record is created. With the -ingroup option one can +make the newly created record a subgroup or a member of the particular +group with unique ID groupID. If no error occurs, the command returns +the unique ID of the created record. -addressbook export recordID +addressbook export personID +This command lets you export the record with unique ID +personID as a VCard. The result should be +considered as binary data since it can contain an image associated to the +record. addressbook getme arrayvar +This command retrieves all the data available in the database concerning the logged-in user +("Me") and stores it in the array variable specified by the arrayvar +argument. See the addressbook record +command for a description of the format of the various kinds of +properties. addressbook groups ?-ids? ?-ingroup groupID? +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 -ids argument is specified, the returned +list will contain only the unique IDs of the groups. If the -ingroup +option is specified, only the subgroups contained in the group +with ID groupID will be returned. -addressbook image recordID ?imageData? +addressbook image personID ?imageData? +This command returns the custom image associated with the record +corresponding to the unique ID personID. If no +image exists, it raises an error. The returned bytes are binary data. addressbook import vCardData +This command imports data in VCard format. The data specified by +the vCardData 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. -addressbook parents recordID ?-ids? +addressbook parents ?-ids? recordID +This command returns a list of all the groups the record with unique ID +recordID 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 -ids option is specified, only IDs are +returned. addressbook persons ?-ids? ?-ingroup groupID? +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 -ids argument is specified, the +returned list will contain only the unique IDs. If the +-ingroup option is specified, only the members belonging to the group +with ID groupID will be returned. -addressbook properties (-groups | -persons) +addressbook property names (-groups | -persons) +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 addressbook property add and addressbook property remove commands. + +addressbook property add (-groups | -persons) propName propType +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 propName argument: it must be unique. One can get the list of +all the existing properties with the addressbook property names command. +The type of the property is specified by +the propType argument. This argument can have one of the following values: +Array, Data, Date, Dictionary, Integer, Real, String, MultiArray, +MultiData, MultiDate, MultiDictionary, MultiInteger, MultiReal, MultiString. + +addressbook property remove (-groups | -persons) 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 properties with the addressbook property names command. addressbook record recordID arrayvar +This command retrieves all the data available in the database concerning +the record with unique ID recordID and stores it in the array +variable specified by the arrayvar argument. The keys of the array +(as returned by the array names Tcl command) are the names of the +properties: the values are the current values of the corresponding +property. Only existing properties for the specified record are returned +by this command: you should unset the arrayvar variable before +invoking addressbook record in case you use this command repeatedly +in order to be sure it does not keep stale information. + The format used to return a particular value depends on the type of +the property (string, integer, date, multivalue etc.). Some properties have +a multiple type: MultiString for fields like Email, Phone etc., MultiDate +for fields like ABDate, MultiDictionary for the Address field. In case of a +multivalue, the returned value is a Tcl list. Each element of the list +corresponds to a single property. For instance: -addressbook remove record recordID ?-fromgroup groupID? + the elements of a MultiString or MultiDate value list are two-elements +sublists: the first element is the label of the corresponding +property (like Home, Work etc.) and the second is the value itself. + the elements of a MultiDictionary value list are lists themselves, +representing a Label/Dictionary pair (dictionary in the AddressBook sense, not a Tcl +dictionary as defined in version 8.5 of Tcl). Each element of this list +has two elements: the first one is the label describing the address (like +Home, Work etc.) and the second one is a list representing the dictionary. +The lists representing dictionaries contain two-elements sublists: the +first item is the key in the dictionary and the second one is the value +associated with this key. For instance a person could have two addresses: +each address will be returned as a Label/Dictionary pair; the +elements of the dictionary are pairs like {City Paris} or {CountryCode fr}. -addressbook remove property (-groups|-persons) propName + Dates are returned as values suitable for use with the clock format +Tcl command. It is the number of seconds relative to "Thu Jan 01 00:00:00 +CET 1970". + +addressbook remove recordID ?-fromgroup groupID? +This command removes the record with unique ID recordID from the +database or from a particular subgroup specified by its unique ID with the +-fromgroup option. Note that any changes made to the database +won't be definitive until you invoke the addressbook save command. addressbook save +This command lets you save the changes made in the database. Commands such +as addressbook value, addressbook create or addressbook +remove modify the data in memory: to make the changes definitive in the +database, one must call explicitely the addressbook save command. +To check whether there has been changes in the database, use the +addressbook changed command. -addressbook search property value ?property value ...? +addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? property op value +This command returns all the records corresponding to the criterion +described by the last three arguments: -addressbook type recordID + property is the name of the property whose value will be +compared to the value argument + op is an operator specifying the type of comparison. It can be +one of the following symbols: -addressbook value recordID property ?value? + ==, !=, <, <=, >, >= + value is the value property you are searching -5. PORTABILITY ISSUES -The [addressbook] command is only available on Macintosh. It is made -available as an extension which should be loaded by Tcl scripts with the -following instruction: + The -groups or -persons arguments let you specify the kind of records +you want to search. If it is not specified, the default is -person. +If the -ids option is specified, only IDs of the matching records are +returned, rather than pairs made of the ID and the name. The -nocase +argument concerns string comparisons and requires that no distinction be +made between uppercase and lowercase letters. - package require addressbook +addressbook type recordID +This command returns the type (ABPerson or ABGroup) of the record with +unique ID recordID. + +addressbook value recordID propertyName ?value? +This command lets you get or set the value of a particular property for +the record with unique ID recordID. If the value argument is not +specified, it returns the current value of the property specified in the +propertyName argument. If value is specified, the property +propertyName will be set to this value. See the addressbook record +command for a description of the format used for the various kinds of +properties. +5. INSTALLATION +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 +contained in a folder called, in version 1.0, TclAddressBook1.0. This folder +should be installed on your system in /Library/Tcl or in ~/Library/Tcl or, +more generally, in any folder contained in your auto_path Tcl variable. If +you use the extension within the AlphaX editor (version 8.0b11 or greater), +you can also install it in the Tclextensions folder which is located at the +same level as the application. 6. VERSION HISTORY @@ -104,12 +239,19 @@ 1.0 - -7. KNOW ISSUES -The [addressbook] command has been created on OSX as a Tcl extension by Bernard -Desgraupes. Please e-mail any bug or problem you encounter: -<bde...@ea...> -8. LICENSE AND DISCLAIMER +7. REQUIREMENTS AND PORTABILITY +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). + + +8. KNOW ISSUES +Please e-mail any bug or problem you encounter: +<bde...@us...> + + +9. LICENSE AND DISCLAIMER This software is free software and distributed under the same licensing terms as the Tcl language itself. See license.terms in the Tcl distribution. @@ -117,7 +259,8 @@ © Copyright Bernard Desgraupes 2003 -9. SOURCE CODE + +10. SOURCE CODE Tcladdressbook is an Open Source Project. Its source code is public and can be found on the SourceForge site at the following address: <http://sourceforge.net/projects/tcladdressbook> @@ -130,14 +273,14 @@ development using any CVS client. See instructions at: <http://sourceforge.net/cvs/?group_id=96169> - You can browse the cvs repository online at + You can also browse the cvs repository online at <http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook> -10. SEE ALSO - +11. SEE ALSO +The Mk4Tcl extension. -11. KEYWORDS +12. KEYWORDS Address book, data base |
|
From: <bde...@us...> - 2003-12-07 16:43:24
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv795/Source Modified Files: TclAddressBookUtils.h Log Message: Renamed cmds (add-create, properties-property) Index: TclAddressBookUtils.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TclAddressBookUtils.h 6 Dec 2003 06:20:30 -0000 1.2 +++ TclAddressBookUtils.h 7 Dec 2003 16:43:21 -0000 1.3 @@ -55,29 +55,48 @@ ABPropertyType inPropType); void TclAB_ResultListFromCFArray(Tcl_Interp *interp, - Tcl_Obj *resultPtr, - CFArrayRef allSubGroups, - Boolean onlyID, - int inRecordType); + Tcl_Obj *resultPtr, + CFArrayRef allSubGroups, + Boolean onlyID, + int inRecordType); -int TclAB_ListItems(Tcl_Interp *interp, +int TclAB_CreateRecord(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr, int inRecordType); -void TclAB_SetArrayOrResult(Tcl_Interp *interp, CONST84 char * inVar, char * inPropName, char * inStr); +int TclAB_ListItems(Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + Tcl_Obj *resultPtr, + int inRecordType); -Boolean TclAB_CheckGroup(Tcl_Interp *interp, ABAddressBookRef ab, CONST84 char * inGroupUID, - CONST84 char * option, ABRecordRef * outGroupRef); +int TclAB_PropertyAdd(Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + Tcl_Obj *resultPtr, + int inRecordType); -int TclAB_AddRecord(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr, int inRecordType); +int TclAB_PropertyNames(Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + Tcl_Obj *resultPtr, + int inRecordType); -int TclAB_AddProperty(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); +int TclAB_PropertyRemove(Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[], + Tcl_Obj *resultPtr, + int inRecordType); -int TclAB_RemoveRecord(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); +void TclAB_SetArrayOrResult(Tcl_Interp *interp, CONST84 char * inVar, char * inPropName, char * inStr); -int TclAB_RemoveProperty(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); +Boolean TclAB_CheckGroup(Tcl_Interp *interp, + ABAddressBookRef ab, + CONST84 char * inGroupUID, + CONST84 char * option, + ABRecordRef * outGroupRef); extern Tcl_Obj * TclLindexList(Tcl_Interp* interp, |
|
From: <bde...@us...> - 2003-12-07 16:43:18
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv761/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
Renamed cmds (add-create, properties-property)
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- TclAddressBookUtils.c 6 Dec 2003 06:20:24 -0000 1.2
+++ TclAddressBookUtils.c 7 Dec 2003 16:43:15 -0000 1.3
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBookUtils.c"
* Created: 2003-12-05 10:08:03
- * Last modification: 2003-12-06 06:35:27
+ * Last modification: 2003-12-07 16:58:34
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -653,8 +653,7 @@
*
* TclAB_ResultListFromCFArray --
*
- * This function is invoked to determine the type (group or person)
- * corresponding to a particular UID.
+ * This function is invoked to bild a Tcl list from a CFArray.
*
* Results:
* None.
@@ -666,7 +665,7 @@
*/
void TclAB_ResultListFromCFArray(Tcl_Interp *interp, Tcl_Obj *resultPtr,
- CFArrayRef allSubGroups, Boolean onlyID,
+ CFArrayRef allElements, Boolean onlyID,
int inRecordType)
{
CFIndex theCount;
@@ -677,12 +676,17 @@
int result, i;
TextEncoding theEncoding = GetApplicationTextEncoding();
- theCount = CFArrayGetCount(allSubGroups);
+ Tcl_ResetResult(interp);
+ if (!allElements) {
+ return;
+ }
+
+ theCount = CFArrayGetCount(allElements);
for (i = 0; i < theCount; i++) {
Tcl_Obj * listPtr;
// Get the record at index i
- theGroup = (ABGroupRef) CFArrayGetValueAtIndex(allSubGroups,i);
+ theGroup = (ABGroupRef) CFArrayGetValueAtIndex(allElements,i);
// Get the unique id for this record
uniqueId = ABRecordCopyUniqueId(theGroup);
CFStringGetCString(uniqueId, theUID, sizeof(theUID), theEncoding);
@@ -776,7 +780,7 @@
/*
*----------------------------------------------------------------------
*
- * TclABCmd_Add --
+ * TclAB_CreateRecord --
*
* This function is invoked to process the [addressbook add group] and
* the [addressbook add person] Tcl commands.
@@ -796,7 +800,7 @@
*/
int
-TclAB_AddRecord(
+TclAB_CreateRecord(
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[], /* Argument values. */
@@ -913,7 +917,7 @@
/*
*----------------------------------------------------------------------
*
- * TclAB_AddProperty --
+ * TclAB_PropertyAdd --
*
* This function is invoked to process the [addressbook add property]
* Tcl command.
@@ -932,24 +936,21 @@
*/
int
-TclAB_AddProperty(
+TclAB_PropertyAdd(
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[], /* Argument values. */
- Tcl_Obj *resultPtr) /* Pointer to store the result. */
+ Tcl_Obj *resultPtr, /* Pointer to store the result. */
+ int inRecordType)
{
ABAddressBookRef ab;
CFStringRef theKey, theValue;
CFMutableDictionaryRef theDict;
- int index, kind, length, result;
+ int index, length, result;
int theInt;
SInt32 theSInt32;
TextEncoding theEncoding = GetApplicationTextEncoding();
- static CONST char *addpropSwitches[] = {
- "-groups", "-persons", (char *) NULL
- };
-
static CONST char *typeSwitches[] = {
"Array", "Data", "Date", "Dictionary", "Integer", "Real", "String",
"MultiArray","MultiData", "MultiDate", "MultiDictionary",
@@ -976,16 +977,12 @@
Tcl_ResetResult(interp);
if (objc != 6) {
- Tcl_WrongNumArgs(interp, 2, objv, "property (-groups|-persons) propName propType");
+ Tcl_WrongNumArgs(interp, 2, objv, "add (-groups|-persons) propName propType");
return TCL_ERROR;
}
Tcl_IncrRefCount(objv[4]);
- if (Tcl_GetIndexFromObj(interp, objv[3], addpropSwitches, "option", 0, &kind) != TCL_OK) {
- return TCL_ERROR;
- }
-
if (Tcl_GetIndexFromObj(interp, objv[5], typeSwitches, "property", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -1002,9 +999,9 @@
CFDictionaryAddValue(theDict, theKey, theValue);
// Add the property to the Address Book
- if ( !ABAddPropertiesAndTypes(ab, kind ? kABPersonRecordType : kABGroupRecordType, theDict) ) {
+ if ( !ABAddPropertiesAndTypes(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType, theDict) ) {
Tcl_AppendStringsToObj(resultPtr, "Couldn't add new property for ",
- kind ? "Person":"Group" , " records", (char *) NULL);
+ inRecordType ? "Person":"Group" , " records", (char *) NULL);
result = TCL_ERROR;
} else {
result = TCL_OK;
@@ -1021,19 +1018,15 @@
/*
*----------------------------------------------------------------------
*
- * TclAB_RemoveRecord --
+ * TclAB_PropertyNames --
*
- * This procedure is invoked to process the [addressbook remove] Tcl command.
+ * This procedure is invoked to process the [addressbook property] Tcl command.
* See the user documentation for details on what it does.
- * - if -fromgroup is specified, remove recordID from the group: recordID can be
- * either a person (remove it as a member of the group) or a group (remove it as
- * a subgroup of the group)
- * - otherwise, remove recordID from the database.
*
* Syntax:
- * addressbook remove person recordID ?-fromgroup groupID?
- * addressbook remove group recordID ?-fromgroup groupID?
- * addressbook remove record recordID ?-fromgroup groupID?
+ * addressbook property add (-groups|-persons) propName propType
+ * addressbook property remove (-groups|-persons) propName
+ * addressbook property names (-groups|-persons)
*
* Results:
* A standard Tcl result.
@@ -1044,102 +1037,59 @@
*----------------------------------------------------------------------
*/
-
int
-TclAB_RemoveRecord(
+TclAB_PropertyNames(
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[], /* Argument values. */
- Tcl_Obj *resultPtr) /* Pointer to store the result. */
+ Tcl_Obj *resultPtr, /* Pointer to store the result. */
+ int inRecordType)
{
+ CFIndex theCount;
+ CFStringRef theProperty;
+ CFArrayRef theItems;
+ char theName[256];
+ Tcl_Obj * objPtr;
+ int i, result;
ABAddressBookRef ab;
- ABRecordRef theRecord, fromGroup;
- CONST84 char * directUID;
- CONST84 char * fromUID;
- CFStringRef directCFStr;
- int length, kind, result;
- TextEncoding theEncoding = GetApplicationTextEncoding();
- Boolean removingFromGroup = false;
-
- static CONST char *removerecSwitches[] = {
- "-ingroup", (char *) NULL
- };
-
- if (objc != 3 && objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "record recordID ?-fromgroup groupID?");
- return TCL_ERROR;
- }
-
- if (objc == 5) {
- if (Tcl_GetIndexFromObj(interp, objv[3], removerecSwitches, "option", 0, &index) != TCL_OK) {
- return TCL_ERROR;
- } else {
- fromUID = Tcl_GetStringFromObj(objv[4], &length);
- removingFromGroup = true;
- }
- }
-
- result = TCL_OK;
- directUID = Tcl_GetStringFromObj(objv[2], &length);
// Get the address book
- ab = ABGetSharedAddressBook();
-
- directCFStr = CFStringCreateWithCString(NULL, directUID, theEncoding);
- // Find the record corresponding to the UID
- theRecord = ABCopyRecordForUniqueId(ab, directCFStr);
- CFRelease(directCFStr);
- if (!theRecord) {
- Tcl_AppendStringsToObj(resultPtr, "Unrecognized record ID", (char *) NULL);
- return TCL_ERROR;
- }
+ ab = ABGetSharedAddressBook();
+
+ switch (inRecordType) {
+ case rec_group:
+ theItems = ABCopyArrayOfPropertiesForRecordType(ab, kABGroupRecordType);
+ break;
+
+ case rec_person:
+ theItems = ABCopyArrayOfPropertiesForRecordType(ab, kABPersonRecordType);
+ break;
+ }
- if (removingFromGroup) {
- if ( !TclAB_CheckGroup(interp, ab, fromUID, "-fromgroup", &fromGroup) ) {
- result = TCL_ERROR;
- goto DONE;
- }
+ theCount = CFArrayGetCount(theItems);
+ for (i = 0; i < theCount; i++) {
+ // Get the record at index i
+ theProperty = CFArrayGetValueAtIndex(theItems,i);
- // Is recordID a person or a group?
- kind = TclAB_TypeFromRecord(ab, theRecord);
- switch (kind) {
- case rec_person:
- if (!ABGroupRemoveMember(fromGroup, theRecord)) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't remove member from group", (char *) NULL);
- result = TCL_ERROR;
- }
- break;
-
- case rec_group:
- if (!ABGroupRemoveGroup(fromGroup, theRecord)) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't remove subgroup from group", (char *) NULL);
- result = TCL_ERROR;
- }
- break;
-
- default:
- Tcl_AppendStringsToObj(resultPtr, "Unknown type for recordID argument", (char *) NULL);
- result = TCL_ERROR;
- break;
- }
- CFRelease(fromGroup);
- } else {
- if (!ABRemoveRecord(ab, theRecord)) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't remove record from database", (char *) NULL);
- result = TCL_ERROR;
- }
+ if (theProperty && CFStringGetCString(theProperty, theName, sizeof(theName), GetApplicationTextEncoding())) {
+ objPtr = Tcl_NewStringObj(theName, strlen(theName));
+ result = Tcl_ListObjAppendElement(interp, resultPtr, objPtr);
+ if (result != TCL_OK) {
+ Tcl_DecrRefCount(objPtr);
+ break;
+ }
+ }
}
-
-DONE:
- CFRelease(theRecord);
- return result;
+ CFRelease(theItems);
+
+ return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * TclAB_RemoveProperty --
+ * TclAB_PropertyRemove --
*
* This function is invoked to process the [addressbook remove property]
* Tcl command.
@@ -1158,38 +1108,31 @@
*/
int
-TclAB_RemoveProperty(
+TclAB_PropertyRemove(
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[], /* Argument values. */
- Tcl_Obj *resultPtr) /* Pointer to store the result. */
+ Tcl_Obj *resultPtr, /* Pointer to store the result. */
+ int inRecordType)
{
ABAddressBookRef ab;
CFStringRef theProp;
CFMutableArrayRef theArray;
- int index, kind, length, result;
+ int index, length, result;
int theInt;
SInt32 theSInt32;
char * propName;
- static CONST char *removepropSwitches[] = {
- "-groups", "-persons", (char *) NULL
- };
-
Tcl_ResetResult(interp);
if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "property (-groups|-persons) propName");
+ Tcl_WrongNumArgs(interp, 2, objv, "remove (-groups|-persons) propName");
return TCL_ERROR;
}
Tcl_IncrRefCount(objv[4]);
propName = Tcl_GetStringFromObj(objv[4], &length);
- if (Tcl_GetIndexFromObj(interp, objv[3], removepropSwitches, "option", 0, &kind) != TCL_OK) {
- return TCL_ERROR;
- }
-
// Get the address book
ab = ABGetSharedAddressBook();
@@ -1200,10 +1143,10 @@
CFArrayAppendValue(theArray, theProp);
// Add the property to the Address Book
- result = ABRemoveProperties(ab, kind ? kABPersonRecordType : kABGroupRecordType, theArray);
+ result = ABRemoveProperties(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType, theArray);
if ( !result ) {
Tcl_AppendStringsToObj(resultPtr, "Couldn't remove property '",
- propName, "' for ", kind ? "Person":"Group" , " records", (char *) NULL);
+ propName, "' for ", inRecordType ? "Person":"Group" , " records", (char *) NULL);
result = TCL_ERROR;
} else {
result = TCL_OK;
@@ -1214,5 +1157,6 @@
CFRelease(theArray);
return result;
}
+
|
|
From: <bde...@us...> - 2003-12-07 16:43:00
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv687/Source
Modified Files:
TclAddressBook.c
Log Message:
Renamed cmds (add-create, properties-property)
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- TclAddressBook.c 7 Dec 2003 16:04:06 -0000 1.11
+++ TclAddressBook.c 7 Dec 2003 16:42:57 -0000 1.12
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBook.c"
* Created: 2003-11-26 12:54:15
- * Last modification: 2003-12-07 02:00:17
+ * Last modification: 2003-12-07 16:51:26
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -26,17 +26,17 @@
*/
static int TclABCmd_AddressBook(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
-static int TclABCmd_Add(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Changed(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Count(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
-static int TclABCmd_GetMe(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
+static int TclABCmd_Create(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Export(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
+static int TclABCmd_GetMe(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Groups(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Image(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Import(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Parents(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Persons(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
-static int TclABCmd_Properties(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
+static int TclABCmd_Property(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Record(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Remove(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Save(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
@@ -121,14 +121,14 @@
int index, result;
static CONST char *switches[] = {
- "add", "changed", "count", "export", "getme", "groups",
+ "changed", "count", "create", "export", "getme", "groups",
"image", "import", "parents", "persons", "properties",
"record", "remove", "save", "search", "type", "value", (char *) NULL
};
enum {
- TCLAB_ADD, TCLAB_CHANGED, TCLAB_COUNT, TCLAB_EXPORT, TCLAB_GETME, TCLAB_GROUPS,
- TCLAB_IMAGE, TCLAB_IMPORT, TCLAB_PARENTS, TCLAB_PERSONS, TCLAB_PROPERTIES,
+ TCLAB_CHANGED, TCLAB_COUNT, TCLAB_CREATE, TCLAB_EXPORT, TCLAB_GETME, TCLAB_GROUPS,
+ TCLAB_IMAGE, TCLAB_IMPORT, TCLAB_PARENTS, TCLAB_PERSONS, TCLAB_PROPERTY,
TCLAB_RECORD, TCLAB_REMOVE, TCLAB_SAVE, TCLAB_SEARCH, TCLAB_TYPE, TCLAB_VALUE
};
@@ -145,8 +145,8 @@
}
switch (index) {
- case TCLAB_ADD:
- result = TclABCmd_Add(clientData, interp, objc, objv, resultPtr);
+ case TCLAB_CREATE:
+ result = TclABCmd_Create(clientData, interp, objc, objv, resultPtr);
break;
case TCLAB_CHANGED:
@@ -185,8 +185,8 @@
result = TclABCmd_Persons(clientData, interp, objc, objv, resultPtr);
break;
- case TCLAB_PROPERTIES:
- result = TclABCmd_Properties(clientData, interp, objc, objv, resultPtr);
+ case TCLAB_PROPERTY:
+ result = TclABCmd_Property(clientData, interp, objc, objv, resultPtr);
break;
case TCLAB_RECORD:
@@ -224,16 +224,15 @@
/*
*----------------------------------------------------------------------
*
- * TclABCmd_Add --
+ * TclABCmd_Create --
*
- * This procedure is invoked to process the [addressbook add] Tcl command.
+ * This procedure is invoked to process the [addressbook create] Tcl command.
* See the user documentation for details on what it does. It can be used
* either to add a new group or person record to the database, or to add
* a new property.
*
* Syntax:
- * addressbook add (group | person) name ?-ingroup groupID?
- * addressbook add property (-groups|-persons) propName propType
+ * addressbook create (group | person) name ?-ingroup groupID?
*
* Results:
* A standard Tcl result.
@@ -245,7 +244,7 @@
*/
int
-TclABCmd_Add(
+TclABCmd_Create(
ClientData /* clientData */, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -254,32 +253,29 @@
{
int index, result;
- static CONST char *addSubcmds[] = {
- "group", "person", "property", (char *) NULL
+ static CONST char *createSubcmds[] = {
+ "group", "person", (char *) NULL
};
enum {
- TCLAB_ADD_GROUP, TCLAB_ADD_PERSON, TCLAB_ADD_PROPERTY
+ TCLAB_ADD_GROUP, TCLAB_ADD_PERSON
};
if (objc < 4 || objc > 6) {
- Tcl_WrongNumArgs(interp, 2, objv, "(group|person|property) args");
+ Tcl_WrongNumArgs(interp, 2, objv, "(group|person) args");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[2], addSubcmds, "subcommand", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], createSubcmds, "subcommand", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
switch (index) {
case TCLAB_ADD_GROUP:
- result = TclAB_AddRecord(interp, objc, objv, resultPtr, rec_group);
+ result = TclAB_CreateRecord(interp, objc, objv, resultPtr, rec_group);
case TCLAB_ADD_PERSON:
- result = TclAB_AddRecord(interp, objc, objv, resultPtr, rec_person);
-
- case TCLAB_ADD_PROPERTY:
- result = TclAB_AddProperty(interp, objc, objv, resultPtr);
+ result = TclAB_CreateRecord(interp, objc, objv, resultPtr, rec_person);
}
return result;
}
@@ -911,13 +907,15 @@
/*
*----------------------------------------------------------------------
*
- * TclABCmd_Properties --
+ * TclABCmd_Property --
*
- * This procedure is invoked to process the [addressbook properties] Tcl command.
+ * This procedure is invoked to process the [addressbook property] Tcl command.
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook properties (-groups|-persons)
+ * addressbook property add (-groups|-persons) propName propType
+ * addressbook property remove (-groups|-persons) propName
+ * addressbook property names (-groups|-persons)
*
* Results:
* A standard Tcl result.
@@ -929,70 +927,57 @@
*/
int
-TclABCmd_Properties(
+TclABCmd_Property(
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. */
{
- CFIndex theCount;
- CFStringRef theProperty;
- CFArrayRef theItems;
- char theName[256];
- Tcl_Obj * objPtr;
- int result, index, i;
- ABAddressBookRef ab;
+ int result, index, kind;
- static CONST char *propertiesSwitches[] = {
- "-groups", "-persons", (char *) NULL
+ static CONST char *propSubcmdSwitches[] = {
+ "add", "names", "remove", (char *) NULL
};
enum {
- TCLAB_PROPERTIES_GROUPS, TCLAB_PROPERTIES_PERSONS
+ TCLAB_PROPERTY_ADD, TCLAB_PROPERTY_NAMES, TCLAB_PROPERTY_REMOVE
};
+ static CONST char *propertySwitches[] = {
+ "-groups", "-persons", (char *) NULL
+ };
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "(-groups|-persons)");
+ if (objc < 4 || objc > 6) {
+ Tcl_WrongNumArgs(interp, 2, objv, "(add|names|remove) (-groups|-persons) args");
return TCL_ERROR;
}
- // Get the address book
- ab = ABGetSharedAddressBook();
+ if (Tcl_GetIndexFromObj(interp, objv[3], propSubcmdSwitches,
+ "subcommand", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
- if (Tcl_GetIndexFromObj(interp, objv[2], propertiesSwitches,
- "option", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], propertySwitches,
+ "option", 0, &kind) != TCL_OK) {
return TCL_ERROR;
}
switch (index) {
- case TCLAB_PROPERTIES_GROUPS:
- theItems = ABCopyArrayOfPropertiesForRecordType(ab, kABGroupRecordType);
+ case TCLAB_PROPERTY_ADD:
+ result = TclAB_PropertyAdd(interp, objc, objv, resultPtr, kind);
break;
- case TCLAB_PROPERTIES_PERSONS:
- theItems = ABCopyArrayOfPropertiesForRecordType(ab, kABPersonRecordType);
+ case TCLAB_PROPERTY_NAMES:
+ result = TclAB_PropertyNames(interp, objc, objv, resultPtr, kind);
break;
- }
-
- theCount = CFArrayGetCount(theItems);
- for (i = 0; i < theCount; i++) {
- // Get the record at index i
- theProperty = CFArrayGetValueAtIndex(theItems,i);
- if (theProperty && CFStringGetCString(theProperty, theName, sizeof(theName), GetApplicationTextEncoding())) {
- objPtr = Tcl_NewStringObj(theName, strlen(theName));
- result = Tcl_ListObjAppendElement(interp, resultPtr, objPtr);
- if (result != TCL_OK) {
- Tcl_DecrRefCount(objPtr);
- break;
- }
- }
+ case TCLAB_PROPERTY_REMOVE:
+ result = TclAB_PropertyRemove(interp, objc, objv, resultPtr, kind);
+ break;
}
- CFRelease(theItems);
- return TCL_OK;
+ return result;
}
@@ -1072,18 +1057,15 @@
*
* TclABCmd_Remove --
*
- * This procedure is invoked to process the [addressbook remove record] and
- * the the [addressbook remove property] Tcl commands.
+ * This procedure is invoked to process the [addressbook remove] Tcl command.
* See the user documentation for details on what it does.
* - if -fromgroup is specified, remove recordID from the group: recordID can be
* either a person (remove it as a member of the group) or a group (remove it as
* a subgroup of the group)
* - otherwise, remove recordID from the database.
- * - [remove property] removes a property for the specified type of record
*
* Syntax:
- * addressbook remove record recordID ?-fromgroup groupID?
- * addressbook remove property (-groups|-persons) propName
+ * addressbook remove recordID ?-fromgroup groupID?
*
* Results:
* A standard Tcl result.
@@ -1094,7 +1076,6 @@
*----------------------------------------------------------------------
*/
-
int
TclABCmd_Remove(
ClientData /* clientData */, /* Not used. */
@@ -1103,32 +1084,87 @@
Tcl_Obj *CONST objv[], /* Argument values. */
Tcl_Obj *resultPtr) /* Pointer to store the result. */
{
- int index, result;
-
- static CONST char *removeSubcmds[] = {
- "record", "property", (char *) NULL
- };
+
+ ABAddressBookRef ab;
+ ABRecordRef theRecord, fromGroup;
+ CONST84 char * directUID;
+ CONST84 char * fromUID;
+ CFStringRef directCFStr;
+ int length, kind, result;
+ TextEncoding theEncoding = GetApplicationTextEncoding();
+ Boolean removingFromGroup = false;
- enum {
- TCLAB_REMOVE_RECORD, TCLAB_REMOVE_PROPERTY
+ static CONST char *rmRecSwitches[] = {
+ "-fromgroup", (char *) NULL
};
- if (objc < 4 || objc > 6) {
- Tcl_WrongNumArgs(interp, 2, objv, "(record|property) args");
+ if (objc != 3 && objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "record recordID ?-fromgroup groupID?");
return TCL_ERROR;
}
-
- if (Tcl_GetIndexFromObj(interp, objv[2], removeSubcmds, "subcommand", 0, &index) != TCL_OK) {
+
+ if (objc == 5) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], rmRecSwitches, "option", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ } else {
+ fromUID = Tcl_GetStringFromObj(objv[4], &length);
+ removingFromGroup = true;
+ }
+ }
+
+ result = TCL_OK;
+ directUID = Tcl_GetStringFromObj(objv[2], &length);
+
+ // Get the address book
+ ab = ABGetSharedAddressBook();
+
+ directCFStr = CFStringCreateWithCString(NULL, directUID, theEncoding);
+ // Find the record corresponding to the UID
+ theRecord = ABCopyRecordForUniqueId(ab, directCFStr);
+ CFRelease(directCFStr);
+ if (!theRecord) {
+ Tcl_AppendStringsToObj(resultPtr, "Unrecognized record ID", (char *) NULL);
return TCL_ERROR;
}
- switch (index) {
- case TCLAB_REMOVE_RECORD:
- result = TclAB_RemoveRecord(interp, objc, objv, resultPtr);
+ if (removingFromGroup) {
+ if ( !TclAB_CheckGroup(interp, ab, fromUID, "-fromgroup", &fromGroup) ) {
+ result = TCL_ERROR;
+ goto DONE;
+ }
- case TCLAB_REMOVE_PROPERTY:
- result = TclAB_RemoveProperty(interp, objc, objv, resultPtr);
+ // Is recordID a person or a group?
+ kind = TclAB_TypeFromRecord(ab, theRecord);
+ switch (kind) {
+ case rec_person:
+ if (!ABGroupRemoveMember(fromGroup, theRecord)) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't remove member from group", (char *) NULL);
+ result = TCL_ERROR;
+ }
+ break;
+
+ case rec_group:
+ if (!ABGroupRemoveGroup(fromGroup, theRecord)) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't remove subgroup from group", (char *) NULL);
+ result = TCL_ERROR;
+ }
+ break;
+
+ default:
+ Tcl_AppendStringsToObj(resultPtr, "Unknown type for recordID argument", (char *) NULL);
+ result = TCL_ERROR;
+ break;
+ }
+ CFRelease(fromGroup);
+ } else {
+ if (!ABRemoveRecord(ab, theRecord)) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't remove record from database", (char *) NULL);
+ result = TCL_ERROR;
+ }
}
+
+DONE:
+ CFRelease(theRecord);
return result;
}
|
|
From: <bde...@us...> - 2003-12-07 16:04:09
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv26913/Source
Modified Files:
TclAddressBook.c
Log Message:
Implemented [search]
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- TclAddressBook.c 6 Dec 2003 15:37:16 -0000 1.10
+++ TclAddressBook.c 7 Dec 2003 16:04:06 -0000 1.11
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBook.c"
* Created: 2003-11-26 12:54:15
- * Last modification: 2003-12-06 16:29:57
+ * Last modification: 2003-12-07 02:00:17
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -786,7 +786,7 @@
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook parents recordID ?-ids?
+ * addressbook parents ?-ids? recordID
*
* Results:
* A standard Tcl result.
@@ -807,7 +807,7 @@
{
CFArrayRef allParents;
ABRecordRef theRecord;
- CONST84 char * groupUID;
+ CONST84 char * theUID;
CFStringRef uidRef;
int index, kind, length;
ABAddressBookRef ab;
@@ -822,12 +822,12 @@
};
if (objc != 3 && objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "recordID ?-ids?");
+ Tcl_WrongNumArgs(interp, 2, objv, "?-ids? recordID");
return TCL_ERROR;
}
if (objc == 4) {
- if (Tcl_GetIndexFromObj(interp, objv[3], parentsSwitches, "option", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], parentsSwitches, "option", 0, &index) != TCL_OK) {
return TCL_ERROR;
} else {
onlyID = true;
@@ -837,8 +837,8 @@
// Get the address book
ab = ABGetSharedAddressBook();
- groupUID = Tcl_GetStringFromObj(objv[2], &length);
- uidRef = CFStringCreateWithCString(NULL, groupUID, GetApplicationTextEncoding());
+ theUID = Tcl_GetStringFromObj(objv[objc-1], &length);
+ uidRef = CFStringCreateWithCString(NULL, theUID, GetApplicationTextEncoding());
// Find the record corresponding to the UID
theRecord = ABCopyRecordForUniqueId(ab, uidRef);
@@ -1184,8 +1184,9 @@
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook search property value ?property value ...?
+ * addressbook search ?(-groups|-persons)? ?-ids? ?-nocase? property op value
*
+ * The op argument can be: "==", "!=", "<", "<=", ">", or ">="
* Results:
* A standard Tcl result.
*
@@ -1203,6 +1204,176 @@
Tcl_Obj *CONST objv[], /* Argument values. */
Tcl_Obj *resultPtr) /* Pointer to store the result. */
{
+ ABAddressBookRef ab;
+ ABSearchElementRef theSearchElement;
+ ABSearchComparison comparison;
+ ABPropertyType thePropType;
+ CONST84 char * theProperty;
+ CONST84 char * theOp;
+ CONST84 char * theValue;
+ CFStringRef propertyRef, valueRef;
+ CFArrayRef foundItemsRef;
+ SInt32 theSInt32;
+ double theDouble;
+ int i, index, opIndex, kind = rec_person, length;
+ TextEncoding theEncoding = GetApplicationTextEncoding();
+ Boolean onlyID = false;
+ Boolean noCase = false;
+ Boolean isNumeric = false;
+
+ static CONST char *searchSwitches[] = {
+ "-groups", "-persons", "-ids", "-nocase", (char *) NULL
+ };
+
+ enum {
+ TCLAB_SEARCH_GROUPS, TCLAB_SEARCH_PERSONS,
+ TCLAB_SEARCH_IDS, TCLAB_SEARCH_NOCASE
+ };
+
+ static CONST char *searchOpSwitches[] = {
+ "==", "!=", "<", "<=", ">", ">=", (char *) NULL
+ };
+
+ // Same order as in the ABSearchComparison enum. DON'T CHANGE IT!
+ enum {
+ TCLAB_SEARCHOP_EQUAL, TCLAB_SEARCHOP_NOTEQUAL, TCLAB_SEARCHOP_LESSTHAN,
+ TCLAB_SEARCHOP_LESSTHANOREQUAL, TCLAB_SEARCHOP_GREATERTHAN,
+ TCLAB_SEARCHOP_GREATERTHANOREQUAL,
+ };
+
+ if (objc < 5 || objc > 8) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?(-groups|-persons)? ?-ids? ?-nocase? property op value");
+ return TCL_ERROR;
+ }
+ if (objc > 6) {
+ for (i = objc-4; i > 1; i--) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], searchSwitches, "option", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ switch (index) {
+ case TCLAB_SEARCH_GROUPS:
+ case TCLAB_SEARCH_PERSONS:
+ kind = index;
+ break;
+
+ case TCLAB_SEARCH_IDS:
+ onlyID = true;
+ break;
+
+ case TCLAB_SEARCH_NOCASE:
+ noCase = true;
+ break;
+ }
+ }
+ }
+
+ if (Tcl_GetIndexFromObj(interp, objv[objc-2], searchOpSwitches, "operator", 0, &opIndex) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ theProperty = Tcl_GetStringFromObj(objv[objc-3], &length);
+ theValue = Tcl_GetStringFromObj(objv[objc-1], &length);
+
+ // Make CF objects. The kind of CF object for value depends on the type of
+ // the property (string, integer, date etc.)
+ propertyRef = CFStringCreateWithCString(NULL, theProperty, theEncoding);
+ if (!propertyRef) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't create property reference", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ // Get the address book
+ ab = ABGetSharedAddressBook();
+
+ thePropType = ABTypeOfProperty(ab, kind ? kABPersonRecordType : kABGroupRecordType, theProperty);
+ switch (thePropType) {
+ case kABArrayProperty:
+ case kABDictionaryProperty:
+ case kABStringProperty:
+ case kABMultiArrayProperty:
+ case kABMultiDictionaryProperty:
+ case kABMultiStringProperty:
+ valueRef = CFStringCreateWithCString(NULL, theValue, theEncoding);
+ break;
+
+ case kABDateProperty:
+ case kABMultiDateProperty:
+ theDouble = atof(theValue);
+ theDouble -= kCFAbsoluteTimeIntervalSince1970;
+ valueRef = CFDateCreate(NULL, theDouble);
+ isNumeric = true;
+ break;
+
+ case kABIntegerProperty:
+ case kABRealProperty:
+ case kABMultiIntegerProperty:
+ case kABMultiRealProperty:
+ theSInt32 = atoi(theValue);
+ valueRef = CFNumberCreate(NULL, kCFNumberSInt32Type, &theSInt32);
+ isNumeric = true;
+ break;
+
+ case kABDataProperty:
+ case kABMultiDataProperty:
+ valueRef = NULL;
+ default:
+ break;
+ }
+ if (!valueRef) {
+ Tcl_AppendStringsToObj(resultPtr, "Invalid value", (char *) NULL);
+ CFRelease(propertyRef);
+ return TCL_ERROR;
+ }
+
+ switch (opIndex) {
+ case TCLAB_SEARCHOP_EQUAL:
+ if (!isNumeric && noCase) {
+ comparison = kABEqualCaseInsensitive;
+ } else {
+ comparison = opIndex;
+ }
+ break;
+
+ case TCLAB_SEARCHOP_GREATERTHAN:
+ case TCLAB_SEARCHOP_GREATERTHANOREQUAL:
+ if (isNumeric) {
+ comparison = opIndex;
+ } else if (noCase) {
+ comparison = kABContainsSubStringCaseInsensitive;
+ } else {
+ comparison = kABContainsSubString;
+ }
+ break;
+
+ case TCLAB_SEARCHOP_NOTEQUAL:
+ case TCLAB_SEARCHOP_LESSTHAN:
+ case TCLAB_SEARCHOP_LESSTHANOREQUAL:
+ comparison = opIndex;
+ break;
+ }
+
+ switch (kind) {
+ case rec_person:
+ theSearchElement = ABPersonCreateSearchElement(propertyRef, NULL, NULL, valueRef, comparison);
+ break;
+
+ case rec_group:
+ theSearchElement = ABGroupCreateSearchElement(propertyRef, NULL, NULL, valueRef, comparison);
+ break;
+ }
+ CFRelease(propertyRef);
+ CFRelease(valueRef);
+
+ if (theSearchElement) {
+ foundItemsRef = ABCopyArrayOfMatchingRecords(ab, theSearchElement);
+ CFRelease(theSearchElement);
+ TclAB_ResultListFromCFArray(interp, resultPtr, foundItemsRef, onlyID, kind);
+ CFRelease(foundItemsRef);
+ } else {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't build search element", (char *) NULL);
+ return TCL_ERROR;
+ }
+
return TCL_OK;
}
|
|
From: <bde...@us...> - 2003-12-06 15:37:19
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv23281/Source
Modified Files:
TclAddressBook.c
Log Message:
New [import], [export] and [image] commands
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- TclAddressBook.c 6 Dec 2003 06:19:43 -0000 1.9
+++ TclAddressBook.c 6 Dec 2003 15:37:16 -0000 1.10
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBook.c"
* Created: 2003-11-26 12:54:15
- * Last modification: 2003-12-06 06:36:29
+ * Last modification: 2003-12-06 16:29:57
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -30,7 +30,10 @@
static int TclABCmd_Changed(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Count(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_GetMe(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
+static int TclABCmd_Export(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Groups(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
+static int TclABCmd_Image(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
+static int TclABCmd_Import(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Parents(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Persons(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
static int TclABCmd_Properties(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
@@ -118,15 +121,15 @@
int index, result;
static CONST char *switches[] = {
- "add", "changed", "count", "getme", "groups",
- "parents", "persons", "properties", "record", "remove",
- "save", "search", "type", "value", (char *) NULL
+ "add", "changed", "count", "export", "getme", "groups",
+ "image", "import", "parents", "persons", "properties",
+ "record", "remove", "save", "search", "type", "value", (char *) NULL
};
enum {
- TCLAB_ADD, TCLAB_CHANGED, TCLAB_COUNT, TCLAB_GETME, TCLAB_GROUPS,
- TCLAB_PARENTS, TCLAB_PERSONS, TCLAB_PROPERTIES, TCLAB_RECORD, TCLAB_REMOVE,
- TCLAB_SAVE, TCLAB_SEARCH, TCLAB_TYPE, TCLAB_VALUE
+ TCLAB_ADD, TCLAB_CHANGED, TCLAB_COUNT, TCLAB_EXPORT, TCLAB_GETME, TCLAB_GROUPS,
+ TCLAB_IMAGE, TCLAB_IMPORT, TCLAB_PARENTS, TCLAB_PERSONS, TCLAB_PROPERTIES,
+ TCLAB_RECORD, TCLAB_REMOVE, TCLAB_SAVE, TCLAB_SEARCH, TCLAB_TYPE, TCLAB_VALUE
};
resultPtr = Tcl_GetObjResult(interp);
@@ -154,6 +157,10 @@
result = TclABCmd_Count(clientData, interp, objc, objv, resultPtr);
break;
+ case TCLAB_EXPORT:
+ result = TclABCmd_Export(clientData, interp, objc, objv, resultPtr);
+ break;
+
case TCLAB_GETME:
result = TclABCmd_GetMe(clientData, interp, objc, objv, resultPtr);
break;
@@ -162,6 +169,14 @@
result = TclABCmd_Groups(clientData, interp, objc, objv, resultPtr);
break;
+ case TCLAB_IMAGE:
+ result = TclABCmd_Image(clientData, interp, objc, objv, resultPtr);
+ break;
+
+ case TCLAB_IMPORT:
+ result = TclABCmd_Import(clientData, interp, objc, objv, resultPtr);
+ break;
+
case TCLAB_PARENTS:
result = TclABCmd_Parents(clientData, interp, objc, objv, resultPtr);
break;
@@ -400,6 +415,82 @@
/*
*----------------------------------------------------------------------
*
+ * TclABCmd_Export --
+ *
+ * This procedure is invoked to process the [addressbook export] Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Syntax:
+ * addressbook export personID
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclABCmd_Export(
+ 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;
+ CFStringRef uidRef;
+ CFDataRef vCard;
+ int length, kind;
+ Tcl_Obj * objPtr;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "personID");
+ return TCL_ERROR;
+ }
+
+ uidRef = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(objv[2], &length), GetApplicationTextEncoding());
+ // Get the address book
+ ab = ABGetSharedAddressBook();
+ // Find the record corresponding to the UID
+ theRecord = ABCopyRecordForUniqueId(ab, uidRef);
+ CFRelease(uidRef);
+ if (!theRecord) {
+ Tcl_AppendStringsToObj(resultPtr, "Unrecognized record ID", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ // Is it a person or a group?
+ kind = TclAB_TypeFromRecord(ab, theRecord);
+ if (kind != rec_person) {
+ Tcl_AppendStringsToObj(resultPtr, "Not a person record", (char *) NULL);
+ CFRelease(theRecord);
+ return TCL_ERROR;
+ }
+
+ vCard = ABPersonCopyVCardRepresentation(theRecord);
+ if (vCard) {
+ objPtr = Tcl_NewByteArrayObj( CFDataGetBytePtr(vCard), CFDataGetLength(vCard) );
+ Tcl_SetObjResult(interp, objPtr);
+ } else {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't get vCard representation", (char *) NULL);
+ CFRelease(theRecord);
+ return TCL_ERROR;
+ }
+
+ CFRelease(vCard);
+ CFRelease(theRecord);
+ return TCL_OK;
+}
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
* TclABCmd_GetMe --
*
* This procedure is invoked to process the [addressbook getme] Tcl command.
@@ -482,6 +573,213 @@
/*
*----------------------------------------------------------------------
*
+ * TclABCmd_Image --
+ *
+ * This procedure is invoked to process the [addressbook image] Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Syntax:
+ * addressbook image personID ?imageData?
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclABCmd_Image(
+ 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;
+ CFStringRef uidRef;
+ CFDataRef imageRef;
+ int length, kind, result;
+ Tcl_Obj * objPtr;
+ Boolean setIt = false;
+ unsigned char * imageBytes;
+
+ Tcl_ResetResult(interp);
+ result = TCL_OK;
+
+ if (objc != 3 && objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "personID");
+ return TCL_ERROR;
+ }
+
+ if (objc == 4) {
+ imageBytes = Tcl_GetByteArrayFromObj(objv[3], &length);
+ setIt = true;
+ }
+
+ uidRef = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(objv[2], &length), GetApplicationTextEncoding());
+ // Get the address book
+ ab = ABGetSharedAddressBook();
+ // Find the record corresponding to the UID
+ theRecord = ABCopyRecordForUniqueId(ab, uidRef);
+ CFRelease(uidRef);
+ if (!theRecord) {
+ Tcl_AppendStringsToObj(resultPtr, "Unrecognized record ID", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ // Is it a person or a group?
+ kind = TclAB_TypeFromRecord(ab, theRecord);
+ if (kind != rec_person) {
+ Tcl_AppendStringsToObj(resultPtr, "Not a person record", (char *) NULL);
+ CFRelease(theRecord);
+ return TCL_ERROR;
+ }
+
+ if (setIt) {
+ imageRef = CFDataCreate(NULL, imageBytes, length);
+ if (!imageRef) {
+ Tcl_AppendStringsToObj(resultPtr, "CFDataCreate error", (char *) NULL);
+ result = TCL_ERROR;
+ } else {
+ if (!ABPersonSetImageData(theRecord, imageRef)) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't set image data", (char *) NULL);
+ result = TCL_ERROR;
+ }
+ }
+ } else {
+ imageRef = ABPersonCopyImageData(theRecord);
+ if (!imageRef) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't get image data", (char *) NULL);
+ result = TCL_ERROR;
+ } else {
+ objPtr = Tcl_NewByteArrayObj( CFDataGetBytePtr(imageRef), CFDataGetLength(imageRef) );
+ Tcl_SetObjResult(interp, objPtr);
+ }
+ }
+
+ if (imageRef) CFRelease(imageRef);
+ CFRelease(theRecord);
+ return result;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclABCmd_Import --
+ *
+ * This procedure is invoked to process the [addressbook import] Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Syntax:
+ * addressbook import vCardData
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclABCmd_Import(
+ 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;
+ ABPersonRef importedRecord, newRecord;
+ CFStringRef theValue, theProperty, uidRef;
+ CFArrayRef allProps;
+ CFDataRef vCard;
+ CFIndex theCount;
+ char theUID[256];
+ int i, length, result;
+ Tcl_Obj * objPtr;
+ unsigned char * theBytes;
+
+ Tcl_ResetResult(interp);
+ result = TCL_OK;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "VCardData");
+ return TCL_ERROR;
+ }
+
+ theBytes = Tcl_GetByteArrayFromObj(objv[2], &length);
+
+ vCard = CFDataCreate(NULL, theBytes, length);
+ if (!vCard) {
+ Tcl_AppendStringsToObj(resultPtr, "CFDataCreate error", (char *) NULL);
+ result = TCL_ERROR;
+ } else {
+ // Import the VCard
+ importedRecord = ABPersonCreateWithVCardRepresentation(vCard);
+ CFRelease(vCard);
+ // Adding the imported record directly to the database causes a
+ // crash. So we create a new record and copy the improted property/value
+ // pairs to the new record.
+ newRecord = ABPersonCreate();
+ if (!importedRecord || !newRecord) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't create new record with VCard data", (char *) NULL);
+ result = TCL_ERROR;
+ } else {
+ // Get the address book
+ ab = ABGetSharedAddressBook();
+ // Loop over all the properties and copy them the the new record
+ allProps = ABCopyArrayOfPropertiesForRecordType(ab, kABPersonRecordType);
+ theCount = CFArrayGetCount(allProps);
+ for (i = 0; i < theCount; i++) {
+ // Get the property at index i
+ theProperty = CFArrayGetValueAtIndex(allProps, i);
+ if (theProperty) {
+ theValue = ABRecordCopyValue(importedRecord, theProperty);
+ if (!theValue) {
+ continue;
+ }
+ ABRecordSetValue(newRecord, theProperty, theValue);
+ CFRelease(theValue);
+ }
+ }
+ if (allProps) CFRelease(allProps);
+
+ // TODO: also copy the image if any
+
+ // Add the new record to the Address Book. Don't save here: leave
+ // this to the Tcl level.
+ if ( ABAddRecord(ab, newRecord) ) {
+ // Retrieve the UID for the newly created record
+ uidRef = ABRecordCopyUniqueId(newRecord);
+ if (uidRef) {
+ CFStringGetCString(uidRef, theUID, sizeof(theUID), GetApplicationTextEncoding());
+ CFRelease(uidRef);
+ Tcl_AppendStringsToObj(resultPtr, theUID, (char *) NULL);
+ }
+ } else {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't add record to the Address Book", (char *) NULL);
+ result = TCL_ERROR;
+ }
+ }
+ if (importedRecord) CFRelease(importedRecord);
+ if (newRecord) CFRelease(newRecord);
+ }
+
+ return result;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
* TclABCmd_Parents --
*
* This procedure is invoked to process the [addressbook parents] Tcl command.
@@ -510,10 +808,9 @@
CFArrayRef allParents;
ABRecordRef theRecord;
CONST84 char * groupUID;
- CFStringRef uidCFStr;
+ CFStringRef uidRef;
int index, kind, length;
ABAddressBookRef ab;
- TextEncoding theEncoding = GetApplicationTextEncoding();
Boolean onlyID = false;
static CONST char *parentsSwitches[] = {
@@ -541,11 +838,11 @@
ab = ABGetSharedAddressBook();
groupUID = Tcl_GetStringFromObj(objv[2], &length);
- uidCFStr = CFStringCreateWithCString(NULL, groupUID, theEncoding);
+ uidRef = CFStringCreateWithCString(NULL, groupUID, GetApplicationTextEncoding());
// Find the record corresponding to the UID
- theRecord = ABCopyRecordForUniqueId(ab, uidCFStr);
- CFRelease(uidCFStr);
+ theRecord = ABCopyRecordForUniqueId(ab, uidRef);
+ CFRelease(uidRef);
if (!theRecord) {
Tcl_AppendStringsToObj(resultPtr, "Unrecognized record ID", (char *) NULL);
return TCL_ERROR;
@@ -731,9 +1028,8 @@
ABRecordRef theRecord;
CONST84 char * var;
CONST84 char * theUID;
- CFStringRef uidCFStr;
+ CFStringRef uidRef;
int length, kind;
- TextEncoding theEncoding = GetApplicationTextEncoding();
if (objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "recordID arrayvar");
@@ -743,12 +1039,12 @@
var = Tcl_GetStringFromObj(objv[3], &length);
theUID = Tcl_GetStringFromObj(objv[2], &length);
- uidCFStr = CFStringCreateWithCString(NULL, theUID, theEncoding);
+ uidRef = CFStringCreateWithCString(NULL, theUID, GetApplicationTextEncoding());
// Get the address book
ab = ABGetSharedAddressBook();
// Find the record corresponding to the UID
- theRecord = ABCopyRecordForUniqueId(ab, uidCFStr);
- CFRelease(uidCFStr);
+ theRecord = ABCopyRecordForUniqueId(ab, uidRef);
+ CFRelease(uidRef);
if (!theRecord) {
Tcl_AppendStringsToObj(resultPtr, "Unrecognized record ID", (char *) NULL);
return TCL_ERROR;
@@ -758,6 +1054,7 @@
kind = TclAB_TypeFromRecord(ab, theRecord);
if (kind == rec_undefined) {
Tcl_AppendStringsToObj(resultPtr, "Unknown type for recordID argument", (char *) NULL);
+ CFRelease(theRecord);
return TCL_ERROR;
}
|
|
From: <bde...@us...> - 2003-12-06 15:36:42
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv23185/Source Modified Files: Changes.Log Log Message: New [import], [export] and [image] commands Index: Changes.Log =================================================================== RCS file: /cvsroot/tcladdressbook/Source/Changes.Log,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Changes.Log 5 Dec 2003 20:20:44 -0000 1.4 +++ Changes.Log 6 Dec 2003 15:36:39 -0000 1.5 @@ -32,7 +32,14 @@ ================================================================================ ================================================================================ -= 1.0d6 last update: 2003-12-04 09:55:18 += 1.0d7 last update: 2003-12-06 07:13:17 +================================================================================ + New [import] and [export] commands to transmit data in vCard format. + New [image] command to get/set the image of a person's record. + + +================================================================================ += 1.0d6 last update: 2003-12-06 07:10:21 ================================================================================ [add] command now has an -ingroup optional argument. Added -ingroup optional argument to the [persons] and [groups] commands. @@ -43,7 +50,8 @@ code and eliminate redundancies. New [add property] command to add user defined properties to person or group records. Changed [add -persons] to [add persons]. Ditto for groups. - + New [remove property] command to remove user defined properties for person or + group records. Changed [remove] to [remove record]. ================================================================================ = 1.0d5 last update: 2003-12-04 09:28:13 |
|
From: <bde...@us...> - 2003-12-06 06:23:25
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv17785/Help Modified Files: TclAddressBookHelp.html Log Message: [remove property], [image], [import], [export] Index: TclAddressBookHelp.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TclAddressBookHelp.html 4 Dec 2003 08:53:01 -0000 1.2 +++ TclAddressBookHelp.html 6 Dec 2003 06:23:22 -0000 1.3 @@ -11,7 +11,7 @@ <!-- :Author: Bernard Desgraupes <A HREF="mailto:bde...@ea...">bde...@ea...</A> --> <!-- :Homepage: <A HREF="http://webperso.easyconnect.fr/bdesgraupes/">http://webperso.easyconnect.fr/bdesgraupes/</A> --> <!-- :Created: 2003-11-26 14:30:03 --> -<!-- :Modified: 2003-11-26 14:30:14 --> +<!-- :Modified: 2003-12-04 14:12:26 --> <!-- :Keywords: Address book, data base --> @@ -54,35 +54,43 @@ <H2><A NAME="M4"></A> SUBCOMMANDS</H2> -<H5>addressbook add (-group|-person) ?-ingroup groupID?</H5> +<H5>addressbook add (group | person) <I>name</I> ?-ingroup <I>groupID</I>?</H5> + +<H5>addressbook add property (-groups|-persons) <I>propName</I> <I>propType</I></H5> <H5>addressbook changed</H5> -<H5>addressbook count (-groups|-persons)</H5> +<H5>addressbook count (-groups | -persons)</H5> -<H5>addressbook getme arrayvar</H5> +<H5>addressbook export <I>recordID</I></H5> -<H5>addressbook groups ?-ids?</H5> +<H5>addressbook getme <I>arrayvar</I></H5> -<H5>addressbook parents recordID ?-ids?</H5> +<H5>addressbook groups ?-ids? ?-ingroup <I>groupID</I>?</H5> -<H5>addressbook persons ?-ids?</H5> +<H5>addressbook image <I>recordID</I> ?<I>imageData</I>?</H5> -<H5>addressbook properties (-groups|-persons)</H5> +<H5>addressbook import <I>vCardData</I></H5> -<H5>addressbook record recordID arrayvar</H5> +<H5>addressbook parents <I>recordID</I> ?-ids?</H5> -<H5>addressbook remove recordID ?-fromgroup groupID?</H5> +<H5>addressbook persons ?-ids? ?-ingroup <I>groupID</I>?</H5> -<H5>addressbook save</H5> +<H5>addressbook properties (-groups | -persons)</H5> -<H5>addressbook search</H5> +<H5>addressbook record <I>recordID arrayvar</I></H5> -<H5>addressbook subgroups groupID ?-ids?</H5> +<H5>addressbook remove record <I>recordID</I> ?-fromgroup <I>groupID</I>?</H5> -<H5>addressbook type recordID</H5> +<H5>addressbook remove property (-groups|-persons) <I>propName</I></H5> -<H5>addressbook value recordID property ?value?</H5> +<H5>addressbook save</H5> + +<H5>addressbook search <I>property value</I> ?<I>property value</I> ...?</H5> + +<H5>addressbook type <I>recordID</I></H5> + +<H5>addressbook value <I>recordID property</I> ?<I>value</I>?</H5> <H2><A NAME="M5"></A> PORTABILITY ISSUES</H2> |
|
From: <bde...@us...> - 2003-12-06 06:23:18
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv17770/Help Modified Files: TclAddressBookHelp Log Message: [remove property], [image], [import], [export] Index: TclAddressBookHelp =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TclAddressBookHelp 4 Dec 2003 08:52:55 -0000 1.2 +++ TclAddressBookHelp 6 Dec 2003 06:23:15 -0000 1.3 @@ -5,7 +5,7 @@ Author: Bernard Desgraupes <bde...@ea...> Homepage: <http://webperso.easyconnect.fr/bdesgraupes/> Created: 2003-11-26 14:30:03 -Modified: 2003-11-26 14:30:14 +Modified: 2003-12-04 14:12:26 Keywords: Address book, data base @@ -50,31 +50,39 @@ 4. SUBCOMMANDS -addressbook add (-group|-person) ?-ingroup groupID? +addressbook add (group | person) name ?-ingroup groupID? + +addressbook add property (-groups|-persons) propName propType addressbook changed -addressbook count (-groups|-persons) +addressbook count (-groups | -persons) + +addressbook export recordID addressbook getme arrayvar -addressbook groups ?-ids? +addressbook groups ?-ids? ?-ingroup groupID? + +addressbook image recordID ?imageData? + +addressbook import vCardData addressbook parents recordID ?-ids? -addressbook persons ?-ids? +addressbook persons ?-ids? ?-ingroup groupID? -addressbook properties (-groups|-persons) +addressbook properties (-groups | -persons) addressbook record recordID arrayvar -addressbook remove recordID ?-fromgroup groupID? +addressbook remove record recordID ?-fromgroup groupID? -addressbook save +addressbook remove property (-groups|-persons) propName -addressbook search +addressbook save -addressbook subgroups groupID ?-ids? +addressbook search property value ?property value ...? addressbook type recordID |
|
From: <bde...@us...> - 2003-12-06 06:20:47
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv17539/Source Modified Files: TclAddressBook_version.h Log Message: Upped to 1.0d7 Index: TclAddressBook_version.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook_version.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TclAddressBook_version.h 4 Dec 2003 08:44:21 -0000 1.2 +++ TclAddressBook_version.h 6 Dec 2003 06:20:44 -0000 1.3 @@ -1,12 +1,12 @@ // File: "TclAddressBook_version.h" // Created: 2003-09-24 07:28:22 -// Last modification: 2003-11-30 18:35:07 +// Last modification: 2003-12-06 07:18:26 // Author: Bernard Desgraupes // Description: version numbering for Tcladdressbook #define TCLADDRESSBOOK_MAJOR 1 #define TCLADDRESSBOOK_MINOR 0 -#define TCLADDRESSBOOK_SUBMINOR 6 +#define TCLADDRESSBOOK_SUBMINOR 7 #define TCLADDRESSBOOK_STAGE 'd' // 'd' for developStage // 'a' for alphaStage |
|
From: <bde...@us...> - 2003-12-06 06:20:33
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv17487/Source Modified Files: TclAddressBookUtils.h Log Message: [remove property] Index: TclAddressBookUtils.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TclAddressBookUtils.h 5 Dec 2003 20:22:49 -0000 1.1 +++ TclAddressBookUtils.h 6 Dec 2003 06:20:30 -0000 1.2 @@ -75,6 +75,10 @@ int TclAB_AddProperty(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); +int TclAB_RemoveRecord(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); + +int TclAB_RemoveProperty(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr); + extern Tcl_Obj * TclLindexList(Tcl_Interp* interp, Tcl_Obj* listPtr, |
|
From: <bde...@us...> - 2003-12-06 06:20:27
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv17467/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
[remove property]
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- TclAddressBookUtils.c 5 Dec 2003 20:22:42 -0000 1.1
+++ TclAddressBookUtils.c 6 Dec 2003 06:20:24 -0000 1.2
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBookUtils.c"
* Created: 2003-12-05 10:08:03
- * Last modification: 2003-12-05 10:27:15
+ * Last modification: 2003-12-06 06:35:27
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -17,7 +17,7 @@
*/
-// TclAddressBookUtils.h included in precompiled header
+/* TclAddressBookUtils.h included in precompiled header */
// #include "TclAddressBookUtils.h"
@@ -945,18 +945,11 @@
int theInt;
SInt32 theSInt32;
TextEncoding theEncoding = GetApplicationTextEncoding();
- char thePropName[256];
- char * test;
-
static CONST char *addpropSwitches[] = {
"-groups", "-persons", (char *) NULL
};
- enum {
- TCLAB_ADDPROP_GROUPS, TCLAB_ADDPROP_PERSONS
- };
-
static CONST char *typeSwitches[] = {
"Array", "Data", "Date", "Dictionary", "Integer", "Real", "String",
"MultiArray","MultiData", "MultiDate", "MultiDictionary",
@@ -980,16 +973,14 @@
kABMultiStringProperty
};
+ Tcl_ResetResult(interp);
+
if (objc != 6) {
Tcl_WrongNumArgs(interp, 2, objv, "property (-groups|-persons) propName propType");
return TCL_ERROR;
}
Tcl_IncrRefCount(objv[4]);
-// test = Tcl_GetStringFromObj(objv[4], &length);
-//
-// BlockMoveData(test, thePropName, length);
-// thePropName[length] = 0;
if (Tcl_GetIndexFromObj(interp, objv[3], addpropSwitches, "option", 0, &kind) != TCL_OK) {
return TCL_ERROR;
@@ -1011,12 +1002,7 @@
CFDictionaryAddValue(theDict, theKey, theValue);
// Add the property to the Address Book
- if (kind == rec_person) {
- result = ABAddPropertiesAndTypes(ab, kABPersonRecordType, theDict);
- } else {
- result = ABAddPropertiesAndTypes(ab, kABGroupRecordType, theDict);
- }
- if ( !result ) {
+ if ( !ABAddPropertiesAndTypes(ab, kind ? kABPersonRecordType : kABGroupRecordType, theDict) ) {
Tcl_AppendStringsToObj(resultPtr, "Couldn't add new property for ",
kind ? "Person":"Group" , " records", (char *) NULL);
result = TCL_ERROR;
@@ -1026,6 +1012,207 @@
Tcl_DecrRefCount(objv[4]);
CFRelease(theKey);
+ CFRelease(theValue);
CFRelease(theDict);
return result;
}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclAB_RemoveRecord --
+ *
+ * This procedure is invoked to process the [addressbook remove] Tcl command.
+ * See the user documentation for details on what it does.
+ * - if -fromgroup is specified, remove recordID from the group: recordID can be
+ * either a person (remove it as a member of the group) or a group (remove it as
+ * a subgroup of the group)
+ * - otherwise, remove recordID from the database.
+ *
+ * Syntax:
+ * addressbook remove person recordID ?-fromgroup groupID?
+ * addressbook remove group recordID ?-fromgroup groupID?
+ * addressbook remove record recordID ?-fromgroup groupID?
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+
+int
+TclAB_RemoveRecord(
+ 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, fromGroup;
+ CONST84 char * directUID;
+ CONST84 char * fromUID;
+ CFStringRef directCFStr;
+ int length, kind, result;
+ TextEncoding theEncoding = GetApplicationTextEncoding();
+ Boolean removingFromGroup = false;
+
+ static CONST char *removerecSwitches[] = {
+ "-ingroup", (char *) NULL
+ };
+
+ if (objc != 3 && objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "record recordID ?-fromgroup groupID?");
+ return TCL_ERROR;
+ }
+
+ if (objc == 5) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], removerecSwitches, "option", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ } else {
+ fromUID = Tcl_GetStringFromObj(objv[4], &length);
+ removingFromGroup = true;
+ }
+ }
+
+ result = TCL_OK;
+ directUID = Tcl_GetStringFromObj(objv[2], &length);
+
+ // Get the address book
+ ab = ABGetSharedAddressBook();
+
+ directCFStr = CFStringCreateWithCString(NULL, directUID, theEncoding);
+ // Find the record corresponding to the UID
+ theRecord = ABCopyRecordForUniqueId(ab, directCFStr);
+ CFRelease(directCFStr);
+ if (!theRecord) {
+ Tcl_AppendStringsToObj(resultPtr, "Unrecognized record ID", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ if (removingFromGroup) {
+ if ( !TclAB_CheckGroup(interp, ab, fromUID, "-fromgroup", &fromGroup) ) {
+ result = TCL_ERROR;
+ goto DONE;
+ }
+
+ // Is recordID a person or a group?
+ kind = TclAB_TypeFromRecord(ab, theRecord);
+ switch (kind) {
+ case rec_person:
+ if (!ABGroupRemoveMember(fromGroup, theRecord)) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't remove member from group", (char *) NULL);
+ result = TCL_ERROR;
+ }
+ break;
+
+ case rec_group:
+ if (!ABGroupRemoveGroup(fromGroup, theRecord)) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't remove subgroup from group", (char *) NULL);
+ result = TCL_ERROR;
+ }
+ break;
+
+ default:
+ Tcl_AppendStringsToObj(resultPtr, "Unknown type for recordID argument", (char *) NULL);
+ result = TCL_ERROR;
+ break;
+ }
+ CFRelease(fromGroup);
+ } else {
+ if (!ABRemoveRecord(ab, theRecord)) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't remove record from database", (char *) NULL);
+ result = TCL_ERROR;
+ }
+ }
+
+DONE:
+ CFRelease(theRecord);
+ return result;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclAB_RemoveProperty --
+ *
+ * This function is invoked to process the [addressbook remove property]
+ * Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Syntax:
+ * addressbook remove property (-groups|-persons) propName
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclAB_RemoveProperty(
+ 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;
+ CFStringRef theProp;
+ CFMutableArrayRef theArray;
+ int index, kind, length, result;
+ int theInt;
+ SInt32 theSInt32;
+ char * propName;
+
+ static CONST char *removepropSwitches[] = {
+ "-groups", "-persons", (char *) NULL
+ };
+
+ Tcl_ResetResult(interp);
+
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "property (-groups|-persons) propName");
+ return TCL_ERROR;
+ }
+
+ Tcl_IncrRefCount(objv[4]);
+ propName = Tcl_GetStringFromObj(objv[4], &length);
+
+ if (Tcl_GetIndexFromObj(interp, objv[3], removepropSwitches, "option", 0, &kind) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ // Get the address book
+ ab = ABGetSharedAddressBook();
+
+ // Create a CFArray
+ theArray = CFArrayCreateMutable(NULL, 0, NULL);
+ theProp = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(objv[4], &length), GetApplicationTextEncoding());
+ // Populate the CFArray with the property pair
+ CFArrayAppendValue(theArray, theProp);
+
+ // Add the property to the Address Book
+ result = ABRemoveProperties(ab, kind ? kABPersonRecordType : kABGroupRecordType, theArray);
+ if ( !result ) {
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't remove property '",
+ propName, "' for ", kind ? "Person":"Group" , " records", (char *) NULL);
+ result = TCL_ERROR;
+ } else {
+ result = TCL_OK;
+ }
+
+ Tcl_DecrRefCount(objv[4]);
+ CFRelease(theProp);
+ CFRelease(theArray);
+ return result;
+}
+
+
|
|
From: <bde...@us...> - 2003-12-06 06:19:46
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv17339/Source
Modified Files:
TclAddressBook.c
Log Message:
[remove property]
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- TclAddressBook.c 5 Dec 2003 20:21:30 -0000 1.8
+++ TclAddressBook.c 6 Dec 2003 06:19:43 -0000 1.9
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBook.c"
* Created: 2003-11-26 12:54:15
- * Last modification: 2003-12-05 10:26:56
+ * Last modification: 2003-12-06 06:36:29
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -18,7 +18,7 @@
*/
-// TclAddressBookUtils.h included in precompiled header
+/* TclAddressBookUtils.h included in precompiled header */
// #include "TclAddressBookUtils.h"
/*
@@ -775,15 +775,18 @@
*
* TclABCmd_Remove --
*
- * This procedure is invoked to process the [addressbook remove] Tcl command.
+ * This procedure is invoked to process the [addressbook remove record] and
+ * the the [addressbook remove property] Tcl commands.
* See the user documentation for details on what it does.
* - if -fromgroup is specified, remove recordID from the group: recordID can be
* either a person (remove it as a member of the group) or a group (remove it as
* a subgroup of the group)
- * - otherwise, remove recordID from the database. What if recordID is a group ?
+ * - otherwise, remove recordID from the database.
+ * - [remove property] removes a property for the specified type of record
*
* Syntax:
- * addressbook remove recordID ?-fromgroup groupID?
+ * addressbook remove record recordID ?-fromgroup groupID?
+ * addressbook remove property (-groups|-persons) propName
*
* Results:
* A standard Tcl result.
@@ -803,90 +806,32 @@
Tcl_Obj *CONST objv[], /* Argument values. */
Tcl_Obj *resultPtr) /* Pointer to store the result. */
{
- ABAddressBookRef ab;
- ABRecordRef theRecord, fromGroup;
- CONST84 char * directUID;
- CONST84 char * fromUID;
- CFStringRef directCFStr;
- int length, kind, result;
- TextEncoding theEncoding = GetApplicationTextEncoding();
- Boolean removingFromGroup = false;
+ int index, result;
- static CONST char *removeSwitches[] = {
- "-fromgroup", (char *) NULL
+ static CONST char *removeSubcmds[] = {
+ "record", "property", (char *) NULL
};
enum {
- TCLAB_REMOVE_FROMGROUP
+ TCLAB_REMOVE_RECORD, TCLAB_REMOVE_PROPERTY
};
- if (objc != 3 && objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "recordID ?-fromgroup groupID?");
+ if (objc < 4 || objc > 6) {
+ Tcl_WrongNumArgs(interp, 2, objv, "(record|property) args");
return TCL_ERROR;
}
-
- if (objc == 5) {
- if (Tcl_GetIndexFromObj(interp, objv[3], removeSwitches, "option", 0, &index) != TCL_OK) {
- return TCL_ERROR;
- } else {
- fromUID = Tcl_GetStringFromObj(objv[4], &length);
- removingFromGroup = true;
- }
- }
-
- result = TCL_OK;
- directUID = Tcl_GetStringFromObj(objv[2], &length);
-
- // Get the address book
- ab = ABGetSharedAddressBook();
-
- directCFStr = CFStringCreateWithCString(NULL, directUID, theEncoding);
- // Find the record corresponding to the UID
- theRecord = ABCopyRecordForUniqueId(ab, directCFStr);
- CFRelease(directCFStr);
- if (!theRecord) {
- Tcl_AppendStringsToObj(resultPtr, "Unrecognized record ID", (char *) NULL);
+
+ if (Tcl_GetIndexFromObj(interp, objv[2], removeSubcmds, "subcommand", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
- if (removingFromGroup) {
- if ( !TclAB_CheckGroup(interp, ab, fromUID, "-fromgroup", &fromGroup) ) {
- result = TCL_ERROR;
- goto DONE;
- }
+ switch (index) {
+ case TCLAB_REMOVE_RECORD:
+ result = TclAB_RemoveRecord(interp, objc, objv, resultPtr);
- // Is recordID a person or a group?
- kind = TclAB_TypeFromRecord(ab, theRecord);
- switch (kind) {
- case rec_person:
- if (!ABGroupRemoveMember(fromGroup, theRecord)) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't remove member from group", (char *) NULL);
- result = TCL_ERROR;
- }
- break;
-
- case rec_group:
- if (!ABGroupRemoveGroup(fromGroup, theRecord)) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't remove subgroup from group", (char *) NULL);
- result = TCL_ERROR;
- }
- break;
-
- default:
- Tcl_AppendStringsToObj(resultPtr, "Unknown type for recordID argument", (char *) NULL);
- result = TCL_ERROR;
- break;
- }
- CFRelease(fromGroup);
- } else {
- if (!ABRemoveRecord(ab, theRecord)) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't remove record from database", (char *) NULL);
- result = TCL_ERROR;
- }
+ case TCLAB_REMOVE_PROPERTY:
+ result = TclAB_RemoveProperty(interp, objc, objv, resultPtr);
}
-
-DONE:
- CFRelease(theRecord);
return result;
}
|
|
From: <bde...@us...> - 2003-12-05 20:23:37
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv22817/Source
Modified Files:
TclAddressBook.xml
Log Message:
Added TclAddressBookUtils.c and TclAddressBookUtils.h
Index: TclAddressBook.xml
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- TclAddressBook.xml 2 Dec 2003 15:25:48 -0000 1.1
+++ TclAddressBook.xml 5 Dec 2003 20:23:34 -0000 1.2
@@ -747,7 +747,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
- <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0ÿÄ`</VALUE></SETTING>
+ <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0ÿÄ`~ݐ)¤Ô</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@@ -1285,6 +1285,13 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
+ <FILE>
+ <PATHTYPE>Name</PATHTYPE>
+ <PATH>TclAddressBookUtils.c</PATH>
+ <PATHFORMAT>Unix</PATHFORMAT>
+ <FILEKIND>Text</FILEKIND>
+ <FILEFLAGS>Debug</FILEFLAGS>
+ </FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@@ -1307,6 +1314,11 @@
<PATH>TclAddressBook.pch</PATH>
<PATHFORMAT>Unix</PATHFORMAT>
</FILEREF>
+ <FILEREF>
+ <PATHTYPE>Name</PATHTYPE>
+ <PATH>TclAddressBookUtils.c</PATH>
+ <PATHFORMAT>Unix</PATHFORMAT>
+ </FILEREF>
</LINKORDER>
<FRAMEWORKLIST>
<FRAMEWORK>
@@ -2053,7 +2065,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
- <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0ÿÄ`</VALUE></SETTING>
+ <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0ÿÄ`~ݐ)¤Ô</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@@ -2591,6 +2603,13 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
+ <FILE>
+ <PATHTYPE>Name</PATHTYPE>
+ <PATH>TclAddressBookUtils.c</PATH>
+ <PATHFORMAT>Unix</PATHFORMAT>
+ <FILEKIND>Text</FILEKIND>
+ <FILEFLAGS>Debug</FILEFLAGS>
+ </FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@@ -2613,6 +2632,11 @@
<PATH>TclAddressBook.pch</PATH>
<PATHFORMAT>Unix</PATHFORMAT>
</FILEREF>
+ <FILEREF>
+ <PATHTYPE>Name</PATHTYPE>
+ <PATH>TclAddressBookUtils.c</PATH>
+ <PATHFORMAT>Unix</PATHFORMAT>
+ </FILEREF>
</LINKORDER>
<FRAMEWORKLIST>
<FRAMEWORK>
@@ -2686,6 +2710,12 @@
<TARGETNAME>TclAddressBook Dylib</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>TclAddressBook.c</PATH>
+ <PATHFORMAT>Unix</PATHFORMAT>
+ </FILEREF>
+ <FILEREF>
+ <TARGETNAME>TclAddressBook Dylib</TARGETNAME>
+ <PATHTYPE>Name</PATHTYPE>
+ <PATH>TclAddressBookUtils.c</PATH>
<PATHFORMAT>Unix</PATHFORMAT>
</FILEREF>
</GROUP>
|
|
From: <bde...@us...> - 2003-12-05 20:23:10
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv22771/Source Modified Files: TclAddressBook.pch Log Message: TclAddressBookUtils.h Index: TclAddressBook.pch =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.pch,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- TclAddressBook.pch 1 Dec 2003 16:46:11 -0000 1.1.1.1 +++ TclAddressBook.pch 5 Dec 2003 20:23:05 -0000 1.2 @@ -1,6 +1,6 @@ // File: "TclAddressBook_CarbonMachO.pch" // Created: 2003-09-22 10:47:15 -// Last modification: 2003-11-28 09:33:20 +// Last modification: 2003-12-05 10:27:22 // Author: Bernard Desgraupes // Description: Use this header to include the precompiled headers // on OSX for dylib target built with CW Pro 8 @@ -68,3 +68,4 @@ #endif #include "TclAddressBook_version.h" +#include "TclAddressBookUtils.h" |
|
From: <bde...@us...> - 2003-12-05 20:22:52
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv22690/Source
Added Files:
TclAddressBookUtils.h
Log Message:
Redispatched funcs. Implements [add property]
--- NEW FILE: TclAddressBookUtils.h ---
/*
* File : "TclAddressBookUtils.h"
* Created: 2003-12-05 10:05:19
* Last modification: 2003-12-04 18:03:13
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
* Header file for TclAddressBookUtils.c
*
* (c) Copyright : Bernard Desgraupes, 2003
* All rights reserved.
* This software is free software with BSD licence.
* Versions history: see the Changes.Log file.
*
* $Date: 2003/12/05 20:22:49 $
* $Revision: 1.1 $
*/
#ifndef TCLADDRESSBOOKUTILS_H
#define TCLADDRESSBOOKUTILS_H
/*
* Enumerated values to designate the type of records
*/
static enum {
rec_undefined = -1,
rec_group = 0,
rec_person
} recordType;
/*
* Prototypes for the functions
*/
int TclAB_TypeFromRecord(ABAddressBookRef ab, ABRecordRef inRecord);
void TclAB_GetAllValues(Tcl_Interp *interp,
ABAddressBookRef ab,
ABRecordRef inRecord,
CONST84 char * inVar,
int inRecordType);
void TclAB_GetValue(Tcl_Interp *interp,
ABAddressBookRef ab,
CFStringRef theProperty,
CFStringRef theValue,
CONST84 char * var,
int inRecordType);
Boolean TclAB_SetValue(Tcl_Interp *interp,
ABRecordRef theRecord,
CFStringRef inProperty,
CONST84 char * inValue,
ABPropertyType inPropType);
void TclAB_ResultListFromCFArray(Tcl_Interp *interp,
Tcl_Obj *resultPtr,
CFArrayRef allSubGroups,
Boolean onlyID,
int inRecordType);
int TclAB_ListItems(Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[],
Tcl_Obj *resultPtr,
int inRecordType);
void TclAB_SetArrayOrResult(Tcl_Interp *interp, CONST84 char * inVar, char * inPropName, char * inStr);
Boolean TclAB_CheckGroup(Tcl_Interp *interp, ABAddressBookRef ab, CONST84 char * inGroupUID,
CONST84 char * option, ABRecordRef * outGroupRef);
int TclAB_AddRecord(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr, int inRecordType);
int TclAB_AddProperty(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *resultPtr);
extern Tcl_Obj * TclLindexList(Tcl_Interp* interp,
Tcl_Obj* listPtr,
Tcl_Obj* argPtr );
#endif // TCLADDRESSBOOKUTILS_H
|
|
From: <bde...@us...> - 2003-12-05 20:22:45
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv22667/Source
Added Files:
TclAddressBookUtils.c
Log Message:
Redispatched funcs. Implements [add property]
--- NEW FILE: TclAddressBookUtils.c ---
/*
* File : "TclAddressBookUtils.c"
* Created: 2003-12-05 10:08:03
* Last modification: 2003-12-05 10:27:15
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
* Utility functions called by the TclABCmd command functions
*
* (c) Copyright : Bernard Desgraupes, 2003
* All rights reserved.
* This software is free software with BSD licence.
* Versions history: see the Changes.Log file.
*
* $Date: 2003/12/05 20:22:42 $
* $Revision: 1.1 $
*/
[...992 lines suppressed...]
// Add the property to the Address Book
if (kind == rec_person) {
result = ABAddPropertiesAndTypes(ab, kABPersonRecordType, theDict);
} else {
result = ABAddPropertiesAndTypes(ab, kABGroupRecordType, theDict);
}
if ( !result ) {
Tcl_AppendStringsToObj(resultPtr, "Couldn't add new property for ",
kind ? "Person":"Group" , " records", (char *) NULL);
result = TCL_ERROR;
} else {
result = TCL_OK;
}
Tcl_DecrRefCount(objv[4]);
CFRelease(theKey);
CFRelease(theDict);
return result;
}
|
|
From: <bde...@us...> - 2003-12-05 20:21:35
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv22505/Source
Modified Files:
TclAddressBook.c
Log Message:
Split file.
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- TclAddressBook.c 5 Dec 2003 09:14:12 -0000 1.7
+++ TclAddressBook.c 5 Dec 2003 20:21:30 -0000 1.8
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBook.c"
* Created: 2003-11-26 12:54:15
- * Last modification: 2003-12-04 18:03:13
+ * Last modification: 2003-12-05 10:26:56
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -18,18 +18,8 @@
*/
[...1116 lines suppressed...]
- // Find the record corresponding to the UID
- *outGroupRef = ABCopyRecordForUniqueId(ab, groupCFStr);
- CFRelease(groupCFStr);
- if (!*outGroupRef) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "Unrecognized record ID in ", option,
- " argument", (char *) NULL);
- result = false;
- } else {
- // Is it really a group?
- kind = TclAB_TypeFromRecord(ab, *outGroupRef);
- if (kind != rec_group) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "Not a group ID in ", option,
- " argument", (char *) NULL);
- CFRelease(groupCFStr);
- result = false;
- }
- }
-
- return result;
-}
|
|
From: <bde...@us...> - 2003-12-05 20:20:49
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv22378/Source Modified Files: Changes.Log Log Message: [add property] Index: Changes.Log =================================================================== RCS file: /cvsroot/tcladdressbook/Source/Changes.Log,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Changes.Log 4 Dec 2003 14:30:04 -0000 1.3 +++ Changes.Log 5 Dec 2003 20:20:44 -0000 1.4 @@ -41,6 +41,9 @@ undefined in Jaguar. The extension should work now on Jaguar. Replaced TclAB_TypeFromUID() by TclAB_TypeFromRecord() to streamline the code and eliminate redundancies. + New [add property] command to add user defined properties to person or + group records. Changed [add -persons] to [add persons]. Ditto for groups. + ================================================================================ = 1.0d5 last update: 2003-12-04 09:28:13 |