From: znek Date: Thu, 14 Oct 2004 21:01:23 +0000 (+0000) Subject: import of overhauled version of versitSaxDriver X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0845f165ed702b7887d2a57ee8e8a87b658b1235;p=sope import of overhauled version of versitSaxDriver git-svn-id: http://svn.opengroupware.org/SOPE/trunk@257 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-ical/NGiCal/NGiCal.xmap b/sope-ical/NGiCal/NGiCal.xmap index 8e7a4546..1473190c 100644 --- a/sope-ical/NGiCal/NGiCal.xmap +++ b/sope-ical/NGiCal/NGiCal.xmap @@ -161,6 +161,7 @@ status = { class = NSString; }; transp = { class = NSString; }; sequence = { class = NSString; }; + categories = { class = NSString; }; class = { class = NSString; key = accessClass; }; percent-complete = { class = NSString; key = "percentComplete"; }; diff --git a/sope-ical/iCalSaxDriver/iCalSaxDriver.xcode/project.pbxproj b/sope-ical/iCalSaxDriver/iCalSaxDriver.xcode/project.pbxproj index c2828143..668d0989 100644 --- a/sope-ical/iCalSaxDriver/iCalSaxDriver.xcode/project.pbxproj +++ b/sope-ical/iCalSaxDriver/iCalSaxDriver.xcode/project.pbxproj @@ -155,7 +155,7 @@ GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PRECOMPILE_PREFIX_HEADER = NO; INFOPLIST_FILE = "iCalSaxDriver-Info.plist"; - INSTALL_PATH = "$(USER_LIBRARY_DIR)/SaxDrivers"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/SaxDrivers-4.3"; OTHER_CFLAGS = "-DXCODE_BUILD=1"; PRODUCT_NAME = iCalSaxDriver; WARNING_CFLAGS = "-Wmost"; @@ -186,12 +186,6 @@ ADBE0C1406D78ED2007C5267, ADBE0C1606D78ED2007C5267, ADBE0C1806D78ED2007C5267, - ADBE0C1906D78ED2007C5267, - ADBE0C1A06D78ED2007C5267, - ADBE0C1B06D78ED2007C5267, - ADBE0C1C06D78ED2007C5267, - ADBE0C1D06D78ED2007C5267, - ADBE0C1E06D78ED2007C5267, ADBE0C1F06D78ED2007C5267, ADBE0C2006D78ED2007C5267, ADBE0C2106D78ED2007C5267, @@ -306,28 +300,37 @@ sourceTree = ""; }; ADBE0BF506D78ED1007C5267 = { - fileEncoding = 4; + explicitFileType = sourcecode.make; + fileEncoding = 5; + indentWidth = 8; isa = PBXFileReference; - lastKnownFileType = text; path = GNUmakefile; refType = 4; sourceTree = ""; + tabWidth = 8; + usesTabs = 1; }; ADBE0BF606D78ED1007C5267 = { - fileEncoding = 4; + explicitFileType = sourcecode.make; + fileEncoding = 5; + indentWidth = 8; isa = PBXFileReference; - lastKnownFileType = text; path = GNUmakefile.postamble; refType = 4; sourceTree = ""; + tabWidth = 8; + usesTabs = 1; }; ADBE0BF706D78ED1007C5267 = { - fileEncoding = 4; + explicitFileType = sourcecode.make; + fileEncoding = 5; + indentWidth = 8; isa = PBXFileReference; - lastKnownFileType = text; path = GNUmakefile.preamble; refType = 4; sourceTree = ""; + tabWidth = 8; + usesTabs = 1; }; ADBE0BF806D78ED1007C5267 = { fileEncoding = 4; @@ -458,12 +461,14 @@ sourceTree = ""; }; ADBE0C0806D78ED2007C5267 = { + explicitFileType = sourcecode.make; fileEncoding = 4; + indentWidth = 8; isa = PBXFileReference; - lastKnownFileType = text; path = Version; refType = 4; sourceTree = ""; + tabWidth = 8; }; ADBE0C0906D78ED2007C5267 = { fileRef = ADBE0BF006D78ED1007C5267; @@ -561,42 +566,6 @@ settings = { }; }; - ADBE0C1906D78ED2007C5267 = { - fileRef = ADBE0C0006D78ED1007C5267; - isa = PBXBuildFile; - settings = { - }; - }; - ADBE0C1A06D78ED2007C5267 = { - fileRef = ADBE0C0106D78ED1007C5267; - isa = PBXBuildFile; - settings = { - }; - }; - ADBE0C1B06D78ED2007C5267 = { - fileRef = ADBE0C0206D78ED1007C5267; - isa = PBXBuildFile; - settings = { - }; - }; - ADBE0C1C06D78ED2007C5267 = { - fileRef = ADBE0C0306D78ED1007C5267; - isa = PBXBuildFile; - settings = { - }; - }; - ADBE0C1D06D78ED2007C5267 = { - fileRef = ADBE0C0406D78ED1007C5267; - isa = PBXBuildFile; - settings = { - }; - }; - ADBE0C1E06D78ED2007C5267 = { - fileRef = ADBE0C0506D78ED2007C5267; - isa = PBXBuildFile; - settings = { - }; - }; ADBE0C1F06D78ED2007C5267 = { fileRef = ADBE0C0606D78ED2007C5267; isa = PBXBuildFile; @@ -618,8 +587,8 @@ ADBE0CB306D79080007C5267 = { children = ( ADBE0BF506D78ED1007C5267, - ADBE0BF606D78ED1007C5267, ADBE0BF706D78ED1007C5267, + ADBE0BF606D78ED1007C5267, ); isa = PBXGroup; name = Makefiles; diff --git a/sope-ical/versitSaxDriver/AUTHORS b/sope-ical/versitSaxDriver/AUTHORS new file mode 100644 index 00000000..5a4b2257 --- /dev/null +++ b/sope-ical/versitSaxDriver/AUTHORS @@ -0,0 +1,2 @@ +Max Berger +Marcus Mueller diff --git a/sope-ical/versitSaxDriver/COPYING b/sope-ical/versitSaxDriver/COPYING new file mode 100644 index 00000000..1adca665 --- /dev/null +++ b/sope-ical/versitSaxDriver/COPYING @@ -0,0 +1,437 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/sope-ical/versitSaxDriver/COPYRIGHT b/sope-ical/versitSaxDriver/COPYRIGHT new file mode 100644 index 00000000..2a5be29f --- /dev/null +++ b/sope-ical/versitSaxDriver/COPYRIGHT @@ -0,0 +1,4 @@ +Copyright (C) 2003-2004 Max Berger +Copyright (C) 2004 OpenGroupware.org + +Contact: info@opengroupware.org diff --git a/sope-ical/versitSaxDriver/ChangeLog b/sope-ical/versitSaxDriver/ChangeLog new file mode 100644 index 00000000..2b8b1f7e --- /dev/null +++ b/sope-ical/versitSaxDriver/ChangeLog @@ -0,0 +1,156 @@ +2004-10-14 Marcus Mueller + + * v1.0.0 + + * README, COPYRIGHT, COPYING, AUTHORS: new files + + * VersitSaxDriver.[hm]: renamed to VSSaxDriver.[hm] + + * ICalendarSaxDriver.[hm]: renamed to VSiCalSaxDriver.[hm] + + * VCardSaxDriver.[hm]: renamed to VSvCardSaxDriver.[hm] + + * ICalendarSaxDriver.[hm]: renamed to VSiCalSaxDriver.[hm] + + * VSSaxDriver.m: Major cleanups, cache all character sets as class + variables, rewrote _parseString: to properly do unfolding. Bugfixes. + + * VSiCalSaxDriver.m, VSvCardSaxDriver.m: cache character sets, cleanup, + minor fixes. + + * bundle-info.plist: adjusted names + +2004-04-09 Max Berger + + * fixed another bug related to libFoundation that applied to + NSMutableCharacterSet (v0.1.18) + +2004-02-24 Max Berger + + * fixed bug to crash on libFoundation in scanner line (v0.1.17) + +2004-02-25 Helge Hess + + * v0.1.16 + + * GNUmakefile.preamble: properly link with OGo gstep-make + + * added a common.h file (and use that in the source files) + + * VersitSaxDriver.m: fixed type, fixed a "==" vs "=" bug in -init, + minor code cleanups + +2004-02-24 Max Berger + + * v0.1.15 + + * added new initialize function to check for debug property + + * added debug messages to parseFromSource + + * updated Copyright in VersitSaxDriver.m + +2003-12-13 Max Berger + + * replaces commas by spaces in attrs (as in spec) (v0.1.15) + +2003-12-13 Max Berger + + * v0.1.14 + + * added support for apple item1.adr elements + + * added support for multiple attributes of same type + + +2003-12-12 Max Berger + + * added support for subitems, added subitems for ical and vcard (v0.1.13) + +2003-12-12 Max Berger + + * added mappings into vcard driver (v0.1.12) + +2003-12-11 Max Berger + + * collapsed drivers for vcard 21 and 30 (v0.1.11) + +2003-12-11 Max Berger + + * fixed range check (v0.1.10) + +2003-12-11 Max Berger + + * fixed another missing () in malloc (v0.1.9) + +2003-12-11 Max Berger + + * fixed a missing () in malloc (v0.1.8) + +2003-12-11 Helge Hess + + * v0.1.7 + + * minor tweaks to sourcecode style ;-) + + * created GNUmakefile's + +2003-11-23 Max Berger + + * v0.1.6 + + * added GNUmakefile for unix + + * fixed bundle-info.plist + + * fixed a bug that caused libFondation to crash + +2003-11-23 Max Berger + + * v0.1.5 + + * Implemented attribute mapping + + * Added list of attributes for xcal + +2003-11-23 Max Berger + + * v0.1.4 + + * implemented handling via list and stack + + * added support for name mapping and mapping to attributes + + * added complete iCalendar Name mapping + +2003-11-23 Max Berger + + * v0.1.3 + + * VersitSaxDriver.m: Split up in lines works correctly + + * VersitSaxDriver: added support for contentHandler + + * VersitSaxDriver: added support for namespace + + * VersitSaxDriver: now has begin/end document + + * ICalendarSaxDriver: now set correct namespace + + * VersitSaxDriver: now parses Tags, attibutes and values + +2003-11-23 Max Berger + + * v0.1.2 + + * fixed Copyright notice + + * added Data Retrieval + + * added unfold method (doesnt do anything yet) + + +2003-11-23 Max Berger + + * Initial Version (v0.1.1) + diff --git a/sope-ical/versitSaxDriver/GNUmakefile b/sope-ical/versitSaxDriver/GNUmakefile new file mode 100644 index 00000000..21ac77c9 --- /dev/null +++ b/sope-ical/versitSaxDriver/GNUmakefile @@ -0,0 +1,18 @@ +# $Id$ + +include $(GNUSTEP_MAKEFILES)/common.make + +BUNDLE_NAME = versitSaxDriver +BUNDLE_EXTENSION = .sax +BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SaxDrivers-4.3 + +versitSaxDriver_OBJC_FILES = \ + VSSaxDriver.m \ + VSiCalSaxDriver.m \ + VSvCardSaxDriver.m \ + +versitSaxDriver_RESOURCE_FILES = bundle-info.plist + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/bundle.make +-include GNUmakefile.postamble diff --git a/sope-ical/versitSaxDriver/GNUmakefile.postamble b/sope-ical/versitSaxDriver/GNUmakefile.postamble new file mode 100644 index 00000000..358256ed --- /dev/null +++ b/sope-ical/versitSaxDriver/GNUmakefile.postamble @@ -0,0 +1,5 @@ +# $Id$ + +after-all :: + @(cp bundle-info.plist \ + $(GNUSTEP_BUILD_DIR)/$(BUNDLE_NAME)$(BUNDLE_EXTENSION)) diff --git a/sope-ical/versitSaxDriver/GNUmakefile.preamble b/sope-ical/versitSaxDriver/GNUmakefile.preamble new file mode 100644 index 00000000..65d38ad9 --- /dev/null +++ b/sope-ical/versitSaxDriver/GNUmakefile.preamble @@ -0,0 +1,4 @@ +# $Id$ + +BUNDLE_LIBS += -lSaxObjC +ADDITIONAL_BUNDLE_LIBS += $(BUNDLE_LIBS) diff --git a/sope-ical/versitSaxDriver/README b/sope-ical/versitSaxDriver/README new file mode 100644 index 00000000..3abf860e --- /dev/null +++ b/sope-ical/versitSaxDriver/README @@ -0,0 +1,40 @@ +# $Id$ + +Overview +======== + +Two SaxObjC drivers for iCalendar and vCard files, initially written by +Max Berger . + +VSiCalSaxDriver basically maps iCal 2.0 components, properties and parameters +to the XML events according to the xCal 02 draft (iCal 3.0). + +Having a SAX driver for iCal might seem strange and a bit inefficient at +first look, but the time saved for the application-level developer is +significant, since he only needs to learn (or usually already knows) the +SAX or DOM APIs and any XML API based on them (like XPATH, XQUERY). + +The VSiCalSaxDriver is aimed to be a replacement for the older (but better +tested as of now) iCalSaxDriver. However, the iCalSaxDriver depends on the +abandoned and hardly maintainable libical, which itself is an additional +dependency to the OGo project and thus a welcome candidate for replacement. + + +ToDo +==== + +- improve error handling (SaxExceptions !) +- make the driver fully xCal compliant + + +Examples +======== + +To "convert" an iCalendar to xCal (the test programs print out some XML): + + saxxml -XMLReader iCalSaxDriver test1.ics + domxml -XMLReader iCalSaxDriver -xml test1.ics + +To "convert" an iCalendar to PYX: + + domxml -XMLReader iCalSaxDriver -pyx test1.ics diff --git a/sope-ical/versitSaxDriver/VSSaxDriver.h b/sope-ical/versitSaxDriver/VSSaxDriver.h new file mode 100644 index 00000000..0f79e610 --- /dev/null +++ b/sope-ical/versitSaxDriver/VSSaxDriver.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2003-2004 Max Berger + Copyright (C) 2004 OpenGroupware.org + + This file is part of versitSaxDriver, written for the OpenGroupware.org + project (OGo). + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + */ +// $Id$ + +#ifndef __versitSaxDriver_VSSaxDriver_H__ +#define __versitSaxDriver_VSSaxDriver_H__ + +#import + +#include + +@interface VSSaxDriver : NSObject < SaxXMLReader > +{ + id contentHandler; + NSString *prefixURI; + NSMutableArray *cardStack; + NSMutableArray *elementList; + + NSSet *attributeElements; + NSDictionary *elementMapping; + + NSMutableDictionary *attributeMapping; + NSMutableDictionary *subItemMapping; +} + +- (NSSet *)attributeElements; +- (void)setAttributeElements:(NSSet *)_elements; + +- (NSDictionary *)elementMapping; +- (void)setElementMapping:(NSDictionary *)_mapping; + +- (NSString *)prefixURI; +- (void)setPrefixURI:(NSString*)_uri; + +- (void)setAttributeMapping:(NSDictionary *)_mapping; +- (void)setAttributeMapping:(NSDictionary *)_mapping + forElement:(NSString *)_element; + +- (void)setSubItemMapping:(NSArray *)_mapping + forElement:(NSString *)_element; + +@end + +#endif /* __versitSaxDriver_VersitSaxDriver_H__ */ diff --git a/sope-ical/versitSaxDriver/VSSaxDriver.m b/sope-ical/versitSaxDriver/VSSaxDriver.m new file mode 100644 index 00000000..d0922f19 --- /dev/null +++ b/sope-ical/versitSaxDriver/VSSaxDriver.m @@ -0,0 +1,575 @@ +/* + Copyright (C) 2003-2004 Max Berger + Copyright (C) 2004 OpenGroupware.org + + This file is part of versitSaxDriver, written for the OpenGroupware.org + project (OGo). + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + +#include "VSSaxDriver.h" +#include "common.h" + +@implementation VSSaxDriver + +static BOOL debugOn = NO; + +static NSCharacterSet *dotCharSet = nil; +static NSCharacterSet *equalSignCharSet = nil; +static NSCharacterSet *commaCharSet = nil; +static NSCharacterSet *colonAndSemicolonCharSet = nil; +static NSCharacterSet *whitespaceCharSet = nil; + ++ (void)initialize { + static BOOL didInit = NO; + NSUserDefaults *ud; + + if(didInit) + return; + didInit = YES; + + ud = [NSUserDefaults standardUserDefaults]; + debugOn = [ud boolForKey:@"OGoDebugVersitSaxDriver"]; + + dotCharSet = + [[NSCharacterSet characterSetWithCharactersInString:@"."] retain]; + equalSignCharSet = + [[NSCharacterSet characterSetWithCharactersInString:@"="] retain]; + commaCharSet = + [[NSCharacterSet characterSetWithCharactersInString:@","] retain]; + colonAndSemicolonCharSet = + [[NSCharacterSet characterSetWithCharactersInString:@":;"] retain]; + whitespaceCharSet = + [[NSCharacterSet whitespaceCharacterSet] retain]; +} + + +- (id)init { + if ((self = [super init])) { + self->prefixURI = @""; + self->cardStack = [[NSMutableArray alloc] init]; + self->elementList = [[NSMutableArray alloc] init]; + self->attributeMapping = [[NSMutableDictionary alloc] init]; + self->subItemMapping = [[NSMutableDictionary alloc] init]; + } + return self; +} + +- (void)dealloc { + [self->contentHandler release]; + [self->prefixURI release]; + [self->cardStack release]; + [self->elementList release]; + [self->attributeElements release]; + [self->elementMapping release]; + [self->attributeMapping release]; + [self->subItemMapping release]; + [super dealloc]; +} + +/* accessors */ + +- (void)setFeature:(NSString *)_name to:(BOOL)_value { +} +- (BOOL)feature:(NSString *)_name { + return NO; +} + +- (void)setProperty:(NSString *)_name to:(id)_value { +} +- (id)property:(NSString *)_name { + return nil; +} + +/* handlers */ + +- (void)setContentHandler:(id)_handler { + ASSIGN(self->contentHandler,_handler); +} + +- (void)setDTDHandler:(id)_handler { + // FIXME +} + +- (void)setErrorHandler:(id)_handler { + // FIXME +} +- (void)setEntityResolver:(id)_handler { + // FIXME +} + +- (id)contentHandler { + return self->contentHandler; +} + +- (id)dtdHandler { + // FIXME + return NULL; +} + +- (id)errorHandler { + // FIXME + return NULL; +} +- (id)entityResolver { + // FIXME + return NULL; +} + +- (void)setPrefixURI:(NSString *)_uri { + ASSIGNCOPY(self->prefixURI, _uri); +} +- (NSString *)prefixURI { + return self->prefixURI; +} + +- (void)setAttributeElements:(NSSet *)_elements { + ASSIGNCOPY(self->attributeElements, _elements); +} +- (NSSet *)attributeElements { + return self->attributeElements; +} + +- (void)setElementMapping:(NSDictionary *)_mapping { + ASSIGNCOPY(self->elementMapping, _mapping); +} +- (NSDictionary *)elementMapping { + return self->elementMapping; +} + +- (void)setAttributeMapping:(NSDictionary *)_mapping { + [self setAttributeMapping:_mapping forElement:@""]; +} + +- (void)setAttributeMapping:(NSDictionary *)_mapping + forElement:(NSString *)_element +{ + if (!_element) + _element = @""; + [attributeMapping setObject:_mapping forKey:_element]; +} + +- (void)setSubItemMapping:(NSArray *)_mapping + forElement:(NSString *)_element +{ + [subItemMapping setObject:_mapping forKey:_element]; +} + + + +/* parsing */ + +- (NSString *)_mapTagName:(NSString *)_tagName { + NSString *ret; + NSRange r; + + if ((ret = [self->elementMapping objectForKey:_tagName]) == nil) { + //NSLog(@"Unknown Key: %@ in %@",_tagName,self->elementMapping); + ret = _tagName; + + /* This is to allow parsing of vCards produced by Apple + Addressbook. AFAIK the .dot notation is a non-standard + extension */ + r = [_tagName rangeOfCharacterFromSet:dotCharSet]; + if (r.length > 0) { + ret = [self _mapTagName:[_tagName substringFromIndex:(r.location + 1)]]; + } + } + return ret; +} + +- (void)_addAttribute:(NSString *)_attribute + value:(NSString *)_value + toAttrs:(SaxAttributes *)_attrs +{ + [_attrs addAttribute:_attribute + uri:self->prefixURI + rawName:_attribute + type:@"CDATA" + value:_value]; +} + +- (void)_addAttribute:(NSString *)_attribute value:(NSString *)_value { + NSArray *element = [cardStack lastObject]; + SaxAttributes *attrs = [element objectAtIndex:2]; + [self _addAttribute:_attribute value:_value toAttrs:attrs]; +} + +- (NSString *)_mapAttrName:(NSString *)_attrName forTag:(NSString *)_tagName { + NSString *mappedName; + + mappedName = [[self->attributeMapping objectForKey:_tagName] + objectForKey:_attrName]; + if (!mappedName) { + mappedName = [[self->attributeMapping objectForKey: + [self _mapTagName:_tagName]] + objectForKey:_attrName]; + } + if (!mappedName) { + mappedName = [[self->attributeMapping objectForKey:@""] + objectForKey:_attrName]; + } + if (!mappedName) + mappedName = _attrName; + + return mappedName; +} + +- (void)_parseAttr:(NSString *)_attr + forTag:(NSString *)_tagName + intoAttr:(NSString **)attr_ + intoValue:(NSString **)value_ +{ + NSRange r; + NSString *attrName; + NSMutableString *attrValue; + NSString *mappedName; + + r = [_attr rangeOfCharacterFromSet:equalSignCharSet]; + if (r.length > 0) { + attrName = [[_attr substringToIndex:r.location] uppercaseString]; + attrValue = [[_attr substringFromIndex:(r.location + 1)] mutableCopy]; + } + else { + attrName = @"TYPE"; + attrValue = [[NSMutableString alloc] initWithString:_attr]; + } + + r = [attrValue rangeOfCharacterFromSet:commaCharSet]; + while (r.length > 0) { + [attrValue replaceCharactersInRange:r withString:@" "]; + r = [attrValue rangeOfCharacterFromSet:commaCharSet]; + } + + mappedName = [self _mapAttrName:attrName forTag:_tagName]; + *attr_ = mappedName; + *value_ = [NSString stringWithString:attrValue]; + [attrValue release]; +} + +- (id)_mapAttrs:(NSArray *)_attrs + forTag:(NSString *)_tagName +{ + SaxAttributes *retAttrs; + NSEnumerator *attrEnum; + NSString *curAttr, *mappedAttr, *mappedValue, *oldValue; + NSMutableDictionary *attributes; + + if (!_attrs || [_attrs count] == 0) + return nil; + + attributes = [[NSMutableDictionary alloc] init]; + retAttrs = [[[SaxAttributes alloc] init] autorelease]; + attrEnum = [_attrs objectEnumerator]; + while ((curAttr = [attrEnum nextObject])) { + [self _parseAttr:curAttr + forTag:_tagName + intoAttr:&mappedAttr + intoValue:&mappedValue]; + if ((oldValue = [attributes objectForKey:mappedAttr])) { + NSString *val; + /* ZNeK: duh! */ + val = [NSString stringWithFormat:@"%@ %@",oldValue, mappedValue]; + [attributes setObject:val forKey:mappedAttr]; + } + else + [attributes setObject:mappedValue forKey:mappedAttr]; + } + + attrEnum = [attributes keyEnumerator]; + while ((curAttr = [attrEnum nextObject])) { + [self _addAttribute:curAttr + value:[attributes objectForKey:curAttr] + toAttrs:retAttrs]; + } + + [attributes release]; + + return retAttrs; +} + +- (NSArray *)_beginTag:(NSString *)_tagName + withAttrs:(id)_attrs +{ + NSArray *tag = [NSArray arrayWithObjects:@"BEGIN",_tagName,_attrs,NULL]; + [self->elementList addObject:tag]; + return tag; +} + +- (void)_endTag:(NSString *)_tagName { + [self->elementList addObject: + [NSArray arrayWithObjects:@"END",_tagName,NULL]]; +} + +- (void)_addSubItems:(NSArray *)_items withData:(NSString *)_content { + NSEnumerator *itemEnum, *contentEnum; + NSString *subTag; + NSString *subContent; + + itemEnum = [_items objectEnumerator]; + contentEnum = [[_content componentsSeparatedByString:@";"] objectEnumerator]; + + while ((subTag=[itemEnum nextObject])) { + subContent = [contentEnum nextObject]; + + [self _beginTag:subTag withAttrs:nil]; + if ([subContent length]>0) + [self->elementList addObject: + [NSArray arrayWithObjects:@"DATA", subContent, nil]]; + [self _endTag:subTag]; + } +} + +- (void)_dataTag:(NSString *)_tagName + withAttrs:(id)_attrs + andContent:(NSString *)_content +{ + NSArray *subItems; + + if ([self->attributeElements containsObject:_tagName]) { + [self _addAttribute:_tagName value:_content]; + } + else { + [self _beginTag:_tagName withAttrs:_attrs]; + if ([_content length] > 0) { + if ((subItems = [self->subItemMapping objectForKey:_tagName])) { + [self _addSubItems:subItems withData:_content]; + } + else { + [self->elementList addObject: + [NSArray arrayWithObjects:@"DATA", _content, nil]]; + } + } + [self _endTag:_tagName]; + } +} + +- (void)_eventsForElements { + NSEnumerator *enu; + NSArray *obj; + NSString *type; + NSString *name; + unichar *chardata; + id attrs; + + enu = [elementList objectEnumerator]; + while ((obj = [enu nextObject])) { + type = [obj objectAtIndex:0]; + name = [obj objectAtIndex:1]; + + if ([obj count] > 2) + attrs = [obj objectAtIndex:2]; + else + attrs = nil; + + if ([type isEqualToString:@"BEGIN"]) { + [self->contentHandler startElement:name + namespace:self->prefixURI + rawName:name + attributes:attrs]; + } + else if ([type isEqualToString:@"END"]) { + [self->contentHandler endElement:name + namespace:self->prefixURI + rawName:name]; + } + else { + unsigned len = [name length]; + chardata = malloc(len * sizeof(unichar)); + [name getCharacters:chardata range:NSMakeRange(0, len)]; + [self->contentHandler characters:chardata length:len]; + if (chardata) + free(chardata); + } + } + [elementList removeAllObjects]; +} + +- (void)_parseLine:(NSString *)_line { + NSScanner *scanner; + NSString *tagName, *tagAttribute, *tagValue; + NSMutableArray *tagAttributes; + + scanner = [NSScanner scannerWithString:_line]; + tagAttributes = [[NSMutableArray alloc] init]; + + tagName = @""; + [scanner scanUpToCharactersFromSet:colonAndSemicolonCharSet + intoString:&tagName]; + + while ([scanner scanString:@";" intoString:NULL]) { + [scanner scanUpToCharactersFromSet:colonAndSemicolonCharSet + intoString:&tagAttribute]; + [tagAttributes addObject:tagAttribute]; + } + [scanner scanString:@":" intoString:NULL]; + tagValue = [_line substringFromIndex:[scanner scanLocation]]; + + //NSLog (@"%@ %@ %@",tagName,tagAttributes, tagValue); + + tagName = [tagName uppercaseString]; + + if ([tagName isEqualToString:@"BEGIN"]) { + id tag; + + tag = [self _beginTag:[self _mapTagName:tagValue] + withAttrs:[[[SaxAttributes alloc] init] autorelease]]; + [self->cardStack addObject:tag]; + } + else if ([tagName isEqualToString:@"END"]) { + [self _endTag:[self _mapTagName:tagValue]]; + [self->cardStack removeLastObject]; + if ([self->cardStack count] == 0) + [self _eventsForElements]; + } + else { + [self _dataTag:[self _mapTagName:tagName] + withAttrs:[self _mapAttrs:tagAttributes forTag:tagName] + andContent:tagValue]; + } + [tagAttributes release]; +} + +- (void)_parseString:(NSString *)_rawString { + unsigned pos, length; + NSMutableString *line; + NSRange r; + + [self->contentHandler startDocument]; + [self->contentHandler startPrefixMapping:@"" uri:self->prefixURI]; + + length = [_rawString length]; + /* RFC2445: + contentline = name *(";" param ) ":" value CRLF + ; When parsing a content line, folded lines MUST first + ; be unfolded + */ + r = NSMakeRange(0, 0); + /* probably too optimistic */ + line = [[NSMutableString alloc] initWithCapacity:75 + 2]; + + for(pos = 0; pos < length; pos++) { + unichar c = [_rawString characterAtIndex:pos]; + + if(c == '\r') { + if(((length - 1) - pos) >= 1) { + if([_rawString characterAtIndex:pos + 1] == '\n') { + BOOL isAtEndOfLine = YES; + /* test for folding first */ + if(((length - 1) - pos) >= 2) { + unichar ws = [_rawString characterAtIndex:pos + 2]; + isAtEndOfLine = [whitespaceCharSet characterIsMember:ws] ? NO + : YES; + if(!isAtEndOfLine) { + /* assemble part of line up to pos */ + if(r.length > 0) { + [line appendString:[_rawString substringWithRange:r]]; + } + /* unfold */ + pos += 2; + r = NSMakeRange(pos + 1, 0); /* begin new range */ + } + } + if(isAtEndOfLine) { + /* assemble part of line up to pos */ + if(r.length > 0) { + [line appendString:[_rawString substringWithRange:r]]; + } + [self _parseLine:line]; + /* reset line */ + [line deleteCharactersInRange:NSMakeRange(0, [line length])]; + pos += 1; + r = NSMakeRange(pos + 1, 0); /* begin new range */ + } + } + } + else { + /* garbled last line! */ + if(debugOn) { + NSLog(@"%s Last line is truncated, trying to parse anyways!", + __PRETTY_FUNCTION__); + } + } + } + else { + r.length += 1; + } + } + if(r.length > 0) { + if(debugOn) { + NSLog(@"%s Last line of iCal string is not properly terminated!", + __PRETTY_FUNCTION__); + } + [line appendString:[_rawString substringWithRange:r]]; + [self _parseLine:line]; + } + + [line release]; + [self->contentHandler endPrefixMapping:@""]; + [self->contentHandler endDocument]; +} + +- (void)parseFromSource:(id)_source { + if (debugOn) + NSLog(@"%s: parse: %@", __PRETTY_FUNCTION__, _source); + + if ([_source isKindOfClass:[NSURL class]]) { + if (debugOn) + NSLog(@"%s: trying to load URL...",__PRETTY_FUNCTION__); + _source = [_source resourceDataUsingCache:NO]; + } + + if ([_source isKindOfClass:[NSData class]]) { + // FIXME: Data is not always utf-8..... + if (debugOn) + NSLog(@"%s: trying to decode data...",__PRETTY_FUNCTION__); + _source = [[[NSString alloc] + initWithData:_source encoding:NSUTF8StringEncoding] + autorelease]; + } + + if ([_source isKindOfClass:[NSString class]]) { + if (debugOn) + NSLog(@"%s: trying to parse string...",__PRETTY_FUNCTION__); + [self _parseString:_source]; + } + else { + if (debugOn) + NSLog(@"%s: unrecognizable source: %@", __PRETTY_FUNCTION__,_source); + // FIXME: Return Error + } +} + +- (void)parseFromSource:(id)_source systemId:(NSString *)_sysId { + [self parseFromSource:_source]; +} + +- (void)parseFromSystemId:(NSString *)_sysId { + NSURL *url; + + if ((url = [NSURL URLWithString:_sysId])) + [self parseFromSource:url systemId:_sysId]; +} + +/* debugging */ + +- (BOOL)isDebuggingEnabled { + return debugOn; +} + +@end /* VersitSaxDriver */ diff --git a/sope-ical/versitSaxDriver/VSiCalSaxDriver.h b/sope-ical/versitSaxDriver/VSiCalSaxDriver.h new file mode 100644 index 00000000..fa3810a1 --- /dev/null +++ b/sope-ical/versitSaxDriver/VSiCalSaxDriver.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2003-2004 Max Berger + Copyright (C) 2004 OpenGroupware.org + + This file is part of versitSaxDriver, written for the OpenGroupware.org + project (OGo). + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + */ +// $Id$ + +#ifndef __versitSaxDriver_VSiCalSaxDriver_H__ +#define __versitSaxDriver_VSiCalSaxDriver_H__ + +#include "VSSaxDriver.h" + +@interface VSiCalSaxDriver : VSSaxDriver +{ +} + +@end + +#endif /* __versitSaxDriver_VSiCalSaxDriver_H__ */ diff --git a/sope-ical/versitSaxDriver/VSiCalSaxDriver.m b/sope-ical/versitSaxDriver/VSiCalSaxDriver.m new file mode 100644 index 00000000..6dc735d0 --- /dev/null +++ b/sope-ical/versitSaxDriver/VSiCalSaxDriver.m @@ -0,0 +1,367 @@ +/* + Copyright (C) 2003-2004 Max Berger + Copyright (C) 2004 OpenGroupware.org + + This file is part of versitSaxDriver, written for the OpenGroupware.org + project (OGo). + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + */ +// $Id$ + +#include "VSiCalSaxDriver.h" +#include +#include "common.h" + +@implementation VSiCalSaxDriver + +static NSSet *defElementNames = nil; +static NSArray *defGeoMappings = nil; + ++ (void)initialize { + static BOOL didInit = NO; + + if(didInit) + return; + didInit = YES; + + defElementNames = [[NSSet alloc] initWithObjects: + @"calscale", + @"version", + @"prodid", + @"method", + nil]; + defGeoMappings = [[NSArray alloc] initWithObjects: + @"lat", + @"lon", + nil]; +} + ++ (NSDictionary *)xcalMapping { + static NSDictionary *dict = nil; + if (!dict) { + NSMutableDictionary *xcal; + + xcal = [[NSMutableDictionary alloc] initWithCapacity:60]; + /* + +---------------+-----------+-----------+-----------------+ + | Calendar | Attribute | Attribute | Default | + | Property Name | Name | Type | Value | + +---------------+-----------+-----------+-----------------+ + | CALSCALE | calscale | CDATA | IMPLIED | + | METHOD | method | NMTOKEN | PUBLISH | + | VERSION | version | CDATA | REQUIRED | + | PRODID | prodid | CDATA | IMPLIED | + +---------------+-----------+-----------+-----------------+ + */ + [xcal setObject:@"calscale" forKey:@"CALSCALE"]; + [xcal setObject:@"method" forKey:@"METHOD"]; + [xcal setObject:@"version" forKey:@"VERSION"]; + [xcal setObject:@"prodid" forKey:@"PRODID"]; + + /* + Descriptive Component Properties + +----------------+-------------+-----------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+-------------+-----------------------------+ + | ATTACH | attach | extref or b64bin | + | | extref | EMPTY | + | | b64bin | PCDATA | + | CATEGORIES | categories | Any number of item elements | + | | item | PCDATA | + | CLASS | class | PCDATA | + | COMMENT | comment | PCDATA | + | DESCRIPTION | description | PCDATA | + | GEO | geo | lat followed by lon element | + | | lat | PCDATA | + | | lon | PCDATA | + | LOCATION | location | PCDATA | + | PERCENT | percent | PCDATA | + | PRIORITY | priority | PCDATA | + | RESOURCES | resources | Any number of item elements | + | STATUS | status | PCDATA | + | SUMMARY | summary | PCDATA | + +----------------+-------------+-----------------------------+ + */ + + [xcal setObject:@"attach" forKey:@"ATTACH"]; + [xcal setObject:@"categories" forKey:@"CATEGORIES"]; + [xcal setObject:@"class" forKey:@"CLASS"]; + [xcal setObject:@"comment" forKey:@"COMMENT"]; + [xcal setObject:@"description" forKey:@"DESCRIPTION"]; + [xcal setObject:@"geo" forKey:@"GEO"]; + [xcal setObject:@"location" forKey:@"LOCATION"]; + [xcal setObject:@"percent" forKey:@"PERCENT"]; + [xcal setObject:@"priority" forKey:@"PRIORITY"]; + [xcal setObject:@"resources" forKey:@"RESOURCES"]; + [xcal setObject:@"status" forKey:@"STATUS"]; + [xcal setObject:@"summary" forKey:@"SUMMARY"]; + + /* + Date and Time Component Properties + +----------------+------------+-----------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+------------+-----------------------------+ + | COMPLETED | completed | PCDATA | + | DTEND | dtend | PCDATA | + | DUE | due | PCDATA | + | DTSTART | dtstart | PCDATA | + | DURATION | duration | PCDATA | + | FREEBUSY | freebusy | PCDATA | + | TRANSP | transp | PCDATA | + +----------------+------------+-----------------------------+ + */ + + [xcal setObject:@"completed" forKey:@"COMPLETED"]; + [xcal setObject:@"dtend" forKey:@"DTEND"]; + [xcal setObject:@"due" forKey:@"DUE"]; + [xcal setObject:@"dtstart" forKey:@"DTSTART"]; + [xcal setObject:@"duration" forKey:@"DURATION"]; + [xcal setObject:@"freebusy" forKey:@"FREEBUSY"]; + [xcal setObject:@"transp" forKey:@"TRANSP"]; + + /* + Time Zone Component Properties + +----------------+-------------+-----------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+-------------+-----------------------------+ + | TZID | tzid | PCDATA | + | TZNAME | tzname | PCDATA | + | TZOFFSETFROM | tzoffsetfrom| PCDATA | + | TZOFFSETTO | tzoffsetto | PCDATA | + | TZURL | tzurl | EMPTY | + +----------------+-------------+-----------------------------+ + */ + + [xcal setObject:@"tzid" forKey:@"TZID"]; + [xcal setObject:@"tzname" forKey:@"TZNAME"]; + [xcal setObject:@"tzoffsetfrom" forKey:@"TZOFFSETFROM"]; + [xcal setObject:@"tzoffsetto" forKey:@"TZOFFSETTO"]; + [xcal setObject:@"tzurl" forKey:@"TZURL"]; + + /* + Relationship Component Properties + +----------------+---------------+--------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+---------------+--------------------------+ + | ATTENDEE | attendee | PCDATA | + | CONTACT | contact | PCDATA | + | ORGANIZER | organizer | PCDATA | + | RECURRENCE-ID | recurrence-id | PCDATA | + | RELATED-TO | related-to | PCDATA | + | URL | url | EMPTY | + | UID | uid | PCDATA | + +----------------+---------------+--------------------------+ + */ + [xcal setObject:@"attendee" forKey:@"ATTENDEE"]; + [xcal setObject:@"contact" forKey:@"CONTACT"]; + [xcal setObject:@"organizer" forKey:@"ORGANIZER"]; + [xcal setObject:@"recurrence-id" forKey:@"RECURRENCE-ID"]; + [xcal setObject:@"related-to" forKey:@"RELATED-TO"]; + [xcal setObject:@"url" forKey:@"URL"]; + [xcal setObject:@"uid" forKey:@"UID"]; + + /* + Recurrence Component Properties + +----------------+------------+-----------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+------------+-----------------------------+ + | EXDATE | exdate | PCDATA | + | EXRULE | exrule | PCDATA | + | RDATE | rdate | PCDATA | + | RRULE | rrule | PCDATA | + +----------------+------------+-----------------------------+ + + */ + [xcal setObject:@"exdate" forKey:@"EXDATE"]; + [xcal setObject:@"exrule" forKey:@"EXRULE"]; + [xcal setObject:@"rdate" forKey:@"RDATE"]; + [xcal setObject:@"rrule" forKey:@"RRULE"]; + + /* + Alarm Component Properties + +----------------+------------+-----------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+------------+-----------------------------+ + | ACTION | action | PCDATA | + | REPEAT | repeat | PCDATA | + | TRIGGER | trigger | PCDATA | + +----------------+------------+-----------------------------+ + */ + [xcal setObject:@"action" forKey:@"ACTION"]; + [xcal setObject:@"repeat" forKey:@"REPEAT"]; + [xcal setObject:@"trigger" forKey:@"TRIGGER"]; + + /* + Change Management Component Properties + +----------------+---------------+--------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+---------------+--------------------------+ + | CREATED | created | PCDATA | + | DTSTAMP | dtstamp | PCDATA | + | LAST-MODIFIED | last-modified | PCDATA | + | SEQUENCE | sequence | PCDATA | + +----------------+---------------+--------------------------+ + */ + [xcal setObject:@"created" forKey:@"CREATED"]; + [xcal setObject:@"dtstamp" forKey:@"DTSTAMP"]; + [xcal setObject:@"last-modified" forKey:@"LAST-MODIFIED"]; + [xcal setObject:@"sequence" forKey:@"SEQUENCE"]; + + /* + Miscellaneous Component Properties + +----------------+----------------+-------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+----------------+-------------------------+ + | REQUEST-STATUS | request-status | PCDATA | + +----------------+----------------+-------------------------+ + */ + [xcal setObject:@"request-status" forKey:@"REQUEST-STATUS"]; + + + /* + Component Structuring Properties + +----------------+------------+-------------------------------+ + | Component | Element | Element Content Model | + | Property Name | Name | | + +----------------+------------+-------------------------------+ + | Multiple iCal- | iCalendar | One or more iCal elements | + | endar objects | | | + | VCALENDAR | vcalendar | calcomp parameter entity | + | VEVENT | vevent | vevent.opt1 and vevent.optm | + | | | parameter entity and valarm | + | | | element | + | VTODO | vtodo | vtodo.opt1 and vtodo.optm | + | | | parameter entity and valarm | + | | | element | + | VJOURNAL | vjournal | vjournal.opt1 and | + | | | vjournal.optm parameter | + | | | entity | + | VFREEBUSY | vfreebusy | vfreebusy.opt1 and | + | | | vfreebusy.optm parameter | + | | | entity | + | VTIMEZONE | vtimezone | vtimezone.man, | + | | | vtimezone.opt1, | + | | | vtimezone.mann parameter | + | | | entity | + | STANDARD | standard | standard.man or standard.optm | + | | | entity | + | DAYLIGHT | daylight | daylight.man or daylight.optm | + | | | entity | + | VALARM | valarm | valarm.audio, valarm.display, | + | | | valarm.email and | + | | | valarm.procedure entity | + +----------------+------------+-------------------------------+ + */ + + [xcal setObject:@"vcalendar" forKey:@"VCALENDAR"]; + [xcal setObject:@"vevent" forKey:@"VEVENT"]; + [xcal setObject:@"vtodo" forKey:@"VTODO"]; + [xcal setObject:@"vjournal" forKey:@"VJOURNAL"]; + [xcal setObject:@"vfreebusy" forKey:@"VFREEBUSY"]; + [xcal setObject:@"vtimezone" forKey:@"VTIMEZONE"]; + [xcal setObject:@"standard" forKey:@"STANDARD"]; + [xcal setObject:@"daylight" forKey:@"DAYLIGHT"]; + [xcal setObject:@"valarm" forKey:@"VALARM"]; + + dict = [xcal copy]; + [xcal release]; + } + return dict; +} + ++ (NSDictionary *)xcalAttrMapping +{ + static NSDictionary *dict = nil; + if (!dict) { + NSMutableDictionary *xcal; + + xcal = [[NSMutableDictionary alloc] initWithCapacity:20]; + /* + ----------------+----------------+-----------+-----------------+ + | Property | Attribute | Attribute | Default | + | Parameter Name | Name | Type | Value | + +----------------+----------------+-----------+-----------------+ + | ALTREP | altrep | ENTITY | IMPLIED | + | CN | cn | CDATA | Null String | + | CUTYPE | cutype | NMTOKEN | INDIVIDUAL | + | DELEGATED-FROM | delegated-from | CDATA | IMPLIED | + | DELEGATED-TO | delegated-to | CDATA | IMPLIED | + | DIR | dir | ENTITY | IMPLIED | + | ENCODING | Not Used | n/a | n/a | + | FMTTYPE | fmttype | CDATA | REQUIRED | + | FBTYPE | fbtype | NMTOKEN | BUSY | + | LANGUAGE | language | CDATA | IMPLIED | + | MEMBER | member | CDATA | IMPLIED | + | PARTSTAT | partstat | NMTOKEN | NEEDS-ACTION | + | RANGE | range | NMTOKEN | THISONLY | + | RELATED | related | NMTOKEN | START | + | RELTYPE | reltype | NMTOKEN | PARENT | + | ROLE | role | NMTOKEN | REQ-PARTICIPANT | + | RSVP | rsvp | NMTOKEN | FALSE | + | SENT-BY | sent-by | CDATA | IMPLIED | + | TZID | tzid | CDATA | IMPLIED | + | VALUE | value | NOTATION | See elements | + +----------------+----------------+-----------+-----------------+ + */ + [xcal setObject:@"altrep" forKey:@"ALTREP"]; + [xcal setObject:@"cn" forKey:@"CN"]; + [xcal setObject:@"cutype" forKey:@"CUTYPE"]; + [xcal setObject:@"delegated-from" forKey:@"DELEGATED-FROM"]; + [xcal setObject:@"delegated-to" forKey:@"DELEGATED-TO"]; + [xcal setObject:@"dir" forKey:@"DIR"]; + [xcal setObject:@"Not" forKey:@"ENCODING"]; + [xcal setObject:@"fmttype" forKey:@"FMTTYPE"]; + [xcal setObject:@"fbtype" forKey:@"FBTYPE"]; + [xcal setObject:@"language" forKey:@"LANGUAGE"]; + [xcal setObject:@"member" forKey:@"MEMBER"]; + [xcal setObject:@"partstat" forKey:@"PARTSTAT"]; + [xcal setObject:@"range" forKey:@"RANGE"]; + [xcal setObject:@"related" forKey:@"RELATED"]; + [xcal setObject:@"reltype" forKey:@"RELTYPE"]; + [xcal setObject:@"role" forKey:@"ROLE"]; + [xcal setObject:@"rsvp" forKey:@"RSVP"]; + [xcal setObject:@"sent-by" forKey:@"SENT-BY"]; + [xcal setObject:@"tzid" forKey:@"TZID"]; + [xcal setObject:@"value" forKey:@"VALUE"]; + + dict = [xcal copy]; + [xcal release]; + } + return dict; +} + +- (id)init { + if ((self = [super init])) { + [self setPrefixURI:XMLNS_XCAL_01]; + [self setElementMapping:[[self class] xcalMapping]]; + [self setAttributeElements:defElementNames]; + + [self setAttributeMapping:[[self class] xcalAttrMapping]]; + [self setSubItemMapping:defGeoMappings forElement:@"geo"]; + } + return self; +} + +@end /* ICalendarSaxDriver */ diff --git a/sope-ical/versitSaxDriver/VSvCardSaxDriver.h b/sope-ical/versitSaxDriver/VSvCardSaxDriver.h new file mode 100644 index 00000000..09243b59 --- /dev/null +++ b/sope-ical/versitSaxDriver/VSvCardSaxDriver.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2003-2004 Max Berger + Copyright (C) 2004 OpenGroupware.org + + This file is part of versitSaxDriver, written for the OpenGroupware.org + project (OGo). + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + */ +// $Id$ + +#ifndef __versitSaxDriver_VSvCardSaxDriver_H__ +#define __versitSaxDriver_VSvCardSaxDriver_H__ + +#include "VSSaxDriver.h" + +@interface VSvCardSaxDriver : VSSaxDriver +{ +} + +@end + +#endif /* __versitSaxDriver_VSvCardSaxDriver_H__ */ diff --git a/sope-ical/versitSaxDriver/VSvCardSaxDriver.m b/sope-ical/versitSaxDriver/VSvCardSaxDriver.m new file mode 100644 index 00000000..097f485a --- /dev/null +++ b/sope-ical/versitSaxDriver/VSvCardSaxDriver.m @@ -0,0 +1,323 @@ +/* + Copyright (C) 2003-2004 Max Berger + Copyright (C) 2004 OpenGroupware.org + + This file is part of versitSaxDriver, written for the OpenGroupware.org + project (OGo). + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + */ +// $Id$ + +#include "VSvCardSaxDriver.h" +#include "common.h" + +@implementation VSvCardSaxDriver + +static NSSet *defElementNames = nil; + ++ (void)initialize { + static BOOL didInit = NO; + + if(didInit) + return; + didInit = YES; + + defElementNames = [[NSSet alloc] initWithObjects: + @"class", + @"prodid", + @"rev", + @"uid", + @"version", + nil]; +} + ++ (NSDictionary *)xcardMapping { + static NSDictionary *dict = nil; + if (dict == NULL) { + NSMutableDictionary *xcard; + + xcard = [[NSMutableDictionary alloc] initWithCapacity:30]; + + [xcard setObject:@"vCard" forKey:@"VCARD"]; + + /* + +----------------+------------+------------+----------------+ + | Type | Attribute | Attribute | Default | + | Name | Name | Type | Value | + +----------------+------------+------------+----------------+ + | CLASS | class | enumerated | 'PUBLIC' | + | PRODID | prodid | CDATA | IMPLIED | + | REV | rev | CDATA | IMPLIED | + | UID | uid | CDATA | IMPLIED | + | VERSION | version | CDATA | IMPLIED | + +----------------+------------+------------+----------------+ + */ + [xcard setObject:@"class" forKey:@"CLASS"]; + [xcard setObject:@"prodid" forKey:@"PRODID"]; + [xcard setObject:@"rev" forKey:@"REV"]; + [xcard setObject:@"uid" forKey:@"UID"]; + [xcard setObject:@"version" forKey:@"VERSION"]; + + + /* + Identification Types + +----------------+------------+-----------------------------+ + | vCard | Element | Element Content Model | + | Type Name | Name | | + +----------------+------------+-----------------------------+ + | FN | fn | PCDATA | + | N | n | family*,given*,other*, | + | | | prefix*, suffix* | + | | family | PCDATA | + | | given | PCDATA | + | | other | PCDATA | + | | prefix | PCDATA | + | | suffix | PCDATA | + | NICKNAME | nickname | PCDATA | + | PHOTO | photo | extref or b64bin | + | | extref | EMPTY | + | | b64bin | PCDATA | + | BDAY | bday | PCDATA | + +----------------+------------+-----------------------------+ + */ + [xcard setObject:@"fn" forKey:@"FN"]; + [xcard setObject:@"n" forKey:@"N"]; + [xcard setObject:@"nickname" forKey:@"NICKNAME"]; + [xcard setObject:@"photo" forKey:@"PHOTO"]; + [xcard setObject:@"bday" forKey:@"BDAY"]; + + + /* + Delivery Addressing Types + +----------------+------------+-----------------------------+ + | vCard | Element | Element Content Model | + | Type Name | Name | | + +----------------+------------+-----------------------------+ + | ADR | adr | pobox*,extadd*,street*, | + | | | locality*,region*,pcode*, | + | | | country* | + | | pobox | PCDATA | + | | extadd | PCDATA | + | | street | PCDATA | + | | locality | PCDATA | + | | region | PCDATA | + | | pcode | PCDATA | + | | country | PCDATA | + | LABEL | LABEL | PCDATA | + +----------------+------------+-----------------------------+ + */ + [xcard setObject:@"adr" forKey:@"ADR"]; + [xcard setObject:@"LABEL" forKey:@"LABEL"]; + + /* + Telecommunications Addressing Types + +----------------+------------+-----------------------------+ + | vCard | Element | Element Content Model | + | Type Name | Name | | + +----------------+------------+-----------------------------+ + | TEL | tel | PCDATA | + | EMAIL | email | PCDATA | + | MAILER | mailer | PCDATA | + +----------------+------------+-----------------------------+ + */ + [xcard setObject:@"tel" forKey:@"TEL"]; + [xcard setObject:@"email" forKey:@"EMAIL"]; + [xcard setObject:@"mailer" forKey:@"MAILER"]; + + /* + Geographical Types + +----------------+------------+-----------------------------+ + | vCard | Element | Element Content Model | + | Type Name | Name | | + +----------------+------------+-----------------------------+ + | TZ | tz | PCDATA | + | GEO | geo | lat,lon | + | | lat | PCDATA | + | | lon | PCDATA | + +----------------+------------+-----------------------------+ + */ + [xcard setObject:@"tz" forKey:@"TZ"]; + [xcard setObject:@"geo" forKey:@"GEO"]; + + /* + Organizational Types + +----------------+------------+-----------------------------+ + | vCard | Element | Element Content Model | + | Type Name | Name | | + +----------------+------------+-----------------------------+ + | TITLE | title | PCDATA | + | ROLE | role | PCDATA | + | LOGO | logo | extref or b64bin | + | | extref | EMPTY | + | | b64bin | PCDATA | + | AGENT | agent | vCard | extref | + | ORG | org | orgnam,orgunit* | + | | orgnam | PCDATA | + | | orgunit | PCDATA + +----------------+------------+-----------------------------+ + */ + [xcard setObject:@"title" forKey:@"TITLE"]; + [xcard setObject:@"role" forKey:@"ROLE"]; + [xcard setObject:@"logo" forKey:@"LOGO"]; + [xcard setObject:@"agent" forKey:@"AGENT"]; + [xcard setObject:@"org" forKey:@"ORG"]; + + /* + Explanatory Types + +----------------+------------+-----------------------------+ + | vCard | Element | Element Content Model | + | Type Name | Name | | + +----------------+------------+-----------------------------+ + | CATEGORIES | categories | item* | + | | item | PCDATA | + | NOTE | note | PCDATA | + | SORT-STRING | sort | PCDATA | + | SOUND | sound | extref | b64bin | + | | extref | EMPTY | + | | b64bin | PCDATA | + | URL | url | PCDATA | + | URI | uri | PCDATA | + +----------------+------------+-----------------------------+ + */ + [xcard setObject:@"categories" forKey:@"CATEGORIES"]; + [xcard setObject:@"note" forKey:@"NOTE"]; + [xcard setObject:@"sort" forKey:@"SORT-STRING"]; + [xcard setObject:@"sound" forKey:@"SOUND"]; + [xcard setObject:@"url" forKey:@"URL"]; + [xcard setObject:@"uri" forKey:@"URI"]; + + /* + Security Types + +----------------+------------+-----------------------------+ + | vCard | Element | Element Content Model | + | Type Name | Name | | + +----------------+------------+-----------------------------+ + | KEY | key | extref | b64bin | + | | extref | EMPTY | + | | b64bin | PCDATA | + +----------------+------------+-----------------------------+ + */ + [xcard setObject:@"key" forKey:@"KEY"]; + + dict = [xcard copy]; + [xcard release]; + } + return dict; +} + +- (void)_setVCardAttributeMappings { + /* + +----------------+------------+-----------+-----------------+ + | Type | Attribute | Attribute | Default | + | Parameter Name | Name | Type | Value | + +----------------+------------+-----------+-----------------+ + | ENCODING | Not Used | n/a | n/a | + | LANGUAGE | lang | CDATA | IMPLIED | + | TYPE for ADR | del.type | NMTOKENS | 'INTL POSTAL | + | and LABEL | | | PARCEL WORK' | + | TYPE for TEL | tel.type | NMTOKENS | 'VOICE' | + | TYPE for EMAIL | email.type | NMTOKENS | 'INTERNET' | + | TYPE for PHOTO,| img.type | CDATA | REQUIRED | + | and LOGO | | | | + | TYPE for SOUND | aud.type | CDATA | REQUIRED | + | VALUE | value | NOTATION | See elements | + +----------------+------------+-----------+-----------------+ + */ + NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:2]; + + [dict setObject:@"lang" forKey:@"LANGUAGE"]; + [dict setObject:@"value" forKey:@"VALUE"]; + [self setAttributeMapping:dict]; + [dict release]; + + dict = [[NSMutableDictionary alloc] initWithCapacity:1]; + [dict setObject:@"del.type" forKey:@"TYPE"]; + [self setAttributeMapping:dict forElement:@"ADR"]; + [self setAttributeMapping:dict forElement:@"LABEL"]; + [dict release]; + + dict = [[NSMutableDictionary alloc] initWithCapacity:1]; + [dict setObject:@"tel.type" forKey:@"TYPE"]; + [self setAttributeMapping:dict forElement:@"TEL"]; + [dict release]; + + dict = [[NSMutableDictionary alloc] initWithCapacity:1]; + [dict setObject:@"email.type" forKey:@"TYPE"]; + [self setAttributeMapping:dict forElement:@"EMAIL"]; + [dict release]; + + dict = [[NSMutableDictionary alloc] initWithCapacity:1]; + [dict setObject:@"img.type" forKey:@"TYPE"]; + [self setAttributeMapping:dict forElement:@"PHOTO"]; + [self setAttributeMapping:dict forElement:@"LOGO"]; + [dict release]; + + dict = [[NSMutableDictionary alloc] initWithCapacity:1]; + [dict setObject:@"aud.type" forKey:@"TYPE"]; + [self setAttributeMapping:dict forElement:@"SOUND"]; + [dict release]; +} + +- (void)_setVCardSubItemMappings { + NSArray *a; + + a = [NSArray arrayWithObjects: + @"family", + @"given", + @"other", + @"prefix", + @"suffix", + nil]; + [self setSubItemMapping:a forElement:@"n"]; + + a = [NSArray arrayWithObjects: + @"pobox", + @"extadd", + @"street", + @"locality", + @"region", + @"pcode", + @"country", + nil]; + [self setSubItemMapping:a forElement:@"adr"]; + + a = [NSArray arrayWithObjects: + @"lat", + @"lon", + nil]; + [self setSubItemMapping:a forElement:@"geo"]; + + a = [NSArray arrayWithObjects: + @"orgnam", + @"orgunit", + nil]; + [self setSubItemMapping:a forElement:@"org"]; +} + +- (id)init { + if ((self = [super init])) { + + [self setPrefixURI:@"http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt"]; + [self setElementMapping:[[self class] xcardMapping]]; + [self setAttributeElements:defElementNames]; + [self _setVCardAttributeMappings]; + [self _setVCardSubItemMappings]; + } + return self; +} + +@end /* VCardSaxDriver */ diff --git a/sope-ical/versitSaxDriver/Version b/sope-ical/versitSaxDriver/Version new file mode 100644 index 00000000..25648bd2 --- /dev/null +++ b/sope-ical/versitSaxDriver/Version @@ -0,0 +1,5 @@ +# $Id$ + +MAJOR_VERSION=1 +MINOR_VERSION=0 +SUBMINOR_VERSION:=0 diff --git a/sope-ical/versitSaxDriver/bundle-info.plist b/sope-ical/versitSaxDriver/bundle-info.plist new file mode 100644 index 00000000..50d3a92b --- /dev/null +++ b/sope-ical/versitSaxDriver/bundle-info.plist @@ -0,0 +1,31 @@ +{ + requires = { + bundleManagerVersion = 1; + classes = ( { name = NSObject; } ); + }; + + provides = { + SAXDrivers = ( + { + name = "VSiCalSaxDriver"; + sourceTypes = ( "text/calendar" ); + }, + { + name = "VSiCalSaxDriver"; + sourceTypes = ( "text/x-vCalendar" ); + }, + { + name = "VSvCardSaxDriver"; + sourceTypes = ( "text/x-vcard" ); + }, + { + name = "VSvCardSaxDriver"; + sourceTypes = ( "text/vcard" ); + } + ); + classes = ( + { name = "VSiCalSaxDriver"; }, + { name = "VSvCardSaxDriver"; } + ); + }; +} diff --git a/sope-ical/versitSaxDriver/common.h b/sope-ical/versitSaxDriver/common.h new file mode 100644 index 00000000..763d99aa --- /dev/null +++ b/sope-ical/versitSaxDriver/common.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2004 OpenGroupware.org + + This file is part of versitSaxDriver, written for the OpenGroupware.org + project (OGo). + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + +#import + +#include diff --git a/sope-ical/versitSaxDriver/versitSaxDriver-Info.plist b/sope-ical/versitSaxDriver/versitSaxDriver-Info.plist new file mode 100644 index 00000000..6a0a3439 --- /dev/null +++ b/sope-ical/versitSaxDriver/versitSaxDriver-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + versitSaxDriver + CFBundleGetInfoString + + CFBundleIconFile + + CFBundleIdentifier + org.OpenGroupware.SOPE.sope-ical.versitSaxDriver + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/sope-ical/versitSaxDriver/versitSaxDriver.xcode/project.pbxproj b/sope-ical/versitSaxDriver/versitSaxDriver.xcode/project.pbxproj new file mode 100644 index 00000000..0b1b600e --- /dev/null +++ b/sope-ical/versitSaxDriver/versitSaxDriver.xcode/project.pbxproj @@ -0,0 +1,520 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 1656CC9D058802980012D2BC = { + children = ( + AD5010A5071F18AE0020300E, + AD5010C0071F18FA0020300E, + AD5010BE071F18F00020300E, + AD5010A7071F18B80020300E, + 16800E4205880EC4007700A5, + 16800E4305880EC4007700A5, + AD665AAE071EB2C200EC5911, + AD665ABF071EB3D500EC5911, + 1656CD1F0588063D0012D2BC, + 1656CD8F058809E30012D2BC, + 1656CD92058809FD0012D2BC, + 16800E3905880EA1007700A5, + ); + isa = PBXGroup; + refType = 4; + sourceTree = ""; + }; + 1656CC9F058802980012D2BC = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 1656CCA0058802990012D2BC = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; + 1656CCA1058802990012D2BC = { + buildSettings = { + }; + buildStyles = ( + 1656CC9F058802980012D2BC, + 1656CCA0058802990012D2BC, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 1656CC9D058802980012D2BC; + productRefGroup = 1656CC9D058802980012D2BC; + projectDirPath = ""; + targets = ( + 1656CCAE058802B80012D2BC, + ); + }; + 1656CCAA058802B80012D2BC = { + buildActionMask = 2147483647; + files = ( + 1656CCE4058805BB0012D2BC, + 1656CD26058806680012D2BC, + 1656CD7E058809660012D2BC, + AD665AB6071EB38C00EC5911, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 1656CCAB058802B80012D2BC = { + buildActionMask = 2147483647; + files = ( + 1656CD38058806CE0012D2BC, + 16800E4405880EC4007700A5, + 16800E4505880EC4007700A5, + AD5010A6071F18AE0020300E, + AD5010A8071F18B80020300E, + AD5010BF071F18F00020300E, + AD5010C1071F18FA0020300E, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 1656CCAC058802B80012D2BC = { + buildActionMask = 2147483647; + files = ( + 1656CCE5058805BB0012D2BC, + 1656CD27058806680012D2BC, + 1656CD7F058809660012D2BC, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 1656CCAD058802B80012D2BC = { + buildActionMask = 2147483647; + files = ( + AD665AB0071EB30200EC5911, + AD665AB4071EB36D00EC5911, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 1656CCAE058802B80012D2BC = { + buildPhases = ( + 1656CCAA058802B80012D2BC, + 1656CCAB058802B80012D2BC, + 1656CCAC058802B80012D2BC, + 1656CCAD058802B80012D2BC, + ); + buildRules = ( + ); + buildSettings = { + FRAMEWORK_SEARCH_PATHS = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = common.h; + INFOPLIST_FILE = "versitSaxDriver-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/SaxDrivers-4.3"; + PRODUCT_NAME = versitSaxDriver; + WARNING_CFLAGS = "-Wmost"; + WRAPPER_EXTENSION = sax; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = versitSaxDriver; + productName = versitSaxDriver; + productReference = 16800E2F05880E8E007700A5; + productSettingsXML = " + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + versitSaxDriver + CFBundleGetInfoString + + CFBundleIconFile + + CFBundleIdentifier + com.MySoftwareCompany.versitSaxDriver + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + + CFBundleSignature + ???? + CFBundleVersion + 1.0.0d1 + + +"; + productType = "com.apple.product-type.bundle"; + }; + 1656CCB80588036A0012D2BC = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = "versitSaxDriver-Info.plist"; + refType = 4; + sourceTree = ""; + }; + 1656CCE2058805BB0012D2BC = { + fileEncoding = 5; + indentWidth = 2; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = VSiCalSaxDriver.h; + refType = 4; + sourceTree = ""; + }; + 1656CCE3058805BB0012D2BC = { + fileEncoding = 5; + indentWidth = 2; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = VSiCalSaxDriver.m; + refType = 4; + sourceTree = ""; + }; + 1656CCE4058805BB0012D2BC = { + fileRef = 1656CCE2058805BB0012D2BC; + isa = PBXBuildFile; + settings = { + }; + }; + 1656CCE5058805BB0012D2BC = { + fileRef = 1656CCE3058805BB0012D2BC; + isa = PBXBuildFile; + settings = { + }; + }; + 1656CD1F0588063D0012D2BC = { + children = ( + AD665AB5071EB38C00EC5911, + 1656CD25058806680012D2BC, + 1656CCE3058805BB0012D2BC, + 1656CD7D058809660012D2BC, + ); + isa = PBXGroup; + name = Classes; + refType = 4; + sourceTree = ""; + }; + 1656CD24058806680012D2BC = { + fileEncoding = 5; + indentWidth = 2; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = VSSaxDriver.h; + refType = 4; + sourceTree = ""; + }; + 1656CD25058806680012D2BC = { + fileEncoding = 5; + indentWidth = 2; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = VSSaxDriver.m; + refType = 4; + sourceTree = ""; + }; + 1656CD26058806680012D2BC = { + fileRef = 1656CD24058806680012D2BC; + isa = PBXBuildFile; + settings = { + }; + }; + 1656CD27058806680012D2BC = { + fileRef = 1656CD25058806680012D2BC; + isa = PBXBuildFile; + settings = { + }; + }; + 1656CD37058806CE0012D2BC = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = "bundle-info.plist"; + refType = 4; + sourceTree = ""; + }; + 1656CD38058806CE0012D2BC = { + fileRef = 1656CD37058806CE0012D2BC; + isa = PBXBuildFile; + settings = { + }; + }; + 1656CD7C058809660012D2BC = { + fileEncoding = 5; + indentWidth = 2; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = VSvCardSaxDriver.h; + refType = 4; + sourceTree = ""; + }; + 1656CD7D058809660012D2BC = { + fileEncoding = 5; + indentWidth = 2; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = VSvCardSaxDriver.m; + refType = 4; + sourceTree = ""; + }; + 1656CD7E058809660012D2BC = { + fileRef = 1656CD7C058809660012D2BC; + isa = PBXBuildFile; + settings = { + }; + }; + 1656CD7F058809660012D2BC = { + fileRef = 1656CD7D058809660012D2BC; + isa = PBXBuildFile; + settings = { + }; + }; + 1656CD8F058809E30012D2BC = { + children = ( + 1656CCB80588036A0012D2BC, + 1656CD37058806CE0012D2BC, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 1656CD92058809FD0012D2BC = { + children = ( + AD665AB3071EB36D00EC5911, + AD665AAF071EB30200EC5911, + ); + isa = PBXGroup; + name = Frameworks; + path = ""; + refType = 4; + sourceTree = ""; + }; + 16800E2F05880E8E007700A5 = { + explicitFileType = wrapper.cfbundle; + includeInIndex = 0; + isa = PBXFileReference; + path = versitSaxDriver.sax; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 16800E3905880EA1007700A5 = { + children = ( + 16800E2F05880E8E007700A5, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; + 16800E4205880EC4007700A5 = { + explicitFileType = text; + fileEncoding = 30; + indentWidth = 8; + isa = PBXFileReference; + path = ChangeLog; + refType = 4; + sourceTree = ""; + tabWidth = 8; + usesTabs = 1; + }; + 16800E4305880EC4007700A5 = { + explicitFileType = sourcecode.make; + fileEncoding = 30; + indentWidth = 8; + isa = PBXFileReference; + path = Version; + refType = 4; + sourceTree = ""; + tabWidth = 8; + }; + 16800E4405880EC4007700A5 = { + fileRef = 16800E4205880EC4007700A5; + isa = PBXBuildFile; + settings = { + }; + }; + 16800E4505880EC4007700A5 = { + fileRef = 16800E4305880EC4007700A5; + isa = PBXBuildFile; + settings = { + }; + }; +//160 +//161 +//162 +//163 +//164 +//AD0 +//AD1 +//AD2 +//AD3 +//AD4 + AD5010A5071F18AE0020300E = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + path = README; + refType = 4; + sourceTree = ""; + }; + AD5010A6071F18AE0020300E = { + fileRef = AD5010A5071F18AE0020300E; + isa = PBXBuildFile; + settings = { + }; + }; + AD5010A7071F18B80020300E = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + path = AUTHORS; + refType = 4; + sourceTree = ""; + }; + AD5010A8071F18B80020300E = { + fileRef = AD5010A7071F18B80020300E; + isa = PBXBuildFile; + settings = { + }; + }; + AD5010BE071F18F00020300E = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + path = COPYING; + refType = 4; + sourceTree = ""; + }; + AD5010BF071F18F00020300E = { + fileRef = AD5010BE071F18F00020300E; + isa = PBXBuildFile; + settings = { + }; + }; + AD5010C0071F18FA0020300E = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + path = COPYRIGHT; + refType = 4; + sourceTree = ""; + }; + AD5010C1071F18FA0020300E = { + fileRef = AD5010C0071F18FA0020300E; + isa = PBXBuildFile; + settings = { + }; + }; + AD665AAE071EB2C200EC5911 = { + children = ( + AD665AB7071EB39600EC5911, + AD665AB9071EB39600EC5911, + AD665AB8071EB39600EC5911, + ); + isa = PBXGroup; + name = Makefiles; + refType = 4; + sourceTree = ""; + }; + AD665AAF071EB30200EC5911 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = Foundation.framework; + path = /System/Library/Frameworks/Foundation.framework; + refType = 0; + sourceTree = ""; + }; + AD665AB0071EB30200EC5911 = { + fileRef = AD665AAF071EB30200EC5911; + isa = PBXBuildFile; + settings = { + }; + }; + AD665AB3071EB36D00EC5911 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = SaxObjC.framework; + path = /Library/Frameworks/SaxObjC.framework; + refType = 0; + sourceTree = ""; + }; + AD665AB4071EB36D00EC5911 = { + fileRef = AD665AB3071EB36D00EC5911; + isa = PBXBuildFile; + settings = { + }; + }; + AD665AB5071EB38C00EC5911 = { + fileEncoding = 5; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = common.h; + refType = 4; + sourceTree = ""; + }; + AD665AB6071EB38C00EC5911 = { + fileRef = AD665AB5071EB38C00EC5911; + isa = PBXBuildFile; + settings = { + }; + }; + AD665AB7071EB39600EC5911 = { + explicitFileType = sourcecode.make; + fileEncoding = 5; + indentWidth = 8; + isa = PBXFileReference; + path = GNUmakefile; + refType = 4; + sourceTree = ""; + tabWidth = 8; + }; + AD665AB8071EB39600EC5911 = { + explicitFileType = sourcecode.make; + fileEncoding = 5; + indentWidth = 8; + isa = PBXFileReference; + path = GNUmakefile.postamble; + refType = 4; + sourceTree = ""; + tabWidth = 8; + }; + AD665AB9071EB39600EC5911 = { + explicitFileType = sourcecode.make; + fileEncoding = 5; + indentWidth = 8; + isa = PBXFileReference; + path = GNUmakefile.preamble; + refType = 4; + sourceTree = ""; + tabWidth = 8; + }; + AD665ABF071EB3D500EC5911 = { + children = ( + 1656CD24058806680012D2BC, + 1656CCE2058805BB0012D2BC, + 1656CD7C058809660012D2BC, + ); + isa = PBXGroup; + name = Headers; + path = ""; + refType = 4; + sourceTree = ""; + }; + }; + rootObject = 1656CCA1058802990012D2BC; +}