diff --git a/OpenChange/COPYING b/OpenChange/COPYING
deleted file mode 100644
index 94a9ed024..000000000
--- a/OpenChange/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, 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
-them 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 prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If 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 convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU 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
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/OpenChange/Codepages.h b/OpenChange/Codepages.h
deleted file mode 100644
index 60d8223d8..000000000
--- a/OpenChange/Codepages.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Codepages.h - this file is part of SOGo
- *
- * Copyright (C) 2014 Jesús García Sáez
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-
-
-@interface Codepages
-
-+ (NSDictionary *) getCodepagesTable;
-+ (NSDictionary *) getReverseCodepagesTable;
-
-+ (NSNumber *) getCodepageFromName: (NSString *) name;
-+ (NSString *) getNameFromCodepage: (NSNumber *) codepage;
-
-@end
diff --git a/OpenChange/Codepages.m b/OpenChange/Codepages.m
deleted file mode 100644
index 8776ffe22..000000000
--- a/OpenChange/Codepages.m
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Codepages.m - this file is part of SOGo
- *
- * Copyright (C) 2014 Jesús García Sáez
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import "Codepages.h"
-#import
-
-@implementation Codepages
-
-+ (NSDictionary *) getCodepagesTable
-{
- static NSDictionary *table = nil;
-
- if (table == nil)
- {
- /* http://msdn.microsoft.com/en-us/library/dd317756%28v=vs.85%29.aspx */
- table = [[NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt: 37], @"ibm037",
- [NSNumber numberWithInt: 437], @"ibm437",
- [NSNumber numberWithInt: 500], @"ibm500",
- [NSNumber numberWithInt: 708], @"asmo-708",
- [NSNumber numberWithInt: 720], @"dos-720",
- [NSNumber numberWithInt: 737], @"ibm737",
- [NSNumber numberWithInt: 775], @"ibm775",
- [NSNumber numberWithInt: 850], @"ibm850",
- [NSNumber numberWithInt: 852], @"ibm852",
- [NSNumber numberWithInt: 855], @"ibm855",
- [NSNumber numberWithInt: 857], @"ibm857",
- [NSNumber numberWithInt: 858], @"ibm00858",
- [NSNumber numberWithInt: 860], @"ibm860",
- [NSNumber numberWithInt: 861], @"ibm861",
- [NSNumber numberWithInt: 862], @"dos-862",
- [NSNumber numberWithInt: 863], @"ibm863",
- [NSNumber numberWithInt: 864], @"ibm864",
- [NSNumber numberWithInt: 865], @"ibm865",
- [NSNumber numberWithInt: 866], @"cp866",
- [NSNumber numberWithInt: 869], @"ibm869",
- [NSNumber numberWithInt: 870], @"ibm870",
- [NSNumber numberWithInt: 874], @"windows-874",
- [NSNumber numberWithInt: 875], @"cp875",
- [NSNumber numberWithInt: 932], @"shift_jis",
- [NSNumber numberWithInt: 936], @"gb2312",
- [NSNumber numberWithInt: 949], @"ks_c_5601-1987",
- [NSNumber numberWithInt: 950], @"big5",
- [NSNumber numberWithInt: 1026], @"ibm1026",
- [NSNumber numberWithInt: 1047], @"ibm01047",
- [NSNumber numberWithInt: 1140], @"ibm01140",
- [NSNumber numberWithInt: 1141], @"ibm01141",
- [NSNumber numberWithInt: 1142], @"ibm01142",
- [NSNumber numberWithInt: 1143], @"ibm01143",
- [NSNumber numberWithInt: 1144], @"ibm01144",
- [NSNumber numberWithInt: 1145], @"ibm01145",
- [NSNumber numberWithInt: 1146], @"ibm01146",
- [NSNumber numberWithInt: 1147], @"ibm01147",
- [NSNumber numberWithInt: 1148], @"ibm01148",
- [NSNumber numberWithInt: 1149], @"ibm01149",
- [NSNumber numberWithInt: 1200], @"utf-16",
- [NSNumber numberWithInt: 1201], @"unicodefffe",
- [NSNumber numberWithInt: 1250], @"windows-1250",
- [NSNumber numberWithInt: 1251], @"windows-1251",
- [NSNumber numberWithInt: 1252], @"windows-1252",
- [NSNumber numberWithInt: 1253], @"windows-1253",
- [NSNumber numberWithInt: 1254], @"windows-1254",
- [NSNumber numberWithInt: 1255], @"windows-1255",
- [NSNumber numberWithInt: 1256], @"windows-1256",
- [NSNumber numberWithInt: 1257], @"windows-1257",
- [NSNumber numberWithInt: 1258], @"windows-1258",
- [NSNumber numberWithInt: 1361], @"johab",
- [NSNumber numberWithInt: 10000], @"macintosh",
- [NSNumber numberWithInt: 10001], @"x-mac-japanese",
- [NSNumber numberWithInt: 10002], @"x-mac-chinesetrad",
- [NSNumber numberWithInt: 10003], @"x-mac-korean",
- [NSNumber numberWithInt: 10004], @"x-mac-arabic",
- [NSNumber numberWithInt: 10005], @"x-mac-hebrew",
- [NSNumber numberWithInt: 10006], @"x-mac-greek",
- [NSNumber numberWithInt: 10007], @"x-mac-cyrillic",
- [NSNumber numberWithInt: 10008], @"x-mac-chinesesimp",
- [NSNumber numberWithInt: 10010], @"x-mac-romanian",
- [NSNumber numberWithInt: 10017], @"x-mac-ukrainian",
- [NSNumber numberWithInt: 10021], @"x-mac-thai",
- [NSNumber numberWithInt: 10029], @"x-mac-ce",
- [NSNumber numberWithInt: 10079], @"x-mac-icelandic",
- [NSNumber numberWithInt: 10081], @"x-mac-turkish",
- [NSNumber numberWithInt: 10082], @"x-mac-croatian",
- [NSNumber numberWithInt: 12000], @"utf-32",
- [NSNumber numberWithInt: 12001], @"utf-32be",
- [NSNumber numberWithInt: 20000], @"x-chinese-cns",
- [NSNumber numberWithInt: 20001], @"x-cp20001",
- [NSNumber numberWithInt: 20002], @"x-chinese-eten",
- [NSNumber numberWithInt: 20003], @"x-cp20003",
- [NSNumber numberWithInt: 20004], @"x-cp20004",
- [NSNumber numberWithInt: 20005], @"x-cp20005",
- [NSNumber numberWithInt: 20105], @"x-ia5",
- [NSNumber numberWithInt: 20106], @"x-ia5-german",
- [NSNumber numberWithInt: 20107], @"x-ia5-swedish",
- [NSNumber numberWithInt: 20108], @"x-ia5-norwegian",
- [NSNumber numberWithInt: 20127], @"us-ascii",
- [NSNumber numberWithInt: 20261], @"x-cp20261",
- [NSNumber numberWithInt: 20269], @"x-cp20269",
- [NSNumber numberWithInt: 20273], @"ibm273",
- [NSNumber numberWithInt: 20277], @"ibm277",
- [NSNumber numberWithInt: 20278], @"ibm278",
- [NSNumber numberWithInt: 20280], @"ibm280",
- [NSNumber numberWithInt: 20284], @"ibm284",
- [NSNumber numberWithInt: 20285], @"ibm285",
- [NSNumber numberWithInt: 20290], @"ibm290",
- [NSNumber numberWithInt: 20297], @"ibm297",
- [NSNumber numberWithInt: 20420], @"ibm420",
- [NSNumber numberWithInt: 20423], @"ibm423",
- [NSNumber numberWithInt: 20424], @"ibm424",
- [NSNumber numberWithInt: 20833], @"x-ebcdic-koreanextended",
- [NSNumber numberWithInt: 20838], @"ibm-thai",
- [NSNumber numberWithInt: 20866], @"koi8-r",
- [NSNumber numberWithInt: 20871], @"ibm871",
- [NSNumber numberWithInt: 20880], @"ibm880",
- [NSNumber numberWithInt: 20905], @"ibm905",
- [NSNumber numberWithInt: 20924], @"ibm00924",
- [NSNumber numberWithInt: 20932], @"euc-jp",
- [NSNumber numberWithInt: 20936], @"x-cp20936",
- [NSNumber numberWithInt: 20949], @"x-cp20949",
- [NSNumber numberWithInt: 21025], @"cp1025",
- [NSNumber numberWithInt: 21866], @"koi8-u",
- [NSNumber numberWithInt: 28591], @"iso-8859-1",
- [NSNumber numberWithInt: 28592], @"iso-8859-2",
- [NSNumber numberWithInt: 28593], @"iso-8859-3",
- [NSNumber numberWithInt: 28594], @"iso-8859-4",
- [NSNumber numberWithInt: 28595], @"iso-8859-5",
- [NSNumber numberWithInt: 28596], @"iso-8859-6",
- [NSNumber numberWithInt: 28597], @"iso-8859-7",
- [NSNumber numberWithInt: 28598], @"iso-8859-8",
- [NSNumber numberWithInt: 28599], @"iso-8859-9",
- [NSNumber numberWithInt: 28603], @"iso-8859-13",
- [NSNumber numberWithInt: 28605], @"iso-8859-15",
- [NSNumber numberWithInt: 29001], @"x-europa",
- [NSNumber numberWithInt: 38598], @"iso-8859-8-i",
- [NSNumber numberWithInt: 50220], @"iso-2022-jp",
- [NSNumber numberWithInt: 50221], @"csiso2022jp",
- [NSNumber numberWithInt: 50222], @"iso-2022-jp",
- [NSNumber numberWithInt: 50225], @"iso-2022-kr",
- [NSNumber numberWithInt: 50227], @"x-cp50227",
- [NSNumber numberWithInt: 51932], @"euc-jp",
- [NSNumber numberWithInt: 51936], @"euc-cn",
- [NSNumber numberWithInt: 51949], @"euc-kr",
- [NSNumber numberWithInt: 52936], @"hz-gb-2312",
- [NSNumber numberWithInt: 54936], @"gb18030",
- [NSNumber numberWithInt: 57002], @"x-iscii-de",
- [NSNumber numberWithInt: 57003], @"x-iscii-be",
- [NSNumber numberWithInt: 57004], @"x-iscii-ta",
- [NSNumber numberWithInt: 57005], @"x-iscii-te",
- [NSNumber numberWithInt: 57006], @"x-iscii-as",
- [NSNumber numberWithInt: 57007], @"x-iscii-or",
- [NSNumber numberWithInt: 57008], @"x-iscii-ka",
- [NSNumber numberWithInt: 57009], @"x-iscii-ma",
- [NSNumber numberWithInt: 57010], @"x-iscii-gu",
- [NSNumber numberWithInt: 57011], @"x-iscii-pa",
- [NSNumber numberWithInt: 65000], @"utf-7",
- [NSNumber numberWithInt: 65001], @"utf-8",
- nil] retain];
- }
- return table;
-}
-
-+ (NSDictionary *) getReverseCodepagesTable
-{
- static NSDictionary *table = nil;
-
- if (table == nil)
- {
- NSDictionary *codepages_table;
- NSEnumerator *enumerator;
- NSMutableArray *codepages, *names;
- id key;
- // Build reverse table: (NSNumber) codepage -> (NSString) encoding name
- codepages_table = [self getCodepagesTable];
- codepages = [NSMutableArray arrayWithCapacity: [codepages_table count]];
- names = [NSMutableArray arrayWithCapacity: [codepages_table count]];
- enumerator = [codepages_table keyEnumerator];
- while ((key = [enumerator nextObject]))
- {
- [names addObject: key];
- [codepages addObject: [codepages_table objectForKey: key]];
- }
- table = [[NSDictionary dictionaryWithObjects: names forKeys: codepages] retain];
- }
- return table;
-}
-
-+ (NSNumber *) getCodepageFromName: (NSString *) name
-{
- return [[self getCodepagesTable] objectForKey: [name lowercaseString]];
-}
-
-+ (NSString *) getNameFromCodepage: (NSNumber *) codepage
-{
- return [[self getReverseCodepagesTable] objectForKey: codepage];
-}
-
-@end
diff --git a/OpenChange/GNUmakefile b/OpenChange/GNUmakefile
deleted file mode 100644
index 739fbd95b..000000000
--- a/OpenChange/GNUmakefile
+++ /dev/null
@@ -1,200 +0,0 @@
-
-# GNUstep makefile
-
-include ../config.make
-include $(GNUSTEP_MAKEFILES)/common.make
-include ../Version
-
-BACKEND_VERSION = 1.0.0
-
-### bootstrap library
-MAPISTORESOGO = MAPIStoreSOGo
-LIBRARY_NAME = $(MAPISTORESOGO)
-
-$(MAPISTORESOGO)_VERSION = $(BACKEND_VERSION)
-
-$(MAPISTORESOGO)_OBJC_FILES += \
- MAPIStoreSOGo.m
-
-### backend bundle
-SOGOBACKEND = SOGoBackend
-BUNDLE_NAME = $(SOGOBACKEND)
-BUNDLE_EXTENSION = .MAPIStore
-BUNDLE_INSTALL_DIR = $(SOGO_LIBDIR)
-
-PYTHON = /usr/bin/python
-PYTHON_IS_GOOD = $(shell $(PYTHON) -c 'from sys import version_info; a=version_info; print a[0] == 2 and a[1] >= 6')
-ifeq (${PYTHON_IS_GOOD},False)
-PYTHON = /usr/bin/python2.6
-endif
-
-all::
- @echo " Python executable: ${PYTHON}"
-
-SAMBA_PRIVATE_DIR = $(shell $(PYTHON) ./samba-get-config.py 'private dir' || echo /var/lib/samba/private)
-
-$(SOGOBACKEND)_PRINCIPAL_CLASS = MAPIApplication
-
-$(SOGOBACKEND)_OBJC_FILES += \
- MAPIApplication.m \
- MAPIStoreActiveTables.m \
- MAPIStoreAuthenticator.m \
- MAPIStoreMapping.m \
- MAPIStoreMIME.m \
- MAPIStoreTypes.m \
- MAPIStorePropertySelectors.m \
- MAPIStoreSamDBUtils.m \
- MAPIStoreUserContext.m \
- \
- SOGoMAPIDBMessage.m \
- SOGoCacheGCSObject+MAPIStore.m \
- \
- MAPIStoreAppointmentWrapper.m \
- MAPIStoreAttachment.m \
- MAPIStoreAttachmentTable.m \
- MAPIStoreContext.m \
- MAPIStoreEmbeddedMessage.m \
- MAPIStoreFolder.m \
- MAPIStoreMessage.m \
- MAPIStoreObject.m \
- MAPIStoreObjectProxy.m \
- MAPIStoreSOGoObject.m \
- MAPIStoreTable.m \
- MAPIStoreMessageTable.m \
- MAPIStoreFolderTable.m \
- MAPIStorePermissionsTable.m \
- \
- MAPIStoreDBBaseContext.m \
- MAPIStoreDBFolder.m \
- MAPIStoreDBFolderTable.m \
- MAPIStoreDBMessage.m \
- MAPIStoreDBMessageTable.m \
- \
- MAPIStoreFAIMessage.m \
- MAPIStoreFAIMessageTable.m \
- \
- MAPIStoreGCSBaseContext.m \
- MAPIStoreGCSFolder.m \
- MAPIStoreGCSMessage.m \
- MAPIStoreGCSMessageTable.m \
- \
- MAPIStoreCalTaskFolder.m \
- MAPIStoreCalTaskMessage.m \
- \
- MAPIStoreCalendarAttachment.m \
- MAPIStoreCalendarContext.m \
- MAPIStoreCalendarFolder.m \
- MAPIStoreCalendarMessage.m \
- MAPIStoreCalendarEmbeddedMessage.m \
- MAPIStoreCalendarMessageTable.m \
- MAPIStoreRecurrenceUtils.m \
- \
- MAPIStoreContactsAttachment.m \
- MAPIStoreContactsContext.m \
- MAPIStoreContactsFolder.m \
- MAPIStoreContactsMessage.m \
- MAPIStoreContactsMessageTable.m \
- \
- MAPIStoreTasksContext.m \
- MAPIStoreTasksFolder.m \
- MAPIStoreTasksMessage.m \
- MAPIStoreTasksMessageTable.m \
- \
- MAPIStoreMailAttachment.m \
- MAPIStoreMailContext.m \
- MAPIStoreMailFolder.m \
- MAPIStoreMailFolderTable.m \
- MAPIStoreMailMessage.m \
- MAPIStoreMailVolatileMessage.m \
- MAPIStoreMailMessageTable.m \
- \
- MAPIStoreNotesContext.m \
- MAPIStoreNotesFolder.m \
- MAPIStoreNotesMessage.m \
- \
- MAPIStoreFallbackContext.m \
- \
- MAPIStoreSharingMessage.m \
- \
- NSArray+MAPIStore.m \
- NSData+MAPIStore.m \
- NSDate+MAPIStore.m \
- NSObject+MAPIStore.m \
- NSString+MAPIStore.m \
- NSValue+MAPIStore.m \
- \
- iCalEvent+MAPIStore.m \
- iCalTimeZone+MAPIStore.m \
- \
- RTFHandler.m \
- \
- Codepages.m
-
-
-$(SOGOBACKEND)_RESOURCE_FILES += \
- product.plist
-
-### pl reader
-PLREADER_TOOL = plreader
-$(PLREADER_TOOL)_OBJC_FILES += \
- plreader.m \
-
-DBMSGREADER_TOOL = dbmsgreader
-$(DBMSGREADER_TOOL)_OBJC_FILES += \
- dbmsgreader.m \
- NSObject+PropertyList.m
-
-$(DBMSGREADER_TOOL)_LIB_DIRS += \
- -L../SoObjects/SOGo/SOGo.framework/sogo -lSOGo \
- -L../SOPE/GDLContentStore/obj/ -lGDLContentStore \
- -L../SOPE/NGCards/obj/ -lNGCards \
- -lNGObjWeb \
- $(LIBMAPI_LIBS)
-
-TEST_TOOL_NAME += $(PLREADER_TOOL) $(DBMSGREADER_TOOL)
-
-### cflags and libs
-LIBMAPI_CFLAGS = $(shell pkg-config libmapi --cflags)
-
-ifeq ($(LIBMAPI_CFLAGS),)
-all install::
- @echo "Cannot build the OpenChange SOGo backend (empty CFLAGS for libmapistore)"
-else
-
-SAMBA_LIB_DIR = $(shell pkg-config libmapistore --variable=libdir)
-
-LIBMAPI_LIBS = $(shell pkg-config libmapi --libs)
-
-LIBMAPISTORE_CFLAGS = $(shell pkg-config libmapistore --cflags) -DSAMBA_PREFIX="\"$(shell pkg-config libmapistore --variable=prefix)\""
-LIBMAPISTORE_LIBS = $(shell pkg-config libmapistore --libs) -lmapiproxy -lWEExtensions
-
-$(MAPISTORESOGO)_INSTALL_DIR = $(DESTDIR)/$(SAMBA_LIB_DIR)/mapistore_backends
-$(MAPISTORESOGO)_LIB_DIRS += \
- -L../SoObjects/SOGo/SOGo.framework/sogo/ -lSOGo -lgnustep-base -lobjc -lNGObjWeb \
- $(LIBMAPI_LIBS) \
- $(LIBMAPISTORE_LIBS)
-
-$(SOGOBACKEND)_LIB_DIRS += \
- -L../SoObjects/SOGo/SOGo.framework/sogo/ -lSOGo \
- $(LIBMAPI_LIBS) \
- $(LIBMAPISTORE_LIBS)
-
-ADDITIONAL_INCLUDE_DIRS += \
- -Wall \
- -DSAMBA_PRIVATE_DIR=@"\"$(SAMBA_PRIVATE_DIR)\"" \
- $(LIBMAPI_CFLAGS) \
- $(LIBMAPISTORE_CFLAGS) \
- -I../SoObjects -I../SOPE \
- -DBACKEND_BUNDLE_NAME="@\"$(BUNDLE_NAME)$(BUNDLE_EXTENSION)\"" \
- -DSOGO_BUNDLES_DIR="@\"$(BUNDLE_INSTALL_DIR)\""
-
-ADDITIONAL_LDFLAGS += -Wl,--rpath,$(SOGO_SYSLIBDIR)/sogo
-
--include GNUmakefile.preamble
-include $(GNUSTEP_MAKEFILES)/bundle.make
-include $(GNUSTEP_MAKEFILES)/library.make
-include $(GNUSTEP_MAKEFILES)/test-tool.make
-include $(GNUSTEP_MAKEFILES)/aggregate.make
--include GNUmakefile.postamble
-
-endif
diff --git a/OpenChange/GNUmakefile.preamble b/OpenChange/GNUmakefile.preamble
deleted file mode 100644
index 7dba896b6..000000000
--- a/OpenChange/GNUmakefile.preamble
+++ /dev/null
@@ -1,8 +0,0 @@
-all:: MAPIStorePropertySelectors.m MAPIStorePropertySelectors.h
-
-MAPIStorePropertySelectors.m MAPIStorePropertySelectors.h: gen-property-selectors.py code-MAPIStorePropertySelectors.m code-MAPIStorePropertySelectors.h
- @echo " Auto-generating MAPIStorePropertySelectors.[hm]..."
- @$(PYTHON) ./gen-property-selectors.py -o MAPIStorePropertySelectors $(LIBMAPISTORE_CFLAGS)
-
-distclean clean::
- -rm -f MAPIStorePropertySelectors.m MAPIStorePropertySelectors.h
diff --git a/OpenChange/MAPIApplication.h b/OpenChange/MAPIApplication.h
deleted file mode 100644
index 44fdaa15a..000000000
--- a/OpenChange/MAPIApplication.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* MAPIApplication.h - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc.
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPIAPPLICATION_H
-#define MAPIAPPLICATION_H
-
-#import
-
-@class MAPIStoreUserContext;
-
-@interface MAPIApplication : SoApplication
-{
- MAPIStoreUserContext *userContext;
-}
-
-- (id) authenticatorInContext: (id) context;
-- (MAPIStoreUserContext *) userContext;
-- (void) setUserContext: (MAPIStoreUserContext *) newContext;
-- (void) cleanup;
-
-@end
-
-extern MAPIApplication *MAPIApp;
-
-#endif /* MAPIAPPLICATION_H */
diff --git a/OpenChange/MAPIApplication.m b/OpenChange/MAPIApplication.m
deleted file mode 100644
index 818ec1199..000000000
--- a/OpenChange/MAPIApplication.m
+++ /dev/null
@@ -1,101 +0,0 @@
-/* MAPIApplication.m - this file is part of SOGo
- *
- * Copyright (C) 2010 Inverse inc.
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-
-#import
-#import
-
-#import
-
-#import "MAPIStoreUserContext.h"
-#import "MAPIStoreTypes.h"
-
-#import "MAPIApplication.h"
-
-MAPIApplication *MAPIApp = nil;
-
-@implementation MAPIApplication
-
-+ (BOOL) isCachingEnabled;
-{
- return NO;
-}
-
-- (NSString *) name
-{
- return @"SOGo";
-}
-
-- (id) init
-{
- if (!MAPIApp)
- {
- WEResourceManager *rm;
-
- // TODO publish
- [iCalEntityObject initializeSOGoExtensions];
-
- MAPIApp = [super init];
- [MAPIApp retain];
-
- rm = [[WEResourceManager alloc] init];
- [self setResourceManager:rm];
- [rm release];
-
- utcTZ = [NSTimeZone timeZoneWithName: @"UTC"];
- [utcTZ retain];
- }
-
- return MAPIApp;
-}
-
-- (BOOL) shouldSetupSignalHandlers
-{
- return NO;
-}
-
-- (MAPIStoreUserContext *) userContext
-{
- return userContext;
-}
-
-- (void) setUserContext: (MAPIStoreUserContext *) newContext
-{
- /* user contexts must not be retained here ad their holder (mapistore)
- contexts must be active when any operation occurs. */
- userContext = newContext;
-}
-
-- (id) authenticatorInContext: (id) context
-{
- return [userContext authenticator];
-}
-
-- (void) cleanup
-{
- [userContext deactivate];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreActiveTables.h b/OpenChange/MAPIStoreActiveTables.h
deleted file mode 100644
index 8459bd9c1..000000000
--- a/OpenChange/MAPIStoreActiveTables.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* MAPIStoreActiveTables.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTOREACTIVETABLES_H
-#define MAPISTOREACTIVETABLES_H
-
-#import
-
-@class NSMutableArray;
-
-@class MAPIStoreTable;
-
-@interface MAPIStoreActiveTables : NSObject
-{
- NSMutableArray *records;
-}
-
-+ (id) activeTables;
-
-- (void) registerTable: (MAPIStoreTable *) table;
-- (void) unregisterTable: (MAPIStoreTable *) table;
-
-- (NSArray *) activeTablesForFMID: (uint64_t) fmid
- andType: (uint8_t) tableType;
-
-@end
-
-#endif /* MAPISTOREACTIVETABLES_H */
diff --git a/OpenChange/MAPIStoreActiveTables.m b/OpenChange/MAPIStoreActiveTables.m
deleted file mode 100644
index a9cb0c254..000000000
--- a/OpenChange/MAPIStoreActiveTables.m
+++ /dev/null
@@ -1,198 +0,0 @@
-/* MAPIStoreActiveTables.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* MAPIStoreActiveTables provides an interface to keep accounting of all
- instances of a given table, independently from its store and context.
- Primary useful for notifications across different connections. */
-
-#import
-#import
-
-#import "MAPIStoreFolder.h"
-#import "MAPIStoreTable.h"
-
-#import "MAPIStoreActiveTables.h"
-
-@interface MAPIStoreActiveTableRecord : NSObject
-{
- uint64_t folderId;
- uint8_t tableType;
- MAPIStoreTable *table;
-}
-
-+ (id) recordForTable: (MAPIStoreTable *) newTable;
-- (id) initWithTable: (MAPIStoreTable *) newTable;
-
-- (MAPIStoreTable *) table;
-
-- (BOOL) exactlyMatchesTable: (MAPIStoreTable *) otherTable;
-- (BOOL) matchesFMID: (uint64_t) otherFMid
- andTableType: (uint8_t) otherTableType;
-- (BOOL) matchesTable: (MAPIStoreTable *) otherTable;
-
-@end
-
-@implementation MAPIStoreActiveTableRecord : NSObject
-
-+ (id) recordForTable: (MAPIStoreTable *) newTable
-{
- MAPIStoreActiveTableRecord *record;
-
- record = [[self alloc] initWithTable: newTable];
- [record autorelease];
-
- return record;
-}
-
-- (id) init
-{
- if ((self = [super init]))
- {
- folderId = 0;
- tableType = 0;
- table = nil;
- }
-
- return self;
-}
-
-- (id) initWithTable: (MAPIStoreTable *) newTable
-{
- if ((self = [self init]))
- {
- table = newTable;
- folderId = [[table container] objectId];
- tableType = [table tableType];
- }
-
- return self;
-}
-
-- (MAPIStoreTable *) table
-{
- return table;
-}
-
-- (BOOL) exactlyMatchesTable: (MAPIStoreTable *) otherTable
-{
- return (table == otherTable);
-}
-
-- (BOOL) matchesFMID: (uint64_t) otherFMid
- andTableType: (uint8_t) otherTableType
-{
- return (tableType == otherTableType
- && folderId == otherFMid);
-}
-
-- (BOOL) matchesTable: (MAPIStoreTable *) otherTable
-{
- uint64_t otherFMid;
- BOOL rc;
-
- rc = [self exactlyMatchesTable: otherTable];
- if (!rc)
- {
- otherFMid = [[otherTable container] objectId];
- rc = [self matchesFMID: otherFMid andTableType: [otherTable tableType]];
- }
-
- return rc;
-}
-
-@end
-
-@implementation MAPIStoreActiveTables
-
-+ (id) activeTables
-{
- static MAPIStoreActiveTables *activeTables = nil;
-
- if (!activeTables)
- activeTables = [self new];
-
- return activeTables;
-}
-
-- (id) init
-{
- if ((self = [super init]))
- {
- records = [NSMutableArray new];
- }
-
- return self;
-}
-
-- (void) dealloc
-{
- [records release];
- [super dealloc];
-}
-
-- (void) registerTable: (MAPIStoreTable *) table
-{
- MAPIStoreActiveTableRecord *newRecord;
-
- newRecord = [MAPIStoreActiveTableRecord recordForTable: table];
- [records addObject: newRecord];
-}
-
-- (void) unregisterTable: (MAPIStoreTable *) table
-{
- MAPIStoreActiveTableRecord *currentRecord;
- NSUInteger count, max;
- BOOL done = NO;
-
- max = [records count];
- for (count = 0; !done && count < max; count++)
- {
- currentRecord = [records objectAtIndex: count];
- if ([currentRecord exactlyMatchesTable: table])
- {
- [records removeObject: currentRecord];
- done = YES;
- }
- }
-}
-
-- (NSArray *) activeTablesForFMID: (uint64_t) fmid
- andType: (uint8_t) tableType
-{
- NSUInteger count, max;
- NSMutableArray *tables;
- MAPIStoreActiveTableRecord *currentRecord;
-
- tables = [NSMutableArray arrayWithCapacity: 5];
-
- max = [records count];
- for (count = 0; count < max; count++)
- {
- currentRecord = [records objectAtIndex: count];
- if ([currentRecord matchesFMID: fmid andTableType: tableType])
- [tables addObject: [currentRecord table]];
- }
-
- return tables;
-}
-
-@end
diff --git a/OpenChange/MAPIStoreAppointmentWrapper.h b/OpenChange/MAPIStoreAppointmentWrapper.h
deleted file mode 100644
index 5ed4c83ff..000000000
--- a/OpenChange/MAPIStoreAppointmentWrapper.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* MAPIStoreAppointmentWrapper.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALENDARWRAPPER_H
-#define MAPISTORECALENDARWRAPPER_H
-
-#import
-#import
-#import
-
-#import "MAPIStoreObjectProxy.h"
-
-@class NSTimeZone;
-
-@class iCalAlarm;
-@class iCalCalendar;
-@class iCalEvent;
-
-@class SOGoUser;
-
-@interface MAPIStoreAppointmentWrapper : MAPIStoreObjectProxy
-{
- struct mapistore_connection_info *connInfo;
- iCalCalendar *calendar;
- iCalEvent *firstEvent;
- iCalEvent *event;
- iCalTimeZone *timeZone;
- SOGoUser *user;
- NSString *senderEmail;
- NSData *globalObjectId;
- NSData *cleanGlobalObjectId;
- BOOL alarmSet;
- iCalAlarm *alarm;
- BOOL itipSetup;
- NSString *method;
- iCalPersonPartStat partstat;
-}
-
-+ (id) wrapperWithICalEvent: (iCalEvent *) newEvent
- andUser: (SOGoUser *) newUser
- andSenderEmail: (NSString *) newSenderEmail
- withConnectionInfo: (struct mapistore_connection_info *) newConnInfo;
-- (id) initWithICalEvent: (iCalEvent *) newEvent
- andUser: (SOGoUser *) newUser
- andSenderEmail: (NSString *) newSenderEmail
- withConnectionInfo: (struct mapistore_connection_info *) newConnInfo;
-
-/* getters */
-- (void) fillMessageData: (struct mapistore_message *) dataPtr
- inMemCtx: (TALLOC_CTX *) memCtx;
-
-- (NSString *) creator;
-- (NSString *) owner;
-- (NSUInteger) sensitivity;
-
-- (enum mapistore_error) getPidTagSenderEmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagSenderAddressType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagSenderName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagSenderEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-
-- (enum mapistore_error) getPidTagReceivedByAddressType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagReceivedByEmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagReceivedByName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagReceivedByEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-
-- (enum mapistore_error) getPidTagIconIndex: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagOwnerAppointmentId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidMeetingType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagMessageClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagStartDate: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidAppointmentSequence: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidAppointmentStateFlags: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidResponseStatus: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-
-- (enum mapistore_error) getPidLidAppointmentStartWhole: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidCommonStart: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagEndDate: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidAppointmentEndWhole: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidCommonEnd: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidAppointmentDuration: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidAppointmentSubType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidBusyStatus: (void **) data // TODO
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidIndentedBusyStatus: (void **) data // TODO
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagNormalizedSubject: (void **) data // SUMMARY
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidLocation: (void **) data // LOCATION
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidPrivate: (void **) data // private (bool), should depend on CLASS and permissions
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagSensitivity: (void **) data // not implemented, depends on CLASS
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagImportance: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidTagBody: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidIsRecurring: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidRecurring: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidAppointmentRecur: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidGlobalObjectId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidCleanGlobalObjectId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidServerProcessed: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidServerProcessingActions: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidAppointmentReplyTime: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-
-/* reminders */
-- (enum mapistore_error) getPidLidReminderSet: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidReminderDelta: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidReminderTime: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidReminderSignalTime: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidReminderOverride: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidReminderType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidReminderPlaySound: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getPidLidReminderFileParameter: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx;
-
-@end
-
-#endif /* MAPISTORECALENDARWRAPPER_H */
diff --git a/OpenChange/MAPIStoreAppointmentWrapper.m b/OpenChange/MAPIStoreAppointmentWrapper.m
deleted file mode 100644
index 1881a16a5..000000000
--- a/OpenChange/MAPIStoreAppointmentWrapper.m
+++ /dev/null
@@ -1,2115 +0,0 @@
-/* MAPIStoreAppointmentWrapper.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include
-
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-
-#import "iCalTimeZone+MAPIStore.h"
-#import "MAPIStoreRecurrenceUtils.h"
-#import "MAPIStoreSamDBUtils.h"
-#import "MAPIStoreTypes.h"
-#import "NSArray+MAPIStore.h"
-#import "NSData+MAPIStore.h"
-#import "NSDate+MAPIStore.h"
-#import "NSObject+MAPIStore.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreAppointmentWrapper.h"
-
-#undef DEBUG
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-static NSCharacterSet *hexCharacterSet = nil;
-
-@implementation MAPIStoreAppointmentWrapper
-
-+ (void) initialize
-{
- if (!hexCharacterSet)
- {
- hexCharacterSet = [NSCharacterSet characterSetWithCharactersInString: @"1234567890abcdefABCDEF"];
- [hexCharacterSet retain];
- }
-}
-
-+ (id) wrapperWithICalEvent: (iCalEvent *) newEvent
- andUser: (SOGoUser *) newUser
- andSenderEmail: (NSString *) newSenderEmail
- withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
-{
- MAPIStoreAppointmentWrapper *wrapper;
-
- wrapper = [[self alloc] initWithICalEvent: newEvent
- andUser: newUser
- andSenderEmail: newSenderEmail
- withConnectionInfo: newConnInfo];
- [wrapper autorelease];
-
- return wrapper;
-}
-
-- (id) init
-{
- if ((self = [super init]))
- {
- connInfo = NULL;
- calendar = nil;
- event = nil;
- timeZone = nil;
- senderEmail = nil;
- globalObjectId = nil;
- cleanGlobalObjectId = nil;
- user = nil;
- alarmSet = NO;
- itipSetup = NO;
- alarm = nil;
- method = nil;
- }
-
- return self;
-}
-
-- (void) _setupITIPContextFromAttendees
-{
- iCalPerson *attendee = nil;
- NSArray *attendees;
-
- attendee = [event userAsAttendee: user];
- if (attendee)
- method = @"REQUEST";
- else if ([event userIsOrganizer: user])
- {
- if (senderEmail)
- attendee = [event findAttendeeWithEmail: senderEmail];
- if (!attendee)
- {
- attendees = [event attendees];
- if ([attendees count] == 1)
- attendee = [attendees objectAtIndex: 0];
- }
- if (attendee)
- {
- method = @"REPLY";
- partstat = [attendee participationStatus];
- }
- else
- {
- [self logWithFormat: @"no attendee matching sender found"];
- method = nil;
- }
- }
- else
- method = nil;
-
- [method retain];
-}
-
-- (void) _setupITIPContext
-{
- NSArray *attendees;
- NSUInteger max;
-
- /* Here we attempt to determine the type of message from the ITIP method
- contained in the event. It it fails, we attempt to determine this by
- checking the identity of the organizer and of the attendees. */
- itipSetup = YES;
- method = [[event parent] method];
- if ([method length] > 0)
- {
- method = [method uppercaseString];
- [method retain];
- if ([method isEqualToString: @"REPLY"])
- {
- attendees = [event attendees];
- max = [attendees count];
- if (max == 1)
- partstat = [[attendees objectAtIndex: 0] participationStatus];
- else if (max > 1)
- [self _setupITIPContextFromAttendees];
- }
- }
- else
- [self _setupITIPContextFromAttendees];
-}
-
-- (id) initWithICalEvent: (iCalEvent *) newEvent
- andUser: (SOGoUser *) newUser
- andSenderEmail: (NSString *) newSenderEmail
- withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
-{
- NSArray *events;
- iCalTimeZone *tz;
-
- if ((self = [self init]))
- {
- connInfo = newConnInfo;
- ASSIGN (calendar, [newEvent parent]);
- event = newEvent;
- events = [calendar events];
- firstEvent = [events objectAtIndex: 0];
- ASSIGN (user, newUser);
- ASSIGN (senderEmail, newSenderEmail);
- /* If newEvent comes from the client, we set its time zone in
- updateFromMAPIProperties. If it is not present, we use the
- time zone of the user */
- tz = (iCalTimeZone *) [calendar firstChildWithTag: @"vtimezone"];
- if (!tz)
- {
- tz = [iCalTimeZone timeZoneForName: [[[user userDefaults] timeZone] name]];
- if (!tz)
- [self logWithFormat: @"no time zone could be set"];
- }
- ASSIGN (timeZone, tz);
-
- [self _setupITIPContext];
- }
-
- return self;
-}
-
-- (void) dealloc
-{
- [calendar release];
- [timeZone release];
- [user release];
- [senderEmail release];
- [globalObjectId release];
- [cleanGlobalObjectId release];
- [alarm release];
- [method release];
- [super dealloc];
-}
-
-- (void) fillMessageData: (struct mapistore_message *) msgData
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *username, *cn, *email;
- NSData *entryId;
- NSArray *attendees;
- iCalPerson *person;
- iCalPersonPartStat partStat;
- uint32_t partStatValue;
- SOGoUserManager *mgr;
- NSDictionary *contactInfos;
- struct mapistore_message_recipient *recipient;
- int count, max, p;
-
- msgData->columns = set_SPropTagArray (msgData, 9,
- PR_OBJECT_TYPE,
- PR_DISPLAY_TYPE,
- PR_7BIT_DISPLAY_NAME_UNICODE,
- PR_SMTP_ADDRESS_UNICODE,
- PR_SEND_INTERNET_ENCODING,
- PR_RECIPIENT_DISPLAY_NAME_UNICODE,
- PR_RECIPIENT_FLAGS,
- PR_RECIPIENT_ENTRYID,
- PR_RECIPIENT_TRACKSTATUS);
-// ,
-// PR_RECORD_KEY);
-
- attendees = [event attendees];
- max = [attendees count];
-
- if (max > 0)
- {
- mgr = [SOGoUserManager sharedUserManager];
- msgData->recipients_count = max + 1;
- msgData->recipients = talloc_array (msgData, struct mapistore_message_recipient, max + 1);
- for (count = 0; count < max; count++)
- {
- recipient = msgData->recipients + count;
-
- person = [attendees objectAtIndex: count];
- cn = [person cn];
- email = [person rfc822Email];
- if ([cn length] == 0)
- cn = email;
- contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
-
- if (contactInfos)
- {
- username = [contactInfos objectForKey: @"sAMAccountName"];
- recipient->username = [username asUnicodeInMemCtx: msgData];
- entryId = MAPIStoreInternalEntryId (connInfo, username);
- }
- else
- {
- recipient->username = NULL;
- entryId = MAPIStoreExternalEntryId (cn, email);
- }
- recipient->type = [[person role] isEqualToString: @"OPT-PARTICIPANT"] ? MAPI_CC : MAPI_TO;
-
- /* properties */
- p = 0;
- recipient->data = talloc_array (msgData, void *, msgData->columns->cValues);
- memset (recipient->data, 0, msgData->columns->cValues * sizeof (void *));
-
- // PR_OBJECT_TYPE = MAPI_MAILUSER (see MAPI_OBJTYPE)
- recipient->data[p] = MAPILongValue (msgData, MAPI_MAILUSER);
- p++;
-
- // PR_DISPLAY_TYPE = DT_MAILUSER (see MS-NSPI)
- recipient->data[p] = MAPILongValue (msgData, 0);
- p++;
-
- // PR_7BIT_DISPLAY_NAME_UNICODE
- recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
- p++;
-
- // PR_SMTP_ADDRESS_UNICODE
- recipient->data[p] = [email asUnicodeInMemCtx: msgData];
- p++;
-
- // PR_SEND_INTERNET_ENCODING = 0x00060000 (plain text, see OXCMAIL)
- recipient->data[p] = MAPILongValue (msgData, 0x00060000);
- p++;
-
- // PR_RECIPIENT_DISPLAY_NAME_UNICODE
- recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
- p++;
-
- // PR_RECIPIENT_FLAGS
- recipient->data[p] = MAPILongValue (msgData, 1);
- p++;
-
- // PR_RECIPIENT_ENTRYID
- recipient->data[p] = [entryId asBinaryInMemCtx: msgData];
- p++;
-
- // PR_RECIPIENT_TRACKSTATUS
- /*
- respNone 0x00000000
- No response is required for this object. This is the case for Appointment objects and Meeting Response objects.
- respOrganized 0x00000001
- This Meeting object belongs to the organizer.
- respTentative 0x00000002
- This value on the attendee's Meeting object indicates that the
- attendee has tentatively accepted the Meeting Request object.
- respAccepted 0x00000003
- This value on the attendee's Meeting object indicates that the
- attendee has accepted the Meeting Request object.
- respDeclined 0x00000004
- This value on the attendee's Meeting object indicates that the attendee has declined the Meeting Request
- object.
- respNotResponded 0x00000005
- This value on the attendee's Meeting object indicates that the attendee has
- not yet responded. This value is on the Meet
- */
- partStat = [person participationStatus];
- switch (partStat)
- {
- case iCalPersonPartStatAccepted:
- partStatValue = 3;
- break;
- case iCalPersonPartStatDeclined:
- partStatValue = 4;
- break;
- case iCalPersonPartStatTentative:
- partStatValue = 2;
- break;
- default:
- partStatValue = 5;
- }
- recipient->data[p] = MAPILongValue (msgData, partStatValue);
- p++;
-
- // // PR_RECORD_KEY
- // recipient->data[p] = [entryId asBinaryInMemCtx: msgData];
- // p++;
- }
-
- /* On with the organizer: */
- {
- recipient = msgData->recipients + max;
-
- person = [event organizer];
- cn = [person cn];
- email = [person rfc822Email];
- contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
-
- if (contactInfos)
- {
- username = [contactInfos objectForKey: @"sAMAccountName"];
- recipient->username = [username asUnicodeInMemCtx: msgData];
- entryId = MAPIStoreInternalEntryId (connInfo, username);
- }
- else
- {
- recipient->username = NULL;
- entryId = MAPIStoreExternalEntryId (cn, email);
- }
- recipient->type = MAPI_TO;
-
- p = 0;
- recipient->data = talloc_array (msgData, void *, msgData->columns->cValues);
- memset (recipient->data, 0, msgData->columns->cValues * sizeof (void *));
-
- // PR_OBJECT_TYPE = MAPI_MAILUSER (see MAPI_OBJTYPE)
- recipient->data[p] = MAPILongValue (msgData, MAPI_MAILUSER);
- p++;
-
- // PR_DISPLAY_TYPE = DT_MAILUSER (see MS-NSPI)
- recipient->data[p] = MAPILongValue (msgData, 0);
- p++;
-
- // PR_7BIT_DISPLAY_NAME_UNICODE
- recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
- p++;
-
- // PR_SMTP_ADDRESS_UNICODE
- recipient->data[p] = [email asUnicodeInMemCtx: msgData];
- p++;
-
- // PR_SEND_INTERNET_ENCODING = 0x00060000 (plain text, see OXCMAIL)
- recipient->data[p] = MAPILongValue (msgData, 0x00060000);
- p++;
-
- // PR_RECIPIENT_DISPLAY_NAME_UNICODE
- recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
- p++;
-
- // PR_RECIPIENT_FLAGS
- recipient->data[p] = MAPILongValue (msgData, 3);
- p++;
-
- // PR_RECIPIENT_ENTRYID = NULL
- recipient->data[p] = [entryId asBinaryInMemCtx: msgData];
- p++;
-
- // PR_RECIPIENT_TRACKSTATUS
- /*
- respNone 0x00000000
- No response is required for this object. This is the case for Appointment objects and Meeting Response objects.
- respOrganized 0x00000001
- This Meeting object belongs to the organizer.
- respTentative 0x00000002
- This value on the attendee's Meeting object indicates that the
- attendee has tentatively accepted the Meeting Request object.
- respAccepted 0x00000003
- This value on the attendee's Meeting object indicates that the
- attendee has accepted the Meeting Request object.
- respDeclined 0x00000004
- This value on the attendee's Meeting object indicates that the attendee has declined the Meeting Request
- object.
- respNotResponded 0x00000005
- This value on the attendee's Meeting object indicates that the attendee has
- not yet responded. This value is on the Meet
- */
- recipient->data[p] = MAPILongValue (msgData, 1);
- p++;
-
- // // PR_RECORD_KEY
- // recipient->data[p] = [entryId asBinaryInMemCtx: msgData];
- // p++;
- }
- }
-}
-
-- (enum mapistore_error) getPidTagIconIndex: (void **) data // TODO
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- uint32_t longValue;
-
- /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx:
- Single instance appointment: 0x00000400
- Recurring appointment: 0x00000401
- Single instance meeting: 0x00000402
- Recurring meeting: 0x00000403
- Meeting request: 0x00000404
- Accept: 0x00000405
- Decline: 0x00000406
- Tentativly: 0x00000407
- Cancellation: 0x00000408
- Informational update: 0x00000409 */
-
- // if ([headerMethod isEqualToString: @"REQUEST"])
- // longValue = 0x0404;
- // else
- // longValue = 0x0400;
-
- if (!itipSetup)
- [self _setupITIPContext];
-
- longValue = 0x0400;
-
- if (method)
- {
- if ([method isEqualToString: @"REQUEST"])
- longValue |= 0x0004;
- else if ([method isEqualToString: @"REPLY"])
- {
- longValue |= 0x0004;
- switch (partstat)
- {
- case iCalPersonPartStatAccepted:
- longValue |= 0x0001;
- break;
- case iCalPersonPartStatDeclined:
- longValue |= 0x0002;
- break;
- case iCalPersonPartStatTentative:
- longValue |= 0x0003;
- break;
- default:
- longValue = 0x0400;
- [self logWithFormat: @"unhandled part stat"];
- }
- }
- else if ([method isEqualToString: @"CANCEL"])
- longValue |= 0x0008;
- }
- else
- {
- if ([event isRecurrent])
- longValue |= 0x0001;
- if ([[event attendees] count] > 0)
- longValue |= 0x0002;
- }
-
- *data = MAPILongValue (memCtx, longValue);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagOwnerAppointmentId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- const char *utf8UID;
- union {
- uint32_t longValue;
- char charValue[4];
- } value;
- NSUInteger max, length;
-
- if ([[event attendees] count] > 0)
- {
- utf8UID = [[event uid] UTF8String];
- length = strlen (utf8UID);
- max = 2;
- if (length < max)
- max = length;
- memcpy (value.charValue, utf8UID, max);
- memcpy (value.charValue + 2, utf8UID + length - 2, max);
-
- *data = MAPILongValue (memCtx, value.longValue);
-
- rc = MAPISTORE_SUCCESS;
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidMeetingType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- /* TODO
- See 2.2.6.5 PidLidMeetingType (OXOCAL) */
- *data = MAPILongValue (memCtx, 0x00000001);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidOwnerCriticalChange: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
- NSCalendarDate *lastModified;
-
- if ([[event attendees] count] > 0)
- {
- lastModified = [event lastModified];
- if (lastModified)
- {
- *data = [lastModified asFileTimeInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
- }
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidAttendeeCriticalChange: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
- NSCalendarDate *lastModified;
-
- if ([[event attendees] count] > 0)
- {
- lastModified = [event lastModified];
- if (lastModified)
- {
- *data = [lastModified asFileTimeInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
- }
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagMessageClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- const char *className;
-
- if (!itipSetup)
- [self _setupITIPContext];
-
- if (method)
- {
- if ([method isEqualToString: @"REQUEST"])
- className = "IPM.Schedule.Meeting.Request";
- else if ([method isEqualToString: @"REPLY"])
- {
- switch (partstat)
- {
- case iCalPersonPartStatAccepted:
- className = "IPM.Schedule.Meeting.Resp.Pos";
- break;
- case iCalPersonPartStatDeclined:
- className = "IPM.Schedule.Meeting.Resp.Neg";
- break;
- case iCalPersonPartStatTentative:
- className = "IPM.Schedule.Meeting.Resp.Tent";
- break;
- default:
- className = "IPM.Appointment";
- [self logWithFormat: @"unhandled part stat"];
- }
- }
- else if ([method isEqualToString: @"COUNTER"])
- className = "IPM.Schedule.Meeting.Resp.Tent";
- else if ([method isEqualToString: @"CANCEL"])
- className = "IPM.Schedule.Meeting.Cancelled";
- else
- {
- className = "IPM.Appointment";
- [self logWithFormat: @"unhandled method: %@", method];
- }
- }
- else
- className = "IPM.Appointment";
- *data = talloc_strdup(memCtx, className);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidAppointmentMessageClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = talloc_strdup (memCtx, "IPM.Appointment");
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidFInvited: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidAppointmentSequence: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx, [[event sequence] unsignedIntValue]);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidAppointmentStateFlags: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- uint32_t flags = 0x00;
-
- if ([[event attendees] count] > 0)
- {
- flags |= 0x01; /* asfMeeting */
- if ([event userAsAttendee: user])
- flags |= 0x02; /* asfReceived */
- /* TODO: asfCancelled */
- }
-
- *data = MAPILongValue (memCtx, flags);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidResponseStatus: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- uint32_t status = 0x00;
- iCalPerson *person;
-
- if ([[event attendees] count] > 0)
- {
- if ([event userIsOrganizer: user])
- status = 1;
- else
- {
- person = [event userAsAttendee: user];
- if (person)
- {
- switch ([person participationStatus])
- {
- case iCalPersonPartStatTentative:
- status = 2;
- break;
- case iCalPersonPartStatAccepted:
- status = 3;
- break;
- case iCalPersonPartStatDeclined:
- status = 4;
- break;
- default:
- status = 5;
- }
- }
- }
- }
-
- *data = MAPILongValue (memCtx, status);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidAppointmentNotAllowPropose: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidAppointmentStartWhole: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSCalendarDate *dateValue;
-
- // if ([event isRecurrent])
- // dateValue = [event firstRecurrenceStartDate];
- // else
- dateValue = [event startDate];
- if ([event isAllDay])
- dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagStartDate: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- /* "The PidTagStartDate property ([MS-OXPROPS] section 2.1077) SHOULD be
- set, and when set, it MUST be equal to the value of the
- PidLidAppointmentStartWhole property (section 2.2.1.5).". Not true for
- exceptions, where it is the normal start date for the day of the
- exception. */
- NSCalendarDate *dateValue;
-
- dateValue = [event recurrenceId];
- if (!dateValue)
- dateValue = [event startDate];
- if ([event isAllDay])
- dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidCommonStart: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSCalendarDate *dateValue;
-
- dateValue = [firstEvent startDate];
- if ([firstEvent isAllDay])
- dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidClipStart: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- NSCalendarDate *dateValue, *start;
-
- if ([event isRecurrent])
- {
- /* [MS-OXOCAL] For a recurring series, this property specifies
- midnight in the user's machine time zone, on the date of the
- first instance, then is persisted in UTC. */
- start = [event startDate];
- dateValue = [NSCalendarDate dateWithYear: [start yearOfCommonEra]
- month: [start monthOfYear]
- day: [start dayOfMonth]
- hour: 0 minute: 0 second: 0
- timeZone: utcTZ];
- dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
- else if ([event recurrenceId] != nil)
- rc = MAPISTORE_ERR_NOT_FOUND;
- else
- rc = [self getPidLidAppointmentStartWhole: data inMemCtx: memCtx];
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidAppointmentEndWhole: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSCalendarDate *dateValue;
- NSInteger offset;
-
- // if ([event isRecurrent])
- // dateValue = [event firstRecurrenceStartDate];
- // else
- dateValue = [event startDate];
- offset = [event durationAsTimeInterval];
- if ([event isAllDay])
- offset -= [[timeZone periodForDate: dateValue] secondsOffsetFromGMT];
- dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
- hours: 0 minutes: 0
- seconds: offset];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagEndDate: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSCalendarDate *dateValue;
- NSInteger offset;
-
- dateValue = [event recurrenceId];
- if (!dateValue)
- dateValue = [event startDate];
- offset = [firstEvent durationAsTimeInterval];
- if ([firstEvent isAllDay])
- offset -= [[timeZone periodForDate: dateValue] secondsOffsetFromGMT];
- dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
- hours: 0 minutes: 0
- seconds: offset];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidCommonEnd: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSCalendarDate *dateValue;
- NSInteger offset;
-
- // if ([event isRecurrent])
- // dateValue = [event firstRecurrenceStartDate];
- // else
- dateValue = [firstEvent startDate];
- offset = [firstEvent durationAsTimeInterval];
- if ([event isAllDay])
- offset -= [[timeZone periodForDate: dateValue] secondsOffsetFromGMT];
- dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
- hours: 0 minutes: 0
- seconds: offset];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidClipEnd: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- NSCalendarDate *dateValue;
- iCalRecurrenceRule *rrule;
-
- if ([event isRecurrent])
- {
- rrule = [[event recurrenceRules] objectAtIndex: 0];
- dateValue = [rrule untilDate];
- if (dateValue && [event isAllDay])
- dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
- else
- dateValue = [NSCalendarDate dateWithYear: 4500 month: 8 day: 31
- hour: 23 minute: 59 second: 00
- timeZone: utcTZ];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
- else if ([event recurrenceId] != nil)
- rc = MAPISTORE_ERR_NOT_FOUND;
- else
- rc = [self getPidLidAppointmentEndWhole: data inMemCtx: memCtx];
-
- return rc;
-}
-
-- (enum mapistore_error) _getEntryIdFromCN: (NSString *) cn
- andEmail: (NSString *) email
- inData: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *username;
- SOGoUserManager *mgr;
- NSDictionary *contactInfos;
- NSData *entryId;
-
- mgr = [SOGoUserManager sharedUserManager];
- contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
- if (contactInfos)
- {
- username = [contactInfos objectForKey: @"sAMAccountName"];
- entryId = MAPIStoreInternalEntryId (connInfo, username);
- }
- else
- entryId = MAPIStoreExternalEntryId (cn, email);
-
- *data = [entryId asBinaryInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) _getEmailAddress: (void **) data
- forICalPerson: (iCalPerson *) person
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- NSString *email;
-
- email = [person rfc822Email];
- if ([email length] > 0)
- {
- *data = [email asUnicodeInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) _getAddrType: (void **) data
- forICalPerson: (iCalPerson *) person
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = [@"SMTP" asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) _getName: (void **) data
- forICalPerson: (iCalPerson *) person
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- NSString *cn;
-
- cn = [person cn];
- if ([cn length] > 0)
- {
- *data = [cn asUnicodeInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) _getEntryId: (void **) data
- forICalPerson: (iCalPerson *) person
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
- NSString *email, *cn;
-
- if (person)
- {
- email = [person rfc822Email];
- if ([email length] > 0)
- {
- cn = [person cn];
- rc = [self _getEntryIdFromCN: cn andEmail: email
- inData: data
- inMemCtx: memCtx];
- }
- }
-
- return rc;
-}
-
-/* sender (organizer) */
-- (enum mapistore_error) getPidTagSenderEmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getEmailAddress: data
- forICalPerson: [event organizer]
- inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagSenderAddressType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getAddrType: data
- forICalPerson: [event organizer]
- inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagSenderName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getName: data
- forICalPerson: [event organizer]
- inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagSenderEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getEntryId: data
- forICalPerson: [event organizer]
- inMemCtx: memCtx];
-}
-
-/* creator (only if created from Outlook/SOGo or organizer as fallback */
-- (NSString *) creator
-{
- iCalPerson *person;
- NSDictionary *contactInfos;
- NSString *creator = nil, *email;
- SOGoUserManager *mgr;
-
- creator = [[event uniqueChildWithTag: @"x-sogo-component-created-by"]
- flattenedValuesForKey: @""];
- if ([creator length] == 0)
- {
- person = [event organizer];
- if (person)
- {
- email = [person rfc822Email];
- if ([email length] > 0)
- {
- mgr = [SOGoUserManager sharedUserManager];
- contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
- if (contactInfos)
- creator = [contactInfos objectForKey: @"sAMAccountName"];
- }
- }
- }
- return creator;
-}
-
-/* owner is the organizer of the event, if none, try with the creator
- who has saved only from Outlook or SOGo */
-- (NSString *) owner
-{
- iCalPerson *person;
- NSDictionary *contactInfos;
- NSString *email, *owner = nil;
- SOGoUserManager *mgr;
-
- person = [event organizer];
- if (person)
- {
- email = [person rfc822Email];
- if ([email length] > 0)
- {
- mgr = [SOGoUserManager sharedUserManager];
- contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
- if (contactInfos)
- owner = [contactInfos objectForKey: @"sAMAccountName"];
- }
- }
-
- if (!owner)
- owner = [[event uniqueChildWithTag: @"x-sogo-component-created-by"]
- flattenedValuesForKey: @""];
-
- return owner;
-}
-
-- (NSUInteger) sensitivity
-{
- NSString *accessClass = nil;
- NSUInteger v;
-
- accessClass = [event accessClass];
- if (accessClass)
- {
- if ([accessClass isEqualToString: @"X-PERSONAL"])
- v = 0x1;
- else if ([accessClass isEqualToString: @"PRIVATE"])
- v = 0x2;
- else if ([accessClass isEqualToString: @"CONFIDENTIAL"])
- v = 0x3;
- else
- v = 0x0; /* PUBLIC */
- }
- else
- v = 0x0; /* PUBLIC */
-
- return v;
-}
-
-/* sender representing */
-- (enum mapistore_error) getPidTagSentRepresentingEmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidTagSenderEmailAddress: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagSentRepresentingAddressType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getSMTPAddrType: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagSentRepresentingName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidTagSenderName: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagSentRepresentingEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidTagSenderEntryId: data inMemCtx: memCtx];
-}
-
-/* attendee */
-- (enum mapistore_error) getPidTagReceivedByEmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getEmailAddress: data
- forICalPerson: [event userAsAttendee: user]
- inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagReceivedByAddressType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getAddrType: data
- forICalPerson: [event userAsAttendee: user]
- inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagReceivedByName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getName: data
- forICalPerson: [event userAsAttendee: user]
- inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagReceivedByEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getEntryId: data
- forICalPerson: [event userAsAttendee: user]
- inMemCtx: memCtx];
-}
-/* /attendee */
-
-- (enum mapistore_error) getPidLidAppointmentDuration: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSTimeInterval timeValue;
-
- timeValue = [[event endDate] timeIntervalSinceDate: [event startDate]];
- *data = MAPILongValue (memCtx, (uint32_t) (timeValue / 60));
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidAppointmentSubType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPIBoolValue (memCtx, [event isAllDay]);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidBusyStatus: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- uint8_t value;
-
- value = 0x2; // olBusy
-
- if (![event isOpaque])
- value = 0x0; // olFree
-
- *data = MAPILongValue (memCtx, value);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidIndentedBusyStatus: (void **) data // TODO
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidLidBusyStatus: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagNormalizedSubject: (void **) data // SUMMARY
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = [[event summary] asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidLocation: (void **) data // LOCATION
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_SUCCESS;
- NSString *location;
-
- location = [event location];
- if (location)
- *data = [location asUnicodeInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidWhere: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidLidLocation: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidServerProcessed: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- /* TODO: we need to check whether the event has been processed internally by
- SOGo or if it was received only by mail. We only assume the SOGo case
- here. */
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidServerProcessingActions: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx,
- 0x00000010 /* cpsCreatedOnPrincipal */
- | 0x00000080 /* cpsUpdatedCalItem */
- | 0x00000100 /* cpsCopiedOldProperties */);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidPrivate: (void **) data // private (bool), should depend on CLASS and permissions
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if ([event symbolicAccessClass] == iCalAccessPublic)
- return [self getNo: data inMemCtx: memCtx];
-
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagSensitivity: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- /* See [MS-OXCICAL] Section 2.1.3.11.20.4 */
- uint32_t v;
-
- v = (uint32_t) [self sensitivity];
- *data = MAPILongValue (memCtx, v);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagImportance: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- uint32_t v;
- if ([[event priority] isEqualToString: @"9"])
- v = 0x0;
- else if ([[event priority] isEqualToString: @"1"])
- v = 0x2;
- else
- v = 0x1;
-
- *data = MAPILongValue (memCtx, v);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidNameKeywords: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- /* See [MS-OXCICAL] Section 2.1.3.1.1.20.3 */
- NSArray *categories;
-
- categories = [event categories];
- if (categories)
- {
- *data = [categories asMVUnicodeInMemCtx: memCtx];
- return MAPISTORE_SUCCESS;
- }
- else
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidTagBody: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- NSRange range;
- NSString *stringValue;
- NSString *trimingString = @"\r\n\n";
-
- /* FIXME: there is a confusion in NGCards around "comment" and "description" */
- stringValue = [event comment];
- if ([stringValue length] > 0
- && ![stringValue isEqualToString: @"\r\n"]
- && ![stringValue isEqualToString: @"\n"])
- {
- /* Avoiding those trail weird characters at event description */
- range = [stringValue rangeOfString: trimingString
- options: NSBackwardsSearch];
- if (range.location != NSNotFound)
- {
- stringValue = [stringValue substringToIndex: (NSMaxRange(range) -1)];
- }
-
- rc = MAPISTORE_SUCCESS;
- *data = [stringValue asUnicodeInMemCtx: memCtx];
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagInternetCodepage: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- /* ref:
- http://msdn.microsoft.com/en-us/library/dd317756%28v=vs.85%29.aspx
-
- minimal list that should be handled:
- us-ascii: 20127
- iso-8859-1: 28591
- iso-8859-15: 28605
- utf-8: 65001 */
- *data = MAPILongValue(memCtx, 65001);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidRecurring: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPIBoolValue (memCtx, [event isRecurrent]);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidIsRecurring: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPIBoolValue (memCtx,
- [event isRecurrent]
- || ([event recurrenceId] != nil));
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidIsException: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPIBoolValue (memCtx, [event recurrenceId] != nil);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidExceptionReplaceTime: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- NSCalendarDate *dateValue;
-
- dateValue = [event recurrenceId];
- if (dateValue)
- {
- rc = MAPISTORE_SUCCESS;
-
- if ([event isAllDay])
- dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidRecurrencePattern: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = [@"No description" asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (void) _fillExceptionInfo: (struct ExceptionInfo *) exceptionInfo
- andExtendedException: (struct ExtendedException *) extendedException
- withException: (iCalEvent *) exceptionEvent
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- iCalEventChanges *changes;
- NSArray *changedProperties;
- NSCalendarDate *dateValue;
-
- changes = [iCalEventChanges changesFromEvent: event toEvent: exceptionEvent];
-
- memset (exceptionInfo, 0, sizeof (struct ExceptionInfo));
- memset (extendedException, 0, sizeof (struct ExtendedException));
- extendedException->ChangeHighlight.Size = sizeof (uint32_t);
-
- dateValue = [timeZone computedDateForDate: [exceptionEvent startDate]];
- exceptionInfo->StartDateTime = [dateValue asMinutesSince1601];
- extendedException->ChangeHighlight.Value = BIT_CH_START;
- extendedException->StartDateTime = exceptionInfo->StartDateTime;
-
- dateValue = [timeZone computedDateForDate: [exceptionEvent endDate]];
- exceptionInfo->EndDateTime = [dateValue asMinutesSince1601];
- extendedException->ChangeHighlight.Value |= BIT_CH_END;
- extendedException->EndDateTime = exceptionInfo->EndDateTime;
-
- dateValue = [timeZone computedDateForDate: [exceptionEvent recurrenceId]];
- exceptionInfo->OriginalStartDate = [dateValue asMinutesSince1601];
- extendedException->OriginalStartDate = exceptionInfo->OriginalStartDate;
-
- changedProperties = [changes updatedProperties];
- if ([changedProperties containsObject: @"summary"])
- {
- extendedException->ChangeHighlight.Value |= BIT_CH_SUBJECT;
- extendedException->Subject
- = [[exceptionEvent summary] asUnicodeInMemCtx: memCtx];
-
- exceptionInfo->OverrideFlags |= ARO_SUBJECT;
- exceptionInfo->Subject.subjectMsg.msg
- = (uint8_t *) extendedException->Subject;
- /* FIXME: this will fail with non ascii chars */
- exceptionInfo->Subject.subjectMsg.msgLength2 = [[exceptionEvent summary] length];
- exceptionInfo->Subject.subjectMsg.msgLength = exceptionInfo->Subject.subjectMsg.msgLength2 + 1;
- }
- if ([changedProperties containsObject: @"location"])
- {
- extendedException->ChangeHighlight.Value |= BIT_CH_LOCATION;
- extendedException->Location
- = [[exceptionEvent location] asUnicodeInMemCtx: memCtx];
- exceptionInfo->OverrideFlags |= ARO_LOCATION;
- exceptionInfo->Location.locationMsg.msg
- = (uint8_t *) extendedException->Location;
- /* FIXME: this will fail with non ascii chars */
- exceptionInfo->Location.locationMsg.msgLength2 = [[exceptionEvent location] length];
- exceptionInfo->Location.locationMsg.msgLength = exceptionInfo->Location.locationMsg.msgLength2 + 1;
- }
- if ([event isAllDay] != [exceptionEvent isAllDay])
- {
- exceptionInfo->OverrideFlags |= ARO_SUBTYPE;
- exceptionInfo->SubType.sType = [exceptionEvent isAllDay];
- }
-}
-
-// - (struct SBinary_short *) _computeAppointmentRecurInMemCtx: (TALLOC_CTX *) memCtx
-- (struct Binary_r *) _computeAppointmentRecurInMemCtx: (TALLOC_CTX *) memCtx
-{
- struct AppointmentRecurrencePattern *arp;
- struct Binary_r *bin;
- // struct SBinary_short *sBin;
- NSCalendarDate *firstStartDate;
- iCalRecurrenceRule *rule;
- NSUInteger startMinutes;
- NSArray *events, *exceptions;
- iCalEvent *exceptionEvent;
- NSUInteger count, max;
-
- rule = [[event recurrenceRules] objectAtIndex: 0];
-
- firstStartDate = [event firstRecurrenceStartDate];
- if (firstStartDate)
- {
- arp = talloc_zero (NULL, struct AppointmentRecurrencePattern);
- [rule fillRecurrencePattern: &arp->RecurrencePattern
- withEvent: event
- inMemCtx: arp];
- arp->ReaderVersion2 = 0x00003006;
- arp->WriterVersion2 = 0x00003008; /* 0x3008 for compatibility with
- ol2003 */
-
- /* All day events' dates are specified in floating time
- ([MS-OXCICAL] 2.1.3.1.1.20.10). The StartTimeOffset and EndTimeOffset
- fields are relative to midnight of those days ([MS-OXOCAL] 2.2.1.44.5),
- so no time zone adjustment is needed */
- if (![event isAllDay])
- firstStartDate = [timeZone computedDateForDate: firstStartDate];
- startMinutes = ([firstStartDate hourOfDay] * 60
- + [firstStartDate minuteOfHour]);
- arp->StartTimeOffset = startMinutes;
- arp->EndTimeOffset = (startMinutes
- + (NSUInteger) ([event durationAsTimeInterval]
- / 60));
-
- events = [[event parent] events];
- exceptions
- = [events subarrayWithRange: NSMakeRange (1, [events count] - 1)];
- max = [exceptions count];
- arp->ExceptionCount = max;
- arp->ExceptionInfo = talloc_array (memCtx, struct ExceptionInfo, max);
- arp->ExtendedException = talloc_array (memCtx, struct ExtendedException, max);
- for (count = 0; count < max; count++)
- {
- exceptionEvent = [exceptions objectAtIndex: count];
- [self _fillExceptionInfo: arp->ExceptionInfo + count
- andExtendedException: arp->ExtendedException + count
- withException: exceptionEvent
- inMemCtx: arp];
- }
- arp->ReservedBlock1Size = 0;
- arp->ReservedBlock2Size = 0;
-
- /* Currently ignored in property.idl: arp->ReservedBlock2Size = 0; */
-
- /* convert struct to blob */
- // sBin = talloc_zero (memCtx, struct SBinary_short);
- bin = set_AppointmentRecurrencePattern (memCtx, arp);
- // sBin->cb = bin->cb;
- // sBin->lpb = bin->lpb;
- talloc_free (arp);
-
- // DEBUG(5, ("To client:\n"));
- // NDR_PRINT_DEBUG (AppointmentRecurrencePattern, arp);
- }
- else
- {
- [self errorWithFormat: @"no first occurrence found in rule: %@", rule];
- // bin = NULL;
- bin = NULL;
- }
-
- return bin;
-}
-
-/* exception 12345 + 123456 (exchange):
- 81ad0102 (PT_BINARY):
- named prop
- guid: {00062002-0000-0000-c000-000000000046}
- dispid: 0x00008216
- (163 bytes)
- 04 30 04 30 0a 20 00 00 | \x04 0 \x04 0 \x0a \x00 \x00
- 00 00 00 00 00 00 a0 05 | \x00 \x00 \x00 \x00 \x00 \x00 \xa0 \x05
- 00 00 00 00 00 00 23 20 | \x00 \x00 \x00 \x00 \x00 \x00 #
- 00 00 0a 00 00 00 00 00 | \x00 \x00 \x0a \x00 \x00 \x00 \x00 \x00
- 00 00 01 00 00 00 a0 c6 | \x00 \x00 \x01 \x00 \x00 \x00 \xa0 \xc6
- e6 0c 01 00 00 00 a0 c6 | \xe6 \x0c \x01 \x00 \x00 \x00 \xa0 \xc6
- e6 0c 00 c1 e6 0c df 80 | \xe6 \x0c \x00 \xc1 \xe6 \x0c \xdf \x80
- e9 5a 06 30 00 00 08 30 | \xe9 Z \x06 0 \x00 \x00 \x08 0
- 00 00 66 03 00 00 84 03 | \x00 \x00 f \x03 \x00 \x00 \x84 \x03
- 00 00 01 00 e8 c9 e6 0c | \x00 \x00 \x01 \x00 \xe8 \xc9 \xe6 \x0c
- f6 ca e6 0c 06 ca e6 0c | \xf6 \xca \xe6 \x0c \x06 \xca \xe6 \x0c
- 11 00 06 00 05 00 31 32 | \x11 \x00 \x06 \x00 \x05 \x00 1 2
- 33 34 35 07 00 06 00 31 | 3 4 5 \x07 \x00 \x06 \x00 1
- 32 33 34 35 36 00 00 00 | 2 3 4 5 6 \x00 \x00 \x00
- 00 00 00 00 00 e8 c9 e6 | \x00 \x00 \x00 \x00 \x00 \xe8 \xc9 \xe6
- 0c f6 ca e6 0c 06 ca e6 | \x0c \xf6 \xca \xe6 \x0c \x06 \xca \xe6
- 0c 05 00 31 00 32 00 33 | \x0c \x05 \x00 1 \x00 2 \x00 3
- 00 34 00 35 00 06 00 31 | \x00 4 \x00 5 \x00 \x06 \x00 1
- 00 32 00 33 00 34 00 35 | \x00 2 \x00 3 \x00 4 \x00 5
- 00 36 00 00 00 00 00 00 | \x00 6 \x00 \x00 \x00 \x00 \x00 \x00
- 00 00 00 | \x00 \x00 \x00
-
-openchange:
- 918b0102 (PT_BINARY):
- named prop
- guid: {00062002-0000-0000-c000-000000000046}
- dispid: 0x00008216
- (167 bytes)
-
-
-recurrence pattern
- readerversion: 04 30
- writerversion: 04 30
- recurfrequency: 0a 20 (daily)
- patterntype: 00 00
- calendartype: 00 00
- firstdatetime: 00 00 00 00
- period: a0 05 00 00 (1440 minutes)
- slidingflag: 00 00 00 00
- patterntypespecific: (0 bytes)
- endtype: 23 20 00 00
- occurrencecount: *00->0a 00 00 00 (meaningless since no enddate)
- firstdow: 00 00 00 00
- deletedicount: 01 00 00 00
- deletedinstancedates: (1)
- a0 c6 e6 0c
- modifiedicount: 01 00 00 00
- modifiedinstancedates: (1)
- a0 c6 e6 0c
- startdate: 00 c1 e6 0c
- enddate: df 80 e9 5a
-ReaderVersion2: 06 30 00 00
-WriterVersion2: 08 30 00 00
-StartTimeOffset: 66 03 00 00
-EndTimeOffset: 84 03 00 00
-ExceptionCount: 01 00
-ExceptionInfos: (1)
- StartDateTime: *e7->e8 *ca->c9 e6 0c
- EndDateTime: *e6->f6 *cb->ca e6 0c
- OriginalStartDate: *a0->06 *c6->ca e6 0c
- OverrideFlags: 11 00
- SubjectLength2: 06 00
- SubjectLength: 05 00
- Subject: 31 32 33 34 35
- LocationLength2: 07 00
- LocationLength: 06 00
- Location: 31 32 33 34 35 36
-ReservedBlock1Size: 00 00 00 00
-ExtendedException: (1)
- ReservedBlockEE1Size: 00 00 00 00
- StartDateTime: *e7->e8 *ca->c9 e6 0c
- EndDateTime: *e6->f6 *cb->ca e6 0c
- OriginalStartDate: *a0->06 *c6->ca e6 0c
- WideCharSubjectLength *06->05
- WideCharSubject: 00 31 00 32 00 33 00 34 00 35 00 [2bytes sup: 00 00]
- LocationLength: *07->06
- Location 00 31 00 32 00 33 00 34 00 35 00 36 00 00
- ReservedBlockEE2Size: 00 00 00 00
-ReservedBlockEE2Size: 00 00 00 00
-*/
-
-- (enum mapistore_error) getPidLidAppointmentRecur: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- if ([event isRecurrent])
- *data = [self _computeAppointmentRecurInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidRecurrenceType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- iCalRecurrenceFrequency freq;
- iCalRecurrenceRule *rrule;
- enum RecurrenceType rectype;
-
- if ([event isRecurrent])
- {
- rrule = [[event recurrenceRules] objectAtIndex: 0];
- freq = [rrule frequency];
- if (freq == iCalRecurrenceFrequenceDaily)
- rectype = rectypeDaily;
- else if (freq == iCalRecurrenceFrequenceWeekly)
- rectype = rectypeWeekly;
- else if (freq == iCalRecurrenceFrequenceMonthly)
- rectype = rectypeMonthly;
- else if (freq == iCalRecurrenceFrequenceYearly)
- rectype = rectypeYearly;
- else
- rectype = rectypeNone; /* or "unsupported" */
-
- *data = MAPILongValue (memCtx, rectype);
- rc = MAPISTORE_SUCCESS;
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-// - (enum mapistore_error) getPidLidGlobalObjectId: (void **) data
-// inMemCtx: (TALLOC_CTX *) memCtx
-// {
-// static char byteArrayId[] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0,
-// 0x00, 0x74, 0xC5, 0xB7, 0x10, 0x1A, 0x82,
-// 0xE0, 0x08};
-// static char X[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-// NSMutableData *nsData;
-// NSData *uidData;
-// NSCalendarDate *creationTime;
-// struct FILETIME *creationFileTime;
-// uint32_t uidDataLength;
-
-// nsData = [NSMutableData dataWithCapacity: 256];
-// [nsData appendBytes: byteArrayId length: 16];
-
-// /* FIXME TODO */
-// [nsData appendBytes: X length: 4];
-// /* /FIXME */
-
-// creationTime = [event created];
-// if (!creationTime)
-// {
-// [self logWithFormat: @"" __location__ ": event has no 'CREATED' tag -> inventing one"];
-// creationTime = [event lastModified];
-// if (!creationTime)
-// creationTime = [NSCalendarDate date];
-// }
-// creationFileTime = [creationTime asFileTimeInMemCtx: NULL];
-// [nsData appendBytes: &creationFileTime->dwLowDateTime length: 4];
-// [nsData appendBytes: &creationFileTime->dwHighDateTime length: 4];
-// talloc_free (creationFileTime);
-
-// uidData = [[event uid] dataUsingEncoding: NSUTF8StringEncoding];
-// uidDataLength = [uidData length];
-// [nsData appendBytes: &uidDataLength length: 4];
-// [nsData appendData: uidData];
-// *data = [nsData asBinaryInMemCtx: memCtx];
-
-// return MAPISTORE_SUCCESS;
-// }
-
-- (void) _setInstanceDate: (struct GlobalObjectId *) newGlobalId
- fromDate: (NSCalendarDate *) instanceDate;
-{
- uint16_t year;
- NSCalendarDate *dateValue;
-
- if (instanceDate)
- {
- dateValue = [timeZone computedDateForDate: instanceDate];
- year = [dateValue yearOfCommonEra];
- newGlobalId->YH = year >> 8;
- newGlobalId->YL = year & 0xff;
- newGlobalId->Month = [dateValue monthOfYear];
- newGlobalId->D = [dateValue dayOfMonth];
- }
-}
-
-/* note: returns a retained object */
-- (NSData *) _objectIdAsNSData: (const struct GlobalObjectId *) newGlobalId
-{
- NSData *nsData;
- TALLOC_CTX *localMemCtx;
- struct ndr_push *ndr;
-
- localMemCtx = talloc_zero (NULL, TALLOC_CTX);
- ndr = ndr_push_init_ctx (localMemCtx);
- ndr_push_GlobalObjectId (ndr, NDR_SCALARS, newGlobalId);
- nsData = [[NSData alloc] initWithBytes: ndr->data
- length: ndr->offset];
- talloc_free (localMemCtx);
-
- return nsData;
-}
-
-- (void) _computeGlobalObjectIds
-{
- static NSString *prefix = @"040000008200e00074c5b7101a82e008";
- static uint8_t dataPrefix[] = { 0x76, 0x43, 0x61, 0x6c, 0x2d, 0x55, 0x69,
- 0x64, 0x01, 0x00, 0x00, 0x00 };
- NSString *uid;
- const char *uidAsUTF8;
- NSUInteger uidLength;
- NSData *encodedGlobalIdData;
- struct Binary_r *encodedGlobalIdBinary;
- struct GlobalObjectId *encodedGlobalId;
- struct GlobalObjectId newGlobalId;
- uint16_t year;
- NSData *binPrefix;
- TALLOC_CTX *localMemCtx;
-
- localMemCtx = talloc_zero (NULL, TALLOC_CTX);
-
- memset (&newGlobalId, 0, sizeof (struct GlobalObjectId));
-
- uid = [event uid];
- uidLength = [uid length];
- if (uidLength >= 82 && (uidLength % 2) == 0 && [uid hasPrefix: prefix]
- && [[uid stringByTrimmingCharactersInSet: hexCharacterSet] length] == 0)
- {
- encodedGlobalIdData = [uid convertHexStringToBytes];
- if (encodedGlobalIdData)
- {
- encodedGlobalIdBinary
- = [encodedGlobalIdData asBinaryInMemCtx: localMemCtx];
- encodedGlobalId = get_GlobalObjectId (localMemCtx,
- encodedGlobalIdBinary);
- if (encodedGlobalId)
- {
- memcpy (newGlobalId.ByteArrayID,
- encodedGlobalId->ByteArrayID,
- 16);
- year = ((uint16_t) encodedGlobalId->YH << 8) | encodedGlobalId->YL;
- if (year >= 1601 && year <= 4500
- && encodedGlobalId->Month > 0 && encodedGlobalId->Month < 13
- && encodedGlobalId->D > 0 && encodedGlobalId->D < 31)
- {
- newGlobalId.YH = encodedGlobalId->YH;
- newGlobalId.YL = encodedGlobalId->YL;
- newGlobalId.Month = encodedGlobalId->Month;
- newGlobalId.D = encodedGlobalId->D;
- }
- else
- [self _setInstanceDate: &newGlobalId
- fromDate: [event recurrenceId]];
- newGlobalId.CreationTime = encodedGlobalId->CreationTime;
- memcpy (newGlobalId.X, encodedGlobalId->X, 8);
- newGlobalId.Size = encodedGlobalId->Size;
- newGlobalId.Data = encodedGlobalId->Data;
- }
- else
- abort ();
- }
- else
- abort ();
- }
- else
- {
- binPrefix = [prefix convertHexStringToBytes];
- [binPrefix getBytes: &newGlobalId.ByteArrayID];
- [self _setInstanceDate: &newGlobalId
- fromDate: [event recurrenceId]];
- uidAsUTF8 = [uid UTF8String];
- newGlobalId.Size = 0x0c + strlen (uidAsUTF8);
- newGlobalId.Data = talloc_array (localMemCtx, uint8_t,
- newGlobalId.Size);
- memcpy (newGlobalId.Data, dataPrefix, 0x0c);
- memcpy (newGlobalId.Data + 0x0c, uidAsUTF8, newGlobalId.Size - 0x0c);
- }
-
- globalObjectId = [self _objectIdAsNSData: &newGlobalId];
-
- newGlobalId.YH = 0;
- newGlobalId.YL = 0;
- newGlobalId.Month = 0;
- newGlobalId.D = 0;
- cleanGlobalObjectId = [self _objectIdAsNSData: &newGlobalId];
-
- talloc_free (localMemCtx);
-}
-
-- (enum mapistore_error) getPidLidGlobalObjectId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- if (!globalObjectId)
- [self _computeGlobalObjectIds];
-
- if (globalObjectId)
- *data = [globalObjectId asBinaryInMemCtx: memCtx];
- else
- abort ();
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidCleanGlobalObjectId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- if (!cleanGlobalObjectId)
- [self _computeGlobalObjectIds];
-
- if (cleanGlobalObjectId)
- *data = [cleanGlobalObjectId asBinaryInMemCtx: memCtx];
- else
- abort ();
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidAppointmentReplyTime: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- /* We always return LAST-MODIFIED, which is a hack, but one that works
- because: the user is either (NOT recipient OR (is recipient AND its
- status is N/A), where this value should not be taken into account by the
- client OR the user is recipient and its status is defined, where this
- value is thus correct because the recipient status is the only property
- that can be changed. */
- enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
- NSCalendarDate *lastModified;
-
- lastModified = [event lastModified];
- if (lastModified)
- {
- *data = [lastModified asFileTimeInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
-
- return rc;
-}
-
-/* reminders */
-- (void) _setupAlarm
-{
- NSArray *alarms;
- NSUInteger count, max;
- iCalAlarm *currentAlarm;
- NSString *action, *webstatus;
-
- alarms = [event alarms];
- max = [alarms count];
- for (count = 0; !alarm && count < max; count++)
- {
- currentAlarm = [alarms objectAtIndex: count];
-
- // Only handle 'display' alarms
- action = [currentAlarm action];
- if ([action caseInsensitiveCompare: @"display"] != NSOrderedSame)
- continue;
-
- // Ignore alarms already triggered
- webstatus = [[currentAlarm trigger] value: 0 ofAttribute: @"x-webstatus"];
- if ([webstatus caseInsensitiveCompare: @"triggered"] == NSOrderedSame)
- continue;
-
- ASSIGN (alarm, currentAlarm);
- }
-
- alarmSet = YES;
-}
-
-- (enum mapistore_error) getPidLidReminderSet: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if (!alarmSet)
- [self _setupAlarm];
-
- *data = MAPIBoolValue (memCtx, (alarm != nil));
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidReminderTime: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if (!alarmSet)
- [self _setupAlarm];
-
- return (alarm
- ? [self getPidTagStartDate: data inMemCtx: memCtx]
- : MAPISTORE_ERR_NOT_FOUND);
-}
-
-- (enum mapistore_error) getPidLidReminderDelta: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
- iCalTrigger *trigger;
- NSCalendarDate *startDate, *relationDate, *alarmDate;
- NSTimeInterval interval;
- NSString *relation;
-
- if (!alarmSet)
- [self _setupAlarm];
-
- if (alarm)
- {
- trigger = [alarm trigger];
- if ([[trigger valueType] caseInsensitiveCompare: @"DURATION"] == NSOrderedSame)
- {
- startDate = [event startDate];
- relation = [[trigger relationType] lowercaseString];
- interval = [[trigger flattenedValuesForKey: @""]
- durationAsTimeInterval];
- if ([relation isEqualToString: @"end"])
- relationDate = [event endDate];
- else
- relationDate = startDate;
-
- // Compute the next alarm date with respect to the reference date
- if (relationDate)
- {
- alarmDate = [relationDate addTimeInterval: interval];
- interval = [startDate timeIntervalSinceDate: alarmDate];
- *data = MAPILongValue (memCtx, (int) (interval / 60));
- rc = MAPISTORE_SUCCESS;
- }
- }
- }
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidReminderSignalTime: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_SUCCESS;
- NSCalendarDate *alarmDate;
-
- if (!alarmSet)
- [self _setupAlarm];
-
- if (alarm)
- {
- alarmDate = [alarm nextAlarmDate];
- *data = [alarmDate asFileTimeInMemCtx: memCtx];
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidReminderOverride: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- if (!alarmSet)
- [self _setupAlarm];
-
- if (alarm)
- *data = MAPIBoolValue (memCtx, YES);
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidReminderPlaySound: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- if (!alarmSet)
- [self _setupAlarm];
-
- if (alarm)
- *data = MAPIBoolValue (memCtx, YES);
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidReminderFileParameter: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- // if (!alarmSet)
- // [self _setupAlarm];
-
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidLidReminderType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidLidTimeZoneDescription: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- NSString *tzid;
-
- tzid = [timeZone tzId];
- if ([tzid length] > 0)
- {
- *data = [tzid asUnicodeInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidTimeZoneStruct: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
-
- *data = [timeZone asTimeZoneStructInMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidAppointmentTimeZoneDefinitionStartDisplay: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
-
- /* [MS-OXOCAL] 3.1.5.5.1: This property is used in floating (all-day) events,
- specified in floating time, to convert the start date from UTC to the user's
- time zone */
- if ([event isAllDay] || [event isRecurrent])
- {
- /* [MS-OXOCAL] 2.2.1.42: This property can only have the E flag set in the
- TimeZoneDefinition struct */
- *data = [timeZone asZoneTimeDefinitionWithFlags: TZRULE_FLAG_EFFECTIVE_TZREG
- inMemCtx: memCtx];
- rc = MAPISTORE_SUCCESS;
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidAppointmentTimeZoneDefinitionEndDisplay: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidLidAppointmentTimeZoneDefinitionStartDisplay: data
- inMemCtx: memCtx];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreAttachment.h b/OpenChange/MAPIStoreAttachment.h
deleted file mode 100644
index 24ba32c43..000000000
--- a/OpenChange/MAPIStoreAttachment.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* MAPIStoreAttachment.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTOREATTACHMENT_H
-#define MAPISTOREATTACHMENT_H
-
-#import "MAPIStoreObject.h"
-
-@class NSData;
-@class MAPIStoreEmbeddedMessage;
-
-@interface MAPIStoreAttachment : MAPIStoreObject
-{
- uint32_t aid;
-}
-
-- (void) setAID: (uint32_t) newAID;
-- (uint32_t) AID;
-
-- (enum mapistore_error) openEmbeddedMessage: (MAPIStoreEmbeddedMessage **) messagePtr
- withMID: (uint64_t *) mid
- withMAPIStoreMsg: (struct mapistore_message **) mapistoreMsgPtr
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) createEmbeddedMessage: (MAPIStoreEmbeddedMessage **) messagePtr
- withMAPIStoreMsg: (struct mapistore_message **) mapistoreMsgPtr
- inMemCtx: (TALLOC_CTX *) memCtx;
-
-/* helpers */
-- (NSData *) mimeAttachTag;
-
-/* move & copy operations */
-- (void) copyToAttachment: (MAPIStoreAttachment *) newAttachment inMemCtx: (TALLOC_CTX *) memCtx;
-
-/* subclasses */
-- (MAPIStoreEmbeddedMessage *) openEmbeddedMessage;
-- (MAPIStoreEmbeddedMessage *) createEmbeddedMessage;
-
-@end
-
-#endif /* MAPISTOREATTACHMENT_H */
diff --git a/OpenChange/MAPIStoreAttachment.m b/OpenChange/MAPIStoreAttachment.m
deleted file mode 100644
index 754436d7e..000000000
--- a/OpenChange/MAPIStoreAttachment.m
+++ /dev/null
@@ -1,194 +0,0 @@
-/* MAPIStoreAttachment.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-
-#import "MAPIStoreAttachment.h"
-#import "MAPIStoreEmbeddedMessage.h"
-#import "MAPIStoreContext.h"
-#import "MAPIStoreMapping.h"
-#import "MAPIStoreMessage.h"
-#import "MAPIStoreTypes.h"
-#import "NSObject+MAPIStore.h"
-
-#undef DEBUG
-#include
-#include
-#include
-#include
-
-@implementation MAPIStoreAttachment
-
-- (void) setAID: (uint32_t) newAID
-{
- aid = newAID;
-}
-
-- (uint32_t) AID
-{
- return aid;
-}
-
-- (NSString *) nameInContainer
-{
- return [NSString stringWithFormat: @"%d", aid];
-}
-
-- (NSData *) mimeAttachTag
-{
- static NSData *mimeAttachTag = nil;
- char tagBytes[] = {0x2a, 0x86, 0x48, 0x86, 0xf7, 0x14, 0x03, 0x0a, 0x04};
-
- if (!mimeAttachTag)
- {
- mimeAttachTag = [NSData dataWithBytes: tagBytes length: 9];
- [mimeAttachTag retain];
- }
-
- return mimeAttachTag;
-}
-
-- (enum mapistore_error) getPidTagMid: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongLongValue (memCtx, [container objectId]);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachNumber: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx, aid);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagRenderingPosition: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx, 0xffffffff);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAccessLevel: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getLongZero: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) openEmbeddedMessage: (MAPIStoreEmbeddedMessage **) messagePtr
- withMID: (uint64_t *) mid
- withMAPIStoreMsg: (struct mapistore_message **) mapistoreMsgPtr
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- MAPIStoreEmbeddedMessage *attMessage;
- struct mapistore_message *mapistoreMsg;
-
- mapistoreMsg = talloc_zero (memCtx, struct mapistore_message);
-
- attMessage = [self openEmbeddedMessage];
- if (attMessage)
- {
- *mid = [attMessage objectId];
- *messagePtr = attMessage;
- *mapistoreMsgPtr = mapistoreMsg;
- }
-
- return (attMessage ? MAPISTORE_SUCCESS : MAPISTORE_ERROR);
-}
-
-- (enum mapistore_error) createEmbeddedMessage: (MAPIStoreEmbeddedMessage **) messagePtr
- withMAPIStoreMsg: (struct mapistore_message **) mapistoreMsgPtr
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- MAPIStoreEmbeddedMessage *attMessage;
- struct mapistore_message *mapistoreMsg;
-
- mapistoreMsg = talloc_zero (memCtx, struct mapistore_message);
- attMessage = [self createEmbeddedMessage];
- if (attMessage)
- {
- *messagePtr = attMessage;
- *mapistoreMsgPtr = mapistoreMsg;
- }
-
- return (attMessage ? MAPISTORE_SUCCESS : MAPISTORE_ERROR);
-}
-
-- (NSDate *) creationTime
-{
- return [container creationTime];
-}
-
-- (NSDate *) lastModificationTime
-{
- return [container lastModificationTime];
-}
-
-- (uint64_t) objectVersion
-{
- /* attachments have no version number */
- return ULLONG_MAX;
-}
-
-- (void) copyToAttachment: (MAPIStoreAttachment *) newAttachment inMemCtx: (TALLOC_CTX *) memCtx
-{
- void *attachMethod;
- enum mapistore_error error;
- MAPIStoreEmbeddedMessage *embeddedMessage, *newEmbeddedMessage;
-
- [self copyPropertiesToObject: newAttachment inMemCtx: memCtx];
-
- attachMethod = NULL;
- error = [self getProperty: &attachMethod
- withTag: PidTagAttachMethod
- inMemCtx: NULL];
- if (error == MAPISTORE_SUCCESS && attachMethod)
- {
- if (*(uint32_t *) attachMethod == afEmbeddedMessage)
- {
- embeddedMessage = [self openEmbeddedMessage];
- newEmbeddedMessage = [newAttachment createEmbeddedMessage];
- [embeddedMessage copyToMessage: newEmbeddedMessage inMemCtx: memCtx];
- }
- talloc_free (attachMethod);
- }
-}
-
-/* subclasses */
-- (MAPIStoreEmbeddedMessage *) openEmbeddedMessage
-{
- // [self subclassResponsibility: _cmd];
-
- return nil;
-}
-
-- (MAPIStoreEmbeddedMessage *) createEmbeddedMessage
-{
- [self subclassResponsibility: _cmd];
-
- return nil;
-}
-
-@end
diff --git a/OpenChange/MAPIStoreAttachmentTable.h b/OpenChange/MAPIStoreAttachmentTable.h
deleted file mode 100644
index d066a7b8c..000000000
--- a/OpenChange/MAPIStoreAttachmentTable.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* MAPIStoreAttachmentTable.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTOREATTACHMENTTABLE_H
-#define MAPISTOREATTACHMENTTABLE_H
-
-#import "MAPIStoreTable.h"
-
-@interface MAPIStoreAttachmentTable : MAPIStoreTable
-@end
-
-#endif /* MAPISTOREATTACHMENTTABLE_H */
diff --git a/OpenChange/MAPIStoreAttachmentTable.m b/OpenChange/MAPIStoreAttachmentTable.m
deleted file mode 100644
index 61c82dd1b..000000000
--- a/OpenChange/MAPIStoreAttachmentTable.m
+++ /dev/null
@@ -1,73 +0,0 @@
-/* MAPIStoreAttachmentTable.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-
-#import "MAPIStoreMessage.h"
-
-#import "MAPIStoreAttachmentTable.h"
-
-@implementation MAPIStoreAttachmentTable
-
-- (NSArray *) childKeys
-{
- if (!childKeys)
- {
- childKeys = [(MAPIStoreMessage *)
- container attachmentKeysMatchingQualifier: nil
- andSortOrderings: sortOrderings];
- [childKeys retain];
- }
-
- return childKeys;
-}
-
-- (NSArray *) restrictedChildKeys
-{
- NSArray *keys;
-
- if (!restrictedChildKeys)
- {
- if (restrictionState != MAPIRestrictionStateAlwaysTrue)
- {
- if (restrictionState == MAPIRestrictionStateNeedsEval)
- keys = [(MAPIStoreMessage *)
- container attachmentKeysMatchingQualifier: restriction
- andSortOrderings: sortOrderings];
- else
- keys = [NSArray array];
- }
- else
- keys = [self childKeys];
-
- ASSIGN (restrictedChildKeys, keys);
- }
-
- return restrictedChildKeys;
-}
-
-- (id) lookupChild: (NSString *) childKey
-{
- return [(MAPIStoreMessage *) container lookupAttachment: childKey];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreAuthenticator.h b/OpenChange/MAPIStoreAuthenticator.h
deleted file mode 100644
index ce88a60be..000000000
--- a/OpenChange/MAPIStoreAuthenticator.h
+++ /dev/null
@@ -1,54 +0,0 @@
-
-/* MAPIStoreAuthenticator.h - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc.
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTOREAUTHENTICATOR_H
-#define MAPISTOREAUTHENTICATOR_H
-
-#import
-
-@class NSString;
-@class NSURL;
-
-@class WOContext;
-
-@interface MAPIStoreAuthenticator : NSObject
-{
- NSString *username;
- NSString *password;
-}
-
-- (void) setUsername: (NSString *) newUsername;
-- (NSString *) username;
-
-- (void) setPassword: (NSString *) newPassword;
-
-- (NSString *) imapPasswordInContext: (WOContext *) context
- forURL: (NSURL *) server
- forceRenew: (BOOL) renew;
-
-- (NSString *) passwordInContext: (WOContext *) context;
-
-
-@end
-
-#endif /* MAPISTOREAUTHENTICATOR_H */
diff --git a/OpenChange/MAPIStoreAuthenticator.m b/OpenChange/MAPIStoreAuthenticator.m
deleted file mode 100644
index 41e4ed081..000000000
--- a/OpenChange/MAPIStoreAuthenticator.m
+++ /dev/null
@@ -1,79 +0,0 @@
-/* MAPIStoreAuthenticator.m - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-
-#import
-#import
-
-#import "MAPIStoreAuthenticator.h"
-
-@implementation MAPIStoreAuthenticator
-
-- (void) dealloc
-{
- [username release];
- [password release];
- [super dealloc];
-}
-
-- (void) setUsername: (NSString *) newUsername
-{
- ASSIGN (username, newUsername);
-}
-
-- (NSString *) username
-{
- return username;
-}
-
-- (void) setPassword: (NSString *) newPassword
-{
- ASSIGN (password, newPassword);
-}
-
-- (SOGoUser *) userInContext: (WOContext *)_ctx
-{
- return [SOGoUser userWithLogin: username
- roles: [NSArray arrayWithObject: SoRole_Authenticated]];
-}
-
-- (NSString *) imapPasswordInContext: (WOContext *) context
- forURL: (NSURL *) server
- forceRenew: (BOOL) renew
-{
- NSString *imapPassword;
-
- if (renew)
- imapPassword = nil;
- else
- imapPassword = password;
-
- return imapPassword;
-}
-
-- (NSString *) passwordInContext: (WOContext *) context
-{
- return password;
-}
-@end
diff --git a/OpenChange/MAPIStoreCalTaskFolder.h b/OpenChange/MAPIStoreCalTaskFolder.h
deleted file mode 100644
index 92b75e463..000000000
--- a/OpenChange/MAPIStoreCalTaskFolder.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* MAPIStoreCalTaskFolder.h - this file is part of SOGo
- *
- * Copyright (C) 2016 Enrique J. Hernandez
- *
- * Author: Enrique J. Hernandez
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALTASKFOLDER_H
-#define MAPISTORECALTASKFOLDER_H
-
-#import "MAPIStoreGCSFolder.h"
-
-/* This class is intended to share code between Calendar and Tasks as
- of nowadays share the table */
-
-@interface MAPIStoreCalTaskFolder : MAPIStoreGCSFolder
-
-@end
-
-#endif /* MAPISTORECALTASKFOLDER_H */
diff --git a/OpenChange/MAPIStoreCalTaskFolder.m b/OpenChange/MAPIStoreCalTaskFolder.m
deleted file mode 100644
index 8876c77e5..000000000
--- a/OpenChange/MAPIStoreCalTaskFolder.m
+++ /dev/null
@@ -1,101 +0,0 @@
-/* MAPIStoreCalTaskFolder.m - this file is part of SOGo
- *
- * Copyright (C) 2016 Enrique J. Hernandez
- *
- * Author: Enrique J. Hernandez
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#import
-#import
-#import
-#import
-
-#import
-
-#import "MAPIStoreCalTaskFolder.h"
-
-@implementation MAPIStoreCalTaskFolder
-
-- (NSArray *) expandRoles: (NSArray *) roles
-{
- static NSDictionary *rolesMap = nil;
- NSArray *subRoles;
- NSMutableSet *expandedRoles;
- NSString *role, *subRole;
- NSUInteger i, max, j;
-
- if (!rolesMap)
- {
- /* Build the map of array permissions */
- rolesMap = [[NSDictionary alloc] initWithObjects: [NSArray arrayWithObjects:
- [NSArray arrayWithObjects: SOGoCalendarRole_PublicDAndTViewer,
- SOGoCalendarRole_PublicViewer,
- SOGoCalendarRole_PublicResponder,
- SOGoCalendarRole_PublicModifier, nil],
- [NSArray arrayWithObjects: SOGoCalendarRole_ConfidentialDAndTViewer,
- SOGoCalendarRole_ConfidentialViewer,
- SOGoCalendarRole_ConfidentialResponder,
- SOGoCalendarRole_ConfidentialModifier, nil],
- [NSArray arrayWithObjects: SOGoCalendarRole_PrivateDAndTViewer,
- SOGoCalendarRole_PrivateViewer,
- SOGoCalendarRole_PrivateResponder,
- SOGoCalendarRole_PrivateModifier, nil],
- [NSArray arrayWithObjects: SOGoCalendarRole_ComponentDAndTViewer,
- SOGoCalendarRole_ComponentViewer,
- SOGoCalendarRole_ComponentResponder,
- SOGoCalendarRole_ComponentModifier, nil],
- nil]
- forKeys: [NSArray arrayWithObjects: @"Public", @"Confidential", @"Private",
- @"Component", nil]];
- }
-
- max = [roles count];
- expandedRoles = [NSMutableSet set];
- for (i = 0; i < max; i++)
- {
- role = [roles objectAtIndex: i];
- subRoles = nil;
- if ([role hasPrefix: @"Public"])
- subRoles = [rolesMap objectForKey: @"Public"];
- else if ([role hasPrefix: @"Confidential"])
- subRoles = [rolesMap objectForKey: @"Confidential"];
- else if ([role hasPrefix: @"Private"])
- subRoles = [rolesMap objectForKey: @"Private"];
- else if ([role hasPrefix: @"Component"])
- subRoles = [rolesMap objectForKey: @"Component"];
-
- if (subRoles)
- {
- for (j = 0; j < [subRoles count]; j++)
- {
- subRole = [subRoles objectAtIndex: j];
- [expandedRoles addObject: subRole];
-
- if ([subRole isEqualToString: role])
- break;
- }
- }
- else
- {
- [expandedRoles addObject: role];
- }
- }
-
- return [expandedRoles allObjects];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreCalTaskMessage.h b/OpenChange/MAPIStoreCalTaskMessage.h
deleted file mode 100644
index 8e284b414..000000000
--- a/OpenChange/MAPIStoreCalTaskMessage.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* MAPIStoreCalTaskMessage.h - this file is part of SOGo
- *
- * Copyright (C) 2016 Enrique J. Hernandez
- *
- * Author: Enrique J. Hernandez
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALTASKMESSAGE_H
-#define MAPISTORECALTASKMESSAGE_H
-
-#import "MAPIStoreGCSMessage.h"
-
-/* This class is intended to share common logic for Calendar and Tasks
- as of today they are stored in the same table. This is relevant for
- permissions */
-@interface MAPIStoreCalTaskMessage : MAPIStoreGCSMessage
-{
-}
-
-/* Get the sensitivity (access class) from a message */
-- (NSUInteger) sensitivity;
-
-@end
-
-#endif /* MAPISTORECALTASKMESSAGE_H */
diff --git a/OpenChange/MAPIStoreCalTaskMessage.m b/OpenChange/MAPIStoreCalTaskMessage.m
deleted file mode 100644
index b88e9c2ef..000000000
--- a/OpenChange/MAPIStoreCalTaskMessage.m
+++ /dev/null
@@ -1,107 +0,0 @@
-/* MAPIStoreCalTaskMessage.h - this file is part of SOGo
- *
- * Copyright (C) 2016 Enrique J. Hernandez
- *
- * Author: Enrique J. Hernandez
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#import
-#import
-
-#import
-
-#import
-
-#import "MAPIStoreFolder.h"
-#import "MAPIStoreCalTaskMessage.h"
-
-@implementation MAPIStoreCalTaskMessage
-
-/* It must be implemented by subclasses */
-- (NSUInteger) sensitivity
-{
- [self subclassResponsibility: _cmd];
-
- return 0;
-}
-
-- (NSArray *) expandRoles: (NSArray *) roles
-{
- return [container expandRoles: roles];
-}
-
-- (BOOL) subscriberCanModifyMessage
-{
- BOOL rc;
- NSArray *roles;
-
- roles = [self activeUserRoles];
-
- if (isNew)
- rc = [roles containsObject: SOGoRole_ObjectCreator];
- else
- rc = ([roles containsObject: SOGoCalendarRole_ComponentModifier]
- || [roles containsObject: SOGoCalendarRole_ComponentResponder]);
-
- /* Check if the message is owned and it has permission to edit it */
- if (!rc && [roles containsObject: MAPIStoreRightEditOwn])
- {
- NSString *currentUser;
-
- currentUser = [[container context] activeUser];
- rc = [currentUser isEqual: [self ownerUser]];
- }
-
- if (!rc)
- {
- NSUInteger sensitivity;
-
- /* Get sensitivity of the message to check if the user can
- modify the message */
- sensitivity = [self sensitivity];
- /* FIXME: Use OpenChange constant names */
- switch (sensitivity)
- {
- case 0: /* PUBLIC */
- rc = [roles containsObject: SOGoCalendarRole_PublicModifier]
- || [roles containsObject: SOGoCalendarRole_PublicResponder];
- break;
- case 1: /* PERSONAL */
- case 2: /* PRIVATE */
- rc = [roles containsObject: SOGoCalendarRole_PrivateModifier]
- || [roles containsObject: SOGoCalendarRole_PrivateResponder];
- break;
- case 3: /* CONFIDENTIAL */
- rc = [roles containsObject: SOGoCalendarRole_ConfidentialModifier]
- || [roles containsObject: SOGoCalendarRole_ConfidentialResponder];
- }
- }
- return rc;
-}
-
-- (BOOL) subscriberCanReadMessage
-{
- NSArray *roles;
-
- roles = [self activeUserRoles];
-
- return ([roles containsObject: SOGoCalendarRole_ComponentViewer]
- || [roles containsObject: SOGoCalendarRole_ComponentDAndTViewer]
- || [self subscriberCanModifyMessage]);
-}
-
-@end
diff --git a/OpenChange/MAPIStoreCalendarAttachment.h b/OpenChange/MAPIStoreCalendarAttachment.h
deleted file mode 100644
index b0a35d6b2..000000000
--- a/OpenChange/MAPIStoreCalendarAttachment.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* MAPIStoreCalendarAttachment.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALENDARATTACHMENT_H
-#define MAPISTORECALENDARATTACHMENT_H
-
-#import "MAPIStoreAttachment.h"
-
-@class NSTimeZone;
-
-@class iCalEvent;
-
-@interface MAPIStoreCalendarAttachment : MAPIStoreAttachment
-{
- iCalEvent *event;
- NSTimeZone *timeZone;
-}
-
-- (void) setEvent: (iCalEvent *) newEvent;
-- (iCalEvent *) event;
-
-@end
-
-#endif /* MAPISTORECALENDARATTACHMENT_H */
diff --git a/OpenChange/MAPIStoreCalendarAttachment.m b/OpenChange/MAPIStoreCalendarAttachment.m
deleted file mode 100644
index b2044b602..000000000
--- a/OpenChange/MAPIStoreCalendarAttachment.m
+++ /dev/null
@@ -1,255 +0,0 @@
-/* MAPIStoreCalendarAttachment.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-#import
-
-#import
-#import
-
-#import "iCalEvent+MAPIStore.h"
-#import "MAPIStoreCalendarEmbeddedMessage.h"
-#import "MAPIStoreTypes.h"
-#import "MAPIStoreUserContext.h"
-#import "NSDate+MAPIStore.h"
-#import "NSData+MAPIStore.h"
-#import "NSObject+MAPIStore.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreCalendarAttachment.h"
-
-#undef DEBUG
-#include
-#include
-#include
-#include
-
-@implementation MAPIStoreCalendarAttachment
-
-- (id) init
-{
- if ((self = [super init]))
- {
- event = nil;
- timeZone = nil;
- }
-
- return self;
-}
-
-- (id) initInContainer: (MAPIStoreObject *) newContainer
-{
- MAPIStoreUserContext *userContext;
-
- if ((self = [super initInContainer: newContainer]))
- {
- userContext = [newContainer userContext];
- ASSIGN (timeZone, [userContext timeZone]);
- }
-
- return self;
-}
-
-- (void) dealloc
-{
- [event release];
- [timeZone release];
- [super dealloc];
-}
-
-- (void) setEvent: (iCalEvent *) newEvent
-{
- ASSIGN (event, newEvent);
-}
-
-- (iCalEvent *) event
-{
- return event;
-}
-
-- (NSString *) nameInContainer
-{
- return [[event uniqueChildWithTag: @"recurrence-id"]
- flattenedValuesForKey: @""];
-}
-
-- (enum mapistore_error) getPidTagAttachmentHidden: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- return [self getYes: data inMemCtx: localMemCtx];
-}
-
-- (enum mapistore_error) getPidTagAttachmentFlags: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- *data = MAPILongValue (localMemCtx, 0x00000002); /* afException */
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachmentLinkId: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- return [self getLongZero: data inMemCtx: localMemCtx];
-}
-
-- (enum mapistore_error) getPidTagAttachFlags: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- return [self getLongZero: data inMemCtx: localMemCtx];
-}
-
-- (enum mapistore_error) getPidTagAttachMethod: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- *data = MAPILongValue (localMemCtx, afEmbeddedMessage);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachEncoding: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- *data = [[NSData data] asBinaryInMemCtx: localMemCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagDisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- *data = [@"Untitled" asUnicodeInMemCtx: localMemCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachmentContactPhoto: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getNo: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagExceptionReplaceTime: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc;
- NSCalendarDate *dateValue;
- NSInteger offset;
-
- dateValue = [event recurrenceId];
- if (dateValue)
- {
- rc = MAPISTORE_SUCCESS;
-
- if ([event isAllDay])
- {
- offset = -[timeZone secondsFromGMTForDate: dateValue];
- dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
- hours: 0 minutes: 0
- seconds: offset];
- }
- [dateValue setTimeZone: utcTZ];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagExceptionStartTime: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- enum mapistore_error rc;
- NSCalendarDate *dateValue;
- NSInteger offset;
-
- if ([event recurrenceId] != nil)
- {
- dateValue = [event startDate];
- [dateValue setTimeZone: timeZone];
- if (![event isAllDay])
- {
- offset = [timeZone secondsFromGMTForDate: dateValue];
- dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
- hours: 0 minutes: 0
- seconds: offset];
- }
- *data = [dateValue asFileTimeInMemCtx: localMemCtx];
- rc = MAPISTORE_SUCCESS;
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagExceptionEndTime: (void **) data
- inMemCtx: (TALLOC_CTX *) localMemCtx
-{
- enum mapistore_error rc;
- NSCalendarDate *dateValue;
- NSInteger offset;
-
- if ([event recurrenceId] != nil)
- {
- dateValue = [event startDate];
- [dateValue setTimeZone: timeZone];
- offset = [event durationAsTimeInterval];
- if (![event isAllDay])
- offset += [timeZone secondsFromGMTForDate: dateValue];
- dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
- hours: 0 minutes: 0
- seconds: offset];
- *data = [dateValue asFileTimeInMemCtx: localMemCtx];
- rc = MAPISTORE_SUCCESS;
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-/* subclasses */
-- (MAPIStoreCalendarEmbeddedMessage *) openEmbeddedMessage
-{
- MAPIStoreCalendarEmbeddedMessage *msg;
-
- msg = [MAPIStoreCalendarEmbeddedMessage
- mapiStoreObjectInContainer: self];
-
- return msg;
-}
-
-- (MAPIStoreCalendarEmbeddedMessage *) createEmbeddedMessage
-{
- MAPIStoreCalendarEmbeddedMessage *msg;
-
- msg = [self openEmbeddedMessage];
- [msg setIsNew: YES];
-
- return msg;
-}
-
-@end
diff --git a/OpenChange/MAPIStoreCalendarContext.h b/OpenChange/MAPIStoreCalendarContext.h
deleted file mode 100644
index e6f804805..000000000
--- a/OpenChange/MAPIStoreCalendarContext.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* MAPIStoreCalendarContext.h - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc.
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALENDARCONTEXT_H
-#define MAPISTORECALENDARCONTEXT_H
-
-#import "MAPIStoreGCSBaseContext.h"
-
-@interface MAPIStoreCalendarContext : MAPIStoreGCSBaseContext
-
-@end
-
-#endif /* MAPISTORECALENDARCONTEXT_H */
diff --git a/OpenChange/MAPIStoreCalendarContext.m b/OpenChange/MAPIStoreCalendarContext.m
deleted file mode 100644
index 035741afb..000000000
--- a/OpenChange/MAPIStoreCalendarContext.m
+++ /dev/null
@@ -1,64 +0,0 @@
-/* MAPIStoreCalendarContext.m - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-
-#import "MAPIStoreMapping.h"
-#import "MAPIStoreCalendarFolder.h"
-#import "MAPIStoreUserContext.h"
-
-#import "MAPIStoreCalendarContext.h"
-
-#undef DEBUG
-#include
-
-static Class MAPIStoreCalendarFolderK;
-
-@implementation MAPIStoreCalendarContext
-
-+ (void) initialize
-{
- MAPIStoreCalendarFolderK = [MAPIStoreCalendarFolder class];
-}
-
-+ (NSString *) MAPIModuleName
-{
- return @"calendar";
-}
-
-+ (enum mapistore_context_role) MAPIContextRole
-{
- return MAPISTORE_CALENDAR_ROLE;
-}
-
-- (Class) MAPIStoreFolderClass
-{
- return MAPIStoreCalendarFolderK;
-}
-
-+ (NSString *) folderNameSuffix
-{
- return @"c";
-}
-
-@end
diff --git a/OpenChange/MAPIStoreCalendarEmbeddedMessage.h b/OpenChange/MAPIStoreCalendarEmbeddedMessage.h
deleted file mode 100644
index 3e27c575c..000000000
--- a/OpenChange/MAPIStoreCalendarEmbeddedMessage.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* MAPIStoreCalendarEmbeddedMessage.h - this file is part of SOGo
- *
- * Copyright (C) 2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALENDAREMBEDDEDMESSAGE_H
-#define MAPISTORECALENDAREMBEDDEDMESSAGE_H
-
-#import "MAPIStoreEmbeddedMessage.h"
-
-@class MAPIStoreAppointmentWrapper;
-
-@interface MAPIStoreCalendarEmbeddedMessage : MAPIStoreEmbeddedMessage
-
-@end
-
-#endif /* MAPISTORECALENDAREMBEDDEDMESSAGE_H */
diff --git a/OpenChange/MAPIStoreCalendarEmbeddedMessage.m b/OpenChange/MAPIStoreCalendarEmbeddedMessage.m
deleted file mode 100644
index 02a776949..000000000
--- a/OpenChange/MAPIStoreCalendarEmbeddedMessage.m
+++ /dev/null
@@ -1,215 +0,0 @@
-/* MAPIStoreCalendarEmbeddedMessage.m - this file is part of SOGo
- *
- * Copyright (C) 2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include
-
-#import
-#import
-
-#import
-
-#import
-#import "iCalEvent+MAPIStore.h"
-
-#import "MAPIStoreAppointmentWrapper.h"
-#import "MAPIStoreCalendarAttachment.h"
-#import "MAPIStoreContext.h"
-#import "MAPIStoreUserContext.h"
-#import "MAPIStoreTypes.h"
-#import "NSObject+MAPIStore.h"
-
-#import "MAPIStoreCalendarEmbeddedMessage.h"
-
-#include
-
-@implementation MAPIStoreCalendarEmbeddedMessage
-
-- (id) initInContainer: (id) newContainer
-{
- MAPIStoreContext *context;
- MAPIStoreUserContext *userContext;
- MAPIStoreAppointmentWrapper *appointmentWrapper;
-
- if ((self = [super initInContainer: newContainer]))
- {
- context = [self context];
- userContext = [self userContext];
- appointmentWrapper
- = [MAPIStoreAppointmentWrapper
- wrapperWithICalEvent: [newContainer event]
- andUser: [userContext sogoUser]
- andSenderEmail: nil
- withConnectionInfo: [context connectionInfo]];
- [self addProxy: appointmentWrapper];
- }
-
- return self;
-}
-
-- (NSDate *) creationTime
-{
- return [[container event] created];
-}
-
-- (NSDate *) lastModificationTime
-{
- return [[container event] lastModified];
-}
-
-- (void) getMessageData: (struct mapistore_message **) dataPtr
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- struct mapistore_message *msgData;
-
- [super getMessageData: &msgData inMemCtx: memCtx];
-
- /* HACK: we know the first (and only) proxy is our appointment wrapper
- instance, but this might not always be true */
- [[proxies objectAtIndex: 0] fillMessageData: msgData
- inMemCtx: memCtx];
- *dataPtr = msgData;
-}
-
-- (enum mapistore_error) getPidTagMessageClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = talloc_strdup (memCtx, "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}");
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagMessageFlags: (void **) data // TODO
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx, MSGFLAG_UNMODIFIED);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagProcessed: (void **) data inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagResponseRequested: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-/* discarded properties */
-
-- (enum mapistore_error) getPidLidAppointmentLastSequence: (void **)
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidLidMeetingWorkspaceUrl: (void **)
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidLidContacts: (void **)
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidTagSensitivity: (void **)
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidLidPrivate: (void **)
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidNameKeywords: (void **)
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidLidFExceptionalBody: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getNo: data inMemCtx: memCtx];
-}
-
-- (void) save: (TALLOC_CTX *) memCtx
-{
-// (gdb) po embeddedMessage->properties
-// 2442592320 = "2012-07-11 22:30:00 +0000";
-// 2448359488 = "2012-07-11 22:30:00 +0000";
-// 2442723392 = "2012-07-11 22:30:00 +0000";
-// 2442068032 = "2012-07-11 22:30:00 +0000";
-// 2441740352 = "2012-07-11 23:00:00 +0000";
-// 131083 = 1; 2442330115 = 2;
-// 235339779 = 9;
-// 6291520 = "2012-07-11 16:00:00 +0000";
-// 2442526784 = "2012-07-11 23:00:00 +0000";
-// 2818059 = 0;
-// 1703967 = "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}";
-// 3538947 = 0;
-// 1071513603 = 28591; 805830720 = "2012-07-10 16:42:00 +0000";
-// 2485977346 = <02013000 02001500 45006100 73007400
-// 65007200 6e002000 53007400 61006e00 64006100 72006400 20005400 69006d00
-// 65000200 02013e00 0000d607 00000000 00000000 00000000 00002c01 00000000
-// 0000c4ff ffff0000 0a000000 05000200 00000000 00000000 04000000 01000200
-// 00000000 00000201 3e000200 d7070000 00000000 00000000 00000000 2c010000
-// 00000000 c4ffffff 00000b00 00000100 02000000 00000000 00000300 00000200
-// 02000000 00000000>; 2454257728 = "2012-07-11 16:00:00 +0000"; 2442985475 =
-// 118330; 1507331 = 1; 805765184 = "2012-07-09 18:32:00 +0000"; 2442657856 =
-// "2012-07-11 23:00:00 +0000"; 2443051039 = "11.0"; 236912651 = 1; 2485911810 =
-// <02013000 02001500 45006100 73007400 65007200 6e002000 53007400 61006e00
-// 64006100 72006400 20005400 69006d00 65000200 02013e00 0000d607 00000000
-// 00000000 00000000 00002c01 00000000 0000c4ff ffff0000 0a000000 05000200
-// 00000000 00000000 04000000 01000200 00000000 00000201 3e000200 d7070000
-// 00000000 00000000 00000000 2c010000 00000000 c4ffffff 00000b00 00000100
-// 02000000 00000000 00000300 00000200 02000000 00000000>; 2441543683 = 30;
-// 2442068032 = "2012-07-11 22:30:00 +0000";
-// 1073348639 = "OpenChange User";
-// 806027522 = <2d64f6f5 89a59243 992d29d1 49173b3a>; 6357056 = "2012-07-11
-// 16:30:00 +0000";
-// */
-
-// // 0x92490040 = 2454257728
-
-// }
-
- SOGoUser *activeUser;
-
- activeUser = [[self context] activeUser];
-
- [[container event] updateFromMAPIProperties: properties
- inUserContext: [self userContext]
- withActiveUser: activeUser
- isNew: NO
- inMemCtx: memCtx];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreCalendarFolder.h b/OpenChange/MAPIStoreCalendarFolder.h
deleted file mode 100644
index 9b3a4cf5c..000000000
--- a/OpenChange/MAPIStoreCalendarFolder.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* MAPIStoreCalendarFolder.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALENDARFOLDER_H
-#define MAPISTORECALENDARFOLDER_H
-
-#import "MAPIStoreCalTaskFolder.h"
-
-@interface MAPIStoreCalendarFolder : MAPIStoreCalTaskFolder
-
-@end
-
-#endif /* MAPISTORECALENDARFOLDER_H */
diff --git a/OpenChange/MAPIStoreCalendarFolder.m b/OpenChange/MAPIStoreCalendarFolder.m
deleted file mode 100644
index ed949e638..000000000
--- a/OpenChange/MAPIStoreCalendarFolder.m
+++ /dev/null
@@ -1,226 +0,0 @@
-/* MAPIStoreCalendarFolder.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-
-#import "MAPIApplication.h"
-#import "MAPIStoreCalendarContext.h"
-#import "MAPIStoreCalendarMessage.h"
-#import "MAPIStoreCalendarMessageTable.h"
-#import "MAPIStoreUserContext.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreCalendarFolder.h"
-
-#include
-#include
-#include
-
-@implementation MAPIStoreCalendarFolder
-
-- (MAPIStoreMessageTable *) messageTable
-{
- [self synchroniseCache];
- return [MAPIStoreCalendarMessageTable tableForContainer: self];
-}
-
-- (NSString *) component
-{
- return @"vevent";
-}
-
-- (MAPIStoreMessage *) createMessage
-{
- MAPIStoreMessage *newMessage;
- SOGoAppointmentObject *newEntry;
- NSString *name;
-
- [[self userContext] activate];
-
- name = [NSString stringWithFormat: @"%@.ics",
- [SOGoObject globallyUniqueObjectId]];
- newEntry = [SOGoAppointmentObject objectWithName: name
- inContainer: sogoObject];
- [newEntry setIsNew: YES];
- newMessage = [MAPIStoreCalendarMessage mapiStoreObjectWithSOGoObject: newEntry
- inContainer: self];
- return newMessage;
-}
-
-- (NSArray *) rolesForExchangeRights: (uint32_t) rights
-{
- /* Limitations
-
- Following rights are not supported by SOGo specifically:
-
- - CreateSubfolders: No calendar subfolders
- - FolderVisible: It is inferred by other rights when extracting
- */
- NSMutableArray *roles;
-
- roles = [NSMutableArray arrayWithCapacity: 6];
- if (rights & RightsCreateItems)
- [roles addObject: SOGoRole_ObjectCreator];
- if (rights & RightsDeleteAll)
- [roles addObject: SOGoRole_ObjectEraser];
- if (rights & RightsDeleteOwn)
- [roles addObject: MAPIStoreRightDeleteOwn];
-
- if (rights & RightsEditAll)
- {
- [roles addObject: SOGoCalendarRole_PublicModifier];
- [roles addObject: SOGoCalendarRole_PrivateModifier];
- [roles addObject: SOGoCalendarRole_ConfidentialModifier];
- }
- if (rights & RightsEditOwn)
- [roles addObject: MAPIStoreRightEditOwn];
-
- if (rights & RightsReadItems)
- {
- [roles addObject: SOGoCalendarRole_PublicViewer];
- [roles addObject: SOGoCalendarRole_PrivateViewer];
- [roles addObject: SOGoCalendarRole_ConfidentialViewer];
- }
- if (rights & RightsFreeBusySimple)
- [roles addObject: SOGoCalendarRole_PublicDAndTViewer];
-
- if (rights & RightsFreeBusyDetailed)
- [roles addObject: SOGoCalendarRole_ConfidentialDAndTViewer];
-
- if (rights & RightsFolderOwner)
- [roles addObject: MAPIStoreRightFolderOwner];
-
- if (rights & RightsFolderContact)
- [roles addObject: MAPIStoreRightFolderContact];
-
- // [self logWithFormat: @"roles for rights %.8x = (%@)", rights, roles];
-
- return roles;
-}
-
-- (uint32_t) exchangeRightsForRoles: (NSArray *) roles
-{
- uint32_t rights = 0;
-
- if ([roles containsObject: SOGoRole_ObjectCreator])
- rights |= RightsCreateItems;
- if ([roles containsObject: SOGoRole_ObjectEraser])
- rights |= RightsDeleteAll | RightsDeleteOwn;
- if ([roles containsObject: SOGoCalendarRole_PublicModifier]
- && [roles containsObject: SOGoCalendarRole_PrivateModifier]
- && [roles containsObject: SOGoCalendarRole_ConfidentialModifier])
- rights |= RightsReadItems | RightsEditAll | RightsEditOwn | RightsFreeBusySimple | RightsFreeBusyDetailed;
- else if ([roles containsObject: SOGoCalendarRole_PublicViewer]
- && [roles containsObject: SOGoCalendarRole_PrivateViewer]
- && [roles containsObject: SOGoCalendarRole_ConfidentialViewer])
- rights |= RightsReadItems;
-
- if ([roles containsObject: MAPIStoreRightEditOwn])
- rights |= RightsEditOwn;
- if ([roles containsObject: MAPIStoreRightDeleteOwn])
- rights |= RightsDeleteOwn;
-
- if ([roles containsObject: SOGoCalendarRole_PublicDAndTViewer])
- rights |= RightsFreeBusySimple;
-
- if ([roles containsObject: SOGoCalendarRole_ConfidentialDAndTViewer])
- rights |= RightsFreeBusySimple | RightsFreeBusyDetailed;
-
- if ((rights & RightsReadItems) != 0 || (rights & RightsCreateItems) != 0 || (rights & RightsDeleteAll) != 0)
- rights |= RoleNone; /* actually "folder visible" */
-
- if ([roles containsObject: MAPIStoreRightFolderOwner])
- rights |= RightsFolderOwner | RoleNone;
-
- if ([roles containsObject: MAPIStoreRightFolderContact])
- rights |= RightsFolderContact;
-
- // [self logWithFormat: @"rights for roles (%@) = %.8x", roles, rights];
-
- return rights;
-}
-
-- (BOOL) subscriberCanReadMessages
-{
- static NSArray *viewerRoles = nil;
-
- if (!viewerRoles)
- viewerRoles = [[NSArray alloc] initWithObjects:
- SOGoCalendarRole_PublicViewer,
- SOGoCalendarRole_PublicDAndTViewer,
- SOGoCalendarRole_PrivateViewer,
- SOGoCalendarRole_PrivateDAndTViewer,
- SOGoCalendarRole_ConfidentialViewer,
- SOGoCalendarRole_ConfidentialDAndTViewer,
- nil];
-
- return ([[self activeUserRoles] firstObjectCommonWithArray: viewerRoles]
- != nil);
-}
-
-- (BOOL) subscriberCanModifyMessages
-{
- static NSArray *modifierRoles = nil;
-
- if (!modifierRoles)
- modifierRoles = [[NSArray alloc] initWithObjects:
- SOGoCalendarRole_PublicModifier,
- SOGoCalendarRole_PrivateModifier,
- SOGoCalendarRole_ConfidentialModifier,
- nil];
-
- return ([[self activeUserRoles] firstObjectCommonWithArray: modifierRoles]
- != nil);
-}
-
-- (EOQualifier *) aclQualifier
-{
- return [EOQualifier qualifierWithQualifierFormat:
- [(SOGoAppointmentFolder *) sogoObject aclSQLListingFilter]];
-}
-
-- (enum mapistore_error) getPidTagContainerClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = [@"IPF.Appointment" asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagDefaultPostMessageClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = [@"IPM.Appointment" asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-@end
diff --git a/OpenChange/MAPIStoreCalendarMessage.h b/OpenChange/MAPIStoreCalendarMessage.h
deleted file mode 100644
index 99e286073..000000000
--- a/OpenChange/MAPIStoreCalendarMessage.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* MAPIStoreCalendarMessage.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALENDARMESSAGE_H
-#define MAPISTORECALENDARMESSAGE_H
-
-#import "MAPIStoreCalTaskMessage.h"
-
-@class iCalCalendar;
-@class iCalEvent;
-@class MAPIStoreAppointmentWrapper;
-
-@interface MAPIStoreCalendarMessage : MAPIStoreCalTaskMessage
-{
- iCalCalendar *calendar;
- iCalEvent *masterEvent;
-}
-
-@end
-
-#endif /* MAPISTORECALENDARMESSAGE_H */
diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m
deleted file mode 100644
index 5ec92d07f..000000000
--- a/OpenChange/MAPIStoreCalendarMessage.m
+++ /dev/null
@@ -1,669 +0,0 @@
-/* MAPIStoreCalendarMessage.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* TODO:
- - merge common code with tasks
- - take the tz definitions from Outlook */
-
-#include
-#include
-
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-
-#import "iCalEvent+MAPIStore.h"
-#import "MAPIStoreAppointmentWrapper.h"
-#import "MAPIStoreCalendarAttachment.h"
-#import "MAPIStoreCalendarFolder.h"
-#import "MAPIStoreContext.h"
-#import "MAPIStoreMapping.h"
-#import "MAPIStoreRecurrenceUtils.h"
-#import "MAPIStoreTypes.h"
-#import "MAPIStoreUserContext.h"
-#import "NSDate+MAPIStore.h"
-#import "NSData+MAPIStore.h"
-#import "NSObject+MAPIStore.h"
-#import "NSString+MAPIStore.h"
-#import "NSValue+MAPIStore.h"
-
-#import "MAPIStoreCalendarMessage.h"
-
-#undef DEBUG
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// extern void ndr_print_AppointmentRecurrencePattern(struct ndr_print *ndr, const char *name, const struct AppointmentRecurrencePattern *r);
-
-static Class NSArrayK, MAPIStoreAppointmentWrapperK;
-
-@implementation SOGoAppointmentObject (MAPIStoreExtension)
-
-- (Class) mapistoreMessageClass
-{
- return [MAPIStoreCalendarMessage class];
-}
-
-@end
-
-@implementation MAPIStoreCalendarMessage
-
-+ (void) initialize
-{
- NSArrayK = [NSArray class];
- MAPIStoreAppointmentWrapperK = [MAPIStoreAppointmentWrapper class];
-}
-
-+ (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- BOOL listedProperties[65536];
- NSUInteger count;
- uint16_t propId;
-
- memset (listedProperties, NO, 65536 * sizeof (BOOL));
- [super getAvailableProperties: propertiesP inMemCtx: memCtx];
- for (count = 0; count < (*propertiesP)->cValues; count++)
- {
- propId = ((*propertiesP)->aulPropTag[count] >> 16) & 0xffff;
- listedProperties[propId] = YES;
- }
- [MAPIStoreAppointmentWrapper fillAvailableProperties: *propertiesP
- withExclusions: listedProperties];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (id) init
-{
- if ((self = [super init]))
- {
- calendar = nil;
- masterEvent = nil;
- }
-
- return self;
-}
-
-- (void) _setupAttachmentParts
-{
- NSUInteger count, max;
- NSArray *events;
- NSString *newKey;
- MAPIStoreCalendarAttachment *attachment;
- NSUInteger aid;
- iCalEvent *event;
-
- events = [calendar events];
- max = [events count];
- for (count = 1; count < max; count++)
- {
- attachment = [MAPIStoreCalendarAttachment
- mapiStoreObjectInContainer: self];
- /* we now that there are no attachments yet, so we can assume that the
- right AID is 0 from the start */
- aid = count - 1;
- [attachment setAID: aid];
- event = [events objectAtIndex: count];
- [attachment setEvent: event];
- newKey = [[event uniqueChildWithTag: @"recurrence-id"]
- flattenedValuesForKey: @""];
- [attachmentParts setObject: attachment forKey: newKey];
- }
-}
-
-- (id) initWithSOGoObject: (id) newSOGoObject
- inContainer: (MAPIStoreObject *) newFolder
-{
- MAPIStoreContext *context;
- MAPIStoreUserContext *userContext;
- iCalCalendar *origCalendar;
- MAPIStoreAppointmentWrapper *appointmentWrapper;
-
- if ((self = [super initWithSOGoObject: newSOGoObject
- inContainer: newFolder]))
- {
- if ([newSOGoObject isNew])
- {
- ASSIGN (calendar, [iCalCalendar groupWithTag: @"vcalendar"]);
- [calendar setVersion: @"2.0"];
- [calendar setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
- masterEvent = [iCalEvent groupWithTag: @"vevent"];
- [calendar addChild: masterEvent];
- [masterEvent setCreated: [NSCalendarDate date]];
- }
- else
- {
- origCalendar = [sogoObject calendar: YES secure: YES];
- if (!origCalendar)
- {
- [self errorWithFormat: @"Incorrect calendar event %@. Empty message is created",
- [self url]];
- return self;
- }
- calendar = [origCalendar mutableCopy];
- masterEvent = [[calendar events] objectAtIndex: 0];
- [self _setupAttachmentParts];
- }
- context = [self context];
- userContext = [self userContext];
- appointmentWrapper
- = [MAPIStoreAppointmentWrapper wrapperWithICalEvent: masterEvent
- andUser: [userContext sogoUser]
- andSenderEmail: nil
- withConnectionInfo: [context connectionInfo]];
- [self addProxy: appointmentWrapper];
- }
-
- return self;
-}
-
-- (void) dealloc
-{
- //NSLog(@"MAPIStoreCalendarMessage: -dealloc (%p)", self);
- [calendar release];
- [super dealloc];
-}
-
-- (MAPIStoreAppointmentWrapper *) _appointmentWrapper
-{
- NSUInteger i, max;
- id proxy;
- max = [proxies count];
- for (i = 0; i < max; i++) {
- proxy = [proxies objectAtIndex: i];
- if ([proxy isKindOfClass: MAPIStoreAppointmentWrapperK])
- {
- return proxy;
- }
- }
- return nil;
-}
-
-
-/* getters */
-- (enum mapistore_error) getPidTagMessageClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- SOGoUser *owner;
-
- owner = [[self userContext] sogoUser];
- if ([masterEvent userAsAttendee: owner])
- *data = talloc_strdup (memCtx, "IPM.Schedule.Meeting.Request");
- else
- *data = talloc_strdup (memCtx, "IPM.Appointment");
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidSideEffects: (void **) data // TODO
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx,
- seOpenToDelete | seOpenToCopy | seOpenToMove
- | seCoerceToInbox | seOpenForCtxMenu);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagProcessed: (void **) data inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (void) getMessageData: (struct mapistore_message **) dataPtr
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- static NSString *recTypes[] = {@"orig", @"to", @"cc", @"bcc"};
- static NSInteger recTypesValue[] = {MAPI_ORIG, MAPI_TO, MAPI_CC, MAPI_BCC};
- struct mapistore_message *msgData;
- NSDictionary *recipients, *contactInfos;
- NSString *email;
- NSArray *attendees;
- NSDictionary *attendee;
- SOGoUserManager *mgr;
- struct mapistore_message_recipient *recipient;
- NSUInteger nRecType, maxRecTypes, count, max, propCount;
- NSObject *currentValue;
-
- [super getMessageData: &msgData inMemCtx: memCtx];
-
- /* The presence of the "recipients" meta-property means that our most recent
- list of recipients has not been saved yet and that we must return that
- one instead of the one stored in the event. */
- recipients = [properties objectForKey: @"recipients"];
- if (recipients)
- {
- mgr = [SOGoUserManager sharedUserManager];
-
- /* TODO: this code might need to be moved into MAPIStoreMessage */
- msgData->columns = set_SPropTagArray (msgData, 9,
- PR_OBJECT_TYPE,
- PR_DISPLAY_TYPE,
- PR_7BIT_DISPLAY_NAME_UNICODE,
- PR_SMTP_ADDRESS_UNICODE,
- PR_SEND_INTERNET_ENCODING,
- PR_RECIPIENT_DISPLAY_NAME_UNICODE,
- PR_RECIPIENT_FLAGS,
- PR_RECIPIENT_ENTRYID,
- PR_RECIPIENT_TRACKSTATUS);
-
- maxRecTypes = sizeof(recTypes) / sizeof(recTypes[0]);
- for (nRecType = 0; nRecType < maxRecTypes; nRecType++)
- {
- attendees = [recipients objectForKey: recTypes[nRecType]];
- max = [attendees count];
- if (max > 0)
- {
- msgData->recipients_count += max;
- msgData->recipients = talloc_realloc(msgData,
- msgData->recipients, struct
- mapistore_message_recipient, msgData->recipients_count);
- recipient = msgData->recipients;
- for (count = 0; count < max; count++)
- {
- attendee = [attendees objectAtIndex: count];
- recipient->type = recTypesValue[nRecType];
- email = [attendee objectForKey: @"email"];
- if (email)
- {
- contactInfos
- = [mgr contactInfosForUserWithUIDorEmail: email];
- recipient->username = [[contactInfos
- objectForKey: @"c_uid"]
- asUnicodeInMemCtx: msgData];
- }
- else
- recipient->username = NULL;
-
- recipient->data = talloc_array(msgData, void *,
- msgData->columns->cValues);
- for (propCount = 0;
- propCount < msgData->columns->cValues;
- propCount++)
- {
- currentValue = [attendee objectForKey: MAPIPropertyKey (msgData->columns->aulPropTag[propCount])];
- [currentValue getValue: recipient->data + propCount
- forTag: msgData->columns->aulPropTag[propCount]
- inMemCtx: msgData];
- }
- recipient++;
- }
- }
- }
- }
- else
- {
- [[self _appointmentWrapper] fillMessageData: msgData
- inMemCtx: memCtx];
- }
-
- *dataPtr = msgData;
-}
-
-- (enum mapistore_error) getPidTagResponseRequested: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-/* This three methods: getPidTagNormalizedSubject,
- getPidTagSensitivity and getPidTagImportance are implemented in
- MAPIStoreMessage base class, then the proxy method is not reached
- (see MAPIStoreObject).
-*/
-- (enum mapistore_error) getPidTagNormalizedSubject: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- MAPIStoreAppointmentWrapper *appointmentWrapper;
-
- appointmentWrapper = [self _appointmentWrapper];
- if (appointmentWrapper)
- return [appointmentWrapper getPidTagNormalizedSubject: data inMemCtx: memCtx];
-
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidTagSensitivity: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- MAPIStoreAppointmentWrapper *appointmentWrapper;
-
- appointmentWrapper = [self _appointmentWrapper];
- if (appointmentWrapper)
- return [appointmentWrapper getPidTagSensitivity: data inMemCtx: memCtx];
-
- return [self getLongZero: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagImportance: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- MAPIStoreAppointmentWrapper *appointmentWrapper;
-
- appointmentWrapper = [self _appointmentWrapper];
- if (appointmentWrapper)
- return [appointmentWrapper getPidTagImportance: data inMemCtx: memCtx];
-
- *data = MAPILongValue (memCtx, 1);
-
- return MAPISTORE_SUCCESS;
-}
-
-
-- (NSString *) _uidFromGlobalObjectId: (TALLOC_CTX *) memCtx
-{
- NSData *objectId;
- NSString *uid = nil;
- char *bytesDup, *uidStart;
- NSUInteger length;
-
- /* NOTE: we only handle the generic case at the moment, see
- MAPIStoreAppointmentWrapper */
- objectId = [properties
- objectForKey: MAPIPropertyKey (PidLidGlobalObjectId)];
- if (objectId)
- {
- length = [objectId length];
- bytesDup = talloc_array (memCtx, char, length + 1);
- memcpy (bytesDup, [objectId bytes], length);
- bytesDup[length] = 0;
- uidStart = bytesDup + length - 1;
- while (uidStart != bytesDup && *(uidStart - 1))
- uidStart--;
- if (uidStart > bytesDup && *uidStart)
- uid = [NSString stringWithUTF8String: uidStart];
- talloc_free (bytesDup);
- }
-
- return uid;
-}
-
-- (SOGoAppointmentObject *) _resurrectRecord: (NSString *) cname
- fromFolder: (SOGoAppointmentFolder *) folder
-{
- NSArray *records;
- EOQualifier *qualifier;
- EOFetchSpecification *fs;
- GCSFolder *ocsFolder;
- SOGoAppointmentObject *newObject;
- NSMutableDictionary *newRecord;
- static NSArray *childRecordFields = nil;
-
- if (!childRecordFields)
- {
- childRecordFields = [NSArray arrayWithObjects: @"c_name",
- @"c_creationdate", @"c_lastmodified",
- @"c_content", nil];
- [childRecordFields retain];
- }
-
- ocsFolder = [folder ocsFolder];
-
- qualifier
- = [EOQualifier qualifierWithQualifierFormat:
- [NSString stringWithFormat: @"c_name='%@'", cname]];
- fs = [EOFetchSpecification fetchSpecificationWithEntityName: [ocsFolder folderName]
- qualifier: qualifier
- sortOrderings: nil];
- records = [ocsFolder fetchFields: childRecordFields
- fetchSpecification: fs
- ignoreDeleted: NO];
- if ([records isKindOfClass: NSArrayK] && [records count])
- {
- newRecord = [[records objectAtIndex: 0] mutableCopy];
- [newRecord setObject: [NSNumber numberWithInt: 0]
- forKey: @"c_version"];
- newObject = [SOGoAppointmentObject objectWithRecord: newRecord
- inContainer: folder];
- [newRecord autorelease];
- [newObject setIsNew: NO];
- }
- else
- newObject = nil;
-
-
- return newObject;
-}
-
-- (void) _fixupAppointmentObjectWithUID: (NSString *) uid
-{
- NSString *cname, *url;
- MAPIStoreMapping *mapping;
- uint64_t objectId;
- WOContext *woContext;
- SOGoAppointmentFolder *folder;
- SOGoAppointmentObject *newObject;
-
- cname = [[container sogoObject] resourceNameForEventUID: uid];
- if (cname)
- isNew = NO;
- else
- cname = [NSString stringWithFormat: @"%@.ics", uid];
-
- mapping = [self mapping];
-
- url = [NSString stringWithFormat: @"%@%@", [container url], cname];
- folder = [sogoObject container];
-
- /* reinstantiate the old sogo object and attach it to self */
- [[self userContext] activate];
- woContext = [[self userContext] woContext];
- if (isNew)
- {
- /* event could have been deleted, let's try to resurrect it */
- newObject = [self _resurrectRecord: cname fromFolder: folder];
- if (!newObject)
- {
- newObject = [SOGoAppointmentObject objectWithName: cname
- inContainer: folder];
- [newObject setIsNew: YES];
- }
- }
- else
- {
- /* dissociate the object url from the old object's id */
- objectId = [mapping idFromURL: url];
- [mapping unregisterURLWithID: objectId];
- newObject = [folder lookupName: cname
- inContext: woContext
- acquire: NO];
- }
-
- /* dissociate the object url associated with this object, as we want to
- discard it */
- objectId = [self objectId];
- [mapping unregisterURLWithID: objectId];
-
- /* associate the new object url with this object id */
- [mapping registerURL: url withID: objectId];
-
- [newObject setContext: woContext];
- ASSIGN (sogoObject, newObject);
-}
-
-- (NSUInteger) sensitivity
-{
- return [[self _appointmentWrapper] sensitivity];
-}
-
-- (NSString *) creator
-{
- return [[self _appointmentWrapper] creator];
-}
-
-- (NSString *) owner
-{
- return [[self _appointmentWrapper] owner];
-}
-
-- (void) _updateAttachedEvents
-{
- NSArray *allAttachments;
- NSUInteger count, max;
- NSString *uid, *summary;
- iCalEvent *event;
- MAPIStoreCalendarAttachment *attachment;
-
- /* ensure that all exception events have the same UID as the master */
- uid = [masterEvent uid];
- summary = [masterEvent summary];
-
- allAttachments = [attachmentParts allValues];
- max = [allAttachments count];
- for (count = 0; count < max; count++)
- {
- attachment = [allAttachments objectAtIndex: count];
- event = [attachment event];
- if ([[event summary] length] == 0)
- [event setSummary: summary];
- [event setUid: uid];
- }
-}
-
-- (void) save: (TALLOC_CTX *) memCtx
-{
- // iCalCalendar *vCalendar;
- // NSCalendarDate *now;
- NSString *uid, *nameInContainer;
- // iCalEvent *newEvent;
- // iCalPerson *userPerson;
- SOGoUser *activeUser;
- NSRange rangeOfDot;
-
- if (isNew)
- {
- uid = [self _uidFromGlobalObjectId: memCtx];
- if (uid)
- {
- /* Hack required because of what's explained in oxocal 3.1.4.7.1:
- basically, Outlook creates a copy of the event and then removes
- the old instance. We perform a trickery to avoid performing those
- operations in the backend, in a way that enables us to recover
- the initial instance and act solely on it. */
- [self _fixupAppointmentObjectWithUID: uid];
- }
- else
- {
- /* We create a UID from the nameInContainer, or the reverse if the
- latter is already set... */
- nameInContainer = [sogoObject nameInContainer];
- if (nameInContainer)
- {
- rangeOfDot = [nameInContainer rangeOfString: @"."
- options: NSBackwardsSearch];
- if (rangeOfDot.location == NSNotFound)
- uid = nameInContainer;
- else
- uid = [nameInContainer substringToIndex: rangeOfDot.location];
- }
- else
- {
- uid = [SOGoObject globallyUniqueObjectId];
- nameInContainer = [NSString stringWithFormat: @"%@.ics", uid];
- [sogoObject setNameInContainer: nameInContainer];
- }
- }
- [masterEvent setUid: uid];
- }
-
- // [self logWithFormat: @"-save, event props:"];
- // MAPIStoreDumpMessageProperties (newProperties);
-
- // now = [NSCalendarDate date];
-
- activeUser = [[self context] activeUser];
- [masterEvent updateFromMAPIProperties: properties
- inUserContext: [self userContext]
- withActiveUser: activeUser
- isNew: isNew
- inMemCtx: memCtx];
- [self _updateAttachedEvents];
- [[self userContext] activate];
- [sogoObject updateContentWithCalendar: calendar
- fromRequest: nil];
- [self updateVersions];
-}
-
-- (id) lookupAttachment: (NSString *) childKey
-{
- return [attachmentParts objectForKey: childKey];
-}
-
-- (MAPIStoreAttachment *) createAttachment
-{
- MAPIStoreCalendarAttachment *newAttachment;
- uint32_t newAid;
- NSString *newKey;
- iCalEvent *newEvent;
-
- newAid = [[self attachmentKeys] count];
-
- newAttachment = [MAPIStoreCalendarAttachment
- mapiStoreObjectInContainer: self];
- [newAttachment setAID: newAid];
- newEvent = [iCalEvent groupWithTag: @"vevent"];
- [newAttachment setEvent: newEvent];
- [calendar addToEvents: newEvent];
-
- newKey = [NSString stringWithFormat: @"%ul", newAid];
- [attachmentParts setObject: newAttachment
- forKey: newKey];
- [attachmentKeys release];
- attachmentKeys = nil;
-
- return newAttachment;
-}
-
-- (enum mapistore_error) setReadFlag: (uint8_t) flag
-{
- return MAPISTORE_SUCCESS;
-}
-
-@end
diff --git a/OpenChange/MAPIStoreCalendarMessageTable.h b/OpenChange/MAPIStoreCalendarMessageTable.h
deleted file mode 100644
index eeccbc455..000000000
--- a/OpenChange/MAPIStoreCalendarMessageTable.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* MAPIStoreCalendarMessageTable.h - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECALENDARMESSAGETABLE_H
-#define MAPISTORECALENDARMESSAGETABLE_H
-
-#import "MAPIStoreGCSMessageTable.h"
-
-@interface MAPIStoreCalendarMessageTable : MAPIStoreGCSMessageTable
-
-@end
-
-#endif /* MAPISTORECALENDARMESSAGETABLE_H */
diff --git a/OpenChange/MAPIStoreCalendarMessageTable.m b/OpenChange/MAPIStoreCalendarMessageTable.m
deleted file mode 100644
index bbf05274f..000000000
--- a/OpenChange/MAPIStoreCalendarMessageTable.m
+++ /dev/null
@@ -1,193 +0,0 @@
-/* MAPIStoreCalendarMessageTable.m - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-
-#import
-
-#import
-
-#import "MAPIStoreCalendarMessage.h"
-#import "MAPIStoreTypes.h"
-#import "NSDate+MAPIStore.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreCalendarMessageTable.h"
-
-#include
-
-static Class MAPIStoreCalendarMessageK = Nil;
-
-@implementation MAPIStoreCalendarMessageTable
-
-+ (void) initialize
-{
- MAPIStoreCalendarMessageK = [MAPIStoreCalendarMessage class];
-}
-
-+ (Class) childObjectClass
-{
- return MAPIStoreCalendarMessageK;
-}
-
-- (EOQualifier *) _orgMailNotNullQualifier
-{
- static EOQualifier *orgMailQualifier = nil;
- EOQualifier *notNullQualifier, *nullQualifier, *notEmptyQualifier, *emptyQualifier;
-
- if (!orgMailQualifier)
- {
- nullQualifier = [[EOKeyValueQualifier alloc]
- initWithKey: @"c_orgmail"
- operatorSelector: EOQualifierOperatorEqual
- value: [NSNull null]];
- notNullQualifier = [[EONotQualifier alloc]
- initWithQualifier: nullQualifier];
- emptyQualifier = [[EOKeyValueQualifier alloc]
- initWithKey: @"c_orgmail"
- operatorSelector: EOQualifierOperatorEqual
- value: @""];
- notEmptyQualifier = [[EONotQualifier alloc]
- initWithQualifier: emptyQualifier];
- orgMailQualifier = [[EOAndQualifier alloc]
- initWithQualifiers: notNullQualifier,
- notEmptyQualifier, nil];
- [nullQualifier release];
- [notNullQualifier release];
- [emptyQualifier release];
- [notEmptyQualifier release];
- }
-
- return orgMailQualifier;
-}
-
-- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
- intoQualifier: (EOQualifier **) qualifier
-{
- MAPIRestrictionState rc;
- id value;
- NSMutableString *likeString;
- NSString *likePartString;
- EOAndQualifier *andQualifier, *stringQualifier;
- union {
- uint32_t longValue;
- char charValue[4];
- } apptIdValue;
-
- value = NSObjectFromMAPISPropValue (&res->lpProp);
- switch ((uint32_t) res->ulPropTag)
- {
- case PR_MESSAGE_CLASS_UNICODE:
- if ([value isEqualToString: @"IPM.Appointment"])
- rc = MAPIRestrictionStateAlwaysTrue;
- else
- rc = MAPIRestrictionStateAlwaysFalse;
- break;
- case PR_OWNER_APPT_ID:
- // c_orgmail != NULL && c_orgmail != '' && c_uid like 'ab%89';
- apptIdValue.longValue = [value unsignedLongValue];
- likeString = [NSMutableString string];
- likePartString = [[NSString alloc]
- initWithBytes: apptIdValue.charValue
- length: 2
- encoding: NSISOLatin1StringEncoding];
- [likeString appendString: likePartString];
- [likePartString release];
- [likeString appendString: @"%%"];
- likePartString = [[NSString alloc]
- initWithBytes: apptIdValue.charValue + 2
- length: 2
- encoding: NSISOLatin1StringEncoding];
- [likeString appendString: likePartString];
- [likePartString release];
- stringQualifier = [[EOKeyValueQualifier alloc]
- initWithKey: @"c_uid"
- operatorSelector: EOQualifierOperatorLike
- value: likeString];
- andQualifier = [[EOAndQualifier alloc]
- initWithQualifiers: [self _orgMailNotNullQualifier],
- stringQualifier, nil];
- [andQualifier autorelease];
- [stringQualifier release];
- *qualifier = andQualifier;
- rc = MAPIRestrictionStateNeedsEval;
- break;
- case PidLidBusyStatus:
- rc = MAPIRestrictionStateAlwaysTrue; // should be based on c_isopaque
- break;
- default:
- rc = [super evaluatePropertyRestriction: res intoQualifier: qualifier];
- }
-
- return rc;
-}
-
-- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
-{
- static NSMutableDictionary *knownProperties = nil;
-
- if (!knownProperties)
- {
- knownProperties = [NSMutableDictionary new];
- [knownProperties setObject: @"c_startdate"
- forKey: MAPIPropertyKey (PidLidAppointmentStartWhole)];
- [knownProperties setObject: @"c_enddate"
- forKey: MAPIPropertyKey (PidLidAppointmentEndWhole)];
- [knownProperties setObject: @"c_iscycle"
- forKey: MAPIPropertyKey (PidLidRecurring)];
- }
-
- return [knownProperties objectForKey: MAPIPropertyKey (property)];
-}
-
-/* sorting */
-
-- (NSString *) sortIdentifierForProperty: (enum MAPITAGS) property
-{
- static NSMutableDictionary *knownProperties = nil;
-
- if (!knownProperties)
- {
- knownProperties = [NSMutableDictionary new];
- [knownProperties setObject: @"c_startdate"
- forKey: MAPIPropertyKey (PidLidAppointmentStartWhole)];
- [knownProperties setObject: @"c_enddate"
- forKey: MAPIPropertyKey (PidLidAppointmentEndWhole)];
- [knownProperties setObject: @"c_iscycle"
- forKey: MAPIPropertyKey (PidLidRecurring)];
- [knownProperties setObject: @"c_isallday"
- forKey: MAPIPropertyKey (PidLidAppointmentSubType)];
- [knownProperties setObject: @"c_creationdate"
- forKey: MAPIPropertyKey (PR_CREATION_TIME)];
- [knownProperties setObject: @"c_uid"
- forKey: MAPIPropertyKey (PR_OWNER_APPT_ID)];
- /* Use by oxcfxics to sort the latest first */
- [knownProperties setObject: @"c_lastmodified"
- forKey: MAPIPropertyKey (PidTagMessageDeliveryTime)];
- }
-
- return [knownProperties objectForKey: MAPIPropertyKey (property)];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreContactsAttachment.h b/OpenChange/MAPIStoreContactsAttachment.h
deleted file mode 100644
index c4a368849..000000000
--- a/OpenChange/MAPIStoreContactsAttachment.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* MAPIStoreContactsAttachment.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECONTACTSATTACHMENT_H
-#define MAPISTORECONTACTSATTACHMENT_H
-
-#import "MAPIStoreAttachment.h"
-
-@class NSData;
-@class NGVCardPhoto;
-
-@interface MAPIStoreContactsAttachment : MAPIStoreAttachment
-{
- NGVCardPhoto *photo;
- NSData *photoData;
-}
-
-- (void) setPhoto: (NGVCardPhoto *) newPhoto;
-
-@end
-
-#endif /* MAPISTORECONTACTSATTACHMENT_H */
diff --git a/OpenChange/MAPIStoreContactsAttachment.m b/OpenChange/MAPIStoreContactsAttachment.m
deleted file mode 100644
index 6b0d73133..000000000
--- a/OpenChange/MAPIStoreContactsAttachment.m
+++ /dev/null
@@ -1,197 +0,0 @@
-/* MAPIStoreContactsAttachment.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-#import
-
-#import "MAPIStoreTypes.h"
-#import "NSData+MAPIStore.h"
-#import "NSDate+MAPIStore.h"
-#import "NSObject+MAPIStore.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreContactsAttachment.h"
-
-#include
-
-/* TODO: handle URL pictures via PidTagAttachMethod = ref ? */
-
-@implementation MAPIStoreContactsAttachment
-
-- (id) init
-{
- if ((self = [super init]))
- {
- photo = nil;
- photoData = nil;
- }
-
- return self;
-}
-
-- (void) dealloc
-{
- [photo release];
- [photoData release];
- [super dealloc];
-}
-
-- (void) setPhoto: (NGVCardPhoto *) newPhoto
-{
- ASSIGN (photo, newPhoto);
-}
-
-- (NSString *) fileExtension
-{
- NSString *type, *extension;
-
- type = [photo type];
- if ([type isEqualToString: @"JPEG"]
- || [type isEqualToString: @"JPG"])
- extension = @".jpg";
- else if ([type isEqualToString: @"PNG"])
- extension = @".png";
- else if ([type isEqualToString: @"BMP"])
- extension = @".bmp";
- else if ([type isEqualToString: @"GIF"])
- extension = @".gif";
- else
- extension = nil;
-
- return extension;
-}
-
-- (NSDate *) creationTime
-{
- return [container creationTime];
-}
-
-- (NSDate *) lastModificationTime
-{
- return [container lastModificationTime];
-}
-
-- (enum mapistore_error) getPidTagAttachEncoding: (void **) data inMemCtx: (TALLOC_CTX *) memCtx;
-{
- *data = [[NSData data] asBinaryInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachFlags: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getLongZero: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagAttachmentFlags: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getLongZero: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagAttachmentHidden: (void **) data inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getNo: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagAttachmentLinkId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getLongZero: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagAttachMethod: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx, 0x00000001);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachmentContactPhoto: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagAttachDataBinary: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if (!photoData)
- ASSIGN (photoData,
- [[photo flattenedValuesForKey: @""] dataByDecodingBase64]);
-
- *data = [photoData asBinaryInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachSize: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if (!photoData)
- ASSIGN (photoData,
- [[photo flattenedValuesForKey: @""] dataByDecodingBase64]);
-
- *data = MAPILongValue (memCtx, [photoData length]);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachExtension: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = [[self fileExtension] asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachLongFilename: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *filename;
-
- filename = [NSString stringWithFormat: @"ContactPhoto%@",
- [self fileExtension]];
-
- *data = [filename asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAttachFilename: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidTagAttachLongFilename: data
- inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagDisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidTagAttachLongFilename: data inMemCtx: memCtx];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreContactsContext.h b/OpenChange/MAPIStoreContactsContext.h
deleted file mode 100644
index 68120215e..000000000
--- a/OpenChange/MAPIStoreContactsContext.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* MAPIStoreContactsContext.h - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc.
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECONTACTSCONTEXT_H
-#define MAPISTORECONTACTSCONTEXT_H
-
-#import "MAPIStoreGCSBaseContext.h"
-
-@interface MAPIStoreContactsContext : MAPIStoreGCSBaseContext
-
-@end
-
-#endif /* MAPISTORECONTACTSCONTEXT_H */
diff --git a/OpenChange/MAPIStoreContactsContext.m b/OpenChange/MAPIStoreContactsContext.m
deleted file mode 100644
index bfef33e27..000000000
--- a/OpenChange/MAPIStoreContactsContext.m
+++ /dev/null
@@ -1,59 +0,0 @@
-/* MAPIStoreContactsContext.m - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc.
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-
-#import
-
-#import "MAPIStoreContactsFolder.h"
-#import "MAPIStoreUserContext.h"
-
-#import "MAPIStoreContactsContext.h"
-
-#undef DEBUG
-#include
-
-static Class MAPIStoreContactsFolderK;
-
-@implementation MAPIStoreContactsContext
-
-+ (void) initialize
-{
- MAPIStoreContactsFolderK = [MAPIStoreContactsFolder class];
-}
-
-+ (NSString *) MAPIModuleName
-{
- return @"contacts";
-}
-
-+ (enum mapistore_context_role) MAPIContextRole
-{
- return MAPISTORE_CONTACTS_ROLE;
-}
-
-- (Class) MAPIStoreFolderClass
-{
- return MAPIStoreContactsFolderK;
-}
-
-@end
diff --git a/OpenChange/MAPIStoreContactsFolder.h b/OpenChange/MAPIStoreContactsFolder.h
deleted file mode 100644
index 2bade99f7..000000000
--- a/OpenChange/MAPIStoreContactsFolder.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* MAPIStoreContactsFolder.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECONTACTSFOLDER_H
-#define MAPISTORECONTACTSFOLDER_H
-
-#import "MAPIStoreGCSFolder.h"
-
-@interface MAPIStoreContactsFolder : MAPIStoreGCSFolder
-
-@end
-
-#endif /* MAPISTORECONTACTSFOLDER_H */
diff --git a/OpenChange/MAPIStoreContactsFolder.m b/OpenChange/MAPIStoreContactsFolder.m
deleted file mode 100644
index d55c34a25..000000000
--- a/OpenChange/MAPIStoreContactsFolder.m
+++ /dev/null
@@ -1,157 +0,0 @@
-/* MAPIStoreContactsFolder.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-#import
-#import
-#import
-
-#import "MAPIApplication.h"
-#import "MAPIStoreUserContext.h"
-#import "MAPIStoreContactsContext.h"
-#import "MAPIStoreContactsMessage.h"
-#import "MAPIStoreContactsMessageTable.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreContactsFolder.h"
-
-#include
-#include
-#include
-
-@implementation MAPIStoreContactsFolder
-
-- (MAPIStoreMessageTable *) messageTable
-{
- [self synchroniseCache];
- return [MAPIStoreContactsMessageTable tableForContainer: self];
-}
-
-- (NSString *) component
-{
- return @"vcard";
-}
-
-- (MAPIStoreMessage *) createMessage
-{
- MAPIStoreMessage *newMessage;
- SOGoContactGCSEntry *newEntry;
- NSString *name;
-
- [[self userContext] activate];
-
- name = [NSString stringWithFormat: @"%@.vcf",
- [SOGoObject globallyUniqueObjectId]];
- newEntry = [SOGoContactGCSEntry objectWithName: name
- inContainer: sogoObject];
- [newEntry setIsNew: YES];
- newMessage = [MAPIStoreContactsMessage mapiStoreObjectWithSOGoObject: newEntry
- inContainer: self];
-
- return newMessage;
-}
-
-- (NSArray *) rolesForExchangeRights: (uint32_t) rights
-{
- /* Limitations
-
- Following rights are not supported by SOGo specifically:
-
- - CreateSubfolders: No contacts subfolders
- - FolderVisible: It is inferred by other rights when extracting
- */
- NSMutableArray *roles;
-
- roles = [NSMutableArray arrayWithCapacity: 8];
- if (rights & RightsCreateItems)
- [roles addObject: SOGoRole_ObjectCreator];
- if (rights & RightsDeleteAll)
- [roles addObject: SOGoRole_ObjectEraser];
- if (rights & RightsDeleteOwn)
- [roles addObject: MAPIStoreRightDeleteOwn];
- if (rights & RightsEditAll)
- [roles addObject: SOGoRole_ObjectEditor];
- if (rights & RightsEditOwn)
- [roles addObject: MAPIStoreRightEditOwn];
- if (rights & RightsReadItems)
- [roles addObject: SOGoRole_ObjectViewer];
-
- if (rights & RightsFolderOwner)
- [roles addObject: MAPIStoreRightFolderOwner];
- if (rights & RightsFolderContact)
- [roles addObject: MAPIStoreRightFolderContact];
-
- return roles;
-}
-
-- (uint32_t) exchangeRightsForRoles: (NSArray *) roles
-{
- uint32_t rights = 0;
-
- if ([roles containsObject: SOGoRole_ObjectCreator])
- rights |= RightsCreateItems;
-
- if ([roles containsObject: SOGoRole_ObjectEraser])
- rights |= RightsDeleteAll | RightsDeleteOwn;
- else if ([roles containsObject: MAPIStoreRightDeleteOwn])
- rights |= RightsDeleteOwn;
-
- if ([roles containsObject: SOGoRole_ObjectEditor])
- rights |= RightsEditAll | RightsEditOwn;
- else if ([roles containsObject: MAPIStoreRightEditOwn])
- rights |= RightsEditOwn;
-
- if ([roles containsObject: SOGoRole_ObjectViewer])
- rights |= RightsReadItems;
- if (rights != 0)
- rights |= RoleNone; /* actually "folder visible" */
-
- if ([roles containsObject: MAPIStoreRightFolderOwner])
- rights |= RightsFolderOwner | RoleNone;
-
- if ([roles containsObject: MAPIStoreRightFolderContact])
- rights |= RightsFolderContact;
-
- return rights;
-}
-
-- (BOOL) subscriberCanModifyMessages
-{
- return [[self activeUserRoles] containsObject: SOGoRole_ObjectEditor];
-}
-
-- (BOOL) subscriberCanReadMessages
-{
- return [[self activeUserRoles] containsObject: SOGoRole_ObjectViewer];
-}
-
-- (enum mapistore_error) getPidTagDefaultPostMessageClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = [@"IPM.Contact" asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-@end
diff --git a/OpenChange/MAPIStoreContactsMessage.h b/OpenChange/MAPIStoreContactsMessage.h
deleted file mode 100644
index 48d5bafb0..000000000
--- a/OpenChange/MAPIStoreContactsMessage.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* MAPIStoreContactsMessage.h - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECONTACTSMESSAGE_H
-#define MAPISTORECONTACTSMESSAGE_H
-
-#import "MAPIStoreGCSMessage.h"
-
-@interface MAPIStoreContactsMessage : MAPIStoreGCSMessage
-{
- BOOL fetchedAttachments;
-}
-
-@end
-
-#endif /* MAPISTORECONTACTSMESSAGE_H */
diff --git a/OpenChange/MAPIStoreContactsMessage.m b/OpenChange/MAPIStoreContactsMessage.m
deleted file mode 100644
index 344f31c39..000000000
--- a/OpenChange/MAPIStoreContactsMessage.m
+++ /dev/null
@@ -1,1619 +0,0 @@
-/* MAPIStoreContactsMessage.m - this file is part of SOGo
- *
- * Copyright (C) 2011-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- * Ludovic Marcotte
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-
-#import "MAPIStoreAttachment.h"
-#import "MAPIStoreContactsAttachment.h"
-#import "MAPIStoreContactsFolder.h"
-#import "MAPIStoreContext.h"
-#import "MAPIStorePropertySelectors.h"
-#import "MAPIStoreSamDBUtils.h"
-#import "MAPIStoreTypes.h"
-#import "NSArray+MAPIStore.h"
-#import "NSDate+MAPIStore.h"
-#import "NSData+MAPIStore.h"
-#import "NSObject+MAPIStore.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreContactsMessage.h"
-
-#undef DEBUG
-#include
-#include
-#include
-#include
-#include
-
-@implementation SOGoContactGCSEntry (MAPIStoreExtension)
-
-- (Class) mapistoreMessageClass
-{
- return [MAPIStoreContactsMessage class];
-}
-
-@end
-
-@implementation MAPIStoreContactsMessage
-
-- (id) init
-{
- if ((self = [super init]))
- {
- fetchedAttachments = NO;
- }
-
- return self;
-}
-
-// TODO: this should be combined with the version found
-// in UIxContactEditor.m
-- (CardElement *) _elementWithTag: (NSString *) tag
- ofType: (NSString *) type
- forCard: (NGVCard *) card
-{
- NSArray *elements;
- CardElement *element;
-
- elements = [card childrenWithTag: tag
- andAttribute: @"type" havingValue: type];
- if ([elements count] > 0)
- element = [elements objectAtIndex: 0];
- else
- {
- element = [CardElement new];
- [element autorelease];
- [element setTag: tag];
- [element addType: type];
- [card addChild: element];
- }
-
- return element;
-}
-
-- (enum mapistore_error) getPidTagIconIndex: (void **) data // TODO
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- /* see http://msdn.microsoft.com/en-us/library/cc815472.aspx */
- *data = MAPILongValue (memCtx, 0x00000200);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAlternateRecipientAllowed: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagMessageFlags: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx, MSGFLAG_READ);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagDeleteAfterSubmit: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-
-{
- return [self getNo: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagMessageClass: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = talloc_strdup (memCtx, "IPM.Contact");
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagSendInternetEncoding: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx, 0x00065001);
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagNormalizedSubject: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidTagDisplayName: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidFileUnder: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *surName, *givenName, *middleName;
- NSMutableString *fileUnder;
- CardElement *n;
-
- n = [[sogoObject vCard] n];
- surName = [n flattenedValueAtIndex: 0
- forKey: @""];
- fileUnder = [surName mutableCopy];
- [fileUnder autorelease];
- [fileUnder appendString: @","];
- givenName = [n flattenedValueAtIndex: 1
- forKey: @""];
- if ([givenName length] > 0)
- [fileUnder appendFormat: @" %@", givenName];
- middleName = [n flattenedValueAtIndex: 2
- forKey: @""];
- if ([middleName length] > 0)
- [fileUnder appendFormat: @" %@", middleName];
-
- *data = [fileUnder asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidFileUnderId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- *data = MAPILongValue (memCtx, 0x00008017); /* what ol2003 sets */
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagAccount: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidLidEmail1EmailAddress: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagContactEmailAddresses: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[sogoObject vCard] preferredEMail];
- if (!stringValue)
- stringValue = @"";
- *data = [[NSArray arrayWithObject: stringValue]
- asMVUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagEmsAbTargetAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[sogoObject vCard] preferredEMail];
- *data = [[NSString stringWithFormat: @"SMTP:%@", stringValue]
- asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagSearchKey: (void **) data // TODO
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[sogoObject vCard] preferredEMail];
- *data = [[stringValue dataUsingEncoding: NSASCIIStringEncoding]
- asBinaryInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagMailPermission: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getYes: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagBody: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- enum mapistore_error rc = MAPISTORE_SUCCESS;
- NSString *stringValue;
-
- stringValue = [[sogoObject vCard] note];
- if ([stringValue length] > 0)
- *data = [stringValue asUnicodeInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagSensitivity: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getLongZero: data inMemCtx: memCtx];
-}
-
-// ---------------------------------------------------------
-// Contact Name Properties [MS-OXOCNTC 2.2.1.1]
-// ---------------------------------------------------------
-
-- (enum mapistore_error) getPidTagNickname: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[sogoObject vCard] nickname];
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagGeneration: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
- flattenedValueAtIndex: 4
- forKey: @""];
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagSurname: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
- flattenedValueAtIndex: 0
- forKey: @""];
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagMiddleName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
- flattenedValueAtIndex: 2
- forKey: @""];
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagGivenName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
- flattenedValueAtIndex: 1
- forKey: @""];
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagDisplayNamePrefix: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
- flattenedValueAtIndex: 3
- forKey: @""];
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-// -------------------------------------------------------
-// Electronic Address Properties [MS-OXOCNTC 2.2.1.2]
-// -------------------------------------------------------
-
-enum { // [MS-OXOCNTC] 2.2.1.2.11
- AddressBookProviderEmailValueEmail1 = 0,
- AddressBookProviderEmailValueEmail2,
- AddressBookProviderEmailValueEmail3,
- AddressBookProviderEmailValueBusinessFax,
- AddressBookProviderEmailValueHomeFax,
- AddressBookProviderEmailValuePrimaryFax
-};
-
-/*
- Fetch Email1, Email2 and Email3 values from the vcard.
- Returns nil if not found
-*/
-- (NSString *) _fetchEmailAddress: (NSUInteger) position
-{
- NSMutableArray *emails;
- NSString *email, *stringValue = nil;
- NGVCard *card;
- NSUInteger count, max;
-
- card = [sogoObject vCard];
-
- if (position == 1)
- // Predefined email
- return [card preferredEMail];
-
- emails = [NSMutableArray array];
- [emails addObjectsFromArray: [card childrenWithTag: @"email"]];
- [emails removeObjectsInArray: [card childrenWithTag: @"email"
- andAttribute: @"type"
- havingValue: @"pref"]];
- max = [emails count];
- for (count = 0; !stringValue && count < max; count++)
- {
- email = [[emails objectAtIndex: count] flattenedValuesForKey: @""];
-
- if ([email caseInsensitiveCompare: [card preferredEMail]] != NSOrderedSame)
- {
- position--;
- if (position == 1)
- stringValue = email;
- }
- }
-
- return stringValue;
-}
-
-/*
- Store on *data the given email (position)
- It can return MAPISTORE_ERR_NOT_FOUND if the email doesn't exist
-*/
-- (enum mapistore_error) _getPidLidEmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
- atPosition: (NSUInteger) position
-{
- NSString *email;
-
- email = [self _fetchEmailAddress: position];
- if (!email) return MAPISTORE_ERR_NOT_FOUND;
-
- *data = [email asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidEmail1EmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailAddress: data inMemCtx: memCtx atPosition: 1];
-}
-
-- (enum mapistore_error) getPidLidEmail2EmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailAddress: data inMemCtx: memCtx atPosition: 2];
-}
-
-- (enum mapistore_error) getPidLidEmail3EmailAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailAddress: data inMemCtx: memCtx atPosition: 3];
-}
-
-- (enum mapistore_error) getPidLidEmail1OriginalDisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidLidEmail1EmailAddress: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidEmail2OriginalDisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidLidEmail2EmailAddress: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidEmail3OriginalDisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self getPidLidEmail3EmailAddress: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidEmail1AddressType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if (![self _fetchEmailAddress: 1]) return MAPISTORE_ERR_NOT_FOUND;
-
- return [self getSMTPAddrType: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidEmail2AddressType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if (![self _fetchEmailAddress: 2]) return MAPISTORE_ERR_NOT_FOUND;
-
- return [self getSMTPAddrType: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidEmail3AddressType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if (![self _fetchEmailAddress: 3]) return MAPISTORE_ERR_NOT_FOUND;
-
- return [self getSMTPAddrType: data inMemCtx: memCtx];
-}
-
-/*
- Store on *data a string with the display name for the given email (position)
- It can return MAPISTORE_ERR_NOT_FOUND if the email doesn't exist
-*/
-- (enum mapistore_error) _getPidLidEmailDisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
- atPosition: (NSUInteger) position
-{
- NGVCard *vCard;
- NSString *fn, *email;
-
- email = [self _fetchEmailAddress: position];
- if (!email) return MAPISTORE_ERR_NOT_FOUND;
-
- vCard = [sogoObject vCard];
- fn = [vCard fn];
-
- *data = [[NSString stringWithFormat: @"%@ (%@)", fn, email]
- asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidEmail1DisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailDisplayName: data inMemCtx: memCtx atPosition: 1];
-}
-
-- (enum mapistore_error) getPidLidEmail2DisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailDisplayName: data inMemCtx: memCtx atPosition: 2];
-}
-
-- (enum mapistore_error) getPidLidEmail3DisplayName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailDisplayName: data inMemCtx: memCtx atPosition: 3];
-}
-
-/*
- Return an entry id (either one-off or addressbook entry) for the given email
- It can return nil if the email doesn't exist
-*/
-- (NSData *) _buildEntryIdForEmail: (NSUInteger) position
-{
- NSString *email, *username;
- NSData *data;
- SOGoUserManager *mgr;
- NSDictionary *contactInfos;
-
- email = [self _fetchEmailAddress: position];
- if (!email) return nil;
-
- // Try to figure out if this email is from local domain
- mgr = [SOGoUserManager sharedUserManager];
- contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
- if (contactInfos)
- {
- username = [contactInfos objectForKey: @"sAMAccountName"];
- data = MAPIStoreInternalEntryId ([[self context] connectionInfo], username);
- }
- else
- data = MAPIStoreExternalEntryId ([[sogoObject vCard] fn], email);
-
- return data;
-}
-/*
- Store on *data an entryId for the given email (position)
- It can return MAPISTORE_ERR_NOT_FOUND if the email doesn't exist
-*/
-- (enum mapistore_error) _getPidLidEmailOriginalEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
- atPosition: (NSUInteger) position
-{
- NSData *value;
-
- value = [self _buildEntryIdForEmail: position];
- if (!value) return MAPISTORE_ERR_NOT_FOUND;
-
- *data = [value asBinaryInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidEmail1OriginalEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailOriginalEntryId: data
- inMemCtx: memCtx
- atPosition: 1];
-}
-
-- (enum mapistore_error) getPidLidEmail2OriginalEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailOriginalEntryId: data
- inMemCtx: memCtx
- atPosition: 2];
-}
-
-- (enum mapistore_error) getPidLidEmail3OriginalEntryId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getPidLidEmailOriginalEntryId: data
- inMemCtx: memCtx
- atPosition: 3];
-}
-
-- (enum mapistore_error) _getElement: (NSString *) elementTag
- ofType: (NSString *) aType
- excluding: (NSString *) aTypeToExclude
- atPos: (NSUInteger) pos
- inData: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSArray *elements;
- CardElement *ce;
- NSUInteger count, max;
- NGVCard *vCard;
- NSString *stringValue;
-
- stringValue = nil;
-
- vCard = [sogoObject vCard];
- elements = [[vCard childrenWithTag: elementTag]
- cardElementsWithAttribute: @"type"
- havingValue: aType];
- max = [elements count];
- for (count = 0; !stringValue && count < max; count++)
- {
- ce = [elements objectAtIndex: count];
- if (!aTypeToExclude
- || ![ce hasAttribute: @"type" havingValue: aTypeToExclude])
- stringValue = [ce flattenedValueAtIndex: pos forKey: @""];
- }
-
- if (!stringValue)
- return MAPISTORE_ERR_NOT_FOUND;
-
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagBusinessFaxNumber: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"tel" ofType: @"fax" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-/*
- [MS-OXOCNTC] 2.2.1.2.11
- https://msdn.microsoft.com/en-us/library/ee158427%28v=exchg.80%29.aspx
-*/
-- (NSArray *) _buildAddressBookProviderEmailList
-{
- NSMutableArray *list = [[NSMutableArray alloc] init];
- NSArray *elements;
-
- // Is there a fax number?
- elements = [[[sogoObject vCard] childrenWithTag: @"tel"]
- cardElementsWithAttribute: @"type"
- havingValue: @"fax"];
- if ([elements count] > 0)
- [list addObject: [NSNumber numberWithInteger: AddressBookProviderEmailValueBusinessFax]];
-
- // How many different email addresses?
- if ([self _fetchEmailAddress: 1])
- [list addObject: [NSNumber numberWithInteger: AddressBookProviderEmailValueEmail1]];
- else
- return list;
- if ([self _fetchEmailAddress: 2])
- [list addObject: [NSNumber numberWithInteger: AddressBookProviderEmailValueEmail2]];
- else
- return list;
- if ([self _fetchEmailAddress: 3])
- [list addObject: [NSNumber numberWithInteger: AddressBookProviderEmailValueEmail3]];
-
- return list;
-}
-
-- (enum mapistore_error) getPidLidAddressBookProviderArrayType: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- // [MS-OXOCNTC] 2.2.1.2.12
- // https://msdn.microsoft.com/en-us/library/ee218011%28v=exchg.80%29.aspx
- uint32_t value = 0;
- NSArray *emailList = [self _buildAddressBookProviderEmailList];
-
- if ([emailList count] > 0)
- {
- for (NSNumber *maskValue in emailList)
- value |= 1 << [maskValue intValue];
-
- *data = MAPILongValue (memCtx, value);
-
- return MAPISTORE_SUCCESS;
- }
- else
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-- (enum mapistore_error) getPidLidAddressBookProviderEmailList: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSArray *emailList = [self _buildAddressBookProviderEmailList];
-
- if ([emailList count] > 0)
- {
- *data = [emailList asMVLongInMemCtx: memCtx];
- return MAPISTORE_SUCCESS;
- }
- else
- return MAPISTORE_ERR_NOT_FOUND;
-}
-
-// ---------------------------------------------------------
-// Physical Address Properties [MS-OXOCNTC 2.2.1.3]
-// ---------------------------------------------------------
-
-// Home Address
-
-- (enum mapistore_error) getPidTagHomeAddressStreet: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"home" excluding: nil
- atPos: 2 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagHomeAddressCity: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"home" excluding: nil
- atPos: 3 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagHomeAddressStateOrProvince: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"home" excluding: nil
- atPos: 4 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagHomeAddressPostalCode: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"home" excluding: nil
- atPos: 5 inData: data inMemCtx: memCtx];
-}
-- (enum mapistore_error) getPidTagHomeAddressCountry: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"home" excluding: nil
- atPos: 6 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagHomeAddressPostOfficeBox: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"home" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidHomeAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"label" ofType: @"home" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-// Work Address
-
-- (enum mapistore_error) getPidLidWorkAddressStreet: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"work" excluding: nil
- atPos: 2 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidWorkAddressCity: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"work" excluding: nil
- atPos: 3 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidWorkAddressState: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"work" excluding: nil
- atPos: 4 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidWorkAddressPostalCode: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"work" excluding: nil
- atPos: 5 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidWorkAddressCountry: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"work" excluding: nil
- atPos: 6 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidWorkAddressPostOfficeBox: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"work" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidWorkAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"label" ofType: @"work" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-// Mailing Address
-
-- (enum mapistore_error) getPidTagStreetAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"pref" excluding: nil
- atPos: 2 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagLocality: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"pref" excluding: nil
- atPos: 3 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagStateOrProvince: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"pref" excluding: nil
- atPos: 4 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagPostalCode: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"pref" excluding: nil
- atPos: 5 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagCountry: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"pref" excluding: nil
- atPos: 6 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagPostOfficeBox: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"adr" ofType: @"pref" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagPostalAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"label" ofType: @"pref" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidLidPostalAddressId: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSArray *elements;
- CardElement *element;
- uint32_t longValue = 0;
- NGVCard *vCard;
-
- vCard = [sogoObject vCard];
- elements = [[vCard childrenWithTag: @"adr"]
- cardElementsWithAttribute: @"type"
- havingValue: @"pref"];
- if ([elements count] > 0)
- {
- element = [elements objectAtIndex: 0];
- if ([element hasAttribute: @"type"
- havingValue: @"home"])
- longValue = 1; // The Home Address is the mailing address.
- else if ([element hasAttribute: @"type"
- havingValue: @"work"])
- longValue = 2; // The Work Address is the mailing address.
- }
- *data = MAPILongValue (memCtx, longValue);
-
- return MAPISTORE_SUCCESS;
-}
-
-// -------------------------------------------------------
-// Telephone Properties [MS-OXOCNTC 2.2.1.4]
-// -------------------------------------------------------
-
-- (enum mapistore_error) getPidTagPagerTelephoneNumber: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"tel" ofType: @"pager" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagBusinessTelephoneNumber: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"tel" ofType: @"work" excluding: @"fax"
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagHomeTelephoneNumber: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"tel" ofType: @"home" excluding: @"fax"
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagPrimaryTelephoneNumber: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"tel" ofType: @"pref" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagMobileTelephoneNumber: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"tel" ofType: @"cell" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-// ---------------------------------------------------------
-// Event Properties [MS-OXOCNTC 2.2.1.5]
-// ---------------------------------------------------------
-
-- (enum mapistore_error) getPidTagBirthday: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSCalendarDate *dateValue;
- NSString *stringValue;
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- stringValue = [[sogoObject vCard] bday];
- if ([stringValue length] != 0)
- {
- dateValue = [NSCalendarDate dateWithString: stringValue
- calendarFormat: @"%Y-%m-%d"];
- //dateValue = [dateValue addYear: 0 month: 0 day: 1 hour: 0 minute: 0 second: 0];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagWeddingAnniversary: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSCalendarDate *dateValue;
- NSString *stringValue;
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"x-ms-anniversary"]
- flattenedValuesForKey: @""];
- if ([stringValue length] != 0)
- {
- dateValue = [NSCalendarDate dateWithString: stringValue
- calendarFormat: @"%Y-%m-%d"];
- *data = [dateValue asFileTimeInMemCtx: memCtx];
- }
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-// ---------------------------------------------------------
-// Professional Properties [MS-OXOCNTC 2.2.1.6]
-// ---------------------------------------------------------
-
-- (enum mapistore_error) getPidTagTitle: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[sogoObject vCard] title];
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagCompanyName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- CardElement *org;
-
- org = [[sogoObject vCard] org];
- *data = [[org flattenedValueAtIndex: 0 forKey: @""]
- asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagDepartmentName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- CardElement *org;
-
- org = [[sogoObject vCard] org];
- *data = [[org flattenedValueAtIndex: 1 forKey: @""]
- asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidTagOfficeLocation: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"x-ms-office"]
- flattenedValuesForKey: @""];
- if ([stringValue length] != 0)
- *data = [stringValue asUnicodeInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagManagerName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"x-ms-manager"]
- flattenedValuesForKey: @""];
- if ([stringValue length] != 0)
- *data = [stringValue asUnicodeInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagAssistant: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"x-ms-assistant"]
- flattenedValuesForKey: @""];
- if ([stringValue length] != 0)
- *data = [stringValue asUnicodeInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagProfession: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- stringValue = [[sogoObject vCard] role];
- if (stringValue)
- *data = [stringValue asUnicodeInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-// ---------------------------------------------------------
-// Contact Photo Properties [MS-OXOCNTC 2.2.1.8]
-// ---------------------------------------------------------
-
-- (void) _fetchAttachmentParts
-{
- NGVCardPhoto *photo;
- MAPIStoreContactsAttachment *attachment;
- NSString *encoding;
-
- photo = (NGVCardPhoto *) [[sogoObject vCard] firstChildWithTag: @"photo"];
- if (photo)
- {
- encoding = [[photo value: 0 ofAttribute: @"encoding"] uppercaseString];
- if ([encoding isEqualToString: @"B"]
- || [encoding isEqualToString: @"BASE64"])
- {
- attachment = [MAPIStoreContactsAttachment
- mapiStoreObjectInContainer: self];
- [attachment setAID: 0];
- [attachment setPhoto: photo];
- [attachmentParts setObject: attachment forKey: @"photo"];
- }
- }
-
- fetchedAttachments = YES;
-}
-
-- (enum mapistore_error) getPidLidHasPicture: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- if (!fetchedAttachments)
- [self _fetchAttachmentParts];
-
- *data = MAPIBoolValue (memCtx, ([attachmentParts count] > 0));
-
- return MAPISTORE_SUCCESS;
-}
-
-- (NSArray *) attachmentKeysMatchingQualifier: (EOQualifier *) qualifier
- andSortOrderings: (NSArray *) sortOrderings
-{
- if (!fetchedAttachments)
- [self _fetchAttachmentParts];
-
- return [super attachmentKeysMatchingQualifier: qualifier
- andSortOrderings: sortOrderings];
-}
-
-- (id) lookupAttachment: (NSString *) childKey
-{
- if (!fetchedAttachments)
- [self _fetchAttachmentParts];
-
- return [attachmentParts objectForKey: childKey];
-}
-
-- (void) _updatePhotoInVCard: (NGVCard *) card
- fromProperties: (NSDictionary *) attachmentProps
-{
- NSString *photoExt, *photoType, *content;
- CardElement *photo;
-
- if ([[attachmentProps
- objectForKey: MAPIPropertyKey (PR_ATTACHMENT_CONTACTPHOTO)]
- boolValue])
- {
- photoExt = [[attachmentProps
- objectForKey: MAPIPropertyKey (PR_ATTACH_EXTENSION_UNICODE)]
- uppercaseString];
- if ([photoExt isEqualToString: @".JPG"])
- photoType = @"JPEG";
- else if ([photoExt isEqualToString: @".PNG"])
- photoType = @"PNG";
- else if ([photoExt isEqualToString: @".BMP"])
- photoType = @"BMP";
- else if ([photoExt isEqualToString: @".GIF"])
- photoType = @"GIF";
- else
- photoType = nil;
-
- content = [[attachmentProps
- objectForKey: MAPIPropertyKey (PR_ATTACH_DATA_BIN)]
- stringByEncodingBase64];
- if (photoType && content)
- {
- photo = [card uniqueChildWithTag: @"photo"];
- [photo setValue: 0 ofAttribute: @"type"
- to: photoType];
- [photo setValue: 0 ofAttribute: @"encoding"
- to: @"b"];
- [photo setSingleValue: [content stringByReplacingString: @"\n"
- withString: @""]
- atIndex: 0 forKey: @""];
- }
- }
-}
-
-// ---------------------------------------------------------
-// Other Properties [MS-OXOCNTC 2.2.1.10]
-// ---------------------------------------------------------
-
-- (enum mapistore_error) getPidTagSpouseName: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"x-ms-spouse"]
- flattenedValuesForKey: @""];
- if ([stringValue length] != 0)
- *data = [stringValue asUnicodeInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidLidInstantMessagingAddress: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
-
- stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"x-aim"]
- flattenedValuesForKey: @""];
- if (!stringValue)
- stringValue = @"";
- *data = [stringValue asUnicodeInMemCtx: memCtx];
-
- return MAPISTORE_SUCCESS;
-}
-
-- (enum mapistore_error) getPidLidFreeBusyLocation: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- NSString *stringValue;
- enum mapistore_error rc = MAPISTORE_SUCCESS;
-
- stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"fburl"]
- flattenedValuesForKey: @""];
- if ([stringValue length] != 0)
- *data = [stringValue asUnicodeInMemCtx: memCtx];
- else
- rc = MAPISTORE_ERR_NOT_FOUND;
-
- return rc;
-}
-
-- (enum mapistore_error) getPidTagPersonalHomePage: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"url" ofType: @"home" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-- (enum mapistore_error) getPidTagBusinessHomePage: (void **) data
- inMemCtx: (TALLOC_CTX *) memCtx
-{
- return [self _getElement: @"url" ofType: @"work" excluding: nil
- atPos: 0 inData: data inMemCtx: memCtx];
-}
-
-// ---------------------------------------------------------
-// Permissions
-// ---------------------------------------------------------
-
-- (NSString *) creator
-{
- return [[[sogoObject vCard] uniqueChildWithTag: @"x-openchange-creator"]
- flattenedValuesForKey: @""];
-}
-
-- (NSString *) owner
-{
- return [self creator];
-}
-
-- (BOOL) subscriberCanReadMessage
-{
- return [[self activeUserRoles] containsObject: SOGoRole_ObjectViewer];
-}
-
-// ---------------------------------------------------------
-// Save
-// ---------------------------------------------------------
-- (void) saveDistList:(TALLOC_CTX *) memCtx
-{
- [self warnWithFormat: @"IPM.DistList messages are ignored"];
-}
-
-- (void) saveContact:(TALLOC_CTX *) memCtx
-{
- NSArray *elements, *units;
- CardElement *element;
- NGVCard *newCard;
- MAPIStoreAttachment *attachment;
- int postalAddressId;
- id value;
-
- [self logWithFormat: @"setMAPIProperties: %@", properties];
-
- newCard = [sogoObject vCard];
- [newCard setTag: @"vcard"];
- [newCard setVersion: @"3.0"];
- [newCard setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
- [newCard setProfile: @"vCard"];
-
- // Decomposed fullname
- [newCard setNWithFamily: [properties objectForKey: MAPIPropertyKey(PR_SURNAME_UNICODE)]
- given: [properties objectForKey: MAPIPropertyKey(PR_GIVEN_NAME_UNICODE)]
- additional: [properties objectForKey: MAPIPropertyKey(PR_MIDDLE_NAME_UNICODE)]
- prefixes: [properties objectForKey: MAPIPropertyKey(PR_DISPLAY_NAME_PREFIX_UNICODE)]
- suffixes: [properties objectForKey: MAPIPropertyKey(PR_GENERATION_UNICODE)]];
-
- //
- // display name
- //
- value = [properties objectForKey: MAPIPropertyKey(PR_DISPLAY_NAME_UNICODE)];
- if (value)
- [newCard setFn: value];
-
- //
- // email addresses handling
- //
- elements = [newCard childrenWithTag: @"email"];
- value = [properties objectForKey: MAPIPropertyKey(PidLidEmail1EmailAddress)];
- if (value)
- {
- if ([elements count] > 0)
- [[elements objectAtIndex: 0] setSingleValue: value forKey: @""];
- else
- [newCard addEmail: value
- types: [NSArray arrayWithObject: @"pref"]];
- }
- value = [properties objectForKey: MAPIPropertyKey (PidLidEmail2EmailAddress)];
- if (value)
- {
- if ([elements count] > 1)
- [[elements objectAtIndex: 1] setSingleValue: value forKey: @""];
- else
- [newCard addEmail: value types: nil];
- }
- value = [properties objectForKey: MAPIPropertyKey (PidLidEmail3EmailAddress)];
- if (value)
- {
- if ([elements count] > 2)
- [[elements objectAtIndex: 2] setSingleValue: value forKey: @""];
- else
- [newCard addEmail: value types: nil];
- }
-
- //
- // work postal addresses handling
- //
- // Possible values for PidLidPostalAddressId are:
- //
- // 0x00000000 - No address is selected as the Mailing Address.
- // 0x00000001 - The Home Address is the Mailing Address.
- // 0x00000002 - The Work Address is the Mailing Address
- // 0x00000003 - The Other Address is the Mailing Address.
- //
- //
- postalAddressId = [[properties objectForKey: MAPIPropertyKey (PidLidPostalAddressId)]
- intValue];
-
- value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddress)];
- if ([value length])
- {
- elements = [newCard childrenWithTag: @"label"
- andAttribute: @"type"
- havingValue: @"work"];
- if ([elements count] > 0)
- element = [elements objectAtIndex: 0];
- else
- {
- element = [CardElement elementWithTag: @"label"];
- [element addAttribute: @"type" value: @"work"];
- [newCard addChild: element];
- }
- if (postalAddressId == 2)
- {
- [element removeValue: @"pref"
- fromAttribute: @"type"];
- [element addAttribute: @"type"
- value: @"pref"];
- }
- [element setSingleValue: value forKey: @""];
- }
-
- elements = [newCard childrenWithTag: @"adr"
- andAttribute: @"type"
- havingValue: @"work"];
- if ([elements count] > 0)
- element = [elements objectAtIndex: 0];
- else
- {
- element = [CardElement elementWithTag: @"adr"];
- [element addAttribute: @"type" value: @"work"];
- [newCard addChild: element];
- }
- if (postalAddressId == 2)
- [element addAttribute: @"type" value: @"pref"];
- value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressPostOfficeBox)];
- if (value)
- [element setSingleValue: value atIndex: 0 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressStreet)];
- if (value)
- [element setSingleValue: value atIndex: 2 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressCity)];
- if (value)
- [element setSingleValue: value atIndex: 3 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressState)];
- if (value)
- [element setSingleValue: value atIndex: 4 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressPostalCode)];
- if (value)
- [element setSingleValue: value atIndex: 5 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressCountry)];
- if (value)
- [element setSingleValue: value atIndex: 6 forKey: @""];
-
- //
- // home postal addresses handling
- //
- value = [properties objectForKey: MAPIPropertyKey(PidLidHomeAddress)];
- if ([value length])
- {
- elements = [newCard childrenWithTag: @"label"
- andAttribute: @"type"
- havingValue: @"home"];
- if ([elements count] > 0)
- element = [elements objectAtIndex: 0];
- else
- {
- element = [CardElement elementWithTag: @"label"];
- [element addAttribute: @"type" value: @"home"];
- [newCard addChild: element];
- }
- if (postalAddressId == 1)
- {
- [element removeValue: @"pref"
- fromAttribute: @"type"];
- [element addAttribute: @"type"
- value: @"pref"];
- }
- [element setSingleValue: value forKey: @""];
- }
-
- elements = [newCard childrenWithTag: @"adr"
- andAttribute: @"type"
- havingValue: @"home"];
- if ([elements count] > 0)
- element = [elements objectAtIndex: 0];
- else
- {
- element = [CardElement elementWithTag: @"adr"];
- [element addAttribute: @"type" value: @"home"];
- [newCard addChild: element];
- }
- if (postalAddressId == 1)
- [element addAttribute: @"type" value: @"pref"];
-
- value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_POST_OFFICE_BOX_UNICODE)];
- if (value)
- [element setSingleValue: value atIndex: 0 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey( PR_HOME_ADDRESS_STREET_UNICODE)];
- if (value)
- [element setSingleValue: value atIndex: 2 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_CITY_UNICODE)];
- if (value)
- [element setSingleValue: value atIndex: 3 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_STATE_OR_PROVINCE_UNICODE)];
- if (value)
- [element setSingleValue: value atIndex: 4 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_POSTAL_CODE_UNICODE)];
- if (value)
- [element setSingleValue: value atIndex: 5 forKey: @""];
- value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_COUNTRY_UNICODE)];
- if (value)
- [element setSingleValue: value atIndex: 6 forKey: @""];
-
-
- //
- // telephone numbers: work, home, fax, pager and mobile
- //
- element = [self _elementWithTag: @"tel" ofType: @"work" forCard: newCard];
- value = [properties objectForKey: MAPIPropertyKey(PR_OFFICE_TELEPHONE_NUMBER_UNICODE)];
- if (value)
- [element setSingleValue: value forKey: @""];
-
- element = [self _elementWithTag: @"tel" ofType: @"home" forCard: newCard];
- value = [properties objectForKey: MAPIPropertyKey(PR_HOME_TELEPHONE_NUMBER_UNICODE)];
- if (value)
- [element setSingleValue: value forKey: @""];
-
- element = [self _elementWithTag: @"tel" ofType: @"fax" forCard: newCard];
- value = [properties objectForKey: MAPIPropertyKey(PR_BUSINESS_FAX_NUMBER_UNICODE)];
- if (value)
- [element setSingleValue: value forKey: @""];
-
- element = [self _elementWithTag: @"tel" ofType: @"pager" forCard: newCard];
- value = [properties objectForKey: MAPIPropertyKey(PR_PAGER_TELEPHONE_NUMBER_UNICODE)];
- if (value)
- [element setSingleValue: value forKey: @""];
-
- element = [self _elementWithTag: @"tel" ofType: @"cell" forCard: newCard];
- value = [properties objectForKey: MAPIPropertyKey(PR_MOBILE_TELEPHONE_NUMBER_UNICODE)];
- if (value)
- [element setSingleValue: value forKey: @""];
-
-
- //
- // job title, profession, nickname, company name, deparment, work url, im address/screen name and birthday
- //
- value = [properties objectForKey: MAPIPropertyKey(PR_TITLE_UNICODE)];
- if (value)
- [newCard setTitle: value];
-
- value = [properties objectForKey: MAPIPropertyKey(PR_PROFESSION_UNICODE)];
- if (value)
- {
- [newCard setRole: value];
- }
-
- value = [properties objectForKey: MAPIPropertyKey(PR_NICKNAME_UNICODE)];
- if (value)
- [newCard setNickname: value];
-
- value = [properties objectForKey: MAPIPropertyKey(PR_DEPARTMENT_NAME_UNICODE)];
- if (value)
- units = [NSArray arrayWithObject: value];
- else
- units = nil;
-
- value = [properties objectForKey: MAPIPropertyKey(PR_COMPANY_NAME_UNICODE)];
- if (value)
- [newCard setOrg: value units: units];
-
- value = [properties objectForKey: MAPIPropertyKey(PR_BUSINESS_HOME_PAGE_UNICODE)];
- if (value)
- {
- [[self _elementWithTag: @"url" ofType: @"work" forCard: newCard]
- setSingleValue: value forKey: @""];
- }
-
- value = [properties objectForKey: MAPIPropertyKey(PidLidInstantMessagingAddress)];
- if (value)
- {
- [[newCard uniqueChildWithTag: @"x-aim"]
- setSingleValue: value forKey: @""];
- }
-
- value = [properties objectForKey: MAPIPropertyKey(PR_BIRTHDAY)];
- if (value)
- {
- [newCard setBday: [value descriptionWithCalendarFormat: @"%Y-%m-%d"]];
- }
-
- //
- // wedding anniversary, spouse's name, manager's name, assistant's name, office location, freebusy location
- //
- value = [properties objectForKey: MAPIPropertyKey(PidTagWeddingAnniversary)];
- if (value)
- {
- [[newCard uniqueChildWithTag: @"x-ms-anniversary"]
- setSingleValue: [value descriptionWithCalendarFormat: @"%Y-%m-%d"]
- forKey: @""];
- }
-
- value = [properties objectForKey: MAPIPropertyKey(PR_SPOUSE_NAME_UNICODE)];
- if (value)
- {
- [[newCard uniqueChildWithTag: @"x-ms-spouse"]
- setSingleValue: value forKey: @""];
- }
-
- value = [properties objectForKey: MAPIPropertyKey(PR_MANAGER_NAME_UNICODE)];
- if (value)
- {
- [[newCard uniqueChildWithTag: @"x-ms-manager"]
- setSingleValue: value forKey: @""];
- }
-
- value = [properties objectForKey: MAPIPropertyKey(PR_ASSISTANT_UNICODE)];
- if (value)
- {
- [[newCard uniqueChildWithTag: @"x-ms-assistant"]
- setSingleValue: value forKey: @""];
- }
-
- value = [properties objectForKey: MAPIPropertyKey(PR_OFFICE_LOCATION_UNICODE)];
- if (value)
- {
- [[newCard uniqueChildWithTag: @"x-ms-office"]
- setSingleValue: value forKey: @""];
- }
-
- value = [properties objectForKey: MAPIPropertyKey(PidLidFreeBusyLocation)];
- if (value)
- {
- [[newCard uniqueChildWithTag: @"fburl"]
- setSingleValue: value forKey: @""];
- }
-
- /* photo */
- if ([attachmentParts count] > 0)
- {
- attachment = [[attachmentParts allValues] objectAtIndex: 0];
- [self _updatePhotoInVCard: newCard
- fromProperties: [attachment properties]];
- }
-
- /* Note */
- value = [properties objectForKey: MAPIPropertyKey (PR_BODY_UNICODE)];
- if (!value)
- {
- value = [properties objectForKey: MAPIPropertyKey (PR_HTML)];
- if (value)
- {
- value = [[NSString alloc] initWithData: value
- encoding: NSUTF8StringEncoding];
- [value autorelease];
- value = [value htmlToText];
- }
- }
- if (value)
- [newCard setNote: value];
-
- /* Store the creator name for sharing purposes */
- if (isNew)
- {
- value = [[[self context] activeUser] login];
- [[newCard uniqueChildWithTag: @"x-openchange-creator"]
- setSingleValue: value forKey: @""];
- }
-
- //
- // we save the new/modified card
- //
- [sogoObject saveComponent: newCard];
-
- [self updateVersions];
-}
-
-- (void) save:(TALLOC_CTX *) memCtx
-{
- NSString *messageClass = [properties objectForKey: MAPIPropertyKey(PR_MESSAGE_CLASS_UNICODE)];
- if ([messageClass isEqualToString: @"IPM.DistList"])
- [self saveDistList: memCtx];
- else
- [self saveContact: memCtx];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreContactsMessageTable.h b/OpenChange/MAPIStoreContactsMessageTable.h
deleted file mode 100644
index 0563f9b2e..000000000
--- a/OpenChange/MAPIStoreContactsMessageTable.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* MAPIStoreContactsMessageTable.h - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECONTACTSMESSAGETABLE_H
-#define MAPISTORECONTACTSMESSAGETABLE_H
-
-#import "MAPIStoreGCSMessageTable.h"
-
-@interface MAPIStoreContactsMessageTable : MAPIStoreGCSMessageTable
-@end
-
-#endif /* MAPISTORECONTACTSMESSAGETABLE_H */
diff --git a/OpenChange/MAPIStoreContactsMessageTable.m b/OpenChange/MAPIStoreContactsMessageTable.m
deleted file mode 100644
index b88158a26..000000000
--- a/OpenChange/MAPIStoreContactsMessageTable.m
+++ /dev/null
@@ -1,231 +0,0 @@
-/* MAPIStoreContactsMessageTable.m - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-#import
-
-#import
-#import
-#import
-#import
-#import
-
-#import
-
-#import "MAPIStoreContactsMessage.h"
-#import "MAPIStoreTypes.h"
-#import "NSDate+MAPIStore.h"
-#import "NSArray+MAPIStore.h"
-#import "NSData+MAPIStore.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreContactsMessageTable.h"
-
-#include
-
-static Class MAPIStoreContactsMessageK, NGMailAddressK, NSDataK, NSStringK;
-
-@implementation MAPIStoreContactsMessageTable
-
-+ (void) initialize
-{
- MAPIStoreContactsMessageK = [MAPIStoreContactsMessage class];
- NSDataK = [NSData class];
- NSStringK = [NSString class];
- NGMailAddressK = [NGMailAddress class];
-}
-
-+ (Class) childObjectClass
-{
- return MAPIStoreContactsMessageK;
-}
-
-- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
-{
- static NSMutableDictionary *knownProperties = nil;
-
- if (!knownProperties)
- {
- knownProperties = [NSMutableDictionary new];
- [knownProperties setObject: @"c_mail"
- forKey: MAPIPropertyKey (PidLidEmail1EmailAddress)];
- [knownProperties setObject: @"c_mail"
- forKey: MAPIPropertyKey (PidLidEmail2EmailAddress)];
- [knownProperties setObject: @"c_mail"
- forKey: MAPIPropertyKey (PidLidEmail3EmailAddress)];
- [knownProperties setObject: @"c_cn"
- forKey: MAPIPropertyKey (PidLidFileUnder)];
- [knownProperties setObject: @"c_cn"
- forKey: MAPIPropertyKey (PidTagDisplayName)];
- [knownProperties setObject: @"c_cn"
- forKey: MAPIPropertyKey (PidTagSubject)];
- }
-
- return [knownProperties objectForKey: MAPIPropertyKey (property)];
-}
-
-/* restrictions */
-
-- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
- intoQualifier: (EOQualifier **) qualifier
-{
- MAPIRestrictionState rc;
- EOAndQualifier *andQualifier;
- EOKeyValueQualifier *fullNameQualifier, *emailQualifier;
- NSString *fullName, *email;
- SEL operator;
- id value, ngAddress;
-
- value = NSObjectFromMAPISPropValue (&res->lpProp);
- switch ((uint32_t) res->ulPropTag)
- {
- case PR_MESSAGE_CLASS_UNICODE:
- if ([value isEqualToString: @"IPM.Contact"])
- rc = MAPIRestrictionStateAlwaysTrue;
- else
- rc = MAPIRestrictionStateAlwaysFalse;
- break;
-
- case PR_SENSITIVITY:
- rc = MAPIRestrictionStateAlwaysTrue;
- break;
- case PidLidAddressBookProviderArrayType:
- case PidLidAddressBookProviderEmailList:
- /* FIXME: this is a hack. We should return a real qualifier here */
- rc = MAPIRestrictionStateAlwaysTrue;
- break;
-
- case PidLidEmail1OriginalDisplayName:
- case PidLidEmail2OriginalDisplayName:
- case PidLidEmail3OriginalDisplayName:
- rc = MAPIRestrictionStateAlwaysFalse;
- value = NSObjectFromMAPISPropValue (&res->lpProp);
- if (value && [value isKindOfClass: NSStringK])
- {
- rc = MAPIRestrictionStateNeedsEval;
- ngAddress = [[NGMailAddressParser mailAddressParserWithString: value]
- parse];
- if ([ngAddress isKindOfClass: NGMailAddressK])
- {
- operator = [self operatorFromRestrictionOperator: res->relop];
- fullName = [ngAddress displayName];
- email = [ngAddress address];
- emailQualifier = [[EOKeyValueQualifier alloc]
- initWithKey: @"c_mail"
- operatorSelector: operator
- value: email];
- if ([fullName length] > 0)
- {
- fullNameQualifier = [[EOKeyValueQualifier alloc]
- initWithKey: @"c_cn"
- operatorSelector: operator
- value: fullName];
- andQualifier = [[EOAndQualifier alloc]
- initWithQualifiers:
- emailQualifier, fullNameQualifier, nil];
- [fullNameQualifier release];
- [emailQualifier release];
- *qualifier = andQualifier;
- }
- else
- *qualifier = emailQualifier;
- [*qualifier autorelease];
- }
- }
- break;
- case PidLidEmail1AddressType:
- case PidLidEmail2AddressType:
- case PidLidEmail3AddressType:
- if ([value isEqualToString: @"SMTP"])
- rc = MAPIRestrictionStateAlwaysTrue;
- else
- rc = MAPIRestrictionStateAlwaysFalse;
- break;
-
- default:
- rc = [super evaluatePropertyRestriction: res intoQualifier: qualifier];
- }
-
- return rc;
-}
-
-- (MAPIRestrictionState) evaluateContentRestriction: (struct mapi_SContentRestriction *) res
- intoQualifier: (EOQualifier **) qualifier
-{
- MAPIRestrictionState rc;
- id value;
-
- value = NSObjectFromMAPISPropValue (&res->lpProp);
- if ([value isKindOfClass: NSDataK])
- {
- value = [[NSString alloc] initWithData: value
- encoding: NSUTF8StringEncoding];
- [value autorelease];
- }
- else if (![value isKindOfClass: NSStringK])
- [NSException raise: @"MAPIStoreTypeConversionException"
- format: @"unhandled content restriction for class '%@'",
- NSStringFromClass ([value class])];
-
- switch (res->ulPropTag)
- {
- case PR_MESSAGE_CLASS_UNICODE: /* FIXME: should make use of c_component here */
- if ([value isEqualToString: @"IPM.Contact"])
- rc = MAPIRestrictionStateAlwaysTrue;
- else
- rc = MAPIRestrictionStateAlwaysFalse;
- break;
- default:
- rc = [super evaluateContentRestriction: res intoQualifier: qualifier];
- }
-
- return rc;
-}
-
-/* sorting */
-
-- (NSString *) sortIdentifierForProperty: (enum MAPITAGS) property
-{
- static NSMutableDictionary *knownProperties = nil;
-
- if (!knownProperties)
- {
- knownProperties = [NSMutableDictionary new];
- [knownProperties setObject: @"c_cn"
- forKey: MAPIPropertyKey (PidLidFileUnder)];
- [knownProperties setObject: @"c_cn"
- forKey: MAPIPropertyKey (PidTagDisplayName)];
- [knownProperties setObject: @"c_cn"
- forKey: MAPIPropertyKey (PidTagSubject)];
- [knownProperties setObject: @"c_cn"
- forKey: MAPIPropertyKey (PidTagNormalizedSubject)];
- /* Use by oxcfxics to sort the latest first */
- [knownProperties setObject: @"c_lastmodified"
- forKey: MAPIPropertyKey (PidTagMessageDeliveryTime)];
- }
-
- return [knownProperties objectForKey: MAPIPropertyKey (property)];
-}
-
-@end
diff --git a/OpenChange/MAPIStoreContext.h b/OpenChange/MAPIStoreContext.h
deleted file mode 100644
index 4bde9d79a..000000000
--- a/OpenChange/MAPIStoreContext.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* MAPIStoreContext.h - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc.
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef MAPISTORECONTEXT_H
-#define MAPISTORECONTEXT_H
-
-#include
-
-#import
-
-@class NSArray;
-@class NSFileHandle;
-@class NSMutableArray;
-@class NSMutableDictionary;
-@class NSString;
-@class NSURL;
-
-@class EOQualifier;
-
-@class WOContext;
-
-@class SOGoFolder;
-@class SOGoMAPIFSFolder;
-@class SOGoObject;
-@class SOGoUser;
-
-@class MAPIStoreAuthenticator;
-@class MAPIStoreAttachment;
-@class MAPIStoreAttachmentTable;
-@class MAPIStoreFolder;
-@class MAPIStoreMessage;
-@class MAPIStoreTable;
-@class MAPIStoreUserContext;
-
-@interface MAPIStoreContext : NSObject
-{
- struct mapistore_connection_info *connInfo;
- NSMutableArray *containersBag;
- SOGoUser *activeUser; /* the user accessing the resource */
- MAPIStoreUserContext *userContext; /* the owner or the resource */
- NSURL *contextUrl;
-}
-
-+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
- withIndexing: (struct indexing_context *) indexing
- inMemCtx: (TALLOC_CTX *) memCtx;
-+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
- withIndexing: (struct indexing_context *) indexing
- inMemCtx: (TALLOC_CTX *) memCtx;
-+ (enum mapistore_error) createRootFolder: (NSString **) mapistoreUriP
- withFID: (uint64_t ) fid
- andName: (NSString *) folderName
- forUser: (NSString *) username
- withRole: (enum mapistore_context_role) role;
-
-+ (enum mapistore_error) openContext: (MAPIStoreContext **) contextPtr
- withURI: (const char *) newUri
- connectionInfo: (struct mapistore_connection_info *) newConnInfo
- andTDBIndexing: (struct indexing_context *) indexing;
-
-- (id) initFromURL: (NSURL *) newUri
- withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
- andTDBIndexing: (struct indexing_context *) indexing;
-
-- (NSURL *) url;
-- (struct mapistore_connection_info *) connectionInfo;
-
-- (MAPIStoreUserContext *) userContext;
-
-- (SOGoUser *) activeUser;
-
-// - (id) lookupObject: (NSString *) objectURLString;
-
-/* backend methods */
-- (enum mapistore_error) getPath: (char **) path
- ofFMID: (uint64_t) fmid
- inMemCtx: (TALLOC_CTX *) memCtx;
-- (enum mapistore_error) getRootFolder: (MAPIStoreFolder **) folderPtr
- withFID: (uint64_t) fmid;
-
-/* util methods */
-- (NSString *) extractChildNameFromURL: (NSString *) childURL
- andFolderURLAt: (NSString **) folderURL;
-
-- (uint64_t) idForObjectWithKey: (NSString *) key
- inFolderURL: (NSString *) folderURL;
-- (NSArray *) getNewFMIDs: (uint64_t) max;
-- (uint64_t) getNewChangeNumber;
-- (NSArray *) getNewChangeNumbers: (uint64_t) max;
-
-/* subclass methods */
-+ (NSString *) MAPIModuleName;
-+ (enum mapistore_context_role) MAPIContextRole;
-+ (NSString *)
- createRootSecondaryFolderWithFID: (uint64_t) fid
- andName: (NSString *) folderName
- forUser: (NSString *) userName;
-- (Class) MAPIStoreFolderClass;
-
-/* the top-most parent of the context folder: SOGoMailAccount,
- SOGoCalendarFolders, ... */
-- (id) rootSOGoFolder;
-
-@end
-
-#endif /* MAPISTORECONTEXT_H */
diff --git a/OpenChange/MAPIStoreContext.m b/OpenChange/MAPIStoreContext.m
deleted file mode 100644
index 32a01e147..000000000
--- a/OpenChange/MAPIStoreContext.m
+++ /dev/null
@@ -1,644 +0,0 @@
-/* MAPIStoreContext.m - this file is part of SOGo
- *
- * Copyright (C) 2010-2012 Inverse inc.
- *
- * Author: Wolfgang Sourdeau
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * This file 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#import
-#import
-#import
-#import
-
-#import
-#import
-#import
-
-#import
-#import
-
-#import "MAPIStoreAttachment.h"
-#import "MAPIStoreFallbackContext.h"
-#import "MAPIStoreFolder.h"
-#import "MAPIStoreFolderTable.h"
-#import "MAPIStoreMapping.h"
-#import "MAPIStoreMessage.h"
-#import "MAPIStoreMessageTable.h"
-#import "MAPIStoreFAIMessage.h"
-#import "MAPIStoreFAIMessageTable.h"
-#import "MAPIStoreTypes.h"
-#import "MAPIStoreUserContext.h"
-#import "NSArray+MAPIStore.h"
-#import "NSObject+MAPIStore.h"
-#import "NSString+MAPIStore.h"
-
-#import "MAPIStoreContext.h"
-
-#undef DEBUG
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include