aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog6
-rw-r--r--addressbook/Makefile.am2
-rw-r--r--addressbook/backend/Makefile.am1
-rw-r--r--addressbook/backend/ebook/.cvsignore26
-rw-r--r--addressbook/backend/ebook/GNOME_Evolution_Addressbook_LDIF_Importer.server.in.in29
-rw-r--r--addressbook/backend/ebook/GNOME_Evolution_Addressbook_VCard_Importer.server.in.in29
-rw-r--r--addressbook/backend/ebook/Makefile.am79
-rw-r--r--addressbook/backend/ebook/TODO2
-rw-r--r--addressbook/backend/ebook/docs/rfc2047.txt843
-rw-r--r--addressbook/backend/ebook/docs/rfc2425.txt1851
-rw-r--r--addressbook/backend/ebook/docs/rfc2426.txt2355
-rw-r--r--addressbook/backend/ebook/docs/rfc2739.txt899
-rw-r--r--addressbook/backend/ebook/docs/vcard-21.txt1544
-rw-r--r--addressbook/backend/ebook/e-book-async.c1121
-rw-r--r--addressbook/backend/ebook/e-book-async.h107
-rw-r--r--addressbook/backend/ebook/e-book-listener.c394
-rw-r--r--addressbook/backend/ebook/e-book-listener.h112
-rw-r--r--addressbook/backend/ebook/e-book-marshal.list5
-rw-r--r--addressbook/backend/ebook/e-book-query.c524
-rw-r--r--addressbook/backend/ebook/e-book-query.h49
-rw-r--r--addressbook/backend/ebook/e-book-types.h68
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.c314
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.h90
-rw-r--r--addressbook/backend/ebook/e-book-view.c353
-rw-r--r--addressbook/backend/ebook/e-book-view.h70
-rw-r--r--addressbook/backend/ebook/e-book.c2060
-rw-r--r--addressbook/backend/ebook/e-book.h166
-rw-r--r--addressbook/backend/ebook/e-contact.c1288
-rw-r--r--addressbook/backend/ebook/e-contact.h231
-rw-r--r--addressbook/backend/ebook/e-destination.c1698
-rw-r--r--addressbook/backend/ebook/e-vcard.c1383
-rw-r--r--addressbook/backend/ebook/e-vcard.h165
-rw-r--r--addressbook/backend/ebook/evolution-ldif-importer.c592
-rw-r--r--addressbook/backend/ebook/evolution-vcard-importer.c214
-rw-r--r--addressbook/backend/ebook/load-gnomecard-addressbook.c77
-rw-r--r--addressbook/backend/ebook/load-pine-addressbook.c159
-rw-r--r--addressbook/backend/ebook/test-card.c193
-rw-r--r--addressbook/backend/ebook/tests/.cvsignore2
-rw-r--r--addressbook/backend/ebook/tests/Makefile.am1
-rw-r--r--addressbook/backend/ebook/tests/ebook/.cvsignore7
-rw-r--r--addressbook/backend/ebook/tests/ebook/Makefile.am12
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-changes.c89
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-date.c36
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-ebook.c110
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-photo.c59
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-string.c27
-rw-r--r--addressbook/backend/ebook/tests/vcard/.cvsignore3
-rw-r--r--addressbook/backend/ebook/tests/vcard/1.vcf12
-rw-r--r--addressbook/backend/ebook/tests/vcard/10.vcf12
-rw-r--r--addressbook/backend/ebook/tests/vcard/2.vcf10
-rw-r--r--addressbook/backend/ebook/tests/vcard/3.vcf13
-rw-r--r--addressbook/backend/ebook/tests/vcard/4.vcf11
-rw-r--r--addressbook/backend/ebook/tests/vcard/5.vcf32
-rw-r--r--addressbook/backend/ebook/tests/vcard/6.vcf12
-rw-r--r--addressbook/backend/ebook/tests/vcard/7.vcf11
-rw-r--r--addressbook/backend/ebook/tests/vcard/8.vcf11
-rw-r--r--addressbook/backend/ebook/tests/vcard/9.vcf9
-rw-r--r--addressbook/backend/ebook/tests/vcard/Makefile.am8
-rw-r--r--addressbook/backend/ebook/tests/vcard/README41
-rw-r--r--addressbook/backend/ebook/tests/vcard/dump-vcard.c32
-rw-r--r--addressbook/backend/idl/.cvsignore6
-rw-r--r--addressbook/backend/idl/Makefile.am4
-rw-r--r--addressbook/backend/idl/addressbook.idl187
-rw-r--r--addressbook/backend/pas/.cvsignore13
-rw-r--r--addressbook/backend/pas/Makefile.am109
-rw-r--r--addressbook/backend/pas/TODO2
-rw-r--r--addressbook/backend/pas/evolutionperson.schema212
-rw-r--r--addressbook/backend/pas/pas-backend-card-sexp.c482
-rw-r--r--addressbook/backend/pas/pas-backend-card-sexp.h56
-rw-r--r--addressbook/backend/pas/pas-backend-file.c1169
-rw-r--r--addressbook/backend/pas/pas-backend-file.h32
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c3206
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.h32
-rw-r--r--addressbook/backend/pas/pas-backend-summary.c1078
-rw-r--r--addressbook/backend/pas/pas-backend-summary.h72
-rw-r--r--addressbook/backend/pas/pas-backend-sync.c395
-rw-r--r--addressbook/backend/pas/pas-backend-sync.h81
-rw-r--r--addressbook/backend/pas/pas-backend-vcf.c675
-rw-r--r--addressbook/backend/pas/pas-backend-vcf.h35
-rw-r--r--addressbook/backend/pas/pas-backend.c671
-rw-r--r--addressbook/backend/pas/pas-backend.h173
-rw-r--r--addressbook/backend/pas/pas-book-factory.c471
-rw-r--r--addressbook/backend/pas/pas-book-factory.h53
-rw-r--r--addressbook/backend/pas/pas-book-view.c465
-rw-r--r--addressbook/backend/pas/pas-book-view.h64
-rw-r--r--addressbook/backend/pas/pas-book.c770
-rw-r--r--addressbook/backend/pas/pas-book.h96
-rw-r--r--addressbook/backend/pas/pas-marshal.list2
-rw-r--r--addressbook/backend/pas/pas-types.h32
-rw-r--r--addressbook/backend/pas/ximian-vcard.h81
-rw-r--r--addressbook/conduit/Makefile.am3
-rw-r--r--addressbook/conduit/address-conduit.c2
-rw-r--r--addressbook/gui/component/Makefile.am1
-rw-r--r--addressbook/gui/component/addressbook.c2
-rw-r--r--addressbook/gui/component/addressbook.h2
-rw-r--r--addressbook/gui/component/select-names/Makefile.am1
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c2
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.h2
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c3
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.h2
-rw-r--r--addressbook/gui/component/select-names/e-select-names-table-model.c3
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c4
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-address.h2
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.h2
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h4
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c4
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.h2
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.h4
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.h4
-rw-r--r--addressbook/gui/merging/eab-contact-compare.h4
-rw-r--r--addressbook/gui/merging/eab-contact-merging.h2
-rw-r--r--addressbook/gui/search/e-addressbook-search-dialog.h2
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h4
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.h2
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.h4
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h2
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.h2
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h2
-rw-r--r--addressbook/gui/widgets/e-minicard.c2
-rw-r--r--addressbook/gui/widgets/e-minicard.h2
-rw-r--r--addressbook/gui/widgets/eab-contact-display.h2
-rw-r--r--addressbook/gui/widgets/eab-gui-util.h2
-rw-r--r--addressbook/gui/widgets/eab-popup-control.c2
-rw-r--r--addressbook/gui/widgets/eab-popup-control.h6
-rw-r--r--addressbook/gui/widgets/eab-vcard-control.c4
-rw-r--r--addressbook/printing/Makefile.am2
-rw-r--r--addressbook/printing/e-contact-print-envelope.h2
-rw-r--r--addressbook/printing/e-contact-print.c4
-rw-r--r--addressbook/printing/e-contact-print.h4
-rw-r--r--addressbook/util/Makefile.am8
-rw-r--r--addressbook/util/eab-book-util.h4
-rw-r--r--addressbook/util/eab-destination.c2
-rw-r--r--addressbook/util/eab-destination.h4
133 files changed, 63 insertions, 30443 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index a52ef2373f..1997df2897 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,9 @@
+2003-11-07 JP Rosevear <jpr@ximian.com>
+
+ * In the gui this is a search and replace commit for moving the
+ addressbook to evolution-data-server; it also deletes the old
+ backend files
+
2003-11-05 Larry Ewing <lewing@ximian.com>
* gui/widgets/e-addressbook-view.c (create_minicard_view): fix cast.
diff --git a/addressbook/Makefile.am b/addressbook/Makefile.am
index 7bbbce2434..d472f0033b 100644
--- a/addressbook/Makefile.am
+++ b/addressbook/Makefile.am
@@ -3,7 +3,7 @@ CONDUIT_SUBDIR=conduit
endif
SUBDIRS = \
- backend util printing gui $(CONDUIT_SUBDIR)
+ util printing gui $(CONDUIT_SUBDIR)
EXTRA_DIST = \
ChangeLog.pre-1-4
diff --git a/addressbook/backend/Makefile.am b/addressbook/backend/Makefile.am
deleted file mode 100644
index b2807b2480..0000000000
--- a/addressbook/backend/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = idl ebook pas
diff --git a/addressbook/backend/ebook/.cvsignore b/addressbook/backend/ebook/.cvsignore
deleted file mode 100644
index 17250008f8..0000000000
--- a/addressbook/backend/ebook/.cvsignore
+++ /dev/null
@@ -1,26 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-addressbook-stubs.c
-addressbook-skels.c
-addressbook-common.c
-addressbook.h
-test-card
-test-client
-test-client-list
-test-ebook
-load-pine-addressbook
-load-gnomecard-addressbook
-evolution-vcard-importer
-evolution-gnomecard-importer
-evolution-ldif-importer
-GNOME_Evolution_Addressbook_VCard_Importer.server
-GNOME_Evolution_Addressbook_LDIF_Importer.server
-GNOME_Evolution_Addressbook_VCard_Importer.server.in
-GNOME_Evolution_Addressbook_LDIF_Importer.server.in
-e-book-marshal.c
-e-book-marshal.h
diff --git a/addressbook/backend/ebook/GNOME_Evolution_Addressbook_LDIF_Importer.server.in.in b/addressbook/backend/ebook/GNOME_Evolution_Addressbook_LDIF_Importer.server.in.in
deleted file mode 100644
index 392220d119..0000000000
--- a/addressbook/backend/ebook/GNOME_Evolution_Addressbook_LDIF_Importer.server.in.in
+++ /dev/null
@@ -1,29 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_LDIF_ImporterFactory"
- type="exe"
- location="@LIBEXECDIR@/evolution-ldif-importer">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution LDIF importer"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_LDIF_Importer"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_LDIF_ImporterFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Importer:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="evolution:menu_name" type="string"
- _value="LDAP Data Interchange Format (.ldif)"/>
- <oaf_attribute name="name" type="string"
- _value="Evolution LDIF importer"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/addressbook/backend/ebook/GNOME_Evolution_Addressbook_VCard_Importer.server.in.in b/addressbook/backend/ebook/GNOME_Evolution_Addressbook_VCard_Importer.server.in.in
deleted file mode 100644
index b630d31bec..0000000000
--- a/addressbook/backend/ebook/GNOME_Evolution_Addressbook_VCard_Importer.server.in.in
+++ /dev/null
@@ -1,29 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_VCard_ImporterFactory"
- type="exe"
- location="@LIBEXECDIR@/evolution-vcard-importer">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution VCard importer"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_VCard_Importer"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_VCard_ImporterFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Importer:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="evolution:menu_name" type="string"
- _value="VCard (.vcf, .gcrd)"/>
- <oaf_attribute name="name" type="string"
- _value="Evolution VCard Importer"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am
deleted file mode 100644
index e83e3e1411..0000000000
--- a/addressbook/backend/ebook/Makefile.am
+++ /dev/null
@@ -1,79 +0,0 @@
-# CORBA stuff
-
-SUBDIRS = . tests
-
-CORBA_ADDRESSBOOK_SOURCE_H = \
- addressbook.h
-CORBA_ADDRESSBOOK_SOURCE_C = \
- addressbook-common.c \
- addressbook-stubs.c \
- addressbook-skels.c
-CORBA_ADDRESSBOOK_IDL = $(srcdir)/../idl/addressbook.idl
-
-$(CORBA_ADDRESSBOOK_SOURCE_H): $(CORBA_ADDRESSBOOK_IDL)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(CORBA_ADDRESSBOOK_IDL)
-
-$(CORBA_ADDRESSBOOK_SOURCE_C): $(CORBA_ADDRESSBOOK_SOURCE_H)
-
-CORBA_SOURCE_H = $(CORBA_ADDRESSBOOK_SOURCE_H)
-CORBA_SOURCE_C = $(CORBA_ADDRESSBOOK_SOURCE_C)
-CORBA_SOURCE = $(CORBA_SOURCE_H) $(CORBA_SOURCE_C)
-
-
-# The component
-
-INCLUDES = \
- -DPREFIX=\"$(prefix)\" \
- -DSYSCONFDIR=\"$(sysconfdir)\" \
- -DDATADIR=\"$(datadir)\" \
- -DLIBDIR=\"$(libdir)\" \
- -DG_LOG_DOMAIN=\"EBook\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_srcdir)/addressbook/ename \
- -I$(top_builddir)/addressbook/backend \
- -I$(top_builddir)/addressbook/ename \
- -DG_DISABLE_DEPRECATED \
- -DLIBGNOME_DISABLE_DEPRECATED \
- $(EVOLUTION_ADDRESSBOOK_CFLAGS)
-
-privlib_LTLIBRARIES = libebook.la
-
-libebook_la_SOURCES = \
- $(CORBA_SOURCE) \
- addressbook.h \
- e-book-marshal.c \
- e-book-query.c \
- e-book-view-listener.c \
- e-book-view.c \
- e-book-listener.c \
- e-book.c \
- e-book-async.c \
- e-contact.c \
- e-vcard.c
-
-libebook_la_LIBADD = \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/e-util/ename/libename.la \
- $(top_builddir)/e-util/libeutil.la
-
-libebookincludedir = $(privincludedir)/ebook
-
-libebookinclude_HEADERS = \
- e-book-query.h \
- e-book-view-listener.h \
- e-book-view.h \
- e-book-types.h \
- e-book-listener.h \
- e-book.h \
- e-contact.h \
- e-vcard.h
-
-MARSHAL_GENERATED = e-book-marshal.c e-book-marshal.h
-@EVO_MARSHAL_RULE@
-
-BUILT_SOURCES = $(CORBA_SOURCE) $(MARSHAL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
diff --git a/addressbook/backend/ebook/TODO b/addressbook/backend/ebook/TODO
deleted file mode 100644
index a69703cd92..0000000000
--- a/addressbook/backend/ebook/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-* Make sure open_book_progress does not use the EBook op queue; make
- sure it works.
diff --git a/addressbook/backend/ebook/docs/rfc2047.txt b/addressbook/backend/ebook/docs/rfc2047.txt
deleted file mode 100644
index ff9a744bf3..0000000000
--- a/addressbook/backend/ebook/docs/rfc2047.txt
+++ /dev/null
@@ -1,843 +0,0 @@
-
-
-
-
-
-
-Network Working Group K. Moore
-Request for Comments: 2047 University of Tennessee
-Obsoletes: 1521, 1522, 1590 November 1996
-Category: Standards Track
-
-
- MIME (Multipurpose Internet Mail Extensions) Part Three:
- Message Header Extensions for Non-ASCII Text
-
-Status of this Memo
-
- This document specifies an Internet standards track protocol for the
- Internet community, and requests discussion and suggestions for
- improvements. Please refer to the current edition of the "Internet
- Official Protocol Standards" (STD 1) for the standardization state
- and status of this protocol. Distribution of this memo is unlimited.
-
-Abstract
-
- STD 11, RFC 822, defines a message representation protocol specifying
- considerable detail about US-ASCII message headers, and leaves the
- message content, or message body, as flat US-ASCII text. This set of
- documents, collectively called the Multipurpose Internet Mail
- Extensions, or MIME, redefines the format of messages to allow for
-
- (1) textual message bodies in character sets other than US-ASCII,
-
- (2) an extensible set of different formats for non-textual message
- bodies,
-
- (3) multi-part message bodies, and
-
- (4) textual header information in character sets other than US-ASCII.
-
- These documents are based on earlier work documented in RFC 934, STD
- 11, and RFC 1049, but extends and revises them. Because RFC 822 said
- so little about message bodies, these documents are largely
- orthogonal to (rather than a revision of) RFC 822.
-
- This particular document is the third document in the series. It
- describes extensions to RFC 822 to allow non-US-ASCII text data in
- Internet mail header fields.
-
-
-
-
-
-
-
-
-
-Moore Standards Track [Page 1]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- Other documents in this series include:
-
- + RFC 2045, which specifies the various headers used to describe
- the structure of MIME messages.
-
- + RFC 2046, which defines the general structure of the MIME media
- typing system and defines an initial set of media types,
-
- + RFC 2048, which specifies various IANA registration procedures
- for MIME-related facilities, and
-
- + RFC 2049, which describes MIME conformance criteria and
- provides some illustrative examples of MIME message formats,
- acknowledgements, and the bibliography.
-
- These documents are revisions of RFCs 1521, 1522, and 1590, which
- themselves were revisions of RFCs 1341 and 1342. An appendix in RFC
- 2049 describes differences and changes from previous versions.
-
-1. Introduction
-
- RFC 2045 describes a mechanism for denoting textual body parts which
- are coded in various character sets, as well as methods for encoding
- such body parts as sequences of printable US-ASCII characters. This
- memo describes similar techniques to allow the encoding of non-ASCII
- text in various portions of a RFC 822 [2] message header, in a manner
- which is unlikely to confuse existing message handling software.
-
- Like the encoding techniques described in RFC 2045, the techniques
- outlined here were designed to allow the use of non-ASCII characters
- in message headers in a way which is unlikely to be disturbed by the
- quirks of existing Internet mail handling programs. In particular,
- some mail relaying programs are known to (a) delete some message
- header fields while retaining others, (b) rearrange the order of
- addresses in To or Cc fields, (c) rearrange the (vertical) order of
- header fields, and/or (d) "wrap" message headers at different places
- than those in the original message. In addition, some mail reading
- programs are known to have difficulty correctly parsing message
- headers which, while legal according to RFC 822, make use of
- backslash-quoting to "hide" special characters such as "<", ",", or
- ":", or which exploit other infrequently-used features of that
- specification.
-
- While it is unfortunate that these programs do not correctly
- interpret RFC 822 headers, to "break" these programs would cause
- severe operational problems for the Internet mail system. The
- extensions described in this memo therefore do not rely on little-
- used features of RFC 822.
-
-
-
-Moore Standards Track [Page 2]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- Instead, certain sequences of "ordinary" printable ASCII characters
- (known as "encoded-words") are reserved for use as encoded data. The
- syntax of encoded-words is such that they are unlikely to
- "accidentally" appear as normal text in message headers.
- Furthermore, the characters used in encoded-words are restricted to
- those which do not have special meanings in the context in which the
- encoded-word appears.
-
- Generally, an "encoded-word" is a sequence of printable ASCII
- characters that begins with "=?", ends with "?=", and has two "?"s in
- between. It specifies a character set and an encoding method, and
- also includes the original text encoded as graphic ASCII characters,
- according to the rules for that encoding method.
-
- A mail composer that implements this specification will provide a
- means of inputting non-ASCII text in header fields, but will
- translate these fields (or appropriate portions of these fields) into
- encoded-words before inserting them into the message header.
-
- A mail reader that implements this specification will recognize
- encoded-words when they appear in certain portions of the message
- header. Instead of displaying the encoded-word "as is", it will
- reverse the encoding and display the original text in the designated
- character set.
-
-NOTES
-
- This memo relies heavily on notation and terms defined RFC 822 and
- RFC 2045. In particular, the syntax for the ABNF used in this memo
- is defined in RFC 822, as well as many of the terminal or nonterminal
- symbols from RFC 822 are used in the grammar for the header
- extensions defined here. Among the symbols defined in RFC 822 and
- referenced in this memo are: 'addr-spec', 'atom', 'CHAR', 'comment',
- 'CTLs', 'ctext', 'linear-white-space', 'phrase', 'quoted-pair'.
- 'quoted-string', 'SPACE', and 'word'. Successful implementation of
- this protocol extension requires careful attention to the RFC 822
- definitions of these terms.
-
- When the term "ASCII" appears in this memo, it refers to the "7-Bit
- American Standard Code for Information Interchange", ANSI X3.4-1986.
- The MIME charset name for this character set is "US-ASCII". When not
- specifically referring to the MIME charset name, this document uses
- the term "ASCII", both for brevity and for consistency with RFC 822.
- However, implementors are warned that the character set name must be
- spelled "US-ASCII" in MIME message and body part headers.
-
-
-
-
-
-
-Moore Standards Track [Page 3]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- This memo specifies a protocol for the representation of non-ASCII
- text in message headers. It specifically DOES NOT define any
- translation between "8-bit headers" and pure ASCII headers, nor is
- any such translation assumed to be possible.
-
-2. Syntax of encoded-words
-
- An 'encoded-word' is defined by the following ABNF grammar. The
- notation of RFC 822 is used, with the exception that white space
- characters MUST NOT appear between components of an 'encoded-word'.
-
- encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
-
- charset = token ; see section 3
-
- encoding = token ; see section 4
-
- token = 1*<Any CHAR except SPACE, CTLs, and especials>
-
- especials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "
- <"> / "/" / "[" / "]" / "?" / "." / "="
-
- encoded-text = 1*<Any printable ASCII character other than "?"
- or SPACE>
- ; (but see "Use of encoded-words in message
- ; headers", section 5)
-
- Both 'encoding' and 'charset' names are case-independent. Thus the
- charset name "ISO-8859-1" is equivalent to "iso-8859-1", and the
- encoding named "Q" may be spelled either "Q" or "q".
-
- An 'encoded-word' may not be more than 75 characters long, including
- 'charset', 'encoding', 'encoded-text', and delimiters. If it is
- desirable to encode more text than will fit in an 'encoded-word' of
- 75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may
- be used.
-
- While there is no limit to the length of a multiple-line header
- field, each line of a header field that contains one or more
- 'encoded-word's is limited to 76 characters.
-
- The length restrictions are included both to ease interoperability
- through internetwork mail gateways, and to impose a limit on the
- amount of lookahead a header parser must employ (while looking for a
- final ?= delimiter) before it can decide whether a token is an
- "encoded-word" or something else.
-
-
-
-
-
-Moore Standards Track [Page 4]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- IMPORTANT: 'encoded-word's are designed to be recognized as 'atom's
- by an RFC 822 parser. As a consequence, unencoded white space
- characters (such as SPACE and HTAB) are FORBIDDEN within an
- 'encoded-word'. For example, the character sequence
-
- =?iso-8859-1?q?this is some text?=
-
- would be parsed as four 'atom's, rather than as a single 'atom' (by
- an RFC 822 parser) or 'encoded-word' (by a parser which understands
- 'encoded-words'). The correct way to encode the string "this is some
- text" is to encode the SPACE characters as well, e.g.
-
- =?iso-8859-1?q?this=20is=20some=20text?=
-
- The characters which may appear in 'encoded-text' are further
- restricted by the rules in section 5.
-
-3. Character sets
-
- The 'charset' portion of an 'encoded-word' specifies the character
- set associated with the unencoded text. A 'charset' can be any of
- the character set names allowed in an MIME "charset" parameter of a
- "text/plain" body part, or any character set name registered with
- IANA for use with the MIME text/plain content-type.
-
- Some character sets use code-switching techniques to switch between
- "ASCII mode" and other modes. If unencoded text in an 'encoded-word'
- contains a sequence which causes the charset interpreter to switch
- out of ASCII mode, it MUST contain additional control codes such that
- ASCII mode is again selected at the end of the 'encoded-word'. (This
- rule applies separately to each 'encoded-word', including adjacent
- 'encoded-word's within a single header field.)
-
- When there is a possibility of using more than one character set to
- represent the text in an 'encoded-word', and in the absence of
- private agreements between sender and recipients of a message, it is
- recommended that members of the ISO-8859-* series be used in
- preference to other character sets.
-
-4. Encodings
-
- Initially, the legal values for "encoding" are "Q" and "B". These
- encodings are described below. The "Q" encoding is recommended for
- use when most of the characters to be encoded are in the ASCII
- character set; otherwise, the "B" encoding should be used.
- Nevertheless, a mail reader which claims to recognize 'encoded-word's
- MUST be able to accept either encoding for any character set which it
- supports.
-
-
-
-Moore Standards Track [Page 5]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- Only a subset of the printable ASCII characters may be used in
- 'encoded-text'. Space and tab characters are not allowed, so that
- the beginning and end of an 'encoded-word' are obvious. The "?"
- character is used within an 'encoded-word' to separate the various
- portions of the 'encoded-word' from one another, and thus cannot
- appear in the 'encoded-text' portion. Other characters are also
- illegal in certain contexts. For example, an 'encoded-word' in a
- 'phrase' preceding an address in a From header field may not contain
- any of the "specials" defined in RFC 822. Finally, certain other
- characters are disallowed in some contexts, to ensure reliability for
- messages that pass through internetwork mail gateways.
-
- The "B" encoding automatically meets these requirements. The "Q"
- encoding allows a wide range of printable characters to be used in
- non-critical locations in the message header (e.g., Subject), with
- fewer characters available for use in other locations.
-
-4.1. The "B" encoding
-
- The "B" encoding is identical to the "BASE64" encoding defined by RFC
- 2045.
-
-4.2. The "Q" encoding
-
- The "Q" encoding is similar to the "Quoted-Printable" content-
- transfer-encoding defined in RFC 2045. It is designed to allow text
- containing mostly ASCII characters to be decipherable on an ASCII
- terminal without decoding.
-
- (1) Any 8-bit value may be represented by a "=" followed by two
- hexadecimal digits. For example, if the character set in use
- were ISO-8859-1, the "=" character would thus be encoded as
- "=3D", and a SPACE by "=20". (Upper case should be used for
- hexadecimal digits "A" through "F".)
-
- (2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
- represented as "_" (underscore, ASCII 95.). (This character may
- not pass through some internetwork mail gateways, but its use
- will greatly enhance readability of "Q" encoded data with mail
- readers that do not support this encoding.) Note that the "_"
- always represents hexadecimal 20, even if the SPACE character
- occupies a different code position in the character set in use.
-
- (3) 8-bit values which correspond to printable ASCII characters other
- than "=", "?", and "_" (underscore), MAY be represented as those
- characters. (But see section 5 for restrictions.) In
- particular, SPACE and TAB MUST NOT be represented as themselves
- within encoded words.
-
-
-
-Moore Standards Track [Page 6]
-
-RFC 2047 Message Header Extensions November 1996
-
-
-5. Use of encoded-words in message headers
-
- An 'encoded-word' may appear in a message header or body part header
- according to the following rules:
-
-(1) An 'encoded-word' may replace a 'text' token (as defined by RFC 822)
- in any Subject or Comments header field, any extension message
- header field, or any MIME body part field for which the field body
- is defined as '*text'. An 'encoded-word' may also appear in any
- user-defined ("X-") message or body part header field.
-
- Ordinary ASCII text and 'encoded-word's may appear together in the
- same header field. However, an 'encoded-word' that appears in a
- header field defined as '*text' MUST be separated from any adjacent
- 'encoded-word' or 'text' by 'linear-white-space'.
-
-(2) An 'encoded-word' may appear within a 'comment' delimited by "(" and
- ")", i.e., wherever a 'ctext' is allowed. More precisely, the RFC
- 822 ABNF definition for 'comment' is amended as follows:
-
- comment = "(" *(ctext / quoted-pair / comment / encoded-word) ")"
-
- A "Q"-encoded 'encoded-word' which appears in a 'comment' MUST NOT
- contain the characters "(", ")" or "
- 'encoded-word' that appears in a 'comment' MUST be separated from
- any adjacent 'encoded-word' or 'ctext' by 'linear-white-space'.
-
- It is important to note that 'comment's are only recognized inside
- "structured" field bodies. In fields whose bodies are defined as
- '*text', "(" and ")" are treated as ordinary characters rather than
- comment delimiters, and rule (1) of this section applies. (See RFC
- 822, sections 3.1.2 and 3.1.3)
-
-(3) As a replacement for a 'word' entity within a 'phrase', for example,
- one that precedes an address in a From, To, or Cc header. The ABNF
- definition for 'phrase' from RFC 822 thus becomes:
-
- phrase = 1*( encoded-word / word )
-
- In this case the set of characters that may be used in a "Q"-encoded
- 'encoded-word' is restricted to: <upper and lower case ASCII
- letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_"
- (underscore, ASCII 95.)>. An 'encoded-word' that appears within a
- 'phrase' MUST be separated from any adjacent 'word', 'text' or
- 'special' by 'linear-white-space'.
-
-
-
-
-
-
-Moore Standards Track [Page 7]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- These are the ONLY locations where an 'encoded-word' may appear. In
- particular:
-
- + An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'.
-
- + An 'encoded-word' MUST NOT appear within a 'quoted-string'.
-
- + An 'encoded-word' MUST NOT be used in a Received header field.
-
- + An 'encoded-word' MUST NOT be used in parameter of a MIME
- Content-Type or Content-Disposition field, or in any structured
- field body except within a 'comment' or 'phrase'.
-
- The 'encoded-text' in an 'encoded-word' must be self-contained;
- 'encoded-text' MUST NOT be continued from one 'encoded-word' to
- another. This implies that the 'encoded-text' portion of a "B"
- 'encoded-word' will be a multiple of 4 characters long; for a "Q"
- 'encoded-word', any "=" character that appears in the 'encoded-text'
- portion will be followed by two hexadecimal characters.
-
- Each 'encoded-word' MUST encode an integral number of octets. The
- 'encoded-text' in each 'encoded-word' must be well-formed according
- to the encoding specified; the 'encoded-text' may not be continued in
- the next 'encoded-word'. (For example, "=?charset?Q?=?=
- =?charset?Q?AB?=" would be illegal, because the two hex digits "AB"
- must follow the "=" in the same 'encoded-word'.)
-
- Each 'encoded-word' MUST represent an integral number of characters.
- A multi-octet character may not be split across adjacent 'encoded-
- word's.
-
- Only printable and white space character data should be encoded using
- this scheme. However, since these encoding schemes allow the
- encoding of arbitrary octet values, mail readers that implement this
- decoding should also ensure that display of the decoded data on the
- recipient's terminal will not cause unwanted side-effects.
-
- Use of these methods to encode non-textual data (e.g., pictures or
- sounds) is not defined by this memo. Use of 'encoded-word's to
- represent strings of purely ASCII characters is allowed, but
- discouraged. In rare cases it may be necessary to encode ordinary
- text that looks like an 'encoded-word'.
-
-
-
-
-
-
-
-
-
-Moore Standards Track [Page 8]
-
-RFC 2047 Message Header Extensions November 1996
-
-
-6. Support of 'encoded-word's by mail readers
-
-6.1. Recognition of 'encoded-word's in message headers
-
- A mail reader must parse the message and body part headers according
- to the rules in RFC 822 to correctly recognize 'encoded-word's.
-
- 'encoded-word's are to be recognized as follows:
-
- (1) Any message or body part header field defined as '*text', or any
- user-defined header field, should be parsed as follows: Beginning
- at the start of the field-body and immediately following each
- occurrence of 'linear-white-space', each sequence of up to 75
- printable characters (not containing any 'linear-white-space')
- should be examined to see if it is an 'encoded-word' according to
- the syntax rules in section 2. Any other sequence of printable
- characters should be treated as ordinary ASCII text.
-
- (2) Any header field not defined as '*text' should be parsed
- according to the syntax rules for that header field. However,
- any 'word' that appears within a 'phrase' should be treated as an
- 'encoded-word' if it meets the syntax rules in section 2.
- Otherwise it should be treated as an ordinary 'word'.
-
- (3) Within a 'comment', any sequence of up to 75 printable characters
- (not containing 'linear-white-space'), that meets the syntax
- rules in section 2, should be treated as an 'encoded-word'.
- Otherwise it should be treated as normal comment text.
-
- (4) A MIME-Version header field is NOT required to be present for
- 'encoded-word's to be interpreted according to this
- specification. One reason for this is that the mail reader is
- not expected to parse the entire message header before displaying
- lines that may contain 'encoded-word's.
-
-6.2. Display of 'encoded-word's
-
- Any 'encoded-word's so recognized are decoded, and if possible, the
- resulting unencoded text is displayed in the original character set.
-
- NOTE: Decoding and display of encoded-words occurs *after* a
- structured field body is parsed into tokens. It is therefore
- possible to hide 'special' characters in encoded-words which, when
- displayed, will be indistinguishable from 'special' characters in the
- surrounding text. For this and other reasons, it is NOT generally
- possible to translate a message header containing 'encoded-word's to
- an unencoded form which can be parsed by an RFC 822 mail reader.
-
-
-
-
-Moore Standards Track [Page 9]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- When displaying a particular header field that contains multiple
- 'encoded-word's, any 'linear-white-space' that separates a pair of
- adjacent 'encoded-word's is ignored. (This is to allow the use of
- multiple 'encoded-word's to represent long strings of unencoded text,
- without having to separate 'encoded-word's where spaces occur in the
- unencoded text.)
-
- In the event other encodings are defined in the future, and the mail
- reader does not support the encoding used, it may either (a) display
- the 'encoded-word' as ordinary text, or (b) substitute an appropriate
- message indicating that the text could not be decoded.
-
- If the mail reader does not support the character set used, it may
- (a) display the 'encoded-word' as ordinary text (i.e., as it appears
- in the header), (b) make a "best effort" to display using such
- characters as are available, or (c) substitute an appropriate message
- indicating that the decoded text could not be displayed.
-
- If the character set being used employs code-switching techniques,
- display of the encoded text implicitly begins in "ASCII mode". In
- addition, the mail reader must ensure that the output device is once
- again in "ASCII mode" after the 'encoded-word' is displayed.
-
-6.3. Mail reader handling of incorrectly formed 'encoded-word's
-
- It is possible that an 'encoded-word' that is legal according to the
- syntax defined in section 2, is incorrectly formed according to the
- rules for the encoding being used. For example:
-
- (1) An 'encoded-word' which contains characters which are not legal
- for a particular encoding (for example, a "-" in the "B"
- encoding, or a SPACE or HTAB in either the "B" or "Q" encoding),
- is incorrectly formed.
-
- (2) Any 'encoded-word' which encodes a non-integral number of
- characters or octets is incorrectly formed.
-
- A mail reader need not attempt to display the text associated with an
- 'encoded-word' that is incorrectly formed. However, a mail reader
- MUST NOT prevent the display or handling of a message because an
- 'encoded-word' is incorrectly formed.
-
-7. Conformance
-
- A mail composing program claiming compliance with this specification
- MUST ensure that any string of non-white-space printable ASCII
- characters within a '*text' or '*ctext' that begins with "=?" and
- ends with "?=" be a valid 'encoded-word'. ("begins" means: at the
-
-
-
-Moore Standards Track [Page 10]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- start of the field-body, immediately following 'linear-white-space',
- or immediately following a "(" for an 'encoded-word' within '*ctext';
- "ends" means: at the end of the field-body, immediately preceding
- 'linear-white-space', or immediately preceding a ")" for an
- 'encoded-word' within '*ctext'.) In addition, any 'word' within a
- 'phrase' that begins with "=?" and ends with "?=" must be a valid
- 'encoded-word'.
-
- A mail reading program claiming compliance with this specification
- must be able to distinguish 'encoded-word's from 'text', 'ctext', or
- 'word's, according to the rules in section 6, anytime they appear in
- appropriate places in message headers. It must support both the "B"
- and "Q" encodings for any character set which it supports. The
- program must be able to display the unencoded text if the character
- set is "US-ASCII". For the ISO-8859-* character sets, the mail
- reading program must at least be able to display the characters which
- are also in the ASCII set.
-
-8. Examples
-
- The following are examples of message headers containing 'encoded-
- word's:
-
- From: =?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>
- To: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>
- CC: =?ISO-8859-1?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be>
- Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
- =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=
-
- Note: In the first 'encoded-word' of the Subject field above, the
- last "=" at the end of the 'encoded-text' is necessary because each
- 'encoded-word' must be self-contained (the "=" character completes a
- group of 4 base64 characters representing 2 octets). An additional
- octet could have been encoded in the first 'encoded-word' (so that
- the encoded-word would contain an exact multiple of 3 encoded
- octets), except that the second 'encoded-word' uses a different
- 'charset' than the first one.
-
- From: =?ISO-8859-1?Q?Olle_J=E4rnefors?= <ojarnef@admin.kth.se>
- To: ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se
- Subject: Time for ISO 10646?
-
- To: Dave Crocker <dcrocker@mordor.stanford.edu>
- Cc: ietf-822@dimacs.rutgers.edu, paf@comsol.se
- From: =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <paf@nada.kth.se>
- Subject: Re: RFC-HDR care and feeding
-
-
-
-
-
-Moore Standards Track [Page 11]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- From: Nathaniel Borenstein <nsb@thumper.bellcore.com>
- (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)
- To: Greg Vaudreuil <gvaudre@NRI.Reston.VA.US>, Ned Freed
- <ned@innosoft.com>, Keith Moore <moore@cs.utk.edu>
- Subject: Test of new header generator
- MIME-Version: 1.0
- Content-type: text/plain; charset=ISO-8859-1
-
- The following examples illustrate how text containing 'encoded-word's
- which appear in a structured field body. The rules are slightly
- different for fields defined as '*text' because "(" and ")" are not
- recognized as 'comment' delimiters. [Section 5, paragraph (1)].
-
- In each of the following examples, if the same sequence were to occur
- in a '*text' field, the "displayed as" form would NOT be treated as
- encoded words, but be identical to the "encoded form". This is
- because each of the encoded-words in the following examples is
- adjacent to a "(" or ")" character.
-
- encoded form displayed as
- ---------------------------------------------------------------------
- (=?ISO-8859-1?Q?a?=) (a)
-
- (=?ISO-8859-1?Q?a?= b) (a b)
-
- Within a 'comment', white space MUST appear between an
- 'encoded-word' and surrounding text. [Section 5,
- paragraph (2)]. However, white space is not needed between
- the initial "(" that begins the 'comment', and the
- 'encoded-word'.
-
-
- (=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=) (ab)
-
- White space between adjacent 'encoded-word's is not
- displayed.
-
- (=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=) (ab)
-
- Even multiple SPACEs between 'encoded-word's are ignored
- for the purpose of display.
-
- (=?ISO-8859-1?Q?a?= (ab)
- =?ISO-8859-1?Q?b?=)
-
- Any amount of linear-space-white between 'encoded-word's,
- even if it includes a CRLF followed by one or more SPACEs,
- is ignored for the purposes of display.
-
-
-
-Moore Standards Track [Page 12]
-
-RFC 2047 Message Header Extensions November 1996
-
-
- (=?ISO-8859-1?Q?a_b?=) (a b)
-
- In order to cause a SPACE to be displayed within a portion
- of encoded text, the SPACE MUST be encoded as part of the
- 'encoded-word'.
-
- (=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=) (a b)
-
- In order to cause a SPACE to be displayed between two strings
- of encoded text, the SPACE MAY be encoded as part of one of
- the 'encoded-word's.
-
-9. References
-
- [RFC 822] Crocker, D., "Standard for the Format of ARPA Internet Text
- Messages", STD 11, RFC 822, UDEL, August 1982.
-
- [RFC 2049] Borenstein, N., and N. Freed, "Multipurpose Internet Mail
- Extensions (MIME) Part Five: Conformance Criteria and Examples",
- RFC 2049, November 1996.
-
- [RFC 2045] Borenstein, N., and N. Freed, "Multipurpose Internet Mail
- Extensions (MIME) Part One: Format of Internet Message Bodies",
- RFC 2045, November 1996.
-
- [RFC 2046] Borenstein N., and N. Freed, "Multipurpose Internet Mail
- Extensions (MIME) Part Two: Media Types", RFC 2046,
- November 1996.
-
- [RFC 2048] Freed, N., Klensin, J., and J. Postel, "Multipurpose
- Internet Mail Extensions (MIME) Part Four: Registration
- Procedures", RFC 2048, November 1996.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Moore Standards Track [Page 13]
-
-RFC 2047 Message Header Extensions November 1996
-
-
-10. Security Considerations
-
- Security issues are not discussed in this memo.
-
-11. Acknowledgements
-
- The author wishes to thank Nathaniel Borenstein, Issac Chan, Lutz
- Donnerhacke, Paul Eggert, Ned Freed, Andreas M. Kirchwitz, Olle
- Jarnefors, Mike Rosin, Yutaka Sato, Bart Schaefer, and Kazuhiko
- Yamamoto, for their helpful advice, insightful comments, and
- illuminating questions in response to earlier versions of this
- specification.
-
-12. Author's Address
-
- Keith Moore
- University of Tennessee
- 107 Ayres Hall
- Knoxville TN 37996-1301
-
- EMail: moore@cs.utk.edu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Moore Standards Track [Page 14]
-
-RFC 2047 Message Header Extensions November 1996
-
-
-Appendix - changes since RFC 1522 (in no particular order)
-
- + explicitly state that the MIME-Version is not requried to use
- 'encoded-word's.
-
- + add explicit note that SPACEs and TABs are not allowed within
- 'encoded-word's, explaining that an 'encoded-word' must look like an
- 'atom' to an RFC822 parser.values, to be precise).
-
- + add examples from Olle Jarnefors (thanks!) which illustrate how
- encoded-words with adjacent linear-white-space are displayed.
-
- + explicitly list terms defined in RFC822 and referenced in this memo
-
- + fix transcription typos that caused one or two lines and a couple of
- characters to disappear in the resulting text, due to nroff quirks.
-
- + clarify that encoded-words are allowed in '*text' fields in both
- RFC822 headers and MIME body part headers, but NOT as parameter
- values.
-
- + clarify the requirement to switch back to ASCII within the encoded
- portion of an 'encoded-word', for any charset that uses code switching
- sequences.
-
- + add a note about 'encoded-word's being delimited by "(" and ")"
- within a comment, but not in a *text (how bizarre!).
-
- + fix the Andre Pirard example to get rid of the trailing "_" after
- the =E9. (no longer needed post-1342).
-
- + clarification: an 'encoded-word' may appear immediately following
- the initial "(" or immediately before the final ")" that delimits a
- comment, not just adjacent to "(" and ")" *within* *ctext.
-
- + add a note to explain that a "B" 'encoded-word' will always have a
- multiple of 4 characters in the 'encoded-text' portion.
-
- + add note about the "=" in the examples
-
- + note that processing of 'encoded-word's occurs *after* parsing, and
- some of the implications thereof.
-
- + explicitly state that you can't expect to translate between
- 1522 and either vanilla 822 or so-called "8-bit headers".
-
- + explicitly state that 'encoded-word's are not valid within a
- 'quoted-string'.
-
-
-
-Moore Standards Track [Page 15]
-
diff --git a/addressbook/backend/ebook/docs/rfc2425.txt b/addressbook/backend/ebook/docs/rfc2425.txt
deleted file mode 100644
index 30fed9bc07..0000000000
--- a/addressbook/backend/ebook/docs/rfc2425.txt
+++ /dev/null
@@ -1,1851 +0,0 @@
-
-
-
-
-
-
-Network Working Group T. Howes
-Request for Comments: 2425 M. Smith
-Category: Standards Track Netscape Communications Corp.
- F. Dawson
- Lotus Development Corporation
- September 1998
-
-
- A MIME Content-Type for Directory Information
-
-Status of this Memo
-
- This document specifies an Internet standards track protocol for the
- Internet community, and requests discussion and suggestions for
- improvements. Please refer to the current edition of the "Internet
- Official Protocol Standards" (STD 1) for the standardization state
- and status of this protocol. Distribution of this memo is unlimited.
-
-Copyright Notice
-
- Copyright (C) The Internet Society (1998). All Rights Reserved.
-
-1. Abstract
-
- This document defines a MIME Content-Type for holding directory
- information. The definition is independent of any particular
- directory service or protocol. The text/directory Content-Type is
- defined for holding a variety of directory information, for example,
- name, or email address, or logo. The text/directory Content-Type can
- also be used as the root body part in a multipart/related Content-
- Type for handling more complicated situations, especially those in
- which non-textual information that already has a natural MIME
- representation, for example, a photograph or sound, is to be
- represented.
-
- The text/directory Content-Type defines a general framework and
- format for holding directory information in a simple "type:value"
- form. We refer to "type" in this context meaning a property or
- attribute with which the value is associated. Mechanisms are defined
- to specify alternate languages, encodings and other meta-information.
- This document also defines the procedure by which particular formats,
- called profiles, for carrying application-specific information within
- a text/directory Content-Type can be defined and registered, and the
- conventions such formats must follow. It is expected that other
- documents will be produced that define such formats for various
- applications (e.g., white pages).
-
-
-
-
-
-Howes, et. al. Standards Track [Page 1]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY" and "OPTIONAL" in this
- document are to be interpreted as described in [RFC-2119].
-
-2. Table of Contents
-
- Status of the Memo................................................ 1
- Copyright Notice.................................................. 1
- 1. Abstract...................................................... 1
- 2. Table of Contents............................................. 2
- 3. Need for a MIME Directory Type................................ 3
- 4. Overview...................................................... 4
- 5. The text/directory Content-Type............................... 4
- 5.1. MIME media type name........................................ 4
- 5.2. MIME subtype name........................................... 5
- 5.3. Required parameters......................................... 5
- 5.4. Optional parameters......................................... 5
- 5.5. Encoding considerations..................................... 5
- 5.6. Security considerations..................................... 6
- 5.7. Interoperability considerations............................. 6
- 5.8. Published specification..................................... 6
- 5.8.1. Line delimiting and folding............................... 6
- 5.8.2. ABNF content-type definition.............................. 7
- 5.8.3. Pre-defined Parameters.................................... 9
- 5.8.4. Pre-defined Value Types...................................11
- 5.9. Applications which use this media type......................14
- 5.10. Additional information.....................................14
- 5.11. Person & email address to contact for further information..14
- 5.12. Intended usage.............................................14
- 5.13. Author/Change controller...................................15
- 6. Predefined Types..............................................15
- 6.1. SOURCE Type Definition......................................15
- 6.2. NAME Type Definition........................................16
- 6.3. PROFILE Type Definition.....................................16
- 6.4. BEGIN Type Definition.......................................17
- 6.5. END Type Definition.........................................17
- 7. Use of the multipart/related Content-Type.....................18
- 8. Examples.......................................................18
- 8.1. Example 1...................................................19
- 8.2. Example 2...................................................19
- 8.3. Example 3...................................................20
- 8.4. Example 4...................................................21
- 9. Registration of new profiles..................................22
- 9.1. Define the profile..........................................22
- 9.2. Post the profile definition.................................23
- 9.3. Allow a comment period......................................23
- 9.4. Submit the profile for approval.............................23
- 10. Profile Change Control.......................................23
-
-
-
-Howes, et. al. Standards Track [Page 2]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- 11. Registration of new types....................................24
- 11.1. Define the type............................................24
- 11.2. Post the type definition...................................25
- 11.3. Allow a comment period.....................................25
- 11.4. Submit the type for approval...............................25
- 12. Type Change Control..........................................25
- 13. Registration of new parameters...............................26
- 13.1. Define the parameter.......................................26
- 13.2. Post the parameter definition..............................27
- 13.3. Allow a comment period.....................................27
- 13.4. Submit the parameter for approval..........................27
- 14. Parameter Change Control.....................................28
- 15. Registration of new value types..............................28
- 15.1. Define the value type......................................28
- 15.2. Post the value type definition.............................29
- 15.3. Allow a comment period.....................................29
- 15.4. Submit the value type for approval.........................29
- 16. Security Considerations......................................30
- 17. Acknowledgements..............................................30
- 18. References....................................................30
- 19. Authors' Addresses...........................................32
- 20. Full Copyright Statement......................................33
-
-3. Need for a MIME Directory Type
-
- For purposes of this document, a directory is a special-purpose
- database that contains typed information. A directory usually
- supports both read and search of the information it contains, and can
- support creation and modification of the information as well.
- Directory information is usually accessed far more often than it is
- updated. Directories can be local or global in scope. They can be
- distributed or centralized. The information they contain can be
- replicated, with weak or strong consistency requirements.
-
- There are several situations in which users of Internet mail might
- wish to exchange directory information: the email analogy of a
- "business card" exchange; the conveyance of directory information to
- a user having only email access to the Internet; the provision of
- machine-parseable address information when purchasing goods or
- services over the Internet; etc. As MIME [RFC-2045, RFC-2046] is
- used increasingly by other protocols, most notably HTTP, it can also
- be useful for these protocols to carry directory information in MIME
- format. Such a format, for example, could be used to represent URC
- (uniform resource characteristics) information about resources on the
- World Wide Web, or to provide a rudimentary directory service over
- HTTP.
-
-
-
-
-
-Howes, et. al. Standards Track [Page 3]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-4. Overview
-
- The scheme defined here for representing directory information in a
- MIME Content-Type has two parts. First, the text/directory Content-
- Type is defined for use in holding directory information within a
- single body part, for example name, title, or email address. In its
- simplest form, the format uses a "type:value" approach, which should
- be easily parseable by existing MIME implementations and
- understandable by users. More complicated situations can be
- represented also. This document defines the general form the
- information in the Content-Type should have, and the procedure by
- which specific types and values (properties) for particular
- applications can be defined. The framework is general enough to
- handle information from any number of end directory services,
- including LDAP [RFC-1777, RFC-1778], WHOIS++ [RFC-1835], and X.500
- [X500].
-
- Directory entries can include far more than just textual information.
- Some such information (e.g., an image or sound) overlaps with
- predefined MIME Content-Types. In these cases it can be desirable to
- include the information in its well-known MIME format. This situation
- is handled by using a multipart/related Content-Type as defined in
- [RFC-2112]. The root component of this type is a text/directory body
- part specifying any in-line information, and for information
- contained in other Content-Types, the Content-IDs (in URI form) of
- those parts.
-
- In some applications, it can be useful to include a pointer (e.g, a
- URI) to some directory information rather than the information
- itself. This document defines a general mechanism for accomplishing
- this.
-
-5. The text/directory Content-Type
-
- The text/directory Content-Type is used to hold basic directory
- information and URIs referencing other information, including other
- MIME body parts holding supplementary or non-textual directory
- information, such as an image or sound. It is defined as follows,
- using the MIME media type registration template from [RFC-2048].
-
- To: ietf-types@uninett.no
- Subject: Registration of MIME media type text/directory
-
-5.1. MIME media type name
-
- MIME media type name: text
-
-
-
-
-
-Howes, et. al. Standards Track [Page 4]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-5.2. MIME subtype name
-
- MIME subtype name: directory
-
-5.3. Required parameters
-
- Required parameters: charset
-
- The "charset" parameter is as defined in [RFC-2046] for other body
- parts. It is used to identify the default character set used within
- the body part.
-
-5.4. Optional parameters
-
- Optional parameters: profile
-
- The "profile" parameter is used to convey the type(s) of entity(ies)
- to which the directory information pertains and the likely set of
- information associated with the entity(ies). It is intended only as a
- guide to applications interpreting the information contained within
- the body part. It SHOULD NOT be used to exclude or require particular
- pieces of information unless a profile definition specifically calls
- for this behavior. Unless specifically forbidden by a particular
- profile definition, a text/directory content type can contain
- arbitrary attribute/value pairs.
-
- The value of the "profile" parameter is defined as follows. Profile
- names are case insensitive (i.e., the profile name "vCard" is the
- same as "VCARD" and "vcard" and "vcArD").
-
- profile = x-name / iana-token
-
- x-name = "x-" 1*(ALPHA / DIGIT / "-")
- ; Names beginning with "x-" or "X-" are
- ; reserved for experimental use not intended for released
- ; products, or for use in bilateral agreements.
-
- iana-token = <a publicly-defined extension token, registered
- with IANA, as specified in Section 9 of this
- document>
-
-5.5. Encoding considerations
-
- The default encoding is 8bit. Otherwise, as specified by the
- Content-Transfer-Encoding header field.
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 5]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-5.6. Security considerations
-
- Directory information can be public or it can be protected from
- unauthorized access by the directory service in which it resides.
- Once the information leaves its native service, there can be no
- guarantee that the same care will be taken by all services handling
- the information. Furthermore, this specification defines no access
- control mechanism by which information can be protected, or by which
- access control information can be conveyed. Note that the integrity
- and privacy of a text/directory body part can be protected by
- enclosing it within an appropriate MIME-based security mechanism.
-
-5.7. Interoperability considerations
-
- In order to make sense of directory information, applications must
- share a common understanding of the types of information contained
- within the Content-Type (the directory schema). This schema
- information is not defined in this document, but rather in companion
- documents (e.g., [MIME-VCARD]) that follow the requirements specified
- in this document, or in bilateral agreements between communicating
- parties.
-
-5.8. Published specification
-
- The text/directory Content-Type contains directory information,
- typically pertaining to a single directory entity or group of
- entities. The content consists of one or more lines in the format
- given below.
-
-5.8.1. Line delimiting and folding
-
- Individual lines within the MIME text/directory Content Type body are
- delimited by the [RFC-822] line break, which is a CRLF sequence
- (ASCII decimal 13, followed by ASCII decimal 10). Long logical lines
- of text can be split into a multiple-physical-line representation
- using the following folding technique.
-
- A logical line MAY be continued on the next physical line anywhere
- between two characters by inserting a CRLF immediately followed by a
- single white space character (space, ASCII decimal 32, or horizontal
- tab, ASCII decimal 9). At least one character must be present on the
- folded line. Any sequence of CRLF followed immediately by a single
- white space character is ignored (removed) when processing the
- content type. For example the line:
-
- DESCRIPTION:This is a long description that exists on a long line.
-
- Can be represented as:
-
-
-
-Howes, et. al. Standards Track [Page 6]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- DESCRIPTION:This is a long description
- that exists on a long line.
-
- It could also be represented as:
-
- DESCRIPTION:This is a long descrip
- tion that exists o
- n a long line.
-
- The process of moving from this folded multiple-line representation
- of a type definition to its single line representation is called
- unfolding. Unfolding is accomplished by regarding CRLF immediately
- followed by a white space character (namely HTAB ASCII decimal 9 or
- SPACE ASCII decimal 32) as equivalent to no characters at all (i.e.,
- the CRLF and single white space character are removed).
-
-5.8.2. ABNF content-type definition
-
- The following ABNF uses the notation of RFC 2234, which also defines
- CRLF, WSP, DQUOTE, VCHAR, ALPHA, and DIGIT. After the unfolding of
- any folded lines as described above, the syntax for a line of this
- content type is as follows:
-
- contentline = [group "."] name *(";" param) ":" value CRLF
- ; When parsing a content line, folded lines MUST first
- ; be unfolded according to the unfolding procedure
- ; described above.
- ; When generating a content line, lines longer than 75
- ; characters SHOULD be folded according to the folding
- ; procedure described above.
-
- group = 1*(ALPHA / DIGIT / "-")
-
- name = x-name / iana-token
-
- iana-token = 1*(ALPHA / DIGIT / "-")
- ; identifier registered with IANA
-
- x-name = "x-" 1*(ALPHA / DIGIT / "-")
- ; Names that begin with "x-" or "X-" are
- ; reserved for experimental use, not intended for released
- ; products, or for use in bilateral agreements.
-
- param = param-name "=" param-value *("," param-value)
-
- param-name = x-name / iana-token
-
- param-value = ptext / quoted-string
-
-
-
-Howes, et. al. Standards Track [Page 7]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- ptext = *SAFE-CHAR
-
- value = *VALUE-CHAR
- / valuespec ; valuespec defined in section 5.8.4
-
- quoted-string = DQUOTE *QSAFE-CHAR DQUOTE
-
- NON-ASCII = %x80-FF
- ; use restricted by charset parameter
- ; on outer MIME object (UTF-8 preferred)
-
- QSAFE-CHAR = WSP / %x21 / %x23-7E / NON-ASCII
- ; Any character except CTLs, DQUOTE
-
- SAFE-CHAR = WSP / %x21 / %x23-2B / %x2D-39 / %x3C-7E / NON-ASCII
- ; Any character except CTLs, DQUOTE, ";", ":", ","
-
- VALUE-CHAR = WSP / VCHAR / NON-ASCII
- ; any textual character
-
- A line that begins with a white space character is a continuation of
- the previous line, as described above. The white space character and
- immediately preceeding CRLF should be discarded when reconstructing
- the original line. Note that this line-folding convention differs
- from that found in RFC 822, in that the sequence <CRLF><WSP> found
- anywhere in the content indicates a continued line and should be
- removed.
-
- Various type names and the format of the corresponding values are
- defined as specified in Section 11. Specifications MAY impose
- ordering on the type constructs within a body part, though none is
- required by default. The various x-name constructs are used for
- bilaterally-agreed upon type names, parameter names and parameter
- values, or for use in experimental settings.
-
- Type names and parameter names are case insensitive (e.g., the type
- name "fn" is the same as "FN" and "Fn"). Parameter values MAY be case
- sensitive or case insensitive, depending on their definition.
-
- The group construct is used to group related attributes together.
- The group name is a syntactic convention used to indicate that all
- type names prefaced with the same group name SHOULD be grouped
- together when displayed by an application. It has no other
- significance. Implementations that do not understand or support
- grouping MAY simply strip off any text before a "." to the left of
- the type name and present the types and values as normal.
-
-
-
-
-
-Howes, et. al. Standards Track [Page 8]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- Each attribute defined in the text/directory body MAY have multiple
- values, if allowed in the definition of the profile in which the
- attribute is used. The general rule for encoding multi-valued items
- is to simply create a new content line for each value (including the
- type name). However, it should be noted that some value types
- support encoding multiple values in a single content line by
- separating the values with a comma ",". This approach has been taken
- for several of the content types defined below (date, time, integer,
- float), for space-saving reasons.
-
-5.8.3. Pre-defined Parameters
-
- The following parameters and value types are defined for general use.
-
- predefined-param = encodingparm
- / valuetypeparm
- / languageparm
- / contextparm
-
- encodingparm = "encoding" "=" encodingtype
-
- encodingtype = "b" ; from RFC 2047
- / iana-token ; registered as described in
- ; section 15 of this document
-
- valuetypeparm = "value" "=" valuetype
-
- valuetype = "uri" ; genericurl from secion 5 of RFC 1738
- / "text"
- / "date"
- / "time"
- / "date-time" ; date time
- / "integer"
- / "boolean"
- / "float"
- / x-name
- / iana-token ; registered as described in
- ; section 15 of this document
-
- languageparm = "language" "=" Language-Tag
- ; Language-Tag is defined in section 2 of RFC 1766
-
- contextparm = "context" "=" context
-
- context = x-name
- / iana-token
-
-
-
-
-
-Howes, et. al. Standards Track [Page 9]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- The "language" type parameter is used to identify data in multiple
- languages. There is no concept of "default" language, except as
- specified by any "Content-Language" MIME header parameter that is
- present. The value of the "language" type parameter is a language
- tag as defined in Section 2 of [RFC-1766].
-
- The "context" type parameter is used to identify a context (e.g., a
- protocol) used in interpreting the value. This is used, for example,
- in the "source" type, defined below.
-
- The "encoding" type parameter is used to specify an alternate
- encoding for a value. If the value contains a CRLF, it must be
- encoded, since CRLF is used to separate lines in the content-type
- itself. Currently, only the "b" encoding is supported.
-
- The "b" encoding can also be useful for binary values that are mixed
- with other text information in the body part (e.g., a certificate).
- Using a per-value "b" encoding in this case leaves the other
- information in a more readable form. The encoded base 64 value can be
- split across multiple physical lines in the content type by using the
- line folding technique described above.
-
- The Content-Transfer-Encoding header field is used to specify the
- encoding used for the body part as a whole. The "encoding" type
- parameter is used to specify an encoding for a particular value
- (e.g., a certificate). In this case, the Content-Transfer-Encoding
- header might specify "8bit", while the one certificate value might
- specify an encoding of "b" via an "encoding=b" type parameter.
-
- The Content-Transfer-Encoding and the encodings of individual types
- given by the "encoding" type parameter are independent of one
- another. When encoding a text/directory body part for transmission,
- individual type encodings are performed first, then the entire body
- part is encoded according to the Content-Transfer-Encoding. When
- decoding a text/directory body part, the Content-Transfer-Encoding is
- decoded first, and then any individual types with an "encoding" type
- parameter are decoded.
-
- The "value" parameter is optional, and is used to identify the value
- type (data type) and format of the value. The use of these
- predefined formats is encouraged even if the value parameter is not
- explicity used. By defining a standard set of value types and their
- formats, existing parsing and processing code can be leveraged.
-
- Including the value type explicitly as part of each property provides
- an extra hint to keep parsing simple and support more generalized
- applications. For example a search engine would not have to know the
- particular value types for all of the items for which it is
-
-
-
-Howes, et. al. Standards Track [Page 10]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- searching. Because the value type is explicit in the definition, the
- search engine could look for dates in any item type and provide
- results that can still be interpreted.
-
-5.8.4. Pre-defined Value Types
-
- The format for values corresponding to the predefined valuetype
- specifications given above are defined.
-
- valuespec = text-list
- / genericurl ; from section 5 of RFC 1738
- / date-list
- / time-list
- / date-time-list
- / boolean
- / integer-list
- / float-list
- / iana-valuespec
-
- text-list = *TEXT-LIST-CHAR *("," *TEXT-LIST-CHAR)
-
- TEXT-LIST-CHAR = "\\" / "\," / "\n"
- / <any VALUE-CHAR except , or \ or newline>
- ; Backslashes, newlines, and commas must be encoded.
- ; \n or \N can be used to encode a newline.
-
- date-list = date *("," date)
-
- time-list = time *("," time)
-
- date-time-list = date "T" time *("," date "T" time)
-
- boolean = "TRUE" / "FALSE"
-
- integer-list = integer *("," integer)
-
- integer = [sign] 1*DIGIT
-
- float-list = float *("," float)
-
- float = [sign] 1*DIGIT ["." 1*DIGIT]
-
- sign = "+" / "-"
-
- date = date-fullyear ["-"] date-month ["-"] date-mday
-
- date-fullyear = 4 DIGIT
-
-
-
-
-Howes, et. al. Standards Track [Page 11]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- date-month = 2 DIGIT ;01-12
-
- date-mday = 2 DIGIT ;01-28, 01-29, 01-30, 01-31
- ;based on month/year
-
- time = time-hour [":"] time-minute [":"] time-second [time-secfrac]
- [time-zone]
-
- time-hour = 2 DIGIT ;00-23
-
- time-minute = 2 DIGIT ;00-59
-
- time-second = 2 DIGIT ;00-60 (leap second)
-
- time-secfrac = "," 1*DIGIT
-
- time-zone = "Z" / time-numzone
-
- time-numzome = sign time-hour [":"] time-minute
-
- iana-valuespec = <a publicly-defined valuetype format, registered
- with IANA, as defined in section 15 of this
- document>
-
- Some specific notes on the value types and formats:
-
- "text": The "text" value type should be used to identify values that
- contain human-readable text. The character set and language in which
- the text is represented is controlled by the charset content-header
- and the language type parameter and content-header.
-
- Examples for "text":
- this is a text value
- this is one value,this is another
- this is a single value\, with a comma encoded
-
- A formatted text line break in a text value type MUST be represented
- as the character sequence backslash (ASCII decimal 92) followed by a
- Latin small letter n (ASCII decimal 110) or a Latin capital letter N
- (ASCII decimal 78), that is "\n" or "\N".
-
- For example a multiple line DESCRIPTION value of:
-
- Mythical Manager
- Hyjinx Software Division
- BabsCo, Inc.
-
- could be represented as:
-
-
-
-Howes, et. al. Standards Track [Page 12]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- DESCRIPTION:Mythical Manager\nHyjinx Software Division\n
- BabsCo\, Inc.\n
-
- demonstrating the \n literal formatted line break technique, the
- CRLF-followed-by-space line folding technique, and the backslash
- escape technique.
-
- "uri": The "uri" value type should be used to identify values that
- are referenced by a URI (including a Content-ID URI), instead of
- encoded in-line. These value references might be used if the value is
- too large, or otherwise undesirable to include directly. The format
- for the URI is as defined in RFC 1738.
-
- Examples for "uri":
- http://www.foobar.com/my/picture.jpg
- ldap://ldap.foobar.com/cn=babs%20jensen
-
- "date", "time", and "date-time": Each of these value types is based
- on a subset of the definitions in ISO 8601 standard. Profiles MAY
- place further restrictions on "date" and "time" values. Multiple
- "date" and "time" values can be specified using the comma-separated
- notation, unless restricted by a profile.
-
- Examples for "date":
- 1985-04-12
- 1996-08-05,1996-11-11
- 19850412
-
- Examples for "time":
- 10:22:00
- 102200
- 10:22:00.33
- 10:22:00.33Z
- 10:22:33,11:22:00
- 10:22:00-08:00
-
- Examples for "date-time":
- 1996-10-22T14:00:00Z
- 1996-08-11T12:34:56Z
- 19960811T123456Z
- 1996-10-22T14:00:00Z,1996-08-11T12:34:56Z
-
- "boolean": The "boolean" value type is used to express boolen values.
- These values are case insensitive.
-
- Examples: TRUE
- false
- True
-
-
-
-Howes, et. al. Standards Track [Page 13]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- "integer": The "integer" value type is used to express signed
- integers in decimal format. If sign is not specified, the value is
- assumed positive "+". Multiple "integer" values can be specified
- using the comma-separated notation, unless restricted by a profile.
-
- Examples: 1234567890
- -1234556790
- +1234556790,432109876
-
- "float": The "float" value type is used to express real numbers. If
- sign is not specified, the value is assumed positive "+". Multiple
- "float" values can be specified using the comma-separated notation,
- unless restricted by a profile.
-
- Examples: 20.30
- 1000000.0000001
- 1.333,3.14
-
-5.9. Applications which use this media type
-
- Applications which use this media type: Various
-
-5.10. Additional information
-
- Additional information: None
-
-5.11. Person & email address to contact for further information
-
- Tim Howes
- Netscape Communications Corp.
- 501 East Middlefield Rd.
- Mountain View, CA 94041
- USA
- howes@netscape.com
- +1 415 937 3419
-
-5.12. Intended usage
-
- Intended usage: COMMON
-
-
-
-
-
-
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 14]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-5.13. Author/Change controller
-
- Tim Howes
- Netscape Communications Corp.
- 501 East Middlefield Rd.
- Mountain View, CA 94041
- USA
- howes@netscape.com
- +1 415 937 3419
-
- Mark Smith
- Netscape Communications Corp.
- 501 East Middlefield Rd.
- Mountain View, CA 94041
- USA
- mcs@netscape.com
- +1 415 937 3477
-
- Frank Dawson
- Lotus Development Corporation
- 6544 Battleford Drive
- Raleigh, NC 27613-3502
- USA
- frank_dawson@lotus.com
- +1-919-676-9515
-
-6. Predefined Types
-
- The following types are generally useful regardless of the profile
- being carried and are defined below using the text/directory MIME
- type registration template defined in Section 11.1 of this document.
- These types MAY be included in any profile, unless explicitly
- forbidden in the profile definition.
-
-6.1. SOURCE Type Definition
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME type SOURCE
-
- Type name: SOURCE
-
- Type purpose: To identify the source of directory information
- contained in the content type.
-
- Type encoding: 8bit
-
- Type valuetype: uri
-
-
-
-
-Howes, et. al. Standards Track [Page 15]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- Type special notes: The SOURCE type is used to provide the means by
- which applications knowledgable in the given directory service
- protocol can obtain additional or more up-to-date information from
- the directory service. It contains a URI as defined in [RFC-1738]
- and/or other information referencing the directory entity or entities
- to which the information pertains. When directory information is
- available from more than one source, the sending entity can pick what
- it considers to be the best source, or multiple SOURCE types can be
- included. The interpretation of the value for a SOURCE type can
- depend on the setting of the CONTEXT type parameter. The value of the
- CONTEXT type parameter MUST be compatible with the value of the uri
- prefix.
-
- Type example:
- SOURCE;CONTEXT=LDAP:ldap://ldap.host/cn=Babs%20Jensen,
- %20o=Babsco,%20c=US
-
-6.2. NAME Type Definition
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME type NAME
-
- Type name: NAME
-
- Type purpose: To identify the displayable name of the directory
- entity to which information in the content type pertains.
-
- Type encoding: 8bit
-
- Type valuetype: text
-
- Type special notes: The NAME type is used to convey the display name
- of the entity to which the directory information pertains.
-
- Type example:
- NAME:Babs Jensen's Contact Information
-
-6.3. PROFILE Type Definition
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME type PROFILE
-
- Type name: PROFILE
-
- Type purpose: To identify the type of directory entity to which
- information in the content type pertains.
-
- Type encoding: 8bit
-
-
-
-Howes, et. al. Standards Track [Page 16]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- Type valuetype: A profile name, registered as described in Section 9
- of this document or bilaterally agreed upon as described in Section
- 5.
-
- Type special notes: The PROFILE type is used to convey the type of
- the entity to which the directory information in the rest of the body
- part pertains. It should be the same as the "profile" header
- parameter, if present.
-
- Type example:
- PROFILE:vCard
-
-6.4. BEGIN Type Definition
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME type BEGIN
-
- Type name: BEGIN
-
- Type purpose: To denote the beginning of a syntactic entity within a
- text/directory content-type.
-
- Type encoding: 8bit
-
- Type valuetype: text, containing a profile name, registered as
- described in Section 9 of this document or bilaterally-agreed upon as
- described in Section 5.
-
- Type special notes: The BEGIN type is used in conjunction with the
- END type to delimit a profile containing a related set of properties
- within an text/directory content-type. This construct can be used
- instead of or in addition to wrapping separate sets of information
- inside additional MIME headers. It is provided for applications that
- wish to define content that can contain multiple entities within the
- same text/directory content-type or to define content that can be
- identifiable outside of a MIME environment.
-
- Type example:
- BEGIN:VCARD
-
-6.5. END Type Definition
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME type END
-
- Type name: END
-
-
-
-
-
-Howes, et. al. Standards Track [Page 17]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- Type purpose: To denote the end of a syntactic entity within a
- text/directory content-type.
-
- Type encoding: 8bit
-
- Type valuetype: text, containing a profile name, registered as
- described in Section 9 of this document or bilaterally-agreed upon as
- described in Section 5.
-
- Type special notes: The END type is used in conjunction with the
- BEGIN type to delimit a profile containing a related set of
- properties within an text/directory content-type. This construct can
- be used instead of or in addition to wrapping separate sets of
- information inside additional MIME headers. It is provided for
- applications that wish to define content that can contain multiple
- entities within the same text/directory content-type or to define
- content that can be identifiable outside of a MIME environment.
-
- Type example:
- END: VCARD
-
-7. Use of the multipart/related Content-Type
-
- The multipart/related Content-Type can be used to hold directory
- information comprised of both text and non-text information or
- directory information that already has a natural MIME representation.
- The root body part within the multipart/related body part is
- specified as defined in [RFC-2112] by a "start" parameter, or it is
- the first body part in the absence of such a parameter. The root
- body part must have a Content-Type of "text/directory". This part
- holds inline information and makes reference to subsequent body parts
- holding additional text or non-text directory information via their
- Content-ID URIs as explained in Section 5.
-
- The body parts referred to do not have to be in any particular order,
- except as noted above for the root body part.
-
-8. Examples
-
- The following examples are for illustrative purposes only and are not
- part of the definition.
-
-
-
-
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 18]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-8.1. Example 1
-
- The first example illustrates simple use of the text/directory
- Content-Type. Note that no "profile" parameter is given, so an
- application may not know what kind of directory entity the
- information applies to. Note also the use of both hypothetical
- official and bilaterally agreed upon types.
-
- From: Whomever@wherever.com
- To: Someone@somewhere.com
- Subject: whatever
- MIME-Version: 1.0
- Message-ID: <id1@host.net>
- Content-Type: text/directory
- Content-ID: <id2@host.com>
-
- cn:Babs Jensen
- cn:Barbara J Jensen
- sn:Jensen
- email:babs@umich.edu
- phone:+1 313 747-4454
- x-id:1234567890
-
-8.2. Example 2
-
- The next example illustrates the use of the Quoted-Printable transfer
- encoding defined in [RFC 2045] to include non-ASCII character in some
- of the information returned, and the use of the optional "name" and
- "source" types. It also illustrates the use of an "encoding" type
- parameter to encode a certificate value in "b". A "vCard" profile
- [MIME- VCARD] is used for the example.
-
-Content-Type: text/directory;
- charset="iso-8859-1";
- profile="vCard"
-Content-ID: <id3@host.com>
-Content-Transfer-Encoding: Quoted-Printable
-
-begin:VCARD
-source:ldap://cn=3Dbjorn%20Jensen, o=3Duniversity%20of%20Michigan, c=3DUS
-name:Bjorn Jensen
-fn:Bj=F8rn Jensen
-n:Jensen;Bj=F8rn
-email;type=3Dinternet:bjorn@umich.edu
-tel;type=3Dwork,voice,msg:+1 313 747-4454
-key;type=3Dx509;encoding=3DB:dGhpcyBjb3VsZCBiZSAKbXkgY2VydGlmaWNhdGUK
-end:VCARD
-
-
-
-
-Howes, et. al. Standards Track [Page 19]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-8.3. Example 3
-
- The next example illustrates the use of multi-valued type parameters,
- the "language" type parameter, the "value" type parameter, folding of
- long lines, the \n encoding for formatted lines, attribute grouping,
- and the inline "b" encoding. A "vCard" profile [MIME-VCARD] is used
- for the example.
-
-Content-Type: text/directory; profile="vcard"; charset=iso-8859-1
-Content-ID: <id3@host.com>
-Content-Transfer-Encoding: Quoted-Printable
-
-begin:vcard
-source:ldap://cn=3DMeister%20Berger,o=3DUniversitaet%20Goerlitz,c=3DDE
-name:Meister Berger
-fn:Meister Berger
-n:Berger;Meister
-bday;value=3Ddate:1963-09-21
-o:Universit=E6t G=F6rlitz
-title:Mayor
-title;language=3Dde;value=3Dtext:Burgermeister
-note:The Mayor of the great city of
- Goerlitz in the great country of Germany.
-email;internet:mb@goerlitz.de
-home.tel;type=3Dfax,voice,msg:+49 3581 123456
-home.label:Hufenshlagel 1234\n
- 02828 Goerlitz\n
- Deutschland
-key;type=3DX509;encoding=3Db:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQ
- AwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zI
- ENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0ZW1zMRwwGgYDVQQD
- ExNyb290Y2EubmV0c2NhcGUuY29tMB4XDTk3MDYwNjE5NDc1OVoXDTk3MTIwMzE5NDc
- 1OVowgYkxCzAJBgNVBAYTAlVTMSYwJAYDVQQKEx1OZXRzY2FwZSBDb21tdW5pY2F0aW
- 9ucyBDb3JwLjEYMBYGA1UEAxMPVGltb3RoeSBBIEhvd2VzMSEwHwYJKoZIhvcNAQkBF
- hJob3dlc0BuZXRzY2FwZS5jb20xFTATBgoJkiaJk/IsZAEBEwVob3dlczBcMA0GCSqG
- SIb3DQEBAQUAA0sAMEgCQQC0JZf6wkg8pLMXHHCUvMfL5H6zjSk4vTTXZpYyrdN2dXc
- oX49LKiOmgeJSzoiFKHtLOIboyludF90CgqcxtwKnAgMBAAGjNjA0MBEGCWCGSAGG+E
- IBAQQEAwIAoDAfBgNVHSMEGDAWgBT84FToB/GV3jr3mcau+hUMbsQukjANBgkqhkiG9
- w0BAQQFAAOBgQBexv7o7mi3PLXadkmNP9LcIPmx93HGp0Kgyx1jIVMyNgsemeAwBM+M
- SlhMfcpbTrONwNjZYW8vJDSoi//yrZlVt9bJbs7MNYZVsyF1unsqaln4/vy6Uawfg8V
- UMk1U7jt8LYpo4YULU7UZHPYVUaSgVttImOHZIKi4hlPXBOhcUQ=3D=3D
-end:vcard
-
-
-
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 20]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-8.4. Example 4
-
- The final example illustrates the use of the multipart/related
- Content-Type to include non-textual directory data via the "uri"
- encoding to refer to other body parts within the same message, or to
- external values. Note that no "profile" parameter is given, so an
- application may not know what kind of directory entity the
- information applies to. Note also the use of both hypothetical
- official and bilaterally agreed upon types.
-
-Content-Type: multipart/related;
- boundary=woof;
- type="text/directory";
- start="<id5@host.com>"
-Content-ID: <id4@host.com>
-
---woof
-Content-Type: text/directory; charset="iso-8859-1"
-Content-ID: <id5@host.com>
-Content-Transfer-Encoding: Quoted-Printable
-
-source:ldap://cn=3DBjorn%20Jensen,o=3DUniversity%20of%20Michigan,c=3DUS
-cn:Bj=F8rn Jensen
-sn:Jensen
-email:bjorn@umich.edu
-image;value=3Duri:cid:id6@host.com
-image;value=3Duri;format=3Djpeg:ftp://some.host/some/path.jpg
-sound;value=3Duri:cid:id7@host.com
-phone:+1 313 747-4454
-
---woof
-Content-Type: image/jpeg
-Content-ID: <id6@host.com>
-
-<...image data...>
-
---woof
-Content-Type: message/external-body;
- name="myvoice.au";
- site="myhost.com";
- access-type=ANON-FTP;
- directory="pub/myname";
- mode="image"
-
-Content-Type: audio/basic
-Content-ID: <id7@host.com>
-
---woof--
-
-
-
-Howes, et. al. Standards Track [Page 21]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-9. Registration of new profiles
-
- This section defines procedures by which new profiles are registered
- with the IANA and made available to the Internet community. Note that
- non-IANA profiles can be used by bilateral agreement, provided the
- associated profile names follow the "X-" convention defined above.
-
- The procedures defined here are designed to allow public comment and
- review of new profiles, while posing only a small impediment to the
- definition of new profiles.
-
- Registration of a new profile is accomplished by the following steps.
-
-9.1. Define the profile
-
- A profile is defined by completing the following template.
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME profile XXX
-
- Profile name:
-
- Profile purpose:
-
- Profile types:
-
- Profile special notes (optional):
-
- Intended usage: (one of COMMON, LIMITED USE or OBSOLETE)
-
- The explanation of what goes in each field in the template follows.
-
- Profile name: The name of the profile as it will appear in the
- text/directory MIME Content-Type "profile" header parameter, or the
- predefined "profile" type name.
-
- Profile purpose: The purpose of the profile (e.g., to represent
- information about people, printers, documents, etc.). Give a short
- but clear description.
-
- Profile types: The list of types associated with the profile. This
- list of types is to be expected but not required in the profile,
- unless otherwise noted in the profile definition. Other types not
- mentioned in the profile definition MAY also be present. Note that
- any new types referenced by the profile MUST be defined separately as
- described in Section 10.
-
-
-
-
-
-Howes, et. al. Standards Track [Page 22]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- Profile special notes: Any special notes about the profile, how it is
- to be used, etc. This section of the template can also be used to
- define an ordering on the types that appear in the Content-Type, if
- such an ordering is required.
-
-9.2. Post the profile definition
-
- The profile description must be posted to the new profile discussion
- list, ietf-mime-direct@imc.org
-
-9.3. Allow a comment period
-
- Discussion on the new profile must be allowed to take place on the
- list for a minimum of two weeks. Consensus must be reached on the
- profile before proceeding to step 4.
-
-9.4. Submit the profile for approval
-
- Once the two-week comment period has elapsed, and the proposer is
- convinced consensus has been reached on the profile, the registration
- application should be submitted to the Profile Reviewer for approval.
- The Profile Reviewer is appointed by the Application Area Directors
- and can either accept or reject the profile registration. An accepted
- registration is passed on by the Profile Reviewer to the IANA for
- inclusion in the official IANA profile registry. The registration may
- be rejected for any of the following reasons. 1) Insufficient comment
- period; 2) Consensus not reached; 3) Technical deficiencies raised on
- the list or elsewhere have not been addressed. The Profile Reviewer's
- decision to reject a profile can be appealed by the proposer to the
- IESG, or the objections raised can be addressed by the proposer and
- the profile resubmitted.
-
-10. Profile Change Control
-
- Existing profiles can be changed using the same process by which they
- were registered.
-
- Define the change
-
- Post the change
-
- Allow a comment period
-
- Submit the changed profile for approval
-
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 23]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- Note that the original author or any other interested party can
- propose a change to an existing profile, but that such changes should
- only be proposed when there are serious omissions or errors in the
- published specification. The Profile Reviewer can object to a change
- if it is not backwards compatible, but is not required to do so.
-
- Profile definitions can never be deleted from the IANA registry, but
- profiles which are no longer believed to be useful can be declared
- OBSOLETE by a change to their "intended use" field.
-
-11. Registration of new types
-
- This section defines procedures by which new types are registered
- with the IANA. Note that non-IANA types can be used by bilateral
- agreement, provided the associated types names follow the "X-"
- convention defined above.
-
- The procedures defined here are designed to allow public comment and
- review of new types, while posing only a small impediment to the
- definition of new types.
-
- Registration of a new type is accomplished by the following steps.
-
-11.1. Define the type
-
- A type is defined by completing the following template.
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME type XXX
-
- Type name:
-
- Type purpose:
-
- Type encoding:
-
- Type valuetype:
-
- Type special notes (optional):
-
- Intended usage: (one of COMMON, LIMITED USE or OBSOLETE)
-
- The meaning of each field in the template is as follows.
-
- Type name: The name of the type, as it will appear in the body of an
- text/directory MIME Content-Type "type: value" line to the left of
- the colon ":".
-
-
-
-
-Howes, et. al. Standards Track [Page 24]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- Type purpose: The purpose of the type (e.g., to represent a name,
- postal address, IP address, etc.). Give a short but clear
- description.
-
- Type encoding: The default encoding a value of the type must have in
- the body of a text/directory MIME Content-Type.
-
- Type valuetype: The format a value of the type must have in the body
- of a text/directory MIME Content-Type. This description must be
- precise and must not violate the general encoding rules defined in
- section 5 of this document.
-
- Type special notes: Any special notes about the type, how it is to be
- used, etc.
-
-11.2. Post the type definition
-
- The type description must be posted to the new type discussion list,
- ietf-mime-direct@imc.org
-
-11.3. Allow a comment period
-
- Discussion on the new type must be allowed to take place on the list
- for a minimum of two weeks. Consensus must be reached on the type
- before proceeding to step 4.
-
-11.4. Submit the type for approval
-
- Once the two-week comment period has elapsed, and the proposer is
- convinced consensus has been reached on the type, the registration
- application should be submitted to the Profile Reviewer for approval.
- The Profile Reviewer is appointed by the Application Area Directors
- and can either accept or reject the type registration. An accepted
- registration is passed on by the Profile Reviewer to the IANA for
- inclusion in the official IANA profile registry. The registration can
- be rejected for any of the following reasons. 1) Insufficient comment
- period; 2) Consensus not reached; 3) Technical deficiencies raised on
- the list or elsewhere have not been addressed. The Profile
- Reviewer's decision to reject a type can be appealed by the proposer
- to the IESG, or the objections raised can be addressed by the
- proposer and the type resubmitted.
-
-
-
-
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 25]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-12. Type Change Control
-
- Existing types can be changed using the same process by which they
- were registered.
-
- Define the change
-
- Post the change
-
- Allow a comment period
-
- Submit the type for approval
-
- Note that the original author or any other interested party can
- propose a change to an existing type, but that such changes should
- only be proposed when there are serious omissions or errors in the
- published specification. The Profile Reviewer can object to a change
- if it is not backwards compatible, but is not required to do so.
-
- Type definitions can never be deleted from the IANA registry, but
- types which are nolonger believed to be useful can be declared
- OBSOLETE by a change to their "intended use" field.
-
-13. Registration of new parameters
-
- This section defines procedures by which new parameters are
- registered with the IANA and made available to the Internet
- community. Note that non-IANA parameters can be used by bilateral
- agreement, provided the associated parameters names follow the "X-"
- convention defined above.
-
- The procedures defined here are designed to allow public comment and
- review of new parameters, while posing only a small impediment to the
- definition of new parameters.
-
- Registration of a new parameter is accomplished by the following
- steps.
-
-13.1. Define the parameter
-
- A parameter is defined by completing the following template.
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME type parameter XXX
-
- Parameter name:
-
- Parameter purpose:
-
-
-
-Howes, et. al. Standards Track [Page 26]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- Parameter values:
-
- Parameter special notes (optional):
-
- Intended usage: (one of COMMON, LIMITED USE or OBSOLETE)
-
- The explanation of what goes in each field in the template follows.
-
- Parameter name: The name of the parameter as it will appear in the
- text/directory MIME Content-Type.
-
- Parameter purpose: The purpose of the parameter (e.g., to represent
- the format of an image, type of a phone number, etc.). Give a short
- but clear description. If defining a general paramemter like "format"
- or "type" keep in mind that other applications might wish to extend
- its use.
-
- Parameter values: The list or description of values associated with
- the parameter.
-
- Parameter special notes: Any special notes about the parameter, how
- it is to be used, etc.
-
-13.2. Post the parameter definition
-
- The parameter description must be posted to the new parameter
- discussion list, ietf-mime-direct@imc.org
-
-13.3. Allow a comment period
-
- Discussion on the new parameter must be allowed to take place on the
- list for a minimum of two weeks. Consensus must be reached on the
- parameter before proceeding to step 4.
-
-13.4. Submit the parameter for approval
-
- Once the two-week comment period has elapsed, and the proposer is
- convinced consensus has been reached on the parameter, the
- registration application should be submitted to the Profile Reviewer
- for approval. The Profile Reviewer is appointed by the Application
- Area Directors and can either accept or reject the parameter
- registration. An accepted registration is passed on by the Profile
- Reviewer to the IANA for inclusion in the official IANA parameter
- registry. The registration can be rejected for any of the following
- reasons. 1) Insufficient comment period; 2) Consensus not reached; 3)
- Technical deficiencies raised on the list or elsewhere have not been
- addressed. The Profile Reviewer's decision to reject a profile can be
- appealed by the proposer to the IESG, or the objections raised can be
-
-
-
-Howes, et. al. Standards Track [Page 27]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- addressed by the proposer and the parameter registration resubmitted.
-
-14. Parameter Change Control
-
- Existing parameters can be changed using the same process by which
- they were registered.
-
- Define the change
-
- Post the change
-
- Allow a comment period
-
- Submit the parameter for approval
-
- Note that the original author or any other interested party can
- propose a change to an existing parameter, but that such changes
- should only be proposed when there are serious omissions or errors in
- the published specification. The Profile Reviewer can object to a
- change if it is not backwards compatible, but is not required to do
- so.
-
- Parameter definitions can never be deleted from the IANA registry,
- but parameters which are nolonger believed to be useful can be
- declared OBSOLETE by a change to their "intended use" field.
-
-15. Registration of new value types
-
- This section defines procedures by which new value types are
- registered with the IANA and made available to the Internet
- community. Note that non-IANA value types can be used by bilateral
- agreement, provided the associated value types names follow the "X-"
- convention defined above.
-
- The procedures defined here are designed to allow public comment and
- review of new value types, while posing only a small impediment to
- the definition of new value types.
-
- Registration of a new value types is accomplished by the following
- steps.
-
-15.1. Define the value type
-
- A value type is defined by completing the following template.
-
- To: ietf-mime-direct@imc.org
- Subject: Registration of text/directory MIME value type XXX
-
-
-
-
-Howes, et. al. Standards Track [Page 28]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- value type name:
-
- value type purpose:
-
- value type format:
-
- value type special notes (optional):
-
- Intended usage: (one of COMMON, LIMITED USE or OBSOLETE)
-
- The explanation of what goes in each field in the template follows.
-
- value type name: The name of the value type as it will appear in the
- text/directory MIME Content-Type.
-
- value type purpose: The purpose of the value type. Give a short but
- clear description.
-
- value type format: The definition of the format for the value,
- usually using ABNF grammar.
-
- value type special notes: Any special notes about the value type, how
- it is to be used, etc.
-
-15.2. Post the value type definition
-
- The value type description must be posted to the new value type
- discussion list, ietf-mime-direct@imc.org
-
-15.3. Allow a comment period
-
- Discussion on the new value type must be allowed to take place on the
- list for a minimum of two weeks. Consensus must be reached before
- proceeding to step 4.
-
-15.4. Submit the value type for approval
-
- Once the two-week comment period has elapsed, and the proposer is
- convinced consensus has been reached on the value type, the
- registration application should be submitted to the Profile Reviewer
- for approval. The Profile Reviewer is appointed by the Application
- Area Directors and can either accept or reject the value type
- registration. An accepted registration should be passed on by the
- Profile Reviewer to the IANA for inclusion in the official IANA value
- type registry. The registration can be rejected for any of the
- following reasons. 1) Insufficient comment period; 2) Consensus not
- reached; 3) Technical deficiencies raised on the list or elsewhere
- have not been addressed. The Profile Reviewer's decision to reject a
-
-
-
-Howes, et. al. Standards Track [Page 29]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- profile can be appealed by the proposer to the IESG, or the
- objections raised can be addressed by the proposer and the value type
- registration resubmitted.
-
-16. Security Considerations
-
- Internet mail is subject to many well known security attacks,
- including monitoring, replay, and forgery. Care should be taken by
- any directory service in allowing information to leave the scope of
- the service itself, where any access controls can no longer be
- guaranteed. Applications should also take care to display directory
- data in a "safe" environment (e.g., PostScript-valued types).
-
-17. Acknowledgements
-
- The registration procedures defined here were shamelessly lifted from
- the MIME registration RFC.
-
- The many valuable comments contributed by members of the IETF ASID
- working group are gratefully acknowledged, as are the contributions
- of the Versit Consortium. Chris Newman was especially helpful in
- navigating the intricacies of ABNF lore.
-
-18. References
-
- [RFC-1777] Yeong, W., Howes, T., and S. Kille, "Lightweight
- Directory Access Protocol", RFC 1777, March 1995.
-
- [RFC-1778] Howes, T., Kille, S., Yeong, W., and C. Robbins, "The
- String Representation of Standard Attribute Syntaxes",
- RFC 1778, March 1995.
-
- [RFC-822] Crocker, D., "Standard for the Format of ARPA Internet
- Text Messages", STD 11, RFC 822, August 1982.
-
- [RFC-2045] Borenstein, N., and N. Freed, "Multipurpose Internet
- Mail Extensions (MIME) Part One: Format of Internet
- Message Bodies", RFC 2045, November 1996.
-
- [RFC-2046] Moore, K., "Multipurpose Internet Mail Extensions (MIME)
- Part Two: Media Types", RFC 2046, November 1996.
-
- [RFC-2048] Freed, N., Klensin, J., and J. Postel, "Multipurpose
- Internet Mail Extensions (MIME) Part Four: Registration
- Procedures", RFC 2048, November 1996.
-
- [RFC-1766] Alvestrand, H., "Tags for the Identification of
- Languages", RFC 1766, March 1995.
-
-
-
-Howes, et. al. Standards Track [Page 30]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
- [RFC-2112] Levinson, E., "The MIME Multipart/Related Content-type",
- RFC 2112, March 1997.
-
- [X500] "Information Processing Systems - Open Systems
- Interconnection - The Directory: Overview of Concepts,
- Models and Services", ISO/IEC JTC 1/SC21, International
- Standard 9594-1, 1988.
-
- [RFC-1835] Deutsch, P., Schoultz, R., Faltstrom, P., and C. Weider,
- "Architecture of the WHOIS++ service", RFC 1835, August
- 1995.
-
- [RFC-1738] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform
- Resource Locators (URL)", RFC 1738, December 1994.
-
- [MIME-VCARD] Dawson, F., and T. Howes, "VCard MIME Directory
- Profile", RFC 2426, September 1998.
-
- [VCARD] Internet Mail Consortium, "vCard - The Electronic
- Business Card", Version 2.1,
- http://www.imc.com/pdi/vcard-21.txt, September, 1996.
-
- [RFC-2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", BCP 14, RFC 2119, March 1997.
-
- [RFC-2234] Crocker, D., and P. Overell, "Augmented BNF for Syntax
- Specifications: ABNF", RFC 2234, November 1997.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 31]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-19. Authors' Addresses
-
- Tim Howes
- Netscape Communications Corp.
- 501 East Middlefield Rd.
- Mountain View, CA 94041
- USA
-
- Phone: +1.415.937.3419
- EMail: howes@netscape.com
-
-
- Mark Smith
- Netscape Communications Corp.
- 501 East Middlefield Rd.
- Mountain View, CA 94041
- USA
-
- Phone: +1.415.937.3477
- EMail: mcs@netscape.com
-
-
- Frank Dawson
- Lotus Development Corporation
- 6544 Battleford Drive
- Raleigh, NC 27613
- USA
-
- Phone: +1-919-676-9515
- EMail: frank_dawson@lotus.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 32]
-
-RFC 2425 MIME Content-Type for Directory Information September 1998
-
-
-20. Full Copyright Statement
-
- Copyright (C) The Internet Society (1998). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Howes, et. al. Standards Track [Page 33]
-
diff --git a/addressbook/backend/ebook/docs/rfc2426.txt b/addressbook/backend/ebook/docs/rfc2426.txt
deleted file mode 100644
index a393a67c98..0000000000
--- a/addressbook/backend/ebook/docs/rfc2426.txt
+++ /dev/null
@@ -1,2355 +0,0 @@
-
-
-
-
-
-
-Network Working Group F. Dawson
-Request for Comments: 2426 Lotus Development Corporation
-Category: Standards Track T. Howes
- Netscape Communications
- September 1998
-
-
- vCard MIME Directory Profile
-
-Status of this Memo
-
- This document specifies an Internet standards track protocol for the
- Internet community, and requests discussion and suggestions for
- improvements. Please refer to the current edition of the "Internet
- Official Protocol Standards" (STD 1) for the standardization state
- and status of this protocol. Distribution of this memo is unlimited.
-
-Copyright Notice
-
- Copyright (C) The Internet Society (1998). All Rights Reserved.
-
-Abstract
-
- This memo defines the profile of the MIME Content-Type [MIME-DIR] for
- directory information for a white-pages person object, based on a
- vCard electronic business card. The profile definition is independent
- of any particular directory service or protocol. The profile is
- defined for representing and exchanging a variety of information
- about an individual (e.g., formatted and structured name and delivery
- addresses, email address, multiple telephone numbers, photograph,
- logo, audio clips, etc.). The directory information used by this
- profile is based on the attributes for the person object defined in
- the X.520 and X.521 directory services recommendations. The profile
- also provides the method for including a [VCARD] representation of a
- white-pages directory entry within the MIME Content-Type defined by
- the [MIME-DIR] document.
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY" and "OPTIONAL" in this
- document are to be interpreted as described in [RFC 2119].
-
-
-
-
-
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 1]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-Table of Contents
-
- Overview.........................................................3
- 1. THE VCARD MIME DIRECTORY PROFILE REGISTRATION.................4
- 2. MIME DIRECTORY FEATURES.......................................5
- 2.1 PREDEFINED TYPE USAGE ......................................5
- 2.1.1 BEGIN and END Type ......................................5
- 2.1.2 NAME Type ...............................................5
- 2.1.3 PROFILE Type ............................................5
- 2.1.4 SOURCE Type .............................................5
- 2.2 PREDEFINED TYPE PARAMETER USAGE ............................6
- 2.3 PREDEFINED VALUE TYPE USAGE ................................6
- 2.4 EXTENSIONS TO THE PREDEFINED VALUE TYPES ...................6
- 2.4.1 BINARY ..................................................6
- 2.4.2 VCARD ...................................................6
- 2.4.3 PHONE-NUMBER ............................................7
- 2.4.4 UTC-OFFSET ..............................................7
- 2.5 STRUCTURED TYPE VALUES .....................................7
- 2.6 LINE DELIMITING AND FOLDING ................................8
- 3. VCARD PROFILE FEATURES........................................8
- 3.1 IDENTIFICATION TYPES .......................................8
- 3.1.1 FN Type Definition ......................................8
- 3.1.2 N Type Definition .......................................9
- 3.1.3 NICKNAME Type Definition ................................9
- 3.1.4 PHOTO Type Definition ..................................10
- 3.1.5 BDAY Type Definition ...................................11
- 3.2 DELIVERY ADDRESSING TYPES .................................11
- 3.2.1 ADR Type Definition ....................................11
- 3.2.2 LABEL Type Definition ..................................13
- 3.3 TELECOMMUNICATIONS ADDRESSING TYPES .......................13
- 3.3.1 TEL Type Definition ....................................14
- 3.3.2 EMAIL Type Definition ..................................15
- 3.3.3 MAILER Type Definition .................................15
- 3.4 GEOGRAPHICAL TYPES ........................................16
- 3.4.1 TZ Type Definition .....................................16
- 3.4.2 GEO Type Definition ....................................16
- 3.5 ORGANIZATIONAL TYPES ......................................17
- 3.5.1 TITLE Type Definition ..................................17
- 3.5.2 ROLE Type Definition ...................................18
- 3.5.3 LOGO Type Definition ...................................18
- 3.5.4 AGENT Type Definition ..................................19
- 3.5.5 ORG Type Definition ....................................20
- 3.6 EXPLANATORY TYPES .........................................20
- 3.6.1 CATEGORIES Type Definition .............................20
- 3.6.2 NOTE Type Definition ...................................21
- 3.6.3 PRODID Type Definition .................................21
- 3.6.4 REV Type Definition ....................................22
- 3.6.5 SORT-STRING Type Definition ............................22
-
-
-
-Dawson & Howes Standards Track [Page 2]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- 3.6.6 SOUND Type Definition ..................................23
- 3.6.7 UID Type Definition ....................................24
- 3.6.8 URL Type Definition ....................................25
- 3.6.9 VERSION Type Definition ................................25
- 3.7 SECURITY TYPES ............................................25
- 3.7.1 CLASS Type Definition ..................................26
- 3.7.2 KEY Type Definition ....................................26
- 3.8 EXTENDED TYPES ............................................27
- 4. FORMAL GRAMMAR...............................................27
- 5. DIFFERENCES FROM VCARD V2.1..................................37
- 6. ACKNOWLEDGEMENTS.............................................39
- 7. AUTHORS' ADDRESSES...........................................39
- 8. SECURITY CONSIDERATIONS......................................39
- 9. REFERENCES...................................................40
- 10. FULL COPYRIGHT STATEMENT....................................42
-
-Overview
-
- The [MIME-DIR] document defines a MIME Content-Type for holding
- different kinds of directory information. The directory information
- can be based on any of a number of directory schemas. This document
- defines a [MIME-DIR] usage profile for conveying directory
- information based on one such schema; that of the white-pages type of
- person object.
-
- The schema is based on the attributes for the person object defined
- in the X.520 and X.521 directory services recommendations. The schema
- has augmented the basic attributes defined in the X.500 series
- recommendation in order to provide for an electronic representation
- of the information commonly found on a paper business card. This
- schema was first defined in the [VCARD] document. Hence, this [MIME-
- DIR] profile is referred to as the vCard MIME Directory Profile.
-
- A directory entry based on this usage profile can include traditional
- directory, white-pages information such as the distinguished name
- used to uniquely identify the entry, a formatted representation of
- the name used for user-interface or presentation purposes, both the
- structured and presentation form of the delivery address, various
- telephone numbers and organizational information associated with the
- entry. In addition, traditional paper business card information such
- as an image of an organizational logo or identify photograph can be
- included in this person object.
-
- The vCard MIME Directory Profile also provides support for
- representing other important information about the person associated
- with the directory entry. For instance, the date of birth of the
- person; an audio clip describing the pronunciation of the name
- associated with the directory entry, or some other application of the
-
-
-
-Dawson & Howes Standards Track [Page 3]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- digital sound; longitude and latitude geo-positioning information
- related to the person associated with the directory entry; date and
- time that the directory information was last updated; annotations
- often written on a business card; Uniform Resource Locators (URL) for
- a website; public key information. The profile also provides support
- for non-standard extensions to the schema. This provides the
- flexibility for implementations to augment the current capabilities
- of the profile in a standardized way. More information about this
- electronic business card format can be found in [VCARD].
-
-1. The vCard Mime Directory Profile Registration
-
- This profile is identified by the following [MIME-DIR] registration
- template information. Subsequent sections define the profile
- definition.
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME profile VCARD
-
- Profile name: VCARD
-
- Profile purpose: To hold person object or white-pages type of
- directory information. The person schema captured in the directory
- entries is that commonly found in an electronic business card.
-
- Predefined MIME Directory value specifications used: uri, date,
- date-time, float
-
- New value specifications: This profile places further constraints on
- the [MIME-DIR] text value specification. In addition, it adds a
- binary, phone-number, utc-offset and vcard value specifications.
-
- Predefined MIME Directory types used: SOURCE, NAME, PROFILE, BEGIN,
- END.
-
- Predefined MIME Directory parameters used: ENCODING, VALUE, CHARSET,
- LANGUAGE, CONTEXT.
-
- New types: FN, N, NICKNAME, PHOTO, BDAY, ADR, LABEL, TEL, EMAIL,
- MAILER, TZ, GEO, TITLE, ROLE, LOGO, AGENT, ORG, CATEGORIES, NOTE,
- PRODID, REV, SORT-STRING, SOUND, URL, UID, VERSION, CLASS, KEY
-
- New parameters: TYPE
-
- Profile special notes: The vCard object MUST contain the FN, N and
- VERSION types. The type-grouping feature of [MIME-DIR] is supported
- by this profile to group related vCard properties about a directory
-
-
-
-Dawson & Howes Standards Track [Page 4]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- entry. For example, vCard properties describing WORK or HOME related
- characteristics can be grouped with a unique group label.
-
- The profile permits the use of non-standard types (i.e., those
- identified with the prefix string "X-") as a flexible method for
- implementations to extend the functionality currently defined within
- this profile.
-
-2. MIME Directory Features
-
- The vCard MIME Directory Profile makes use of many of the features
- defined by [MIME-DIR]. The following sections either clarify or
- extend the content-type definition of [MIME-DIR].
-
-2.1 Predefined Type Usage
-
- The vCard MIME Directory Profile uses the following predefined types
- from [MIME-DIR].
-
-2.1.1 BEGIN and END Type
-
- The content entity MUST begin with the BEGIN type with a value of
- "VCARD". The content entity MUST end with the END type with a value
- of "VCARD".
-
-2.1.2 NAME Type
-
- If the NAME type is present, then its value is the displayable,
- presentation text associated with the source for the vCard, as
- specified in the SOURCE type.
-
-2.1.3 PROFILE Type
-
- If the PROFILE type is present, then its value MUST be "VCARD".
-
-2.1.4 SOURCE Type
-
- If the SOURCE type is present, then its value provides information
- how to find the source for the vCard.
-
-
-
-
-
-
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 5]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-2.2 Predefined Type Parameter Usage
-
- The vCard MIME Directory Profile uses the following predefined type
- parameters as defined by [MIME-DIR].
-
- - LANGUAGE
-
- - ENCODING
-
- - VALUE
-
-2.3 Predefined VALUE Type Usage
-
- The predefined data type values specified in [MIME-DIR] MUST NOT be
- repeated in COMMA separated value lists except within the N,
- NICKNAME, ADR and CATEGORIES value types.
-
- The text value type defined in [MIME-DIR] is further restricted such
- that any SEMI-COLON character (ASCII decimal 59) in the value MUST be
- escaped with the BACKSLASH character (ASCII decimal 92).
-
-2.4 Extensions To The Predefined VALUE Types
-
- The predefined data type values specified in [MIME-DIR] have been
- extended by the vCard profile to include a number of value types that
- are specific to this profile.
-
-2.4.1 BINARY
-
- The "binary" value type specifies that the type value is inline,
- encoded binary data. This value type can be specified in the PHOTO,
- LOGO, SOUND, and KEY types.
-
- If inline encoded binary data is specified, the ENCODING type
- parameter MUST be used to specify the encoding format. The binary
- data MUST be encoded using the "B" encoding format. Long lines of
- encoded binary data SHOULD BE folded to 75 characters using the
- folding method defined in [MIME-DIR].
-
- The value type is defined by the following notation:
-
- binary = <A "B" binary encoded string as defined by [RFC 2047].>
-
-2.4.2 VCARD
-
- The "vcard" value type specifies that the type value is another
- vCard. This value type can be specified in the AGENT type. The value
- type is defined by this specification. Since each of the type
-
-
-
-Dawson & Howes Standards Track [Page 6]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- declarations with in the vcard value type are being specified within
- a text value themselves, they MUST be terminated with the backslash
- escape sequence "\n" or "\N", instead of the normal newline character
- sequence CRLF. In addition, any COMMA character (ASCII decimal 44),
- SEMI-COLON character (ASCII decimal 59) and COLON character (ASCII
- decimal 58) MUST be escaped with the BACKSLASH character (ASCII
- decimal 92). For example, with the AGENT type a value would be
- specified as:
-
- AGENT:BEGIN:VCARD\nFN:Joe Friday\nTEL:+1-919-555-7878\n
- TITLE:Area Administrator\, Assistant\n EMAIL\;TYPE=INTERN\n
- ET:jfriday@host.com\nEND:VCARD\n
-
-2.4.3 PHONE-NUMBER
-
- The "phone-number" value type specifies that the type value is a
- telephone number. This value type can be specified in the TEL type.
- The value type is a text value that has the special semantics of a
- telephone number as defined in [CCITT E.163] and [CCITT X.121].
-
-2.4.4 UTC-OFFSET
-
- The "utc-offset" value type specifies that the type value is a signed
- offset from UTC. This value type can be specified in the TZ type.
-
- The value type is an offset from Coordinated Universal Time (UTC). It
- is specified as a positive or negative difference in units of hours
- and minutes (e.g., +hh:mm). The time is specified as a 24-hour clock.
- Hour values are from 00 to 23, and minute values are from 00 to 59.
- Hour and minutes are 2-digits with high order zeroes required to
- maintain digit count. The extended format for ISO 8601 UTC offsets
- MUST be used. The extended format makes use of a colon character as a
- separator of the hour and minute text fields.
-
- The value is defined by the following notation:
-
- time-hour = 2DIGIT ;00-23
- time-minute = 2DIGIT ;00-59
- utc-offset = ("+" / "-") time-hour ":" time-minute
-
-2.5 Structured Type Values
-
- Compound type values are delimited by a field delimiter, specified by
- the SEMI-COLON character (ASCII decimal 59). A SEMI-COLON in a
- component of a compound property value MUST be escaped with a
- BACKSLASH character (ASCII decimal 92).
-
-
-
-
-
-Dawson & Howes Standards Track [Page 7]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Lists of values are delimited by a list delimiter, specified by the
- COMMA character (ASCII decimal 44). A COMMA character in a value MUST
- be escaped with a BACKSLASH character (ASCII decimal 92).
-
- This profile supports the type grouping mechanism defined in [MIME-
- DIR]. Grouping of related types is a useful technique to communicate
- common semantics concerning the properties of a vCard.
-
-2.6 Line Delimiting and Folding
-
- This profile supports the same line delimiting and folding methods
- defined in [MIME-DIR]. Specifically, when parsing a content line,
- folded lines must first be unfolded according to the unfolding
- procedure described in [MIME-DIR]. After generating a content line,
- lines longer than 75 characters SHOULD be folded according to the
- folding procedure described in [MIME DIR].
-
- Folding is done after any content encoding of a type value. Unfolding
- is done before any decoding of a type value in a content line.
-
-3. vCard Profile Features
-
- The vCard MIME Directory Profile Type contains directory information,
- typically pertaining to a single directory entry. The information is
- described using an attribute schema that is tailored for capturing
- personal contact information. The vCard can include attributes that
- describe identification, delivery addressing, telecommunications
- addressing, geographical, organizational, general explanatory and
- security and access information about the particular object
- associated with the vCard.
-
-3.1 Identification Types
-
- These types are used in the vCard profile to capture information
- associated with the identification and naming of the person or
- resource associated with the vCard.
-
-3.1.1 FN Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type FN
-
- Type name:FN
-
- Type purpose: To specify the formatted text corresponding to the name
- of the object the vCard represents.
-
-
-
-
-Dawson & Howes Standards Track [Page 8]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
- Type special notes: This type is based on the semantics of the X.520
- Common Name attribute. The property MUST be present in the vCard
- object.
-
- Type example:
-
- FN:Mr. John Q. Public\, Esq.
-
-3.1.2 N Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type N
-
- Type name: N
-
- Type purpose: To specify the components of the name of the object the
- vCard represents.
-
- Type encoding: 8bit
-
- Type value: A single structured text value. Each component can have
- multiple values.
-
- Type special note: The structured type value corresponds, in
- sequence, to the Family Name, Given Name, Additional Names, Honorific
- Prefixes, and Honorific Suffixes. The text components are separated
- by the SEMI-COLON character (ASCII decimal 59). Individual text
- components can include multiple text values (e.g., multiple
- Additional Names) separated by the COMMA character (ASCII decimal
- 44). This type is based on the semantics of the X.520 individual name
- attributes. The property MUST be present in the vCard object.
-
- Type example:
-
- N:Public;John;Quinlan;Mr.;Esq.
-
- N:Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
-
-3.1.3 NICKNAME Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type NICKNAME
-
-
-
-Dawson & Howes Standards Track [Page 9]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type name: NICKNAME
-
- Type purpose: To specify the text corresponding to the nickname of
- the object the vCard represents.
-
- Type encoding: 8bit
-
- Type value: One or more text values separated by a COMMA character
- (ASCII decimal 44).
-
- Type special note: The nickname is the descriptive name given instead
- of or in addition to the one belonging to a person, place, or thing.
- It can also be used to specify a familiar form of a proper name
- specified by the FN or N types.
-
- Type example:
-
- NICKNAME:Robbie
-
- NICKNAME:Jim,Jimmie
-
-3.1.4 PHOTO Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type PHOTO
-
- Type name: PHOTO
-
- Type purpose: To specify an image or photograph information that
- annotates some aspect of the object the vCard represents.
-
- Type encoding: The encoding MUST be reset to "b" using the ENCODING
- parameter in order to specify inline, encoded binary data. If the
- value is referenced by a URI value, then the default encoding of 8bit
- is used and no explicit ENCODING parameter is needed.
-
- Type value: A single value. The default is binary value. It can also
- be reset to uri value. The uri value can be used to specify a value
- outside of this MIME entity.
-
- Type special notes: The type can include the type parameter "TYPE" to
- specify the graphic image format type. The TYPE parameter values MUST
- be one of the IANA registered image formats or a non-standard image
- format.
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 10]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type example:
-
- PHOTO;VALUE=uri:http://www.abc.com/pub/photos
- /jqpublic.gif
-
-
- PHOTO;ENCODING=b;TYPE=JPEG:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcN
- AQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bm
- ljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
- <...remainder of "B" encoded binary data...>
-
-3.1.5 BDAY Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type BDAY
-
- Type name: BDAY
-
- Type purpose: To specify the birth date of the object the vCard
- represents.
-
- Type encoding: 8bit
-
- Type value: The default is a single date value. It can also be reset
- to a single date-time value.
-
- Type examples:
-
- BDAY:1996-04-15
-
- BDAY:1953-10-15T23:10:00Z
-
- BDAY:1987-09-27T08:30:00-06:00
-
-3.2 Delivery Addressing Types
-
- These types are concerned with information related to the delivery
- addressing or label for the vCard object.
-
-3.2.1 ADR Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type ADR
-
- Type name: ADR
-
-
-
-
-Dawson & Howes Standards Track [Page 11]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type purpose: To specify the components of the delivery address for
- the vCard object.
-
- Type encoding: 8bit
-
- Type value: A single structured text value, separated by the
- SEMI-COLON character (ASCII decimal 59).
-
- Type special notes: The structured type value consists of a sequence
- of address components. The component values MUST be specified in
- their corresponding position. The structured type value corresponds,
- in sequence, to the post office box; the extended address; the street
- address; the locality (e.g., city); the region (e.g., state or
- province); the postal code; the country name. When a component value
- is missing, the associated component separator MUST still be
- specified.
-
- The text components are separated by the SEMI-COLON character (ASCII
- decimal 59). Where it makes semantic sense, individual text
- components can include multiple text values (e.g., a "street"
- component with multiple lines) separated by the COMMA character
- (ASCII decimal 44).
-
- The type can include the type parameter "TYPE" to specify the
- delivery address type. The TYPE parameter values can include "dom" to
- indicate a domestic delivery address; "intl" to indicate an
- international delivery address; "postal" to indicate a postal
- delivery address; "parcel" to indicate a parcel delivery address;
- "home" to indicate a delivery address for a residence; "work" to
- indicate delivery address for a place of work; and "pref" to indicate
- the preferred delivery address when more than one address is
- specified. These type parameter values can be specified as a
- parameter list (i.e., "TYPE=dom;TYPE=postal") or as a value list
- (i.e., "TYPE=dom,postal"). This type is based on semantics of the
- X.520 geographical and postal addressing attributes. The default is
- "TYPE=intl,postal,parcel,work". The default can be overridden to some
- other set of values by specifying one or more alternate values. For
- example, the default can be reset to "TYPE=dom,postal,work,home" to
- specify a domestic delivery address for postal delivery to a
- residence that is also used for work.
-
- Type example: In this example the post office box and the extended
- address are absent.
-
- ADR;TYPE=dom,home,postal,parcel:;;123 Main
- Street;Any Town;CA;91921-1234
-
-
-
-
-
-Dawson & Howes Standards Track [Page 12]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-3.2.2 LABEL Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type LABEL
-
- Type name: LABEL
-
- Type purpose: To specify the formatted text corresponding to delivery
- address of the object the vCard represents.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
- Type special notes: The type value is formatted text that can be used
- to present a delivery address label for the vCard object. The type
- can include the type parameter "TYPE" to specify delivery label type.
- The TYPE parameter values can include "dom" to indicate a domestic
- delivery label; "intl" to indicate an international delivery label;
- "postal" to indicate a postal delivery label; "parcel" to indicate a
- parcel delivery label; "home" to indicate a delivery label for a
- residence; "work" to indicate delivery label for a place of work; and
- "pref" to indicate the preferred delivery label when more than one
- label is specified. These type parameter values can be specified as a
- parameter list (i.e., "TYPE=dom;TYPE=postal") or as a value list
- (i.e., "TYPE=dom,postal"). This type is based on semantics of the
- X.520 geographical and postal addressing attributes. The default is
- "TYPE=intl,postal,parcel,work". The default can be overridden to some
- other set of values by specifying one or more alternate values. For
- example, the default can be reset to "TYPE=intl,post,parcel,home" to
- specify an international delivery label for both postal and parcel
- delivery to a residential location.
-
- Type example: A multi-line address label.
-
- LABEL;TYPE=dom,home,postal,parcel:Mr.John Q. Public\, Esq.\n
- Mail Drop: TNE QB\n123 Main Street\nAny Town\, CA 91921-1234
- \nU.S.A.
-
-3.3 Telecommunications Addressing Types
-
- These types are concerned with information associated with the
- telecommunications addressing of the object the vCard represents.
-
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 13]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-3.3.1 TEL Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type TEL
-
- Type name: TEL
-
- Type purpose: To specify the telephone number for telephony
- communication with the object the vCard represents.
-
- Type encoding: 8bit
-
- Type value: A single phone-number value.
-
- Type special notes: The value of this type is specified in a
- canonical form in order to specify an unambiguous representation of
- the globally unique telephone endpoint. This type is based on the
- X.500 Telephone Number attribute.
-
- The type can include the type parameter "TYPE" to specify intended
- use for the telephone number. The TYPE parameter values can include:
- "home" to indicate a telephone number associated with a residence,
- "msg" to indicate the telephone number has voice messaging support,
- "work" to indicate a telephone number associated with a place of
- work, "pref" to indicate a preferred-use telephone number, "voice" to
- indicate a voice telephone number, "fax" to indicate a facsimile
- telephone number, "cell" to indicate a cellular telephone number,
- "video" to indicate a video conferencing telephone number, "pager" to
- indicate a paging device telephone number, "bbs" to indicate a
- bulletin board system telephone number, "modem" to indicate a MODEM
- connected telephone number, "car" to indicate a car-phone telephone
- number, "isdn" to indicate an ISDN service telephone number, "pcs" to
- indicate a personal communication services telephone number. The
- default type is "voice". These type parameter values can be specified
- as a parameter list (i.e., "TYPE=work;TYPE=voice") or as a value list
- (i.e., "TYPE=work,voice"). The default can be overridden to another
- set of values by specifying one or more alternate values. For
- example, the default TYPE of "voice" can be reset to a WORK and HOME,
- VOICE and FAX telephone number by the value list
- "TYPE=work,home,voice,fax".
-
- Type example:
-
- TEL;TYPE=work,voice,pref,msg:+1-213-555-1234
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 14]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-3.3.2 EMAIL Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type EMAIL
-
- Type name: EMAIL
-
- Type purpose: To specify the electronic mail address for
- communication with the object the vCard represents.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
- Type special notes: The type can include the type parameter "TYPE" to
- specify the format or preference of the electronic mail address. The
- TYPE parameter values can include: "internet" to indicate an Internet
- addressing type, "x400" to indicate a X.400 addressing type or "pref"
- to indicate a preferred-use email address when more than one is
- specified. Another IANA registered address type can also be
- specified. The default email type is "internet". A non-standard value
- can also be specified.
-
- Type example:
-
- EMAIL;TYPE=internet:jqpublic@xyz.dom1.com
-
- EMAIL;TYPE=internet:jdoe@isp.net
-
- EMAIL;TYPE=internet,pref:jane_doe@abc.com
-
-3.3.3 MAILER Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type MAILER
-
- Type name: MAILER
-
- Type purpose: To specify the type of electronic mail software that is
- used by the individual associated with the vCard.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
-
-
-
-
-Dawson & Howes Standards Track [Page 15]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type special notes: This information can provide assistance to a
- correspondent regarding the type of data representation which can be
- used, and how they can be packaged. This property is based on the
- private MIME type X-Mailer that is generally implemented by MIME user
- agent products.
-
- Type example:
-
- MAILER:PigeonMail 2.1
-
-3.4 Geographical Types
-
- These types are concerned with information associated with
- geographical positions or regions associated with the object the
- vCard represents.
-
-3.4.1 TZ Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type TZ
-
- Type name: TZ
-
- Type purpose: To specify information related to the time zone of the
- object the vCard represents.
-
- Type encoding: 8bit
-
- Type value: The default is a single utc-offset value. It can also be
- reset to a single text value.
-
- Type special notes: The type value consists of a single value.
-
- Type examples:
-
- TZ:-05:00
-
- TZ;VALUE=text:-05:00; EST; Raleigh/North America
- ;This example has a single value, not a structure text value.
-
-3.4.2 GEO Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type GEO
-
- Type name: GEO
-
-
-
-Dawson & Howes Standards Track [Page 16]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type purpose: To specify information related to the global
- positioning of the object the vCard represents.
-
- Type encoding: 8bit
-
- Type value: A single structured value consisting of two float values
- separated by the SEMI-COLON character (ASCII decimal 59).
-
- Type special notes: This type specifies information related to the
- global position of the object associated with the vCard. The value
- specifies latitude and longitude, in that order (i.e., "LAT LON"
- ordering). The longitude represents the location east and west of the
- prime meridian as a positive or negative real number, respectively.
- The latitude represents the location north and south of the equator
- as a positive or negative real number, respectively. The longitude
- and latitude values MUST be specified as decimal degrees and should
- be specified to six decimal places. This will allow for granularity
- within a meter of the geographical position. The text components are
- separated by the SEMI-COLON character (ASCII decimal 59). The simple
- formula for converting degrees-minutes-seconds into decimal degrees
- is:
-
- decimal = degrees + minutes/60 + seconds/3600.
-
- Type example:
-
- GEO:37.386013;-122.082932
-
-3.5 Organizational Types
-
- These types are concerned with information associated with
- characteristics of the organization or organizational units of the
- object the vCard represents.
-
-3.5.1 TITLE Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type TITLE
-
- Type name: TITLE
-
- Type purpose: To specify the job title, functional position or
- function of the object the vCard represents.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
-
-
-Dawson & Howes Standards Track [Page 17]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type special notes: This type is based on the X.520 Title attribute.
-
- Type example:
-
- TITLE:Director\, Research and Development
-
-3.5.2 ROLE Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type ROLE
-
- Type name: ROLE
-
- Type purpose: To specify information concerning the role, occupation,
- or business category of the object the vCard represents.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
- Type special notes: This type is based on the X.520 Business Category
- explanatory attribute. This property is included as an organizational
- type to avoid confusion with the semantics of the TITLE type and
- incorrect usage of that type when the semantics of this type is
- intended.
-
- Type example:
-
- ROLE:Programmer
-
-3.5.3 LOGO Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type LOGO
-
- Type name: LOGO
-
- Type purpose: To specify a graphic image of a logo associated with
- the object the vCard represents.
-
- Type encoding: The encoding MUST be reset to "b" using the ENCODING
- parameter in order to specify inline, encoded binary data. If the
- value is referenced by a URI value, then the default encoding of 8bit
- is used and no explicit ENCODING parameter is needed.
-
-
-
-
-
-Dawson & Howes Standards Track [Page 18]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type value: A single value. The default is binary value. It can also
- be reset to uri value. The uri value can be used to specify a value
- outside of this MIME entity.
-
- Type special notes: The type can include the type parameter "TYPE" to
- specify the graphic image format type. The TYPE parameter values MUST
- be one of the IANA registered image formats or a non-standard image
- format.
-
- Type example:
-
- LOGO;VALUE=uri:http://www.abc.com/pub/logos/abccorp.jpg
-
- LOGO;ENCODING=b;TYPE=JPEG:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcN
- AQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bm
- ljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
- <...the remainder of "B" encoded binary data...>
-
-3.5.4 AGENT Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type AGENT
-
- Type name: AGENT
-
- Type purpose: To specify information about another person who will
- act on behalf of the individual or resource associated with the
- vCard.
-
- Type encoding: 8-bit
-
- Type value: The default is a single vcard value. It can also be reset
- to either a single text or uri value. The text value can be used to
- specify textual information. The uri value can be used to specify
- information outside of this MIME entity.
-
- Type special notes: This type typically is used to specify an area
- administrator, assistant, or secretary for the individual associated
- with the vCard. A key characteristic of the Agent type is that it
- represents somebody or something that is separately addressable.
-
- Type example:
-
- AGENT;VALUE=uri:
- CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com
-
-
-
-
-
-Dawson & Howes Standards Track [Page 19]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- AGENT:BEGIN:VCARD\nFN:Susan Thomas\nTEL:+1-919-555-
- 1234\nEMAIL\;INTERNET:sthomas@host.com\nEND:VCARD\n
-
-3.5.5 ORG Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type ORG
-
- Type name: ORG
-
- Type purpose: To specify the organizational name and units associated
- with the vCard.
-
- Type encoding: 8bit
-
- Type value: A single structured text value consisting of components
- separated the SEMI-COLON character (ASCII decimal 59).
-
- Type special notes: The type is based on the X.520 Organization Name
- and Organization Unit attributes. The type value is a structured type
- consisting of the organization name, followed by one or more levels
- of organizational unit names.
-
- Type example: A type value consisting of an organizational name,
- organizational unit #1 name and organizational unit #2 name.
-
- ORG:ABC\, Inc.;North American Division;Marketing
-
-3.6 Explanatory Types
-
- These types are concerned with additional explanations, such as that
- related to informational notes or revisions specific to the vCard.
-
-3.6.1 CATEGORIES Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type CATEGORIES
-
- Type name: CATEGORIES
-
- Type purpose: To specify application category information about the
- vCard.
-
- Type encoding: 8bit
-
-
-
-
-
-Dawson & Howes Standards Track [Page 20]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type value: One or more text values separated by a COMMA character
- (ASCII decimal 44).
-
- Type example:
-
- CATEGORIES:TRAVEL AGENT
-
- CATEGORIES:INTERNET,IETF,INDUSTRY,INFORMATION TECHNOLOGY
-
-3.6.2 NOTE Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type NOTE
-
- Type name: NOTE
-
- Type purpose: To specify supplemental information or a comment that
- is associated with the vCard.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
- Type special notes: The type is based on the X.520 Description
- attribute.
-
- Type example:
-
- NOTE:This fax number is operational 0800 to 1715
- EST\, Mon-Fri.
-
-3.6.3 PRODID Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type PRODID
-
- Type name: PRODID
-
- Type purpose: To specify the identifier for the product that created
- the vCard object.
-
- Type encoding: 8-bit
-
- Type value: A single text value.
-
-
-
-
-
-Dawson & Howes Standards Track [Page 21]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type special notes: Implementations SHOULD use a method such as that
- specified for Formal Public Identifiers in ISO 9070 to assure that
- the text value is unique.
-
- Type example:
-
- PRODID:-//ONLINE DIRECTORY//NONSGML Version 1//EN
-
-3.6.4 REV Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type REV
-
- Type name: REV
-
- Type purpose: To specify revision information about the current
- vCard.
-
- Type encoding: 8-bit
-
- Type value: The default is a single date-time value. Can also be
- reset to a single date value.
-
- Type special notes: The value distinguishes the current revision of
- the information in this vCard for other renditions of the
- information.
-
- Type example:
-
- REV:1995-10-31T22:27:10Z
-
- REV:1997-11-15
-
-3.6.5 SORT-STRING Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type SORT-STRING
-
- Type Name: SORT-STRING
-
- Type purpose: To specify the family name or given name text to be
- used for national-language-specific sorting of the FN and N types.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
-
-
-Dawson & Howes Standards Track [Page 22]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type special notes: The sort string is used to provide family name or
- given name text that is to be used in locale- or national-language-
- specific sorting of the formatted name and structured name types.
- Without this information, sorting algorithms could incorrectly sort
- this vCard within a sequence of sorted vCards. When this type is
- present in a vCard, then this family name or given name value is used
- for sorting the vCard.
-
- Type examples: For the case of family name sorting, the following
- examples define common sort string usage with the FN and N types.
-
- FN:Rene van der Harten
- N:van der Harten;Rene;J.;Sir;R.D.O.N.
- SORT-STRING:Harten
-
- FN:Robert Pau Shou Chang
- N:Pau;Shou Chang;Robert
- SORT-STRING:Pau
-
- FN:Osamu Koura
- N:Koura;Osamu
- SORT-STRING:Koura
-
- FN:Oscar del Pozo
- N:del Pozo Triscon;Oscar
- SORT-STRING:Pozo
-
- FN:Chistine d'Aboville
- N:d'Aboville;Christine
- SORT-STRING:Aboville
-
-3.6.6 SOUND Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type SOUND
-
- Type name: SOUND
-
- Type purpose: To specify a digital sound content information that
- annotates some aspect of the vCard. By default this type is used to
- specify the proper pronunciation of the name type value of the vCard.
-
- Type encoding: The encoding MUST be reset to "b" using the ENCODING
- parameter in order to specify inline, encoded binary data. If the
- value is referenced by a URI value, then the default encoding of 8bit
- is used and no explicit ENCODING parameter is needed.
-
-
-
-
-Dawson & Howes Standards Track [Page 23]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type value: A single value. The default is binary value. It can also
- be reset to uri value. The uri value can be used to specify a value
- outside of this MIME entity.
-
- Type special notes: The type can include the type parameter "TYPE" to
- specify the audio format type. The TYPE parameter values MUST be one
- of the IANA registered audio formats or a non-standard audio format.
-
- Type example:
-
- SOUND;TYPE=BASIC;VALUE=uri:CID:JOHNQPUBLIC.part8.
- 19960229T080000.xyzMail@host1.com
-
- SOUND;TYPE=BASIC;ENCODING=b:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcN
- AQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bm
- ljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
- <...the remainder of "B" encoded binary data...>
-
-3.6.7 UID Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type UID
-
- Type name: UID
-
- Type purpose: To specify a value that represents a globally unique
- identifier corresponding to the individual or resource associated
- with the vCard.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
- Type special notes: The type is used to uniquely identify the object
- that the vCard represents.
-
- The type can include the type parameter "TYPE" to specify the format
- of the identifier. The TYPE parameter value should be an IANA
- registered identifier format. The value can also be a non-standard
- format.
-
- Type example:
-
- UID:19950401-080045-40000F192713-0052
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 24]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-3.6.8 URL Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type URL
-
- Type name: URL
-
- Type purpose: To specify a uniform resource locator associated with
- the object that the vCard refers to.
-
- Type encoding: 8bit
-
- Type value: A single uri value.
-
- Type example:
-
- URL:http://www.swbyps.restaurant.french/~chezchic.html
-
-3.6.9 VERSION Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type VERSION
-
- Type name: VERSION
-
- Type purpose: To specify the version of the vCard specification used
- to format this vCard.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
- Type special notes: The property MUST be present in the vCard object.
- The value MUST be "3.0" if the vCard corresponds to this
- specification.
-
- Type example:
-
- VERSION:3.0
-
-3.7 Security Types
-
- These types are concerned with the security of communication pathways
- or access to the vCard.
-
-
-
-
-
-Dawson & Howes Standards Track [Page 25]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-3.7.1 CLASS Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type CLASS
-
- Type name: CLASS
-
- Type purpose: To specify the access classification for a vCard
- object.
-
- Type encoding: 8bit
-
- Type value: A single text value.
-
- Type special notes: An access classification is only one component of
- the general security model for a directory service. The
- classification attribute provides a method of capturing the intent of
- the owner for general access to information described by the vCard
- object.
-
- Type examples:
-
- CLASS:PUBLIC
-
- CLASS:PRIVATE
-
- CLASS:CONFIDENTIAL
-
-3.7.2 KEY Type Definition
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of text/directory MIME type KEY
-
- Type name: KEY
-
- Type purpose: To specify a public key or authentication certificate
- associated with the object that the vCard represents.
-
- Type encoding: The encoding MUST be reset to "b" using the ENCODING
- parameter in order to specify inline, encoded binary data. If the
- value is a text value, then the default encoding of 8bit is used and
- no explicit ENCODING parameter is needed.
-
- Type value: A single value. The default is binary. It can also be
- reset to text value. The text value can be used to specify a text
- key.
-
-
-
-Dawson & Howes Standards Track [Page 26]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- Type special notes: The type can also include the type parameter TYPE
- to specify the public key or authentication certificate format. The
- parameter type should specify an IANA registered public key or
- authentication certificate format. The parameter type can also
- specify a non-standard format.
-
- Type example:
-
- KEY;ENCODING=b:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQA
- wdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENbW11bmljYX
- Rpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
- ZW1zMRwwGgYDVQQDExNyb290Y2EubmV0c2NhcGUuY29tMB4XDTk3MDYwNj
- E5NDc1OVoXDTk3MTIwMzE5NDc1OVowgYkxCzAJBgNVBAYTAlVTMSYwJAYD
- VQQKEx1OZXRzY2FwZSBDb21tdW5pY2F0aW9ucyBDb3JwLjEYMBYGA1UEAx
- MPVGltb3RoeSBBIEhvd2VzMSEwHwYJKoZIhvcNAQkBFhJob3dlc0BuZXRz
- Y2FwZS5jb20xFTATBgoJkiaJk/IsZAEBEwVob3dlczBcMA0GCSqGSIb3DQ
- EBAQUAA0sAMEgCQQC0JZf6wkg8pLMXHHCUvMfL5H6zjSk4vTTXZpYyrdN2
- dXcoX49LKiOmgeJSzoiFKHtLOIboyludF90CgqcxtwKnAgMBAAGjNjA0MB
- EGCWCGSAGG+EIBAQQEAwIAoDAfBgNVHSMEGDAWgBT84FToB/GV3jr3mcau
- +hUMbsQukjANBgkqhkiG9w0BAQQFAAOBgQBexv7o7mi3PLXadkmNP9LcIP
- mx93HGp0Kgyx1jIVMyNgsemeAwBM+MSlhMfcpbTrONwNjZYW8vJDSoi//y
- rZlVt9bJbs7MNYZVsyF1unsqaln4/vy6Uawfg8VUMk1U7jt8LYpo4YULU7
- UZHPYVUaSgVttImOHZIKi4hlPXBOhcUQ==
-
-3.8 Extended Types
-
- The types defined by this document can be extended with private types
- using the non-standard, private values mechanism defined in [RFC
- 2045]. Non-standard, private types with a name starting with "X-" may
- be defined bilaterally between two cooperating agents without outside
- registration or standardization.
-
-4. Formal Grammar
-
- The following formal grammar is provided to assist developers in
- building parsers for the vCard.
-
- This syntax is written according to the form described in RFC 2234,
- but it references just this small subset of RFC 2234 literals:
-
- ;*******************************************
- ; Commonly Used Literal Definition
- ;*******************************************
-
- ALPHA = %x41-5A / %x61-7A
- ; Latin Capital Letter A-Latin Capital Letter Z /
- ; Latin Small Letter a-Latin Small Letter z
-
-
-
-
-Dawson & Howes Standards Track [Page 27]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- CHAR = %x01-7F
- ; Any C0 Controls and Basic Latin, excluding NULL from
- ; Code Charts, pages 7-6 through 7-9 in [UNICODE]
-
- CR = %x0D
- ; Carriage Return
-
- LF = %0A
- ; Line Feed
-
- CRLF = CR LF
- ; Internet standard newline
-
- ;CTL = %x00-1F / %x7F
- ; Controls. Not used, but referenced in comments.
-
- DIGIT = %x30-39
- ; Digit Zero-Digit Nine
-
- DQUOTE = %x22
- ; Quotation Mark
-
- HTAB = %x09
- ; Horizontal Tabulation
-
- SP = %x20
- ; space
-
- VCHAR = %x21-7E
- ; Visible (printing) characters
-
- WSP = SP / HTAB
- ; White Space
-
- ;*******************************************
- ; Basic vCard Definition
- ;*******************************************
-
- vcard_entity = 1*(vcard)
-
- vcard = [group "."] "BEGIN" ":" "VCARD" 1*CRLF
- 1*(contentline)
- ;A vCard object MUST include the VERSION, FN and N types.
- [group "."] "END" ":" "VCARD" 1*CRLF
-
- contentline = [group "."] name *(";" param ) ":" value CRLF
- ; When parsing a content line, folded lines must first
- ; be unfolded according to the unfolding procedure
-
-
-
-Dawson & Howes Standards Track [Page 28]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- ; described above. When generating a content line, lines
- ; longer than 75 characters SHOULD be folded according to
- ; the folding procedure described in [MIME DIR].
-
- group = 1*(ALPHA / DIGIT / "-")
-
- name = iana-token / x-name
- ; Parsing of the param and value is
- ; based on the "name" or type identifier
- ; as defined in ABNF sections below
-
- iana-token = 1*(ALPHA / DIGIT / "-")
- ; vCard type or parameter identifier registered with IANA
-
- x-name = "X-" 1*(ALPHA / DIGIT / "-")
- ; Reserved for non-standard use
-
- param = param-name "=" param-value *("," param-value)
-
- param-name = iana-token / x-name
-
- param-value = ptext / quoted-string
-
- ptext = *SAFE-CHAR
-
- value = *VALUE-CHAR
-
- quoted-string = DQUOTE QSAFE-CHAR DQUOTE
-
- NON-ASCII = %x80-FF
- ; Use is restricted by CHARSET parameter
- ; on outer MIME object (UTF-8 preferred)
-
- QSAFE-CHAR = WSP / %x21 / %x23-7E / NON-ASCII
- ; Any character except CTLs, DQUOTE
-
- SAFE-CHAR = WSP / %x21 / %x23-2B / %x2D-39 / %x3C-7E / NON-ASCII
- ; Any character except CTLs, DQUOTE, ";", ":", ","
-
- VALUE-CHAR = WSP / VCHAR / NON-ASCII
- ; Any textual character
-
- ;*******************************************
- ; vCard Type Definition
- ;
- ; Provides type-specific definitions for how the
- ; "value" and "param" are defined.
- ;*******************************************
-
-
-
-Dawson & Howes Standards Track [Page 29]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- ;For name="NAME"
- param = ""
- ; No parameters allowed
-
- value = text-value
-
- ;For name="PROFILE"
- param = ""
- ; No parameters allowed
-
- value = text-value
- ; Value MUST be the case insensitive value "VCARD
-
- ;For name="SOURCE"
- param = source-param
- ; No parameters allowed
-
- value = uri
-
- source-param = ("VALUE" "=" "uri")
- / ("CONTEXT" "=" "word")
- ; Parameter value specifies the protocol context
- ; for the uri value.
- / (x-name "=" *SAFE-CHAR)
-
- ;For name="FN"
- ;This type MUST be included in a vCard object.
- param = text-param
- ; Text parameters allowed
-
- value = text-value
-
- ;For name="N"
- ;This type MUST be included in a vCard object.
-
- param = text-param
- ; Text parameters allowed
-
- value = n-value
-
- n-value = 0*4(text-value *("," text-value) ";")
- text-value *("," text-value)
- ; Family; Given; Middle; Prefix; Suffix.
- ; Example: Public;John;Quincy,Adams;Reverend Dr. III
-
- ;For name="NICKNAME"
- param = text-param
- ; Text parameters allowed
-
-
-
-Dawson & Howes Standards Track [Page 30]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- value = text-list
-
- ;For name="PHOTO"
- param = img-inline-param
- ; Only image parameters allowed
-
- param =/ img-refer-param
- ; Only image parameters allowed
-
- value = img-inline-value
- ; Value and parameter MUST match
-
- value =/ img-refer-value
- ; Value and parameter MUST match
-
- ;For name="BDAY"
- param = ("VALUE" "=" "date")
- ; Only value parameter allowed
-
- param =/ ("VALUE" "=" "date-time")
- ; Only value parameter allowed
-
- value = date-value
- ; Value MUST match value type
-
- value =/ date-time-value
- ; Value MUST match value type
-
- ;For name="ADR"
- param = adr-param / text-param
- ; Only adr and text parameters allowed
-
- value = adr-value
-
- ;For name="LABEL"
- param = adr-param / text-param
- ; Only adr and text parameters allowed
-
- value = text-value
-
- ;For name="TEL"
- param = tel-param
- ; Only tel parameters allowed
-
- value = phone-number-value
-
- tel-param = "TYPE" "=" tel-type *("," tel-type)
-
-
-
-
-Dawson & Howes Standards Track [Page 31]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- tel-type = "HOME" / "WORK" / "PREF" / "VOICE" / "FAX" / "MSG"
- / "CELL" / "PAGER" / "BBS" / "MODEM" / "CAR" / "ISDN"
- / "VIDEO" / "PCS" / iana-token / x-name
- ; Values are case insensitive
-
- ;For name="EMAIL"
- param = email-param
- ; Only email parameters allowed
-
- value = text-value
-
- email-param = "TYPE" "=" email-type ["," "PREF"]
- ; Value is case insensitive
-
- email-type = "INTERNET" / "X400" / iana-token / "X-" word
- ; Values are case insensitive
-
- ;For name="MAILER"
- param = text-param
- ; Only text parameters allowed
-
- value = text-value
-
- ;For name="TZ"
- param = ""
- ; No parameters allowed
-
- value = utc-offset-value
-
- ;For name="GEO"
- param = ""
- ; No parameters allowed
-
- value = float-value ";" float-value
-
- ;For name="TITLE"
- param = text-param
- ; Only text parameters allowed
-
- value = text-value
-
- ;For name="ROLE"
- param = text-param
- ; Only text parameters allowed
-
- value = text-value
-
- ;For name="LOGO"
-
-
-
-Dawson & Howes Standards Track [Page 32]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- param = img-inline-param / img-refer-param
- ; Only image parameters allowed
-
- value = img-inline-value / img-refer-value
- ; Value and parameter MUST match
-
- ;For name="AGENT"
- param = agent-inline-param
-
- param =/ agent-refer-param
-
- value = agent-inline-value
- ; Value and parameter MUST match
-
- value =/ agent-refer-value
- ; Value and parameter MUST match
-
- agent-inline-param = ""
- ; No parameters allowed
-
- agent-refer-param = "VALUE" "=" "uri"
- ; Only value parameter allowed
-
- agent-inline-value = text-value
- ; Value MUST be a valid vCard object
-
- agent-refer-value = uri
- ; URI MUST refer to image content of given type
-
- ;For name="ORG"
-
- param = text-param
- ; Only text parameters allowed
-
- value = org-value
-
- org-value = *(text-value ";") text-value
- ; First is Organization Name, remainder are Organization Units.
-
- ;For name="CATEGORIES"
- param = text-param
- ; Only text parameters allowed
-
- value = text-list
-
- ;For name="NOTE"
- param = text-param
- ; Only text parameters allowed
-
-
-
-Dawson & Howes Standards Track [Page 33]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- value = text-value
-
- ;For name="PRODID"
- param = ""
- ; No parameters allowed
-
- value = text-value
-
- ;For name="REV"
- param = ["VALUE" =" "date-time"]
- ; Only value parameters allowed. Values are case insensitive.
-
- param =/ "VALUE" =" "date"
- ; Only value parameters allowed. Values are case insensitive.
-
- value = date-time-value
-
- value =/ date-value
-
- ;For name="SORT-STRING"
- param = text-param
- ; Only text parameters allowed
-
- value = text-value
-
- ;For name="SOUND"
- param = snd-inline-param
- ; Only sound parameters allowed
-
- param =/ snd-refer-param
- ; Only sound parameters allowed
-
- value = snd-line-value
- ; Value MUST match value type
-
- value =/ snd-refer-value
- ; Value MUST match value type
-
- snd-inline-value = binary-value CRLF
- ; Value MUST be "b" encoded audio content
-
- snd-inline-param = ("VALUE" "=" "binary"])
- / ("ENCODING" "=" "b")
- / ("TYPE" "=" *SAFE-CHAR)
- ; Value MUST be an IANA registered audio type
-
- snd-refer-value = uri
- ; URI MUST refer to audio content of given type
-
-
-
-Dawson & Howes Standards Track [Page 34]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- snd-refer-param = ("VALUE" "=" "uri")
- / ("TYPE" "=" word)
- ; Value MUST be an IANA registered audio type
-
- ;For name="UID"
- param = ""
- ; No parameters allowed
-
- value = text-value
-
- ;For name="URL"
- param = ""
- ; No parameters allowed
-
- value = uri
-
- ;For name="VERSION"
- ;This type MUST be included in a vCard object.
- param = ""
- ; No parameters allowed
-
- value = text-value
- ; Value MUST be "3.0"
-
- ;For name="CLASS"
- param = ""
- ; No parameters allowed
-
- value = "PUBLIC" / "PRIVATE" / "CONFIDENTIAL"
- / iana-token / x-name
- ; Value are case insensitive
-
- ;For name="KEY"
- param = key-txt-param
- ; Only value and type parameters allowed
-
- param =/ key-bin-param
- ; Only value and type parameters allowed
-
- value = text-value
-
- value =/ binary-value
-
- key-txt-param = "TYPE" "=" keytype
-
- key-bin-param = ("TYPE" "=" keytype)
- / ("ENCODING" "=" "b")
- ; Value MUST be a "b" encoded key or certificate
-
-
-
-Dawson & Howes Standards Track [Page 35]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- keytype = "X509" / "PGP" / iana-token / x-name
- ; Values are case insensitive
-
- ;For name="X-" non-standard type
- param = text-param / (x-name "=" param-value)
- ; Only text or non-standard parameters allowed
-
- value = text-value
-
- ;*******************************************
- ; vCard Commonly Used Parameter Definition
- ;*******************************************
-
- text-param = ("VALUE" "=" "ptext")
- / ("LANGUAGE" "=" langval)
- / (x-name "=" param-value)
-
- langval = <a language string as defined in RFC 1766>
-
- img-inline-value = binary-value
- ;Value MUST be "b" encoded image content
-
- img-inline-param
-
- img-inline-param = ("VALUE" "=" "binary")
- / ("ENCODING" "=" "b")
- / ("TYPE" "=" param-value
- ;TYPE value MUST be an IANA registered image type
-
- img-refer-value = uri
- ;URI MUST refer to image content of given type
-
- img-refer-param = ("VALUE" "=" "uri")
- / ("TYPE" "=" param-value)
- ;TYPE value MUST be an IANA registered image type
-
- adr-param = ("TYPE" "=" adr-type *("," adr-type))
- / (text-param)
-
- adr-type = "dom" / "intl" / "postal" / "parcel" / "home"
- / "work" / "pref" / iana-type / x-name
-
- adr-value = 0*6(text-value ";") text-value
- ; PO Box, Extended Address, Street, Locality, Region, Postal
- ; Code, Country Name
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 36]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- ;*******************************************
- ; vCard Type Value Definition
- ;*******************************************
-
- text-value-list = 1*text-value *("," 1*text-value)
-
- text-value = *(SAFE-CHAR / ":" / DQUOTE / ESCAPED-CHAR)
-
- ESCAPED-CHAR = "\\" / "\;" / "\," / "\n" / "\N")
- ; \\ encodes \, \n or \N encodes newline
- ; \; encodes ;, \, encodes ,
-
- binary-value = <A "b" encoded text value as defined in [RFC 2047]>
-
- date-value = <A single date value as defined in [MIME-DIR]>
-
- time-value = <A single time value as defined in [MIME-DIR]>
-
- date-time-value = <A single date-time value as defined in [MIME-DIR]
-
- float-value = <A single float value as defined in [MIME-DIR]>
-
- phone-number-value = <A single text value as defined in [CCITT
- E.163] and [CCITT X.121]>
-
- uri-value = <A uri value as defined in [MIME-DIR]>
-
- utc-offset-value = ("+" / "-") time-hour ":" time-minute
- time-hour = 2DIGIT ;00-23
- time-minute = 2DIGIT ;00-59
-
-5. Differences From vCard v2.1
-
- This specification has been reviewed by the IETF community. The
- review process introduced a number of differences from the [VCARD]
- version 2.1. These differences require that vCard objects conforming
- to this specification have a different version number than a vCard
- conforming to [VCARD]. The differences include the following:
-
- . The QUOTED-PRINTABLE inline encoding has been eliminated.
- Only the "B" encoding of [RFC 2047] is an allowed value for
- the ENCODING parameter.
-
- . The method for specifying CRLF character sequences in text
- type values has been changed. The CRLF character sequence in
- a text type value is specified with the backslash character
- sequence "\n" or "\N".
-
-
-
-
-Dawson & Howes Standards Track [Page 37]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- . Any COMMA or SEMICOLON in a text type value must be backslash
- escaped.
-
- . VERSION value corresponding to this specification MUST be
- "3.0".
-
- . The [MIME-DIR] predefined types of SOURCE, NAME and PROFILE
- are allowed.
-
- . The [MIME-DIR] VALUE type parameter for value data typing is
- allowed. In addition, there are extensions made to these type
- values for additional value types used in this specification.
-
- . The [VCARD] CHARSET type parameter has been eliminated.
- Character set can only be specified on the CHARSET parameter
- on the Content-Type MIME header field.
-
- . The [VCARD] support for non-significant WSP character has
- been eliminated.
-
- . The "TYPE=" prefix to parameter values is required. In
- [VCARD] this was optional.
-
- . LOGO, PHOTO and SOUND multimedia formats MUST be either IANA
- registered types or non-standard types.
-
- . Inline binary content must be "B" encoded and folded. A blank
- line after the encoded binary content is no longer required.
-
- . TEL values can be identified as personal communication
- services telephone numbers with the PCS type parameter value.
-
- . The CATEGORIES, CLASS, NICKNAME, PRODID and SORT-STRING types
- have been added.
-
- . The VERSION, N and FN types MUST be specified in a vCard.
- This identifies the version of the specification that the
- object was formatted to. It also assures that every vCard
- will include both a structured and formatted name that can be
- used to identify the object.
-
-
-
-
-
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 38]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-6. Acknowledgements
-
- The many valuable comments contributed by members of the IETF ASID
- working group are gratefully acknowledged, as are the contributions
- by Roland Alden, Stephen Bartlett, Alec Dun, Patrik Faltstrom, Daniel
- Gurney, Bruce Johnston, Daniel Klaussen, Pete Miller, Keith Moore,
- Vinod Seraphin, Michelle Watkins. Chris Newman was especially helpful
- in navigating the intricacies of ABNF lore.
-
-7. Authors' Addresses
-
- BEGIN:vCard
- VERSION:3.0
- FN:Frank Dawson
- ORG:Lotus Development Corporation
- ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
- ;Raleigh;NC;27613-3502;U.S.A.
- TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
- TEL;TYPE=FAX,WORK:+1-919-676-9564
- EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
- EMAIL;TYPE=INTERNET:fdawson@earthlink.net
- URL:http://home.earthlink.net/~fdawson
- END:vCard
-
-
- BEGIN:vCard
- VERSION:3.0
- FN:Tim Howes
- ORG:Netscape Communications Corp.
- ADR;TYPE=WORK:;;501 E. Middlefield Rd.;Mountain View;
- CA; 94043;U.S.A.
- TEL;TYPE=VOICE,MSG,WORK:+1-415-937-3419
- TEL;TYPE=FAX,WORK:+1-415-528-4164
- EMAIL;TYPE=INTERNET:howes@netscape.com
- END:vCard
-
-8. Security Considerations
-
- vCards can carry cryptographic keys or certificates, as described in
- Section 3.7.2.
-
- Section 3.7.1 specifies a desired security classification policy for
- a particular vCard. That policy is not enforced in any way.
-
- The vCard objects have no inherent authentication or privacy, but can
- easily be carried by any security mechanism that transfers MIME
- objects with authentication or privacy. In cases where threats of
- "spoofed" vCard information is a concern, the vCard SHOULD BE
-
-
-
-Dawson & Howes Standards Track [Page 39]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- transported using one of these secure mechanisms.
-
- The information in a vCard may become out of date. In cases where the
- vitality of data is important to an originator of a vCard, the "URL"
- type described in section 3.6.8 SHOULD BE specified. In addition, the
- "REV" type described in section 3.6.4 can be specified to indicate
- the last time that the vCard data was updated.
-
-9. References
-
- [ISO 8601] ISO 8601:1988 - Data elements and interchange formats -
- Information interchange - Representation of dates and
- times - The International Organization for
- Standardization, June, 1988.
-
- [ISO 8601 TC] ISO 8601, Technical Corrigendum 1 - Data elements and
- interchange formats - Information interchange -
- Representation of dates and times - The International
- Organization for Standardization, May, 1991.
-
- [ISO 9070] ISO 9070, Information Processing - SGML support
- facilities - Registration Procedures for Public Text
- Owner Identifiers, April, 1991.
-
- [CCITT E.163] Recommendation E.163 - Numbering Plan for The
- International Telephone Service, CCITT Blue Book,
- Fascicle II.2, pp. 128-134, November, 1988.
-
- [CCITT X.121] Recommendation X.121 - International Numbering Plan for
- Public Data Networks, CCITT Blue Book, Fascicle VIII.3,
- pp. 317-332, November, 1988.
-
- [CCITT X.520] Recommendation X.520 - The Directory - Selected
- Attribute Types, November 1988.
-
- [CCITT X.521] Recommendation X.521 - The Directory - Selected Object
- Classes, November 1988.
-
- [MIME-DIR] Howes, T., Smith, M., and F. Dawson, "A MIME Content-
- Type for Directory Information", RFC 2425, September
- 1998.
-
- [RFC 1738] Berners-Lee, T., Masinter, L., and M. McCahill,
- "Uniform Resource Locators (URL)", RFC 1738, December
- 1994.
-
- [RFC 1766] Alvestrand, H., "Tags for the Identification of
- Languages", RFC 1766, March 1995.
-
-
-
-Dawson & Howes Standards Track [Page 40]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
- [RFC 1872] Levinson, E., "The MIME Multipart/Related Content-
- type", RFC 1872, December 1995.
-
- [RFC 2045] Freed, N., and N. Borenstein, "Multipurpose Internet
- Mail Extensions (MIME) - Part One: Format of Internet
- Message Bodies", RFC 2045, November 1996.
-
- [RFC 2046] Freed, N., and N. Borenstein, "Multipurpose Internet
- Mail Extensions (MIME) - Part Two: Media Types", RFC
- 2046, November 1996.
-
- [RFC 2047] Moore, K., "Multipurpose Internet Mail Extensions
- (MIME) - Part Three: Message Header Extensions for
- Non-ASCII Text", RFC 2047, November 1996.
-
- [RFC 2048] Freed, N., Klensin, J., and J. Postel, "Multipurpose
- Internet Mail Extensions (MIME) - Part Four:
- Registration Procedures", RFC 2048, January 1997.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", BCP 14, RFC 2119, March 1997.
-
- [RFC 2234] Crocker, D., and P. Overell, "Augmented BNF for Syntax
- Specifications: ABNF", RFC 2234, November 1997.
-
- [UNICODE] "The Unicode Standard - Version 2.0", The Unicode
- Consortium, July 1996.
-
- [VCARD] Internet Mail Consortium, "vCard - The Electronic
- Business Card Version 2.1",
- http://www.imc.org/pdi/vcard-21.txt, September 18,
- 1996.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 41]
-
-RFC 2426 vCard MIME Directory Profile September 1998
-
-
-10. Full Copyright Statement
-
- Copyright (C) The Internet Society (1998). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Dawson & Howes Standards Track [Page 42]
-
diff --git a/addressbook/backend/ebook/docs/rfc2739.txt b/addressbook/backend/ebook/docs/rfc2739.txt
deleted file mode 100644
index 5c1dbbcf77..0000000000
--- a/addressbook/backend/ebook/docs/rfc2739.txt
+++ /dev/null
@@ -1,899 +0,0 @@
-
-
-
-
-
-
-Network Working Group T. Small
-Request for Comments: 2739 XpertSite.Com
-Category: Standards Track D. Hennessy
- ISOCOR
- F. Dawson
- Lotus
- January 2000
-
-
- Calendar Attributes for vCard and LDAP
-
-
-Status of this Memo
-
- This document specifies an Internet standards track protocol for the
- Internet community, and requests discussion and suggestions for
- improvements. Please refer to the current edition of the "Internet
- Official Protocol Standards" (STD 1) for the standardization state
- and status of this protocol. Distribution of this memo is unlimited.
-
-Copyright Notice
-
- Copyright (C) The Internet Society (2000). All Rights Reserved.
-
-Abstract
-
- When scheduling a calendar entity, such as an event, it is a
- prerequisite that an organizer has the calendar address of each
- attendee that will be invited to the event. Additionally, access to
- an attendee's current "busy time" provides an a priori indication of
- whether the attendee will be free to participate in the event.
-
- In order to meet these challenges, a calendar user agent (CUA) needs
- a mechanism to locate (URI) individual user's calendar and free/busy
- time.
-
- This memo defines three mechanisms for obtaining a URI to a user's
- calendar and free/busy time. These include:
-
- - Manual transfer of the information;
-
- - Personal data exchange using the vCard format; and
-
- - Directory lookup using the LDAP protocol.
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 1]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
-Table of Contents
-
- 1 CALENDARING AND SCHEDULING URIS...................................3
- 1.1 FREE/BUSY URI (FBURL) .........................................3
- 1.2 CALENDAR ACCESS URI (CAPURI) ..................................4
- 1.3 CALENDAR URI (CALURI) .........................................4
- 1.4 DEFAULT URIS ..................................................4
- 2 DISTRIBUTION......................................................4
- 2.1 MANUAL TRANSFER ...............................................5
- 2.2 PERSONAL DATA EXCHANGE USING A VCARD ..........................5
- 2.3 VCARD SCHEMA EXTENSIONS .......................................5
- 2.3.1 FBURL Property IANA Registration ...........................6
- 2.3.2 CALADRURI Property IANA Registration .......................7
- 2.3.3 CAPURI Property IANA Registration ......................... 8
- 2.3.4 CALURI Property IANA Registration ......................... 8
- 2.4 DIRECTORY LOOKUP USING THE LDAP V3 PROTOCOL .................. 9
- 2.4.1 LDAP Schema Extensions .................................... 9
- 2.4.2 Notation ..................................................10
- 2.4.3 Object Definitions ........................................10
- 2.4.3.1 calEntry ..............................................10
- 2.4.4 Attribute Definitions .....................................10
- 2.4.4.1 calCalURI .............................................10
- 2.4.4.2 calFBURL ..............................................10
- 2.4.4.3 calCAPURI .............................................11
- 2.4.4.4 calCalAdrURI ..........................................11
- 2.4.4.5 calOtherCalURIs .......................................11
- 2.4.4.6 calOtherFBURLs ........................................11
- 2.4.4.7 calOtherCAPURIs .......................................12
- 2.4.4.8 calOtherCalAdrURIs ....................................12
- 3 IANA Considerations..............................................12
- 4 Security Considerations..........................................12
- 5 Acknowledgments..................................................13
- 6 Authors' Addresses...............................................13
- 7 Bibliography.....................................................15
- 8 Full Copyright Statement.........................................16
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 2]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
-1 Calendaring and Scheduling URIs
-
- This memo defines four classes of URIs. URIs are more useful if it is
- understood what the URIs point to. Here is a brief description:
-
-1.1 Free/Busy URI (FBURL)
-
- The free/busy URI is defined to be a transport independent location
- where a client can obtain information about when a user is busy. At
- the present time, this URI only points to busy time data. Future
- revisions of this specification may provide for the extended
- capability of publishing free time data.
-
- If a calendaring and scheduling client (i.e., CUA) were to retrieve
- data from this location using FTP or HTTP, it would get back an
- iCalendar object [4] containing one or more "VFREEBUSY" calendar
- components. If a MIME transport is being used, the response will be
- contained within a "text/calendar" MIME body part as specified in the
- iCalendar specification [4]. For example:
-
- BEGIN:VCALENDAR
- VERSION:2.0
- PRODID:-//hacksw/handcal//NONSGML v1.0//EN
- METHOD:PUBLISH
- BEGIN:VFREEBUSY
- ATTENDEE:MAILTO:jane_doe@host1.com
- DTSTART:19971013T050000Z
- DTEND:19971124T050000Z
- DTSTAMP:19970901T083000Z
- FREEBUSY:19971015T133000Z/19971015T180000Z
- FREEBUSY:19971015T190000Z/19971015T220000Z
- FBURL:http://www.host.com/calendar/busy/jdoe.ifb
- END:VFREEBUSY
- END:VCALENDAR
-
- The amount of busy time data pointed to by the FBURL will generally
- be pre-determined; for example one month of busy time data. As a
- guideline, it is recommended that the previous six weeks of busy time
- data be published at the location associated with the FBURL. If this
- URI points to a file resource, it is recommended that the file
- extension be "ifb" to distinguish it from an arbitrary iCalendar
- object (e.g., with the "ics" file extension).
-
-
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 3]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
-1.2 Calendar Access URI (CAPURI)
-
- The Calendar Access URI is defined to be a protocol independent
- location from which a calendaring and scheduling client (i.e., CUA)
- can communicate with a user's entire calendar.
-
- The semantics for using this URI as an access protocol locator are
- yet to be defined by the IETF CALSCH Working Group. This will be
- addressed in the "Calendar Access Protocol" specification.
-
-1.3 Calendar URI (CALURI)
-
- The Calendar URI is defined to be a protocol independent location
- from which a calendaring and scheduling client (i.e. CUA) can
- retrieve an entire copy of a user's calendar. Retrieving data from
- this URI obtains a published "snapshot" of the user's calendar.
-
- HTTP URI -- If the URI is an HTTP URI, then the content returned with
- a GET should be a "text/calendar" MIME body part containing one or
- more iCalendar object.
-
- FTP URI -- If the URI is an FTP URI, then the resource pointed to
- should be a file with an "ics" file extension containing one or more
- iCalendar objects.
-
-1.4 Default URIs
-
- There are many cases where a user may have more than one calendar. In
- these cases, a user may have multiple URIs, each URI pointing to a
- calendar or free/busy data.
-
- To make the case of multiple calendars simpler for clients, the
- concept of the "default" calendar is introduced. A "default" calendar
- is one that the user has designated as the calendar that other users
- should look at when accessing the user's calendar, or retrieving the
- user's free/busy time.
-
- The default calendar may, in fact, include rolled-up information from
- all the user's other calendars. The other calendars may only exist
- for organizational purposes.
-
-2 Distribution
-
- These four URIs provide valuable pointers to calendaring and
- scheduling data that other users need in order to know when to
- schedule meetings, etc. There are several possibilities on how users
- can communicate these URIs to other users. The following section
- outlines how these URIs can be distributed to other users.
-
-
-
-Small, et al. Standards Track [Page 4]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
-2.1 Manual Transfer
-
- The simplest way to obtain these URIs is for a user to communicate
- the URIs using some out-of-band mechanism such as verbally, or in an
- e-mail message, or by printing these URIs on a paper business card.
-
- When using this mechanism, the user obtains these URIs using an out-
- of-band mechanism and then enters these URIs into their calendaring
- software manually.
-
-2.2 Personal Data Exchange Using A vCard
-
- A more sophisticated way to obtain these URIs is for users to publish
- vCards containing these URIs. The vCard object can be transferred
- between one another. Since many e-mail clients allow a user to
- automatically include a vCard with every message that the user sends,
- this provides a simple, transparent way for a user to distribute
- their calendaring and scheduling URIs.
-
- On the receiving end, an e-mail client that provides an integrated
- vCard database can provide a way to lookup calendaring URIs for users
- whose vCards are stored locally.
-
-2.3 vCard Schema Extensions
-
- Since the vCard [3] specification doesn't specify how to encode
- calendaring URIs in a vCard, this section is provided as an extension
- to vCard which specifies how to encode calendaring URIs within a
- vCard.
-
- Inside a vCard object, four new properties are defined: "CALURI",
- "CAPURI", "CALADRURI", and "FBURL", as defined above.
-
- Any vCard can have one or more of these properties, each representing
- a calendar or free/busy time that is associated with the user.
-
- One of these properties can be designated as the "default" by adding
- the "PREF" parameter.
-
-
-
-
-
-
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 5]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
- Here is a simple example of a vCard containing a "FBURL" and a
- "CALURI".
-
- BEGIN:VCARD
- VERSION:3.0
- N:Dun;Alec
- FN:Alec Dun
- ORG:Microsoft Corporation
- ADR;WORK;POSTAL;PARCEL:;;One Microsoft Way;
- Redmond;WA;98052-6399;USA
- TEL;WORK;MSG:+1-206-936-4544
- TEL;WORK;FAX:+1-206-936-7329
- EMAIL;INTERNET:user@host1.com
- CALADRURI;PREF:mailto:user@host1.com
- CALURI;PREF:http://cal.host1.com/user/cal.ics
- FBURL;PREF:http://cal.host1.com/user/fb.ifb
- CALURI:http://cal.company.com/projectA/pjtA.ics
- FBURL:http://cal.company.com/projectA/pjtAfb.ifb
- END:VCARD
-
-2.3.1 FBURL Property IANA Registration
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of FBURL type for text/directory MIME type
- vCard profile.
-
- Type name: FBURL
-
- Type purpose: To specify the URI for a user's busy time in a vCard
- object.
-
- Type encoding: 8bit
-
- Type value: A single URI value.
-
- Type special notes: Where multiple FBURL properties are specified,
- the default FBURL property is indicated with the PREF parameter. The
- FTP or HTTP type of URI points to an iCalendar object associated with
- a snapshot of the last six weeks of the user's busy time data. If the
- iCalendar object is represented as a file or document, it's file type
- should be "ifb".
-
- Intended usage: Refer to section 1.1.
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 6]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
- Type examples:
-
- FBURL;PREF:http://www.host1.com/busy/janedoe
- FBURL:FTP://ftp.host.com/busy/project-a.ifb
-
-2.3.2 CALADRURI Property IANA Registration
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of CALADRURI type for application/directory
- MIME type vCard profile.
-
- Type name: CALADRURI
-
- Type purpose: To specify the location to which an event request
- should be sent for the user.
-
- Type encoding: 8bit
-
- Type value: A single URI value.
-
- Type special notes: Where multiple CALADRURI properties are
- specified, the default CALADRURI property is indicated with the PREF
- parameter.
-
- Intended usage: Refer to section 1.2.
-
- Type examples:
-
- CALADRURI;PREF:mailto:janedoe@host.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 7]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
-2.3.3 CAPURI Property IANA Registration
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of CAPURI type for application/directory MIME
- type vCard profile.
-
- Type name: CAPURI
-
- Type purpose: To specify a protocol independent location from which a
- calendaring and scheduling client (i.e., CUA) can communicate with a
- user's entire calendar.
-
- Type encoding: 8bit
-
- Type value: A single URI value.
-
- Type special notes: Where multiple CAPURI properties are specified,
- the default CAPURI property is indicated with the PREF parameter.
-
- Intended usage: Refer to section 1.3.
-
-2.3.4 CALURI Property IANA Registration
-
- To: ietf-mime-directory@imc.org
-
- Subject: Registration of CALURI type for text/directory MIME type
- vCard profile.
-
- Type name: CALURI
-
- Type purpose: To specify the URI for a user's calendar in a vCard
- object.
-
- Type encoding: 8bit
-
- Type value type: A single URI value.
-
- Type special notes: Where multiple CALURI properties are specified,
- the default CALURI property is indicated with the PREF parameter. The
- property should contain a URI pointing to an iCalendar object
- associated with a snapshot of the user's calendar store. If the
- iCalendar object is represented as a file or document, it's file type
- should be "ics".
-
- Intended usage: Refer to section 1.4.
-
-
-
-
-
-Small, et al. Standards Track [Page 8]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
- Type examples:
-
- CALURI;PREF:http://cal.host1.com/calA
- CALURI:ftp://ftp.host1.com/calA.ics
-
-2.4 Directory Lookup Using The LDAP v3 Protocol
-
- Another way to obtain these URIs is to look them up in a directory
- using the LDAP protocol [1].
-
- If a user's URIs can be found using directory lookup (i.e., searching
- for one of the LDAP schema extensions defined below), they should, in
- general, be considered "more up-to-date" than URIs in any vCards that
- are stored locally.
-
-2.4.1 LDAP Schema Extensions
-
- In order to encode the calendaring URIs in the directory, the
- following are defined:
-
- - One object class:
-
- - calEntry
-
- - Eight attributes:
-
- - calCalURI
-
- - calFBURL
-
- - calCAPURI
-
- - calCalAdrURI
-
- - calOtherCalURIs
-
- - calOtherFBURLs
-
- - calOtherCAPURIs
-
- - calOtherCalAdrURIs
-
- The calCalURI contains the URI to a snapshot of the user's entire
- default calendar. The calFBURL contains the URI to the user's default
- busy time data. The calCAPURI represents contains a URI that can be
- used to communicate with the user's calendar. The calCalAdrURI
- contains a URI that points to the location to which event requests
- should be sent for that user.
-
-
-
-Small, et al. Standards Track [Page 9]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
- The calOtherCalURIs is a multi-valued property containing URIs to
- snapshots of other calendars that the user may have. The
- calOtherFBURLs is a multi-valued property containing URIs to other
- free/busy data that the user may have. The calOtherCAPURIs attribute
- is a multi-valued property containing URIs to other calendars that
- the user may have. The calOtherCalAdrURIs attribute is a multi-valued
- property containing URIs to other locations that a user may want
- event requests sent to.
-
- There is no predetermined order to the values in either multi-valued
- property.
-
-2.4.2 Notation
-
- The notation used in this memo is the same as that used in [2].
-
-2.4.3 Object Definitions
-
-2.4.3.1 calEntry
-
- The Calendar Entry is a class derived from "TOP" [2], which contains
- the four calendaring attributes.
-
- (1.2.840.113556.1.5.87
- NAME 'calEntry'
- TOP
- AUXILIARY
- MAY (calCalURI calFBURL calOtherCalURIs calOtherFBURLs calCAPURI
- calOtherCAPURLs)
- )
-
-2.4.4 Attribute Definitions
-
-2.4.4.1 calCalURI
-
- (1.2.840.113556.1.4.478
- NAME 'calCalURI'
- EQUALITY caseIgnoreMatch
- SUBSTRING caseIgnoreMatch
- SYNTAX 'IA5String'
- USAGE userApplications
- )
-
-2.4.4.2 calFBURL
-
- (1.2.840.113556.1.4.479
- NAME 'calFBURL'
- EQUALITY caseIgnoreMatch
-
-
-
-Small, et al. Standards Track [Page 10]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
- SUBSTRING caseIgnoreMatch
- SYNTAX 'IA5String'
- USAGE userApplications
- )
-
-2.4.4.3 calCAPURI
-
- (1.2.840.113556.1.4.480
- NAME 'calCAPURI'
- EQUALITY caseIgnoreMatch
- SUBSTRING caseIgnoreMatch
- SYNTAX 'IA5String'
- USAGE userApplications
- )
-
-2.4.4.4 calCalAdrURI
-
- (1.2.840.113556.1.4.481
- NAME 'calCalAdrURI'
- EQUALITY caseIgnoreMatch
- SUBSTRING caseIgnoreMatch
- SYNTAX 'IA5String'
- USAGE userApplications
- )
-
-2.4.4.5 calOtherCalURIs
-
- (1.2.840.113556.1.4.482
- NAME 'calOtherCalURIs'
- EQUALITY caseIgnoreMatch
- SUBSTRING caseIgnoreMatch
- SYNTAX 'IA5String'
- MULTI-VALUE
- USAGE userApplications
- )
-
-2.4.4.6 calOtherFBURLs
-
- (1.2.840.113556.1.4.483
- NAME 'calOtherFBURLs'
- EQUALITY caseIgnoreMatch
- SUBSTRING caseIgnoreMatch
- SYNTAX 'IA5String'
- MULTI-VALUE
- USAGE userApplications
- )
-
-
-
-
-
-Small, et al. Standards Track [Page 11]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
-2.4.4.7 calOtherCAPURIs
-
- (1.2.840.113556.1.4.484
- NAME 'calOtherCAPURIs'
- EQUALITY caseIgnoreMatch
- SUBSTRING caseIgnoreMatch
- SYNTAX 'IA5String'
- MULTI-VALUE
- USAGE userApplications
- )
-
-2.4.4.8 calOtherCalAdrURIs
-
- (1.2.840.113556.1.4.485
- NAME 'calOtherCalAdrURIs'
- EQUALITY caseIgnoreMatch
- SUBSTRING caseIgnoreMatch
- SYNTAX 'IA5String'
- MULTI-VALUE
- USAGE userApplications
- )
-
-3 IANA Considerations
-
- This memo defines IANA registered extensions to the attributes
- defined by LDAP [1] and vCard [3].
-
- IANA registration proposals for vCard are to be emailed to the
- registration agent for the "text/directory" MIME content-type,
- <MAILTO: ietf-mime-directory@imc.org> using the format defined in
- [3].
-
-4 Security Considerations
-
- Standard vCard and LDAP security rules and support apply for the
- extensions described in this document, and there are no special
- security issues for these extensions.
-
- Please note, though, that LDAP servers may permit anonymous clients
- to refresh entries which they did not create. Servers are also
- permitted to control a refresh access to an entry by requiring
- clients to bind before issuing a RefreshRequest. This will have
- implications on the server performance and scalability.
-
- Please also note, though, that vCard objects may have been created by
- an entity other than that represented by the vCard. Recipients should
- be certain of the source that generated the vCard.
-
-
-
-
-Small, et al. Standards Track [Page 12]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
- Also, care should be taken in making use of information obtained from
- directory servers that has been supplied by client, as it may now be
- out of date. In many networks, for example, IP addresses are
- automatically assigned when a host connects to the network, and may
- be reassigned if that host later disconnects. An IP address obtained
- from the directory may no longer be assigned to the host that placed
- the address in the directory. This issue is not specific to LDAP or
- dynamic directories.
-
-5 Acknowledgments
-
- The authors wish to acknowledge the work of Alec Dun, who acted as an
- author for the early drafts of this memo. In addition, this document
- received input from the various participants in the IETF CALSCH
- Working Group discussions.
-
-6 Authors' Addresses
-
- The following address information is provided in a vCard v3.0 [3],
- Electronic Business Card, format.
-
- BEGIN:VCARD
- VERSION:3.0
- N:Small;Tony
- FN:Tony Small
- ORG:XpertSite.Com
- ADR;TYPE=WORK,POSTAL,PARCEL:;;4700 42nd Ave. SW, Suite 440;
- Seattle;WA;98116;USA
- TEL;TYPE=WORK,MSG:+1-206-937-9972
- TEL;TYPE=WORK,FAX:+1-206-936-7329
- EMAIL;TYPE=INTERNET:tony@xpertsite.com
- CALADRURI:MAILTO:tony@xpertsite.com
- END:VCARD
-
- BEGIN:VCARD
- VERSION:3.0
- N:Hennessy;Denis
- FN:Denis Hennessy
- ORG:ISOCOR
- ADR;TYPE=WORK,POSTAL,PARCEL:;;42-47 Lower Mount St;
- Dublin 2;Ireland
- TEL;TYPE=WORK,MSG:+353-1-676-0366
- TEL;TYPE=WORK,FAX:+353-1-676-0856
- EMAIL;TYPE=INTERNET:denis.hennessy@isocor.com
- CALADRURI:MAILTO:denis.hennessy@isocor.com
- END:VCARD
-
-
-
-
-
-Small, et al. Standards Track [Page 13]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
- BEGIN:VCARD
- VERSION:3.0
- N:Dawson;Frank
- FN:Frank Dawson
- ORG:Lotus Development Corporation
- ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive;
- Raleigh;NC;27613-3502;USA
- TEL;TYPE=WORK,PREF:+1-617-693-8728
- TEL;TYPE=WORK,MSG:+1-919-676-9515
- TEL;TYPE=FAX:+1-617-693-8728
- EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
- EMAIL;TYPE=INTERNET:fdawson@earthlink.net
- CALADRURI;TYPE=PREF:MAILTO:Frank_Dawson@Lotus.com
- CALADRURI:MAILTO:fdawson@earthlink.net
- URL:http://home.earthlink.net/~fdawson
- END:VCARD
-
- This memo is a result of the work of the Internet Engineering Task
- Force Calendaring and scheduling Working Group. The chairman of that
- working group is:
-
- BEGIN:VCARD
- VERSION:3.0
- N:Egen;Pat
- FN:Pat Egen
- ORG:Engan Consulting
- ADR;TYPE=WORK:;;803 Creek Overlook;Chattanooga;TN;37415;USA
- TEL;TYPE=WORK,VOICE:423.875.2652
- TEL;TYPE=WORK,FAX:423.875.2017
- EMAIL:pregen@egenconsulting.com
- URL:http://www.egenconsulting.com
- CALADRURI:MAILTO:pregen@egenconsulting.com
- END:VCARD
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 14]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
-7 Bibliography
-
- [1] Wahl, M., Howes, T. and S. Kille, "Lightweight Directory Access
- Protocol (v3)", RFC 2251, December 1997.
-
- [2] Wahl, M., Coulbeck, A., Howes, T. and S. Kille, "Lightweight
- Directory Access Protocol (v3): Attribute Syntax Definitions",
- RFC 2252, December 1997.
-
- [3] Dawson, F. and T. Howes, "vCard MIME Directory Profile", RFC
- 2426, September 1998.
-
- [4] Dawson, F. and D. Stenerson, "Internet Calendaring and Scheduling
- Core Object Specification (iCalendar)", RFC 2445, November 1997.
-
- [5] Dawson, F. and S. Mansour, "iCalendar Message-Based
- Interopability Protocal (iMIP)", RFC 2447, November 1997.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 15]
-
-RFC 2739 Locating a Calendar User January 2000
-
-
-8 Full Copyright Statement
-
- Copyright (C) The Internet Society (2000). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-Acknowledgement
-
- Funding for the RFC Editor function is currently provided by the
- Internet Society.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Small, et al. Standards Track [Page 16]
-
diff --git a/addressbook/backend/ebook/docs/vcard-21.txt b/addressbook/backend/ebook/docs/vcard-21.txt
deleted file mode 100644
index 64716ebf15..0000000000
--- a/addressbook/backend/ebook/docs/vcard-21.txt
+++ /dev/null
@@ -1,1544 +0,0 @@
-vCard
-The Electronic Business Card
-Version 2.1
-
-A versit Consortium Specification
-September 18, 1996
-
-
-Copyrights
-© 1996, International Business Machines Corp., Lucent Technologies, Inc., and Siemens. All rights reserved.
-Permission is granted to copy and distribute this publication provided that it is reproduced in its entirety without modification and includes the above copyright notice and this permission notice.
-No licenses, express or implied, are granted with respect to any of the technology described in this publication. International Business Machines Corp., Lucent Technologies, Inc., and Siemens retain all their intellectual property rights in the technology described in this publication.
-Even though International Business Machines Corp., Lucent Technologies, Inc., and Siemens have reviewed this specification, INTERNATIONAL BUSINESS MACHINES CORP., LUCENT TECHNOLOGIES, INC, AND SIEMENS, MAKE NO WARRANTY OR REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS PUBLICATION, ITS QUALITY OR ACCURACY, NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. AS A RESULT, THIS SPECIFICATION IS DELIVERED "AS IS" AND THE READER ASSUMES THE ENTIRE RISK AS TO ITS QUALITY, ACCURACY OR SUITABILITY FOR ANY PARTICULAR PURPOSE..
-IN NO EVENT WILL INTERNATIONAL BUSINESS MACHINES CORP., LUCENT TECHNOLOGIES, INC, AND SIEMENS, BE LIABLE FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT OR INACCURACY IN THIS PUBLICATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-This publication is provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government are subject to restrictions set forth in DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-
-Trademarks
-versit, the versit logo, versitcard, vCard, and vCalendar are trademarks of Apple Computer, Inc., AT&T Corp., International Business Machines Corp., and Siemens.
-Apple, is a trademarks of Apple Computer, Inc. registered in the U.S. and other countries.
-AT&T and ATTMail are registered trademarks of AT&T Corp.
-IBM, IBM Mail, and OS/2 are registered trademarks of International Business Machines Corporation.
-America Online is a registered trademark of America Online, Inc.
-CompuServe, CompuServe Information Services are registered trademarks of Compuserve Incorporated.
-MCIMail is a registered trademark of MCI Communications Corporation.
-Microsoft is a registered trademark, and Microsoft Windows is a trademark of Microsoft Corporation.
-Prodigy is a registered trademark of Prodigy Services Company.
-Unicode is a registered trademark of Unicode, Inc.
-
-
-Contributors
-Roland Alden
-Greg Ames, Ames & Associates
-Masanari Arai, Puma Technologies
-Stephen W. Bartlett
-Donal Carroll
-Liang-Jye Chang, Starfish Software
-Frank Dawson, IBM Corporation
-Ken Dobson, IntelliLink Inc.
-Scott Feldstein, Nimble Software, Inc.
-Anik Ganguly, OnTime/Division of FTP Software.
-Beijing Goo, Microsoft
-Arvind K. Goyal, Lotus Development Corporation
-Gary Hand, IBM Corporation
-Tim Howes, Netscape Communications Corporation
-Mark Joseph, Attachmate Corporation
-Kerry Kelly, Now Software, Inc.
-Phac Letuan, Apple Computer, Inc.
-Pat Megowan, Counterpoint Sytems Foundry Inc.
-Tohri Mori, IBM Japan/Salutation Consortium
-Ravi Pandya, NetManage, Inc.
-Geoff Ralston, Four11 Corporation
-Steven Rummel, Lucent Technologies
-Michael Santullo, Four11 Corporation
-Vinod Seraphin, Lotus Development Corporation
-Dexter Seely, Corex Technologies, Inc.
-Vlad Shmunis, Ring Zero Systems Inc.
-Dean Stevens, Now Software, Inc.
-Michelle Watkins, Netscape Communications Corporation
-Horst Widlewski, Siemens
-
-
-Reference Information
-The cited references contain provisions which, through reference in this specification, constitute provisions of this specification. At the time of publication, the indicated versions in the following references were valid. Parties to agreements based on this specification are encouraged to research the possibility of revised standards.
-* ANSI X3.4-1977, Code for Information Interchange, American National Standards Institute, 1977.
-* CCITT (ITU) Recommendation E.163, Numbering Plan for The International Telephone Service, CCITT Blue Book, Fascicle II.2, pp. 128-134, November, 1988.
-* CCITT (ITU) Recommendation G.721, 32 kbit/s Adaptive Differential Pulse Code Modulation (ADPCM), CCITT Red Book, Fascicle III.4, November, 1988.
-* CCITT (ITU) Recommendation X.121, International Numbering Plan for Public Data Networks, CCITT Blue Book, Fascicle VIII.3, pp. 317-332, November, 1988.
-* CCITT (ITU) Recommendations X.500-X.521, Data Communication Networks: Directory, CCITT Blue Book, Fascicle VIII.8, November, 1988.
-* CCITT Recommendation X.520, The Directory-Selected Attribute Types, 1988.
-* CCITT Recommendation X.521, The Directory-Selected Object Classes, 1988.
-* IETF RFC 1738, Universal Resource Locator, December 1994.
-* IETF Network Working Group RFC 1766, Tags for the Identification of Languages, March 1995.
-* IETF Network Working Group Draft, A MIME Content-Type for Directory Information, January 1996. Available from the University of Michigan, 535 W. William St., Ann Arbor, MI 48103-4943, FTP://ds.internic.net/Internet-Drafts/draft-ietf-asid-mime-direct-01.txt.
-* IETF Network Working Group Draft, An Application/Directory MIME Content-Type Electronic Business Card Profile, May 1996. Available FTP://ds.internic.net/Internet-Drafts/draft-ietf-asid-mime-vcard-00.txt.
-* IETF Network Working Group Draft, UTF-8, A Transformation Format of UNICODE and ISO 10646, July 1996. Available from FTP://ds.internic.net/Internet-Drafts/draft-yergeau-utf8-01.txt.
-* ISO 639, Code for The Representation of names of languages, International Organization for Standardization, April, 1988.
-* ISO 3166, Codes for The Representation of names of countries, International Organization for Standardization, December, 1993.
-* ISO 8601, Data elements and interchange formats-Information interchange-Representation of dates and times, International Organization for Standardization, June, 1988.
-* ISO 8601, Technical Corrigendum 1, Data elements and interchange formats-Information interchange-Representation of dates and times, International Organization for Standardization, May, 1991.
-* ISO 8859-1, Information Processing-8-Bit single-byte coded graphic character sets-Part 1: Latin Alphabet No. 1, International Organization for Standardization, February, 1987.
-* ISO 9070, Information Processing-SGML support facilities-Registration Procedures for Public Text Owner Identifiers, 1990-02-01.[DS1]
-ï ISO/IEC 9070, Information TechnologyóSGML Support FacilitiesóRegistration Procedures for Public Text Owner Identifiers, Second Edition, International Organization for Standardization, April, 1991.
-ï ISO/IEC 11180, Postal addressing, International Organization for Standardization, 1993.
-ï Appleís Representation of a Canonical Static DeviceID in The Telephony Suite, version 1.0, Apple Computer, Inc., 1993.
-* Microsoft TAPI in Microsoft Windows 3.1 Telephony Programmers' Guide, version 1.0, Microsoft Corporation, 1993.
-* RFC1521, MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies, Network Working Group, September, 1993.
-* The Unicode Standard, Version 1.1: Version 1.0, Volume 1 (ISBN 0-201-56788-1), version 1.0, volume 2 (ISBN 0-20-60845-6) and Unicode Technical Report #4, The Unicode Standard, version 1.1, The Unicode Consortium, October, 1991. Both references to be published by Addison-Wesley.
-
-
-versit Update
-versit is a multivendor development initiative of the communication and computer industries, founded by Apple, AT&T, IBM and Siemens. The versit parties believe that great potential exists in improving the nature of communications in the business world-permitting companies to better manage their quality, productivity, customer satisfaction and cost of operations, while expanding the market opportunities for a variety of product and service vendors. versit parties will jointly define and support open specifications that facilitate and promote the interoperability of advanced personal information and communication devices, networks and services.
-The versit vision is to enable diverse communication and computing devices, applications and services from competing vendors to interoperate in all environments. Through developing a series of specifications for interoperability among diverse communications and computing devices, applications, networks and services, versit 's vision will become a reality.
-versit 's primary development areas are in:
-* Personal Data Interchange (PDI)
-* Computer Telephone Integration (CTI)
-* Conferencing and Messaging (C&M)
-* Wired and Wireless connectivity
-versit specifications are directed at both the decision makers and the implementation teams of:
-* Equipment Manufacturers
-* Independent Software Vendors
-* Information Service Providers
-* Online Service Providers
-* Software Houses
-* Users
-versit specifications are made available to any interested party. In turn, versit encourages the support of our goals by soliciting feedback on versit specifications.
-
-All comments relating to versit or the material within this specification should be submitted to:
-versit
-(800) 803-6240
-+1 (201) 327-2803 (Outside USA)
-pdi@versit.com
-http://www.versit.com/pdi
-
-
-Contents
-Section 1 : Introduction
-1.1 Overview
-1.2 Scope
-1.3 Contents
-1.4 Definitions and Abbreviations
-Section 2 : vCard Specificiation
-2.1 Encoding Characteristics
-2.1.1 vCard Object
-2.1.2 Property
-2.1.3 Delimiters
-2.1.4 Grouping
-2.1.4.1 vCard Grouping
-2.1.4.2 Property Grouping
-2.1.5 Encodings
-2.1.6 Character Set
-2.1.7 Language
-2.1.8 Value Location
-2.1.9 Binary Values
-2.2 Identification Properties
-2.2.1 Formatted Name
-2.2.2 Name
-2.2.3 Photograph
-2.2.3.1 Photo Format Type
-2.2.4 Birthdate
-2.3 Delivery Addressing Properties
-2.3.1 Delivery Address
-2.3.1.1 Delivery Address Type
-2.3.2 Delivery Label
-2.3.2.1 Delivery Label Type
-2.4 Telecommunications Addressing Properties
-2.4.1 Telephone Number
-2.4.1.1 Telephone Type
-2.4.2 Electronic Mail
-2.4.2.1 Electronic Mail Type
-2.4.3 Mailer
-2.4.4 Geographical Properties
-2.4.5 Time Zone
-2.4.6 Geographic Position
-2.5 Organizational Properties
-2.5.1 Title
-2.5.2 Business Category
-2.5.3 Logo
-2.5.3.1 Logo Format Type
-2.5.4 Agent
-2.5.5 Organization Name and Organizational Unit
-2.6 Explanatory Properties
-2.6.1 Comment
-2.6.2 Last Revision
-2.6.3 Sound
-2.6.3.1 Sound Digital Audio Type
-2.6.4 Uniform Resource Locator
-2.6.5 Unique Identifier
-2.6.6 Version
-2.7 Security Properties
-2.7.1 Public Key
-2.7.2 Key Type
-2.8 Miscellaneous Properties
-2.8.1 Extensions
-2.9 Formal Definition
-Section 3 : Internet Recommendations
-3.1 Recommended Practice with SMTP/MIME
-3.1.1 Text/Plain Content Type
-3.1.2 Text/X-vCard Content Type
-3.1.3 Application/Directory Content Type
-3.2 Recommended Practice with HTTP/HTML
-3.2.1 Form Element Usage
-3.2.2 Mapping To INPUT Element Attribute Names
-3.2.3 Example HTML Code
-Section 4 : UI Support Recommendations
-4.1 File System
-4.2 Clipboard
-4.3 Drag/Drop
-Section 5 : Conformance
-
-
-
-Section 1 : Introduction
-[DS2]
-Personal Data Interchange (PDI) occurs every time two or more individuals communicate, in either a business or personal context, face-to-face, or across space and time. Such interchanges frequently include the exchange of informal information, such as business cards, telephone numbers, addresses, dates and times of appointments, etc. Augmenting PDI with electronics and telecommunications can help ensure that information is quickly and reliably communicated, stored, organized and easily located when needed.
-Personal information, by nature, is complex and diverse. Currently, proprietary standards exist to structure some types of PDI information, but no single, open specification comprehensively addresses the needs of collecting and communicating PDI information across many common communication channels such as telephones, voice-mail, e-mail, and face-to-face meetings. versit is developing a comprehensive family of PDI technologies based on open specifications and interoperability agreements to help meet this technology need.
-Overview
-This specification defines a format for an electronic business card, or vCard. The format is suitable as an interchange format between applications or systems. The format is defined independent of the particular method used to transport it. The transport for this exchange might be a file system, point-to-point asynchronous communication, wired-network transport, or some form of unwired transport.
-A vCard is a data stream consisting of one or more vCard objects. The individual vCard definitions can be identified and parsed within the datastream. The vCard data stream may exist as a persistent form in a file system, document management system, network connection between two network endpoints, or in any other digital transport that has an abstraction of a stream of bytes.
-Conceptually, a vCard Writer creates vCard data streams and a vCard Reader interprets vCard data streams. The vCard Reader and Writer may be implemented as a single application or as separate applications. It is not the intent of this specification to define the implementation of these processes beyond some fundamental capabilities related to the format of the vCard data stream and a common set of conformance requirements .
-This specification provides for a clear-text encoding that is intended to be based on the syntax used by the MIME specification (RFC 1521).
-The encoding of this specification can be used in environments which are constrained to 7-bit transfer encodings, short line lengths, and low bandwidth. In addition, the encoding is simple in order to facilitate the implementation of reader and writer applications on small platforms, such as Personal Digital Assistants (PDA), cellular telephones, or alphanumeric pagers.
-Scope
-The vCard is intended to be used for exchanging information about people and resources. In today's business environment, this information is typically exchanged on business cards. It is appropriate, then that this specification define this information in terms of a paradigm based on an electronic business card object.
-The ultimate destination for this information is often a collection of business cards, Rolodex® file, or electronic contact manager. Prior to the introduction of the vCard specification, users of such applications typically had to re-key the original information, often transcribing it from paper business cards. With the advent of the vCard specification, this information can be exchanged in an automated fashion.
-The basis for the data types supported by this specification have their origin in openly defined, international standards and in additional capabilities based on enhancements suggested by the demonstration of the exchange of prototypical vCards using the Internet based World-Wide-Web, Infra-red data transport, and simultaneous voice and data (SVD) modems.
-The "person" object defined by the CCITT X.500 Series Recommendation for Directory Services was the primary reference for the properties that are defined by this specification. Every attempt was made to make it possible to map the X.520/X.521 attributes and objects into and out of an instance of a vCard. The vCard specification has extended the capabilities that have been defined within the CCITT X.500 Series Recommendation to allow the exchange of additional information often recorded on business cards and electronic contact managers. For example, this specification provides support for exchanging graphic images representing company logos, photographs of individuals, geo-positioning information, and other extensions to properties defined by the X.500 Recommendation.
-The specification of all date and time values are defined in terms of the ISO 8601 standard for representation of dates and times. ISO 8601 supersedes all other international standards defined at the time this specification was drafted.
-The paradigm of an electronic business card is related to the concepts of an entry in a LAN/WAN directory or an electronic mail address book or distribution list. However, the requirements of the electronic business card go beyond the definitions of a "person" object found in either the CCITT X.500 Series Recommendation, network directory services, or electronic mail address book products. The vCard specification is needed to address the requirements for an interchange format for the "person" personal data type or object.
-Personal data applications such as Personal Information Managers (PIM) often provide an import/export capability using Comma Separated Value (CSV) or Tab Delimited Files (TDF) formats. However, these solutions do not preserve the intent of the originating application. When a CSV and TDF format is used by a PIM, the meta-data or semantics of the originating object are only apparent to a similar version of the originating application. Exchange of data between such applications is another important application of an industry-standard specification for an electronic business card interchange format, such as the vCard specification.
-Contents
-This specification is separated into eight sections:
-* "Section 1 : Introduction" introduces PDI and the vCard specification with an overview, scope statement and section on definitions and abbreviations.
-* "Section 2 : vCard Specification" defines the semantics and syntax for the vCard.
-* "Section 3 : Internet Recommendations" specifies a set of guidelines to facilitate the exchange of vCard objects over Internet protocols such as HTTP using HTML and SMTP using MIME.
-* "Section 4 : UI Support Recommendations" specifies a set of guidelines to facilitate the exchange of vCard objects at the desktop user interface using the file system, clipboard and drag/drop capabilities of the operating system.
-* "Section 5 : Conformance" defines minimum conformance requirements to consider while developing support for this vCard specification.
-Definitions and Abbreviations
-Definitions and abbreviations used within this specification follow.
-Electronic Business Card: Also known as vCard.
-FPI: Formal Public Identifier. A string expression that represents a public identifier for an object. FPI syntax is defined by ISO 9070.
-GUID: Globally Unique IDentifier
-Internet: A WAN connecting thousands of disparate networks in industry, education, government, and research. The Internet uses TCP/IP as the standard for transmitting information.
-ISO: Organization for International Standardization; a worldwide federation of national standards bodies (ISO Member bodies).
-MIME: Multipurpose Internet Mail Extensions, as defined in RFC1521.
-PDA: Personal Digital Assistant computing device
-PDI: Personal Data Interchange, a collaborative application area which involves the communication of data between people who have a business or personal relationship, but do not necessarily share a common computing infrastructure.
-PIM: Personal Information Manager
-RFC#### documents: Internet "Request For Comment" documents (i.e., RFC822, RFC1521, etc.).
-URL: Uniform Resource Locator; a string expression that can represent any resource on the Internet or local system. RFC 1738 defines the syntax for an URL.
-UTC: Universal Time Coordinated; also known as UCT, for Universal Coordinated Time.
-vCard: The generic term for an electronic, virtual information card that can be transferred between computers, PDAs, or other electronic devices through telephone lines, or e-mail networks, or infrared links. How, when, why, and where vCard are used depends on the applications developed utilizing a vCard.
-versitcard: a vCard.
-WAN: Wide-Area Network
-
-
-Section 2 : vCard Specificiation
-[DS3]
-This section defines the semantics and syntax for the vCard.
-A vCard is a collection of one or more properties. A property is a uniquely named value. A set of properties can be grouped within a vCard. For example, the properties for a telephone number and comment can be grouped in order to preserve the coupling of the annotation with the telephone number. In addition to property groupings, a vC. versit is developing a comprehensive family of PDI technologies based on open specifications and interoperability agreements to help meet this technology need.
-Overview
-This specification defines a format for an electronic business card, or vCard. The format is suitable as an interchange format between applications or systems. The format is defined independent of the particular method used to transport it. The transport for this exchange might be a file system, point-to-point asynchronous communication, wired-network transport, or some form of unwired transport.
-A vCard is a data stream consisting of one or more vCard objects. The individual vCard definitions can be identified and parsed within the datastream. The vCard data stream may exist as a persistent form in a file system, document management system, network connection between two network endpoints, or in any other digital transport that has an abstraction of a stream of bytes.
-Conceptually, a vCard Writer creates vCard data streams and a vCard Reader interprets vCard data streams. The vCard Reader and Writer may be implemented as a single application or as separate applications. It is not the intent of this specification to define the implementation of these processes beyond some fundamental capabilities related to the format of the vCard data stream and a common set of conformance requirements .
-This specification provides for a clear-text encoding that is intended to be based on the syntax used by the MIME specification (RFC 1521).
-The encoding of this specification can be used in environments which are constrained to 7-bit transfer encodings, short line lengths, and low bandwidth. In addition, the encoding is simple in order to facilitate the implementation of reader and writer applications on small platforms, such as Personal Digital Assistants (PDA), cellular telephones, or alphanumeric pagers.
-Scope
-The vCard is intended to be used for exchanging information about people and resources. In today's business environment, this information is typically exchanged on business cards. It is appropriate, then that this specification define this information in terms of a paradigm based on an electronic business card object.
-The ultimate destination for this information is often a collection of business cards, Rolodex® file, or electronic contact manager. Prior to the introduction of the vCard specification, users of such applications typically had to re-key the original information, often transcribing it from paper business cards. With the advent of the vCard specification, this information can be exchanged in an automated fashion.
-The basis for the data types supported by this specification have their origin in openly defined, international standards and in additional capabilities based on enhancements suggested by the demonstration of the exchange of prototypical vCards using the Internet based World-Wide-Web, Infra-red data transport, and simultaneous voice and data (SVD) modems.
-The "person" object defined by the CCITT X.500 Series Recommendation for Directory Services was the primary reference for the properties that are defined by this specification. Every attempt was made to make it possible to map the X.520/X.521 attributes and objects into and out of an instance of a vCard. The vCard specification has extended the capabilities that have been defined within the CCITT X.500 Series Recommendation to allow the exchange of additional information often recorded on business cards and electronic contact managers. For example, this specification provides support for exchanging graphic images representing company logos, photographs of individuals, geo-positioning information, and other extensions to properties defined by the X.500 Recommendation.
-The specification of all date and time values are defined in terms of the ISO 8601 standard for representation of dates and times. ISO 8601 supersedes all other international standards defined at the time this specification was drafted.
-The paradigm of an electronic business card is related to the concepts of aQuoted-Printable lines of text must also be limited to less than 76 characters. The 76 characters does not include the CRLF (RFC 822) line break sequence. For example a multiple line LABEL property value of:
-123 Winding Way
-Any Town, CA 12345
-USA
-Would be represented in a Quoted-Printable encoding as:
-LABEL;ENCODING=QUOTED-PRINTABLE:123 Winding Way=0D=0A=
- Any Town, CA 12345=0D=0A=
- USA
-Property parameter substrings are delimited by a field delimiter, specified by the Semi-colon character (ASCII decimal 59). A Semi-colon in a property parameter value must be escaped with a Backslash character (ASCII 92).
-Compound property values are property values that also make use of the Semi-colon, field delimiter to separate positional components of the value. For example, the Name property is made up of the Family Name, Given Name, etc. components. A Semi-colon in a component of a compound property value must be escaped with a Backslash character (ASCII 92).
-Grouping
-There are two forms of grouping or collections supported within the vCard. A collection of vCard objects can be grouped and a collection of properties within an individual vCard can be grouped.
-vCard Grouping
-The vCard data stream can consist of multiple vCard objects. The vCard data stream can, sequentially, contain one or more vCard objects., In addition, the vCard data stream can contain a property whose value is a nested vCard. In both of these cases, each vCard object will be delimited by the vCard Delimiters. The vCard Reader conforming to this specification must be able to parse and process any of these combinations of vCard Groupings. The support for vCard Grouping is optional for a vCard Writer conforming to this specification.
-Property Grouping
-A Property Grouping is the definition of a method for specifying a collection of related properties within a vCard object. There is no requirement on a vCard reader that it preserve the property group name. However, the vCard reader is required to preserve the grouping of the properties.
-The Property Grouping is identified by a character string prefix to the property name; separated by the Period character (ASCII decimal 46).
-The grouping of a comment property with a telephone property is shown in the following example:
-A.TEL;HOME:+1-213-555-1234
-A.NOTE:This is my vacation home.
-The vCard Reader conforming to this specification must be able to parse and process the property grouping. The support for Property Grouping is optional for a vCard Writer conforming to this specification.
-Encodings
-The default encoding for the vCard object is 7-Bit. The default encoding can be overridden for an individual property value by using the "ENCODING" property parameter. This parameter value can be either "BASE64", "QUOTED-PRINTABLE", or "8BIT". This parameter may be used on any property.
-Some transports (e.g., MIME based electronic mail) may also provide an encoding property at the transport wrapper level. This property can be used in these cases for transporting a vCard data stream that has been defined using a default encoding other than 7-bit (e.g., 8-bit).
-Character Set
-The default character set is ASCII. The default character set can be overridden for an individual property value by using the "CHARSET" property parameter. This property parameter may be used on any property. However, the use of this parameter on some properties may not make sense.
-Any character set registered with the Internet Assigned Numbers Authority (IANA) can be specified by this property parameter. For example, ISO 8859-8 or the Latin/Hebrew character set is specified by:
-ADR;CHARSET=ISO-8859-8:...
-Some transports (e.g., MIME based electronic mail) may also provide a character set property at the transport wrapper level. This property can be used in these cases for transporting a vCard data stream that has been defined using a default character set other than ASCII (e.g., UTF-8).
-Language
-The default language is "en-US" (US English). The default language can be overridden for an individual property value by using the "LANGUAGE" property parameter. The values for this property are a string consistent with RFC 1766, Tags for the Identification of Languages. This property parameter may be used on any property. However, the use of this parameter on some properties, such as PHOTO, LOGO, SOUND, TEL, may not make sense. Canadian French would be specified by this parameter by the following:
-ADR;LANGUAGE=fr-CA:...
-Value Location
-The default location of the property value is inline with the property. However, for some properties, such as those that specify multimedia values, it is efficient to organize the property value as a separate entity (e.g., a file out on the network). The property parameter "VALUE" can be specified to override the "INLINE" location of the property value. In the case of the vCard being transported within a MIME email message, the property value can be specified as being located in a separate MIME entity with the "Content-ID" value, or "CID" for short. In this case, the property value is the Content-ID for the MIME entity containing the property value. In addition, the property value can be specified as being located out on the network within some Internet resource with the "URL" value. In this case, the property value is the Uniform Resource Locator for the Internet resource containing the property value. This property parameter may be used on any property. However, the use of this parameter on some properties may not make sense; for example the Version, Time Zone, Comment, Unique Identifier, properties . The following specifies a value not located inline with the vCard but out in the Internet:
-PHOTO;VALUE=URL;TYPE=GIF:http://www.abc.com/dir_photos/my_photo.gif
-SOUND;VALUE=CONTENT-ID:<jsmith.part3.960817T083000.xyzMail@host1.com
-Binary Values
-The vCard format supports inclusion of binary information, such as computer graphic images, digital audio, or video graphic images. The binary information may either be referenced with a Uniform Reference Locator (URL) or placed inline in the vCard as the value of a property. Inline binary information is included as a property value after being encoded into clear-text with a Base 64 (default) or Quoted-Printable encoding
-Identification Properties
-These property types are concerned with information associated with the identification and naming of the individual or resource associated with the vCard object.
-Formatted Name
-This property specifies the formatted name string associated with the vCard object. This is the way that the name is to be displayed. It can contain desired honorific prefixes, suffixes, titles, etc. For example, "Mr. John Q. Public, Jr.", Dr. Ann Tyler, or Hon. Judge Blackwell. This property is based on the semantics of the X.520 Common Name attribute.
-This property is identified by the property name FN. The following is an example of the Formatted Name property:
-FN:Mr. John Q. Public, Esq.
-Support for this property is optional for vCard Writers conforming to this specification.
-Name
-This property specifies a structured representation of the name of the person, place or thing associated with the vCard object.
-This property is identified by the property name N. This property is defined to encapsulate the individual components of an object's name. The property value consists of the components of the name specified as positional fields separated by the Field Delimiter character (ASCII decimal 59). The property value is a concatenation of the Family Name (first field), Given Name (second field), Additional Names (third field), Name Prefix (fourth field), and Name Suffix (fifth field) strings. The following is an example of the Name property for a person:
-N:Public;John;Quinlan;Mr.;Esq.
-The following is an example of the Name property for a resource or place:
-N:Veni, Vidi, Vici;The Restaurant.
-Support for this property is mandatory for vCard Writers conforming to this specification. All vCard data streams should include this property to facilitate a common property for collating and sorting of vCard objects.
-Photograph
-This property specifies an image or photograph of the individual associated with the vCard.
-The property is identified by the property name PHOTO. For example, the following syntax is an example of a referenced image file:
-PHOTO;VALUE=URL:file:///jqpublic.gif
- The following example is the syntax for including an inline GIF image file, using the Base 64 encoding:
-PHOTO;ENCODING=BASE64;TYPE=GIF:
- R0lGODdhfgA4AOYAAAAAAK+vr62trVIxa6WlpZ+fnzEpCEpzlAha/0Kc74+PjyGM
- SuecKRhrtX9/fzExORBSjCEYCGtra2NjYyF7nDGE50JrhAg51qWtOTl7vee1MWu1
- 50o5e3PO/3sxcwAx/4R7GBgQOcDAwFoAQt61hJyMGHuUSpRKIf8A/wAY54yMjHtz
-...
-Support for this property is optional for vCard Writers conforming to this specification.
-Photo Format Type
-This property parameter is provided to specify the graphics format for the Photo property value. The property parameter includes the following values:
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates Graphics Interchange Format
-GIF
-
-Indicates ISO Computer Graphics Metafile
-CGM
-
-Indicates MS Windows Metafile
-WMF
-
-Indicates MS Windows Bitmap
-BMP
-
-Indicates IBM PM Metafile
-MET
-
-Indicates IBM PM Bitmap
-PMB
-
-Indicates MS Windows DIB
-DIB
-
-Indicates an Apple Picture format
-PICT
-
-Indicates a Tagged Image File Format
-TIFF
-
-Indicates Adobe PostScript format
-PS
-
-Indicates Adobe Page Description Format
-PDF
-
-Indicates ISO JPEG format
-JPEG
-
-Indicates ISO MPEG format
-MPEG
-
-Indicates ISO MPEG version 2 format
-MPEG2
-
-Indicates Intel AVI format
-AVI
-
-Indicates Apple QuickTime format
-QTIME
-
-
-Birthdate
-This property specifies the date of birth of the individual associated with the vCard. The value for this property is a calendar date in a complete representation consistent with ISO 8601.
-This property is identified by the property name BDAY. The property value is a string conforming to the ISO 8601 calendar date, complete representation, in either basic or extended format. The following example is in the basic format of ISO 8601:
-BDAY:19950415
-The following example is in the extended format of ISO 8601:
-BDAY:1995-04-15
-Support for this property is optional for vCard Writers conforming to this specification.
-Delivery Addressing Properties
-Delivery Address
-This property specifies a structured representation of the physical delivery address for the vCard object. The property is made up of components that are based on the X.500 Post Office Box attribute, the X.520 Street Address geographical attribute, the X.520 Locality Name geographical attribute, the X.520 State or Province Name geographical attribute, the X.520 Postal Code attribute, and the X.520 Country Name geographical attribute.
-This property is identified by the property name ADR. The property value consists of components of the address specified as positional fields separated by the Field Delimiter character (ASCII decimal 59). The property value is a concatenation of the Post Office Address (first field) Extended Address (second field), Street (third field), Locality (fourth field), Region (fifth field), Postal Code (six field), and Country (seventh field) strings. An example of this property follows:
-ADR;DOM;HOME:P.O. Box 101;Suite 101;123 Main Street;Any Town;CA;91921-1234;
-Support for this property is optional for vCard Writers conforming to this specification.
-Delivery Address Type
-This property parameter specifies the sub-types of physical delivery that is associated with the delivery address. For example, the label may need to be differentiated for Home, Work, Parcel, Postal, Domestic, and International physical delivery. One or more sub-types can be specified for a given delivery address.
-The property parameter can have one or more of the following values:
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates a domestic address
-DOM
-
-Indicates an international address (Default)
-INTL
-
-Indicates a postal delivery address (Default)
-POSTAL
-
-Indicates a parcel delivery address (Default)
-PARCEL
-
-Indicates a home delivery address
-HOME
-
-Indicates a work delivery address (Default)
-WORK
-
-
-The default property parameter is overridden to some other set of values by specifying one or more alternate values. For example, the default of a delivery for INTL, WORK, POSTAL and PARCEL can be reset to DOM, POSTAL, WORK and HOME in the following example:
-ADR;DOM;WORK;HOME;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;
-Delivery Label
-This property specifies the addressing label for physical delivery to the person/object associated with the vCard. The property is intended to include the information necessary to create a formatted delivery address label. Typical information includes the name, street address, possibly a Post Office or mail drop, city, state or province, zip or postal code. An international delivery label would also include the country name.
-This property is based on the semantics of the X.520 Postal Address attribute. This specification has added semantics to those defined by the X.500 Series standard for differentiating Home, Work, Parcel, Postal, Domestic, and International delivery label types.
-This property is identified by the property name LABEL. This property specifies the formatted delivery address label for the vCard object. An example of a domestic delivery label follows:
-LABEL;DOM;POSTAL;ENCODING=QUOTED-PRINTABLE:P. O. Box 456=0D=0A=
-123 Main Street=0D=0A=
-Any Town, CA 91921-1234
-An example of an international delivery label follows:
-LABEL;INTL;PARCEL,ENCODING=QUOTED-PRINTABLE:Suite 101=0D=0A=
-123 Main Street=0D=0A=
-Any Town, CA 91921-1234=0D=0A=
-U.S.A.
-Support for this property is optional for vCard Writers conforming to this specification. A vCard Reader supporting this property and conforming to this specification should support a minimum of four lines of text for this property.
-Delivery Label Type
-This property parameter specifies the sub-types of physical delivery that is associated with the delivery label. For example, the label may need to be differentiated for Home, Work, Parcel, Postal, Domestic, and International physical delivery. One or more sub-types can be specified for a given delivery label.
-The property parameter can have one or more of the following values:
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates a domestic address
-DOM
-
-Indicates an international address (Default)
-INTL
-
-Indicates a postal delivery address (Default)
-POSTAL
-
-Indicates a parcel delivery address (Default)
-PARCEL
-
-Indicates a home delivery address
-HOME
-
-Indicates a work delivery address (Default)
-WORK
-
-
-The default property parameter is overridden to some other set of values by specifying one or more alternate values. For example, the default of a delivery for INTL, WORK, POSTAL and PARCEL can be reset to DOM and HOME in the following example:
-LABEL;DOM;HOME,ENCODING=QUOTED-PRINTABLE:Suite 101=0D=0A=
-123 Main Street=0D=0A=
-Any Town, CA 91921-1234
-Telecommunications Addressing Properties
-These property types are concerned with information associated with the telecommunications addressing of the vCard object.
-Telephone Number
-This property specifies the canonical number string for a telephone number for telephony communication with the vCard object. The value of this property is specified in a canonical form in order to specify an unambiguous representation of the globally unique telephony endpoint. This property is based on the X.520 Telephone Number attribute.
-The canonical form cannot be dialed without first being transformed by a dialing algorithm. The dialing algorithm combines the canonical number string with knowledge of the local dialing procedures, in effect at the time of call placement to produce actual dialing instructions. The actual dialing algorithm is outside the scope of this specification.
-Two important canonical forms allowed by this specification are:
-* Apple Computer's Representation of a Canonical Static DeviceID in The Telephony Suite, version 1.0,
-* Microsoft TAPI in the Microsoft Windows 3.1 Telephony Programmer's Guide, version 1.0.
-Software which creates this property can store a string in these allowed formats. Dialing software should be prepared to parse numbers from either of the supported formats; as neither format is considered to be technically costly to support.
-This property is identified by the property name TEL. An example of this property follows:
-TEL;PREF;WORK;MSG;FAX:+1-800-555-1234
-Support for this property is optional for vCard Writers conforming to this specification.
-Telephone Type
-This property parameter specifies the sub-type of telephone that is associated with the telephone number (e.g., Home, Work, Cellular, Facsimile, Video, Modem, Message Service, or Preferred). One or more sub-type values can be specified for a given telephone number.
-The property parameter can have one or more of the following values:
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates preferred number
-PREF
-
-Indicates a work number
-WORK
-
-Indicates a home number
-HOME
-
-Indicates a voice number (Default)
-VOICE
-
-Indicates a facsimile number
-FAX
-
-Indicates a messaging service on the number
-MSG
-
-Indicates a cellular number
-CELL
-
-Indicates a pager number
-PAGER
-
-Indicates a bulletin board service number
-BBS
-
-Indicates a MODEM number
-MODEM
-
-Indicates a car-phone number
-CAR
-
-Indicates an ISDN number
-ISDN
-
-Indicates a video-phone number
-VIDEO
-
-The default property parameter is overridden to some other set of values by specifying one or more alternate values. For example, the default of a VOICE telephone number can be reset to a WORK and HOME, VOICE and FAX telephone number in the following example:
-TEL;WORK;HOME;VOICE;FAX:+1-800-555-1234
-Electronic Mail
-This property specifies the address for electronic mail communication with the vCard object. The address is in the form of a specific addressing type. For example, the Internet mail address for John Public might be "John.Public@abc.com" or the CompuServe Information Service address might be "71234,5678".This property is identified by the property name EMAIL.
-An example of this property follows:
-EMAIL;INTERNET:john.public@abc.com
-Support for this property is optional for vCard Writers conforming to this specification.
-Electronic Mail Type
-This property parameter specifies the type of electronic mail address. The following are some example values for this property parameter:
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates America On-Line
-AOL
-
-Indicates AppleLink
-AppleLink
-
-Indicates AT&T Mail
-ATTMail
-
-Indicates CompuServe Information Service
-CIS
-
-Indicates eWorld
-eWorld
-
-Indicates Internet SMTP (default)
-INTERNET
-
-Indicates IBM Mail
-IBMMail
-
-Indicates MCI Mail
-MCIMail
-
-Indicates PowerShare
-POWERSHARE
-
-Indicates Prodigy information service
-PRODIGY
-
-Indicates Telex number
-TLX
-
-Indicates X.400 service
-X400
-
-
-Mailer
-This property parameter specifies the type of electronic mail software that is in use by the individual associated with the vCard object. This information may provide assistance to a correspondent regarding the type of data representation which can be used, and how they may be packaged. This property parameter is based on currently accepted practices within the Internet MIME community with the "X-Mailer" header field.
-This property is identified by the property name MAILER. Support for this property is optional for vCard Writers conforming to this specification. An example of this property follows:
-MAILER:ccMail 2.2
-Geographical Properties
-These property types are concerned with geographical positions or region information associated with the vCard object.
-Time Zone
-This property specifies information related to the standard time zone of the vCard object. The time zone is a string as specified in a manner consistent with ISO 8601. It is an offset from Coordinated Universal Time (UTC). An ISO 8601 UTC offset, in basic format, is specified as a positive or negative difference in units of hours and minutes (e.g., +hhmm). If minutes are zero, then they may be omitted and the format would be specified in units of hours (e.g., +hh). The time is specified as a 24-hour clock. Hour valult property parameter is overridden to some other set of values by specifying one or more alternate values. For example, the default of a delivery for INTL, WORK, POSTAL and PARCEL can be reset to DOM, POSTAL, WORK and HOME in the following example:
-ADR;DOM;WORK;HOME;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;
-Delivery Label
-This property specifies the addressing label for physical delivery to the person/object associated with the vCard. The property is intended to include the information necessary to create a formatted delivery address label. Typical information includes the name, street address, possibly a Post Office or mail drop, city, state or province, zip or postal code. An international delivery label would also include the country name.
-This property is based on the semantics of the X.520 Postal Address attribute. This specification has added semantics to those defined by the X.500 Series standard for differentiating Home, Work, Parcel, Postal, Domestic, and International delivery label types.
-This property is identified by the property name LABEL. This property specifies the formatted delivery address label for the vCard object. An example of a domestic delivery label follows:
-LABEL;DOM;POSTAL;ENCODING=QUOTED-PRINTABLE:P. O. Box 456=0D=0A=
-123 Main Street=0D=0A=
-Any Town, CA 91921-1234
-An example of an international delivery label follows:
-LABEL;INTL;PARCEL,ENCODING=QUOTED-PRINTABLE:Suite 101=0D=0A=
-123 Main Street=0D=0A=
-Any Town, CA 91921-1234=0D=0A=
-U.S.A.
-Support for this property is optional for vCard Writers conforming to this specification. A vCard Reader supporting this property and conforming to this specification should support a minimum of four lines of text for this property.
-Delivery Label Type
-This property parameter specifies the sub-types of physical delivery that is associated with the delivery label. For example, the label may need to be differentiated for Home, Work, Parcel, Postal, Domestic, and International physical delivery. One or more sub-types can be specified for a given delivery label.
-The property parameter can have one or more of the following values:
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates a domestic address
-DOM
-
-Indicates an international address (Default)
-INTL
-
-Indicates a postal delivery address (Default)
-POSTAL
-
-Indicates a parcel delivery address (Default)
-PARCEL
-
-Indicates a home delivery address
-HOME
-
-Indicates a work delivery address (Default)
-WORK
-
-
-The default property parameter is overridden to some other set of values by specifying one or more alternate values. For example, the default of a delivery for INTL, WORK, POSTAL and PARCEL can be reset to DOM and HOME in the following example:
-LABEL;DOM;HOME,ENCODING=QUOTED-PRINTABLE:Suite 101=0D=0A=
-123 Main Street=0D=0A=
-Any Town, CA 91921-1234
-Telecommunications Addressing Properties
-These property types are concerned with information associated with the telecommunications addressing of the vCard object.
-Telephone Number
-This property specifies the canonical number string for a telephone number for telephony communication with the vCard object. The value of this property is specified in a canonical form in order to specify an unambiguous representation of the globally unique telephony endpoint. This property is based on the X.520 Telephone Number attribute.
-The canonical form cannot be dialed without first being transformed by a dialing algorithm. The dialing algorithm combines the canonical number string with knowledge of the local dialing procedures, in effect at the time of call placement to produce actual dialing instructions. The actual dialing algorithm is outside the scope of this specification.
-Two important canonical forms allowed by this specification are:
-* Apple Computer's Representation of a Canonical Static DeviceID in The Telephony Suite, version 1.0,
-* Microsoft TAPI in the Microsoft Windows 3.1 Telephony Programmer's Guide, version 1.0.
-Software which creates this property can store a string in these allowed formats. Dialing s
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates Graphics Interchange Format
-GIF
-
-Indicates ISO Computer Graphics Metafile
-CGM
-
-Indicates MS Windows Metafile
-WMF
-
-Indicates MS Windows Bitmap
-BMP
-
-Indicates IBM PM Metafile
-MET
-
-Indicates IBM PM Bitmap
-PMB
-
-Indicates MS Windows DIB
-DIB
-
-Indicates an Apple Picture format
-PICT
-
-Indicates Tagged Image File Format
-TIFF
-
-Indicates Adobe Page Description Format
-PDF
-
-Indicates Adobe PostScript
-PS
-
-Indicates ISO JPEG format
-JPEG
-
-Indicates ISO MPEG format
-MPEG
-
-Indicates ISO MPEG version 2 format
-MPEG2
-
-Indicates Intel AVI format
-AVI
-
-Indicates Apple QuickTime format
-QTIME
-
-
-Agent
-This property specifies information about another person who will act on behalf of the vCard object. Typically this would be an area administrator, assistant, or secretary for the individual. A key characteristic of the Agent property is that it represents somebody or something which is separately addressable. For example, if all phone calls or e-mail messages are normally screened by an agent, this property may not be needed. On the other hand, if an agent can act as a proxy, and may otherwise need to be contacted separately, then an Agent property is useful.
-This property is equivalent to nesting another vCard with the specified vCard.
-This property is identified by the property name AGENT. The value of this property is a string containing another vCard object. An example of this property follows:
-AGENT:
-BEGIN:VCARD
-VERSION:2.1
-N:Friday;Fred
-TEL;WORK;VOICE:+1-213-555-1234
-TEL;WORK;FAX:+1-213-555-5678
-END:VCARD
-Support for this property is optional for vCard Writers conforming to this specification.
-Organization Name and Organizational Unit
-This property specifies the name and optionally the unit(s) of the organization associated with the vCard object. This property is based on the X.520 Organization Name attribute and the X.520 Organization Unit attribute. For example, "The AB Corporation" and the "North American Division".
-This property is identified by the property name ORG. This property is defined to encapsulate the Organization Name and Organization Unit properties as sub-properties. The property value consists of the components of the organization specified as positional fields separated by the Field Delimiter (ASCII decimal 59). The property value is a concatenation of the Organization Name (first field), Organizational Unit (second field) strings. Additional positional fields, if specified, contain additional Organizational Units. The following is an example of the Organization property:
-ORG:ABC, Inc.;North American Division;Marketing
-Support for this property is optional for vCard Writers conforming to this specification.
-Explanatory Properties
-These property types are concerned with additional explanations, such as that related to national language support, annotation, or encoding of binary information about the vCard object.
-Comment
-This property specifies supplemental information or a comment that is associated with the vCard. With the use of property grouping, the association can be limited to a group of properties. The property is based on the X.520 Description attribute.
-This property is identified by the property name NOTE. An example of this property follows:
-NOTE;ENCODING=QUOTED-PRINTABLE:This facsimile machine if operational=
- 0830 to 1715 hours=0D=0A=
-Monday through Friday. Call +1-213-555-1234 if you have problems=0D=0A=
-with access to the machine.
-Support for this property is optional for vCard Writers conforming to this specification.
-Last Revision
-This property specifies the combination of the calendar date and time of day of the last update to the vCard object. The property value is a character string conforming to the basic or extended format of ISO 8601. The value can either be in terms of local time or UTC.
-This property is identified by the property name REV. Valid values for this property are a character string representing a combination of the calendar date and time of day conforming to the basic or extended format of ISO 8601. The time of day can be either local time or UTC. The following example is in the basic format and local time of ISO 8601:
-REV:19951031T222710
-The following example is in the extended format and UTC time of ISO 8601:
-REV:1995-10-31T22:27:10Z
-Support for this property is optional for vCard Writers conforming to this specification.
-Sound
-This property specifies a sound annotation for the vCard object. By default, if this property is not grouped with other properties it specifies the pronunciation of the Formatted Name property of the vCard object. Such information may be in the form of a string of characters representing a phonetic sound or in the form of a digitized sound, or both; subject to the limitations imposed by the encoding used to communicate the vCard.
-This property is identified by the property name SOUND. Valid values for this property are either a string representation, a reference to a digital audio representation, or an inline digital audio representation of the phonetic pronunciation of the Formatted Name property. The following example shows the string based phonetic representation:
-SOUND:JON Q PUBLIK
-The following example shows the digtial sound representation and URL based value:
-SOUND;VALUE=URL:file///multimed/audio/jqpublic.wav
-The following example shows the digtial sound representation and INLINE value:
-SOUND;WAVE;BASE64:
- UklGRhAsAABXQVZFZm10IBAAAAABAAEAESsAABErAAABAAgAZGF0YesrAACAg4eC
- eXR4e3uAhoiIiYmKjIiDfnx5eX6CgoKEhYWDenV5fH6BhISGiIiDfHZ2eXt/hIiK
- jY2IhH12d3Vyc3uDiIiFf3l7fn18eXl+houFf319fnyAgHl5eoCIiISChIeAfnt2
-...
-Support for this property is optional for vCard Writers conforming to this specification.
-Sound Digital Audio Type
-This property parameteris provided to specify the type of the digital audio Pronunciation for the vCard object. The property parameter can have the following values:
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates Wave format
-WAVE
-
-Indicates MIME basic audio type
-PCM
-
-Indicates AIFF format
-AIFF
-
-
-Uniform Resource Locator
-This property specifies a value that represents a Uniform Resource Locator (URL). An URL is a representation of an Internet location that can be used to obtain real-time information about the vCard object. Application of this property might be to specify the location of a publicly accessible directory where up-to-date or additional information on the individual or resource associated with a vCard can be found.
-This property is identified by the property name URL. Valid values for this property are a string conforming to the IETF RFC 1738, Uniform Resource Locators. The following is an example of this property:
-URL:http://abc.com/pub/directory/northam/jpublic.ecd
-Support for this property is optional for vCard Writers conforming to this specification.
-Unique Identifier
-This property specifies a value that represents a persistent, globally unique identifier associated with the object. The property can be used as a mechanism to relate different vCard objects. Some examples of valid forms of unique identifiers would include ISO 9070 formal public identifiers (FPI), X.500 distinguished names, machine-generated "random" numbers with a statistically high likelihood of being globally unique and Uniform Resource Locators (URL). If an URL is specified, it is suggested that the URL reference a service which will produce an updated version of the vCard.
-This property is identified by the property name UID. This property is provided to enable a vCard Reader and Writer to uniquely identify either a vCard object instance or properties within a vCard object. Valid values for this property are a unique character string. The following is an example of this property:
-UID:19950401-080045-40000F192713-0052
-Support for this property is optional for vCard Writers conforming to this specification.
-Version
-This property specifies the identifier corresponding to the highest version number of the vCard Specification supported by the implementation that created the vCard object. The value of this property must be 2.1 to correspond to this specification..
-This property is identified by the property name VERSION. The following is an example of this property:
-VERSION:2.1
-Support for this property is mandatory for implementations conforming to this specification. This property must appear within the vCard data stream.
-Security Properties
-These property types are concerned with the security of the information in the vCard object.
-Public Key
-This property specifies the public encryption key associated with the vCard object.
-This property is identified by the property name KEY. Valid values for this property are a public key that conforms to a bilaterally agreed to representation. If the representation is a binary format, then the public key must be further encoded. The default format is clear-text. If a binary format is used, then it is specified by the property parameter. Support for this property is optional for vCard Writers conforming to this specification.
-Key Type
-This property parameter is provided to specify the type of the public key for the vCard object. The property parameter can have the following values:
-
-Description
-Property Parameter Value
-
-TYPE=
-
-
-Indicates a X.509 public key certificate type of key
-X509
-
-Indicates an IETF PGP type of key
-PGP
-
-Miscellaneous Properties
-Extensions
-The vCard provides a ìstandard mechanism for doing non-standard thingsî. This extension support is provided for implementers to "push the envelope" on the existing version of the specification. Extension properties are specified by property and/or property parameter names that have the initial sub-string of X- (the two character sequence: Capital X character followed by the Dash character. It is recommended that vendors concatenate onto this sentinel an added short sub-string to identify the vendor. This will facilitate readability of the extensions and minimize possible collision of names between different vendors. For example, the following might be the ABC vendor's extension for a video-clip form of identification property:
-X-ABC-VIDEO;MPEG2:http://lonestar.bubbas.org/billibob.mpg
-or, the following example might be an extension for grouping vCard objects into a distribution list for the Design Work Group.
-BEGIN:VCARD
-VERSION:2.1
-X-DL;Design Work Group:List Item 1;List Item 2;List Item 3
-BEGIN:VCARD
-UID:List Item 1
-N:John Smith
-TEL:+1-213-555-1111
-END:VCARD
-BEGIN:VCARD
-UID:List Item 2
-N:I. M. Big
-TEL:+1-213-555-9999
-END:VCARD
-BEGIN:VCARD
-UID:List Item 3
-N:Jane Doe
-TEL:+1-213-555-5555
-END:VCARD
-END:VCARD
-At present, there is no registration authority for names of extension properties.
-Support for this property is mandatory for implementations conforming to this specification. However, an implementation may not be able to act on the extension property. Conformance only requires that an implementation be able to parse vCard data streams with extensions. The implementation need not act on them.
-Formal Definition
-The following modified Backus-Naur Notation (BNF) is provided to assist developers in building parsers for the vCard.
-This syntax is written according to the form described in RFC 822, but it references just this small subset of RFC 822 literals:
- CR = <ASCII CR, carriage return> ; ( 15, 13.)
- LF = <ASCII LF, linefeed> ; ( 12, 10.)
- CRLF = CR LF
- SPACE = <ASCII SP, space> ; ( 40, 32.)
- HTAB = <ASCII HT, horizontal-tab> ; ( 11, 9.)
-All literal property names are valid as upper, lower, or mixed case.
-ws = 1*(SPACE / HTAB)
- ; "whitespace," one or more spaces or tabs
-wsls = 1*(SPACE / HTAB / CRLF)
- ; whitespace with line separators
-word = <any printable 7bit us-ascii except []=:., >
-groups = groups "." word
- / word
-vcard_file = [wsls] vcard [wsls]
-vcard = "BEGIN" [ws] ":" [ws] "VCARD" [ws] 1*CRLF
- items *CRLF "END" [ws] ":" [ws] "VCARD"
-items = items *CRLF item
- / item
- ; these may be "folded"
-item = [groups "."] name
- [params] ":" value CRLF
- / [groups "."] "ADR"
- [params] ":" addressparts CRLF
- / [groups "."] "ORG"
- [params] ":" orgparts CRLF
- / [groups "."] "N"
- [params] ":" nameparts CRLF
- / [groups "."] "AGENT"
- [params] ":" vcard CRLF
- ; these may be "folded"
-name = "LOGO" / "PHOTO" / "LABEL" / "FN" / "TITLE"
- / "SOUND" / "VERSION" / "TEL" / "EMAIL" / "TZ" / "GEO" / "NOTE"
- / "URL" / "BDAY" / "ROLE" / "REV" / "UID" / "KEY"
- / "MAILER" / "X-" word
- ; these may be "folded"
-value = 7bit / quoted-printable / base64
-7bit = <7bit us-ascii printable chars, excluding CR LF>
-8bit = <MIME RFC 1521 8-bit text>
-quoted-printable = <MIME RFC 1521 quoted-printable text>
-base64 = <MIME RFC 1521 base64 text>
- ; the end of the text is marked with two CRLF sequences
- ; this results in one blank line before the start of the next property
-params = ";" [ws] paramlist
-paramlist = paramlist [ws] ";" [ws] param
- / param
-param = "TYPE" [ws] "=" [ws] ptypeval
- / "VALUE" [ws] "=" [ws] pvalueval
- / "ENCODING" [ws] "=" [ws] pencodingval
- / "CHARSET" [ws] "=" [ws] charsetval
- / "LANGUAGE" [ws] "=" [ws] langval
- / "X-" word [ws] "=" [ws] word
- / knowntype
-ptypeval = knowntype / "X-" word
-pvalueval = "INLINE" / "URL" / "CONTENT-ID" / "CID" / "X-" word
-pencodingval = "7BIT" / "8BIT" / "QUOTED-PRINTABLE" / "BASE64" / "X-" word
-charsetval = <a character set string as defined in Section 7.1 of
- RFC 1521>
-langval = <a language string as defined in RFC 1766>
-addressparts = 0*6(strnosemi ";") strnosemi
- ; PO Box, Extended Addr, Street, Locality, Region, Postal Code,
- Country Name
-orgparts = *(strnosemi ";") strnosemi
- ; First is Organization Name, remainder are Organization Units.
-nameparts = 0*4(strnosemi ";") strnosemi
- ; Family, Given, Middle, Prefix, Suffix.
- ; Example:Public;John;Q.;Reverend Dr.;III, Esq.
-strnosemi = *(*nonsemi ("\;" / "\" CRLF)) *nonsemi
- ; To include a semicolon in this string, it must be escaped
- ; with a "\" character.
-nonsemi = <any non-control ASCII except ";">
-knowntype = "DOM" / "INTL" / "POSTAL" / "PARCEL" / "HOME" / "WORK"
- / "PREF" / "VOICE" / "FAX" / "MSG" / "CELL" / "PAGER"
- / "BBS" / "MODEM" / "CAR" / "ISDN" / "VIDEO"
- / "AOL" / "APPLELINK" / "ATTMAIL" / "CIS" / "EWORLD"
- / "INTERNET" / "IBMMAIL" / "MCIMAIL"
- / "POWERSHARE" / "PRODIGY" / "TLX" / "X400"
- / "GIF" / "CGM" / "WMF" / "BMP" / "MET" / "PMB" / "DIB"
- / "PICT" / "TIFF" / "PDF" / "PS" / "JPEG" / "QTIME"
- / "MPEG" / "MPEG2" / "AVI"
- / "WAVE" / "AIFF" / "PCM"
- / "X509" / "PGP"
-
-
-Section 3 : Internet Recommendations
-[DS4] 1
-Recommended Practice with SMTP/MIME
-The vCard information can be transported through SMTP/MIME based electronic mail services. Interoperability of vCard information over SMTP/MIME transports can be better assured by following a common set of recommended practices for encapsulation of the vCard.
-Text/Plain Content Type
-Without any change to existing SMTP or MIME compliant user agents, a vCard can be included within Internet email messages. This might be the case for an existing, simple user agent such as a legacy SMTP mail system. While this approach provides for transport of vCards over SMTP services, it does not allow for the end user to take advantage of the full capabilities of either the vCard or Internet email (i.e., MIME) functionality.
-The following demonstrates how a vCard can be included as an epilog to a SMTP message made up of a RFC 822 message. This may be an initial method for incorporating vCard objects into SMTP messages.
-Date: Thr, 25 Jan 96 0932 EDT
-From: john.smith@host.com
-Subject: Re: RFC822 vCard Example
-Sender: john.smith@host.com
-To: smartin@host2.com
-Message-ID: <JOHNSMITH.960125T091020.xyzMail@host3.com>
-
-Steve: Thanks for the call earlier today. I am unable to
-use your material at this time. Please feel free to contact
-me in the future.
-BEGIN:VCARD
-VERSION:2.1
-N:Smith;John;M.;Mr.;Esq.
-TEL;WORK;VOICE;MSG:+1 (919) 555-1234
-TEL;WORK;FAX:+1 (919) 555-9876
-ADR;WORK;PARCEL;POSTAL;DOM:Suite 101;1 Central St.;Any Town;NC;27654
-END:VCARD
-The following example demonstrates how a vCard can be included as a separate text/plain content portion within current MIME user agents.
-Date: Fri, 26 Jan 1996 07:53:00 -0500
-From: smartin@host2.com
-Subject: RE: Text/Plain MIME vCard Example
-To: fdawson@VNET.IBM.COM
-Mime-Version: 1.0
-Content-Type: multipart/mixed; boundary=vcard
-Message-ID: <ABC-1.00-Note-martin-steve-0824475754>
-
---vcard
-Content-Type:text/plain; charset=us-ascii
-Content-Transfer-Encoding: 7bit
-John: I have looked over my material and feel that you may
-have over looked a couple of appropriate pieces. Please give
-me a call so that we can discuss further.
---vcard
-Content-Type:text/plain; charset=us-ascii; name="MARTIN.VCF"
-
-BEGIN:VCARD
-VERSION:2.1
-N:Martin;Stephen
-TEL;HOME;VOICE:+1 (210) 555-1357
-TEL;HOME;FAX:+1 (210) 555-0864
-ADR;WORK;PARCEL;POSTAL;DOM:123 Cliff Ave.;Big Town;CA;97531
-END:VCARD
---vcard--
-Text/X-vCard Content Type
-A vCard object may also be transferred in a (RFC 1521) MIME entity as a non-standard "text/x-vCard" content-type. This (RFC 1521) MIME type maybe useful in those cases where the MIME compliant messaging service does not yet support the "application/directory" and "multipart/related" MIME content-types and yet the specificity of a calendaring and scheduling media type is required.
-The following example demonstrates how a vCard can be included as a separate non-standard text/x-vCard content portion within current MIME user agents.
-Date: Fri, 26 Jan 1996 07:53:00 +0000
-From: smartin@host2.com
-Subject: RE: Text/x-vCard MIME vCard Example
-To: fdawson@VNET.IBM.COM
-Mime-Version: 1.0
-Content-Type: multipart/mixed; boundary=vcard
-Message-ID: <ABC-1.00-Note-martin-steve-0824475754>
-
---vcard
-Content-Type:text/plain; charset=us-ascii
-Content-Transfer-Encoding: 7bit
-John: I have looked over my material and feel that you may
-have over looked a couple of appropriate pieces. Please give
-me a call so that we can discuss further.
---vcard
-Content-Type:text/x-vCard; charset=us-ascii; name="MARTIN.VCF"
-
-BEGIN:VCARD
-VERSION:2.1N:Martin;Stephen
-TEL;HOME;VOICE:+1 (210) 555-1357
-TEL;HOME;FAX:+1 (210) 555-0864
-ADR;WORK;PARCEL;POSTAL;DOM:123 Cliff Ave.;Big Town;CA;97531
-END:VCARD
---vcard--
-Application/Directory Content Type
-The Internet Engineering Task Force (IETF) Access and Searching of Internet Directories (ASID) working group has produced an Internet Draft defining the "application/directory" MIME content type. The current draft name is draft-ietf-asid-mime-direct-01.txt. This specification is intended to be aligned with this work. Internet Drafts are working documents of an IETF working group, valid for at most six months, and should be considered "works in progress".
-This MIME content type was designed to be used to transport directory information across MIME based electronic mail services. The internet draft is directly applicable to the exchange of business card data, such as that defined by the vCard specification.
-The versit PDI Team has worked within the IETF ASID Working Group to draft an application/directory profile that registers the method for transporting a vCard as an application/directory Content-Type. The current draft name is draft-ietf-asid-mime-vcard-00.txt. This work is expected to be progressed to a Request For Comment after the publication of this version of the vCard specification. In the interim, the following guidelines are provided to describe how a vCard might be conveyed using the application/directory draft specification.
-A vCard should be included in a MIME message that has a Content-Type header field value of "multipart/related". The vCard is included in the message as the primary body part. The position of the body part entity can also be specified with the "start=" parameter. This MIME body part entity has a Content-Type body part header field value of "application/directory" with a "profile" parameter value of "vcard". Any vCard binary information, such as a logo, picture, or digital audio pronunciation can be included inline within the vCard, as is specified by the vCard specification. Preferably, the binary information should be extracted from the vCard object and contained in the MIME message as secondary body part entities. The binary content in the secondary body part entities can be referenced from within the vCard object through the use of the "VALUE=" property parameter. In this latter case, the binary information should be transformed into a content type nominally supported by MIME user agents. For image content, this would be the Graphics Image Format (GIF) or Joint Picture Encoding Group (JPEG) formats. For audio content, this would be the 8-bit mu-law (PCM) format specified by the MIME specification.
-The following example defines how this might be specified:
-Date: Mon, 29 Jan 96 0830 EDT
-From: john.smith@host.com
-Subject: Re: MIME application/directory vCard Example
-Sender: john.smith@host.com
-To: smartin@host2.com
-Message-ID: <JOHNSMITH.960129T083020.xyzMail@host3.com>
-Content-Type: multipart/related; boundary="vcard";
- type=application/directory;
- start=<JOHNSMITH.part1.960129T083020.xyzMail@host3.com>
---vcard
-Content-Type: application/directory; charset=us-ascii;
- source="file://versit.or2"; profile="vcard"
-Content-ID: <<JOHNSMITH.part1.960129T083020.xyzMail@host3.com>
-BEGIN:VCARD
-VERSION:2.1
-N:Smith;John;M.;Mr.;Esq.
-TEL;WORK;VOICE;MSG:+1 (919) 555-1234
-TEL;CELL:+1 (919) 554-6758
-TEL;WORK;FAX:+1 (919) 555-9876
-PHOTO;GIF;MIME:<<JOHNSMITH.part3.960129T083020.xyzMail@host3.com>
-ADR;WORK;PARCEL;POSTAL;DOM:Suite 101;1 Central St.;Any Town;NC;27654
-END:VCARD
---vcard
-Content-Type: text/plain; charset=us-ascii
-Content-ID: <<JOHNSMITH.part2.960129T083020.xyzMail@host3.com>
-Steve:
-I am not in the office today. You may want to try
-reaching me either on my cellular telephone or fax your
-new ideas to my office.
-Let's setup a face-to-face meeting later this week, after I review
-your updated material. I am including a picture in my business card
-data, since we have not met yet.
--- John
---vcard
-Content-Type: image/gif
-Content-ID: <<JOHNSMITH.part3.960129T083020.xyzMail@host3.com>
-...image data would go here...
---vcard--
-Recommended Practice with HTTP/HTML
-A vCard object should be transferred over HTTP with the non-standard MIME type/subtype value of "text/x-vCard". The non-standard subtype should be used because the vCard has not been registered as a MIME media type with the IANA.
-The vCard information can be captured with a FORM type of HTML document. Interoperability of of vCard information can be better assured by following a common set of recommended practices for mapping vCard information into and out of HTML documents.
-Form Element Usage
-The HTML FORM element is a useful method for capturing data intended for input into individual vCard property values. The following recommended practices are provided for such use.
-Mapping To INPUT Element Attribute Names
-An HTML form data set is a useful mechanism for capturing vCard data within the Internet WWW. The use of a consistent naming scheme for the name attributes within a form element will permit implementations to support automatic fill-in of forms with existing vCard data. In addition, such a consistent naming scheme will provide a greater assurance of interoperability between HTML based applications that use vCard data.
-The following table provides a recommended mapping of vCard properties and name attributes within a form element.
-Identification Properties
-Description
-Attribute Name
-Comment
-
-Formatted Name
-FN
-
-
-Name
-N
-Individual components of name property are captured as separate input elements with the names N.Family, N.First, N.Middle, N.Prefix, N.Suffix.
-
-Photograph
-PHOTO
-Only the URL based specification is supported by this mapping. Value is the URL for the graphic.
-
-Photograph Format Type
-PHOTO.Type
-Where the value is one of the enumerated strings defined by the vCard specification.
-
-Birthdate
-BDAY
-
-
-
-Delivery Addressing Properties
-Description
-Attribute Name
-Comment
-
-Delivery Address
-ADR
-TYPE=TEXTAREA
-
-Address Type
-ADR.x
-TYPE=CHECKBOX. Separate input elements are used to capture the possible delivery types. The elements are named ADR.x, where x is one of the enumerated strings defined by the vCard specification.
-
-Delivery Label
-LABEL
-
-
-Label Type
-LABEL.x
-TYPE=CHECKBOX. Separate input elements are used to capture the possible delivery types. The elements are named LABEL.x, where x is one of the enumerated strings defined by the vCard specification.
-
-
-Telecommunications Addressing Properties
-Description
-Attribute Name
-Comment
-
-Telephone Number
-TEL
-
-
-Telephone Type
-TEL.x
-TYPE=CHECKBOX. Separate input elements are used to capture the possible telephone types. The elements are named TEL.x, where x is one of the enumerated strings defined by the vCard specification.
-
-Electronic Mail Address
-EMAIL
-
-
-Electronic Mail Address Type
-EMAIL.Type
-Selection option from a list of alternatives.
-
-Mailer
-MAILER
-
-
-
-Geographical Properties
-Description
-Attribute Name
-Comment
-
-Time Zone
-TZ
-
-
-Geographic Position
-GEO
-
-
-
-Organizational Properties
-Description
-Attribute Name
-Comment
-
-Title
-TITLE
-
-
-Business Category
-ROLE
-
-
-Logo
-LOGO
-Only the URL based specification is supported by this mapping. Value is the URL for the graphic.
-
-Logo Format Type
-LOGO.Type
-Where the value is one of the enumerated strings defined by the vCard specification.
-
-Agent
-
-Captured through a separate form element using the mapping defined in these tables.
-
-Organization
-ORG
-TYPE=TEXT. Separate input elements for the organizational name and unit. The name ORG.Name is used to capture the organizational name. The name ORG.UNIT is used to capture the organizational unit. If there are multiple organizational units, it is captured in a form with name attributes ORG.UNIT1, ORG.UNIT2, etc.
-
-
-Explanatory Properties
-Description
-Attribute Name
-Comment
-
-Comment
-NOTE
-TYPE=TEXT
-
-Last Revision
-REV
-A hidden field.
-
-Version
-VERSION
-A hidden field with the value set to the string ì2.1î.
-
-Language
-LANG
-A hidden field with the value set to the string associated with the default language used in the form (e.g., US-eng).
-
-Sound
-SOUND
-TYPE=TEXT
-
-Sound Type
-N/A
-
-
-Uniform Resource Locator
-URL
-TYPE=TEXT
-
-Unique Identifier
-UID
-TYPE=TEXT
-
-Binary Encoding
-BE.x
-Where x is one of the enumerated encoding types defined by the vCard specification.
-
-
-Security Properties
-Description
-Attribute Name
-Comment
-
-Public Key
-KEY
-
-
-Key Type
-KEY.Type.x
-Where x is one of the enumerated encoding types defined by the vCard specification.
-
-MISCELLANEOUS PROPERTIES
-
-
-
-Extensions
-X-x
-Where x is a string defined by the extension author.
-
-
-Where multiple properties (e.g., telephone numbers) appear, a label prefix should be used. For example, telephone #1 might have a name attribute of ìA.TELî, telephone #2 might have a name attribute of ìB.TELî, etc.
-Example HTML Code
-The following HTML code is an example of the use of the mapping of INPUT element attributes names to vCard property names. The code can be used to capture input data for creating a vCard on a Web homepage.
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
-<head>
-<title>Create Your Own Versitcard</title>
-</head>
-<IMG src="versit.gif">
-<h1>Create Your Own Versitcard</h1>
-<P> Fill out this form and we'll
-create a <b>Versitcard</b> for you and send it to the email address of your choice,
-along with more information on the Versitcard format.</P>
-<hr><!-- Identification And Organizational Properties -->
-<FORM METHOD="POST" ACTION="/cgi-bin/vcard-maker">
-Formatted Name:<INPUT name="FN" type=text size=32 maxlength=64
-value=""><br>
-Phoenetic Pronunciation:<INPUT name="SOUND" type=text size=32 maxlength=128 value=""><br>
-Company Name:<INPUT name="ORG.Name" type=text size=32 maxlength=64
-value=""><br>
-Company Unit:<INPUT name="ORG.Unit" type=text size=32
-maxlength=64 value=""><br>
-Title:<INPUT name="TITLE" type=text size=32 maxlength=64
-value="">
-<hr><!-- Name Property Component Values -->
-Family Name:<INPUT name="N.Family" type=text size=32 maxlength=64
-value=""><br>
-Given Name:<INPUT name="N.Given" type=text size=32
-maxlength=64 value=""><br>
-Middle Name:<INPUT name="N.Middle" type=type size=32
-maxlength=64 value=""><br>
-Name Prefix:<INPUT name="N.Prefix" type=type size=32
-maxlength=64 value=""><br>
-Name Suffix:<INPUT name="N.Suffix" type=type size=32
-maxlength=64 value=""><br>
-<hr><!-- Delivery Addressing Properties -->
-Delivery Label:<TEXTAREA name="LABEL" cols=64 ROWS=5>
-</TEXTAREA><br><br>
-Post Office Address:<INPUT name="ADR.POAddr" type=text size=32
-maxlength=64 value=""><br>
-Extended Address:<INPUT name="ADR.ExtAddr" type=text size=32
-maxlength=64 value=""><br>
-Street Address:<INPUT name="ADR.Street" type=text size=62
-maxlength=128 value=""><br>
-City:<INPUT name="ADR.Locality" type=text size=16 maxlength=32
-value="">
-Region:<INPUT name="ADR.Region" type=text size=16 maxlength=32
-value="">
-Postal Code:<INPUT name="ADR.PostalCode" type=text size=16 maxlength=32
-value=""><br>
-Country Name:<INPUT name="ADR.CountryName" type=text size=16 maxlength=32 value="USA">
-<INPUT type=checkbox name="ADR.Work" value=WORK checked>Work
-<INPUT type=checkbox name="ADR.Home" value=HOME>Home
-<INPUT type=checkbox name="ADR.Parcel" value=PARCEL checked>Parcel <INPUT type=checkbox name="ADR.Postal" value=POSTAL checked>Postal<br>
-<hr><!-- Geographical Properties -->
-TimeZone:<INPUT name="TZ" type=text size=3 maxlength=8
-value="-06">
-Location:<INPUT name="GEO" type=text size=16 maxlength=32 value=""><br>
-<hr><!-- Telephony Addressing Properties -->
-<!-- Telephone #1 -->
-Telephone #1:<INPUT type=text name="A.TEL" size=20 maxlength=40 value="+1 (000) 000-0000"><br>
-<INPUT type=checkbox name="A.TEL.Work" value=WORK checked>Work
-<INPUT type=checkbox name="A.TEL.Home" value=HOME>Home
-<INPUT type=checkbox name="A.TEL.Voice" value=VOICE checked>Voice
-<INPUT type=checkbox name="A.TEL.Msg" value=MSG checked>Msg <INPUT type=checkbox name="A.TEL.Fax" value=FAX>Fax <INPUT type=checkbox name="A.TEL.Prefer" value=PREFER checked>Preferred<br>
-<hr><!-- Telephone #2 -->
-Telephone #2:<INPUT type=text name="B.TEL" size=20 maxlength=40 value="+1 (000) 000-0000"><br>
-<INPUT type=checkbox name="B.TEL.Work" value=WORK checked>Work <INPUT type=checkbox name="B.TEL.Home" value=HOME>Home
-<INPUT type=checkbox name="B.TEL.Voice" value=VOICE>Voice <INPUT type=checkbox name="B.TEL.Msg" value=MSG>Msg
-<INPUT type=checkbox name="B.TEL.Fax" value=FAX checked>Fax
-<INPUT type=checkbox name="B.TEL.Prefer" value=PREFER>Preferred<br>
-<hr><!-- Telephone #3 -->
-Telephone #3:<INPUT type=text name= "C.TEL" size=20 maxlength=40 value="+1 (000) 000-0000"><br>
-<INPUT type=checkbox name="C.TEL.Work" value=WORK>Work
-<INPUT type=checkbox name="C.TEL.Home" value=HOME checked>Home <INPUT type=checkbox name="C.TEL.Voice" value=VOICE checked>Voice <INPUT type=checkbox name="C.TEL.Msg" value=MSG checked>Msg
-<INPUT type=checkbox name="C.TEL.Fax" value=FAX checked>Fax <INPUT type=checkbox name="D.Prefer" value=PREFER>Preferred<br>
-<hr><!-- Email D -->
-EmailAddress: <select name="D.EMAILTYPE">
-<option selected>INTERNET:
-<option>CompuServe:
-<option>AOL:
-<option>Prodigy:
-<option>eWorld:
-<option>AppleLink:
-<option>AppleTalk:
-<option>PowerShare:
-<option>IBMMail:
-<option>ATTMail:
-<option>MCIMail:
-<option>X.400:
-<option>TLX:
-</select><INPUT type=text name="D.EMAIL" size=32 maxlength=64 value="">
-<INPUT type=checkbox name="D.EMAIL.Work" value=WORK checked>Work <INPUT type=checkbox name="D.EMAIL.Home" value=HOME checked>Home<br>
-<hr><!-- End of vCard Input -->
-Send my Versitcard to this <b>internet</b> email address:
-<INPUT type=text name="SENDTOADDR" size=32 maxlength=64 value=""><br> Press <INPUT TYPE=SUBMIT value="Send"> to send the form now. Or, press <INPUT TYPE=RESET value="Reset"> to reset values to the form defaults.
-</form>
-</body>
-
-
-Section 4 : UI Support Recommendations
-[DS5]
-When integrating vCard support into an application, an implementor needs to consider a number of user interface (UI) implications. Most appliss Type
-ADR.x
-TYPE=CHECKBOX. Separate input elements are used to capture the possible delivery types. The elements are named ADR.x, where x is one of the enumerated strings defined by the vCard specification.
-
-Delivery Label
-LABEL
-
-
-Label Type
-LABEL.x
-TYPE=CHECKBOX. Separate input elements are used to capture the possible delivery types. The elements are named LABEL.x, where x is one of the enumerated strings defined by the vCard specification.
-
-
-Telecommunications Addressing Properties
-Description
-Attribute Name
-Comment
-
-Telephone Number
-TEL
-
-
-Telephone Type
-TEL.x
-TYPE=CHECKBOX. Separate input elements are used to capture the possible telephone types. The elements are named TEL.x, where x is one of the enumerated strings defined by the vCard specification.
-
-Electronic Mail Address
-EMAIL
-
-
-Electronic Mail Address Type
-EMAIL.Type
-Selection option from a list of alternatives.
-
-Mailer
-MAILER
-
-
-
-Geographical Properties
-Description
-Attribute Name
-Comment
-
-Time Zone
-TZ
-
-
-Geographic Position
-GEO
-
-
-
-Organizational Properties
-Description
-Attribute Name
-Comment
-
-Title
-TITLE
-
-
-Business Category
-ROLE
-
-
-Logo
-LOGO
-Only the URL based specification is supported by this mapping. Value is the URL for the graphic.
-
-Logo Format Type
-LOGO.Type
-Where the value is one of the enumerated strings defined by the vCard specification.
-
-Agent
-
-Captured through a separate form element using the mapping defined in these tables.
-
-Organization
-ORG
-TYPE=TEXT. Separate input elements for the organizational name and unit. The name ORG.Name is used to capture the organizational name. The name ORG.UNIT is used to capture the organizational unit. If there are multiple organizational units, it is captured in a form with name attributes ORG.UNIT1, ORG.UNIT2, etc.
-
-
-Explanatory Properties
-Description
-Attribute Name
-Comment
-
-Comment
-NOTE
-TYPE=TEXT
-
-Last Revision
-REV
-A hidden field.
-
-Version
-VERSION
-A hidden field with the value set to the string ì2.1î.
-
-Language
-LANG
-A hidden field with the value set to the string associated with the default language used in the form (e.g., US-eng).
-
-Sound
-SOUND
-TYPE=TEXT
-
-Sound Type
-N/A
-
-
-Uniform Resource Locator
-URL
-TYPE=TEXT
-
-Unique Identifier
-UID
-TYPE=TEXT
-
-Binary Encoding
-BE.x
-Where x is one of the enumerated encoding types defined by the vCard specification.
-
-
-Security Properties
-Description
-Attribute Name
-Comment
-
-Public Key
-KEY
-
-
-Key Type
-KEY.Type.x
-Where x is one of the enumerated encoding types defined by the vCard specification.
-
-MISCELLANEOUS PROPERTIES
-
-
-
-Extensions
-X-x
-Where x is a string defined by the extension author.
-
-
-Where multiple properties (e.g., telephone numbers) appear, a label prefix should be used. For example, telephone #1 might have a name attribute of ìA.TELî, telephone #2 might have a name attribute of ìB.TELî, etc.
-Example HTML Code
-The following HTML code is an example of the use of the mapping of INPUT element attributes names to vCard property names. The code can be used to capture input data for creating a vCard on a Web homepage.
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
-<head>
-<title>Create Your Own Versitcard</title>
-</head>
-<IMG src="versit.gif">
-<h1>Create Your Own Versitcard</h1>
-<P> Fill out this form and we'll
-create a <b>Versitcard</b> for you and send it to the email address of your choice,
-along with more information on the Versitcard format.</P>
-<hr><!-- Identification And Organizational Properties -->
-<FORM METHOD="POST" ACTION="/cgi-bin/vcard-maker">
-Formatted Name:<INPUT name="FN" type=text size=32 maxlength=64
-value=""><br>
-Phoenetic Pronunciation:<INPUT name="SOUND" type=text size=32 maxlength=128 value=""><br>
-Company Name:<INPUT name="ORG.Name" type=text size=32 maxlength=64
-value=""><br>
-Company Unit:<INPUT name="ORG.Unit" type=text size=32
-maxlength=64 value=""><br>
-Title:<INPUT name="TITLE" type=text size=32 maxlength=64
-value="">
-<hr><!-- Name Property Component Values -->
-Family Name:<INPUT nies.
-All forms of vCard Grouping must be able to be parsed and processed.
-Property Grouping must be able to be parsed and processed.
-Additionally, in order for a vCard Writer to conform to this specification it must meet the following additional criteria:
-Must be able to send at least the Version, Formatted Name, Name, Address, Telephone, Email, and Mailer properties.
-
-
-[DS1]This entry (merged from the ìTRIAL USE (TU)î document) appears to be a duplicate of the already-existing entry that follows, except for the publicaton/edition date. I would assume that itís OK to delete this item, but, Ö
-[DS2]This entry/line in the section is assigned the style for the level 1 heading. This is done so that a section number can be given in the chapter title (style "chptr_title") and so that "heading 1" (more specifically, the format/heading numbering of the form "1. Overview") can be "skipped," and the appropriate form for the next-level of heading can be properly displayed (eg., "1.1 Overview"). It is, and must be, formatted as "hidden text" prior to pagination and/or printing.
-[DS3]This entry/line in the section is assigned the style for the level 1 heading. This is done so that a section number can be given in the chapter title (style "chptr_title") and so that "heading 1" (more specifically, the format/heading numbering of the form "1. Overview") can be "skipped," and the appropriate form for the next-level of heading can be properly displayed (eg., "1.1 Overview"). It is, and must be, formatted as "hidden text" prior to pagination and/or printing.
-[DS4]This entry/line in the section is assigned the style for the level 1 heading. This is done so that a section number can be given in the chapter title (style "chptr_title") and so that "heading 1" (more specifically, the format/heading numbering of the form "1. Overview") can be "skipped," and the appropriate form for the next-level of heading can be properly displayed (eg., "1.1 Overview"). It is, and must be, formatted as "hidden text" prior to pagination and/or printing.
-[DS5]This entry/line in the section is assigned the style for the level 1 heading. This is done so that a section number can be given in the chapter title (style ìchptr_title") and so that "heading 1" (more specifically, the format/heading numbering of the form "1. Overview") can be "skipped," and the appropriate form for the next-level of heading can be properly displayed (eg., "1.1 Overview"). It is, and must be, formatted as "hidden text" prior to pagination and/or printing.
-[DS6]This entry/line in the section is assigned the style for the level 1 heading. This is done so that a section number can be given in the chapter title (style ìchptr_title") and so that "heading 1" (more specifically, the format/heading numbering of the form "1. Overview") can be "skipped," and the appropriate form for the next-level of heading can be properly displayed (eg., "1.1 Overview"). It is, and must be, formatted as "hidden text" prior to pagination and/or printing.
-
-
-
-
-
-
-
-$paratext[Pr.Preface]
-
-
-
-
-
-
-
-
-vi vCard Specification, Version 2.1
-
- v
-
-versit Update vii
-
-
-
-
-
-
-
-36 vCard Specification, Version 2.1
-
- xi
-
-
-
-
- 39
-
-
diff --git a/addressbook/backend/ebook/e-book-async.c b/addressbook/backend/ebook/e-book-async.c
deleted file mode 100644
index d21f22a739..0000000000
--- a/addressbook/backend/ebook/e-book-async.c
+++ /dev/null
@@ -1,1121 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include "ebook/e-book-async.h"
-
-static GThread *worker_thread;
-static GAsyncQueue *to_worker_queue;
-static GAsyncQueue *from_worker_queue;
-
-typedef struct _EBookMsg EBookMsg;
-
-typedef void (*EBookMsgHandler)(EBookMsg* msg);
-typedef void (*EBookMsgDtor)(EBookMsg* msg);
-
-struct _EBookMsg {
- EBookMsgHandler handler;
- EBookMsgDtor dtor;
-};
-
-static gpointer
-worker (gpointer data)
-{
- while (TRUE) {
- EBookMsg *msg = g_async_queue_pop (to_worker_queue);
- msg->handler (msg);
- msg->dtor (msg);
- }
-
- return NULL;
-}
-
-static gboolean
-main_thread_check_for_response (gpointer data)
-{
- EBookMsg *msg;
-
- while ((msg = g_async_queue_try_pop (from_worker_queue)) != NULL) {
- msg->handler (msg);
- msg->dtor (msg);
- }
-
- return TRUE;
-}
-
-static void
-e_book_msg_init (EBookMsg *msg, EBookMsgHandler handler, EBookMsgDtor dtor)
-{
- msg->handler = handler;
- msg->dtor = dtor;
-}
-
-static void
-init_async()
-{
- static gboolean init_done = FALSE;
- if (!init_done) {
- init_done = TRUE;
- to_worker_queue = g_async_queue_new ();
- from_worker_queue = g_async_queue_new ();
- worker_thread = g_thread_create (worker, NULL, FALSE, NULL);
- g_timeout_add (300, main_thread_check_for_response, NULL);
- }
-}
-
-
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- char *uri;
- EBookCallback open_response;
- gpointer closure;
-} LoadUriMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- EBookCallback open_response;
- gpointer closure;
-} LoadUriResponse;
-
-static void
-_load_uri_response_handler (EBookMsg *msg)
-{
- LoadUriResponse *resp = (LoadUriResponse*)msg;
-
- resp->open_response (resp->book, resp->status, resp->closure);
-}
-
-static void
-_load_uri_response_dtor (EBookMsg *msg)
-{
- LoadUriResponse *resp = (LoadUriResponse*)msg;
-
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_load_uri_handler (EBookMsg *msg)
-{
- LoadUriMsg *uri_msg = (LoadUriMsg *)msg;
- LoadUriResponse *response;
- GError *error = NULL;
-
- response = g_new (LoadUriResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _load_uri_response_handler, _load_uri_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_load_uri (uri_msg->book, uri_msg->uri, FALSE, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
-
- response->book = uri_msg->book;
- response->open_response = uri_msg->open_response;
- response->closure = uri_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_load_uri_dtor (EBookMsg *msg)
-{
- LoadUriMsg *uri_msg = (LoadUriMsg *)msg;
-
- g_free (uri_msg->uri);
- g_free (uri_msg);
-}
-
-void
-e_book_async_load_uri (EBook *book,
- const char *uri,
- EBookCallback open_response,
- gpointer closure)
-{
- LoadUriMsg *msg;
-
- init_async ();
-
- msg = g_new (LoadUriMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _load_uri_handler, _load_uri_dtor);
-
- msg->book = g_object_ref (book);
- msg->uri = g_strdup (uri);
- msg->open_response = open_response;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-}
-
-
-void
-e_book_async_unload_uri (EBook *book)
-{
- e_book_unload_uri (book, NULL);
-}
-
-
-
-
-typedef struct {
- EBookMsg msg;
-
- EBookCallback open_response;
- gpointer closure;
-} DefaultBookMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- EBookCallback open_response;
- gpointer closure;
-} DefaultBookResponse;
-
-static void
-_default_book_response_handler (EBookMsg *msg)
-{
- LoadUriResponse *resp = (LoadUriResponse*)msg;
-
- resp->open_response (resp->book, resp->status, resp->closure);
-}
-
-static void
-_default_book_response_dtor (EBookMsg *msg)
-{
- LoadUriResponse *resp = (LoadUriResponse*)msg;
-
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_default_book_handler (EBookMsg *msg)
-{
- DefaultBookMsg *dfb_msg = (DefaultBookMsg *)msg;
- DefaultBookResponse *response;
- GError *error = NULL;
-
- response = g_new (DefaultBookResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _default_book_response_handler, _default_book_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_get_default_addressbook (&response->book, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
-
- response->open_response = dfb_msg->open_response;
- response->closure = dfb_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_default_book_dtor (EBookMsg *msg)
-{
- DefaultBookMsg *dfb_msg = (DefaultBookMsg *)msg;
-
- g_free (dfb_msg);
-}
-
-void
-e_book_async_get_default_addressbook (EBookCallback open_response,
- gpointer closure)
-{
- DefaultBookMsg *msg;
-
- init_async ();
-
- msg = g_new (DefaultBookMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _default_book_handler, _default_book_dtor);
-
- msg->open_response = open_response;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-}
-
-
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookFieldsCallback cb;
- gpointer closure;
-} GetFieldsMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- GList *fields;
- EBookFieldsCallback cb;
- gpointer closure;
-} GetFieldsResponse;
-
-static void
-_get_fields_response_handler (EBookMsg *msg)
-{
- GetFieldsResponse *resp = (GetFieldsResponse*)msg;
- GList *l;
- EList *fields = e_list_new ((EListCopyFunc) g_strdup,
- (EListFreeFunc) g_free,
- NULL);
-
- for (l = resp->fields; l; l = l->next)
- e_list_append (fields, l->data);
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, fields, resp->closure);
-
- g_object_unref (fields);
-}
-
-static void
-_get_fields_response_dtor (EBookMsg *msg)
-{
- GetFieldsResponse *resp = (GetFieldsResponse*)msg;
-
- g_list_foreach (resp->fields, (GFunc)g_free, NULL);
- g_list_free (resp->fields);
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_get_fields_handler (EBookMsg *msg)
-{
- GetFieldsMsg *fields_msg = (GetFieldsMsg *)msg;
- GetFieldsResponse *response;
- GError *error = NULL;
-
- response = g_new (GetFieldsResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _get_fields_response_handler, _get_fields_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_get_supported_fields (fields_msg->book, &response->fields, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
- response->book = fields_msg->book;
- response->cb = fields_msg->cb;
- response->closure = fields_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-guint
-e_book_async_get_supported_fields (EBook *book,
- EBookFieldsCallback cb,
- gpointer closure)
-{
- GetFieldsMsg *msg;
-
- init_async ();
-
- msg = g_new (GetFieldsMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _get_fields_handler, (EBookMsgDtor)g_free);
-
- msg->book = g_object_ref (book);
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-
- return 0;
-}
-
-
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookAuthMethodsCallback cb;
- gpointer closure;
-} GetMethodsMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- GList *methods;
- EBookAuthMethodsCallback cb;
- gpointer closure;
-} GetMethodsResponse;
-
-static void
-_get_methods_response_handler (EBookMsg *msg)
-{
- GetMethodsResponse *resp = (GetMethodsResponse*)msg;
- GList *l;
- EList *methods = e_list_new ((EListCopyFunc) g_strdup,
- (EListFreeFunc) g_free,
- NULL);
-
- for (l = resp->methods; l; l = l->next)
- e_list_append (methods, l->data);
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, methods, resp->closure);
-
- g_object_unref (methods);
-}
-
-static void
-_get_methods_response_dtor (EBookMsg *msg)
-{
- GetMethodsResponse *resp = (GetMethodsResponse*)msg;
-
- g_list_foreach (resp->methods, (GFunc)g_free, NULL);
- g_list_free (resp->methods);
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_get_methods_handler (EBookMsg *msg)
-{
- GetMethodsMsg *methods_msg = (GetMethodsMsg *)msg;
- GetMethodsResponse *response;
- GError *error = NULL;
-
- response = g_new (GetMethodsResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _get_methods_response_handler, _get_methods_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_get_supported_auth_methods (methods_msg->book, &response->methods, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
-
- response->book = methods_msg->book;
- response->cb = methods_msg->cb;
- response->closure = methods_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-guint
-e_book_async_get_supported_auth_methods (EBook *book,
- EBookAuthMethodsCallback cb,
- gpointer closure)
-{
- GetMethodsMsg *msg;
-
- init_async ();
-
- msg = g_new (GetMethodsMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _get_methods_handler, (EBookMsgDtor)g_free);
-
- msg->book = g_object_ref (book);
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-
- return 0;
-}
-
-
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- char *user;
- char *passwd;
- char *auth_method;
- EBookCallback cb;
- gpointer closure;
-} AuthUserMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- EBookCallback cb;
- gpointer closure;
-} AuthUserResponse;
-
-static void
-_auth_user_response_handler (EBookMsg *msg)
-{
- AuthUserResponse *resp = (AuthUserResponse*)msg;
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, resp->closure);
-}
-
-static void
-_auth_user_response_dtor (EBookMsg *msg)
-{
- AuthUserResponse *resp = (AuthUserResponse*)msg;
-
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_auth_user_handler (EBookMsg *msg)
-{
- AuthUserMsg *auth_msg = (AuthUserMsg *)msg;
- AuthUserResponse *response;
- GError *error = NULL;
-
- response = g_new (AuthUserResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _auth_user_response_handler, _auth_user_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_authenticate_user (auth_msg->book, auth_msg->user, auth_msg->passwd, auth_msg->auth_method, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
- response->book = auth_msg->book;
- response->cb = auth_msg->cb;
- response->closure = auth_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_auth_user_dtor (EBookMsg *msg)
-{
- AuthUserMsg *auth_msg = (AuthUserMsg *)msg;
-
- g_free (auth_msg->user);
- g_free (auth_msg->passwd);
- g_free (auth_msg->auth_method);
-
- g_free (auth_msg);
-}
-
-/* User authentication. */
-void
-e_book_async_authenticate_user (EBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method,
- EBookCallback cb,
- gpointer closure)
-{
- AuthUserMsg *msg;
-
- init_async ();
-
- msg = g_new (AuthUserMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _auth_user_handler, _auth_user_dtor);
-
- msg->book = g_object_ref (book);
- msg->user = g_strdup (user);
- msg->passwd = g_strdup (passwd);
- msg->auth_method = g_strdup (auth_method);
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-}
-
-
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- char *id;
- EBookContactCallback cb;
- gpointer closure;
-} GetContactMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EContact *contact;
- EBookStatus status;
- EBookContactCallback cb;
- gpointer closure;
-} GetContactResponse;
-
-static void
-_get_contact_response_handler (EBookMsg *msg)
-{
- GetContactResponse *resp = (GetContactResponse*)msg;
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, resp->contact, resp->closure);
-}
-
-static void
-_get_contact_response_dtor (EBookMsg *msg)
-{
- GetContactResponse *resp = (GetContactResponse*)msg;
-
- g_object_unref (resp->contact);
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_get_contact_handler (EBookMsg *msg)
-{
- GetContactMsg *get_contact_msg = (GetContactMsg *)msg;
- GetContactResponse *response;
- GError *error = NULL;
-
- response = g_new (GetContactResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _get_contact_response_handler, _get_contact_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_get_contact (get_contact_msg->book, get_contact_msg->id, &response->contact, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
- response->book = get_contact_msg->book;
- response->cb = get_contact_msg->cb;
- response->closure = get_contact_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_get_contact_dtor (EBookMsg *msg)
-{
- GetContactMsg *get_contact_msg = (GetContactMsg *)msg;
-
- g_free (get_contact_msg->id);
- g_free (get_contact_msg);
-}
-
-/* Fetching contacts. */
-guint
-e_book_async_get_contact (EBook *book,
- const char *id,
- EBookContactCallback cb,
- gpointer closure)
-{
- GetContactMsg *msg;
-
- init_async ();
-
- msg = g_new (GetContactMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _get_contact_handler, _get_contact_dtor);
-
- msg->book = g_object_ref (book);
- msg->id = g_strdup (id);
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-
- return 0;
-}
-
-
-
-/* Deleting cards. */
-gboolean
-e_book_async_remove_contact (EBook *book,
- EContact *contact,
- EBookCallback cb,
- gpointer closure)
-{
- const char *id = e_contact_get_const (contact, E_CONTACT_UID);
-
- return e_book_async_remove_contact_by_id (book, id, cb, closure);
-}
-
-gboolean
-e_book_async_remove_contact_by_id (EBook *book,
- const char *id,
- EBookCallback cb,
- gpointer closure)
-{
- GList *list = g_list_append (NULL, g_strdup (id));
-
- return e_book_async_remove_contacts (book, list, cb, closure);
-}
-
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- GList *id_list;
- EBookCallback cb;
- gpointer closure;
-} RemoveContactsMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- EBookCallback cb;
- gpointer closure;
-} RemoveContactsResponse;
-
-static void
-_remove_contacts_response_handler (EBookMsg *msg)
-{
- RemoveContactsResponse *resp = (RemoveContactsResponse*)msg;
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, resp->closure);
-}
-
-static void
-_remove_contacts_response_dtor (EBookMsg *msg)
-{
- RemoveContactsResponse *resp = (RemoveContactsResponse*)msg;
-
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_remove_contacts_handler (EBookMsg *msg)
-{
- RemoveContactsMsg *remove_contacts_msg = (RemoveContactsMsg *)msg;
- RemoveContactsResponse *response;
- GError *error = NULL;
-
- response = g_new (RemoveContactsResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _remove_contacts_response_handler, _remove_contacts_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_remove_contacts (remove_contacts_msg->book, remove_contacts_msg->id_list, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
- response->book = remove_contacts_msg->book;
- response->cb = remove_contacts_msg->cb;
- response->closure = remove_contacts_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_remove_contacts_dtor (EBookMsg *msg)
-{
- RemoveContactsMsg *remove_contacts_msg = (RemoveContactsMsg *)msg;
-
- g_list_foreach (remove_contacts_msg->id_list, (GFunc)g_free, NULL);
- g_list_free (remove_contacts_msg->id_list);
- g_free (remove_contacts_msg);
-}
-
-gboolean
-e_book_async_remove_contacts (EBook *book,
- GList *id_list,
- EBookCallback cb,
- gpointer closure)
-{
- RemoveContactsMsg *msg;
- GList *l;
- init_async ();
-
- msg = g_new (RemoveContactsMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _remove_contacts_handler, _remove_contacts_dtor);
-
- msg->book = g_object_ref (book);
- msg->id_list = g_list_copy (id_list);
- for (l = msg->id_list; l; l = l->next)
- l->data = g_strdup (l->data);
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-
- return 0;
-}
-
-
-
-/* Adding contacts. */
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EContact *contact;
- EBookIdCallback cb;
- gpointer closure;
-} AddContactMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- char *id;
- EBookStatus status;
- EBookIdCallback cb;
- gpointer closure;
-} AddContactResponse;
-
-static void
-_add_contact_response_handler (EBookMsg *msg)
-{
- AddContactResponse *resp = (AddContactResponse*)msg;
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, resp->id, resp->closure);
-}
-
-static void
-_add_contact_response_dtor (EBookMsg *msg)
-{
- AddContactResponse *resp = (AddContactResponse*)msg;
-
- g_object_unref (resp->book);
- g_free (resp->id);
- g_free (resp);
-}
-
-static void
-_add_contact_handler (EBookMsg *msg)
-{
- AddContactMsg *add_contact_msg = (AddContactMsg *)msg;
- AddContactResponse *response;
- GError *error = NULL;
-
- response = g_new (AddContactResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _add_contact_response_handler, _add_contact_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_add_contact (add_contact_msg->book, add_contact_msg->contact, &error)) {
- response->status = error->code;
- response->id = NULL;
- g_error_free (error);
- }
- else {
- response->id = e_contact_get (add_contact_msg->contact, E_CONTACT_UID);
- }
- response->book = add_contact_msg->book;
- response->cb = add_contact_msg->cb;
- response->closure = add_contact_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_add_contact_dtor (EBookMsg *msg)
-{
- AddContactMsg *add_contact_msg = (AddContactMsg *)msg;
-
- g_object_unref (add_contact_msg->contact);
- g_free (add_contact_msg);
-}
-
-gboolean
-e_book_async_add_contact (EBook *book,
- EContact *contact,
- EBookIdCallback cb,
- gpointer closure)
-{
- AddContactMsg *msg;
-
- init_async ();
-
- msg = g_new (AddContactMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _add_contact_handler, _add_contact_dtor);
-
- msg->book = g_object_ref (book);
- msg->contact = g_object_ref (contact); /* XXX maybe we should _duplicate it here instead */
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-
- return TRUE;
-}
-
-
-
-/* Modifying cards. */
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EContact *contact;
- EBookCallback cb;
- gpointer closure;
-} CommitContactMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- EBookCallback cb;
- gpointer closure;
-} CommitContactResponse;
-
-static void
-_commit_contact_response_handler (EBookMsg *msg)
-{
- CommitContactResponse *resp = (CommitContactResponse*)msg;
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, resp->closure);
-}
-
-static void
-_commit_contact_response_dtor (EBookMsg *msg)
-{
- CommitContactResponse *resp = (CommitContactResponse*)msg;
-
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_commit_contact_handler (EBookMsg *msg)
-{
- CommitContactMsg *commit_contact_msg = (CommitContactMsg *)msg;
- CommitContactResponse *response;
- GError *error = NULL;
-
- response = g_new (CommitContactResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _commit_contact_response_handler, _commit_contact_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_commit_contact (commit_contact_msg->book, commit_contact_msg->contact, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
- response->book = commit_contact_msg->book;
- response->cb = commit_contact_msg->cb;
- response->closure = commit_contact_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_commit_contact_dtor (EBookMsg *msg)
-{
- CommitContactMsg *commit_contact_msg = (CommitContactMsg *)msg;
-
- g_object_unref (commit_contact_msg->contact);
- g_free (commit_contact_msg);
-}
-
-
-gboolean
-e_book_async_commit_contact (EBook *book,
- EContact *contact,
- EBookCallback cb,
- gpointer closure)
-{
- CommitContactMsg *msg;
-
- init_async ();
-
- msg = g_new (CommitContactMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _commit_contact_handler, _commit_contact_dtor);
-
- msg->book = g_object_ref (book);
- msg->contact = g_object_ref (contact); /* XXX maybe we should _duplicate it here instead */
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-
- return TRUE;
-}
-
-
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookQuery *query;
- EBookBookViewCallback cb;
- gpointer closure;
-} GetBookViewMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- EBookView *book_view;
- EBookBookViewCallback cb;
- gpointer closure;
-} GetBookViewResponse;
-
-static void
-_get_book_view_response_handler (EBookMsg *msg)
-{
- GetBookViewResponse *resp = (GetBookViewResponse*)msg;
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, resp->book_view, resp->closure);
-}
-
-static void
-_get_book_view_response_dtor (EBookMsg *msg)
-{
- GetBookViewResponse *resp = (GetBookViewResponse*)msg;
-
- g_object_unref (resp->book);
- g_object_unref (resp->book_view);
- g_free (resp);
-}
-
-static void
-_get_book_view_handler (EBookMsg *msg)
-{
- GetBookViewMsg *view_msg = (GetBookViewMsg *)msg;
- GetBookViewResponse *response;
- GError *error = NULL;
-
- response = g_new (GetBookViewResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _get_book_view_response_handler, _get_book_view_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_get_book_view (view_msg->book, view_msg->query, NULL, -1, &response->book_view, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
- response->book = view_msg->book;
- response->cb = view_msg->cb;
- response->closure = view_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_get_book_view_dtor (EBookMsg *msg)
-{
- GetBookViewMsg *view_msg = (GetBookViewMsg *)msg;
-
- e_book_query_unref (view_msg->query);
- g_free (view_msg);
-}
-
-guint
-e_book_async_get_book_view (EBook *book,
- const gchar *query,
- EBookBookViewCallback cb,
- gpointer closure)
-{
- GetBookViewMsg *msg;
-
- init_async ();
-
- msg = g_new (GetBookViewMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _get_book_view_handler, _get_book_view_dtor);
-
- msg->book = g_object_ref (book);
- msg->query = e_book_query_from_string (query);
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-
- return 0;
-}
-
-
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookQuery *query;
- EBookContactsCallback cb;
- gpointer closure;
-} GetContactsMsg;
-
-typedef struct {
- EBookMsg msg;
-
- EBook *book;
- EBookStatus status;
- GList *contacts;
- EBookContactsCallback cb;
- gpointer closure;
-} GetContactsResponse;
-
-static void
-_get_contacts_response_handler (EBookMsg *msg)
-{
- GetContactsResponse *resp = (GetContactsResponse*)msg;
-
- if (resp->cb)
- resp->cb (resp->book, resp->status, resp->contacts, resp->closure);
-}
-
-static void
-_get_contacts_response_dtor (EBookMsg *msg)
-{
- GetContactsResponse *resp = (GetContactsResponse*)msg;
-
- g_object_unref (resp->book);
- g_free (resp);
-}
-
-static void
-_get_contacts_handler (EBookMsg *msg)
-{
- GetContactsMsg *view_msg = (GetContactsMsg *)msg;
- GetContactsResponse *response;
- GError *error = NULL;
-
- response = g_new (GetContactsResponse, 1);
- e_book_msg_init ((EBookMsg*)response, _get_contacts_response_handler, _get_contacts_response_dtor);
-
- response->status = E_BOOK_ERROR_OK;
- if (!e_book_get_contacts (view_msg->book, view_msg->query, &response->contacts, &error)) {
- response->status = error->code;
- g_error_free (error);
- }
- response->book = view_msg->book;
- response->cb = view_msg->cb;
- response->closure = view_msg->closure;
-
- g_async_queue_push (from_worker_queue, response);
-}
-
-static void
-_get_contacts_dtor (EBookMsg *msg)
-{
- GetContactsMsg *view_msg = (GetContactsMsg *)msg;
-
- e_book_query_unref (view_msg->query);
- g_free (view_msg);
-}
-
-guint
-e_book_async_get_contacts (EBook *book,
- const gchar *query,
- EBookContactsCallback cb,
- gpointer closure)
-{
- GetContactsMsg *msg;
-
- init_async ();
-
- msg = g_new (GetContactsMsg, 1);
- e_book_msg_init ((EBookMsg*)msg, _get_contacts_handler, _get_contacts_dtor);
-
- msg->book = g_object_ref (book);
- msg->query = e_book_query_from_string (query);
- msg->cb = cb;
- msg->closure = closure;
-
- g_async_queue_push (to_worker_queue, msg);
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/e-book-async.h b/addressbook/backend/ebook/e-book-async.h
deleted file mode 100644
index 097f3cff61..0000000000
--- a/addressbook/backend/ebook/e-book-async.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Chris Toshok (toshok@ximian.com)
- *
- * Copyright (C) 2003, Ximian, Inc.
- */
-
-#ifndef __E_BOOK_ASYNC_H__
-#define __E_BOOK_ASYNC_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <e-util/e-list.h>
-#include <ebook/e-contact.h>
-#include <ebook/e-book.h>
-
-G_BEGIN_DECLS
-
-/* Callbacks for asynchronous functions. */
-typedef void (*EBookCallback) (EBook *book, EBookStatus status, gpointer closure);
-typedef void (*EBookOpenProgressCallback) (EBook *book,
- const char *status_message,
- short percent,
- gpointer closure);
-typedef void (*EBookIdCallback) (EBook *book, EBookStatus status, const char *id, gpointer closure);
-typedef void (*EBookContactCallback) (EBook *book, EBookStatus status, EContact *contact, gpointer closure);
-typedef void (*EBookContactsCallback) (EBook *book, EBookStatus status, GList *contacts, gpointer closure);
-typedef void (*EBookBookViewCallback) (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure);
-typedef void (*EBookFieldsCallback) (EBook *book, EBookStatus status, EList *fields, gpointer closure);
-typedef void (*EBookAuthMethodsCallback) (EBook *book, EBookStatus status, EList *auth_methods, gpointer closure);
-
-void e_book_async_load_uri (EBook *book,
- const char *uri,
- EBookCallback open_response,
- gpointer closure);
-
-void e_book_async_get_default_addressbook (EBookCallback open_response,
- gpointer closure);
-
-void e_book_async_unload_uri (EBook *book);
-
-guint e_book_async_get_supported_fields (EBook *book,
- EBookFieldsCallback cb,
- gpointer closure);
-
-guint e_book_async_get_supported_auth_methods (EBook *book,
- EBookAuthMethodsCallback cb,
- gpointer closure);
-
-/* User authentication. */
-void e_book_async_authenticate_user (EBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method,
- EBookCallback cb,
- gpointer closure);
-
-/* Fetching cards. */
-guint e_book_async_get_contact (EBook *book,
- const char *id,
- EBookContactCallback cb,
- gpointer closure);
-
-guint e_book_async_get_contacts (EBook *book,
- const char *query,
- EBookContactsCallback cb,
- gpointer closure);
-
-/* Deleting cards. */
-gboolean e_book_async_remove_contact (EBook *book,
- EContact *contact,
- EBookCallback cb,
- gpointer closure);
-gboolean e_book_async_remove_contact_by_id (EBook *book,
- const char *id,
- EBookCallback cb,
- gpointer closure);
-
-gboolean e_book_async_remove_contacts (EBook *book,
- GList *id_list,
- EBookCallback cb,
- gpointer closure);
-
-/* Adding cards. */
-gboolean e_book_async_add_contact (EBook *book,
- EContact *contact,
- EBookIdCallback cb,
- gpointer closure);
-
-/* Modifying cards. */
-gboolean e_book_async_commit_contact (EBook *book,
- EContact *contact,
- EBookCallback cb,
- gpointer closure);
-
-guint e_book_async_get_book_view (EBook *book,
- const gchar *query, /* XXX this needs to change to an EBookQuery */
- EBookBookViewCallback cb,
- gpointer closure);
-
-G_END_DECLS
-
-#endif /* ! __E_BOOK_H__ */
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
deleted file mode 100644
index 26ed54d2ec..0000000000
--- a/addressbook/backend/ebook/e-book-listener.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Exports the BookListener interface. Maintains a queue of messages
- * which come in on the interface.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <config.h>
-#include <bonobo/bonobo-main.h>
-#include "e-contact.h"
-#include "e-book-listener.h"
-#include "e-book-marshal.h"
-
-static EBookStatus e_book_listener_convert_status (GNOME_Evolution_Addressbook_CallStatus status);
-
-enum {
- RESPONSE,
- LAST_SIGNAL
-};
-
-static guint e_book_listener_signals [LAST_SIGNAL];
-
-static BonoboObjectClass *parent_class;
-
-struct _EBookListenerPrivate {
- guint stopped : 1;
-};
-
-static EBookStatus
-e_book_listener_convert_status (const GNOME_Evolution_Addressbook_CallStatus status)
-{
- switch (status) {
- case GNOME_Evolution_Addressbook_Success:
- return E_BOOK_ERROR_OK;
- case GNOME_Evolution_Addressbook_RepositoryOffline:
- return E_BOOK_ERROR_REPOSITORY_OFFLINE;
- case GNOME_Evolution_Addressbook_PermissionDenied:
- return E_BOOK_ERROR_PERMISSION_DENIED;
- case GNOME_Evolution_Addressbook_ContactNotFound:
- return E_BOOK_ERROR_CONTACT_NOT_FOUND;
- case GNOME_Evolution_Addressbook_ContactIdAlreadyExists:
- return E_BOOK_ERROR_CONTACT_ID_ALREADY_EXISTS;
- case GNOME_Evolution_Addressbook_AuthenticationFailed:
- return E_BOOK_ERROR_AUTHENTICATION_FAILED;
- case GNOME_Evolution_Addressbook_AuthenticationRequired:
- return E_BOOK_ERROR_AUTHENTICATION_REQUIRED;
- case GNOME_Evolution_Addressbook_TLSNotAvailable:
- return E_BOOK_ERROR_TLS_NOT_AVAILABLE;
- case GNOME_Evolution_Addressbook_NoSuchBook:
- return E_BOOK_ERROR_NO_SUCH_BOOK;
- case GNOME_Evolution_Addressbook_OtherError:
- default:
- return E_BOOK_ERROR_OTHER_ERROR;
- }
-}
-
-static void
-impl_BookListener_respond_create_contact (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- const CORBA_char* id,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- response.op = CreateContactResponse;
- response.status = e_book_listener_convert_status (status);
- response.id = g_strdup (id);
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-
- g_free (response.id);
-}
-
-static void
-impl_BookListener_respond_remove_contacts (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- response.op = RemoveContactResponse;
- response.status = e_book_listener_convert_status (status);
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_modify_contact (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- response.op = ModifyContactResponse;
- response.status = e_book_listener_convert_status (status);
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_get_contact (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- const CORBA_char* card,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- response.op = GetContactResponse;
- response.status = e_book_listener_convert_status (status);
- response.vcard = g_strdup (card);
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-
- g_free (response.vcard);
-}
-
-static void
-impl_BookListener_respond_get_contact_list (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- const GNOME_Evolution_Addressbook_stringlist *cards,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
- int i;
-
- if (listener->priv->stopped)
- return;
-
- response.op = GetContactListResponse;
- response.status = e_book_listener_convert_status (status);
- response.list = NULL;
-
- for (i = 0; i < cards->_length; i ++) {
- response.list = g_list_prepend (response.list, e_contact_new_from_vcard (cards->_buffer[i]));
- }
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-
- /* XXX free response.list? */
-}
-
-static void
-impl_BookListener_respond_get_view (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- const GNOME_Evolution_Addressbook_BookView book_view,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- printf ("impl_BookListener_respond_get_view\n");
-
- if (listener->priv->stopped)
- return;
-
- response.op = GetBookViewResponse;
- response.status = e_book_listener_convert_status (status);
- response.book_view = bonobo_object_dup_ref (book_view, ev);
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_get_changes (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- const GNOME_Evolution_Addressbook_BookChangeList *changes,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
- int i;
-
- response.op = GetChangesResponse;
- response.status = e_book_listener_convert_status (status);
- response.list = NULL;
-
- for (i = 0; i < changes->_length; i ++) {
- EBookChange *change = g_new (EBookChange, 1);
- GNOME_Evolution_Addressbook_BookChangeItem corba_change = changes->_buffer[i];
-
- switch (corba_change.changeType) {
- case GNOME_Evolution_Addressbook_ContactAdded:
- change->change_type = E_BOOK_CHANGE_CARD_ADDED;
- break;
- case GNOME_Evolution_Addressbook_ContactDeleted:
- change->change_type = E_BOOK_CHANGE_CARD_DELETED;
- break;
- case GNOME_Evolution_Addressbook_ContactModified:
- change->change_type = E_BOOK_CHANGE_CARD_MODIFIED;
- break;
- }
- change->contact = e_contact_new_from_vcard (corba_change.vcard);
-
- response.list = g_list_prepend (response.list, change);
- }
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_open_book (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- response.op = OpenBookResponse;
- response.status = e_book_listener_convert_status (status);
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_remove_book (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- response.op = RemoveBookResponse;
- response.status = e_book_listener_convert_status (status);
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_authentication_result (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- response.op = AuthenticationResponse;
- response.status = e_book_listener_convert_status (status);
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_get_supported_fields (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- const GNOME_Evolution_Addressbook_stringlist *fields,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
- int i;
-
- response.op = GetSupportedFieldsResponse;
- response.status = e_book_listener_convert_status (status);
- response.list = NULL;
-
- for (i = 0; i < fields->_length; i ++)
- response.list = g_list_prepend (response.list, g_strdup (fields->_buffer[i]));
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_get_supported_auth_methods (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- const GNOME_Evolution_Addressbook_stringlist *auth_methods,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
- int i;
-
- response.op = GetSupportedAuthMethodsResponse;
- response.status = e_book_listener_convert_status (status);
- response.list = NULL;
-
- for (i = 0; i < auth_methods->_length; i ++)
- response.list = g_list_prepend (response.list, g_strdup (auth_methods->_buffer[i]));
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_report_writable (PortableServer_Servant servant,
- const CORBA_boolean writable,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
- EBookListenerResponse response;
-
- response.op = WritableStatusEvent;
- response.writable = writable;
-
- g_signal_emit (listener, e_book_listener_signals [RESPONSE], 0, &response);
-}
-
-static void
-impl_BookListener_respond_progress (PortableServer_Servant servant,
- const CORBA_char * message,
- const CORBA_short percent,
- CORBA_Environment *ev)
-{
-}
-
-static void
-e_book_listener_construct (EBookListener *listener)
-{
- /* nothing to do here */
-}
-
-/**
- * e_book_listener_new:
- * @book: the #EBook for which the listener is to be bound
- *
- * Creates and returns a new #EBookListener for the book.
- *
- * Returns: a new #EBookListener
- */
-EBookListener *
-e_book_listener_new ()
-{
- EBookListener *listener;
-
- listener = g_object_new (E_TYPE_BOOK_LISTENER,
- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL),
- NULL);
-
- e_book_listener_construct (listener);
-
- return listener;
-}
-
-static void
-e_book_listener_init (EBookListener *listener)
-{
- listener->priv = g_new0 (EBookListenerPrivate, 1);
-}
-
-void
-e_book_listener_stop (EBookListener *listener)
-{
- g_return_if_fail (E_IS_BOOK_LISTENER (listener));
-
- listener->priv->stopped = TRUE;
-}
-
-static void
-e_book_listener_class_init (EBookListenerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- POA_GNOME_Evolution_Addressbook_BookListener__epv *epv;
-
- parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT);
-
- e_book_listener_signals [RESPONSE] =
- g_signal_new ("response",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookListenerClass, response),
- NULL, NULL,
- e_book_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- epv = &klass->epv;
- epv->notifyProgress = impl_BookListener_respond_progress;
- epv->notifyBookOpened = impl_BookListener_respond_open_book;
- epv->notifyBookRemoved = impl_BookListener_respond_remove_book;
- epv->notifyContactCreated = impl_BookListener_respond_create_contact;
- epv->notifyContactsRemoved = impl_BookListener_respond_remove_contacts;
- epv->notifyContactModified = impl_BookListener_respond_modify_contact;
- epv->notifyAuthenticationResult = impl_BookListener_respond_authentication_result;
- epv->notifySupportedFields = impl_BookListener_respond_get_supported_fields;
- epv->notifySupportedAuthMethods = impl_BookListener_respond_get_supported_auth_methods;
- epv->notifyContactRequested = impl_BookListener_respond_get_contact;
- epv->notifyContactListRequested = impl_BookListener_respond_get_contact_list;
- epv->notifyViewRequested = impl_BookListener_respond_get_view;
- epv->notifyChangesRequested = impl_BookListener_respond_get_changes;
- epv->notifyWritable = impl_BookListener_report_writable;
-}
-
-BONOBO_TYPE_FUNC_FULL (
- EBookListener,
- GNOME_Evolution_Addressbook_BookListener,
- BONOBO_TYPE_OBJECT,
- e_book_listener);
diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h
deleted file mode 100644
index 4d1f0c0231..0000000000
--- a/addressbook/backend/ebook/e-book-listener.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * A client-side GObject which exposes the
- * Evolution:BookListener interface.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __E_BOOK_LISTENER_H__
-#define __E_BOOK_LISTENER_H__
-
-#include <bonobo/bonobo-object.h>
-#include <ebook/addressbook.h>
-#include <ebook/e-book-types.h>
-
-#define E_TYPE_BOOK_LISTENER (e_book_listener_get_type ())
-#define E_BOOK_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK_LISTENER, EBookListener))
-#define E_BOOK_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_BOOK_LISTENER, EBookListenerClass))
-#define E_IS_BOOK_LISTENER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK_LISTENER))
-#define E_IS_BOOK_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK_LISTENER))
-#define E_BOOK_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK_LISTENER, EBookListenerClass))
-
-G_BEGIN_DECLS
-
-typedef struct _EBookListener EBookListener;
-typedef struct _EBookListenerClass EBookListenerClass;
-typedef struct _EBookListenerPrivate EBookListenerPrivate;
-typedef struct _EBookListenerResponse EBookListenerResponse;
-
-struct _EBookListener {
- BonoboObject parent;
- EBookListenerPrivate *priv;
-};
-
-struct _EBookListenerClass {
- BonoboObjectClass parent;
-
- POA_GNOME_Evolution_Addressbook_BookListener__epv epv;
-
- /*
- * Signals
- */
-
- void (*response) (EBookListener *listener, EBookListenerResponse *response);
-
- /* Padding for future expansion */
- void (*_ebook_reserved0) (void);
- void (*_ebook_reserved1) (void);
- void (*_ebook_reserved2) (void);
- void (*_ebook_reserved3) (void);
- void (*_ebook_reserved4) (void);
-};
-
-typedef enum {
- /* Async responses */
- OpenBookResponse,
- RemoveBookResponse,
- CreateContactResponse,
- RemoveContactResponse,
- ModifyContactResponse,
- GetContactResponse,
- GetContactListResponse,
- GetBookViewResponse,
- GetChangesResponse,
- AuthenticationResponse,
- GetSupportedFieldsResponse,
- GetSupportedAuthMethodsResponse,
-
- /* Async events */
- LinkStatusEvent,
- WritableStatusEvent,
- ProgressEvent,
-} EBookListenerOperation;
-
-struct _EBookListenerResponse {
- EBookListenerOperation op;
-
- /* For most Response notifications */
- EBookStatus status;
-
- /* For GetBookViewReponse */
- GNOME_Evolution_Addressbook_BookView book_view;
-
- /* For GetSupportedFields/GetSupportedAuthMethods */
- GList *list;
-
- /* For ProgressEvent */
- char *msg;
- short percent;
-
- /* For LinkStatusEvent */
- gboolean connected;
-
- /* For WritableStatusEvent */
- gboolean writable;
-
- /* For Card[Added|Removed|Modified]Event */
- char *id;
- char *vcard;
-};
-
-
-EBookListener *e_book_listener_new (void);
-GType e_book_listener_get_type (void);
-void e_book_listener_stop (EBookListener *listener);
-
-G_END_DECLS
-
-#endif /* ! __E_BOOK_LISTENER_H__ */
diff --git a/addressbook/backend/ebook/e-book-marshal.list b/addressbook/backend/ebook/e-book-marshal.list
deleted file mode 100644
index 680ea039a3..0000000000
--- a/addressbook/backend/ebook/e-book-marshal.list
+++ /dev/null
@@ -1,5 +0,0 @@
-NONE:NONE
-NONE:BOOL
-NONE:POINTER
-NONE:STRING
-NONE:INT
diff --git a/addressbook/backend/ebook/e-book-query.c b/addressbook/backend/ebook/e-book-query.c
deleted file mode 100644
index 16e325303c..0000000000
--- a/addressbook/backend/ebook/e-book-query.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <config.h>
-
-#include "e-book-query.h"
-#include <e-util/e-sexp.h>
-
-#include <stdarg.h>
-#include <string.h>
-
-typedef enum {
- E_BOOK_QUERY_TYPE_AND,
- E_BOOK_QUERY_TYPE_OR,
- E_BOOK_QUERY_TYPE_NOT,
- E_BOOK_QUERY_TYPE_FIELD_EXISTS,
- E_BOOK_QUERY_TYPE_FIELD_TEST,
- E_BOOK_QUERY_TYPE_ANY_FIELD_CONTAINS
-} EBookQueryType;
-
-struct EBookQuery {
- EBookQueryType type;
- int ref_count;
-
- union {
- struct {
- guint nqs;
- EBookQuery **qs;
- } andor;
-
- struct {
- EBookQuery *q;
- } not;
-
- struct {
- EBookQueryTest test;
- EContactField field;
- char *value;
- } field_test;
-
- struct {
- EContactField field;
- } exist;
-
- struct {
- char *value;
- } any_field_contains;
- } query;
-};
-
-static EBookQuery *
-conjoin (EBookQueryType type, int nqs, EBookQuery **qs, gboolean unref)
-{
- EBookQuery *ret = g_new0 (EBookQuery, 1);
- int i;
-
- ret->type = type;
- ret->query.andor.nqs = nqs;
- ret->query.andor.qs = g_new (EBookQuery *, nqs);
- for (i = 0; i < nqs; i++) {
- ret->query.andor.qs[i] = qs[i];
- if (!unref)
- e_book_query_ref (qs[i]);
- }
-
- return ret;
-}
-
-EBookQuery *
-e_book_query_and (int nqs, EBookQuery **qs, gboolean unref)
-{
- return conjoin (E_BOOK_QUERY_TYPE_AND, nqs, qs, unref);
-}
-
-EBookQuery *
-e_book_query_or (int nqs, EBookQuery **qs, gboolean unref)
-{
- return conjoin (E_BOOK_QUERY_TYPE_OR, nqs, qs, unref);
-}
-
-static EBookQuery *
-conjoinv (EBookQueryType type, EBookQuery *q, va_list ap)
-{
- EBookQuery *ret = g_new0 (EBookQuery, 1);
- GPtrArray *qs;
-
- qs = g_ptr_array_new ();
- while (q) {
- g_ptr_array_add (qs, q);
- q = va_arg (ap, EBookQuery *);
- }
- va_end (ap);
-
- ret->type = type;
- ret->query.andor.nqs = qs->len;
- ret->query.andor.qs = (EBookQuery **)qs->pdata;
- g_ptr_array_free (qs, FALSE);
-
- return ret;
-}
-
-EBookQuery *
-e_book_query_andv (EBookQuery *q, ...)
-{
- va_list ap;
-
- va_start (ap, q);
- return conjoinv (E_BOOK_QUERY_TYPE_AND, q, ap);
-}
-
-EBookQuery *
-e_book_query_orv (EBookQuery *q, ...)
-{
- va_list ap;
-
- va_start (ap, q);
- return conjoinv (E_BOOK_QUERY_TYPE_OR, q, ap);
-}
-
-EBookQuery *
-e_book_query_not (EBookQuery *q, gboolean unref)
-{
- EBookQuery *ret = g_new0 (EBookQuery, 1);
-
- ret->type = E_BOOK_QUERY_TYPE_NOT;
- ret->query.not.q = q;
- if (!unref)
- e_book_query_ref (q);
-
- return ret;
-}
-
-EBookQuery *
-e_book_query_field_test (EContactField field,
- EBookQueryTest test,
- const char *value)
-{
- EBookQuery *ret = g_new0 (EBookQuery, 1);
-
- ret->type = E_BOOK_QUERY_TYPE_FIELD_TEST;
- ret->query.field_test.field = field;
- ret->query.field_test.test = test;
- ret->query.field_test.value = g_strdup (value);
-
- return ret;
-}
-
-EBookQuery *
-e_book_query_field_exists (EContactField field)
-{
- EBookQuery *ret = g_new0 (EBookQuery, 1);
-
- ret->type = E_BOOK_QUERY_TYPE_FIELD_EXISTS;
- ret->query.exist.field = field;
-
- return ret;
-}
-
-EBookQuery *
-e_book_query_any_field_contains (const char *value)
-{
- EBookQuery *ret = g_new0 (EBookQuery, 1);
-
- ret->type = E_BOOK_QUERY_TYPE_ANY_FIELD_CONTAINS;
- ret->query.any_field_contains.value = g_strdup (value);
-
- return ret;
-}
-
-void
-e_book_query_unref (EBookQuery *q)
-{
- int i;
-
- if (q->ref_count--)
- return;
-
- switch (q->type) {
- case E_BOOK_QUERY_TYPE_AND:
- case E_BOOK_QUERY_TYPE_OR:
- for (i = 0; i < q->query.andor.nqs; i++)
- e_book_query_unref (q->query.andor.qs[i]);
- g_free (q->query.andor.qs);
- break;
-
- case E_BOOK_QUERY_TYPE_NOT:
- e_book_query_unref (q->query.not.q);
- break;
-
- case E_BOOK_QUERY_TYPE_FIELD_TEST:
- g_free (q->query.field_test.value);
- break;
-
- case E_BOOK_QUERY_TYPE_ANY_FIELD_CONTAINS:
- g_free (q->query.any_field_contains.value);
- break;
-
- default:
- break;
- }
-
- g_free (q);
-}
-
-void
-e_book_query_ref (EBookQuery *q)
-{
- q->ref_count++;
-}
-
-static ESExpResult *
-func_and(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- GList **list = data;
- ESExpResult *r;
- EBookQuery **qs;
-
- if (argc > 0) {
- int i;
-
- qs = g_new0(EBookQuery*, argc);
-
- for (i = 0; i < argc; i ++) {
- GList *list_head = *list;
- if (!list_head)
- break;
- qs[i] = list_head->data;
- *list = g_list_remove_link(*list, list_head);
- g_list_free_1(list_head);
- }
-
- *list = g_list_prepend(*list,
- e_book_query_and (argc, qs, TRUE));
-
- g_free (qs);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_or(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- GList **list = data;
- ESExpResult *r;
- EBookQuery **qs;
-
- if (argc > 0) {
- int i;
-
- qs = g_new0(EBookQuery*, argc);
-
- for (i = 0; i < argc; i ++) {
- GList *list_head = *list;
- if (!list_head)
- break;
- qs[i] = list_head->data;
- *list = g_list_remove_link(*list, list_head);
- g_list_free_1(list_head);
- }
-
- *list = g_list_prepend(*list,
- e_book_query_or (argc, qs, TRUE));
-
- g_free (qs);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_not(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- GList **list = data;
- ESExpResult *r;
-
- /* just replace the head of the list with the NOT of it. */
- if (argc > 0) {
- EBookQuery *term = (*list)->data;
- (*list)->data = e_book_query_not (term, TRUE);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- GList **list = data;
- ESExpResult *r;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
- char *str = argv[1]->value.string;
-
- if (!strcmp (propname, "x-evolution-any-field")) {
- *list = g_list_prepend (*list, e_book_query_any_field_contains (str));
- }
- else {
- EContactField field = e_contact_field_id (propname);
-
- if (field)
- *list = g_list_prepend (*list, e_book_query_field_test (field,
- E_BOOK_QUERY_CONTAINS,
- str));
- }
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_is(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- GList **list = data;
- ESExpResult *r;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
- char *str = argv[1]->value.string;
- EContactField field = e_contact_field_id (propname);
-
- if (field)
- *list = g_list_prepend (*list, e_book_query_field_test (field,
- E_BOOK_QUERY_IS,
- str));
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_beginswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- GList **list = data;
- ESExpResult *r;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
- char *str = argv[1]->value.string;
- EContactField field = e_contact_field_id (propname);
-
- if (field)
- *list = g_list_prepend (*list, e_book_query_field_test (field,
- E_BOOK_QUERY_BEGINS_WITH,
- str));
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_endswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- GList **list = data;
- ESExpResult *r;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
- char *str = argv[1]->value.string;
- EContactField field = e_contact_field_id (propname);
-
- if (field)
- *list = g_list_prepend (*list, e_book_query_field_test (field,
- E_BOOK_QUERY_ENDS_WITH,
- str));
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-/* 'builtin' functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "and", func_and, 0 },
- { "or", func_or, 0 },
- { "not", func_not, 0 },
- { "contains", func_contains, 0 },
- { "is", func_is, 0 },
- { "beginswith", func_beginswith, 0 },
- { "endswith", func_endswith, 0 },
-};
-
-EBookQuery*
-e_book_query_from_string (const char *query_string)
-{
- ESExp *sexp;
- ESExpResult *r;
- EBookQuery *retval;
- GList *list = NULL;
- int i;
-
- sexp = e_sexp_new();
-
- for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction(sexp, 0, symbols[i].name,
- (ESExpIFunc *)symbols[i].func, &list);
- } else {
- e_sexp_add_function(sexp, 0, symbols[i].name,
- symbols[i].func, &list);
- }
- }
-
- e_sexp_input_text(sexp, query_string, strlen(query_string));
- e_sexp_parse(sexp);
-
- r = e_sexp_eval(sexp);
-
- e_sexp_result_free(sexp, r);
- e_sexp_unref (sexp);
-
- if (list) {
- if (list->next) {
- g_warning ("conversion to EBookQuery");
- retval = NULL;
- g_list_foreach (list, (GFunc)e_book_query_unref, NULL);
- }
- else {
- retval = list->data;
- }
- }
- else {
- g_warning ("conversion to EBookQuery failed");
- retval = NULL;
- }
-
- g_list_free (list);
- return retval;
-}
-
-char*
-e_book_query_to_string (EBookQuery *q)
-{
- GString *str = g_string_new ("(");
- int i;
- char *s = NULL;
-
- switch (q->type) {
- case E_BOOK_QUERY_TYPE_AND:
- g_string_append (str, "and ");
- for (i = 0; i < q->query.andor.nqs; i ++) {
- s = e_book_query_to_string (q->query.andor.qs[i]);
- g_string_append (str, s);
- g_free (s);
- g_string_append_c (str, ' ');
- }
- break;
- case E_BOOK_QUERY_TYPE_OR:
- g_string_append (str, "or ");
- for (i = 0; i < q->query.andor.nqs; i ++) {
- s = e_book_query_to_string (q->query.andor.qs[i]);
- g_string_append (str, s);
- g_free (s);
- g_string_append_c (str, ' ');
- }
- break;
- case E_BOOK_QUERY_TYPE_NOT:
- s = e_book_query_to_string (q->query.not.q);
- g_string_append_printf (str, "not %s", s);
- g_free (s);
- break;
- case E_BOOK_QUERY_TYPE_FIELD_EXISTS:
- g_string_append_printf (str, "exists \"%s\"", e_contact_field_name (q->query.exist.field));
- break;
- case E_BOOK_QUERY_TYPE_FIELD_TEST:
- switch (q->query.field_test.test) {
- case E_BOOK_QUERY_IS: s = "is"; break;
- case E_BOOK_QUERY_CONTAINS: s = "contains"; break;
- case E_BOOK_QUERY_BEGINS_WITH: s = "beginswith"; break;
- case E_BOOK_QUERY_ENDS_WITH: s = "endswith"; break;
- default:
- g_assert_not_reached();
- break;
- }
-
- /* XXX need to escape q->query.field_test.value */
- g_string_append_printf (str, "%s \"%s\" \"%s\"",
- s,
- e_contact_field_name (q->query.field_test.field),
- q->query.field_test.value);
- break;
- case E_BOOK_QUERY_TYPE_ANY_FIELD_CONTAINS:
- g_string_append_printf (str, "contains \"x-evolution-any-field\" \"%s\"", q->query.any_field_contains.value);
- break;
- }
-
-
- g_string_append (str, ")");
-
- return g_string_free (str, FALSE);
-}
diff --git a/addressbook/backend/ebook/e-book-query.h b/addressbook/backend/ebook/e-book-query.h
deleted file mode 100644
index e36887f6f2..0000000000
--- a/addressbook/backend/ebook/e-book-query.h
+++ /dev/null
@@ -1,49 +0,0 @@
-
-#ifndef __E_BOOK_QUERY_H__
-#define __E_BOOK_QUERY_H__
-
-#include <ebook/e-contact.h>
-
-G_BEGIN_DECLS
-
-typedef struct EBookQuery EBookQuery;
-
-typedef enum {
- E_BOOK_QUERY_IS,
- E_BOOK_QUERY_CONTAINS,
- E_BOOK_QUERY_BEGINS_WITH,
- E_BOOK_QUERY_ENDS_WITH,
-
-#if notyet
- E_BOOK_QUERY_LT,
- E_BOOK_QUERY_LE,
- E_BOOK_QUERY_GT,
- E_BOOK_QUERY_GE,
- E_BOOK_QUERY_EQ,
-#endif
-} EBookQueryTest;
-
-EBookQuery* e_book_query_from_string (const char *sexp);
-char* e_book_query_to_string (EBookQuery *q);
-
-void e_book_query_ref (EBookQuery *q);
-void e_book_query_unref (EBookQuery *q);
-
-EBookQuery* e_book_query_and (int nqs, EBookQuery **qs, gboolean unref);
-EBookQuery* e_book_query_andv (EBookQuery *q, ...);
-EBookQuery* e_book_query_or (int nqs, EBookQuery **qs, gboolean unref);
-EBookQuery* e_book_query_orv (EBookQuery *q, ...);
-
-EBookQuery* e_book_query_not (EBookQuery *qs, gboolean unref);
-
-EBookQuery* e_book_query_field_exists (EContactField field);
-EBookQuery* e_book_query_field_test (EContactField field,
- EBookQueryTest test,
- const char *value);
-
-/* a special any field contains query */
-EBookQuery* e_book_query_any_field_contains (const char *value);
-
-G_END_DECLS
-
-#endif /* __E_BOOK_QUERY_H__ */
diff --git a/addressbook/backend/ebook/e-book-types.h b/addressbook/backend/ebook/e-book-types.h
deleted file mode 100644
index 9bbc66e622..0000000000
--- a/addressbook/backend/ebook/e-book-types.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * A client-side GObject which exposes the
- * Evolution:BookListener interface.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __E_BOOK_TYPES_H__
-#define __E_BOOK_TYPES_H__
-
-#include <glib.h>
-#include <ebook/e-contact.h>
-
-G_BEGIN_DECLS
-
-#define E_BOOK_ERROR e_book_error_quark()
-
-GQuark e_book_error_quark (void) G_GNUC_CONST;
-
-typedef enum {
- E_BOOK_ERROR_OK,
- E_BOOK_ERROR_INVALID_ARG,
- E_BOOK_ERROR_BUSY,
- E_BOOK_ERROR_REPOSITORY_OFFLINE,
- E_BOOK_ERROR_NO_SUCH_BOOK,
- E_BOOK_ERROR_URI_NOT_LOADED,
- E_BOOK_ERROR_URI_ALREADY_LOADED,
- E_BOOK_ERROR_PERMISSION_DENIED,
- E_BOOK_ERROR_CONTACT_NOT_FOUND,
- E_BOOK_ERROR_CONTACT_ID_ALREADY_EXISTS,
- E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED,
- E_BOOK_ERROR_CANCELLED,
- E_BOOK_ERROR_COULD_NOT_CANCEL,
- E_BOOK_ERROR_AUTHENTICATION_FAILED,
- E_BOOK_ERROR_AUTHENTICATION_REQUIRED,
- E_BOOK_ERROR_TLS_NOT_AVAILABLE,
- E_BOOK_ERROR_CORBA_EXCEPTION,
- E_BOOK_ERROR_OTHER_ERROR
-} EBookStatus;
-
-
-typedef enum {
- E_BOOK_VIEW_STATUS_OK,
- E_BOOK_VIEW_STATUS_TIME_LIMIT_EXCEEDED,
- E_BOOK_VIEW_STATUS_SIZE_LIMIT_EXCEEDED,
- E_BOOK_VIEW_ERROR_INVALID_QUERY,
- E_BOOK_VIEW_ERROR_QUERY_REFUSED,
- E_BOOK_VIEW_ERROR_OTHER_ERROR
-} EBookViewStatus;
-
-typedef enum {
- E_BOOK_CHANGE_CARD_ADDED,
- E_BOOK_CHANGE_CARD_DELETED,
- E_BOOK_CHANGE_CARD_MODIFIED
-} EBookChangeType;
-
-typedef struct {
- EBookChangeType change_type;
- EContact *contact;
-} EBookChange;
-
-G_END_DECLS
-
-#endif /* ! __E_BOOK_TYPES_H__ */
diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c
deleted file mode 100644
index 3ab2ff2708..0000000000
--- a/addressbook/backend/ebook/e-book-view-listener.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Exports the BookViewListener interface. Maintains a queue of messages
- * which come in on the interface.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <config.h>
-#include <bonobo/bonobo-main.h>
-#include "e-book-view-listener.h"
-#include "e-book-view.h"
-#include "e-contact.h"
-#include "e-book-marshal.h"
-
-static EBookViewStatus e_book_view_listener_convert_status (GNOME_Evolution_Addressbook_CallStatus status);
-
-enum {
- RESPONSE,
- LAST_SIGNAL
-};
-
-static guint e_book_view_listener_signals [LAST_SIGNAL];
-
-static BonoboObjectClass *parent_class;
-
-struct _EBookViewListenerPrivate {
- guint stopped : 1;
-};
-
-static void
-e_book_view_listener_queue_response (EBookViewListener *listener,
- EBookViewListenerResponse *response)
-{
- if (response == NULL)
- return;
-
- if (listener->priv->stopped) {
- /* Free response and return */
- g_list_foreach (response->ids, (GFunc)g_free, NULL);
- g_list_free (response->ids);
- g_list_foreach (response->contacts, (GFunc) g_object_unref, NULL);
- g_list_free (response->contacts);
- g_free (response->message);
- g_free (response);
- return;
- }
-
- g_signal_emit (listener, e_book_view_listener_signals [RESPONSE], 0, response);
-}
-
-/* Add, Remove, Modify */
-static void
-e_book_view_listener_queue_status_event (EBookViewListener *listener,
- EBookViewListenerOperation op,
- EBookViewStatus status)
-{
- EBookViewListenerResponse *resp;
-
- if (listener->priv->stopped)
- return;
-
- resp = g_new0 (EBookViewListenerResponse, 1);
-
- resp->op = op;
- resp->status = status;
-
- e_book_view_listener_queue_response (listener, resp);
-}
-
-/* Add, Remove, Modify */
-static void
-e_book_view_listener_queue_idlist_event (EBookViewListener *listener,
- EBookViewListenerOperation op,
- const GNOME_Evolution_Addressbook_ContactIdList *ids)
-{
- EBookViewListenerResponse *resp;
- int i;
-
- if (listener->priv->stopped)
- return;
-
- resp = g_new0 (EBookViewListenerResponse, 1);
-
- resp->op = op;
- resp->status = E_BOOK_VIEW_STATUS_OK;
-
- for (i = 0; i < ids->_length; i ++) {
- resp->ids = g_list_prepend (resp->ids, g_strdup (ids->_buffer[i]));
- }
-
- e_book_view_listener_queue_response (listener, resp);
-}
-
-/* Add, Remove, Modify */
-static void
-e_book_view_listener_queue_sequence_event (EBookViewListener *listener,
- EBookViewListenerOperation op,
- const GNOME_Evolution_Addressbook_VCardList *vcards)
-{
- EBookViewListenerResponse *resp;
- int i;
-
- if (listener->priv->stopped)
- return;
-
- resp = g_new0 (EBookViewListenerResponse, 1);
-
- resp->op = op;
- resp->status = E_BOOK_VIEW_STATUS_OK;
-
- for ( i = 0; i < vcards->_length; i++ ) {
- resp->contacts = g_list_append(resp->contacts, e_contact_new_from_vcard (vcards->_buffer[i]));
- }
-
- e_book_view_listener_queue_response (listener, resp);
-}
-
-/* Status Message */
-static void
-e_book_view_listener_queue_message_event (EBookViewListener *listener,
- EBookViewListenerOperation op,
- const char *message)
-{
- EBookViewListenerResponse *resp;
-
- if (listener->priv->stopped)
- return;
-
- resp = g_new0 (EBookViewListenerResponse, 1);
-
- resp->op = op;
- resp->status = E_BOOK_VIEW_STATUS_OK;
- resp->message = g_strdup(message);
-
- e_book_view_listener_queue_response (listener, resp);
-}
-
-static void
-impl_BookViewListener_notify_contacts_added (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_VCardList *vcards,
- CORBA_Environment *ev)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
-
- printf ("impl_BookViewListener_notify_contacts_added\n");
-
- e_book_view_listener_queue_sequence_event (
- listener, ContactsAddedEvent, vcards);
-}
-
-static void
-impl_BookViewListener_notify_contacts_removed (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_ContactIdList *ids,
- CORBA_Environment *ev)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
-
- printf ("impl_BookViewListener_notify_contacts_removed\n");
-
- e_book_view_listener_queue_idlist_event (listener, ContactsRemovedEvent, ids);
-}
-
-static void
-impl_BookViewListener_notify_contacts_changed (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_VCardList *vcards,
- CORBA_Environment *ev)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
-
- printf ("impl_BookViewListener_notify_contacts_changed\n");
-
- e_book_view_listener_queue_sequence_event (
- listener, ContactsModifiedEvent, vcards);
-}
-
-static void
-impl_BookViewListener_notify_sequence_complete (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CallStatus status,
- CORBA_Environment *ev)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
-
- printf ("impl_BookViewListener_notify_sequence_complete\n");
-
- e_book_view_listener_queue_status_event (listener, SequenceCompleteEvent,
- e_book_view_listener_convert_status (status));
-}
-
-static void
-impl_BookViewListener_notify_progress (PortableServer_Servant servant,
- const char *message,
- const CORBA_short percent,
- CORBA_Environment *ev)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
-
- printf ("impl_BookViewListener_notify_progress\n");
-
- e_book_view_listener_queue_message_event (listener, StatusMessageEvent, message);
-}
-
-static EBookViewStatus
-e_book_view_listener_convert_status (const GNOME_Evolution_Addressbook_CallStatus status)
-{
- switch (status) {
- case GNOME_Evolution_Addressbook_Success:
- return E_BOOK_VIEW_STATUS_OK;
- case GNOME_Evolution_Addressbook_SearchTimeLimitExceeded:
- return E_BOOK_VIEW_STATUS_TIME_LIMIT_EXCEEDED;
- case GNOME_Evolution_Addressbook_SearchSizeLimitExceeded:
- return E_BOOK_VIEW_STATUS_SIZE_LIMIT_EXCEEDED;
- case GNOME_Evolution_Addressbook_InvalidQuery:
- return E_BOOK_VIEW_ERROR_INVALID_QUERY;
- case GNOME_Evolution_Addressbook_QueryRefused:
- return E_BOOK_VIEW_ERROR_QUERY_REFUSED;
- case GNOME_Evolution_Addressbook_OtherError:
- default:
- return E_BOOK_VIEW_ERROR_OTHER_ERROR;
- }
-}
-
-static void
-e_book_view_listener_construct (EBookViewListener *listener)
-{
- /* nothing needed here */
-}
-
-/**
- * e_book_view_listener_new:
- * @book: the #EBookView for which the listener is to be bound
- *
- * Creates and returns a new #EBookViewListener for the book.
- *
- * Returns: a new #EBookViewListener
- */
-EBookViewListener *
-e_book_view_listener_new ()
-{
- EBookViewListener *listener;
-
- listener = g_object_new (E_TYPE_BOOK_VIEW_LISTENER,
- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_ALL_AT_IDLE, NULL),
- NULL);
-
- e_book_view_listener_construct (listener);
-
- return listener;
-}
-
-static void
-e_book_view_listener_init (EBookViewListener *listener)
-{
- listener->priv = g_new0 (EBookViewListenerPrivate, 1);
- listener->priv->stopped = FALSE;
-}
-
-void
-e_book_view_listener_stop (EBookViewListener *listener)
-{
- g_return_if_fail (E_IS_BOOK_VIEW_LISTENER (listener));
- listener->priv->stopped = TRUE;
-}
-
-static void
-e_book_view_listener_dispose (GObject *object)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (object);
-
- if (listener->priv) {
- g_free (listener->priv);
- listener->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_book_view_listener_class_init (EBookViewListenerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- POA_GNOME_Evolution_Addressbook_BookViewListener__epv *epv;
-
- parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT);
-
- e_book_view_listener_signals [RESPONSE] =
- g_signal_new ("response",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookViewListenerClass, response),
- NULL, NULL,
- e_book_marshal_NONE__POINTER,
- G_TYPE_NONE,
- 1, G_TYPE_POINTER);
-
- object_class->dispose = e_book_view_listener_dispose;
-
- epv = &klass->epv;
- epv->notifyContactsChanged = impl_BookViewListener_notify_contacts_changed;
- epv->notifyContactsRemoved = impl_BookViewListener_notify_contacts_removed;
- epv->notifyContactsAdded = impl_BookViewListener_notify_contacts_added;
- epv->notifySequenceComplete = impl_BookViewListener_notify_sequence_complete;
- epv->notifyProgress = impl_BookViewListener_notify_progress;
-}
-
-BONOBO_TYPE_FUNC_FULL (
- EBookViewListener,
- GNOME_Evolution_Addressbook_BookViewListener,
- BONOBO_TYPE_OBJECT,
- e_book_view_listener);
diff --git a/addressbook/backend/ebook/e-book-view-listener.h b/addressbook/backend/ebook/e-book-view-listener.h
deleted file mode 100644
index a68f25c337..0000000000
--- a/addressbook/backend/ebook/e-book-view-listener.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * A client-side GObject which exposes the
- * Evolution:BookViewListener interface.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __E_BOOK_VIEW_LISTENER_H__
-#define __E_BOOK_VIEW_LISTENER_H__
-
-#include <bonobo/bonobo-object.h>
-#include <ebook/e-book-types.h>
-#include <ebook/addressbook.h>
-
-#define E_TYPE_BOOK_VIEW_LISTENER (e_book_view_listener_get_type ())
-#define E_BOOK_VIEW_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK_VIEW_LISTENER, EBookViewListener))
-#define E_BOOK_VIEW_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_BOOK_VIEW_LISTENER, EBookViewListenerClass))
-#define E_IS_BOOK_VIEW_LISTENER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK_VIEW_LISTENER))
-#define E_IS_BOOK_VIEW_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK_VIEW_LISTENER))
-#define E_BOOK_VIEW_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK_VIEW_LISTENER, EBookViewListenerClass))
-
-G_BEGIN_DECLS
-
-typedef struct _EBookViewListener EBookViewListener;
-typedef struct _EBookViewListenerClass EBookViewListenerClass;
-typedef struct _EBookViewListenerPrivate EBookViewListenerPrivate;
-
-typedef struct _EBookViewListenerResponse EBookViewListenerResponse;
-
-struct _EBookViewListener {
- BonoboObject parent;
- EBookViewListenerPrivate *priv;
-};
-
-struct _EBookViewListenerClass {
- BonoboObjectClass parent;
-
- POA_GNOME_Evolution_Addressbook_BookViewListener__epv epv;
-
- /*
- * Signals
- */
- void (*response) (EBookViewListener *listener, EBookViewListenerResponse *response);
-
-
- /* Padding for future expansion */
- void (*_ebook_reserved0) (void);
- void (*_ebook_reserved1) (void);
- void (*_ebook_reserved2) (void);
- void (*_ebook_reserved3) (void);
- void (*_ebook_reserved4) (void);
-};
-
-typedef enum {
- /* Async events */
- ContactsAddedEvent,
- ContactsRemovedEvent,
- ContactsModifiedEvent,
- SequenceCompleteEvent,
- StatusMessageEvent,
-} EBookViewListenerOperation;
-
-struct _EBookViewListenerResponse {
- EBookViewListenerOperation op;
-
- /* For SequenceComplete */
- EBookViewStatus status;
-
- /* For ContactsRemovedEvent */
- GList *ids;
-
- /* For Contact[sAdded|Modified]Event */
- GList *contacts; /* Of type EContact. */
-
- /* For StatusMessageEvent */
- char *message;
-
-};
-
-EBookViewListener *e_book_view_listener_new (void);
-GType e_book_view_listener_get_type (void);
-void e_book_view_listener_stop (EBookViewListener *listener);
-
-G_END_DECLS
-
-#endif /* ! __E_BOOK_VIEW_LISTENER_H__ */
diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c
deleted file mode 100644
index c36e87967c..0000000000
--- a/addressbook/backend/ebook/e-book-view.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 1999, 2000, Ximian, Inc.
- */
-
-#include <config.h>
-
-#include "addressbook.h"
-#include "e-book-view-listener.h"
-#include "e-book-view.h"
-#include "e-book.h"
-#include "e-book-marshal.h"
-
-static GObjectClass *parent_class;
-
-struct _EBookViewPrivate {
- GNOME_Evolution_Addressbook_BookView corba_book_view;
-
- EBook *book;
-
- EBookViewListener *listener;
-
- int response_id;
-};
-
-enum {
- CONTACTS_CHANGED,
- CONTACTS_REMOVED,
- CONTACTS_ADDED,
- SEQUENCE_COMPLETE,
- STATUS_MESSAGE,
- LAST_SIGNAL
-};
-
-static guint e_book_view_signals [LAST_SIGNAL];
-
-static void
-e_book_view_do_added_event (EBookView *book_view,
- EBookViewListenerResponse *resp)
-{
- g_signal_emit (book_view, e_book_view_signals [CONTACTS_ADDED], 0,
- resp->contacts);
-
- g_list_foreach (resp->contacts, (GFunc) g_object_unref, NULL);
- g_list_free (resp->contacts);
-}
-
-static void
-e_book_view_do_modified_event (EBookView *book_view,
- EBookViewListenerResponse *resp)
-{
- g_signal_emit (book_view, e_book_view_signals [CONTACTS_CHANGED], 0,
- resp->contacts);
-
- g_list_foreach (resp->contacts, (GFunc) g_object_unref, NULL);
- g_list_free (resp->contacts);
-}
-
-static void
-e_book_view_do_removed_event (EBookView *book_view,
- EBookViewListenerResponse *resp)
-{
- g_signal_emit (book_view, e_book_view_signals [CONTACTS_REMOVED], 0,
- resp->ids);
-
- g_list_foreach (resp->ids, (GFunc) g_free, NULL);
- g_list_free (resp->ids);
-}
-
-static void
-e_book_view_do_complete_event (EBookView *book_view,
- EBookViewListenerResponse *resp)
-{
- g_signal_emit (book_view, e_book_view_signals [SEQUENCE_COMPLETE], 0,
- resp->status);
-}
-
-static void
-e_book_view_do_status_message_event (EBookView *book_view,
- EBookViewListenerResponse *resp)
-{
- g_signal_emit (book_view, e_book_view_signals [STATUS_MESSAGE], 0,
- resp->message);
- g_free(resp->message);
-}
-
-
-static void
-e_book_view_handle_response (EBookViewListener *listener, EBookViewListenerResponse *resp, EBookView *book_view)
-{
- if (resp == NULL)
- return;
-
- switch (resp->op) {
- case ContactsAddedEvent:
- e_book_view_do_added_event (book_view, resp);
- break;
- case ContactsModifiedEvent:
- e_book_view_do_modified_event (book_view, resp);
- break;
- case ContactsRemovedEvent:
- e_book_view_do_removed_event (book_view, resp);
- break;
- case SequenceCompleteEvent:
- e_book_view_do_complete_event (book_view, resp);
- break;
- case StatusMessageEvent:
- e_book_view_do_status_message_event (book_view, resp);
- break;
- default:
- g_error ("EBookView: Unknown operation %d in listener queue!\n",
- resp->op);
- break;
- }
-
- g_free (resp);
-}
-
-static gboolean
-e_book_view_construct (EBookView *book_view, GNOME_Evolution_Addressbook_BookView corba_book_view, EBookViewListener *listener)
-{
- CORBA_Environment ev;
- g_return_val_if_fail (book_view != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK_VIEW (book_view), FALSE);
-
- /*
- * Copy in the corba_book_view.
- */
- CORBA_exception_init (&ev);
-
- book_view->priv->corba_book_view = bonobo_object_dup_ref(corba_book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_view_construct: Exception duplicating corba_book_view.\n");
- CORBA_exception_free (&ev);
- book_view->priv->corba_book_view = NULL;
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /*
- * Create our local BookListener interface.
- */
- book_view->priv->listener = listener;
- book_view->priv->response_id = g_signal_connect (book_view->priv->listener, "response",
- G_CALLBACK (e_book_view_handle_response), book_view);
-
- bonobo_object_ref(BONOBO_OBJECT(book_view->priv->listener));
-
- return TRUE;
-}
-
-/**
- * e_book_view_new:
- */
-EBookView *
-e_book_view_new (GNOME_Evolution_Addressbook_BookView corba_book_view, EBookViewListener *listener)
-{
- EBookView *book_view;
-
- book_view = g_object_new (E_TYPE_BOOK_VIEW, NULL);
-
- if (! e_book_view_construct (book_view, corba_book_view, listener)) {
- g_object_unref (book_view);
- return NULL;
- }
-
- return book_view;
-}
-
-void
-e_book_view_set_book (EBookView *book_view, EBook *book)
-{
- g_return_if_fail (book_view && E_IS_BOOK_VIEW (book_view));
- g_return_if_fail (book && E_IS_BOOK (book));
- g_return_if_fail (book_view->priv->book == NULL);
-
- book_view->priv->book = book;
- g_object_ref (book);
-}
-
-void
-e_book_view_start (EBookView *book_view)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (book_view && E_IS_BOOK_VIEW (book_view));
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookView_start (book_view->priv->corba_book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("corba exception._major = %d\n", ev._major);
- }
-}
-
-void
-e_book_view_stop (EBookView *book_view)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (book_view && E_IS_BOOK_VIEW (book_view));
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookView_stop (book_view->priv->corba_book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("corba exception._major = %d\n", ev._major);
- }
-}
-
-static void
-e_book_view_init (EBookView *book_view)
-{
- book_view->priv = g_new0 (EBookViewPrivate, 1);
- book_view->priv->book = NULL;
- book_view->priv->corba_book_view = CORBA_OBJECT_NIL;
- book_view->priv->listener = NULL;
- book_view->priv->response_id = 0;
-}
-
-static void
-e_book_view_dispose (GObject *object)
-{
- EBookView *book_view = E_BOOK_VIEW (object);
- CORBA_Environment ev;
-
- if (book_view->priv) {
- if (book_view->priv->book) {
- g_object_unref (book_view->priv->book);
- }
-
- if (book_view->priv->corba_book_view) {
- CORBA_exception_init (&ev);
-
- bonobo_object_release_unref (book_view->priv->corba_book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("EBookView: Exception while releasing BookView\n");
- }
-
- CORBA_exception_free (&ev);
- }
-
- if (book_view->priv->listener) {
- if (book_view->priv->response_id)
- g_signal_handler_disconnect(book_view->priv->listener,
- book_view->priv->response_id);
- e_book_view_listener_stop (book_view->priv->listener);
- bonobo_object_unref (BONOBO_OBJECT(book_view->priv->listener));
- }
-
- g_free (book_view->priv);
- book_view->priv = NULL;
- }
-
- G_OBJECT_CLASS(parent_class)->dispose (object);
-}
-
-static void
-e_book_view_class_init (EBookViewClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (G_TYPE_OBJECT);
-
- e_book_view_signals [CONTACTS_CHANGED] =
- g_signal_new ("contacts_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookViewClass, contacts_changed),
- NULL, NULL,
- e_book_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- e_book_view_signals [CONTACTS_ADDED] =
- g_signal_new ("contacts_added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookViewClass, contacts_added),
- NULL, NULL,
- e_book_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- e_book_view_signals [CONTACTS_REMOVED] =
- g_signal_new ("contacts_removed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookViewClass, contacts_removed),
- NULL, NULL,
- e_book_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- e_book_view_signals [SEQUENCE_COMPLETE] =
- g_signal_new ("sequence_complete",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookViewClass, sequence_complete),
- NULL, NULL,
- e_book_marshal_NONE__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
-
- e_book_view_signals [STATUS_MESSAGE] =
- g_signal_new ("status_message",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookViewClass, status_message),
- NULL, NULL,
- e_book_marshal_NONE__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
-
- object_class->dispose = e_book_view_dispose;
-}
-
-/**
- * e_book_view_get_type:
- */
-GType
-e_book_view_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (EBookViewClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) e_book_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EBookView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_book_view_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "EBookView", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/backend/ebook/e-book-view.h b/addressbook/backend/ebook/e-book-view.h
deleted file mode 100644
index 5b9768315b..0000000000
--- a/addressbook/backend/ebook/e-book-view.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 1999, 2000, Ximian, Inc.
- */
-
-#ifndef __E_BOOK_VIEW_H__
-#define __E_BOOK_VIEW_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <ebook/e-book-view-listener.h>
-
-#define E_TYPE_BOOK_VIEW (e_book_view_get_type ())
-#define E_BOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK_VIEW, EBookView))
-#define E_BOOK_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_BOOK_VIEW, EBookViewClass))
-#define E_IS_BOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK_VIEW))
-#define E_IS_BOOK_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK_VIEW))
-#define E_BOOK_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK_VIEW, EBookViewClass))
-
-G_BEGIN_DECLS
-
-typedef struct _EBookView EBookView;
-typedef struct _EBookViewClass EBookViewClass;
-typedef struct _EBookViewPrivate EBookViewPrivate;
-
-struct _EBook; /* Forward reference */
-
-struct _EBookView {
- GObject parent;
- EBookViewPrivate *priv;
-};
-
-struct _EBookViewClass {
- GObjectClass parent;
-
- /*
- * Signals.
- */
- void (* contacts_changed) (EBookView *book_view, const GList *contacts);
- void (* contacts_removed) (EBookView *book_view, const GList *ids);
- void (* contacts_added) (EBookView *book_view, const GList *contacts);
- void (* sequence_complete) (EBookView *book_view, EBookViewStatus status);
- void (* status_message) (EBookView *book_view, const char *message);
-
- /* Padding for future expansion */
- void (*_ebook_reserved0) (void);
- void (*_ebook_reserved1) (void);
- void (*_ebook_reserved2) (void);
- void (*_ebook_reserved3) (void);
- void (*_ebook_reserved4) (void);
-};
-
-/* Creating a new addressbook. */
-EBookView *e_book_view_new (GNOME_Evolution_Addressbook_BookView corba_book_view, EBookViewListener *listener);
-
-GType e_book_view_get_type (void);
-
-void e_book_view_set_book (EBookView *book_view, struct _EBook *book);
-
-void e_book_view_start (EBookView *book_view);
-void e_book_view_stop (EBookView *book_view);
-
-G_END_DECLS
-
-#endif /* ! __E_BOOK_VIEW_H__ */
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
deleted file mode 100644
index b551c8727b..0000000000
--- a/addressbook/backend/ebook/e-book.c
+++ /dev/null
@@ -1,2060 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <config.h>
-
-#include <pthread.h>
-
-#include <string.h>
-
-#include "e-book.h"
-#include "e-vcard.h"
-
-#include <bonobo-activation/bonobo-activation.h>
-
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-main.h>
-
-#include <libgnome/gnome-i18n.h>
-
-#include "e-book-marshal.h"
-#include "e-book-listener.h"
-#include "addressbook.h"
-#include "e-util/e-component-listener.h"
-#include "e-util/e-msgport.h"
-
-static GObjectClass *parent_class;
-
-#define CARDSERVER_OAF_ID "OAFIID:GNOME_Evolution_Wombat_ServerFactory"
-
-#define e_return_error_if_fail(expr,error_code) G_STMT_START{ \
- if G_LIKELY(expr) { } else \
- { \
- g_log (G_LOG_DOMAIN, \
- G_LOG_LEVEL_CRITICAL, \
- "file %s: line %d (%s): assertion `%s' failed", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- #expr); \
- g_set_error (error, E_BOOK_ERROR, (error_code), \
- "file %s: line %d (%s): assertion `%s' failed", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- #expr); \
- return FALSE; \
- }; }G_STMT_END
-
-/* XXX we need a better error message here */
-#define E_BOOK_CHECK_STATUS(status,error) G_STMT_START{ \
- if ((status) == E_BOOK_ERROR_OK) { \
- return TRUE; \
- } \
- else { \
- g_set_error ((error), E_BOOK_ERROR, (status), "EBookStatus returned %d", (status)); \
- return FALSE; \
- } }G_STMT_END
-
-enum {
- OPEN_PROGRESS,
- WRITABLE_STATUS,
- BACKEND_DIED,
- LAST_SIGNAL
-};
-
-static guint e_book_signals [LAST_SIGNAL];
-
-typedef struct {
- EMutex *mutex;
- pthread_cond_t cond;
- EBookStatus status;
-
- char *id;
- GList *list;
- EContact *contact;
-
- EBookView *view;
- EBookViewListener *listener;
-} EBookOp;
-
-typedef enum {
- E_BOOK_URI_NOT_LOADED,
- E_BOOK_URI_LOADING,
- E_BOOK_URI_LOADED
-} EBookLoadState;
-
-struct _EBookPrivate {
- GList *book_factories;
- GList *iter;
-
- /* cached capabilites */
- char *cap;
- gboolean cap_queried;
-
- /* cached writable status */
- gboolean writable;
-
- EBookListener *listener;
- EComponentListener *comp_listener;
-
- GNOME_Evolution_Addressbook_Book corba_book;
-
- EBookLoadState load_state;
-
-
- EBookOp *current_op;
-
- EMutex *mutex;
-
- gchar *uri;
-
- gulong listener_signal;
- gulong died_signal;
-};
-
-
-/* Error quark */
-GQuark
-e_book_error_quark (void)
-{
- static GQuark q = 0;
- if (q == 0)
- q = g_quark_from_static_string ("e-book-error-quark");
-
- return q;
-}
-
-
-
-/* EBookOp calls */
-
-static EBookOp*
-e_book_new_op (EBook *book)
-{
- EBookOp *op = g_new0 (EBookOp, 1);
-
- op->mutex = e_mutex_new (E_MUTEX_SIMPLE);
- pthread_cond_init (&op->cond, 0);
-
- book->priv->current_op = op;
-
- return op;
-}
-
-static EBookOp*
-e_book_get_op (EBook *book)
-{
- if (!book->priv->current_op) {
- g_warning ("unexpected response");
- return NULL;
- }
-
- return book->priv->current_op;
-}
-
-static void
-e_book_op_free (EBookOp *op)
-{
- /* XXX more stuff here */
- pthread_cond_destroy (&op->cond);
- e_mutex_destroy (op->mutex);
- g_free (op);
-}
-
-static void
-e_book_op_remove (EBook *book,
- EBookOp *op)
-{
- if (book->priv->current_op != op)
- g_warning ("cannot remove op, it's not current");
-
- book->priv->current_op = NULL;
-}
-
-static void
-e_book_clear_op (EBook *book,
- EBookOp *op)
-{
- e_book_op_remove (book, op);
- e_mutex_unlock (op->mutex);
- e_book_op_free (op);
-}
-
-
-
-/**
- * e_book_add_card:
- * @book: an #EBook
- * @contact: an #EContact
- *
- * adds @contact to @book.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_add_contact (EBook *book,
- EContact *contact,
- GError **error)
-{
- EBookOp *our_op;
- EBookStatus status;
- CORBA_Environment ev;
- char *vcard_str;
-
- printf ("e_book_add_contact\n");
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (contact && E_IS_CONTACT (contact), E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_add_contact called on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- vcard_str = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- /* will eventually end up calling e_book_response_add_contact */
- GNOME_Evolution_Addressbook_Book_addContact (book->priv->corba_book,
- (const GNOME_Evolution_Addressbook_VCard) vcard_str, &ev);
-
- g_free (vcard_str);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::addContact call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- e_contact_set (contact, E_CONTACT_UID, our_op->id);
- g_free (our_op->id);
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-static void
-e_book_response_add_contact (EBook *book,
- EBookStatus status,
- char *id)
-{
- EBookOp *op;
-
- printf ("e_book_response_add_contact\n");
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_add_contact: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->id = g_strdup (id);
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-
-
-/**
- * e_book_commit_contact:
- * @book: an #EBook
- * @contact: an #EContact
- *
- * applies the changes made to @contact to the stored version in
- * @book.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_commit_contact (EBook *book,
- EContact *contact,
- GError **error)
-{
- EBookOp *our_op;
- EBookStatus status;
- CORBA_Environment ev;
- char *vcard_str;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (contact && E_IS_CONTACT (contact), E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_commit_contact called on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- vcard_str = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- /* will eventually end up calling _e_book_response_generic */
- GNOME_Evolution_Addressbook_Book_modifyContact (book->priv->corba_book,
- (const GNOME_Evolution_Addressbook_VCard) vcard_str, &ev);
-
- g_free (vcard_str);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::modifyContact call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- e_contact_set (contact, E_CONTACT_UID, our_op->id);
- g_free (our_op->id);
-
- /* remove the op from the book's hash of operations */
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-
-/**
- * e_book_get_supported_fields:
- * @book: an #EBook
- * @fields: a #GList
- *
- * queries @book for the list of fields it supports. mostly for use
- * by the contact editor so it knows what fields to sensitize.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_get_supported_fields (EBook *book,
- GList **fields,
- GError **error)
-{
- EBookOp *our_op;
- EBookStatus status;
- CORBA_Environment ev;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (fields, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_get_supported_fields on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- /* will eventually end up calling
- _e_book_response_get_supported_fields */
- GNOME_Evolution_Addressbook_Book_getSupportedFields(book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::getSupportedFields call"));
- return FALSE;
- }
-
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *fields = our_op->list;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-static void
-e_book_response_get_supported_fields (EBook *book,
- EBookStatus status,
- GList *fields)
-{
- EBookOp *op;
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_get_supported_fields: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->list = fields;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-
-/**
- * e_book_get_supported_auth_methods:
- * @book: an #EBook
- * @auth_methods: a #GList
- *
- * queries @book for the list of authentication methods it supports.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_get_supported_auth_methods (EBook *book,
- GList **auth_methods,
- GError **error)
-{
- EBookOp *our_op;
- EBookStatus status;
- CORBA_Environment ev;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (auth_methods, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_get_supported_auth_methods on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- /* will eventually end up calling
- e_book_response_get_supported_fields */
- GNOME_Evolution_Addressbook_Book_getSupportedAuthMethods(book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::getSupportedAuthMethods call"));
- return FALSE;
- }
-
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *auth_methods = our_op->list;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-static void
-e_book_response_get_supported_auth_methods (EBook *book,
- EBookStatus status,
- GList *auth_methods)
-{
- EBookOp *op;
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_get_supported_auth_methods: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->list = auth_methods;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-
-
-/**
- * e_book_authenticate_user:
- * @book: an #EBook
- * @user: a string
- * @passwd: a string
- * @auth_method: a string
- *
- * authenticates @user with @passwd, using the auth method
- * @auth_method. @auth_method must be one of the authentication
- * methods returned using e_book_get_supported_auth_methods.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_authenticate_user (EBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method,
- GError **error)
-{
- EBookOp *our_op;
- EBookStatus status;
- CORBA_Environment ev;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (user, E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (passwd, E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (auth_method, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_authenticate_user on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- /* will eventually end up calling
- e_book_response_generic */
- GNOME_Evolution_Addressbook_Book_authenticateUser (book->priv->corba_book,
- user, passwd,
- auth_method,
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::authenticateUser call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-
-/**
- * e_book_get_contact:
- * @book: an #EBook
- * @id: a string
- * @contact: an #EContact
- *
- * Fills in @contact with the contents of the vcard in @book
- * corresponding to @id.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_get_contact (EBook *book,
- const char *id,
- EContact **contact,
- GError **error)
-{
- EBookOp *our_op;
- EBookStatus status;
- CORBA_Environment ev;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (id, E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (contact, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_get_contact on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- /* will eventually end up calling e_book_response_generic */
- GNOME_Evolution_Addressbook_Book_getContact (book->priv->corba_book,
- (const GNOME_Evolution_Addressbook_VCard) id, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::getContact call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *contact = our_op->contact;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-static void
-e_book_response_get_contact (EBook *book,
- EBookStatus status,
- EContact *contact)
-{
- EBookOp *op;
-
- printf ("e_book_response_get_contact\n");
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_get_contact: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->contact = contact;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-
-/**
- * e_book_remove_contact:
- * @book: an #EBook
- * @id: a string
- *
- * Removes the contact with id @id from @book.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_remove_contact (EBook *book,
- const char *id,
- GError **error)
-{
- GList *list;
- gboolean rv;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (id, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_remove_contact on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- e_mutex_lock (book->priv->mutex);
-
- list = g_list_append (NULL, (char*)id);
-
- rv = e_book_remove_contacts (book, list, error);
-
- return rv;
-}
-
-/**
- * e_book_remove_contacts:
- * @book: an #EBook
- * @ids: an #GList of const char *id's
- *
- * Removes the contacts with ids from the list @ids from @book. This is
- * always more efficient than calling e_book_remove_contact_by_id if you
- * have more than one id to remove, as some backends can implement it
- * as a batch request.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_remove_contacts (EBook *book,
- GList *ids,
- GError **error)
-{
- GNOME_Evolution_Addressbook_ContactIdList idlist;
- CORBA_Environment ev;
- GList *iter;
- int num_ids, i;
- EBookOp *our_op;
- EBookStatus status;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (ids, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_remove_contacts on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- num_ids = g_list_length (ids);
- idlist._buffer = CORBA_sequence_GNOME_Evolution_Addressbook_ContactId_allocbuf (num_ids);
- idlist._maximum = num_ids;
- idlist._length = num_ids;
-
- for (iter = ids, i = 0; iter; iter = iter->next)
- idlist._buffer[i++] = CORBA_string_dup (iter->data);
-
- /* will eventually end up calling e_book_response_generic */
- GNOME_Evolution_Addressbook_Book_removeContacts (book->priv->corba_book, &idlist, &ev);
-
- CORBA_free(idlist._buffer);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::removeContacts call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-
-/**
- * e_book_get_book_view:
- * @book: an #EBook
- * @query: an #EBookQuery
- * @requested_fields a #GList containing the names of fields to return, or NULL for all
- * @max_results the maximum number of contacts to show (or 0 for all)
- *
- * need docs here..
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_get_book_view (EBook *book,
- EBookQuery *query,
- GList *requested_fields,
- int max_results,
- EBookView **book_view,
- GError **error)
-{
- GNOME_Evolution_Addressbook_stringlist stringlist;
- CORBA_Environment ev;
- EBookOp *our_op;
- EBookStatus status;
- int num_fields, i;
- GList *iter;
- char *query_string;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (query, E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (book_view, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_get_book_view on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- our_op->listener = e_book_view_listener_new();
-
- num_fields = g_list_length (requested_fields);
-
- stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_fields);
- stringlist._maximum = num_fields;
- stringlist._length = num_fields;
-
- for (i = 0, iter = requested_fields; iter; iter = iter->next, i ++) {
- stringlist._buffer[i] = CORBA_string_dup ((char*)iter->data);
- }
-
- query_string = e_book_query_to_string (query);
-
- /* will eventually end up calling e_book_response_get_book_view */
- GNOME_Evolution_Addressbook_Book_getBookView (book->priv->corba_book,
- bonobo_object_corba_objref(BONOBO_OBJECT(our_op->listener)),
- query_string,
- &stringlist, max_results, &ev);
-
- CORBA_free(stringlist._buffer);
- g_free (query_string);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning ("corba exception._major = %d\n", ev._major);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::getBookView call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *book_view = our_op->view;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-static void
-e_book_response_get_book_view (EBook *book,
- EBookStatus status,
- GNOME_Evolution_Addressbook_BookView corba_book_view)
-{
-
- EBookOp *op;
-
- printf ("e_book_response_get_book_view\n");
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_get_book_view: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->view = e_book_view_new (corba_book_view, op->listener);
-
- bonobo_object_ref(BONOBO_OBJECT(op->listener));
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-
-
-/**
- * e_book_get_contacts:
- * @book: an #EBook
- * @query: an #EBookQuery
- *
- * need docs here..
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_get_contacts (EBook *book,
- EBookQuery *query,
- GList **contacts,
- GError **error)
-{
- CORBA_Environment ev;
- EBookOp *our_op;
- EBookStatus status;
- char *query_string;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (query, E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (contacts, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_get_contacts on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- query_string = e_book_query_to_string (query);
-
- /* will eventually end up calling e_book_response_get_contacts */
- GNOME_Evolution_Addressbook_Book_getContactList (book->priv->corba_book, query_string, &ev);
-
- g_free (query_string);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning ("corba exception._major = %d\n", ev._major);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::getContactList call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *contacts = our_op->list;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-static void
-e_book_response_get_contacts (EBook *book,
- EBookStatus status,
- GList *contact_list)
-{
-
- EBookOp *op;
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_get_contacts: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->list = contact_list;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-
-gboolean
-e_book_get_changes (EBook *book,
- char *changeid,
- GList **changes,
- GError **error)
-{
- CORBA_Environment ev;
- EBookOp *our_op;
- EBookStatus status;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (changeid, E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (changes, E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_get_changes on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- /* will eventually end up calling e_book_response_get_changes */
- GNOME_Evolution_Addressbook_Book_getChanges (book->priv->corba_book, changeid, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_warning ("corba exception._major = %d\n", ev._major);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::getChanges call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
- *changes = our_op->list;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-static void
-e_book_response_get_changes (EBook *book,
- EBookStatus status,
- GList *change_list)
-{
-
- EBookOp *op;
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_get_contacts: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
- op->list = change_list;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-void
-e_book_free_change_list (GList *change_list)
-{
- GList *l;
- for (l = change_list; l; l = l->next) {
- EBookChange *change = l->data;
-
- g_object_unref (change->contact);
- g_free (change);
- }
-
- g_list_free (change_list);
-}
-
-
-
-static void
-e_book_response_generic (EBook *book,
- EBookStatus status)
-{
- EBookOp *op;
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_generic: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-/**
- * e_book_cancel:
- * @book: an #EBook
- *
- * Used to cancel an already running operation on @book. This
- * function makes a synchronous CORBA to the backend telling it to
- * cancel the operation. If the operation wasn't cancellable (either
- * transiently or permanently) or had already comopleted on the wombat
- * side, this function will return E_BOOK_STATUS_COULD_NOT_CANCEL, and
- * the operation will continue uncancelled. If the operation could be
- * cancelled, this function will return E_BOOK_ERROR_OK, and the
- * blocked e_book function corresponding to current operation will
- * return with a status of E_BOOK_STATUS_CANCELLED.
- *
- * Return value: a #EBookStatus value.
- **/
-gboolean
-e_book_cancel (EBook *book,
- GError **error)
-{
- EBookOp *op;
- EBookStatus status;
- gboolean rv;
- CORBA_Environment ev;
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->current_op == NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_COULD_NOT_CANCEL,
- _("e_book_cancel: there is no current operation"));
- return FALSE;
- }
-
- op = book->priv->current_op;
-
- e_mutex_lock (op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- status = GNOME_Evolution_Addressbook_Book_cancelOperation(book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_mutex_unlock (op->mutex);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::cancelOperation call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- if (status == E_BOOK_ERROR_OK) {
- op->status = E_BOOK_ERROR_CANCELLED;
-
- pthread_cond_signal (&op->cond);
-
- rv = TRUE;
- }
- else {
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_COULD_NOT_CANCEL,
- _("e_book_cancel: couldn't cancel"));
- rv = FALSE;
- }
-
- e_mutex_unlock (op->mutex);
-
- return rv;
-}
-
-static void
-e_book_response_open (EBook *book,
- EBookStatus status)
-{
- EBookOp *op;
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_open: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-
-
-gboolean
-e_book_remove (EBook *book,
- GError **error)
-{
- CORBA_Environment ev;
- EBookOp *our_op;
- EBookStatus status;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
-
- e_mutex_lock (book->priv->mutex);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_URI_NOT_LOADED,
- _("e_book_remove on book before e_book_load_uri"));
- return FALSE;
- }
-
- if (book->priv->current_op != NULL) {
- e_mutex_unlock (book->priv->mutex);
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_BUSY,
- _("book busy"));
- return FALSE;
- }
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- e_mutex_unlock (book->priv->mutex);
-
- CORBA_exception_init (&ev);
-
- /* will eventually end up calling e_book_response_remove */
- GNOME_Evolution_Addressbook_Book_remove (book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
-
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CORBA_EXCEPTION,
- _("Corba exception making Book::remove call"));
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- e_book_clear_op (book, our_op);
-
- E_BOOK_CHECK_STATUS (status, error);
-}
-
-static void
-e_book_response_remove (EBook *book,
- EBookStatus status)
-{
- EBookOp *op;
-
- printf ("e_book_response_remove\n");
-
- op = e_book_get_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_response_remove: Cannot find operation ");
- return;
- }
-
- e_mutex_lock (op->mutex);
-
- op->status = status;
-
- pthread_cond_signal (&op->cond);
-
- e_mutex_unlock (op->mutex);
-}
-
-
-
-static void
-e_book_handle_response (EBookListener *listener, EBookListenerResponse *resp, EBook *book)
-{
- switch (resp->op) {
- case CreateContactResponse:
- e_book_response_add_contact (book, resp->status, resp->id);
- break;
- case RemoveContactResponse:
- case ModifyContactResponse:
- case AuthenticationResponse:
- e_book_response_generic (book, resp->status);
- break;
- case GetContactResponse: {
- EContact *contact = e_contact_new_from_vcard (resp->vcard);
- e_book_response_get_contact (book, resp->status, contact);
- break;
- }
- case GetContactListResponse:
- e_book_response_get_contacts (book, resp->status, resp->list);
- break;
- case GetBookViewResponse:
- e_book_response_get_book_view(book, resp->status, resp->book_view);
- break;
- case GetChangesResponse:
- e_book_response_get_changes(book, resp->status, resp->list);
- break;
- case OpenBookResponse:
- e_book_response_open (book, resp->status);
- break;
- case RemoveBookResponse:
- e_book_response_remove (book, resp->status);
- break;
- case GetSupportedFieldsResponse:
- e_book_response_get_supported_fields (book, resp->status, resp->list);
- break;
- case GetSupportedAuthMethodsResponse:
- e_book_response_get_supported_auth_methods (book, resp->status, resp->list);
- break;
- case WritableStatusEvent:
- book->priv->writable = resp->writable;
- g_signal_emit (book, e_book_signals [WRITABLE_STATUS], 0, resp->writable);
- break;
- default:
- g_error ("EBook: Unknown response code %d!\n",
- resp->op);
- }
-}
-
-
-
-gboolean
-e_book_unload_uri (EBook *book,
- GError **error)
-{
- CORBA_Environment ev;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (book->priv->load_state != E_BOOK_URI_NOT_LOADED, E_BOOK_ERROR_URI_NOT_LOADED);
-
- /* Release the remote GNOME_Evolution_Addressbook_Book in the PAS. */
- CORBA_exception_init (&ev);
-
- bonobo_object_release_unref (book->priv->corba_book, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_unload_uri: Exception releasing "
- "remote book interface!\n");
- }
-
- CORBA_exception_free (&ev);
-
- e_book_listener_stop (book->priv->listener);
- bonobo_object_unref (BONOBO_OBJECT (book->priv->listener));
-
- book->priv->listener = NULL;
- book->priv->load_state = E_BOOK_URI_NOT_LOADED;
- g_free (book->priv->cap);
- book->priv->cap = NULL;
- book->priv->writable = FALSE;
-
- return TRUE;
-}
-
-
-
-/**
- * e_book_load_uri:
- */
-
-static void
-backend_died_cb (EComponentListener *cl, gpointer user_data)
-{
- EBook *book = user_data;
-
- book->priv->load_state = E_BOOK_URI_NOT_LOADED;
- g_signal_emit (book, e_book_signals [BACKEND_DIED], 0);
-}
-
-static GList *
-activate_factories_for_uri (EBook *book, const char *uri)
-{
- CORBA_Environment ev;
- Bonobo_ServerInfoList *info_list = NULL;
- int i;
- char *protocol, *query, *colon;
- GList *factories = NULL;
-
- colon = strchr (uri, ':');
- if (!colon) {
- g_warning ("e_book_load_uri: Unable to determine protocol in the URI\n");
- return FALSE;
- }
-
- protocol = g_strndup (uri, colon-uri);
- query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/BookFactory:1.0')"
- " AND addressbook:supported_protocols.has ('%s')", protocol
- );
-
- CORBA_exception_init (&ev);
-
- info_list = bonobo_activation_query (query, NULL, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Eeek! Cannot perform bonobo-activation query for book factories.");
- CORBA_exception_free (&ev);
- goto done;
- return NULL;
- }
-
- if (info_list->_length == 0) {
- g_warning ("Can't find installed BookFactory that handles protocol '%s'.", protocol);
- CORBA_exception_free (&ev);
- goto done;
- }
-
- CORBA_exception_free (&ev);
-
- for (i = 0; i < info_list->_length; i ++) {
- const Bonobo_ServerInfo *info;
- GNOME_Evolution_Addressbook_BookFactory factory;
-
- info = info_list->_buffer + i;
-
- factory = bonobo_activation_activate_from_id (info->iid, 0, NULL, NULL);
-
- if (factory == CORBA_OBJECT_NIL)
- g_warning ("e_book_construct: Could not obtain a handle "
- "to the Personal Addressbook Server with IID `%s'\n", info->iid);
- else
- factories = g_list_append (factories, factory);
- }
-
- done:
- if (info_list)
- CORBA_free (info_list);
- g_free (query);
- g_free (protocol);
-
- return factories;
-}
-
-gboolean
-e_book_load_uri (EBook *book,
- const char *uri,
- gboolean only_if_exists,
- GError **error)
-{
- GList *factories;
- GList *l;
- gboolean rv = FALSE;
- GNOME_Evolution_Addressbook_Book corba_book = CORBA_OBJECT_NIL;
-
- e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
- e_return_error_if_fail (uri, E_BOOK_ERROR_INVALID_ARG);
-
- /* XXX this needs to happen while holding the book's lock i would think... */
- e_return_error_if_fail (book->priv->load_state == E_BOOK_URI_NOT_LOADED, E_BOOK_ERROR_URI_ALREADY_LOADED);
-
- /* try to find a list of factories that can handle the protocol */
- if (! (factories = activate_factories_for_uri (book, uri))) {
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED,
- _("e_book_load_uri: no factories available for uri `%s'"), uri);
- return FALSE;
- }
-
-
- book->priv->load_state = E_BOOK_URI_LOADING;
-
- /*
- * Create our local BookListener interface.
- */
- book->priv->listener = e_book_listener_new ();
- if (book->priv->listener == NULL) {
- g_warning ("e_book_load_uri: Could not create EBookListener!\n");
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_OTHER_ERROR,
- _("e_book_load_uri: Could not create EBookListener"));
- return FALSE;
- }
- book->priv->listener_signal = g_signal_connect (book->priv->listener, "response",
- G_CALLBACK (e_book_handle_response), book);
-
- g_free (book->priv->uri);
- book->priv->uri = g_strdup (uri);
-
- for (l = factories; l; l = l->next) {
- GNOME_Evolution_Addressbook_BookFactory factory = l->data;
- EBookOp *our_op;
- CORBA_Environment ev;
- EBookStatus status;
-
- our_op = e_book_new_op (book);
-
- e_mutex_lock (our_op->mutex);
-
- CORBA_exception_init (&ev);
-
- corba_book = GNOME_Evolution_Addressbook_BookFactory_getBook (factory, book->priv->uri,
- bonobo_object_corba_objref (BONOBO_OBJECT (book->priv->listener)),
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
- continue;
- }
-
- GNOME_Evolution_Addressbook_Book_open (corba_book,
- only_if_exists,
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- /* kill the listener so the book will die */
- g_signal_handler_disconnect (book->priv->listener, book->priv->listener_signal);
- bonobo_object_unref (book->priv->listener);
- book->priv->listener = NULL;
-
- e_book_clear_op (book, our_op);
-
- CORBA_exception_free (&ev);
- continue;
- }
-
- CORBA_exception_free (&ev);
-
- /* wait for something to happen (both cancellation and a
- successful response will notity us via our cv */
- e_mutex_cond_wait (&our_op->cond, our_op->mutex);
-
- status = our_op->status;
-
- /* remove the op from the book's hash of operations */
- e_book_clear_op (book, our_op);
-
- if (status == E_BOOK_ERROR_CANCELLED
- || status == E_BOOK_ERROR_OK) {
- rv = TRUE;
- break;
- }
- }
-
- /* free up the factories */
- for (l = factories; l; l = l->next)
- CORBA_Object_release ((CORBA_Object)l->data, NULL);
-
- if (rv == TRUE) {
- book->priv->corba_book = corba_book;
- book->priv->load_state = E_BOOK_URI_LOADED;
- book->priv->comp_listener = e_component_listener_new (book->priv->corba_book);
- book->priv->died_signal = g_signal_connect (book->priv->comp_listener, "component_died",
- G_CALLBACK (backend_died_cb), book);
- return TRUE;
- }
- else {
- g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED,
- _("e_book_load_uri: no factories available for uri `%s'"), uri);
- return FALSE;
- }
-
- return rv;
-}
-
-gboolean
-e_book_load_local_addressbook (EBook *book,
- GError **error)
-{
- char *filename;
- char *uri;
- gboolean rv;
-
- filename = g_build_filename (g_get_home_dir(),
- "evolution/local/Contacts",
- NULL);
- uri = g_strdup_printf ("file://%s", filename);
-
- g_free (filename);
-
- rv = e_book_load_uri (book, uri, TRUE, error);
-
- g_free (uri);
-
- return rv;
-}
-
-const char *
-e_book_get_uri (EBook *book)
-{
- return book->priv->uri;
-}
-
-const char *
-e_book_get_static_capabilities (EBook *book,
- GError **error)
-{
- if (!book->priv->cap_queried) {
- CORBA_Environment ev;
- char *temp;
-
- CORBA_exception_init (&ev);
-
- if (book->priv->load_state != E_BOOK_URI_LOADED) {
- g_warning ("e_book_unload_uri: No URI is loaded!\n");
- return g_strdup("");
- }
-
- temp = GNOME_Evolution_Addressbook_Book_getStaticCapabilities(book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_get_static_capabilities: Exception "
- "during get_static_capabilities!\n");
- CORBA_exception_free (&ev);
- return g_strdup("");
- }
-
- book->priv->cap = g_strdup(temp);
- book->priv->cap_queried = TRUE;
-
- CORBA_free(temp);
-
- CORBA_exception_free (&ev);
- }
-
- return book->priv->cap;
-}
-
-gboolean
-e_book_check_static_capability (EBook *book,
- const char *cap)
-{
- const char *caps = e_book_get_static_capabilities (book, NULL);
-
- /* XXX this is an inexact test but it works for our use */
- if (caps && strstr (caps, cap))
- return TRUE;
-
- return FALSE;
-}
-
-gboolean
-e_book_is_writable (EBook *book)
-{
- return book->priv->writable;
-}
-
-
-
-
-gboolean
-e_book_get_self (EContact **contact, EBook **book, GError **error)
-{
- GError *e = NULL;
-
- if (!e_book_get_default_addressbook (book, &e)) {
- g_propagate_error (error, e);
- return FALSE;
- }
-
-#if notyet
- EBook *b;
- char *self_uri, *self_uid;
-
- /* XXX get the setting for the self book and self uid from gconf */
-
- b = e_book_new();
- if (! e_book_load_uri (b, self_uri, TRUE, error)) {
- g_object_unref (b);
- return FALSE;
- }
-
- if (! e_book_get_contact (b, self_uid,
- contact, error)) {
- g_object_unref (b);
- return FALSE;
- }
-
- if (book)
- *book = b;
- else
- g_object_unref (b);
- return TRUE;
-#endif
-}
-
-gboolean
-e_book_set_self (EBook *book, const char *id, GError **error)
-{
-}
-
-
-
-gboolean
-e_book_get_default_addressbook (EBook **book, GError **error)
-{
- /* XXX for now just load the local ~/evolution/local/Contacts */
- char *path, *uri;
- gboolean rv;
-
- *book = e_book_new ();
-
- path = g_build_filename (g_get_home_dir (),
- "evolution/local/Contacts",
- NULL);
- uri = g_strdup_printf ("file://%s", path);
- g_free (path);
-
- rv = e_book_load_uri (*book, uri, FALSE, error);
-
- g_free (uri);
-
- if (!rv) {
- g_object_unref (*book);
- *book = NULL;
- }
-
- return rv;
-#if notyet
- EConfigListener *listener = e_config_listener_new ();
- ESourceList *sources = ...;
- ESource *default_source;
-
- default_source = e_source_list_peek_source_by_uid (sources,
- "default_");
-#endif
-}
-
-#if notyet
-ESourceList*
-e_book_get_addressbooks (GError **error)
-{
-}
-#endif
-
-
-static void*
-startup_mainloop (void *arg)
-{
- bonobo_main();
- return NULL;
-}
-
-/* one-time start up for libebook */
-static void
-e_book_activate()
-{
- static GStaticMutex e_book_lock = G_STATIC_MUTEX_INIT;
- static gboolean activated = FALSE;
-
- g_static_mutex_lock (&e_book_lock);
- if (!activated) {
- pthread_t ebook_mainloop_thread;
- activated = TRUE;
- pthread_create(&ebook_mainloop_thread, NULL, startup_mainloop, NULL);
- }
- g_static_mutex_unlock (&e_book_lock);
-}
-
-
-
-EBook*
-e_book_new (void)
-{
- e_book_activate ();
- return g_object_new (E_TYPE_BOOK, NULL);
-}
-
-
-static void
-e_book_init (EBook *book)
-{
- book->priv = g_new0 (EBookPrivate, 1);
- book->priv->load_state = E_BOOK_URI_NOT_LOADED;
- book->priv->uri = NULL;
- book->priv->mutex = e_mutex_new (E_MUTEX_REC);
-}
-
-static void
-e_book_dispose (GObject *object)
-{
- EBook *book = E_BOOK (object);
-
- if (book->priv) {
- CORBA_Environment ev;
- GList *l;
-
- if (book->priv->comp_listener) {
- g_signal_handler_disconnect (book->priv->comp_listener, book->priv->died_signal);
- g_object_unref (book->priv->comp_listener);
- book->priv->comp_listener = NULL;
- }
-
- if (book->priv->load_state == E_BOOK_URI_LOADED)
- e_book_unload_uri (book, NULL);
-
- CORBA_exception_init (&ev);
-
- for (l = book->priv->book_factories; l; l = l->next) {
- CORBA_Object_release ((CORBA_Object)l->data, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("EBook: Exception while releasing BookFactory\n");
-
- CORBA_exception_free (&ev);
- CORBA_exception_init (&ev);
- }
- }
-
- CORBA_exception_free (&ev);
-
- if (book->priv->listener) {
- g_signal_handler_disconnect (book->priv->listener, book->priv->listener_signal);
- bonobo_object_unref (book->priv->listener);
- book->priv->listener = NULL;
- }
-
- g_free (book->priv->cap);
-
- g_free (book->priv->uri);
-
- g_free (book->priv);
- book->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_book_class_init (EBookClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (G_TYPE_OBJECT);
-
- e_book_signals [WRITABLE_STATUS] =
- g_signal_new ("writable_status",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookClass, writable_status),
- NULL, NULL,
- e_book_marshal_NONE__BOOL,
- G_TYPE_NONE, 1,
- G_TYPE_BOOLEAN);
-
- e_book_signals [BACKEND_DIED] =
- g_signal_new ("backend_died",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookClass, backend_died),
- NULL, NULL,
- e_book_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- object_class->dispose = e_book_dispose;
-}
-
-/**
- * e_book_get_type:
- */
-GType
-e_book_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (EBookClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) e_book_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EBook),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_book_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "EBook", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h
deleted file mode 100644
index 1d2a4dc2d4..0000000000
--- a/addressbook/backend/ebook/e-book.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Chris Toshok (toshok@ximian.com)
- *
- * Copyright (C) 1999-2003, Ximian, Inc.
- */
-
-#ifndef __E_BOOK_H__
-#define __E_BOOK_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <ebook/e-contact.h>
-#include <ebook/e-book-query.h>
-#include <ebook/e-book-view.h>
-#include <ebook/e-book-types.h>
-#if notyet
-#include <e-util/e-source-list.h>
-#endif
-
-#define E_TYPE_BOOK (e_book_get_type ())
-#define E_BOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK, EBook))
-#define E_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_BOOK, EBookClass))
-#define E_IS_BOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK))
-#define E_IS_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK))
-#define E_BOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK, EBookClass))
-
-G_BEGIN_DECLS
-
-typedef struct _EBook EBook;
-typedef struct _EBookClass EBookClass;
-typedef struct _EBookPrivate EBookPrivate;
-
-struct _EBook {
- GObject parent;
- EBookPrivate *priv;
-};
-
-struct _EBookClass {
- GObjectClass parent;
-
- /*
- * Signals.
- */
- void (* writable_status) (EBook *book, gboolean writable);
- void (* backend_died) (EBook *book);
-
- /* Padding for future expansion */
- void (*_ebook_reserved0) (void);
- void (*_ebook_reserved1) (void);
- void (*_ebook_reserved2) (void);
- void (*_ebook_reserved3) (void);
- void (*_ebook_reserved4) (void);
-};
-
-/* Creating a new addressbook. */
-EBook *e_book_new (void);
-
-/* loading arbitrary addressbooks */
-gboolean e_book_load_uri (EBook *book,
- const char *uri,
- gboolean only_if_exists,
- GError **error);
-
-gboolean e_book_unload_uri (EBook *book,
- GError **error);
-
-gboolean e_book_remove (EBook *book,
- GError **error);
-
-/* convenience function for loading the "local" contact folder */
-gboolean e_book_load_local_addressbook (EBook *book,
- GError **error);
-
-gboolean e_book_get_supported_fields (EBook *book,
- GList **fields,
- GError **error);
-
-gboolean e_book_get_supported_auth_methods (EBook *book,
- GList **auth_methods,
- GError **error);
-
-/* User authentication. */
-gboolean e_book_authenticate_user (EBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method,
- GError **error);
-
-/* Fetching contacts. */
-gboolean e_book_get_contact (EBook *book,
- const char *id,
- EContact **contact,
- GError **error);
-
-/* Deleting contacts. */
-gboolean e_book_remove_contact (EBook *book,
- const char *id,
- GError **error);
-
-gboolean e_book_remove_contacts (EBook *book,
- GList *id_list,
- GError **error);
-
-/* Adding contacts. */
-gboolean e_book_add_contact (EBook *book,
- EContact *contact,
- GError **error);
-
-/* Modifying contacts. */
-gboolean e_book_commit_contact (EBook *book,
- EContact *contact,
- GError **error);
-
-/* Returns a live view of a query. */
-gboolean e_book_get_book_view (EBook *book,
- EBookQuery *query,
- GList *requested_fields,
- int max_results,
- EBookView **book_view,
- GError **error);
-
-/* Returns a static snapshot of a query. */
-gboolean e_book_get_contacts (EBook *book,
- EBookQuery *query,
- GList **contacts,
- GError **error);
-
-gboolean e_book_get_changes (EBook *book,
- char *changeid,
- GList **changes,
- GError **error);
-
-void e_book_free_change_list (GList *change_list);
-
-const char *e_book_get_uri (EBook *book);
-
-const char *e_book_get_static_capabilities (EBook *book,
- GError **error);
-gboolean e_book_check_static_capability (EBook *book,
- const char *cap);
-gboolean e_book_is_writable (EBook *book);
-
-/* Cancel a pending operation. */
-gboolean e_book_cancel (EBook *book,
- GError **error);
-
-/* Identity */
-gboolean e_book_get_self (EContact **contact, EBook **book, GError **error);
-gboolean e_book_set_self (EBook *book, const char *id, GError **error);
-
-/* Addressbook Discovery */
-gboolean e_book_get_default_addressbook (EBook **book, GError **error);
-#if notyet
-gboolean e_book_get_addressbooks (ESourceList** addressbook_sources, GError **error);
-#endif
-
-GType e_book_get_type (void);
-
-G_END_DECLS
-
-#endif /* ! __E_BOOK_H__ */
diff --git a/addressbook/backend/ebook/e-contact.c b/addressbook/backend/ebook/e-contact.c
deleted file mode 100644
index ce92b31f71..0000000000
--- a/addressbook/backend/ebook/e-contact.c
+++ /dev/null
@@ -1,1288 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-contact.c
- *
- * Copyright (C) 2003 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Chris Toshok (toshok@ximian.com)
- */
-
-#include <glib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
-#include "e-contact.h"
-#include "e-book.h"
-#include "e-util/ename/e-name-western.h"
-
-struct _EContactPrivate {
-};
-
-#define E_CONTACT_FIELD_TYPE_STRING 0x00000001 /* used for simple single valued attributes */
-/*E_CONTACT_FIELD_TYPE_FLOAT*/
-#define E_CONTACT_FIELD_TYPE_LIST 0x00000002 /* used for multivalued single attributes - the elements are of type char* */
-#define E_CONTACT_FIELD_TYPE_MULTI 0x00000004 /* used for multivalued attributes - the elements are of type EVCardAttribute */
-#define E_CONTACT_FIELD_TYPE_STRUCT 0x00000008 /* used for structured types (N and ADR properties, in particular) */
-#define E_CONTACT_FIELD_TYPE_BOOLEAN 0x00000010 /* used for boolean types (WANTS_HTML) */
-
-#define E_CONTACT_FIELD_TYPE_SYNTHETIC 0x10000000 /* used when there isn't a corresponding vcard field (such as email_1) */
-#define E_CONTACT_FIELD_TYPE_LIST_ELEM 0x20000000 /* used when a synthetic attribute is a numbered list element */
-#define E_CONTACT_FIELD_TYPE_MULTI_ELEM 0x40000000 /* used when we're looking for the nth attribute where more than 1 can be present in the vcard */
-#define E_CONTACT_FIELD_TYPE_ATTR_TYPE 0x80000000 /* used when a synthetic attribute is flagged with a TYPE= that we'll be looking for */
-
-typedef struct {
- guint32 t;
-
- EContactField field_id;
- const char *vcard_field_name;
- const char *field_name; /* non translated */
- const char *pretty_name; /* translated */
-
- gboolean read_only;
-
- int list_elem;
- const char *attr_type1;
- const char *attr_type2;
-
- void* (*struct_getter)(EContact *contact, EVCardAttribute *attribute);
- void (*struct_setter)(EContact *contact, EVCardAttribute *attribute, void *data);
-
-} EContactFieldInfo;
-
-static void* photo_getter (EContact *contact, EVCardAttribute *attr);
-static void photo_setter (EContact *contact, EVCardAttribute *attr, void *data);
-static void* fn_getter (EContact *contact, EVCardAttribute *attr);
-static void fn_setter (EContact *contact, EVCardAttribute *attr, void *data);
-static void* n_getter (EContact *contact, EVCardAttribute *attr);
-static void n_setter (EContact *contact, EVCardAttribute *attr, void *data);
-static void* adr_getter (EContact *contact, EVCardAttribute *attr);
-static void adr_setter (EContact *contact, EVCardAttribute *attr, void *data);
-static void* date_getter (EContact *contact, EVCardAttribute *attr);
-static void date_setter (EContact *contact, EVCardAttribute *attr, void *data);
-
-#define STRING_FIELD(id,vc,n,pn,ro) { E_CONTACT_FIELD_TYPE_STRING, (id), (vc), (n), (pn), (ro) }
-#define BOOLEAN_FIELD(id,vc,n,pn,ro) { E_CONTACT_FIELD_TYPE_BOOLEAN, (id), (vc), (n), (pn), (ro) }
-#define LIST_FIELD(id,vc,n,pn,ro) { E_CONTACT_FIELD_TYPE_LIST, (id), (vc), (n), (pn), (ro) }
-#define MULTI_LIST_FIELD(id,vc,n,pn,ro) { E_CONTACT_FIELD_TYPE_MULTI, (id), (vc), (n), (pn), (ro) }
-#define STRUCT_FIELD(id,vc,n,pn,ro,get,set) { E_CONTACT_FIELD_TYPE_STRUCT, (id), (vc), (n), (pn), (ro), -1, NULL, NULL, (get), (set) }
-#define LIST_ELEM_STR_FIELD(id,vc,n,pn,ro,nm) { E_CONTACT_FIELD_TYPE_LIST_ELEM | E_CONTACT_FIELD_TYPE_SYNTHETIC | E_CONTACT_FIELD_TYPE_STRING, (id), (vc), (n), (pn), (ro), (nm) }
-#define MULTI_ELEM_STR_FIELD(id,vc,n,pn,ro,nm) { E_CONTACT_FIELD_TYPE_MULTI_ELEM | E_CONTACT_FIELD_TYPE_SYNTHETIC | E_CONTACT_FIELD_TYPE_STRING, (id), (vc), (n), (pn), (ro), (nm) }
-#define ATTR_TYPE_STR_FIELD(id,vc,n,pn,ro,at1,nth) { E_CONTACT_FIELD_TYPE_ATTR_TYPE | E_CONTACT_FIELD_TYPE_SYNTHETIC | E_CONTACT_FIELD_TYPE_STRING, (id), (vc), (n), (pn), (ro), (nth), (at1), NULL }
-#define ATTR2_TYPE_STR_FIELD(id,vc,n,pn,ro,at1,at2,nth) { E_CONTACT_FIELD_TYPE_ATTR_TYPE | E_CONTACT_FIELD_TYPE_SYNTHETIC | E_CONTACT_FIELD_TYPE_STRING, (id), (vc), (n), (pn), (ro), (nth), (at1), (at2) }
-#define ATTR_TYPE_STRUCT_FIELD(id,vc,n,pn,ro,at,get,set) { E_CONTACT_FIELD_TYPE_ATTR_TYPE | E_CONTACT_FIELD_TYPE_SYNTHETIC | E_CONTACT_FIELD_TYPE_STRUCT, (id), (vc), (n), (pn), (ro), 0, (at), NULL, (get), (set) }
-
-static EContactFieldInfo field_info[] = {
- STRING_FIELD (E_CONTACT_UID, EVC_UID, "id", N_("Unique ID"), FALSE),
- STRING_FIELD (E_CONTACT_FILE_AS, EVC_X_FILE_AS, "file_as", N_("File As"), FALSE),
-
- /* Name fields */
- /* FN isn't really a structured field - we use a getter/setter
- so we can set the N property (since evo 1.4 works fine with
- vcards that don't even have a N attribute. *sigh*) */
- STRUCT_FIELD (E_CONTACT_FULL_NAME, EVC_FN, "full_name", N_("Full Name"), FALSE, fn_getter, fn_setter),
- STRUCT_FIELD (E_CONTACT_NAME, EVC_N, "name", N_("Name"), FALSE, n_getter, n_setter),
- LIST_ELEM_STR_FIELD (E_CONTACT_GIVEN_NAME, EVC_N, "given_name", N_("Given Name"), FALSE, 1),
- LIST_ELEM_STR_FIELD (E_CONTACT_FAMILY_NAME, EVC_N, "family_name", N_("Family Name"), FALSE, 0),
- STRING_FIELD (E_CONTACT_NICKNAME, EVC_NICKNAME, "nickname", N_("Nickname"), FALSE),
-
- /* Address fields */
- MULTI_LIST_FIELD (E_CONTACT_ADDRESS, EVC_ADR, "address", N_("Address List"), FALSE),
- ATTR_TYPE_STRUCT_FIELD (E_CONTACT_ADDRESS_HOME, EVC_ADR, "address_home", N_("Home Address"), FALSE, "HOME", adr_getter, adr_setter),
- ATTR_TYPE_STRUCT_FIELD (E_CONTACT_ADDRESS_WORK, EVC_ADR, "address_work", N_("Work Address"), FALSE, "WORK", adr_getter, adr_setter),
- ATTR_TYPE_STRUCT_FIELD (E_CONTACT_ADDRESS_OTHER, EVC_ADR, "address_other", N_("Other Address"), FALSE, "OTHER", adr_getter, adr_setter),
-
- ATTR_TYPE_STR_FIELD (E_CONTACT_ADDRESS_LABEL_HOME, EVC_LABEL, "address_label_home", N_("Home Address Label"), FALSE, "HOME", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_ADDRESS_LABEL_WORK, EVC_LABEL, "address_label_work", N_("Work Address Label"), FALSE, "WORK", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_ADDRESS_LABEL_OTHER, EVC_LABEL, "address_label_other", N_("Other Address Label"), FALSE, "OTHER", 0),
-
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_ASSISTANT, EVC_TEL, "assistant_phone", N_("Assistant Phone"), FALSE, "X-EVOLUTION-ASSISTANT", 0),
- ATTR2_TYPE_STR_FIELD (E_CONTACT_PHONE_BUSINESS, EVC_TEL, "business_phone", N_("Business Phone"), FALSE, "WORK", "VOICE", 0),
- ATTR2_TYPE_STR_FIELD (E_CONTACT_PHONE_BUSINESS_2, EVC_TEL, "business_phone_2", N_("Business Phone 2"), FALSE, "WORK", "VOICE", 1),
- ATTR2_TYPE_STR_FIELD (E_CONTACT_PHONE_BUSINESS_FAX, EVC_TEL, "business_fax", N_("Business Fax"), FALSE, "WORK", "FAX", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_CALLBACK, EVC_TEL, "callback_phone", N_("Callback Phone"), FALSE, "X-EVOLUTION-CALLBACK", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_CAR, EVC_TEL, "car_phone", N_("Car Phone"), FALSE, "CAR", 0),
- ATTR2_TYPE_STR_FIELD (E_CONTACT_PHONE_COMPANY, EVC_TEL, "company_phone", N_("Company Phone"), FALSE, "WORK", "VOICE", 2),
- ATTR2_TYPE_STR_FIELD (E_CONTACT_PHONE_HOME, EVC_TEL, "home_phone", N_("Home Phone"), FALSE, "HOME", "VOICE", 0),
- ATTR2_TYPE_STR_FIELD (E_CONTACT_PHONE_HOME_2, EVC_TEL, "home_phone_2", N_("Home Phone 2"), FALSE, "HOME", "VOICE", 1),
- ATTR2_TYPE_STR_FIELD (E_CONTACT_PHONE_HOME_FAX, EVC_TEL, "home_fax", N_("Home Fax"), FALSE, "HOME", "FAX", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_ISDN, EVC_TEL, "isdn_phone", N_("ISDN"), FALSE, "ISDN", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_MOBILE, EVC_TEL, "mobile_phone", N_("Mobile Phone"), FALSE, "CELL", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_OTHER, EVC_TEL, "other_phone", N_("Other Phone"), FALSE, "VOICE", 0), /* XXX */
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_OTHER_FAX, EVC_TEL, "other_fax", N_("Other Fax"), FALSE, "FAX", 0), /* XXX */
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_PAGER, EVC_TEL, "pager", N_("Pager"), FALSE, "PAGER", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_PRIMARY, EVC_TEL, "primary_phone", N_("Primary Phone"), FALSE, "PREF", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_RADIO, EVC_TEL, "radio", N_("Radio"), FALSE, "X-EVOLUTION-RADIO", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_TELEX, EVC_TEL, "telex", N_("Telex"), FALSE, "X-EVOLUTION-TELEX", 0),
- ATTR_TYPE_STR_FIELD (E_CONTACT_PHONE_TTYTDD, EVC_TEL, "tty", N_("TTY"), FALSE, "X-EVOLUTION-TTYTDD", 0),
-
- /* Email fields */
- MULTI_LIST_FIELD (E_CONTACT_EMAIL, EVC_EMAIL, "email", N_("Email List"), FALSE),
- MULTI_ELEM_STR_FIELD (E_CONTACT_EMAIL_1, EVC_EMAIL, "email_1", N_("Email 1"), FALSE, 0),
- MULTI_ELEM_STR_FIELD (E_CONTACT_EMAIL_2, EVC_EMAIL, "email_2", N_("Email 2"), FALSE, 1),
- MULTI_ELEM_STR_FIELD (E_CONTACT_EMAIL_3, EVC_EMAIL, "email_3", N_("Email 3"), FALSE, 2),
- STRING_FIELD (E_CONTACT_MAILER, EVC_MAILER, "mailer", N_("Mailer"), FALSE),
- BOOLEAN_FIELD (E_CONTACT_WANTS_HTML, EVC_X_WANTS_HTML, "wants_html", N_("Wants HTML Mail"), FALSE),
-
- /* Instant messaging fields */
- LIST_FIELD (E_CONTACT_IM_AIM, EVC_X_AIM, "im_aim", N_("AIM Screen Name List"), FALSE),
- LIST_FIELD (E_CONTACT_IM_JABBER, EVC_X_JABBER, "im_jabber", N_("Jabber Id List"), FALSE),
- LIST_FIELD (E_CONTACT_IM_YAHOO, EVC_X_YAHOO, "im_yahoo", N_("Yahoo! Screen Name List"), FALSE),
- LIST_FIELD (E_CONTACT_IM_MSN, EVC_X_MSN, "im_msn", N_("MSN Screen Name List"), FALSE),
- LIST_FIELD (E_CONTACT_IM_ICQ, EVC_X_ICQ, "im_icq", N_("ICQ Id List"), FALSE),
-
- /* Organizational fields */
- LIST_ELEM_STR_FIELD (E_CONTACT_ORG, EVC_ORG, "org", N_("Organization"), FALSE, 0),
- LIST_ELEM_STR_FIELD (E_CONTACT_ORG_UNIT, EVC_ORG, "org_unit", N_("Organizational Unit"), FALSE, 1),
- LIST_ELEM_STR_FIELD (E_CONTACT_OFFICE, EVC_ORG, "office", N_("Office"), FALSE, 2),
-
- STRING_FIELD (E_CONTACT_TITLE, EVC_TITLE, "title", N_("Title"), FALSE),
- STRING_FIELD (E_CONTACT_ROLE, EVC_ROLE, "role", N_("Role"), FALSE),
- STRING_FIELD (E_CONTACT_MANAGER, EVC_X_MANAGER, "manager", N_("Manager"), FALSE),
- STRING_FIELD (E_CONTACT_ASSISTANT, EVC_X_ASSISTANT, "assistant", N_("Assistant"), FALSE),
-
- /* Web fields */
- STRING_FIELD (E_CONTACT_HOMEPAGE_URL, EVC_URL, "homepage_url", N_("Homepage URL"), FALSE),
- STRING_FIELD (E_CONTACT_BLOG_URL, EVC_X_BLOG_URL, "blog_url", N_("Weblog URL"), FALSE),
-
- /* Photo/Logo */
- STRUCT_FIELD (E_CONTACT_PHOTO, EVC_PHOTO, "photo", N_("Photo"), FALSE, photo_getter, photo_setter),
- STRUCT_FIELD (E_CONTACT_LOGO, EVC_LOGO, "logo", N_("Logo"), FALSE, photo_getter, photo_setter),
-
- /* Contact categories */
-#if notyet
- LIST_FIELD (E_CONTACT_CATEGORY_LIST, EVC_CATEGORIES, "category_list", N_("Category List"), FALSE),
- SYNTH_STR_FIELD (E_CONTACT_CATEGORIES, "categories", N_("Categories"), FALSE),
-#else
- STRING_FIELD (E_CONTACT_CATEGORIES, EVC_CATEGORIES, "categories", N_("Categories"), FALSE),
-#endif
-
- /* Collaboration fields */
- STRING_FIELD (E_CONTACT_CALENDAR_URI, EVC_CALURI, "caluri", N_("Calendar URI"), FALSE),
- STRING_FIELD (E_CONTACT_FREEBUSY_URL, EVC_FBURL, "fburl", N_("Free/Busy URL"), FALSE),
- STRING_FIELD (E_CONTACT_ICS_CALENDAR, EVC_ICSCALENDAR, "icscalendar", N_("ICS Calendar"), FALSE),
-
- /* Misc fields */
- STRING_FIELD (E_CONTACT_SPOUSE, EVC_X_SPOUSE, "spouse", N_("Spouse's Name"), FALSE),
- STRING_FIELD (E_CONTACT_NOTE, EVC_NOTE, "note", N_("Note"), FALSE),
-
- STRUCT_FIELD (E_CONTACT_BIRTH_DATE, EVC_BDAY, "birth_date", N_("Birth Date"), FALSE, date_getter, date_setter),
- STRUCT_FIELD (E_CONTACT_ANNIVERSARY, EVC_BDAY, "anniversary", N_("Anniversary"), FALSE, date_getter, date_setter),
-
- BOOLEAN_FIELD (E_CONTACT_IS_LIST, EVC_X_LIST, "list", N_("List"), FALSE),
- BOOLEAN_FIELD (E_CONTACT_LIST_SHOW_ADDRESSES, EVC_X_LIST_SHOW_ADDRESSES, "list_show_addresses", N_("List Show Addresses"), FALSE)
-};
-
-#undef LIST_ELEM_STR_FIELD
-#undef STRING_FIELD
-#undef SYNTH_STR_FIELD
-#undef LIST_FIELD
-#undef STRUCT_FIELD
-
-static GObjectClass *parent_class;
-
-static void e_contact_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_contact_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
-static void
-e_contact_dispose (GObject *object)
-{
- EContact *ec = E_CONTACT (object);
-
- if (!ec->priv)
- return;
-
- /* XXX free instance specific stuff */
-
- g_free (ec->priv);
- ec->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_contact_class_init (EContactClass *klass)
-{
- GObjectClass *object_class;
- int i;
-
- object_class = G_OBJECT_CLASS(klass);
-
- parent_class = g_type_class_ref (E_TYPE_VCARD);
-
- object_class->dispose = e_contact_dispose;
- object_class->set_property = e_contact_set_property;
- object_class->get_property = e_contact_get_property;
-
- for (i = 0; i < G_N_ELEMENTS (field_info); i ++) {
- GParamSpec *pspec = NULL;
- if (field_info[i].t & E_CONTACT_FIELD_TYPE_STRING)
- pspec = g_param_spec_string (field_info[i].field_name,
- _(field_info[i].pretty_name),
- "" /* XXX blurb */,
- NULL,
- field_info[i].read_only ? G_PARAM_READABLE : G_PARAM_READWRITE);
- else if (field_info[i].t & E_CONTACT_FIELD_TYPE_BOOLEAN)
- pspec = g_param_spec_boolean (field_info[i].field_name,
- _(field_info[i].pretty_name),
- "" /* XXX blurb */,
- FALSE,
- field_info[i].read_only ? G_PARAM_READABLE : G_PARAM_READWRITE);
- else
- pspec = g_param_spec_pointer (field_info[i].field_name,
- _(field_info[i].pretty_name),
- "" /* XXX blurb */,
- field_info[i].read_only ? G_PARAM_READABLE : G_PARAM_READWRITE);
-
- g_object_class_install_property (object_class, field_info[i].field_id,
- pspec);
- }
-}
-
-static void
-e_contact_init (EContact *ec)
-{
- ec->priv = g_new0 (EContactPrivate, 1);
-}
-
-GType
-e_contact_get_type (void)
-{
- static GType contact_type = 0;
-
- if (!contact_type) {
- static const GTypeInfo contact_info = {
- sizeof (EContactClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_contact_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EContact),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_contact_init,
- };
-
- contact_type = g_type_register_static (E_TYPE_VCARD, "EContact", &contact_info, 0);
- }
-
- return contact_type;
-}
-
-static EVCardAttribute*
-e_contact_get_first_attr (EContact *contact, const char *attr_name)
-{
- GList *attrs, *l;
-
- attrs = e_vcard_get_attributes (E_VCARD (contact));
-
- for (l = attrs; l; l = l->next) {
- EVCardAttribute *attr = l->data;
- const char *name, *group;
-
- group = e_vcard_attribute_get_group (attr);
- name = e_vcard_attribute_get_name (attr);
-
- /* all the attributes we care about should be in group "" */
- if ((!group || !*group) && !strcasecmp (name, attr_name))
- return attr;
- }
-
- return NULL;
-}
-
-
-
-static void*
-photo_getter (EContact *contact, EVCardAttribute *attr)
-{
- if (attr) {
- GList *values = e_vcard_attribute_get_values_decoded (attr);
-
- if (values && values->data) {
- GString *s = values->data;
- EContactPhoto *photo = g_new (EContactPhoto, 1);
-
- photo->length = s->len;
- photo->data = g_malloc (photo->length);
- memcpy (photo->data, s->str, photo->length);
-
- return photo;
- }
- }
-
- return NULL;
-}
-
-static void
-photo_setter (EContact *contact, EVCardAttribute *attr, void *data)
-{
- EContactPhoto *photo = data;
- const char *mime_type;
- char *image_type = "X-EVOLUTION-UNKNOWN";
-
- e_vcard_attribute_add_param_with_value (attr,
- e_vcard_attribute_param_new (EVC_ENCODING),
- "b");
-
- mime_type = gnome_vfs_get_mime_type_for_data (photo->data, photo->length);
- if (!strcmp (mime_type, "image/gif"))
- image_type = "GIF";
- else if (!strcmp (mime_type, "image/jpeg"))
- image_type = "JPEG";
- else if (!strcmp (mime_type, "image/png"))
- image_type = "PNG";
- else if (!strcmp (mime_type, "image/tiff"))
- image_type = "TIFF";
- /* i have no idea what these last 2 are.. :) */
- else if (!strcmp (mime_type, "image/ief"))
- image_type = "IEF";
- else if (!strcmp (mime_type, "image/cgm"))
- image_type = "CGM";
-
- e_vcard_attribute_add_param_with_value (attr,
- e_vcard_attribute_param_new (EVC_TYPE),
- image_type);
-
- printf ("adding photo of type `%s' of length %d\n", image_type, photo->length);
- e_vcard_attribute_add_value_decoded (attr, photo->data, photo->length);
-}
-
-
-static void*
-fn_getter (EContact *contact, EVCardAttribute *attr)
-{
- if (attr) {
- GList *p = e_vcard_attribute_get_values (attr);
-
- return g_strdup (p && p->data ? p->data : "");
- }
- else
- return NULL;
-}
-
-static void
-fn_setter (EContact *contact, EVCardAttribute *attr, void *data)
-{
- e_vcard_attribute_add_value (attr, (char*)data);
-
- attr = e_contact_get_first_attr (contact, EVC_N);
- if (!attr) {
- EContactName *name = e_contact_name_from_string ((char*)data);
-
- attr = e_vcard_attribute_new (NULL, EVC_N);
- e_vcard_add_attribute (E_VCARD (contact), attr);
-
- /* call the setter directly */
- n_setter (contact, attr, name);
-
- e_contact_name_free (name);
- }
-}
-
-
-
-static void*
-n_getter (EContact *contact, EVCardAttribute *attr)
-{
- EContactName *name = g_new0 (EContactName, 1);
- if (attr) {
- GList *p = e_vcard_attribute_get_values (attr);
-
- name->family = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- name->given = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- name->additional = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- name->prefixes = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- name->suffixes = g_strdup (p && p->data ? p->data : "");
- }
-
- return name;
-}
-
-static void
-n_setter (EContact *contact, EVCardAttribute *attr, void *data)
-{
- EContactName *name = data;
-
- e_vcard_attribute_add_value (attr, name->family);
- e_vcard_attribute_add_value (attr, name->given);
- e_vcard_attribute_add_value (attr, name->additional);
- e_vcard_attribute_add_value (attr, name->prefixes);
- e_vcard_attribute_add_value (attr, name->suffixes);
-
- /* now find the attribute for FileAs. if it's not present, fill it in */
- attr = e_contact_get_first_attr (contact, EVC_X_FILE_AS);
- if (!attr) {
- char *strings[3], **stringptr;
- char *string;
- attr = e_vcard_attribute_new (NULL, EVC_X_FILE_AS);
- e_vcard_add_attribute (E_VCARD (contact), attr);
-
- stringptr = strings;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- *stringptr = NULL;
- string = g_strjoinv(", ", strings);
-
- e_vcard_attribute_add_value (attr, string);
- g_free (string);
- }
-
-}
-
-
-
-static void*
-adr_getter (EContact *contact, EVCardAttribute *attr)
-{
- if (attr) {
- GList *p = e_vcard_attribute_get_values (attr);
- EContactAddress *addr = g_new (EContactAddress, 1);
-
- addr->po = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- addr->ext = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- addr->street = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- addr->locality = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- addr->region = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- addr->code = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
- addr->country = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
-
- return addr;
- }
-
- return NULL;
-}
-
-static void
-adr_setter (EContact *contact, EVCardAttribute *attr, void *data)
-{
- /* XXX */
- g_assert_not_reached ();
-}
-
-
-
-static void*
-date_getter (EContact *contact, EVCardAttribute *attr)
-{
- if (attr) {
- GList *p = e_vcard_attribute_get_values (attr);
- EContactDate *date = e_contact_date_from_string (p && p->data ? (char*)p->data : "");
-
- return date;
- }
-
- return NULL;
-}
-
-static void
-date_setter (EContact *contact, EVCardAttribute *attr, void *data)
-{
- EContactDate *date = data;
- char *str = e_contact_date_to_string (date);
-
- e_vcard_attribute_add_value (attr, str);
- g_free (str);
-}
-
-
-
-/* Set_arg handler for the contact */
-static void
-e_contact_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EContact *contact = E_CONTACT (object);
- int i;
- EContactFieldInfo *info = NULL;
-
- if (prop_id < 1 || prop_id >= E_CONTACT_FIELD_LAST) {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
- }
-
-
- for (i = 0; i < G_N_ELEMENTS (field_info); i++) {
- if (field_info[i].field_id == prop_id) {
- info = &field_info[i];
- break;
- }
- }
-
- if (!info) {
- g_warning ("unknown field %d", prop_id);
- return;
- }
-
- if (info->t & E_CONTACT_FIELD_TYPE_MULTI) {
- GList *new_values = g_value_get_pointer (value);
- GList *l;
-
- /* first we remove all attributes of the type we're
- adding, then add new ones based on the values that
- are passed in */
- e_vcard_remove_attributes (E_VCARD (contact), NULL, info->vcard_field_name);
-
- for (l = new_values; l; l = l->next)
- e_vcard_add_attribute_with_value (E_VCARD (contact),
- e_vcard_attribute_new (NULL, info->vcard_field_name),
- (char*)l->data);
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_SYNTHETIC) {
- if (info->t & E_CONTACT_FIELD_TYPE_MULTI_ELEM) {
- /* XXX this is kinda broken - we don't insert
- insert padding elements if, e.g. the user
- sets email 3 when email 1 and 2 don't
- exist. But, if we *did* pad the lists we'd
- end up with empty items in the vcard. I
- dunno which is worse. */
- EVCardAttribute *attr = NULL;
- gboolean found = FALSE;
- int num_left = info->list_elem;
- GList *attrs = e_vcard_get_attributes (E_VCARD (contact));
- GList *l;
-
- for (l = attrs; l; l = l->next) {
- const char *name, *group;
-
- attr = l->data;
- group = e_vcard_attribute_get_group (attr);
- name = e_vcard_attribute_get_name (attr);
-
- /* all the attributes we care about should be in group "" */
- if ((!group || !*group) && !strcasecmp (name, info->vcard_field_name)) {
- if (num_left-- == 0) {
- found = TRUE;
- break;
- }
- }
- }
-
- if (found) {
- /* we found it, overwrite it */
- e_vcard_attribute_remove_values (attr);
- }
- else {
- /* we didn't find it - add a new attribute */
- attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
- e_vcard_add_attribute (E_VCARD (contact), attr);
- }
-
- e_vcard_attribute_add_value (attr, g_value_get_string (value));
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_ATTR_TYPE) {
- /* XXX this is kinda broken - we don't insert
- insert padding elements if, e.g. the user
- sets email 3 when email 1 and 2 don't
- exist. But, if we *did* pad the lists we'd
- end up with empty items in the vcard. I
- dunno which is worse. */
- EVCardAttribute *attr = NULL;
- gboolean found = FALSE;
- int num_left = info->list_elem;
- GList *attrs = e_vcard_get_attributes (E_VCARD (contact));
- GList *l;
- const char *sval = g_value_get_string (value);
-
- for (l = attrs; l && !found; l = l->next) {
- const char *name, *group;
- gboolean found_needed1, found_needed2;
-
- if (!info->attr_type1)
- found_needed1 = TRUE;
- else
- found_needed1 = FALSE;
-
- if (!info->attr_type2)
- found_needed2 = TRUE;
- else
- found_needed2 = FALSE;
-
- attr = l->data;
- group = e_vcard_attribute_get_group (attr);
- name = e_vcard_attribute_get_name (attr);
-
- /* all the attributes we care about should be in group "" */
- if ((!group || !*group) && !strcasecmp (name, info->vcard_field_name)) {
- GList *params;
-
- for (params = e_vcard_attribute_get_params (attr); params; params = params->next) {
- EVCardAttributeParam *param = params->data;
- const char *name = e_vcard_attribute_param_get_name (param);
-
- if (!strcasecmp (name, EVC_TYPE)) {
- GList *values = e_vcard_attribute_param_get_values (param);
- if (values && values->data) {
- if (!found_needed1 && !strcasecmp ((char*)values->data, info->attr_type1))
- found_needed1 = TRUE;
- else if (!found_needed2 && !strcasecmp ((char*)values->data, info->attr_type2))
- found_needed2 = TRUE;
- }
- }
-
- if (found_needed1 && found_needed2) {
- if (num_left-- == 0) {
- found = TRUE;
- break;
- }
- }
- }
- }
- }
-
- if (found) {
- /* we found it, overwrite it */
- e_vcard_attribute_remove_values (attr);
- }
- else {
- /* we didn't find it - add a new attribute */
- attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
- e_vcard_add_attribute (E_VCARD (contact), attr);
- if (info->attr_type1)
- e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new (EVC_TYPE),
- info->attr_type1);
- if (info->attr_type2)
- e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new (EVC_TYPE),
- info->attr_type2);
- }
-
- if (sval && *sval)
- e_vcard_attribute_add_value (attr, sval);
- else
- e_vcard_remove_attribute (E_VCARD (contact), attr);
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_LIST_ELEM) {
- EVCardAttribute *attr = e_contact_get_first_attr (contact, info->vcard_field_name);
- GList *values;
- GList *p;
- const char *sval = g_value_get_string (value);
-
- if (!attr) {
- if (!sval || !*sval)
- return;
-
- printf ("adding new %s\n", info->vcard_field_name);
-
- attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
- e_vcard_add_attribute (E_VCARD (contact), attr);
- }
-
- values = e_vcard_attribute_get_values (attr);
- p = g_list_nth (values, info->list_elem);
-
- if (p) {
- g_free (p->data);
- p->data = g_strdup (g_value_get_string (value));
- }
- else {
- /* there weren't enough elements in the list, pad it */
- int count = info->list_elem - g_list_length (values);
-
- while (count--)
- e_vcard_attribute_add_value (attr, "");
-
- e_vcard_attribute_add_value (attr, g_value_get_string (value));
- }
-
- }
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_BOOLEAN) {
- EVCardAttribute *attr;
-
- /* first we search for an attribute we can overwrite */
- attr = e_contact_get_first_attr (contact, info->vcard_field_name);
- if (attr) {
- printf ("setting %s to `%s'\n", info->vcard_field_name, g_value_get_string (value));
- e_vcard_attribute_remove_values (attr);
- e_vcard_attribute_add_value (attr, g_value_get_boolean (value) ? "TRUE" : "FALSE");
- }
- else {
- /* and if we don't find one we create a new attribute */
- e_vcard_add_attribute_with_value (E_VCARD (contact),
- e_vcard_attribute_new (NULL, info->vcard_field_name),
- g_value_get_boolean (value) ? "TRUE" : "FALSE");
- }
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_STRING) {
- EVCardAttribute *attr;
- const char *sval = g_value_get_string (value);
-
- /* first we search for an attribute we can overwrite */
- attr = e_contact_get_first_attr (contact, info->vcard_field_name);
- if (attr) {
- printf ("setting %s to `%s'\n", info->vcard_field_name, sval);
- e_vcard_attribute_remove_values (attr);
- if (sval)
- e_vcard_attribute_add_value (attr, sval);
- }
- else if (sval) {
- /* and if we don't find one we create a new attribute */
- e_vcard_add_attribute_with_value (E_VCARD (contact),
- e_vcard_attribute_new (NULL, info->vcard_field_name),
- g_value_get_string (value));
- }
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_STRUCT) {
- EVCardAttribute *attr = e_contact_get_first_attr (contact, info->vcard_field_name);
- void *data = g_value_get_pointer (value);
-
- if (attr) {
- printf ("overwriting existing %s\n", info->vcard_field_name);
- /* remove all existing values and parameters.
- the setter will add the correct ones */
- e_vcard_attribute_remove_values (attr);
- e_vcard_attribute_remove_params (attr);
- }
- else {
- printf ("adding new %s\n", info->vcard_field_name);
- attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
-
- e_vcard_add_attribute (E_VCARD (contact), attr);
- }
-
- info->struct_setter (contact, attr, data);
- }
- else {
- g_warning ("unhandled attribute `%s'", info->vcard_field_name);
- }
-}
-
-static GList *
-e_contact_get_email_list (EContact *contact)
-{
- GList *rv = NULL;
- GList *attrs, *l;
-
- attrs = e_vcard_get_attributes (E_VCARD (contact));
-
- for (l = attrs; l; l = l->next) {
- EVCardAttribute *attr = l->data;
- const char *name, *group;
-
- group = e_vcard_attribute_get_group (attr);
- name = e_vcard_attribute_get_name (attr);
-
- /* all the attributes we care about should be in group "" */
- if ((!group || !*group) && !strcasecmp (name, EVC_EMAIL)) {
- GList *v = e_vcard_attribute_get_values (attr);
-
- rv = g_list_append (rv, v ? g_strdup (v->data) : NULL);
- }
- }
-
- return rv;
-}
-
-static EVCardAttribute *
-e_contact_find_attribute_with_types (EContact *contact, const char *attr_name, const char *type_needed1, const char *type_needed2, int nth)
-{
- GList *l, *attrs;
- gboolean found_needed1, found_needed2;
-
- attrs = e_vcard_get_attributes (E_VCARD (contact));
-
- for (l = attrs; l; l = l->next) {
- EVCardAttribute *attr = l->data;
- const char *name, *group;
-
- if (!type_needed1)
- found_needed1 = TRUE;
- else
- found_needed1 = FALSE;
-
- if (!type_needed2)
- found_needed2 = TRUE;
- else
- found_needed2 = FALSE;
-
- group = e_vcard_attribute_get_group (attr);
- name = e_vcard_attribute_get_name (attr);
-
- /* all the attributes we care about should be in group "" */
- if ((!group || !*group) && !strcasecmp (name, attr_name)) {
- GList *params;
-
- for (params = e_vcard_attribute_get_params (attr); params; params = params->next) {
- EVCardAttributeParam *param = params->data;
- const char *name = e_vcard_attribute_param_get_name (param);
-
- if (!strcasecmp (name, EVC_TYPE)) {
- GList *values = e_vcard_attribute_param_get_values (param);
- if (values && values->data) {
- if (!found_needed1 && !strcasecmp ((char*)values->data, type_needed1))
- found_needed1 = TRUE;
- else if (!found_needed2 && !strcasecmp ((char*)values->data, type_needed2))
- found_needed2 = TRUE;
- }
- }
-
- if (found_needed1 && found_needed2) {
- if (nth-- == 0)
- return attr;
- else
- break;
- }
- }
- }
- }
-
- return NULL;
-}
-
-static void
-e_contact_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EContact *contact = E_CONTACT (object);
- int i;
- EContactFieldInfo *info = NULL;
-
- if (prop_id < 1 || prop_id >= E_CONTACT_FIELD_LAST) {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
- }
-
- for (i = 0; i < G_N_ELEMENTS (field_info); i++) {
- if (field_info[i].field_id == prop_id) {
- info = &field_info[i];
- break;
- }
- }
-
- if (!info) {
- g_warning ("unknown field %d", prop_id);
- return;
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_BOOLEAN) {
- EVCardAttribute *attr = e_contact_get_first_attr (contact, info->vcard_field_name);
- gboolean rv = FALSE;
-
- if (attr) {
- GList *v = e_vcard_attribute_get_values (attr);
- rv = v && v->data && !strcasecmp ((char*)v->data, "true");
- }
-
- g_value_set_boolean (value, rv);
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_LIST) {
- EVCardAttribute *attr = e_contact_get_first_attr (contact, info->vcard_field_name);
-
- if (attr)
- g_value_set_pointer (value, e_vcard_attribute_get_values (attr));
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_LIST_ELEM) {
- if (info->t & E_CONTACT_FIELD_TYPE_STRING) {
- GList *attrs, *l;
-
- attrs = e_vcard_get_attributes (E_VCARD (contact));
-
- for (l = attrs; l; l = l->next) {
- EVCardAttribute *attr = l->data;
- const char *name, *group;
-
- group = e_vcard_attribute_get_group (attr);
- name = e_vcard_attribute_get_name (attr);
-
- /* all the attributes we care about should be in group "" */
- if ((!group || !*group) && !strcasecmp (name, info->vcard_field_name)) {
- GList *v;
- int count;
-
- v = e_vcard_attribute_get_values (attr);
- count = info->list_elem;
-
- v = g_list_nth (v, info->list_elem);
-
- g_value_set_string (value, v ? v->data : NULL);
- }
- }
- }
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_MULTI_ELEM) {
- if (info->t & E_CONTACT_FIELD_TYPE_STRING) {
- GList *attrs, *l;
-
- attrs = e_vcard_get_attributes (E_VCARD (contact));
-
- for (l = attrs; l; l = l->next) {
- EVCardAttribute *attr = l->data;
- const char *name, *group;
-
- group = e_vcard_attribute_get_group (attr);
- name = e_vcard_attribute_get_name (attr);
-
- /* all the attributes we care about should be in group "" */
- if ((!group || !*group) && !strcasecmp (name, info->vcard_field_name)) {
- GList *v;
- int count;
-
- v = e_vcard_attribute_get_values (attr);
- count = info->list_elem;
-
- v = g_list_nth (v, info->list_elem);
-
- g_value_set_string (value, v ? v->data : NULL);
- }
- }
- }
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_ATTR_TYPE) {
- EVCardAttribute *attr = e_contact_find_attribute_with_types (contact, info->vcard_field_name, info->attr_type1, info->attr_type2, info->list_elem);
-
- if (info->t & E_CONTACT_FIELD_TYPE_STRING) {
- if (attr) {
- GList *p = e_vcard_attribute_get_values (attr);
- char *rv = p->data;
-
- g_value_set_string (value, rv);
- }
- else {
- g_value_set_string (value, NULL);
- }
- }
- else { /* struct */
- gpointer rv = info->struct_getter (contact, attr);
-
- g_value_set_pointer (value, rv);
- }
-
- }
- else if (info->t & E_CONTACT_FIELD_TYPE_STRUCT) {
- EVCardAttribute *attr = e_contact_get_first_attr (contact, info->vcard_field_name);
- void *rv = NULL;
-
- if (attr)
- rv = info->struct_getter (contact, attr);
-
- g_value_set_pointer (value, rv);
- }
-
- else if (info->t & E_CONTACT_FIELD_TYPE_SYNTHETIC) {
- switch (info->field_id) {
- default:
- g_warning ("unhandled synthetic field 0x%02x", info->field_id);
- }
- }
- else {
- GList *attrs, *l;
- GList *rv = NULL; /* used for multi attribute lists */
-
- attrs = e_vcard_get_attributes (E_VCARD (contact));
-
- for (l = attrs; l; l = l->next) {
- EVCardAttribute *attr = l->data;
- const char *name, *group;
-
- group = e_vcard_attribute_get_group (attr);
- name = e_vcard_attribute_get_name (attr);
-
- /* all the attributes we care about should be in group "" */
- if ((!group || !*group) && !strcasecmp (name, info->vcard_field_name)) {
- GList *v;
- v = e_vcard_attribute_get_values (attr);
-
- if (info->t & E_CONTACT_FIELD_TYPE_STRING) {
- g_value_set_string (value, v ? v->data : NULL);
- }
- else {
- rv = g_list_append (rv, v ? g_strdup (v->data) : NULL);
-
- g_value_set_pointer (value, rv);
- }
- }
- }
- }
-}
-
-
-
-EContact*
-e_contact_new (void)
-{
- return e_contact_new_from_vcard ("");
-}
-
-EContact*
-e_contact_new_from_vcard (const char *vcard)
-{
- EContact *contact = g_object_new (E_TYPE_CONTACT, NULL);
-
- e_vcard_construct (E_VCARD (contact), vcard);
-
- return contact;
-}
-
-EContact*
-e_contact_duplicate (EContact *contact)
-{
- char *vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
- EContact *c = e_contact_new_from_vcard (vcard);
-
- g_free (vcard);
-
- return c;
-}
-
-const char *
-e_contact_field_name (EContactField field_id)
-{
- int i;
-
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, "");
-
- for (i = 0; i < G_N_ELEMENTS (field_info); i ++) {
- if (field_id == field_info[i].field_id)
- return field_info[i].field_name;
- }
-
- g_warning ("unknown field id %d", field_id);
- return "";
-}
-
-const char *
-e_contact_pretty_name (EContactField field_id)
-{
- int i;
-
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, "");
-
- for (i = 0; i < G_N_ELEMENTS (field_info); i ++) {
- if (field_id == field_info[i].field_id)
- return _(field_info[i].pretty_name);
- }
-
- g_warning ("unknown field id %d", field_id);
- return "";
-}
-
-EContactField
-e_contact_field_id (const char *field_name)
-{
- int i;
-
- for (i = 0; i < G_N_ELEMENTS (field_info); i ++) {
- if (!strcmp (field_info[i].field_name, field_name))
- return field_info[i].field_id;
- }
-
- g_warning ("unknown field name `%s'", field_name);
- return 0;
-}
-
-gpointer
-e_contact_get (EContact *contact, EContactField field_id)
-{
- gpointer value;
-
- g_return_val_if_fail (contact && E_IS_CONTACT (contact), NULL);
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, NULL);
-
- g_object_get (contact,
- e_contact_field_name (field_id), &value,
- NULL);
-
- return value;
-}
-
-/* XXX this won't work for structure/list types... */
-static void
-free_const_data (gpointer data, GObject *where_object_was)
-{
- g_free (data);
-}
-
-const gpointer
-e_contact_get_const (EContact *contact, EContactField field_id)
-{
- gpointer value;
-
- g_return_val_if_fail (E_IS_CONTACT (contact), NULL);
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, NULL);
-
- value = e_contact_get (contact, field_id);
-
- g_object_weak_ref (G_OBJECT (contact), free_const_data, value);
-
- return value;
-}
-
-void
-e_contact_set (EContact *contact, EContactField field_id, gpointer value)
-{
- printf ("e_contact_set (%p, %d, %p)\n", contact, field_id, value);
-
- g_return_if_fail (contact && E_IS_CONTACT (contact));
- g_return_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST);
-
- g_object_set (contact,
- e_contact_field_name (field_id), value,
- NULL);
-}
-
-EContactName*
-e_contact_name_new ()
-{
- return g_new0 (EContactName, 1);
-}
-
-char *
-e_contact_name_to_string(const EContactName *name)
-{
- char *strings[6], **stringptr = strings;
-
- g_return_val_if_fail (name != NULL, NULL);
-
- if (name->prefixes && *name->prefixes)
- *(stringptr++) = name->prefixes;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- if (name->additional && *name->additional)
- *(stringptr++) = name->additional;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->suffixes && *name->suffixes)
- *(stringptr++) = name->suffixes;
- *stringptr = NULL;
- return g_strjoinv(" ", strings);
-}
-
-EContactName*
-e_contact_name_from_string (const char *name_str)
-{
- EContactName *name = e_contact_name_new();
- ENameWestern *western = e_name_western_parse (name_str);
-
- name->prefixes = g_strdup (western->prefix);
- name->given = g_strdup (western->first );
- name->additional = g_strdup (western->middle);
- name->family = g_strdup (western->last );
- name->suffixes = g_strdup (western->suffix);
-
- e_name_western_free(western);
-
- return name;
-}
-
-EContactName*
-e_contact_name_copy (EContactName *n)
-{
- EContactName *name = e_contact_name_new();
-
- name->prefixes = g_strdup (n->prefixes);
- name->given = g_strdup (n->given);
- name->additional = g_strdup (n->additional);
- name->family = g_strdup (n->family);
- name->suffixes = g_strdup (n->suffixes);
-
- return name;
-}
-
-void
-e_contact_name_free (EContactName *name)
-{
- if (!name)
- return;
-
- g_free (name->family);
- g_free (name->given);
- g_free (name->additional);
- g_free (name->prefixes);
- g_free (name->suffixes);
-
- g_free (name);
-}
-
-EContactDate*
-e_contact_date_new (void)
-{
- return g_new0 (EContactDate, 1);
-}
-
-EContactDate*
-e_contact_date_from_string (const char *str)
-{
- EContactDate* date = e_contact_date_new();
- int length;
-
- length = strlen(str);
-
- if (length == 10 ) {
- date->year = str[0] * 1000 + str[1] * 100 + str[2] * 10 + str[3] - '0' * 1111;
- date->month = str[5] * 10 + str[6] - '0' * 11;
- date->day = str[8] * 10 + str[9] - '0' * 11;
- } else if ( length == 8 ) {
- date->year = str[0] * 1000 + str[1] * 100 + str[2] * 10 + str[3] - '0' * 1111;
- date->month = str[4] * 10 + str[5] - '0' * 11;
- date->day = str[6] * 10 + str[7] - '0' * 11;
- }
-
- return date;
-}
-
-char *
-e_contact_date_to_string (EContactDate *dt)
-{
- if (dt)
- return g_strdup_printf ("%04d-%02d-%02d",
- CLAMP(dt->year, 1000, 9999),
- CLAMP(dt->month, 1, 12),
- CLAMP(dt->day, 1, 31));
- else
- return NULL;
-}
-
-void
-e_contact_date_free (EContactDate *dt)
-{
- g_free (dt);
-}
-
-
-void
-e_contact_photo_free (EContactPhoto *photo)
-{
- if (!photo)
- return;
-
- g_free (photo->data);
- g_free (photo);
-}
-
-void
-e_contact_address_free (EContactAddress *address)
-{
- if (!address)
- return;
-
- g_free (address->address_format);
- g_free (address->po);
- g_free (address->ext);
- g_free (address->street);
- g_free (address->locality);
- g_free (address->region);
- g_free (address->code);
- g_free (address->country);
-
- g_free (address);
-}
diff --git a/addressbook/backend/ebook/e-contact.h b/addressbook/backend/ebook/e-contact.h
deleted file mode 100644
index 21c0256ca9..0000000000
--- a/addressbook/backend/ebook/e-contact.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 2003 Ximian, Inc.
- */
-
-#ifndef __E_CONTACT_H__
-#define __E_CONTACT_H__
-
-#include <time.h>
-#include <glib-object.h>
-#include <stdio.h>
-#include <ebook/e-vcard.h>
-
-#define E_TYPE_CONTACT (e_contact_get_type ())
-#define E_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT, EContact))
-#define E_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT, EContactClass))
-#define E_IS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT))
-#define E_IS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CONTACT))
-#define E_CONTACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CONTACT, EContactClass))
-
-typedef struct _EContact EContact;
-typedef struct _EContactClass EContactClass;
-typedef struct _EContactPrivate EContactPrivate;
-
-typedef enum {
-
- E_CONTACT_UID = 1, /* string field */
- E_CONTACT_FILE_AS, /* string field */
-
- /* Name fields */
- E_CONTACT_FULL_NAME, /* string field */
- E_CONTACT_GIVEN_NAME, /* synthetic string field */
- E_CONTACT_FAMILY_NAME, /* synthetic string field */
- E_CONTACT_NICKNAME, /* string field */
-
- /* Email fields */
- E_CONTACT_EMAIL_1, /* synthetic string field */
- E_CONTACT_EMAIL_2, /* synthetic string field */
- E_CONTACT_EMAIL_3, /* synthetic string field */
-
- E_CONTACT_MAILER, /* string field */
-
- /* Address Labels */
- E_CONTACT_ADDRESS_LABEL_HOME, /* synthetic string field */
- E_CONTACT_ADDRESS_LABEL_WORK, /* synthetic string field */
- E_CONTACT_ADDRESS_LABEL_OTHER, /* synthetic string field */
-
- /* Phone fields */
- E_CONTACT_PHONE_ASSISTANT,
- E_CONTACT_PHONE_BUSINESS,
- E_CONTACT_PHONE_BUSINESS_2,
- E_CONTACT_PHONE_BUSINESS_FAX,
- E_CONTACT_PHONE_CALLBACK,
- E_CONTACT_PHONE_CAR,
- E_CONTACT_PHONE_COMPANY,
- E_CONTACT_PHONE_HOME,
- E_CONTACT_PHONE_HOME_2,
- E_CONTACT_PHONE_HOME_FAX,
- E_CONTACT_PHONE_ISDN,
- E_CONTACT_PHONE_MOBILE,
- E_CONTACT_PHONE_OTHER,
- E_CONTACT_PHONE_OTHER_FAX,
- E_CONTACT_PHONE_PAGER,
- E_CONTACT_PHONE_PRIMARY,
- E_CONTACT_PHONE_RADIO,
- E_CONTACT_PHONE_TELEX,
- E_CONTACT_PHONE_TTYTDD,
-
- /* Organizational fields */
- E_CONTACT_ORG, /* string field */
- E_CONTACT_ORG_UNIT, /* string field */
- E_CONTACT_OFFICE, /* string field */
- E_CONTACT_TITLE, /* string field */
- E_CONTACT_ROLE, /* string field */
- E_CONTACT_MANAGER, /* string field */
- E_CONTACT_ASSISTANT, /* string field */
-
- /* Web fields */
- E_CONTACT_HOMEPAGE_URL, /* string field */
- E_CONTACT_BLOG_URL, /* string field */
-
- /* Contact categories */
- E_CONTACT_CATEGORIES, /* string field */
-
- /* Collaboration fields */
- E_CONTACT_CALENDAR_URI, /* string field */
- E_CONTACT_FREEBUSY_URL, /* string field */
- E_CONTACT_ICS_CALENDAR, /* string field */
-
- /* misc fields */
- E_CONTACT_SPOUSE, /* string field */
- E_CONTACT_NOTE, /* string field */
-
- /* fields used for describing contact lists. a contact list
- is just a contact with _IS_LIST set to true. the members
- are listed in the _EMAIL field. */
- E_CONTACT_IS_LIST, /* boolean field */
- E_CONTACT_LIST_SHOW_ADDRESSES, /* boolean field */
-
- /* Instant Messaging fields */
- E_CONTACT_IM_AIM, /* Multi-valued */
- E_CONTACT_IM_JABBER, /* Multi-valued */
- E_CONTACT_IM_YAHOO, /* Multi-valued */
- E_CONTACT_IM_MSN, /* Multi-valued */
- E_CONTACT_IM_ICQ, /* Multi-valued */
-
- /* Address fields */
- E_CONTACT_ADDRESS, /* Multi-valued structured (EContactAddress) */
- E_CONTACT_ADDRESS_HOME, /* synthetic structured field (EContactAddress) */
- E_CONTACT_ADDRESS_WORK, /* synthetic structured field (EContactAddress) */
- E_CONTACT_ADDRESS_OTHER, /* synthetic structured field (EContactAddress) */
-
- E_CONTACT_CATEGORY_LIST, /* multi-valued */
-
- /* Photo/Logo */
- E_CONTACT_PHOTO, /* structured field (EContactPhoto) */
- E_CONTACT_LOGO, /* structured field (EContactPhoto) */
-
- E_CONTACT_NAME, /* structured field (EContactName) */
- E_CONTACT_EMAIL, /* Multi-valued */
-
- E_CONTACT_WANTS_HTML, /* boolean field */
-
- E_CONTACT_BIRTH_DATE, /* structured field (EContactDate) */
- E_CONTACT_ANNIVERSARY, /* structured field (EContactDate) */
-
- /* Security Fields */
- E_CONTACT_X509_CERT, /* string field */
- E_CONTACT_X509_CERT_SHA1_FINGERPRINT, /* string field */
-
- E_CONTACT_FIELD_LAST,
-
- /* useful constants */
- E_CONTACT_LAST_SIMPLE_STRING = E_CONTACT_NOTE,
- E_CONTACT_FIRST_PHONE_ID = E_CONTACT_PHONE_ASSISTANT,
- E_CONTACT_LAST_PHONE_ID = E_CONTACT_PHONE_TTYTDD,
- E_CONTACT_FIRST_EMAIL_ID = E_CONTACT_EMAIL_1,
- E_CONTACT_LAST_EMAIL_ID = E_CONTACT_EMAIL_3,
- E_CONTACT_FIRST_ADDRESS_ID = E_CONTACT_ADDRESS_HOME,
- E_CONTACT_LAST_ADDRESS_ID = E_CONTACT_ADDRESS_OTHER,
- E_CONTACT_FIRST_LABEL_ID = E_CONTACT_ADDRESS_LABEL_HOME,
- E_CONTACT_LAST_LABEL_ID = E_CONTACT_ADDRESS_LABEL_OTHER
-
-} EContactField;
-
-typedef struct {
- char *family;
- char *given;
- char *additional;
- char *prefixes;
- char *suffixes;
-} EContactName;
-
-typedef struct {
- int length;
- char *data;
-} EContactPhoto;
-
-typedef struct {
- char *address_format; /* the two letter country code that
- determines the format/meaning of the
- following fields */
- char *po;
- char *ext;
- char *street;
- char *locality;
- char *region;
- char *code;
- char *country;
-} EContactAddress;
-
-typedef struct {
- int year;
- int month;
- int day;
-} EContactDate;
-
-struct _EContact {
- EVCard parent;
-
- EContactPrivate *priv;
-};
-
-struct _EContactClass {
- EVCardClass parent_class;
-
- /* Padding for future expansion */
- void (*_ebook_reserved0) (void);
- void (*_ebook_reserved1) (void);
- void (*_ebook_reserved2) (void);
- void (*_ebook_reserved3) (void);
- void (*_ebook_reserved4) (void);
-};
-
-GType e_contact_get_type (void);
-
-EContact* e_contact_new (void);
-EContact* e_contact_new_from_vcard (const char *vcard);
-
-EContact* e_contact_duplicate (EContact *contact);
-
-gpointer e_contact_get (EContact *contact, EContactField field_id);
-const gpointer e_contact_get_const (EContact *contact, EContactField field_id);
-void e_contact_set (EContact *contact, EContactField field_id, gpointer value);
-
-/* misc functions for structured values */
-EContactDate *e_contact_date_new (void);
-EContactDate *e_contact_date_from_string (const char *str);
-char *e_contact_date_to_string (EContactDate *dt);
-
-EContactName *e_contact_name_new (void);
-char *e_contact_name_to_string (const EContactName *name);
-EContactName *e_contact_name_from_string (const char *name_str);
-EContactName *e_contact_name_copy (EContactName *name);
-
-
-/* destructors for structured values */
-void e_contact_date_free (EContactDate *date);
-void e_contact_name_free (EContactName *name);
-void e_contact_photo_free (EContactPhoto *photo);
-void e_contact_address_free (EContactAddress *address);
-
-
-const char* e_contact_field_name (EContactField field_id);
-const char* e_contact_pretty_name (EContactField field_id);
-EContactField e_contact_field_id (const char *field_name);
-
-#endif /* __E_CONTACT_H__ */
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
deleted file mode 100644
index b147489719..0000000000
--- a/addressbook/backend/ebook/e-destination.c
+++ /dev/null
@@ -1,1698 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-destination.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- */
-
-#include <config.h>
-#include "e-destination.h"
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include "e-book.h"
-#include "e-book-marshal.h"
-#include "e-book-util.h"
-#include <gal/widgets/e-unicode.h>
-
-#include <glib.h>
-#include <libxml/xmlmemory.h>
-#include <camel/camel-internet-address.h>
-
-#define d(x)
-
-enum {
- CHANGED,
- CARDIFIED,
- LAST_SIGNAL
-};
-
-guint e_destination_signals[LAST_SIGNAL] = { 0 };
-
-struct _EDestinationPrivate {
- gchar *raw;
-
- gchar *book_uri;
- gchar *card_uid;
- ECard *card;
- gint card_email_num;
-
- ECard *old_card;
- gint old_card_email_num;
- gchar *old_textrep;
-
- gchar *name;
- gchar *email;
- gchar *addr;
- gchar *textrep;
-
- GList *list_dests;
-
- guint html_mail_override : 1;
- guint wants_html_mail : 1;
-
- guint show_addresses : 1;
-
- guint has_been_cardified : 1;
- guint allow_cardify : 1;
- guint cannot_cardify : 1;
- guint auto_recipient : 1;
- guint pending_cardification;
-
- guint pending_change : 1;
-
- EBook *cardify_book;
-
- gint freeze_count;
-};
-
-static void e_destination_clear_card (EDestination *);
-static void e_destination_clear_strings (EDestination *);
-
-static GObjectClass *parent_class;
-
-static void
-e_destination_dispose (GObject *obj)
-{
- EDestination *dest = E_DESTINATION (obj);
-
- if (dest->priv) {
- e_destination_clear (dest);
-
- if (dest->priv->old_card)
- g_object_unref (dest->priv->old_card);
-
- if (dest->priv->cardify_book)
- g_object_unref (dest->priv->cardify_book);
-
- g_free (dest->priv->old_textrep);
-
- g_free (dest->priv);
- dest->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (obj);
-}
-
-static void
-e_destination_class_init (EDestinationClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (G_TYPE_OBJECT);
-
- object_class->dispose = e_destination_dispose;
-
- e_destination_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EDestinationClass, changed),
- NULL, NULL,
- e_book_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_destination_signals[CARDIFIED] =
- g_signal_new ("cardified",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EDestinationClass, cardified),
- NULL, NULL,
- e_book_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-}
-
-static void
-e_destination_init (EDestination *dest)
-{
- dest->priv = g_new0 (struct _EDestinationPrivate, 1);
-
- dest->priv->allow_cardify = TRUE;
- dest->priv->cannot_cardify = FALSE;
- dest->priv->auto_recipient = FALSE;
- dest->priv->pending_cardification = 0;
-}
-
-GType
-e_destination_get_type (void)
-{
- static GType dest_type = 0;
-
- if (!dest_type) {
- GTypeInfo dest_info = {
- sizeof (EDestinationClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) e_destination_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EDestination),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_destination_init
- };
-
- dest_type = g_type_register_static (G_TYPE_OBJECT, "EDestination", &dest_info, 0);
- }
-
- return dest_type;
-}
-
-EDestination *
-e_destination_new (void)
-{
- return g_object_new (E_TYPE_DESTINATION, NULL);
-}
-
-static void
-e_destination_freeze (EDestination *dest)
-{
- g_return_if_fail (E_IS_DESTINATION (dest));
- g_return_if_fail (dest->priv->freeze_count >= 0);
-
- dest->priv->freeze_count++;
-}
-
-static void
-e_destination_thaw (EDestination *dest)
-{
- g_return_if_fail (E_IS_DESTINATION (dest));
- g_return_if_fail (dest->priv->freeze_count > 0);
-
- dest->priv->freeze_count--;
- if (dest->priv->freeze_count == 0 && dest->priv->pending_change)
- e_destination_changed (dest);
-}
-
-void
-e_destination_changed (EDestination *dest)
-{
- if (dest->priv->freeze_count == 0) {
- g_signal_emit (dest, e_destination_signals[CHANGED], 0);
- dest->priv->pending_change = FALSE;
- dest->priv->cannot_cardify = FALSE;
-
- } else {
- dest->priv->pending_change = TRUE;
- }
-}
-
-EDestination *
-e_destination_copy (const EDestination *dest)
-{
- EDestination *new_dest;
- GList *iter;
-
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- new_dest = e_destination_new ();
-
- new_dest->priv->book_uri = g_strdup (dest->priv->book_uri);
- new_dest->priv->card_uid = g_strdup (dest->priv->card_uid);
- new_dest->priv->name = g_strdup (dest->priv->name);
- new_dest->priv->email = g_strdup (dest->priv->email);
- new_dest->priv->addr = g_strdup (dest->priv->addr);
- new_dest->priv->card_email_num = dest->priv->card_email_num;
- new_dest->priv->old_card_email_num = dest->priv->old_card_email_num;
- new_dest->priv->old_textrep = g_strdup (dest->priv->old_textrep);
-
- new_dest->priv->card = dest->priv->card;
- if (new_dest->priv->card)
- g_object_ref (new_dest->priv->card);
-
- new_dest->priv->old_card = dest->priv->old_card;
- if (new_dest->priv->old_card)
- g_object_ref (new_dest->priv->old_card);
-
- new_dest->priv->html_mail_override = dest->priv->html_mail_override;
- new_dest->priv->wants_html_mail = dest->priv->wants_html_mail;
-
- for (iter = dest->priv->list_dests; iter != NULL; iter = g_list_next (iter)) {
- new_dest->priv->list_dests = g_list_append (new_dest->priv->list_dests,
- e_destination_copy (E_DESTINATION (iter->data)));
- }
-
- return new_dest;
-}
-
-static void
-e_destination_clear_card (EDestination *dest)
-{
- if (dest->priv->card) {
- if (dest->priv->old_card)
- g_object_unref (dest->priv->old_card);
-
- dest->priv->old_card = dest->priv->card;
- dest->priv->old_card_email_num = dest->priv->card_email_num;
-
- g_free (dest->priv->old_textrep);
- dest->priv->old_textrep = g_strdup (e_destination_get_textrep (dest, FALSE));
- }
-
- g_free (dest->priv->book_uri);
- dest->priv->book_uri = NULL;
- g_free (dest->priv->card_uid);
- dest->priv->card_uid = NULL;
-
- dest->priv->card = NULL;
- dest->priv->card_email_num = -1;
-
- g_list_foreach (dest->priv->list_dests, (GFunc) g_object_unref, NULL);
- g_list_free (dest->priv->list_dests);
- dest->priv->list_dests = NULL;
-
- dest->priv->allow_cardify = TRUE;
- dest->priv->cannot_cardify = FALSE;
-
- e_destination_cancel_cardify (dest);
-
- e_destination_changed (dest);
-}
-
-static void
-e_destination_clear_strings (EDestination *dest)
-{
- g_free (dest->priv->raw);
- dest->priv->raw = NULL;
-
- g_free (dest->priv->name);
- dest->priv->name = NULL;
-
- g_free (dest->priv->email);
- dest->priv->email = NULL;
-
- g_free (dest->priv->addr);
- dest->priv->addr = NULL;
-
- g_free (dest->priv->textrep);
- dest->priv->textrep = NULL;
-
- e_destination_changed (dest);
-}
-
-void
-e_destination_clear (EDestination *dest)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- e_destination_freeze (dest);
-
- e_destination_clear_card (dest);
- e_destination_clear_strings (dest);
-
- e_destination_thaw (dest);
-}
-
-static gboolean
-nonempty (const gchar *s)
-{
- gunichar c;
- while (*s) {
- c = g_utf8_get_char (s);
- if (!g_unichar_isspace (c))
- return TRUE;
- s = g_utf8_next_char (s);
- }
- return FALSE;
-}
-
-gboolean
-e_destination_is_empty (const EDestination *dest)
-
-{
- struct _EDestinationPrivate *p;
-
- g_return_val_if_fail (E_IS_DESTINATION (dest), TRUE);
-
- p = dest->priv;
-
- return !(p->card != NULL
- || (p->book_uri && *p->book_uri)
- || (p->card_uid && *p->card_uid)
- || (p->raw && nonempty (p->raw))
- || (p->name && nonempty (p->name))
- || (p->email && nonempty (p->email))
- || (p->addr && nonempty (p->addr))
- || (p->list_dests != NULL));
-}
-
-gboolean
-e_destination_is_valid (const EDestination *dest)
-{
- const char *email;
-
- g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
- if (e_destination_from_card (dest))
- return TRUE;
-
- email = e_destination_get_email (dest);
-
- /* FIXME: if we really wanted to get fancy here, we could
- check to make sure that the address was valid according to
- rfc822's addr-spec grammar. */
-
- return email && *email && strchr (email, '@');
-}
-
-gboolean
-e_destination_equal (const EDestination *a, const EDestination *b)
-{
- const struct _EDestinationPrivate *pa, *pb;
- const char *na, *nb;
-
- g_return_val_if_fail (E_IS_DESTINATION (a), FALSE);
- g_return_val_if_fail (E_IS_DESTINATION (b), FALSE);
-
- if (a == b)
- return TRUE;
-
- pa = a->priv;
- pb = b->priv;
-
- /* Check equality of cards. */
- if (pa->card || pb->card) {
- if (! (pa->card && pb->card))
- return FALSE;
-
- if (pa->card == pb->card || !strcmp (e_card_get_id (pa->card), e_card_get_id (pb->card)))
- return TRUE;
-
- return FALSE;
- }
-
- /* Just in case name returns NULL */
- na = e_destination_get_name (a);
- nb = e_destination_get_name (b);
- if ((na || nb) && !(na && nb && ! e_utf8_casefold_collate (na, nb)))
- return FALSE;
-
- if (!g_ascii_strcasecmp (e_destination_get_email (a), e_destination_get_email (b)))
- return TRUE;
- else
- return FALSE;
-}
-
-void
-e_destination_set_card (EDestination *dest, ECard *card, gint email_num)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
- g_return_if_fail (card && E_IS_CARD (card));
-
- if (dest->priv->card != card || dest->priv->card_email_num != email_num) {
- /* We have to freeze/thaw around these operations so that the 'changed'
- signals don't cause the EDestination's internal state to be altered
- before we can finish setting ->card && ->card_email_num. */
- e_destination_freeze (dest);
- e_destination_clear (dest);
-
- dest->priv->card = card;
- g_object_ref (dest->priv->card);
-
- dest->priv->card_email_num = email_num;
-
- e_destination_changed (dest);
- e_destination_thaw (dest);
- }
-}
-
-void
-e_destination_set_book_uri (EDestination *dest, const gchar *uri)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
- g_return_if_fail (uri != NULL);
-
- if (dest->priv->book_uri == NULL || strcmp (dest->priv->book_uri, uri)) {
- g_free (dest->priv->book_uri);
- dest->priv->book_uri = g_strdup (uri);
-
- /* If we already have a card, remove it unless it's uri matches the one
- we just set. */
- if (dest->priv->card) {
- EBook *book = e_card_get_book (dest->priv->card);
- if ((!book) || strcmp (uri, e_book_get_uri (book))) {
- g_object_unref (dest->priv->card);
- dest->priv->card = NULL;
- }
- }
-
- e_destination_changed (dest);
- }
-}
-
-void
-e_destination_set_card_uid (EDestination *dest, const gchar *uid, gint email_num)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
- g_return_if_fail (uid != NULL);
-
- if (dest->priv->card_uid == NULL
- || strcmp (dest->priv->card_uid, uid)
- || dest->priv->card_email_num != email_num) {
-
- g_free (dest->priv->card_uid);
- dest->priv->card_uid = g_strdup (uid);
- dest->priv->card_email_num = email_num;
-
- /* If we already have a card, remove it unless it's uri matches the one
- we just set. */
- if (dest->priv->card && strcmp (uid, e_card_get_id (dest->priv->card))) {
- g_object_unref (dest->priv->card);
- dest->priv->card = NULL;
- }
-
- e_destination_changed (dest);
- }
-}
-
-void
-e_destination_set_name (EDestination *dest, const gchar *name)
-{
- gboolean changed = FALSE;
-
- g_return_if_fail (E_IS_DESTINATION (dest));
-
- if (name == NULL) {
- if (dest->priv->name != NULL) {
- g_free (dest->priv->name);
- dest->priv->name = NULL;
- changed = TRUE;
- }
- } else if (dest->priv->name == NULL || strcmp (dest->priv->name, name)) {
- g_free (dest->priv->name);
- dest->priv->name = g_strdup (name);
- changed = TRUE;
- }
-
- if (changed) {
- g_free (dest->priv->addr);
- dest->priv->addr = NULL;
- g_free (dest->priv->textrep);
- dest->priv->textrep = NULL;
- e_destination_changed (dest);
- }
-}
-
-void
-e_destination_set_email (EDestination *dest, const gchar *email)
-{
- gboolean changed = FALSE;
-
- g_return_if_fail (E_IS_DESTINATION (dest));
-
- if (email == NULL) {
- if (dest->priv->email != NULL) {
- g_free (dest->priv->addr);
- dest->priv->addr = NULL;
- changed = TRUE;
- }
- } else if (dest->priv->email == NULL || strcmp (dest->priv->email, email)) {
- g_free (dest->priv->email);
- dest->priv->email = g_strdup (email);
- changed = TRUE;
- }
-
- if (changed) {
- g_free (dest->priv->addr);
- dest->priv->addr = NULL;
- g_free (dest->priv->textrep);
- dest->priv->textrep = NULL;
- e_destination_changed (dest);
- }
-}
-
-void
-e_destination_set_html_mail_pref (EDestination *dest, gboolean x)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- dest->priv->html_mail_override = TRUE;
- if (dest->priv->wants_html_mail != x) {
- dest->priv->wants_html_mail = x;
- e_destination_changed (dest);
- }
-}
-
-gboolean
-e_destination_contains_card (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
- return dest->priv->card != NULL;
-}
-
-gboolean
-e_destination_from_card (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
- return dest->priv->card != NULL || dest->priv->book_uri != NULL || dest->priv->card_uid != NULL;
-}
-
-gboolean
-e_destination_is_auto_recipient (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
-
- return dest->priv->auto_recipient;
-}
-
-void
-e_destination_set_auto_recipient (EDestination *dest, gboolean value)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- dest->priv->auto_recipient = value;
-}
-
-typedef struct _UseCard UseCard;
-struct _UseCard {
- EDestination *dest;
- EDestinationCardCallback cb;
- gpointer closure;
-};
-
-static void
-use_card_cb (ECard *card, gpointer closure)
-{
- UseCard *uc = (UseCard *) closure;
-
- if (card != NULL && uc->dest->priv->card == NULL) {
- uc->dest->priv->card = card;
- g_object_ref (uc->dest->priv->card);
- e_destination_changed (uc->dest);
- }
-
- if (uc->cb) {
- uc->cb (uc->dest, uc->dest->priv->card, uc->closure);
- }
-
- /* We held a copy of the destination during the callback. */
- g_object_unref (uc->dest);
- g_free (uc);
-}
-
-void
-e_destination_use_card (EDestination *dest, EDestinationCardCallback cb, gpointer closure)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- if (dest->priv->card != NULL) {
- if (cb)
- cb (dest, dest->priv->card, closure);
- } else if (dest->priv->book_uri != NULL && dest->priv->card_uid != NULL) {
- UseCard *uc = g_new (UseCard, 1);
-
- uc->dest = dest;
- /* Hold a reference to the destination during the callback. */
- g_object_ref (uc->dest);
- uc->cb = cb;
- uc->closure = closure;
- e_card_load_uri (dest->priv->book_uri, dest->priv->card_uid, use_card_cb, uc);
- } else {
- if (cb)
- cb (dest, NULL, closure);
- }
-}
-
-ECard *
-e_destination_get_card (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- return dest->priv->card;
-}
-
-const gchar *
-e_destination_get_card_uid (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- if (dest->priv->card_uid)
- return dest->priv->card_uid;
-
- if (dest->priv->card)
- return e_card_get_id (dest->priv->card);
-
- return NULL;
-}
-
-const gchar *
-e_destination_get_book_uri (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- if (dest->priv->book_uri)
- return dest->priv->book_uri;
-
- if (dest->priv->card) {
- EBook *book = e_card_get_book (dest->priv->card);
-
- if (book) {
- return e_book_get_uri (book);
- }
- }
-
- return NULL;
-}
-
-gint
-e_destination_get_email_num (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), -1);
-
- if (dest->priv->card == NULL && (dest->priv->book_uri == NULL || dest->priv->card_uid == NULL))
- return -1;
-
- return dest->priv->card_email_num;
-}
-
-const gchar *
-e_destination_get_name (const EDestination *dest)
-{
- struct _EDestinationPrivate *priv;
-
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
-
- if (priv->name == NULL) {
- if (priv->card != NULL) {
- priv->name = e_card_name_to_string (priv->card->name);
-
- if (priv->name == NULL || *priv->name == '\0') {
- g_free (priv->name);
- priv->name = g_strdup (priv->card->file_as);
- }
-
- if (priv->name == NULL || *priv->name == '\0') {
- g_free (priv->name);
- if (e_card_evolution_list (priv->card))
- priv->name = g_strdup (_("Unnamed List"));
- else
- priv->name = g_strdup (e_destination_get_email (dest));
- }
- } else if (priv->raw != NULL) {
- CamelInternetAddress *addr = camel_internet_address_new ();
-
- if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
- const char *camel_name = NULL;
-
- camel_internet_address_get (addr, 0, &camel_name, NULL);
- priv->name = g_strdup (camel_name);
- }
-
- camel_object_unref (CAMEL_OBJECT (addr));
- }
- }
-
- return priv->name;
-}
-
-const gchar *
-e_destination_get_email (const EDestination *dest)
-{
- struct _EDestinationPrivate *priv;
-
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
-
- if (priv->email == NULL) {
- if (priv->card != NULL) {
- /* Pull the address out of the card. */
- if (priv->card->email) {
- EIterator *iter = e_list_get_iterator (priv->card->email);
- int n = priv->card_email_num;
-
- if (n >= 0) {
- while (n > 0) {
- e_iterator_next (iter);
- n--;
- }
-
- if (e_iterator_is_valid (iter)) {
- gconstpointer ptr = e_iterator_get (iter);
- priv->email = g_strdup ((char *) ptr);
- }
- }
- }
- } else if (priv->raw != NULL) {
- CamelInternetAddress *addr = camel_internet_address_new ();
-
- if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
- const gchar *camel_email = NULL;
- camel_internet_address_get (addr, 0, NULL, &camel_email);
- priv->email = g_strdup (camel_email);
- }
-
- camel_object_unref (CAMEL_OBJECT (addr));
- }
-
- /* Force e-mail to be non-null... */
- if (priv->email == NULL) {
- priv->email = g_strdup ("");
- }
- }
-
- return priv->email;
-}
-
-const gchar *
-e_destination_get_address (const EDestination *dest)
-{
- struct _EDestinationPrivate *priv;
-
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
-
- if (priv->addr == NULL) {
- CamelInternetAddress *addr = camel_internet_address_new ();
-
- if (e_destination_is_evolution_list (dest)) {
- GList *iter = dest->priv->list_dests;
-
- while (iter) {
- EDestination *list_dest = E_DESTINATION (iter->data);
-
- if (!e_destination_is_empty (list_dest)) {
- camel_internet_address_add (addr,
- e_destination_get_name (list_dest),
- e_destination_get_email (list_dest));
- }
- iter = g_list_next (iter);
- }
-
- priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
- } else if (priv->raw) {
-
- if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
- priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
- }
- } else {
- camel_internet_address_add (addr,
- e_destination_get_name (dest),
- e_destination_get_email (dest));
-
- priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
- }
-
- camel_object_unref (CAMEL_OBJECT (addr));
- }
-
- return priv->addr;
-}
-
-void
-e_destination_set_raw (EDestination *dest, const gchar *raw)
-{
- g_return_if_fail (E_IS_DESTINATION (dest));
- g_return_if_fail (raw != NULL);
-
- if (dest->priv->raw == NULL || strcmp (dest->priv->raw, raw)) {
- e_destination_freeze (dest);
-
- e_destination_clear (dest);
- dest->priv->raw = g_strdup (raw);
- e_destination_changed (dest);
-
- e_destination_thaw (dest);
- }
-}
-
-const gchar *
-e_destination_get_textrep (const EDestination *dest, gboolean include_email)
-{
- const char *name, *email;
-
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- if (dest->priv->raw)
- return dest->priv->raw;
-
- name = e_destination_get_name (dest);
- email = e_destination_get_email (dest);
-
- if (e_destination_from_card (dest) && name != NULL && (!include_email || !email || !*email))
- return name;
-
- /* Make sure that our address gets quoted properly */
- if (name && email && dest->priv->textrep == NULL) {
- CamelInternetAddress *addr = camel_internet_address_new ();
-
- camel_internet_address_add (addr, name, email);
- g_free (dest->priv->textrep);
- dest->priv->textrep = camel_address_format (CAMEL_ADDRESS (addr));
- camel_object_unref (CAMEL_OBJECT (addr));
- }
-
- if (dest->priv->textrep != NULL)
- return dest->priv->textrep;
-
- if (email)
- return email;
-
- return "";
-}
-
-gboolean
-e_destination_is_evolution_list (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
-
- if (dest->priv->list_dests == NULL
- && dest->priv->card != NULL
- && dest->priv->card->email != NULL
- && e_card_evolution_list (dest->priv->card)) {
-
- EIterator *iter = e_list_get_iterator (dest->priv->card->email);
-
- e_iterator_reset (iter);
- while (e_iterator_is_valid (iter)) {
- const char *dest_xml = (const char *) e_iterator_get (iter);
- EDestination *list_dest = e_destination_import (dest_xml);
-
- if (list_dest)
- dest->priv->list_dests = g_list_append (dest->priv->list_dests, list_dest);
- e_iterator_next (iter);
- }
- }
-
- return dest->priv->list_dests != NULL;
-}
-
-gboolean
-e_destination_list_show_addresses (const EDestination *dest)
-{
- g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
- if (dest->priv->card != NULL)
- return e_card_evolution_list_show_addresses (dest->priv->card);
-
- return dest->priv->show_addresses;
-}
-
-gboolean
-e_destination_get_html_mail_pref (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
-
- if (dest->priv->html_mail_override || dest->priv->card == NULL)
- return dest->priv->wants_html_mail;
-
- return dest->priv->card->wants_html;
-}
-
-gboolean
-e_destination_allow_cardification (const EDestination *dest)
-{
- g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
- return dest->priv->allow_cardify;
-}
-
-void
-e_destination_set_allow_cardification (EDestination *dest, gboolean x)
-{
- g_return_if_fail (E_IS_DESTINATION (dest));
-
- dest->priv->allow_cardify = x;
-}
-
-static void
-set_cardify_book (EDestination *dest, EBook *book)
-{
- if (dest->priv->cardify_book && dest->priv->cardify_book != book) {
- g_object_unref (dest->priv->cardify_book);
- }
-
- dest->priv->cardify_book = book;
-
- if (book)
- g_object_ref (book);
-}
-
-static void
-name_and_email_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure)
-{
- EDestination *dest = E_DESTINATION (closure);
-
- if (status == E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS && g_list_length ((GList *) cards) == 1) {
- ECard *card = E_CARD (cards->data);
- const char *email = e_destination_get_email (dest);
- int email_num = 0;
-
- if (e_destination_is_valid (dest) && email && *email) {
- email_num = e_card_email_find_number (card, e_destination_get_email (dest));
- }
-
- if (email_num >= 0) {
- const char *book_uri;
-
- book_uri = e_book_get_uri (book);
-
- dest->priv->has_been_cardified = TRUE;
- e_destination_set_card (dest, card, email_num);
- e_destination_set_book_uri (dest, book_uri);
- g_signal_emit (dest, e_destination_signals[CARDIFIED], 0);
- }
- }
-
- if (!dest->priv->has_been_cardified) {
- dest->priv->cannot_cardify = TRUE;
- }
-
- g_object_unref (dest); /* drop the reference held by the query */
-}
-
-
-static void
-nickname_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure)
-{
- EDestination *dest = E_DESTINATION (closure);
-
- if (status == E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS) {
- if (g_list_length ((GList *) cards) == 1) {
- const char *book_uri;
-
- book_uri = e_book_get_uri (book);
-
- dest->priv->has_been_cardified = TRUE;
- e_destination_set_card (dest, E_CARD (cards->data), 0); /* Uses primary e-mail by default. */
- e_destination_set_book_uri (dest, book_uri);
- g_signal_emit (dest, e_destination_signals[CARDIFIED], 0);
-
- g_object_unref (dest); /* drop the reference held by the query */
-
- } else {
- /* We can only end up here if we don't look at all like an e-mail address, so
- we do a name-only query on the textrep */
-
- e_book_name_and_email_query (book,
- e_destination_get_textrep (dest, FALSE),
- NULL,
- name_and_email_simple_query_cb,
- dest);
- }
- } else {
- /* Something went wrong with the query: drop our ref to the destination and return. */
- g_object_unref (dest);
- }
-}
-
-static void
-launch_cardify_query (EDestination *dest)
-{
- if (! e_destination_is_valid (dest)) {
- /* If it doesn't look like an e-mail address, see if it is a nickname. */
- e_book_nickname_query (dest->priv->cardify_book,
- e_destination_get_textrep (dest, FALSE),
- nickname_simple_query_cb,
- dest);
-
- } else {
- e_book_name_and_email_query (dest->priv->cardify_book,
- e_destination_get_name (dest),
- e_destination_get_email (dest),
- name_and_email_simple_query_cb,
- dest);
- }
-}
-
-static void
-use_default_book_cb (EBook *book, gpointer closure)
-{
- EDestination *dest = E_DESTINATION (closure);
- if (book != NULL && dest->priv->cardify_book == NULL) {
- dest->priv->cardify_book = book;
- g_object_ref (book);
- }
-
- if (dest->priv->cardify_book)
- launch_cardify_query (dest);
- else
- g_object_unref (dest);
-}
-
-
-static gboolean
-e_destination_reverting_is_a_good_idea (EDestination *dest)
-{
- const char *textrep;
- int len, old_len;
-
- g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
- if (dest->priv->old_textrep == NULL)
- return FALSE;
-
- textrep = e_destination_get_textrep (dest, FALSE);
-
- len = g_utf8_strlen (textrep, -1);
- old_len = g_utf8_strlen (dest->priv->old_textrep, -1);
-
- if (len <= old_len/2)
- return FALSE;
-
- return TRUE;
-}
-
-void
-e_destination_cardify (EDestination *dest, EBook *book)
-{
- g_return_if_fail (E_IS_DESTINATION (dest));
- g_return_if_fail (book == NULL || E_IS_BOOK (book));
-
- if (e_destination_is_evolution_list (dest))
- return;
-
- if (e_destination_contains_card (dest))
- return;
-
- if (!dest->priv->allow_cardify)
- return;
-
- if (dest->priv->cannot_cardify)
- return;
-
- e_destination_cancel_cardify (dest);
-
- /* In some cases, we can revert to the previous card. */
- if (!e_destination_is_valid (dest)
- && e_destination_reverting_is_a_good_idea (dest)
- && e_destination_revert (dest)) {
- return;
- }
-
- set_cardify_book (dest, book);
-
- /* Handle the case of an EDestination containing a card URL */
- if (e_destination_contains_card (dest)) {
- e_destination_use_card (dest, NULL, NULL);
- return;
- }
-
- /* If we have a book ready, proceed. We hold a reference to ourselves
- until our query is complete. */
- g_object_ref (dest);
- if (dest->priv->cardify_book != NULL) {
- launch_cardify_query (dest);
- } else {
- e_book_use_default_book (use_default_book_cb, dest);
- }
-}
-
-static int
-do_cardify_delayed (gpointer ptr)
-{
- EDestination *dest = E_DESTINATION (ptr);
-
- e_destination_cardify (dest, dest->priv->cardify_book);
- return FALSE;
-}
-
-void
-e_destination_cardify_delayed (EDestination *dest, EBook *book, gint delay)
-{
- g_return_if_fail (E_IS_DESTINATION (dest));
- g_return_if_fail (book == NULL || E_IS_BOOK (book));
-
- if (delay < 0)
- delay = 500;
-
- e_destination_cancel_cardify (dest);
-
- set_cardify_book (dest, book);
-
- dest->priv->pending_cardification = g_timeout_add (delay, do_cardify_delayed, dest);
-}
-
-void
-e_destination_cancel_cardify (EDestination *dest)
-{
- g_return_if_fail (E_IS_DESTINATION (dest));
-
- if (dest->priv->pending_cardification) {
- g_source_remove (dest->priv->pending_cardification);
- dest->priv->pending_cardification = 0;
- }
-}
-
-gboolean
-e_destination_uncardify (EDestination *dest)
-{
- char *email;
-
- g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
- if (!e_destination_contains_card (dest))
- return FALSE;
-
- email = g_strdup (e_destination_get_email (dest));
-
- if (email == NULL)
- return FALSE;
-
- e_destination_freeze (dest);
- e_destination_clear (dest);
- e_destination_set_raw (dest, email);
- g_free (email);
- e_destination_thaw (dest);
-
- return TRUE;
-}
-
-gboolean
-e_destination_revert (EDestination *dest)
-{
- g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
- if (dest->priv->old_card) {
- ECard *card;
- int card_email_num;
-
- card = dest->priv->old_card;
- card_email_num = dest->priv->old_card_email_num;
-
- dest->priv->old_card = NULL;
- g_free (dest->priv->old_textrep);
- dest->priv->old_textrep = NULL;
-
- e_destination_freeze (dest);
- e_destination_clear (dest);
- e_destination_set_card (dest, card, card_email_num);
- e_destination_thaw (dest);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*
- * Destination import/export
- */
-
-gchar *
-e_destination_get_address_textv (EDestination **destv)
-{
- int i, j, len = 0;
- char **strv;
- char *str;
-
- g_return_val_if_fail (destv, NULL);
-
- /* Q: Please tell me this is only for assertion
- reasons. If this is considered to be ok behavior then you
- shouldn't use g_return's. Just a reminder ;-)
-
- A: Yes, this is just an assertion. (Though it does find the
- length of the vector in the process...)
- */
- while (destv[len]) {
- g_return_val_if_fail (E_IS_DESTINATION (destv[len]), NULL);
- len++;
- }
-
- strv = g_new0 (char *, len + 1);
- for (i = 0, j = 0; destv[i]; i++) {
- if (!e_destination_is_empty (destv[i])) {
- const char *addr = e_destination_get_address (destv[i]);
- strv[j++] = addr ? (char *) addr : "";
- }
- }
-
- str = g_strjoinv (", ", strv);
-
- g_free (strv);
-
- return str;
-}
-
-xmlNodePtr
-e_destination_xml_encode (const EDestination *dest)
-{
- xmlNodePtr dest_node;
- const char *str;
-
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- dest_node = xmlNewNode (NULL, "destination");
-
- str = e_destination_get_name (dest);
- if (str)
- xmlNewTextChild (dest_node, NULL, "name", str);
-
- if (!e_destination_is_evolution_list (dest)) {
- str = e_destination_get_email (dest);
- if (str)
- xmlNewTextChild (dest_node, NULL, "email", str);
- } else {
- GList *iter = dest->priv->list_dests;
-
- while (iter) {
- EDestination *list_dest = E_DESTINATION (iter->data);
- xmlNodePtr list_node = xmlNewNode (NULL, "list_entry");
-
- str = e_destination_get_name (list_dest);
- if (str)
- xmlNewTextChild (list_node, NULL, "name", str);
-
- str = e_destination_get_email (list_dest);
- if (str)
- xmlNewTextChild (list_node, NULL, "email", str);
-
- xmlAddChild (dest_node, list_node);
-
- iter = g_list_next (iter);
- }
-
- xmlNewProp (dest_node, "is_list", "yes");
- xmlNewProp (dest_node, "show_addresses",
- e_destination_list_show_addresses (dest) ? "yes" : "no");
- }
-
- str = e_destination_get_book_uri (dest);
- if (str) {
- xmlNewTextChild (dest_node, NULL, "book_uri", str);
- }
-
- str = e_destination_get_card_uid (dest);
- if (str) {
- char buf[16];
-
- xmlNodePtr uri_node = xmlNewTextChild (dest_node, NULL, "card_uid", str);
- g_snprintf (buf, 16, "%d", e_destination_get_email_num (dest));
- xmlNewProp (uri_node, "email_num", buf);
- }
-
- xmlNewProp (dest_node, "html_mail", e_destination_get_html_mail_pref (dest) ? "yes" : "no");
-
- xmlNewProp (dest_node, "auto_recipient",
- e_destination_is_auto_recipient (dest) ? "yes" : "no");
-
- return dest_node;
-}
-
-gboolean
-e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
-{
- char *name = NULL, *email = NULL, *book_uri = NULL, *card_uid = NULL;
- gboolean is_list = FALSE, show_addr = FALSE, auto_recip = FALSE;
- gboolean html_mail = FALSE;
- GList *list_dests = NULL;
- int email_num = -1;
- char *tmp;
-
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
- g_return_val_if_fail (node != NULL, FALSE);
-
- if (strcmp (node->name, "destination"))
- return FALSE;
-
- tmp = xmlGetProp (node, "html_mail");
- if (tmp) {
- html_mail = !strcmp (tmp, "yes");
- xmlFree (tmp);
- }
-
- tmp = xmlGetProp (node, "is_list");
- if (tmp) {
- is_list = !strcmp (tmp, "yes");
- xmlFree (tmp);
- }
-
- tmp = xmlGetProp (node, "show_addresses");
- if (tmp) {
- show_addr = !strcmp (tmp, "yes");
- xmlFree (tmp);
- }
-
- tmp = xmlGetProp (node, "auto_recipient");
- if (tmp) {
- auto_recip = !strcmp (tmp, "yes");
- xmlFree (tmp);
- }
-
- node = node->xmlChildrenNode;
- while (node) {
- if (!strcmp (node->name, "name")) {
- tmp = xmlNodeGetContent (node);
- g_free (name);
- name = g_strdup (tmp);
- xmlFree (tmp);
- } else if (!is_list && !strcmp (node->name, "email")) {
- tmp = xmlNodeGetContent (node);
- g_free (email);
- email = g_strdup (tmp);
- xmlFree (tmp);
- } else if (is_list && !strcmp (node->name, "list_entry")) {
- xmlNodePtr subnode = node->xmlChildrenNode;
- char *list_name = NULL, *list_email = NULL;
-
- while (subnode) {
- if (!strcmp (subnode->name, "name")) {
- tmp = xmlNodeGetContent (subnode);
- g_free (list_name);
- list_name = g_strdup (tmp);
- xmlFree (tmp);
- } else if (!strcmp (subnode->name, "email")) {
- tmp = xmlNodeGetContent (subnode);
- g_free (list_email);
- list_email = g_strdup (tmp);
- xmlFree (tmp);
- }
-
- subnode = subnode->next;
- }
-
- if (list_name || list_email) {
- EDestination *list_dest = e_destination_new ();
-
- if (list_name)
- e_destination_set_name (list_dest, list_name);
- if (list_email)
- e_destination_set_email (list_dest, list_email);
-
- g_free (list_name);
- g_free (list_email);
-
- list_dests = g_list_append (list_dests, list_dest);
- }
- } else if (!strcmp (node->name, "book_uri")) {
- tmp = xmlNodeGetContent (node);
- g_free (book_uri);
- book_uri = g_strdup (tmp);
- xmlFree (tmp);
- } else if (!strcmp (node->name, "card_uid")) {
- tmp = xmlNodeGetContent (node);
- g_free (card_uid);
- card_uid = g_strdup (tmp);
- xmlFree (tmp);
-
- tmp = xmlGetProp (node, "email_num");
- email_num = atoi (tmp);
- xmlFree (tmp);
- }
-
- node = node->next;
- }
-
- e_destination_freeze (dest);
-
- e_destination_clear (dest);
-
- if (name) {
- e_destination_set_name (dest, name);
- g_free (name);
- }
- if (email) {
- e_destination_set_email (dest, email);
- g_free (email);
- }
- if (book_uri) {
- e_destination_set_book_uri (dest, book_uri);
- g_free (book_uri);
- }
- if (card_uid) {
- e_destination_set_card_uid (dest, card_uid, email_num);
- g_free (card_uid);
- }
- if (list_dests)
- dest->priv->list_dests = list_dests;
-
- dest->priv->html_mail_override = TRUE;
- dest->priv->wants_html_mail = html_mail;
-
- dest->priv->show_addresses = show_addr;
-
- dest->priv->auto_recipient = auto_recip;
-
- e_destination_thaw (dest);
-
- return TRUE;
-}
-
-/* FIXME: Make utf-8 safe */
-static gchar *
-null_terminate_and_remove_extra_whitespace (xmlChar *xml_in, gint size)
-{
- gboolean skip_white = FALSE;
- char *xml, *r, *w;
-
- if (xml_in == NULL || size <= 0)
- return NULL;
-
- xml = g_strndup (xml_in, size);
- r = w = xml;
-
- while (*r) {
- if (*r == '\n' || *r == '\r') {
- skip_white = TRUE;
- } else {
- gboolean is_space = isspace (*r);
-
- *w = *r;
-
- if (!(skip_white && is_space))
- w++;
- if (!is_space)
- skip_white = FALSE;
- }
- r++;
- }
-
- *w = '\0';
-
- return xml;
-}
-
-gchar *
-e_destination_export (const EDestination *dest)
-{
- xmlNodePtr dest_node;
- xmlDocPtr dest_doc;
- xmlChar *buffer = NULL;
- int size = -1;
- char *str;
-
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- dest_node = e_destination_xml_encode (dest);
- if (dest_node == NULL)
- return NULL;
-
- dest_doc = xmlNewDoc (XML_DEFAULT_VERSION);
- xmlDocSetRootElement (dest_doc, dest_node);
-
- xmlDocDumpMemory (dest_doc, &buffer, &size);
- xmlFreeDoc (dest_doc);
-
- str = null_terminate_and_remove_extra_whitespace (buffer, size);
- xmlFree (buffer);
-
- return str;
-}
-
-EDestination *
-e_destination_import (const gchar *str)
-{
- EDestination *dest = NULL;
- xmlDocPtr dest_doc;
-
- if (!(str && *str))
- return NULL;
-
- dest_doc = xmlParseMemory ((char *) str, strlen (str));
- if (dest_doc && dest_doc->xmlRootNode) {
- dest = e_destination_new ();
- if (! e_destination_xml_decode (dest, dest_doc->xmlRootNode)) {
- g_object_unref (dest);
- dest = NULL;
- }
- }
- xmlFreeDoc (dest_doc);
-
- return dest;
-}
-
-gchar *
-e_destination_exportv (EDestination **destv)
-{
- xmlDocPtr destv_doc;
- xmlNodePtr destv_node;
- xmlChar *buffer = NULL;
- int i, size = -1;
- char *str;
-
- if (destv == NULL || *destv == NULL)
- return NULL;
-
- destv_doc = xmlNewDoc (XML_DEFAULT_VERSION);
- destv_node = xmlNewNode (NULL, "destinations");
- xmlDocSetRootElement (destv_doc, destv_node);
-
- for (i = 0; destv[i]; i++) {
- if (! e_destination_is_empty (destv[i])) {
- xmlNodePtr dest_node = e_destination_xml_encode (destv[i]);
- if (dest_node)
- xmlAddChild (destv_node, dest_node);
- }
- }
-
- xmlDocDumpMemory (destv_doc, &buffer, &size);
- xmlFreeDoc (destv_doc);
-
- str = null_terminate_and_remove_extra_whitespace (buffer, size);
- xmlFree (buffer);
-
- return str;
-}
-
-EDestination **
-e_destination_importv (const gchar *str)
-{
- GPtrArray *dest_array = NULL;
- xmlDocPtr destv_doc;
- xmlNodePtr node;
- EDestination **destv = NULL;
-
- if (!(str && *str))
- return NULL;
-
- destv_doc = xmlParseMemory ((char *)str, strlen (str));
- if (destv_doc == NULL)
- return NULL;
-
- node = destv_doc->xmlRootNode;
-
- if (strcmp (node->name, "destinations"))
- goto finished;
-
- node = node->xmlChildrenNode;
-
- dest_array = g_ptr_array_new ();
-
- while (node) {
- EDestination *dest;
-
- dest = e_destination_new ();
- if (e_destination_xml_decode (dest, node) && !e_destination_is_empty (dest)) {
- g_ptr_array_add (dest_array, dest);
- } else {
- g_object_unref (dest);
- }
-
- node = node->next;
- }
-
- /* we need destv to be NULL terminated */
- g_ptr_array_add (dest_array, NULL);
-
- destv = (EDestination **) dest_array->pdata;
- g_ptr_array_free (dest_array, FALSE);
-
- finished:
- xmlFreeDoc (destv_doc);
-
- return destv;
-}
-
-EDestination **
-e_destination_list_to_vector_sized (GList *list, int n)
-{
- EDestination **destv;
- int i = 0;
-
- if (n == -1)
- n = g_list_length (list);
-
- if (n == 0)
- return NULL;
-
- destv = g_new (EDestination *, n + 1);
- while (list != NULL && i < n) {
- destv[i] = E_DESTINATION (list->data);
- list->data = NULL;
- i++;
- list = g_list_next (list);
- }
- destv[i] = NULL;
-
- return destv;
-}
-
-EDestination **
-e_destination_list_to_vector (GList *list)
-{
- return e_destination_list_to_vector_sized (list, -1);
-}
-
-void
-e_destination_freev (EDestination **destv)
-{
- int i;
-
- if (destv) {
- for (i = 0; destv[i] != NULL; ++i) {
- g_object_unref (destv[i]);
- }
- g_free (destv);
- }
-
-}
-
-static void
-touch_cb (EBook *book, const gchar *addr, ECard *card, gpointer closure)
-{
- if (book != NULL && card != NULL) {
- e_card_touch (card);
- d(g_message ("Use score for \"%s\" is now %f", addr, e_card_get_use_score (card)));
- e_book_commit_card (book, card, NULL, NULL);
- }
-}
-
-void
-e_destination_touch (EDestination *dest)
-{
- const char *email;
-
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- if (!e_destination_is_auto_recipient (dest)) {
- email = e_destination_get_email (dest);
-
- if (email)
- e_book_query_address_default (email, touch_cb, NULL);
- }
-}
-
-void
-e_destination_touchv (EDestination **destv)
-{
- int i;
-
- g_return_if_fail (destv != NULL);
-
- for (i = 0; destv[i] != NULL; ++i) {
- e_destination_touch (destv[i]);
- }
-}
diff --git a/addressbook/backend/ebook/e-vcard.c b/addressbook/backend/ebook/e-vcard.c
deleted file mode 100644
index 5207d0fefe..0000000000
--- a/addressbook/backend/ebook/e-vcard.c
+++ /dev/null
@@ -1,1383 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-vcard.c
- *
- * Copyright (C) 2003 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Chris Toshok (toshok@ximian.com)
- */
-
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include "e-vcard.h"
-
-#define CRLF "\r\n"
-
-typedef enum {
- EVC_ENCODING_RAW, /* no encoding */
- EVC_ENCODING_BASE64, /* base64 */
- EVC_ENCODING_QP /* quoted-printable */
-} EVCardEncoding;
-
-struct _EVCardPrivate {
- GList *attributes;
-};
-
-struct _EVCardAttribute {
- char *group;
- char *name;
- GList *params; /* EVCardParam */
- GList *values;
- GList *decoded_values;
- EVCardEncoding encoding;
- gboolean encoding_set;
-};
-
-struct _EVCardAttributeParam {
- char *name;
- GList *values; /* GList of char*'s*/
-};
-
-static GObjectClass *parent_class;
-
-static void _evc_base64_init(void);
-static size_t _evc_base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
-static size_t _evc_base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save);
-size_t _evc_base64_decode_simple (char *data, size_t len);
-char *_evc_base64_encode_simple (const char *data, size_t len);
-
-static void
-e_vcard_dispose (GObject *object)
-{
- EVCard *evc = E_VCARD (object);
-
- if (!evc->priv)
- return;
-
- g_list_foreach (evc->priv->attributes, (GFunc)e_vcard_attribute_free, NULL);
- g_list_free (evc->priv->attributes);
-
- g_free (evc->priv);
- evc->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_vcard_class_init (EVCardClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS(klass);
-
- parent_class = g_type_class_ref (G_TYPE_OBJECT);
-
- object_class->dispose = e_vcard_dispose;
-
- _evc_base64_init();
-}
-
-static void
-e_vcard_init (EVCard *evc)
-{
- evc->priv = g_new0 (EVCardPrivate, 1);
-}
-
-GType
-e_vcard_get_type (void)
-{
- static GType vcard_type = 0;
-
- if (!vcard_type) {
- static const GTypeInfo vcard_info = {
- sizeof (EVCardClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_vcard_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EVCard),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_vcard_init,
- };
-
- vcard_type = g_type_register_static (G_TYPE_OBJECT, "EVCard", &vcard_info, 0);
- }
-
- return vcard_type;
-}
-
-
-
-static char*
-fold_lines (char *buf)
-{
- GString *str = g_string_new ("");
- char *p = buf;
- char *next, *next2;
-
- /* we're pretty liberal with line folding here. We handle
- lines folded with \r\n<WS>... and \n\r<WS>... and
- \n<WS>... We also turn single \r's and \n's not followed by
- WS into \r\n's. */
- while (*p) {
- if (*p == '\r' || *p == '\n') {
- next = g_utf8_next_char (p);
- if (*next == '\n' || *next == '\r') {
- next2 = g_utf8_next_char (next);
- if (*next2 == ' ' || *next2 == '\t') {
- p = g_utf8_next_char (next2);
- }
- else {
- str = g_string_append (str, CRLF);
- p = g_utf8_next_char (next);
- }
- }
- else if (*next == ' ' || *next == '\t') {
- p = g_utf8_next_char (next);
- }
- else {
- str = g_string_append (str, CRLF);
- p = g_utf8_next_char (p);
- }
- }
- else {
- str = g_string_append_unichar (str, g_utf8_get_char (p));
- p = g_utf8_next_char (p);
- }
- }
-
- g_free (buf);
-
- return g_string_free (str, FALSE);
-}
-
-/* skip forward until we hit the CRLF, or \0 */
-static void
-skip_to_next_line (char **p)
-{
- char *lp;
- lp = *p;
-
- while (*lp != '\r' && *lp != '\0')
- lp = g_utf8_next_char (lp);
-
- if (*lp == '\r') {
- lp = g_utf8_next_char (lp); /* \n */
- lp = g_utf8_next_char (lp); /* start of the next line */
- }
-
- *p = lp;
-}
-
-/* skip forward until we hit a character in @s, CRLF, or \0 */
-static void
-skip_until (char **p, char *s)
-{
- /* XXX write me plz k thx */
- g_assert_not_reached();
-}
-
-static void
-read_attribute_value (EVCardAttribute *attr, char **p, gboolean quoted_printable)
-{
- char *lp = *p;
- GString *str;
-
- /* read in the value */
- str = g_string_new ("");
- while (*lp != '\r' && *lp != '\0') {
- if (*lp == '=' && quoted_printable) {
- char a, b;
- if ((a = *(++lp)) == '\0') break;
- if ((b = *(++lp)) == '\0') break;
- if (a == '\r' && b == '\n') {
- /* it was a = at the end of the line,
- * just ignore this and continue
- * parsing on the next line. yay for
- * 2 kinds of line folding
- */
- }
- else if (isalnum(a) && isalnum (b)) {
- char c;
-
- a = tolower (a);
- b = tolower (b);
-
- c = (((a>='a'?a-'a'+10:a-'0')&0x0f) << 4)
- | ((b>='a'?b-'a'+10:b-'0')&0x0f);
-
- str = g_string_append_c (str, c);
- }
- /* silently consume malformed input, and
- continue parsing */
- lp++;
- }
- else if (*lp == '\\') {
- /* convert back to the non-escaped version of
- the characters */
- lp = g_utf8_next_char(lp);
- if (*lp == '\0') {
- str = g_string_append_c (str, '\\');
- break;
- }
- switch (*lp) {
- case 'n': str = g_string_append_c (str, '\n'); break;
- case 'r': str = g_string_append_c (str, '\r'); break;
- case ';': str = g_string_append_c (str, ';'); break;
- case ',': str = g_string_append_c (str, ','); break;
- case '\\': str = g_string_append_c (str, '\\'); break;
- default:
- g_warning ("invalid escape, passing it through");
- str = g_string_append_c (str, '\\');
- str = g_string_append_unichar (str, g_utf8_get_char(lp));
- break;
- }
- lp = g_utf8_next_char(lp);
- }
- else if (*lp == ';') {
- e_vcard_attribute_add_value (attr, str->str);
- g_string_assign (str, "");
- lp = g_utf8_next_char(lp);
- }
- else {
- str = g_string_append_unichar (str, g_utf8_get_char (lp));
- lp = g_utf8_next_char(lp);
- }
- }
- if (str) {
- e_vcard_attribute_add_value (attr, str->str);
- g_string_free (str, TRUE);
- }
-
- if (*lp == '\r') {
- lp = g_utf8_next_char (lp); /* \n */
- lp = g_utf8_next_char (lp); /* start of the next line */
- }
-
- *p = lp;
-}
-
-static void
-read_attribute_params (EVCardAttribute *attr, char **p, gboolean *quoted_printable)
-{
- char *lp = *p;
- GString *str;
- EVCardAttributeParam *param = NULL;
-
- str = g_string_new ("");
- while (*lp != '\0') {
- /* accumulate until we hit the '=' or ';'. If we hit
- * a '=' the string contains the parameter name. if
- * we hit a ';' the string contains the parameter
- * value and the name is either ENCODING (if value ==
- * QUOTED-PRINTABLE) or TYPE (in any other case.)
- */
- if (*lp == '=') {
- if (str->len > 0) {
- param = e_vcard_attribute_param_new (str->str);
- g_string_assign (str, "");
- lp = g_utf8_next_char (lp);
- }
- else {
- skip_until (&lp, ":;");
- if (*lp == '\r') {
- lp = g_utf8_next_char (lp); /* \n */
- lp = g_utf8_next_char (lp); /* start of the next line */
- break;
- }
- else if (*lp == ';')
- lp = g_utf8_next_char (lp);
- }
- }
- else if (*lp == ';' || *lp == ':' || *lp == ',') {
- gboolean colon = (*lp == ':');
- gboolean comma = (*lp == ',');
-
- if (param) {
- if (str->len > 0) {
- e_vcard_attribute_param_add_value (param, str->str);
- g_string_assign (str, "");
- if (!colon)
- lp = g_utf8_next_char (lp);
- }
- else {
- /* we've got a parameter of the form:
- * PARAM=(.*,)?[:;]
- * so what we do depends on if there are already values
- * for the parameter. If there are, we just finish
- * this parameter and skip past the offending character
- * (unless it's the ':'). If there aren't values, we free
- * the parameter then skip past the character.
- */
- if (!param->values) {
- e_vcard_attribute_param_free (param);
- param = NULL;
- }
- }
-
- if (param
- && !g_ascii_strcasecmp (param->name, "encoding")
- && !g_ascii_strcasecmp (param->values->data, "quoted-printable")) {
- *quoted_printable = TRUE;
- e_vcard_attribute_param_free (param);
- param = NULL;
- }
- }
- else {
- if (str->len > 0) {
- char *param_name;
- if (!g_ascii_strcasecmp (str->str,
- "quoted-printable")) {
- param_name = NULL;
- *quoted_printable = TRUE;
- }
- else {
- param_name = "TYPE";
- }
-
- if (param_name) {
- param = e_vcard_attribute_param_new (param_name);
- e_vcard_attribute_param_add_value (param, str->str);
- }
- g_string_assign (str, "");
- if (!colon)
- lp = g_utf8_next_char (lp);
- }
- else {
- /* XXX more here */
- g_assert_not_reached ();
- }
- }
- if (param && !comma) {
- e_vcard_attribute_add_param (attr, param);
- param = NULL;
- }
- if (colon)
- break;
- }
- else if (g_unichar_isalnum (g_utf8_get_char (lp)) || *lp == '-' || *lp == '_') {
- str = g_string_append_unichar (str, g_utf8_get_char (lp));
- lp = g_utf8_next_char (lp);
- }
- else {
- g_warning ("invalid character found in parameter spec");
- g_string_assign (str, "");
- skip_until (&lp, ":;");
- }
- }
-
- if (str)
- g_string_free (str, TRUE);
-
- *p = lp;
-}
-
-/* reads an entire attribute from the input buffer, leaving p pointing
- at the start of the next line (past the \r\n) */
-static EVCardAttribute*
-read_attribute (char **p)
-{
- char *attr_group = NULL;
- char *attr_name = NULL;
- EVCardAttribute *attr = NULL;
- GString *str;
- char *lp = *p;
- gboolean is_qp = FALSE;
-
- /* first read in the group/name */
- str = g_string_new ("");
- while (*lp != '\r' && *lp != '\0') {
- if (*lp == ':' || *lp == ';') {
- if (str->len != 0) {
- /* we've got a name, break out to the value/attribute parsing */
- attr_name = g_string_free (str, FALSE);
- break;
- }
- else {
- /* a line of the form:
- * (group.)?[:;]
- *
- * since we don't have an attribute
- * name, skip to the end of the line
- * and try again.
- */
- g_string_free (str, TRUE);
- *p = lp;
- skip_to_next_line(p);
- goto lose;
- }
- }
- else if (*lp == '.') {
- if (attr_group) {
- g_warning ("extra `.' in attribute specification. ignoring extra group `%s'",
- str->str);
- g_string_free (str, TRUE);
- str = g_string_new ("");
- }
- if (str->len != 0) {
- attr_group = g_string_free (str, FALSE);
- str = g_string_new ("");
- }
- }
- else if (g_unichar_isalnum (g_utf8_get_char (lp)) || *lp == '-' || *lp == '_') {
- str = g_string_append_unichar (str, g_utf8_get_char (lp));
- }
- else {
- g_warning ("invalid character found in attribute group/name");
- g_string_free (str, TRUE);
- *p = lp;
- skip_to_next_line(p);
- goto lose;
- }
-
- lp = g_utf8_next_char(lp);
- }
-
- if (!attr_name) {
- skip_to_next_line (p);
- goto lose;
- }
-
- attr = e_vcard_attribute_new (attr_group, attr_name);
- g_free (attr_group);
- g_free (attr_name);
-
- if (*lp == ';') {
- /* skip past the ';' */
- lp = g_utf8_next_char(lp);
- read_attribute_params (attr, &lp, &is_qp);
- }
- if (*lp == ':') {
- /* skip past the ':' */
- lp = g_utf8_next_char(lp);
- read_attribute_value (attr, &lp, is_qp);
- }
-
- *p = lp;
-
- if (!attr->values)
- goto lose;
-
- return attr;
- lose:
- if (attr)
- e_vcard_attribute_free (attr);
- return NULL;
-}
-
-/* we try to be as forgiving as we possibly can here - this isn't a
- * validator. Almost nothing is considered a fatal error. We always
- * try to return *something*.
- */
-static void
-parse (EVCard *evc, const char *str)
-{
- char *buf = g_strdup (str);
- char *p, *end;
- EVCardAttribute *attr;
-
- /* first validate the string is valid utf8 */
- if (!g_utf8_validate (buf, -1, (const char **)&end)) {
- /* if the string isn't valid, we parse as much as we can from it */
- g_warning ("invalid utf8 passed to EVCard. Limping along.");
- *end = '\0';
- }
-
-#if DEBUG_FOLDING
- printf ("BEFORE FOLDING:\n");
- printf (str);
-#endif
- buf = fold_lines (buf);
-
-#if DEBUG_FOLDING
- printf ("\n\nAFTER FOLDING:\n");
- printf (buf);
-#endif
- p = buf;
-
- attr = read_attribute (&p);
- if (!attr || attr->group || g_ascii_strcasecmp (attr->name, "begin")) {
- g_warning ("vcard began without a BEGIN:VCARD\n");
- }
- if (attr)
- e_vcard_attribute_free (attr);
-
- while (*p) {
- EVCardAttribute *next_attr = read_attribute (&p);
-
- if (next_attr) {
- if (g_ascii_strcasecmp (next_attr->name, "end"))
- e_vcard_add_attribute (evc, next_attr);
- attr = next_attr;
- }
- }
-
- if (!attr || attr->group || g_ascii_strcasecmp (attr->name, "end")) {
- g_warning ("vcard ended without END:VCARD\n");
- }
-
- if (attr && !g_ascii_strcasecmp (attr->name, "end"))
- e_vcard_attribute_free (attr);
-
- g_free (buf);
-}
-
-static char*
-escape_string (const char *s)
-{
- GString *str = g_string_new ("");
- const char *p;
-
- /* Escape a string as described in RFC2426, section 5 */
- for (p = s; p && *p; p++) {
- switch (*p) {
- case '\n':
- str = g_string_append (str, "\\n");
- break;
- case '\r':
- if (*(p+1) == '\n')
- p++;
- str = g_string_append (str, "\\n");
- break;
- case ';':
- str = g_string_append (str, "\\;");
- break;
- case ',':
- str = g_string_append (str, "\\,");
- break;
- case '\\':
- str = g_string_append (str, "\\\\");
- break;
- default:
- str = g_string_append_c (str, *p);
- break;
- }
- }
-
- return g_string_free (str, FALSE);
-}
-
-#if notyet
-static char*
-unescape_string (const char *s)
-{
- GString *str = g_string_new ("");
- const char *p;
-
- /* Unescape a string as described in RFC2426, section 5 */
- for (p = s; *p; p++) {
- if (*p == '\\') {
- p++;
- if (*p == '\0') {
- str = g_string_append_c (str, '\\');
- break;
- }
- switch (*p) {
- case 'n': str = g_string_append_c (str, '\n'); break;
- case 'r': str = g_string_append_c (str, '\r'); break;
- case ';': str = g_string_append_c (str, ';'); break;
- case ',': str = g_string_append_c (str, ','); break;
- case '\\': str = g_string_append_c (str, '\\'); break;
- default:
- g_warning ("invalid escape, passing it through");
- str = g_string_append_c (str, '\\');
- str = g_string_append_unichar (str, g_utf8_get_char(p));
- break;
- }
- }
- }
-
- return g_string_free (str, FALSE);
-}
-#endif
-
-void
-e_vcard_construct (EVCard *evc, const char *str)
-{
- if (*str)
- parse (evc, str);
-}
-
-EVCard *
-e_vcard_new ()
-{
- return e_vcard_new_from_string ("");
-}
-
-EVCard *
-e_vcard_new_from_string (const char *str)
-{
- EVCard *evc;
-
- g_return_val_if_fail (str, NULL);
-
- evc = g_object_new (E_TYPE_VCARD, NULL);
-
- e_vcard_construct (evc, str);
-
- return evc;
-}
-
-static char*
-e_vcard_to_string_vcard_21 (EVCard *evc)
-{
- g_warning ("need to implement e_vcard_to_string_vcard_21");
- return g_strdup ("");
-}
-
-static char*
-e_vcard_to_string_vcard_30 (EVCard *evc)
-{
- GList *l;
- GList *v;
-
- GString *str = g_string_new ("");
-
- str = g_string_append (str, "BEGIN:vCard" CRLF);
-
- for (l = evc->priv->attributes; l; l = l->next) {
- GList *p;
- EVCardAttribute *attr = l->data;
- GString *attr_str = g_string_new ("");
- int l;
-
- /* From rfc2425, 5.8.2
- *
- * contentline = [group "."] name *(";" param) ":" value CRLF
- */
-
- if (attr->group) {
- attr_str = g_string_append (attr_str, attr->group);
- attr_str = g_string_append_c (attr_str, '.');
- }
- attr_str = g_string_append (attr_str, attr->name);
-
- /* handle the parameters */
- for (p = attr->params; p; p = p->next) {
- EVCardAttributeParam *param = p->data;
- /* 5.8.2:
- * param = param-name "=" param-value *("," param-value)
- */
- attr_str = g_string_append_c (attr_str, ';');
- attr_str = g_string_append (attr_str, param->name);
- if (param->values) {
- attr_str = g_string_append_c (attr_str, '=');
- for (v = param->values; v; v = v->next) {
- char *value = v->data;
- attr_str = g_string_append (attr_str, value);
- if (v->next)
- attr_str = g_string_append_c (attr_str, ',');
- }
- }
- }
-
- attr_str = g_string_append_c (attr_str, ':');
-
- for (v = attr->values; v; v = v->next) {
- char *value = v->data;
- char *escaped_value = NULL;
-
- escaped_value = escape_string (value);
-
- attr_str = g_string_append (attr_str, escaped_value);
- if (v->next)
- attr_str = g_string_append_c (attr_str, ';');
-
- g_free (escaped_value);
- }
-
- /* 5.8.2:
- * When generating a content line, lines longer than 75
- * characters SHOULD be folded
- */
- l = 0;
- do {
- if (attr_str->len - l > 75) {
- l += 75;
- attr_str = g_string_insert_len (attr_str, l, CRLF " ", sizeof (CRLF " ") - 1);
- }
- else
- break;
- } while (l < attr_str->len);
-
- attr_str = g_string_append (attr_str, CRLF);
-
- str = g_string_append (str, attr_str->str);
- g_string_free (attr_str, TRUE);
- }
-
- str = g_string_append (str, "END:vCard");
-
- return g_string_free (str, FALSE);
-}
-
-char*
-e_vcard_to_string (EVCard *evc, EVCardFormat format)
-{
- switch (format) {
- case EVC_FORMAT_VCARD_21:
- return e_vcard_to_string_vcard_21 (evc);
- case EVC_FORMAT_VCARD_30:
- return e_vcard_to_string_vcard_30 (evc);
- default:
- g_warning ("invalid format specifier passed to e_vcard_to_string");
- return g_strdup ("");
- }
-}
-
-void
-e_vcard_dump_structure (EVCard *evc)
-{
- GList *a;
- GList *v;
- int i;
-
- printf ("vCard\n");
- for (a = evc->priv->attributes; a; a = a->next) {
- GList *p;
- EVCardAttribute *attr = a->data;
- printf ("+-- %s\n", attr->name);
- if (attr->params) {
- printf (" +- params=\n");
-
- for (p = attr->params, i = 0; p; p = p->next, i++) {
- EVCardAttributeParam *param = p->data;
- printf (" | [%d] = %s", i,param->name);
- printf ("(");
- for (v = param->values; v; v = v->next) {
- char *value = escape_string ((char*)v->data);
- printf ("%s", value);
- if (v->next)
- printf (",");
- g_free (value);
- }
-
- printf (")\n");
- }
- }
- printf (" +- values=\n");
- for (v = attr->values, i = 0; v; v = v->next, i++) {
- printf (" [%d] = `%s'\n", i, (char*)v->data);
- }
- }
-}
-
-
-EVCardAttribute*
-e_vcard_attribute_new (const char *attr_group, const char *attr_name)
-{
- EVCardAttribute *attr = g_new0 (EVCardAttribute, 1);
-
- attr->group = g_strdup (attr_group);
- attr->name = g_strdup (attr_name);
-
- return attr;
-}
-
-void
-e_vcard_attribute_free (EVCardAttribute *attr)
-{
- g_free (attr->group);
- g_free (attr->name);
-
- e_vcard_attribute_remove_values (attr);
-
- e_vcard_attribute_remove_params (attr);
-
- g_free (attr);
-}
-
-EVCardAttribute*
-e_vcard_attribute_copy (EVCardAttribute *attr)
-{
- EVCardAttribute *a = e_vcard_attribute_new (e_vcard_attribute_get_group (attr),
- e_vcard_attribute_get_name (attr));
- GList *p;
-
- for (p = attr->values; p; p = p->next)
- e_vcard_attribute_add_value (a, p->data);
-
- for (p = attr->params; p; p = p->next)
- e_vcard_attribute_add_param (a, e_vcard_attribute_param_copy (p->data));
-
- return a;
-}
-
-void
-e_vcard_remove_attributes (EVCard *evc, const char *attr_group, const char *attr_name)
-{
- GList *attr;
-
- attr = evc->priv->attributes;
- while (attr) {
- GList *next_attr;
- EVCardAttribute *a = attr->data;
-
- next_attr = attr->next;
-
- if (((!attr_group && !a->group) || !g_ascii_strcasecmp (attr_group, a->group)) &&
- ((!attr_name && !a->name) || !g_ascii_strcasecmp (attr_name, a->name))) {
-
- /* matches, remove/delete the attribute */
- evc->priv->attributes = g_list_remove_link (evc->priv->attributes, attr);
-
- e_vcard_attribute_free (a);
- }
-
- attr = next_attr;
- }
-}
-
-void
-e_vcard_remove_attribute (EVCard *evc, EVCardAttribute *attr)
-{
- evc->priv->attributes = g_list_remove (evc->priv->attributes, attr);
- e_vcard_attribute_free (attr);
-}
-
-void
-e_vcard_add_attribute (EVCard *evc, EVCardAttribute *attr)
-{
- evc->priv->attributes = g_list_append (evc->priv->attributes, attr);
-}
-
-void
-e_vcard_add_attribute_with_value (EVCard *evcard,
- EVCardAttribute *attr, const char *value)
-{
- e_vcard_attribute_add_value (attr, value);
-
- e_vcard_add_attribute (evcard, attr);
-}
-
-void
-e_vcard_add_attribute_with_values (EVCard *evcard, EVCardAttribute *attr, ...)
-{
- va_list ap;
- char *v;
-
- va_start (ap, attr);
-
- while ((v = va_arg (ap, char*))) {
- e_vcard_attribute_add_value (attr, v);
- }
-
- va_end (ap);
-
- e_vcard_add_attribute (evcard, attr);
-}
-
-void
-e_vcard_attribute_add_value (EVCardAttribute *attr, const char *value)
-{
- attr->values = g_list_append (attr->values, g_strdup (value));
-}
-
-void
-e_vcard_attribute_add_value_decoded (EVCardAttribute *attr, const char *value, int len)
-{
- switch (attr->encoding) {
- case EVC_ENCODING_RAW:
- g_warning ("can't add_value_decoded with an attribute using RAW encoding. you must set the ENCODING parameter first");
- break;
- case EVC_ENCODING_BASE64: {
- char *b64_data = _evc_base64_encode_simple (value, len);
- GString *decoded = g_string_new_len (value, len);
-
- /* make sure the decoded list is up to date */
- e_vcard_attribute_get_values_decoded (attr);
-
- printf ("base64 encoded value: %s\n", b64_data);
- printf ("original length: %d\n", len);
-
- attr->values = g_list_append (attr->values, b64_data);
- attr->decoded_values = g_list_append (attr->decoded_values, decoded);
- break;
- }
- case EVC_ENCODING_QP:
- g_warning ("need to implement quoted printable decoding");
- break;
- }
-}
-
-void
-e_vcard_attribute_add_values (EVCardAttribute *attr,
- ...)
-{
- va_list ap;
- char *v;
-
- va_start (ap, attr);
-
- while ((v = va_arg (ap, char*))) {
- e_vcard_attribute_add_value (attr, v);
- }
-
- va_end (ap);
-}
-
-static void
-free_gstring (GString *str)
-{
- g_string_free (str, TRUE);
-}
-
-void
-e_vcard_attribute_remove_values (EVCardAttribute *attr)
-{
- g_list_foreach (attr->values, (GFunc)g_free, NULL);
- g_list_free (attr->values);
- g_list_foreach (attr->decoded_values, (GFunc)free_gstring, NULL);
- g_list_free (attr->decoded_values);
- attr->values = NULL;
-}
-
-void
-e_vcard_attribute_remove_params (EVCardAttribute *attr)
-{
- g_list_foreach (attr->params, (GFunc)e_vcard_attribute_param_free, NULL);
- g_list_free (attr->params);
- attr->params = NULL;
-}
-
-EVCardAttributeParam*
-e_vcard_attribute_param_new (const char *name)
-{
- EVCardAttributeParam *param = g_new0 (EVCardAttributeParam, 1);
- param->name = g_strdup (name);
-
- return param;
-}
-
-void
-e_vcard_attribute_param_free (EVCardAttributeParam *param)
-{
- g_free (param->name);
-
- e_vcard_attribute_param_remove_values (param);
-
- g_free (param);
-}
-
-EVCardAttributeParam*
-e_vcard_attribute_param_copy (EVCardAttributeParam *param)
-{
- EVCardAttributeParam *p = e_vcard_attribute_param_new (e_vcard_attribute_param_get_name (param));
- GList *l;
-
- for (l = param->values; l; l = l->next) {
- e_vcard_attribute_param_add_value (p, l->data);
- }
-
- return p;
-}
-
-void
-e_vcard_attribute_add_param (EVCardAttribute *attr,
- EVCardAttributeParam *param)
-{
- attr->params = g_list_append (attr->params, param);
-
- /* we handle our special encoding stuff here */
-
- if (!g_ascii_strcasecmp (param->name, EVC_ENCODING)) {
- if (attr->encoding_set) {
- g_warning ("ENCODING specified twice");
- return;
- }
-
- if (param->values && param->values->data) {
- if (!g_ascii_strcasecmp ((char*)param->values->data, "b"))
- attr->encoding = EVC_ENCODING_BASE64;
- else if (!g_ascii_strcasecmp ((char*)param->values->data, EVC_QUOTEDPRINTABLE))
- attr->encoding = EVC_ENCODING_QP;
- else {
- g_warning ("Unknown value `%s' for ENCODING parameter. values will be treated as raw",
- (char*)param->values->data);
- }
-
- attr->encoding_set = TRUE;
- }
- else {
- g_warning ("ENCODING parameter added with no value");
- }
- }
-}
-
-void
-e_vcard_attribute_param_add_value (EVCardAttributeParam *param,
- const char *value)
-{
- param->values = g_list_append (param->values, g_strdup (value));
-}
-
-void
-e_vcard_attribute_param_add_values (EVCardAttributeParam *param,
- ...)
-{
- va_list ap;
- char *v;
-
- va_start (ap, param);
-
- while ((v = va_arg (ap, char*))) {
- e_vcard_attribute_param_add_value (param, v);
- }
-
- va_end (ap);
-}
-
-void
-e_vcard_attribute_add_param_with_value (EVCardAttribute *attr,
- EVCardAttributeParam *param, const char *value)
-{
- e_vcard_attribute_param_add_value (param, value);
-
- e_vcard_attribute_add_param (attr, param);
-}
-
-void
-e_vcard_attribute_add_param_with_values (EVCardAttribute *attr,
- EVCardAttributeParam *param, ...)
-{
- va_list ap;
- char *v;
-
- va_start (ap, param);
-
- while ((v = va_arg (ap, char*))) {
- e_vcard_attribute_param_add_value (param, v);
- }
-
- va_end (ap);
-
- e_vcard_attribute_add_param (attr, param);
-}
-
-void
-e_vcard_attribute_param_remove_values (EVCardAttributeParam *param)
-{
- g_list_foreach (param->values, (GFunc)g_free, NULL);
- g_list_free (param->values);
- param->values = NULL;
-}
-
-GList*
-e_vcard_get_attributes (EVCard *evcard)
-{
- return evcard->priv->attributes;
-}
-
-const char*
-e_vcard_attribute_get_group (EVCardAttribute *attr)
-{
- return attr->group;
-}
-
-const char*
-e_vcard_attribute_get_name (EVCardAttribute *attr)
-{
- return attr->name;
-}
-
-GList*
-e_vcard_attribute_get_values (EVCardAttribute *attr)
-{
- return attr->values;
-}
-
-GList*
-e_vcard_attribute_get_values_decoded (EVCardAttribute *attr)
-{
- if (!attr->decoded_values) {
- GList *l;
- switch (attr->encoding) {
- case EVC_ENCODING_RAW:
- for (l = attr->values; l; l = l->next)
- attr->decoded_values = g_list_append (attr->decoded_values, g_string_new ((char*)l->data));
- break;
- case EVC_ENCODING_BASE64:
- for (l = attr->values; l; l = l->next) {
- char *decoded = g_strdup ((char*)l->data);
- int len = _evc_base64_decode_simple (decoded, strlen (decoded));
- attr->decoded_values = g_list_append (attr->decoded_values, g_string_new_len (decoded, len));
- g_free (decoded);
- }
- break;
- case EVC_ENCODING_QP:
- g_warning ("need to implement quoted printable decoding");
- break;
- }
- }
-
- return attr->decoded_values;
-}
-
-GList*
-e_vcard_attribute_get_params (EVCardAttribute *attr)
-{
- return attr->params;
-}
-
-const char*
-e_vcard_attribute_param_get_name (EVCardAttributeParam *param)
-{
- return param->name;
-}
-
-GList*
-e_vcard_attribute_param_get_values (EVCardAttributeParam *param)
-{
- return param->values;
-}
-
-
-
-/* encoding/decoding stuff ripped from camel-mime-utils.c */
-
-static char *_evc_base64_alphabet =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-static unsigned char _evc_base64_rank[256];
-
-static void
-_evc_base64_init(void)
-{
- int i;
-
- memset(_evc_base64_rank, 0xff, sizeof(_evc_base64_rank));
- for (i=0;i<64;i++) {
- _evc_base64_rank[(unsigned int)_evc_base64_alphabet[i]] = i;
- }
- _evc_base64_rank['='] = 0;
-}
-
-/* call this when finished encoding everything, to
- flush off the last little bit */
-static size_t
-_evc_base64_encode_close(unsigned char *in, size_t inlen, gboolean break_lines, unsigned char *out, int *state, int *save)
-{
- int c1, c2;
- unsigned char *outptr = out;
-
- if (inlen>0)
- outptr += _evc_base64_encode_step(in, inlen, break_lines, outptr, state, save);
-
- c1 = ((unsigned char *)save)[1];
- c2 = ((unsigned char *)save)[2];
-
-#if 0
- d(printf("mode = %d\nc1 = %c\nc2 = %c\n",
- (int)((char *)save)[0],
- (int)((char *)save)[1],
- (int)((char *)save)[2]));
-#endif
-
- switch (((char *)save)[0]) {
- case 2:
- outptr[2] = _evc_base64_alphabet[ ( (c2 &0x0f) << 2 ) ];
- g_assert(outptr[2] != 0);
- goto skip;
- case 1:
- outptr[2] = '=';
- skip:
- outptr[0] = _evc_base64_alphabet[ c1 >> 2 ];
- outptr[1] = _evc_base64_alphabet[ c2 >> 4 | ( (c1&0x3) << 4 )];
- outptr[3] = '=';
- outptr += 4;
- break;
- }
- if (break_lines)
- *outptr++ = '\n';
-
- *save = 0;
- *state = 0;
-
- return outptr-out;
-}
-
-/*
- performs an 'encode step', only encodes blocks of 3 characters to the
- output at a time, saves left-over state in state and save (initialise to
- 0 on first invocation).
-*/
-static size_t
-_evc_base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save)
-{
- register unsigned char *inptr, *outptr;
-
- if (len<=0)
- return 0;
-
- inptr = in;
- outptr = out;
-
-#if 0
- d(printf("we have %d chars, and %d saved chars\n", len, ((char *)save)[0]));
-#endif
-
- if (len + ((char *)save)[0] > 2) {
- unsigned char *inend = in+len-2;
- register int c1, c2, c3;
- register int already;
-
- already = *state;
-
- switch (((char *)save)[0]) {
- case 1: c1 = ((unsigned char *)save)[1]; goto skip1;
- case 2: c1 = ((unsigned char *)save)[1];
- c2 = ((unsigned char *)save)[2]; goto skip2;
- }
-
- /* yes, we jump into the loop, no i'm not going to change it, it's beautiful! */
- while (inptr < inend) {
- c1 = *inptr++;
- skip1:
- c2 = *inptr++;
- skip2:
- c3 = *inptr++;
- *outptr++ = _evc_base64_alphabet[ c1 >> 2 ];
- *outptr++ = _evc_base64_alphabet[ c2 >> 4 | ( (c1&0x3) << 4 ) ];
- *outptr++ = _evc_base64_alphabet[ ( (c2 &0x0f) << 2 ) | (c3 >> 6) ];
- *outptr++ = _evc_base64_alphabet[ c3 & 0x3f ];
- /* this is a bit ugly ... */
- if (break_lines && (++already)>=19) {
- *outptr++='\n';
- already = 0;
- }
- }
-
- ((char *)save)[0] = 0;
- len = 2-(inptr-inend);
- *state = already;
- }
-
-#if 0
- d(printf("state = %d, len = %d\n",
- (int)((char *)save)[0],
- len));
-#endif
-
- if (len>0) {
- register char *saveout;
-
- /* points to the slot for the next char to save */
- saveout = & (((char *)save)[1]) + ((char *)save)[0];
-
- /* len can only be 0 1 or 2 */
- switch(len) {
- case 2: *saveout++ = *inptr++;
- case 1: *saveout++ = *inptr++;
- }
- ((char *)save)[0]+=len;
- }
-
-#if 0
- d(printf("mode = %d\nc1 = %c\nc2 = %c\n",
- (int)((char *)save)[0],
- (int)((char *)save)[1],
- (int)((char *)save)[2]));
-#endif
-
- return outptr-out;
-}
-
-
-/**
- * base64_decode_step: decode a chunk of base64 encoded data
- * @in: input stream
- * @len: max length of data to decode
- * @out: output stream
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been decoded
- *
- * Decodes a chunk of base64 encoded data
- **/
-static size_t
-_evc_base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save)
-{
- register unsigned char *inptr, *outptr;
- unsigned char *inend, c;
- register unsigned int v;
- int i;
-
- inend = in+len;
- outptr = out;
-
- /* convert 4 base64 bytes to 3 normal bytes */
- v=*save;
- i=*state;
- inptr = in;
- while (inptr<inend) {
- c = _evc_base64_rank[*inptr++];
- if (c != 0xff) {
- v = (v<<6) | c;
- i++;
- if (i==4) {
- *outptr++ = v>>16;
- *outptr++ = v>>8;
- *outptr++ = v;
- i=0;
- }
- }
- }
-
- *save = v;
- *state = i;
-
- /* quick scan back for '=' on the end somewhere */
- /* fortunately we can drop 1 output char for each trailing = (upto 2) */
- i=2;
- while (inptr>in && i) {
- inptr--;
- if (_evc_base64_rank[*inptr] != 0xff) {
- if (*inptr == '=' && outptr>out)
- outptr--;
- i--;
- }
- }
-
- /* if i!= 0 then there is a truncation error! */
- return outptr-out;
-}
-
-char *
-_evc_base64_encode_simple (const char *data, size_t len)
-{
- unsigned char *out;
- int state = 0, outlen;
- unsigned int save = 0;
-
- out = g_malloc (len * 4 / 3 + 5);
- outlen = _evc_base64_encode_close ((unsigned char *)data, len, FALSE,
- out, &state, &save);
- out[outlen] = '\0';
- return (char *)out;
-}
-
-size_t
-_evc_base64_decode_simple (char *data, size_t len)
-{
- int state = 0;
- unsigned int save = 0;
-
- return _evc_base64_decode_step ((unsigned char *)data, len,
- (unsigned char *)data, &state, &save);
-}
diff --git a/addressbook/backend/ebook/e-vcard.h b/addressbook/backend/ebook/e-vcard.h
deleted file mode 100644
index cedc2b4c70..0000000000
--- a/addressbook/backend/ebook/e-vcard.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-vcard.h
- *
- * Copyright (C) 2003 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Chris Toshok (toshok@ximian.com)
- */
-
-#ifndef _EVCARD_H
-#define _EVCARD_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#define EVC_ADR "ADR"
-#define EVC_BDAY "BDAY"
-#define EVC_CALURI "CALURI"
-#define EVC_CATEGORIES "CATEGORIES"
-#define EVC_EMAIL "EMAIL"
-#define EVC_ENCODING "ENCODING"
-#define EVC_FBURL "FBURL"
-#define EVC_FN "FN"
-#define EVC_ICSCALENDAR "ICSCALENDAR" /* XXX should this be X-EVOLUTION-ICSCALENDAR? */
-#define EVC_LABEL "LABEL"
-#define EVC_LOGO "LOGO"
-#define EVC_MAILER "MAILER"
-#define EVC_NICKNAME "NICKNAME"
-#define EVC_N "N"
-#define EVC_NOTE "NOTE"
-#define EVC_ORG "ORG"
-#define EVC_PHOTO "PHOTO"
-#define EVC_PRODID "PRODID"
-#define EVC_QUOTEDPRINTABLE "QUOTED-PRINTABLE"
-#define EVC_REV "REV"
-#define EVC_ROLE "ROLE"
-#define EVC_TEL "TEL"
-#define EVC_TITLE "TITLE"
-#define EVC_TYPE "TYPE"
-#define EVC_UID "UID"
-#define EVC_URL "URL"
-#define EVC_VALUE "VALUE"
-#define EVC_VERSION "VERSION"
-
-#define EVC_X_AIM "X-AIM"
-#define EVC_X_ANNIVERSARY "X-EVOLUTION-ANNIVERSARY"
-#define EVC_X_ASSISTANT "X-EVOLUTION-ASSISTANT"
-#define EVC_X_BIRTHDAY "X-EVOLUTION-BIRTHDAY"
-#define EVC_X_BLOG_URL "X-EVOLUTION-BLOG-URL"
-#define EVC_X_FILE_AS "X-EVOLUTION-FILE-AS"
-#define EVC_X_ICQ "X-ICQ"
-#define EVC_X_JABBER "X-JABBER"
-#define EVC_X_LIST_SHOW_ADDRESSES "X-EVOLUTION-LIST-SHOW_ADDRESSES"
-#define EVC_X_LIST "X-EVOLUTION-LIST"
-#define EVC_X_MANAGER "X-EVOLUTION-MANAGER"
-#define EVC_X_MSN "X-MSN"
-#define EVC_X_SPOUSE "X-EVOLUTION-SPOUSE"
-#define EVC_X_WANTS_HTML "X-MOZILLA-HTML"
-#define EVC_X_WANTS_HTML "X-MOZILLA-HTML"
-#define EVC_X_YAHOO "X-YAHOO"
-
-typedef enum {
- EVC_FORMAT_VCARD_21,
- EVC_FORMAT_VCARD_30
-} EVCardFormat;
-
-#define E_TYPE_VCARD (e_vcard_get_type ())
-#define E_VCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_VCARD, EVCard))
-#define E_VCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_VCARD, EVCardClass))
-#define E_IS_VCARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_VCARD))
-#define E_IS_VCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_VCARD))
-#define E_VCARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_VCARD, EVCardClass))
-
-typedef struct _EVCard EVCard;
-typedef struct _EVCardClass EVCardClass;
-typedef struct _EVCardPrivate EVCardPrivate;
-typedef struct _EVCardAttribute EVCardAttribute;
-typedef struct _EVCardAttributeParam EVCardAttributeParam;
-
-struct _EVCard {
- GObject parent;
-
- EVCardPrivate *priv;
-};
-
-struct _EVCardClass {
- GObjectClass parent_class;
-
- /* Padding for future expansion */
- void (*_ebook_reserved0) (void);
- void (*_ebook_reserved1) (void);
- void (*_ebook_reserved2) (void);
- void (*_ebook_reserved3) (void);
- void (*_ebook_reserved4) (void);
-};
-
-GType e_vcard_get_type (void);
-
-void e_vcard_construct (EVCard *evc, const char *str);
-EVCard* e_vcard_new (void);
-EVCard* e_vcard_new_from_string (const char *str);
-
-char* e_vcard_to_string (EVCard *evc, EVCardFormat format);
-
-/* mostly for debugging */
-void e_vcard_dump_structure (EVCard *evc);
-
-
-/* attributes */
-EVCardAttribute *e_vcard_attribute_new (const char *attr_group, const char *attr_name);
-void e_vcard_attribute_free (EVCardAttribute *attr);
-EVCardAttribute *e_vcard_attribute_copy (EVCardAttribute *attr);
-void e_vcard_remove_attributes (EVCard *evcard, const char *attr_group, const char *attr_name);
-void e_vcard_remove_attribute (EVCard *evcard, EVCardAttribute *attr);
-void e_vcard_add_attribute (EVCard *evcard, EVCardAttribute *attr);
-void e_vcard_add_attribute_with_value (EVCard *evcard, EVCardAttribute *attr, const char *value);
-void e_vcard_add_attribute_with_values (EVCard *evcard, EVCardAttribute *attr, ...);
-void e_vcard_attribute_add_value (EVCardAttribute *attr, const char *value);
-void e_vcard_attribute_add_value_decoded (EVCardAttribute *attr, const char *value, int len);
-void e_vcard_attribute_add_values (EVCardAttribute *attr, ...);
-void e_vcard_attribute_remove_values (EVCardAttribute *attr);
-void e_vcard_attribute_remove_params (EVCardAttribute *attr);
-
-/* attribute parameters */
-EVCardAttributeParam* e_vcard_attribute_param_new (const char *param_name);
-void e_vcard_attribute_param_free (EVCardAttributeParam *param);
-EVCardAttributeParam* e_vcard_attribute_param_copy (EVCardAttributeParam *param);
-void e_vcard_attribute_add_param (EVCardAttribute *attr, EVCardAttributeParam *param);
-void e_vcard_attribute_add_param_with_value (EVCardAttribute *attr,
- EVCardAttributeParam *param, const char *value);
-void e_vcard_attribute_add_param_with_values (EVCardAttribute *attr,
- EVCardAttributeParam *param, ...);
-
-void e_vcard_attribute_param_add_value (EVCardAttributeParam *param,
- const char *value);
-void e_vcard_attribute_param_add_values (EVCardAttributeParam *param,
- ...);
-void e_vcard_attribute_param_remove_values (EVCardAttributeParam *param);
-
-/* EVCard* accessors. nothing returned from these functions should be
- freed by the caller. */
-GList* e_vcard_get_attributes (EVCard *evcard);
-const char* e_vcard_attribute_get_group (EVCardAttribute *attr);
-const char* e_vcard_attribute_get_name (EVCardAttribute *attr);
-GList* e_vcard_attribute_get_values (EVCardAttribute *attr); /* GList elements are of type char* */
-GList* e_vcard_attribute_get_values_decoded (EVCardAttribute *attr); /* GList elements are of type GString* */
-
-GList* e_vcard_attribute_get_params (EVCardAttribute *attr);
-const char* e_vcard_attribute_param_get_name (EVCardAttributeParam *param);
-GList* e_vcard_attribute_param_get_values (EVCardAttributeParam *param);
-
-#endif /* _EVCARD_H */
diff --git a/addressbook/backend/ebook/evolution-ldif-importer.c b/addressbook/backend/ebook/evolution-ldif-importer.c
deleted file mode 100644
index 559e591fdb..0000000000
--- a/addressbook/backend/ebook/evolution-ldif-importer.c
+++ /dev/null
@@ -1,592 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * LDIF importer. LDIF is the file format of an exported Netscape
- * addressbook.
- *
- * Framework copied from evolution-gnomecard-importer.c
- *
- * Michael M. Morrison (mmorrison@kqcorp.com)
- *
- * Multi-line value support, mailing list support, base64 support, and
- * various fixups: Chris Toshok (toshok@ximian.com)
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-
-#include <e-book.h>
-#include <e-book-util.h>
-#include <e-card-simple.h>
-#include <e-destination.h>
-
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-main.h>
-
-#include <importer/evolution-importer.h>
-#include <importer/GNOME_Evolution_Importer.h>
-
-#define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_LDIF_ImporterFactory"
-#define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_LDIF_Importer"
-
-static GHashTable *dn_card_hash;
-
-typedef struct {
- char *filename;
- GList *cardlist;
- GList *iterator;
- EBook *book;
- gboolean ready;
-} LDIFImporter;
-
-static struct {
- char *ldif_attribute;
- ECardSimpleField simple_field;
-#define FLAG_ADDRESS 0x01
- int flags;
-}
-ldif_fields[] = {
- { "cn", E_CARD_SIMPLE_FIELD_FULL_NAME },
- { "mail", E_CARD_SIMPLE_FIELD_EMAIL },
-#if 0
- { "givenname", E_CARD_SIMPLE_FIELD_GIVEN_NAME },
-#endif
- { "sn", E_CARD_SIMPLE_FIELD_FAMILY_NAME },
- { "xmozillanickname", E_CARD_SIMPLE_FIELD_NICKNAME },
- { "o", E_CARD_SIMPLE_FIELD_ORG },
- { "locality", 0, FLAG_ADDRESS},
- { "st", 0, FLAG_ADDRESS },
- { "streetaddress", 0, FLAG_ADDRESS },
- { "title", E_CARD_SIMPLE_FIELD_TITLE },
- { "postalcode", 0, FLAG_ADDRESS },
- { "countryname", 0, FLAG_ADDRESS },
- { "telephonenumber", E_CARD_SIMPLE_FIELD_PHONE_BUSINESS},
- { "homephone", E_CARD_SIMPLE_FIELD_PHONE_HOME },
- { "facsimiletelephonenumber", E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX },
- { "ou", E_CARD_SIMPLE_FIELD_ORG_UNIT },
- { "pagerphone", E_CARD_SIMPLE_FIELD_PHONE_PAGER },
- { "cellphone", E_CARD_SIMPLE_FIELD_PHONE_MOBILE },
- { "homeurl", E_CARD_SIMPLE_FIELD_URL },
- { "description", E_CARD_SIMPLE_FIELD_NOTE },
- { "xmozillausehtmlmail", E_CARD_SIMPLE_FIELD_WANTS_HTML }
-};
-static int num_ldif_fields = sizeof(ldif_fields) / sizeof (ldif_fields[0]);
-
-static unsigned char base64_rank[256] = {
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255, 62,255,255,255, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255, 0,255,255,
- 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255,
- 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-};
-
-/**
- * base64_decode_step: decode a chunk of base64 encoded data
- * @in: input stream
- * @len: max length of data to decode
- * @out: output stream
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been decoded
- *
- * Decodes a chunk of base64 encoded data
- **/
-static int
-base64_decode_step(unsigned char *in, int len, unsigned char *out, int *state, unsigned int *save)
-{
- register unsigned char *inptr, *outptr;
- unsigned char *inend, c;
- register unsigned int v;
- int i;
-
- inend = in+len;
- outptr = out;
-
- /* convert 4 base64 bytes to 3 normal bytes */
- v=*save;
- i=*state;
- inptr = in;
- while (inptr<inend) {
- c = base64_rank[*inptr++];
- if (c != 0xff) {
- v = (v<<6) | c;
- i++;
- if (i==4) {
- *outptr++ = v>>16;
- *outptr++ = v>>8;
- *outptr++ = v;
- i=0;
- }
- }
- }
-
- *save = v;
- *state = i;
-
- /* quick scan back for '=' on the end somewhere */
- /* fortunately we can drop 1 output char for each trailing = (upto 2) */
- i=2;
- while (inptr>in && i) {
- inptr--;
- if (base64_rank[*inptr] != 0xff) {
- if (*inptr == '=')
- outptr--;
- i--;
- }
- }
-
- /* if i!= 0 then there is a truncation error! */
- return outptr-out;
-}
-
-static int
-base64_decode_simple (char *data, int len)
-{
- int state = 0;
- unsigned int save = 0;
-
- return base64_decode_step ((unsigned char *)data, len,
- (unsigned char *)data, &state, &save);
-}
-
-static GString *
-getValue( char **src )
-{
- GString *dest = g_string_new("");
- char *s = *src;
- gboolean need_base64 = (*s == ':');
-
- copy_line:
- while( *s != 0 && *s != '\n' && *s != '\r' )
- dest = g_string_append_c (dest, *s++);
-
- if (*s == '\r') s++;
- if (*s == '\n') s++;
-
- /* check for continuation here */
- if (*s == ' ') {
- s++;
- goto copy_line;
- }
-
- if (need_base64) {
- int new_len;
- /* it's base64 encoded */
- dest = g_string_erase (dest, 0, 2);
- new_len = base64_decode_simple (dest->str, strlen (dest->str));
- dest = g_string_truncate (dest, new_len);
- }
-
- *src = s;
-
- return dest;
-}
-
-static gboolean
-parseLine( ECardSimple *simple, ECardDeliveryAddress *address, char **buf )
-{
- char *ptr;
- char *colon, *value;
- gboolean field_handled;
- GString *ldif_value;
-
- ptr = *buf;
-
- /* if the string is empty, return */
- if (*ptr == '\0') {
- *buf = NULL;
- return TRUE;
- }
-
- /* skip comment lines */
- if (*ptr == '#') {
- ptr = strchr (ptr, '\n');
- if (!ptr)
- *buf = NULL;
- else
- *buf = ptr + 1;
- return TRUE;
- }
-
- /* first, check for a 'continuation' line */
- if( ptr[0] == ' ' && ptr[1] != '\n' ) {
- g_warning ("unexpected continuation line");
- return FALSE;
- }
-
- colon = (char *)strchr( ptr, ':' );
- if (colon) {
- int i;
-
- *colon = 0;
- value = colon + 1;
- while ( isspace(*value) )
- value++;
-
- ldif_value = getValue(&value );
-
- field_handled = FALSE;
- for (i = 0; i < num_ldif_fields; i ++) {
- if (!g_ascii_strcasecmp (ptr, ldif_fields[i].ldif_attribute)) {
- if (ldif_fields[i].flags & FLAG_ADDRESS) {
- if (!g_ascii_strcasecmp (ptr, "locality"))
- address->city = g_strdup (ldif_value->str);
- else if (!g_ascii_strcasecmp (ptr, "countryname"))
- address->country = g_strdup (ldif_value->str);
- else if (!g_ascii_strcasecmp (ptr, "postalcode"))
- address->code = g_strdup (ldif_value->str);
- else if (!g_ascii_strcasecmp (ptr, "st"))
- address->region = g_strdup (ldif_value->str);
- else if (!g_ascii_strcasecmp (ptr, "streetaddress"))
- address->street = g_strdup (ldif_value->str);
- }
- else {
- e_card_simple_set (simple, ldif_fields[i].simple_field, ldif_value->str);
- printf ("set %s to %s\n", ptr, ldif_value->str);
- }
- field_handled = TRUE;
- break;
- }
- }
-
- /* handle objectclass/dn/member out here */
- if (!field_handled) {
- if (!g_ascii_strcasecmp (ptr, "dn"))
- g_hash_table_insert (dn_card_hash, g_strdup(ldif_value->str), simple->card);
- else if (!g_ascii_strcasecmp (ptr, "objectclass") && !g_ascii_strcasecmp (ldif_value->str, "groupofnames")) {
- e_card_simple_set (simple, E_CARD_SIMPLE_FIELD_IS_LIST, "true");
- }
- else if (!g_ascii_strcasecmp (ptr, "member")) {
- EList *email;
- g_object_get (simple->card,
- "email", &email,
- NULL);
- e_list_append (email, ldif_value->str);
- g_object_unref (email);
- }
- }
-
- /* put the colon back the way it was, just for kicks */
- *colon = ':';
-
- g_string_free (ldif_value, TRUE);
- }
- else {
- g_warning ("unrecognized entry %s", ptr);
- return FALSE;
- }
-
- *buf = value;
-
- return TRUE;
-}
-
-static ECard *
-getNextLDIFEntry( FILE *f )
-{
- ECard *card;
- ECardAddrLabel *label;
- ECardSimple *simple;
- ECardDeliveryAddress *address;
- GString *str;
- char line[1024];
- char *buf;
-
- str = g_string_new ("");
- /* read from the file until we get to a blank line (or eof) */
- while (!feof (f)) {
- if (!fgets (line, sizeof(line), f))
- break;
- if (line[0] == '\n' || (line[0] == '\r' && line[1] == '\n'))
- break;
- str = g_string_append (str, line);
- }
-
- if (strlen (str->str) == 0) {
- g_string_free (str, TRUE);
- return NULL;
- }
-
- /* now parse that entry */
- card = e_card_new ("");
- simple = e_card_simple_new (card);
- address = e_card_delivery_address_new ();
-
- buf = str->str;
- while (buf) {
- if (!parseLine (simple, address, &buf)) {
- /* parsing error */
- g_object_unref (simple);
- e_card_delivery_address_unref (address);
- return NULL;
- }
- }
-
-
- /* fill in the address */
- address->flags = E_CARD_ADDR_HOME;
-
- label = e_card_delivery_address_to_label (address);
- e_card_delivery_address_unref (address);
-
- e_card_simple_set_address (simple, E_CARD_SIMPLE_ADDRESS_ID_HOME, label);
-
- e_card_address_label_unref (label);
-
- e_card_simple_sync_card (simple);
-
- g_string_free (str, TRUE);
-
- return card;
-}
-
-static void
-add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
-{
- ECard *card = E_CARD(closure);
- char *vcard;
-
- e_card_set_id (card, id);
-
- vcard = e_card_get_vcard(card);
-
- g_print ("Saved card: %s\n", vcard);
- g_free(vcard);
-}
-
-static void
-resolve_list_card (LDIFImporter *gci, ECard *card)
-{
- EList *email;
- EIterator *email_iter;
- char *full_name;
-
- if (!e_card_evolution_list (card))
- return;
-
- g_object_get (card,
- "email", &email,
- "full_name", &full_name,
- NULL);
-
- /* set file_as to full_name so we don't later try and figure
- out a first/last name for the list. */
- if (full_name) {
- g_object_set (card,
- "file_as", full_name,
- NULL);
- g_free (full_name);
- }
-
- email_iter = e_list_get_iterator (email);
- while (e_iterator_is_valid (email_iter)) {
- const char *dn = e_iterator_get (email_iter);
- ECard *dn_card = g_hash_table_lookup (dn_card_hash, dn);
-
- /* break list chains here, since we don't support them just yet */
- if (dn_card && !e_card_evolution_list (dn_card)) {
- EDestination *dest = e_destination_new ();
- gchar *dest_xml;
- e_destination_set_card (dest, dn_card, 0); /* Hard-wired for default e-mail, since netscape only exports 1 email address */
- dest_xml = e_destination_export (dest);
- g_object_unref (dest);
- if (dest_xml) {
- e_iterator_set (email_iter, dest_xml);
- g_free (dest_xml);
- e_iterator_next (email_iter);
- }
- else {
- e_iterator_delete (email_iter);
- }
- }
- else {
- e_iterator_delete (email_iter);
- }
- }
- g_object_unref(email);
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- LDIFImporter *gci = (LDIFImporter *) closure;
- GList * list = NULL;
- GList * list_list = NULL;
- FILE * file;
- ECard *card;
-
- if(!( file = fopen( gci->filename, "r" ) )) {
- g_warning("!!!Can't open .ldif file");
- return;
- }
-
- dn_card_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- while ((card = getNextLDIFEntry (file))) {
-
- if (e_card_evolution_list (card))
- list_list = g_list_append (list_list, card);
- else
- list = g_list_append (list, card);
- }
-
- fclose( file );
-
- list = g_list_reverse( list );
- list_list = g_list_reverse (list_list);
- list = g_list_concat (list, list_list);
-
- gci->cardlist = list;
- gci->ready = TRUE;
-}
-
-static void
-ebook_open (LDIFImporter *gci, const char *uri)
-{
- gci->book = e_book_new ();
-
- if (!gci->book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- G_GNUC_FUNCTION);
- return;
- }
-
- e_book_load_address_book_by_uri (gci->book, uri, book_open_cb, gci);
-}
-
-/* EvolutionImporter methods */
-static void
-process_item_fn (EvolutionImporter *importer,
- CORBA_Object listener,
- void *closure,
- CORBA_Environment *ev)
-{
- LDIFImporter *gci = (LDIFImporter *) closure;
- ECard *card;
-
- if (gci->iterator == NULL)
- gci->iterator = gci->cardlist;
-
- if (gci->ready == FALSE) {
- GNOME_Evolution_ImporterListener_notifyResult (listener,
- GNOME_Evolution_ImporterListener_NOT_READY,
- gci->iterator ? TRUE : FALSE,
- ev);
- return;
- }
-
- if (gci->iterator == NULL) {
- GNOME_Evolution_ImporterListener_notifyResult (listener,
- GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION,
- FALSE, ev);
- return;
- }
-
- card = gci->iterator->data;
- if (e_card_evolution_list (card))
- resolve_list_card (gci, card);
- e_book_add_card (gci->book, card, add_card_cb, card);
-
- gci->iterator = gci->iterator->next;
-
- GNOME_Evolution_ImporterListener_notifyResult (listener,
- GNOME_Evolution_ImporterListener_OK,
- gci->iterator ? TRUE : FALSE,
- ev);
- if (ev->_major != CORBA_NO_EXCEPTION) {
- g_warning ("Error notifying listeners.");
- }
-
- return;
-}
-
-static char *supported_extensions[2] = {
- ".ldif", NULL
-};
-
-static gboolean
-support_format_fn (EvolutionImporter *importer,
- const char *filename,
- void *closure)
-{
- char *ext;
- int i;
-
- ext = strrchr (filename, '.');
- if (ext == NULL) {
- return FALSE;
- }
-
- for (i = 0; supported_extensions[i] != NULL; i++) {
- if (strcmp (supported_extensions[i], ext) == 0)
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-importer_destroy_cb (gpointer data,
- GObject *where_object_was)
-{
- bonobo_main_quit ();
-}
-
-static gboolean
-load_file_fn (EvolutionImporter *importer,
- const char *filename,
- const char *uri,
- const char *folder_type,
- void *closure)
-{
- LDIFImporter *gci;
-
- gci = (LDIFImporter *) closure;
- gci->filename = g_strdup (filename);
- gci->cardlist = NULL;
- gci->iterator = NULL;
- gci->ready = FALSE;
- ebook_open (gci, uri);
-
- return TRUE;
-}
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *_factory,
- const char *component_id,
- void *closure)
-{
- EvolutionImporter *importer;
- LDIFImporter *gci;
-
- if (!strcmp (component_id, COMPONENT_IID)) {
- gci = g_new (LDIFImporter, 1);
- importer = evolution_importer_new (support_format_fn, load_file_fn,
- process_item_fn, NULL, gci);
-
- g_object_weak_ref (G_OBJECT (importer),
- importer_destroy_cb, gci);
-
- return BONOBO_OBJECT (importer);
- }
- else {
- g_warning (COMPONENT_FACTORY_IID ": Don't know what to do with %s", component_id);
- return NULL;
- }
-}
-
-BONOBO_ACTIVATION_FACTORY (COMPONENT_FACTORY_IID, "Evolution LDIF Importer Factory", VERSION, factory_fn, NULL);
diff --git a/addressbook/backend/ebook/evolution-vcard-importer.c b/addressbook/backend/ebook/evolution-vcard-importer.c
deleted file mode 100644
index c01c118cae..0000000000
--- a/addressbook/backend/ebook/evolution-vcard-importer.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <bonobo/bonobo-context.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-main.h>
-
-#include <e-book.h>
-#include <e-book-util.h>
-
-#include <importer/evolution-importer.h>
-#include <importer/GNOME_Evolution_Importer.h>
-
-#include <e-util/e-path.h>
-
-#define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_ImporterFactory"
-#define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_Importer"
-
-typedef struct {
- char *filename;
- GList *cardlist;
- GList *iterator;
- EBook *book;
- gboolean ready;
-} VCardImporter;
-
-static void
-add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
-{
- ECard *card = E_CARD(closure);
- g_object_unref(card);
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- VCardImporter *gci = (VCardImporter *) closure;
-
- gci->cardlist = e_card_load_cards_from_file_with_default_charset(gci->filename, "ISO-8859-1");
- gci->ready = TRUE;
-}
-
-static void
-ebook_open (VCardImporter *gci, const char *uri)
-{
- gci->book = e_book_new ();
-
- if (!gci->book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- G_GNUC_FUNCTION);
- return;
- }
-
- e_book_load_address_book_by_uri (gci->book, uri, book_open_cb, gci);
-}
-
-/* EvolutionImporter methods */
-static void
-process_item_fn (EvolutionImporter *importer,
- CORBA_Object listener,
- void *closure,
- CORBA_Environment *ev)
-{
- VCardImporter *gci = (VCardImporter *) closure;
- ECard *card;
-
- if (gci->iterator == NULL)
- gci->iterator = gci->cardlist;
-
- if (gci->ready == FALSE) {
- GNOME_Evolution_ImporterListener_notifyResult (listener,
- GNOME_Evolution_ImporterListener_NOT_READY,
- gci->iterator ? TRUE : FALSE,
- ev);
- return;
- }
-
- if (gci->iterator == NULL) {
- GNOME_Evolution_ImporterListener_notifyResult (listener,
- GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION,
- FALSE, ev);
- return;
- }
-
- card = gci->iterator->data;
- e_book_add_card (gci->book, card, add_card_cb, card);
-
- gci->iterator = gci->iterator->next;
-
- GNOME_Evolution_ImporterListener_notifyResult (listener,
- GNOME_Evolution_ImporterListener_OK,
- gci->iterator ? TRUE : FALSE,
- ev);
- if (ev->_major != CORBA_NO_EXCEPTION) {
- g_warning ("Error notifying listeners.");
- }
-
- return;
-}
-
-static char *supported_extensions[3] = {
- ".vcf",
- ".gcrd",
- NULL
-};
-
-/* Actually check the contents of this file */
-static gboolean
-check_file_is_vcard (const char *filename)
-{
- FILE *handle;
- char line[4096];
- gboolean result;
-
- handle = fopen (filename, "r");
- if (handle == NULL) {
- g_print ("\n");
- return FALSE;
- }
-
- fgets (line, 4096, handle);
- if (line == NULL) {
- fclose (handle);
- g_print ("\n");
- return FALSE;
- }
-
- if (g_ascii_strncasecmp (line, "BEGIN:VCARD", 11) == 0) {
- result = TRUE;
- } else {
- result = FALSE;
- }
-
- fclose (handle);
- return result;
-}
-
-static gboolean
-support_format_fn (EvolutionImporter *importer,
- const char *filename,
- void *closure)
-{
- char *ext;
- int i;
-
- ext = strrchr (filename, '.');
- if (ext == NULL) {
- return check_file_is_vcard (filename);
- }
- for (i = 0; supported_extensions[i] != NULL; i++) {
- if (g_ascii_strcasecmp (supported_extensions[i], ext) == 0)
- return check_file_is_vcard (filename);
- }
-
- return FALSE;
-}
-
-static void
-importer_destroy_cb (gpointer data,
- GObject *where_object_was)
-{
- bonobo_main_quit ();
-}
-
-static gboolean
-load_file_fn (EvolutionImporter *importer,
- const char *filename,
- const char *uri,
- const char *folder_type,
- void *closure)
-{
- VCardImporter *gci;
-
- if (check_file_is_vcard (filename) == FALSE) {
- return FALSE;
- }
-
- gci = (VCardImporter *) closure;
- gci->filename = g_strdup (filename);
- gci->cardlist = NULL;
- gci->iterator = NULL;
- gci->ready = FALSE;
- ebook_open (gci, uri);
-
- return TRUE;
-}
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *_factory,
- const char *component_id,
- void *closure)
-{
- EvolutionImporter *importer;
- VCardImporter *gci;
-
- if (!strcmp (component_id, COMPONENT_IID)) {
- gci = g_new (VCardImporter, 1);
- importer = evolution_importer_new (support_format_fn, load_file_fn,
- process_item_fn, NULL, gci);
-
- g_object_weak_ref (G_OBJECT (importer),
- importer_destroy_cb, gci);
- return BONOBO_OBJECT (importer);
- }
- else {
- g_warning (COMPONENT_FACTORY_IID ": Don't know what to do with %s", component_id);
- return NULL;
- }
-}
-
-BONOBO_ACTIVATION_FACTORY (COMPONENT_FACTORY_IID, "Evolution VCard Importer Factory", VERSION, factory_fn, NULL);
diff --git a/addressbook/backend/ebook/load-gnomecard-addressbook.c b/addressbook/backend/ebook/load-gnomecard-addressbook.c
deleted file mode 100644
index f6fde225e0..0000000000
--- a/addressbook/backend/ebook/load-gnomecard-addressbook.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#include <config.h>
-#include <stdio.h>
-#include <glib.h>
-
-#include <bonobo/bonobo-i18n.h>
-#include <bonobo/bonobo-main.h>
-#include <libgnome/gnome-init.h>
-
-#include "e-book.h"
-
-static void
-add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
-{
- ECard *card = E_CARD(closure);
- char *vcard = e_card_get_vcard_assume_utf8(card);
- g_print ("Saved card: %s\n", vcard);
- g_free(vcard);
- g_object_unref(card);
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- GList *list = e_card_load_cards_from_file_with_default_charset("gnomecard.vcf", "ISO-8859-1");
- GList *iterator;
- for (iterator = list; iterator; iterator = g_list_next(iterator)) {
- ECard *card = iterator->data;
- e_book_add_card(book, card, add_card_cb, card);
- }
- g_list_free(list);
-}
-
-static gboolean
-ebook_create (gpointer data)
-{
- EBook *book;
- gchar *path, *uri;
-
- book = e_book_new ();
-
- if (!book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- G_GNUC_FUNCTION);
- return FALSE;
- }
-
-
- path = g_build_filename (g_get_home_dir (),
- "evolution/local/Contacts/addressbook.db",
- NULL);
- uri = g_strdup_printf ("file://%s", path);
- g_free (path);
-
- e_book_load_uri (book, uri, book_open_cb, NULL);
- g_free(uri);
-
-
- return FALSE;
-}
-
-int
-main (int argc, char **argv)
-{
- GnomeProgram *program;
-
- program = gnome_program_init ("load-gnomecard-addressbook", VERSION, LIBGNOME_MODULE, argc, argv,
- GNOME_PROGRAM_STANDARD_PROPERTIES,
- NULL);
-
- g_idle_add (ebook_create, NULL);
-
- bonobo_main ();
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/load-pine-addressbook.c b/addressbook/backend/ebook/load-pine-addressbook.c
deleted file mode 100644
index ece04bbdef..0000000000
--- a/addressbook/backend/ebook/load-pine-addressbook.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#include <config.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include <bonobo/bonobo-i18n.h>
-#include <bonobo/bonobo-main.h>
-#include <libgnome/gnome-init.h>
-
-#include "e-book.h"
-
-static void
-add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
-{
- ECard *card = E_CARD(closure);
- char *vcard = e_card_get_vcard_assume_utf8(card);
- g_print ("Saved card: %s\n", vcard);
- g_free(vcard);
- g_object_unref(card);
-}
-
-static void
-parse_line (EBook *book, char *line)
-{
- char **strings;
- ECardName *name;
- ECard *card;
- EList *list;
-
- card = e_card_new("");
- strings = g_strsplit(line, "\t", 3);
- if (strings[0] && strings[1] && strings[2]) {
- name = e_card_name_from_string(strings[1]);
- g_object_set(card,
- "nickname", strings[0],
- "full_name", strings[1],
- "name", name,
- NULL);
- g_object_get(card,
- "email", &list,
- NULL);
- e_list_append(list, strings[2]);
- e_book_add_card(book, card, add_card_cb, card);
- g_object_unref(list);
- }
- g_strfreev(strings);
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- FILE *fp = fopen (".addressbook", "r");
- char line[2 * 1024];
- int which = 0;
- char *lastline = NULL;
-
- if (!fp) {
- g_warning ("Can't find .addressbook");
- return;
- }
-
- while(fgets(line + which * 1024, 1024, fp)) {
- int length;
- char *thisline = line + which * 1024;
- length = strlen(thisline);
- if (thisline[length - 1] == '\n')
- line[--length] = 0;
- if (lastline && *thisline && isspace(*thisline)) {
- char *temp;
- while(*thisline && isspace(*thisline))
- thisline ++;
- temp = lastline;
- lastline = g_strdup_printf("%s%s", lastline, thisline);
- g_free(temp);
- continue;
- }
- if (lastline) {
- parse_line (book, lastline);
- g_free(lastline);
- }
- lastline = g_strdup(thisline);
- }
-
- if (lastline) {
- parse_line (book, lastline);
- g_free(lastline);
- }
-}
-
-static gboolean
-ebook_create (gpointer data)
-{
- EBook *book;
- gchar *path, *uri;
-
- book = e_book_new ();
-
- if (!book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__, G_GNUC_FUNCTION);
- return FALSE;
- }
-
-
- path = g_build_filename (g_get_home_dir (),
- "evolution/local/Contacts/addressbook.db",
- NULL);
-
- uri = g_strdup_printf ("file://%s", path);
- g_free (path);
-
- e_book_load_uri (book, uri, book_open_cb, NULL);
- g_free(uri);
-
-
- return FALSE;
-}
-
-#if 0
-static char *
-read_file (char *name)
-{
- int len;
- char buff[65536];
- char line[1024];
- FILE *f;
-
- f = fopen (name, "r");
- if (f == NULL)
- g_error ("Unable to open %s!\n", name);
-
- len = 0;
- while (fgets (line, sizeof (line), f) != NULL) {
- strcpy (buff + len, line);
- len += strlen (line);
- }
-
- fclose (f);
-
- return g_strdup (buff);
-}
-#endif
-
-int
-main (int argc, char **argv)
-{
- GnomeProgram *program;
-
- program = gnome_program_init ("load-pine-addressbook", VERSION, LIBGNOME_MODULE, argc, argv,
- GNOME_PROGRAM_STANDARD_PROPERTIES,
- NULL);
-
- g_idle_add (ebook_create, NULL);
-
- bonobo_main ();
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c
deleted file mode 100644
index 21806b0313..0000000000
--- a/addressbook/backend/ebook/test-card.c
+++ /dev/null
@@ -1,193 +0,0 @@
-#include <string.h>
-#include "e-card.h"
-#include <libgnome/gnome-init.h>
-
-#define TEST_VCARD \
-"BEGIN:VCARD\r\n" \
-"FN:Nat\r\n" \
-"N:Friedman;Nat;D;Mr.\r\n" \
-"ORG:Ximian, Inc.\r\n" \
-"TITLE:Head Geek\r\n" \
-"ROLE:Programmer/Executive\r\n" \
-"BDAY:1977-08-06\r\n" \
-"TEL;WORK:617 679 1984\r\n" \
-"TEL;CELL:123 456 7890\r\n" \
-"EMAIL;INTERNET:nat@nat.org\r\n" \
-"EMAIL;INTERNET:nat@ximian.com\r\n" \
-"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;\r\n" \
-"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA\r\n" \
-"END:VCARD\r\n" \
-"\r\n"
-
-static char *
-read_file (char *name)
-{
- int len;
- char buff[65536];
- char line[1024];
- FILE *f;
-
- f = fopen (name, "r");
- if (f == NULL)
- g_error ("Unable to open %s!\n", name);
-
- len = 0;
- while (fgets (line, sizeof (line), f) != NULL) {
- strcpy (buff + len, line);
- len += strlen (line);
- }
-
- fclose (f);
-
- return g_strdup (buff);
-}
-
-
-
-int
-main (int argc, char **argv)
-{
- char *cardstr;
- ECard *card;
-
- /* Fields */
- char *fname;
- char *org;
- char *org_unit;
- char *title;
- char *role;
- char *nickname;
- char *fburl;
- ECardName *name;
- EList *address;
- EList *phone;
- EList *email;
- EList *arbitrary;
- EIterator *iterator;
- ECardDate *bday;
-
- gnome_program_init("test-card", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- cardstr = NULL;
- if (argc == 2)
- cardstr = read_file (argv [1]);
-
- if (cardstr == NULL)
- cardstr = TEST_VCARD;
-#if 0
- {
- int i;
- for ( i = 0; i < 100000; i++ ) {
- card = e_card_new (cardstr);
-
- g_object_unref (card);
- }
- }
-#endif
- card = e_card_new_with_default_charset (cardstr, "ISO-8859-1");
- g_object_get(card,
- "full_name", &fname,
- "name", &name,
- "address", &address,
- "phone", &phone,
- "email", &email,
- "org", &org,
- "org_unit", &org_unit,
- "title", &title,
- "role", &role,
- "nickname", &nickname,
- "fburl", &fburl,
- "arbitrary", &arbitrary,
- "birth_date", &bday,
- NULL);
- if ( fname ) {
- printf("Name : %s\n", fname);
- g_free(fname);
- }
- if ( name ) {
- printf("Full Name:\n");
- if ( name->prefix )
- printf(" prefix : %s\n", name->prefix);
- if ( name->given )
- printf(" given : %s\n", name->given);
- if ( name->additional )
- printf(" additional : %s\n", name->additional);
- if ( name->family )
- printf(" family : %s\n", name->family);
- if ( name->suffix )
- printf(" suffix : %s\n", name->suffix);
- }
- if ( org ) {
- printf("Company : %s\n", org);
- }
- if ( org_unit ) {
- printf("Department : %s\n", org_unit);
- }
- if ( title ) {
- printf("Title : %s\n", title);
- }
- if ( role ) {
- printf("Profession : %s\n", role);
- }
- if ( nickname ) {
- printf("Nickname : %s\n", nickname);
- }
- if ( fburl ) {
- printf("Free Busy URL : %s\n", fburl);
- }
- if ( arbitrary ) {
- iterator = e_list_get_iterator(arbitrary);
- for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- ECardArbitrary *arbitrary = (ECardArbitrary *) e_iterator_get(iterator);
- printf("Arbitrary : %s, %s\n", arbitrary->key, arbitrary->value);
- }
- g_object_unref(iterator);
- }
- if ( bday ) {
- printf("BDay : %4d-%02d-%02d\n", bday->year, bday->month, bday->day);
- }
- if ( email ) {
- iterator = e_list_get_iterator(address);
- for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- printf("Email : %s\n", (char *) e_iterator_get(iterator));
- }
- g_object_unref(iterator);
- g_object_unref(email);
- }
- if ( phone ) {
- iterator = e_list_get_iterator(address);
- for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- ECardPhone *e_card_phone = (ECardPhone *) e_iterator_get(iterator);
- printf("Phone ; %d : %s\n", e_card_phone->flags, e_card_phone->number);
- }
- g_object_unref(iterator);
- g_object_unref(phone);
- }
- if ( address ) {
- iterator = e_list_get_iterator(address);
- for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- ECardDeliveryAddress *del_address = (ECardDeliveryAddress *) e_iterator_get(iterator);
- printf("Address ; %d:\n", del_address->flags);
- if ( del_address->po )
- printf(" Po : %s\n", del_address->po);
- if ( del_address->ext )
- printf(" Ext : %s\n", del_address->ext);
- if ( del_address->street )
- printf(" Street : %s\n", del_address->street);
- if ( del_address->city )
- printf(" City : %s\n", del_address->city);
- if ( del_address->region )
- printf(" Region : %s\n", del_address->region);
- if ( del_address->code )
- printf(" Code : %s\n", del_address->code);
- if ( del_address->country )
- printf(" Country : %s\n", del_address->country);
- }
- g_object_unref(iterator);
- g_object_unref(address);
- }
- printf("%s", e_card_get_vcard_assume_utf8(card));
- g_object_unref (card);
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/tests/.cvsignore b/addressbook/backend/ebook/tests/.cvsignore
deleted file mode 100644
index 282522db03..0000000000
--- a/addressbook/backend/ebook/tests/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/addressbook/backend/ebook/tests/Makefile.am b/addressbook/backend/ebook/tests/Makefile.am
deleted file mode 100644
index 444d692e22..0000000000
--- a/addressbook/backend/ebook/tests/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS=vcard ebook
diff --git a/addressbook/backend/ebook/tests/ebook/.cvsignore b/addressbook/backend/ebook/tests/ebook/.cvsignore
deleted file mode 100644
index 8dbec11b01..0000000000
--- a/addressbook/backend/ebook/tests/ebook/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-test-date
-test-ebook
-test-changes
-test-photo
-test-string
diff --git a/addressbook/backend/ebook/tests/ebook/Makefile.am b/addressbook/backend/ebook/tests/ebook/Makefile.am
deleted file mode 100644
index 7147690482..0000000000
--- a/addressbook/backend/ebook/tests/ebook/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-
-TEST_LIBS=$(top_builddir)/addressbook/backend/ebook/libebook.la
-
-INCLUDES=-I$(srcdir)/../../.. @EVOLUTION_ADDRESSBOOK_CFLAGS@
-
-noinst_PROGRAMS= test-changes test-date test-ebook test-photo test-string
-
-test_date_LDFLAGS=$(TEST_LIBS)
-test_ebook_LDFLAGS=$(TEST_LIBS)
-test_changes_LDFLAGS=$(TEST_LIBS)
-test_photo_LDFLAGS=$(TEST_LIBS)
-test_string_LDFLAGS=$(TEST_LIBS)
diff --git a/addressbook/backend/ebook/tests/ebook/test-changes.c b/addressbook/backend/ebook/tests/ebook/test-changes.c
deleted file mode 100644
index f1e65adaa0..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-changes.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-#define NEW_VCARD "BEGIN:VCARD\n\
-X-EVOLUTION-FILE-AS:Toshok, Chris\n\
-FN:Chris Toshok\n\
-EMAIL;INTERNET:toshok@ximian.com\n\
-ORG:Ximian, Inc.;\n\
-END:VCARD"
-
-static char file_template[]="file:///tmp/change-test-XXXXXX";
-
-int
-main (int argc, char **argv)
-{
- EBook *book;
- gboolean status;
- EContact *contact;
- GList *changes;
- GError *error = NULL;
- EBookChange *change;
-
- gnome_program_init("test-changes", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- mktemp (file_template);
-
- /* create a temp addressbook in /tmp */
- book = e_book_new ();
-
- printf ("loading addressbook\n");
- if (!e_book_load_uri (book, file_template, FALSE, &error)) {
- printf ("failed to open addressbook: `%s': %s\n", file_template, error->message);
- exit(0);
- }
-
- /* get an initial change set */
- if (!e_book_get_changes (book, "changeidtest", &changes, &error)) {
- printf ("failed to get changes: %s\n", error->message);
- exit(0);
- }
-
- /* make a change to the book */
- contact = e_contact_new_from_vcard (NEW_VCARD);
- if (!e_book_add_contact (book, contact, &error)) {
- printf ("failed to add new contact: %s\n", error->message);
- exit(0);
- }
-
- /* get another change set */
- if (!e_book_get_changes (book, "changeidtest", &changes, &error)) {
- printf ("failed to get second set of changes: %s\n", error->message);
- exit(0);
- }
-
- /* make sure that 1 change has occurred */
- if (g_list_length (changes) != 1) {
- printf ("got back %d changes, was expecting 1\n", g_list_length (changes));
- exit(0);
- }
-
- change = changes->data;
- if (change->change_type != E_BOOK_CHANGE_CARD_ADDED) {
- printf ("was expecting a CARD_ADDED change, but didn't get it.\n");
- exit(0);
- }
-
- printf ("got changed vcard back: %s\n", e_contact_get_const (change->contact, E_CONTACT_UID));
-
- e_book_free_change_list (changes);
-
-
- if (!e_book_remove (book, &error)) {
- printf ("failed to remove book; %s\n", error->message);
- exit(0);
- }
-
- g_object_unref (book);
-
- bonobo_main_quit();
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/tests/ebook/test-date.c b/addressbook/backend/ebook/tests/ebook/test-date.c
deleted file mode 100644
index afe37cf224..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-date.c
+++ /dev/null
@@ -1,36 +0,0 @@
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-int
-main (int argc, char **argv)
-{
- EContact *contact;
- EContactDate date, *dp;
-
- gnome_program_init("test-string", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- contact = e_contact_new ();
-
- date.year = 1999;
- date.month = 3;
- date.day = 3;
-
- e_contact_set (contact, E_CONTACT_BIRTH_DATE, &date);
-
- printf ("vcard = \n%s\n", e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30));
-
- dp = e_contact_get (contact, E_CONTACT_BIRTH_DATE);
-
- if (dp->year != date.year
- || dp->month != date.month
- || dp->day != date.day)
- printf ("failed\n");
- else
- printf ("passed\n");
-}
diff --git a/addressbook/backend/ebook/tests/ebook/test-ebook.c b/addressbook/backend/ebook/tests/ebook/test-ebook.c
deleted file mode 100644
index d78d9f3b6a..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-ebook.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-static void
-print_email (EContact *contact)
-{
- char *file_as = e_contact_get (contact, E_CONTACT_FILE_AS);
- GList *emails, *e;
-
- printf ("Contact: %s\n", file_as);
- printf ("Email addresses:\n");
- emails = e_contact_get (contact, E_CONTACT_EMAIL);
- for (e = emails; e; e = e->next) {
- EVCardAttribute *attr = e->data;
- GList *values = e_vcard_attribute_get_values (attr);
- printf ("\t%s\n", values && values->data ? (char*)values->data : "");
- e_vcard_attribute_free (attr);
- }
- g_list_free (emails);
-
- g_free (file_as);
-
- printf ("\n");
-}
-
-static void
-print_all_emails (EBook *book)
-{
- EBookQuery *query;
- gboolean status;
- GList *cards, *c;
-
- query = e_book_query_field_exists (E_CONTACT_FULL_NAME);
-
- status = e_book_get_contacts (book, query, &cards, NULL);
-
- e_book_query_unref (query);
-
- if (status == FALSE) {
- printf ("error %d getting card list\n", status);
- exit(0);
- }
-
- for (c = cards; c; c = c->next) {
- EContact *contact = E_CONTACT (c->data);
-
- print_email (contact);
-
- g_object_unref (contact);
- }
- g_list_free (cards);
-}
-
-static void
-print_one_email (EBook *book)
-{
- EContact *contact;
- GError *error = NULL;
-
- if (!e_book_get_contact (book, "pas-id-0002023", &contact, &error)) {
- printf ("error %d getting card: %s\n", error->code, error->message);
- g_clear_error (&error);
- return;
- }
-
- print_email (contact);
-
- g_object_unref (contact);
-}
-
-int
-main (int argc, char **argv)
-{
- EBook *book;
- gboolean status;
-
- gnome_program_init("test-ebook", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- /*
- ** the actual ebook foo
- */
-
- book = e_book_new ();
-
- printf ("loading addressbook\n");
- status = e_book_load_local_addressbook (book, NULL);
- if (status == FALSE) {
- printf ("failed to open local addressbook\n");
- exit(0);
- }
-
- printf ("printing one contact\n");
- print_one_email (book);
-
- printf ("printing all contacts\n");
- print_all_emails (book);
-
- g_object_unref (book);
-
- bonobo_main_quit();
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/tests/ebook/test-photo.c b/addressbook/backend/ebook/tests/ebook/test-photo.c
deleted file mode 100644
index cbd6817b37..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-photo.c
+++ /dev/null
@@ -1,59 +0,0 @@
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-const char *photo_data = "/9j/4AAQSkZJRgABAQEARwBHAAD//gAXQ3JlYXRlZCB3aXRo\
-IFRoZSBHSU1Q/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLC\
-McHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIy\
-MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgAMgAyAwEiAAIRAQMRAf\
-/EABsAAQACAwEBAAAAAAAAAAAAAAAHCAQFBgID/8QAMBAAAgEDAQYEBQQDAAAAAAAAAQIDAAQR\
-BQYSEyExQQdhcYEiI0JRkRQVMqFiguH/xAAaAQADAQEBAQAAAAAAAAAAAAAABAUCBgED/8QAIx\
-EAAgICAQQCAwAAAAAAAAAAAAECAwQRQRITITEUYQUiUf/aAAwDAQACEQMRAD8An+sHUtWtNKjV\
-rmQ7754cajLvjrgfbzPIdzWdVfds9pJb3XdQkMrcFZGj+HqY0bdVV9Tz/wBia+N9vbjvkaxMb5\
-E9N6SJB1HxLEEjJaWsUjD6QzSMPXdGB7E1zV74t63HINy1s4F7CWCTn77wrA0TY86jY3N1qsUk\
-6wxBxBDvYjLHkoUH4j3JP/a0V3s1CvF/QM9tKpw0THeU+TLkj8VLnmzT8y0n9FujBx5bioba/r\
-ZLWx3iPZ7RzLp95GtnqRGVTezHNjruH7/4n+67iqpq7Qi3uYWMMsNynfnE6sM8/Lr6VamFi0KM\
-epUE1Sx7XZHbI+fjxos1H0z3SlKYEjzISI2I64OKqsyu8sck2QYrmPjBvpIYg598Vauoh8VtlY\
-7JW2isoBwpPl6hGByZTyD+o6E+h7UtlVOcPHA/+PyI1Wal6Zp7vaC/06wnTTLtEeUDiKwzu4H8\
-vI9AM9Tiuctkng1Nnk1G5cOoYifB4nI/jB7VjWuoT21qPmwXUCHKlphHKvqG5N6g0/cLi/Rg88\
-FhbkbxlaUSu3kqpnn6kDzqGqbNdPB0XyK4/svZr9RVntL50GePdcKEDqzhVBx7sKtPpayppNos\
-xzKIlDHzxUFeG2zo2n2kivWhK6PpHwwoTnfk65J7kZyT9z5VYADAwKuYtfRA5zPv7tnjgUpSmR\
-EV8bq1hvbWW1uY1khlUo6MMhgeor7UoAje18FtmLe9eeQT3EXPcglkJRPbv71EWu7Dajp2o3MG\
-mlRCkjKQ30jPUe1WlrlNW0RptTleNB84DnjkD0P9VlxT4Nqck9pmn8JuFp2zo0cgCWFi2e7555\
-/NSHXLadso2m3sU0NxlV65HM+VdTW3rgwvsUpSvAFKUoAUxSlAClKUAKUpQB//2Q==";
-
-
-int
-main (int argc, char **argv)
-{
- EContact *contact;
- EContactPhoto *photo, *new_photo;
-
- gnome_program_init("test-photo", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- contact = e_contact_new ();
-
- photo = g_new (EContactPhoto, 1);
- photo->data = g_strdup (photo_data);
- photo->length = _evc_base64_decode_simple (photo->data, strlen (photo_data));
-
- /* set the photo */
- e_contact_set (contact, E_CONTACT_PHOTO, photo);
-
- /* then get the photo */
- new_photo = e_contact_get (contact, E_CONTACT_PHOTO);
-
- /* and compare */
- if (new_photo->length != photo->length)
- g_error ("photo lengths differ");
-
- if (memcmp (new_photo->data, photo->data, photo->length))
- g_error ("photo data differs");
-
- printf ("photo test passed\n");
-}
diff --git a/addressbook/backend/ebook/tests/ebook/test-string.c b/addressbook/backend/ebook/tests/ebook/test-string.c
deleted file mode 100644
index b7cdbb3720..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-string.c
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-#define TEST_ID "test-uid"
-
-int
-main (int argc, char **argv)
-{
- EContact *contact;
-
- gnome_program_init("test-string", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- contact = e_contact_new ();
-
- e_contact_set (contact, E_CONTACT_UID, TEST_ID);
-
- if (!strcmp (e_contact_get_const (contact, E_CONTACT_UID), TEST_ID))
- printf ("passed\n");
- else
- printf ("failed\n");
-}
diff --git a/addressbook/backend/ebook/tests/vcard/.cvsignore b/addressbook/backend/ebook/tests/vcard/.cvsignore
deleted file mode 100644
index 41d78c77a2..0000000000
--- a/addressbook/backend/ebook/tests/vcard/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-dump-vcard
diff --git a/addressbook/backend/ebook/tests/vcard/1.vcf b/addressbook/backend/ebook/tests/vcard/1.vcf
deleted file mode 100644
index 308144c5f1..0000000000
--- a/addressbook/backend/ebook/tests/vcard/1.vcf
+++ /dev/null
@@ -1,12 +0,0 @@
-BEGIN:vCard
-VERSION:3.0
-FN:Frank Dawson
-ORG:Lotus Development Corporation
-ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
- ;Raleigh;NC;27613-3502;U.S.A.
-TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
-TEL;TYPE=FAX,WORK:+1-919-676-9564
-EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
-EMAIL;TYPE=INTERNET:fdawson@earthlink.net
-URL:http://home.earthlink.net/~fdawson
-END:vCard
diff --git a/addressbook/backend/ebook/tests/vcard/10.vcf b/addressbook/backend/ebook/tests/vcard/10.vcf
deleted file mode 100644
index 4bccbe9ffb..0000000000
--- a/addressbook/backend/ebook/tests/vcard/10.vcf
+++ /dev/null
@@ -1,12 +0,0 @@
-BEGIN:vCard
-vCard.vCard.VERSION:3.0
-vCard.FN:Frank Dawson
-vCard.ORG:Lotus Development Corporation
-vCard.ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
- ;Raleigh;NC;27613-3502;U.S.A.
-vCard.TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
-vCard.TEL;TYPE=FAX,WORK:+1-919-676-9564
-vCard.EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
-vCard.EMAIL;TYPE=INTERNET:fdawson@earthlink.net
-vCard.URL:http://home.earthlink.net/~fdawson
-END:vCard
diff --git a/addressbook/backend/ebook/tests/vcard/2.vcf b/addressbook/backend/ebook/tests/vcard/2.vcf
deleted file mode 100644
index bdf14ea1b7..0000000000
--- a/addressbook/backend/ebook/tests/vcard/2.vcf
+++ /dev/null
@@ -1,10 +0,0 @@
-BEGIN:vCard
-VERSION:3.0
-FN:Tim Howes
-ORG:Netscape Communications Corp.
-ADR;TYPE=WORK:;;501 E. Middlefield Rd.;Mountain View;
- CA; 94043;U.S.A.
-TEL;TYPE=VOICE,MSG,WORK:+1-415-937-3419
-TEL;TYPE=FAX,WORK:+1-415-528-4164
-EMAIL;TYPE=INTERNET:howes@netscape.com
-END:vCard
diff --git a/addressbook/backend/ebook/tests/vcard/3.vcf b/addressbook/backend/ebook/tests/vcard/3.vcf
deleted file mode 100644
index 3058716959..0000000000
--- a/addressbook/backend/ebook/tests/vcard/3.vcf
+++ /dev/null
@@ -1,13 +0,0 @@
-BEGIN:VCARD
-VERSION:2.1
-X-EVOLUTION-FILE-AS:Friedman, Nat
-FN:Nat
-N:Friedman;Nat;D;Mr.
-ADR;POSTAL;WORK:P.O. Box 101;;;Any Town;CA;91921-1234
-TEL;WORK:617 679 1984
-TEL;CELL:123 456 7890
-EMAIL;INTERNET:nat@nat.org
-EMAIL;INTERNET:nat@ximian.com
-BDAY:1977-08-06
-UID:pas-id-3E65886900000002
-END:VCARD
diff --git a/addressbook/backend/ebook/tests/vcard/4.vcf b/addressbook/backend/ebook/tests/vcard/4.vcf
deleted file mode 100644
index 46878f753b..0000000000
--- a/addressbook/backend/ebook/tests/vcard/4.vcf
+++ /dev/null
@@ -1,11 +0,0 @@
-BEGIN:VCARD
-VERSION:2.1
-X-EVOLUTION-FILE-AS:address, canada
-FN:canada address
-N:address;canada
-ADR;WORK:;;92 Main St. N.;Newmarket;ON;L3Y 4A1;Canada
-ADR;HOME;PREF:;;92 Main St. N.;Newmarket;ON;L3Y 4A1;Canada
-LABEL;QUOTED-PRINTABLE;WORK:92 Main St. N.=0ANewmarket, ON L3Y 4A1=0ACanada
-LABEL;QUOTED-PRINTABLE;HOME;PREF:92 Main St. N.=0ANewmarket, ON L3Y 4A1=0ACanada
-UID:pas-id-3E84C16E00000001
-END:VCARD
diff --git a/addressbook/backend/ebook/tests/vcard/5.vcf b/addressbook/backend/ebook/tests/vcard/5.vcf
deleted file mode 100644
index 51bbe207a6..0000000000
--- a/addressbook/backend/ebook/tests/vcard/5.vcf
+++ /dev/null
@@ -1,32 +0,0 @@
-BEGIN:VCARD
-VERSION:2.1
-X-EVOLUTION-FILE-AS;CHARSET=UTF-8;QUOTED-PRINTABLE:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7
-FN;CHARSET=UTF-8;QUOTED-PRINTABLE:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7
-N;CHARSET=UTF-8:;å城目管ç†å¤§åž‹çŸ¥åº§
-ADR;WORK;PREF;QUOTED-PRINTABLE;CHARSET=UTF-8:;=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=
-=9F=A5=E5=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=
-=9E=8B=E7=9F=A5=E5=BA=A7;=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7
-LABEL;CHARSET=UTF-8;QUOTED-PRINTABLE;WORK;PREF:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=
-=9F=A5=E5=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=
-=9E=8B=E7=9F=A5=E5=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=
-=A4=A7=E5=9E=8B=E7=9F=A5=E5=BA=A7
-TEL;CHARSET=UTF-8;QUOTED-PRINTABLE;WORK;VOICE:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7
-TEL;CHARSET=UTF-8;QUOTED-PRINTABLE;WORK;FAX:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7
-TEL;CHARSET=UTF-8;QUOTED-PRINTABLE;HOME:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7
-TEL;CHARSET=UTF-8;QUOTED-PRINTABLE;CELL:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7
-EMAIL;INTERNET:weird@weird.com
-ORG;CHARSET=UTF-8:å城目管ç†å¤§åž‹çŸ¥åº§
-TITLE;CHARSET=UTF-8;QUOTED-PRINTABLE:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
-=BA=A7
-UID:pas-id-3E52FE2E00000000
-END:VCARD
-
diff --git a/addressbook/backend/ebook/tests/vcard/6.vcf b/addressbook/backend/ebook/tests/vcard/6.vcf
deleted file mode 100644
index e5e8310eb3..0000000000
--- a/addressbook/backend/ebook/tests/vcard/6.vcf
+++ /dev/null
@@ -1,12 +0,0 @@
-BEGIN:vCard
-VERSION:3.0
-FN:Frank Dawson
-ORG:Lotus Development Corporation
-ADR;TYPE=WORK,:;;6544 Battleford Drive
- ;Raleigh;NC;27613-3502;U.S.A.
-TEL;TYPE=VOICE;MSG,WORK:+1-919-676-9515
-TEL;FAX,WORK:+1-919-676-9564
-EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
-EMAIL;TYPE=INTERNET:fdawson@earthlink.net
-URL:http://home.earthlink.net/~fdawson
-END:vCard
diff --git a/addressbook/backend/ebook/tests/vcard/7.vcf b/addressbook/backend/ebook/tests/vcard/7.vcf
deleted file mode 100644
index fb88173032..0000000000
--- a/addressbook/backend/ebook/tests/vcard/7.vcf
+++ /dev/null
@@ -1,11 +0,0 @@
-VERSION:3.0
-FN:Frank Dawson
-ORG:Lotus Development Corporation
-ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
- ;Raleigh;NC;27613-3502;U.S.A.
-TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
-TEL;TYPE=FAX,WORK:+1-919-676-9564
-EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
-EMAIL;TYPE=INTERNET:fdawson@earthlink.net
-URL:http://home.earthlink.net/~fdawson
-END:vCard
diff --git a/addressbook/backend/ebook/tests/vcard/8.vcf b/addressbook/backend/ebook/tests/vcard/8.vcf
deleted file mode 100644
index 172d1d2c68..0000000000
--- a/addressbook/backend/ebook/tests/vcard/8.vcf
+++ /dev/null
@@ -1,11 +0,0 @@
-BEGIN:vCard
-VERSION:3.0
-FN:Frank Dawson
-ORG:Lotus Development Corporation
-ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
- ;Raleigh;NC;27613-3502;U.S.A.
-TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
-TEL;TYPE=FAX,WORK:+1-919-676-9564
-EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
-EMAIL;TYPE=INTERNET:fdawson@earthlink.net
-URL:http://home.earthlink.net/~fdawson
diff --git a/addressbook/backend/ebook/tests/vcard/9.vcf b/addressbook/backend/ebook/tests/vcard/9.vcf
deleted file mode 100644
index 7043ab8c13..0000000000
--- a/addressbook/backend/ebook/tests/vcard/9.vcf
+++ /dev/null
@@ -1,9 +0,0 @@
-BEGIN:vCard
-VERSION:3.0
-FN:Frank Dawson
-ORG:Lotus Development Corporation
-ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
- ;Raleigh;NC;27613-3502;U.S.A.
-TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
-TEL;TYPE=FAX,WORK:+1-919-676-9564
-E
diff --git a/addressbook/backend/ebook/tests/vcard/Makefile.am b/addressbook/backend/ebook/tests/vcard/Makefile.am
deleted file mode 100644
index 7e57329e1d..0000000000
--- a/addressbook/backend/ebook/tests/vcard/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-
-TEST_LIBS=$(top_builddir)/addressbook/backend/ebook/libebook.la
-
-INCLUDES=-I$(srcdir)/../../.. @EVOLUTION_ADDRESSBOOK_CFLAGS@
-
-noinst_PROGRAMS=dump-vcard
-
-dump_vcard_LDFLAGS=$(TEST_LIBS)
diff --git a/addressbook/backend/ebook/tests/vcard/README b/addressbook/backend/ebook/tests/vcard/README
deleted file mode 100644
index 06ae719c5e..0000000000
--- a/addressbook/backend/ebook/tests/vcard/README
+++ /dev/null
@@ -1,41 +0,0 @@
-This is the list of tests I've been using while writing e-vcard.c.
-The parser is all handcrafted, and it's not a validating parser by any
-stretch of the imagination. It tries very hard to deal with any
-possible input (it'll even parse rfc822 mail headers and spit out
-vCard-ish results.)
-
-Test : Description
-----------------------
-
-1.vcf : Frank Dawson's vCard from RFC 2426 (missing the required N
- attribute.)
-
-2.vcf : Tim Howes's vCard from from RFC 2426 (missing the required N
- attribute.)
-
-3.vcf : Nat's old vCard.
-
-4.vcf : A vCard containing a canadian address (quoted-printable
- encoded attribute values.)
-
-5.vcf : A vCard containing utf8 characters quoted-printable encoded.
-
-6.vcf : A vCard with several errors in attribute parameters:
- line 5: an missing parameter value (a , with nothing after it).
- line 6: a missing parameter name when using multiple
- values. (this may not be in violation of the rfc.)
- line 7: a missing parameter name when using multiple
- values. (this may not be in violation of the rfc.)
-
-7.vcf : A vCard missing its begin:vcard attribute, as well as missing
- the required N attribute.
-
-8.vcf : A vCard missing its end: vcard attribute, as well as missing
- the required N attribute.
-
-9.vcf : A vCard that ends (\0) in the middle of an attribute
- name/group.
-
-10.vcf : A vCard with an attribute with more than 1 group specified.
-
-----------------------
diff --git a/addressbook/backend/ebook/tests/vcard/dump-vcard.c b/addressbook/backend/ebook/tests/vcard/dump-vcard.c
deleted file mode 100644
index 907a00efa7..0000000000
--- a/addressbook/backend/ebook/tests/vcard/dump-vcard.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <stdio.h>
-#include "ebook/e-vcard.h"
-
-FILE *fp;
-
-int
-main(int argc, char **argv)
-{
- EVCard *vcard;
- GString *str = g_string_new ("");
-
- if (argc < 2)
- return 0;
-
- g_type_init_with_debug_flags (G_TYPE_DEBUG_OBJECTS);
-
- fp = fopen (argv[1], "r");
-
- while (!feof (fp)) {
- char buf[1024];
- if (fgets (buf, sizeof(buf), fp))
- str = g_string_append (str, buf);
- }
-
- vcard = e_vcard_new_from_string (str->str);
-
- e_vcard_dump_structure (vcard);
-
- return 0;
-}
diff --git a/addressbook/backend/idl/.cvsignore b/addressbook/backend/idl/.cvsignore
deleted file mode 100644
index 09980ae6ba..0000000000
--- a/addressbook/backend/idl/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
diff --git a/addressbook/backend/idl/Makefile.am b/addressbook/backend/idl/Makefile.am
deleted file mode 100644
index e9f011975b..0000000000
--- a/addressbook/backend/idl/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-idl_DATA = \
- addressbook.idl
-
-EXTRA_DIST = $(idl_DATA)
diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl
deleted file mode 100644
index 193d1246ab..0000000000
--- a/addressbook/backend/idl/addressbook.idl
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <Bonobo.idl>
-
-module GNOME {
-module Evolution {
-module Addressbook {
- typedef string ContactId;
- typedef string VCard;
- typedef sequence<VCard> VCardList;
- typedef sequence<ContactId> ContactIdList;
- typedef sequence<string> stringlist;
-
- enum BookChangeType {
- ContactAdded,
- ContactModified,
- ContactDeleted
- };
-
- struct BookChangeItem {
- BookChangeType changeType;
- VCard vcard;
- };
-
- typedef sequence<BookChangeItem> BookChangeList;
-
- enum CallStatus {
- Success,
- RepositoryOffline,
- PermissionDenied,
- ContactNotFound,
- ContactIdAlreadyExists,
- AuthenticationFailed,
- AuthenticationRequired,
- UnsupportedField,
- UnsupportedAuthenticationMethod,
- TLSNotAvailable,
- NoSuchBook,
- BookRemoved,
-
- /* These can be returned for successful searches, but
- indicate the result set was truncated */
- SearchSizeLimitExceeded,
- SearchTimeLimitExceeded,
-
- InvalidQuery,
- QueryRefused,
-
- CouldNotCancel,
-
- OtherError
- };
-
- /*
- * A book view is a live view of a book. It's either a view
- * of all the contacts in the book or a view of a query. When
- * created, it will get a series of notifyContactsAdded calls
- * for all objects in the initial set. After that, it will
- * get added, removed, or changed signals whenever the book
- * changes (if it affects the set of viewed contacts.)
- */
- interface BookViewListener : Bonobo::Unknown {
- oneway void notifyContactsAdded (in VCardList vcards);
- oneway void notifyContactsRemoved (in ContactIdList ids);
- oneway void notifyContactsChanged (in VCardList vcards);
- oneway void notifySequenceComplete (in CallStatus status);
- oneway void notifyProgress (in string message, in short percent);
- };
-
- interface BookView : Bonobo::Unknown {
- oneway void start ();
- oneway void stop ();
- };
-
- interface Book : Bonobo::Unknown {
-
- /*
- * Opening/creating addressbooks.
- */
- oneway void open (in boolean only_if_exists);
-
- /*
- * Removing addressbooks.
- */
- oneway void remove ();
-
- /*
- * Fetching contacts in the addresbook.
- */
- oneway void getContact (in ContactId id);
-
- oneway void authenticateUser (in string user, in string passwd,
- in string authMethod);
-
- /*
- * Adding and deleting contacts in the book.
- */
- oneway void addContact (in VCard vcard);
- oneway void removeContacts (in ContactIdList Id);
-
- /*
- * Modifying contacts in the addressbook.
- */
- oneway void modifyContact (in VCard vcard);
-
- /*
- * These two functions return a book view to the book
- * listener. This is for people who want a live view
- * of the addressbook.
- */
- oneway void getBookView (in BookViewListener listener, in string query,
- in stringlist requested_fields, in long max_results);
-
- oneway void getChanges (in string change_id);
-
- oneway void getContactList (in string query);
-
- oneway void getSupportedFields ();
-
- /*
- * This function returns a list of strings
- * representing the auth methods (e.g. SASL mechs)
- * that a backend/server supports.
- *
- * Some examples are:
- *
- * "ldap/simple-email|By email Address"
- * "sasl/CRAM-MD5|CRAM-MD5(SASL)"
- *
- * The format should be:
- *
- * <class>/<type>|<i18nized string>
- *
- * "i18nized string" is shown in the UI, and should be
- * a user friendly representation of the auth method.
- *
- * in the case of SASL auth mechs, the text trailing
- * the '/' should be the proper name of the mechanism,
- * as it will be passed unchanged to the backend auth
- * function (eg. ldap_sasl_bind)
- */
- oneway void getSupportedAuthMethods ();
-
- string getStaticCapabilities ();
-
- string getName ();
-
- /* cancels the currently running operation, whatever
- it is. */
- CallStatus cancelOperation ();
- };
-
- interface BookListener : Bonobo::Unknown {
-
- oneway void notifyContactCreated (in CallStatus status, in ContactId Id);
- oneway void notifyContactsRemoved (in CallStatus status);
- oneway void notifyContactModified (in CallStatus status);
- oneway void notifyProgress (in string status_message, in short precent);
- oneway void notifyBookOpened (in CallStatus status);
- oneway void notifyBookRemoved (in CallStatus status);
- oneway void notifyViewRequested (in CallStatus status, in BookView view);
- oneway void notifyChangesRequested (in CallStatus status, in BookChangeList changes);
- oneway void notifyContactRequested (in CallStatus status, in VCard vcard);
- oneway void notifyContactListRequested (in CallStatus status, in stringlist contacts);
- oneway void notifySupportedFields (in CallStatus status, in stringlist fields);
- oneway void notifyAuthenticationResult (in CallStatus status);
- oneway void notifySupportedAuthMethods (in CallStatus status, in stringlist auth_methods);
-
- oneway void notifyWritable (in boolean writable);
- };
-
- interface BookFactory : Bonobo::Unknown {
- exception ProtocolNotSupported {};
-
- Book getBook (in string uri, in BookListener listener)
- raises (ProtocolNotSupported);
- };
-};
-};
-};
diff --git a/addressbook/backend/pas/.cvsignore b/addressbook/backend/pas/.cvsignore
deleted file mode 100644
index 6eb58802ec..0000000000
--- a/addressbook/backend/pas/.cvsignore
+++ /dev/null
@@ -1,13 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-addressbook-stubs.c
-addressbook-skels.c
-addressbook-common.c
-addressbook.h
-*.lo
-*.la
-pas-marshal.c
-pas-marshal.h \ No newline at end of file
diff --git a/addressbook/backend/pas/Makefile.am b/addressbook/backend/pas/Makefile.am
deleted file mode 100644
index 269bb8656f..0000000000
--- a/addressbook/backend/pas/Makefile.am
+++ /dev/null
@@ -1,109 +0,0 @@
-CORBA_SOURCE_H = addressbook.h
-
-CORBA_SOURCE_C = \
- addressbook-common.c \
- addressbook-stubs.c \
- addressbook-skels.c
-
-CORBA_SOURCE = $(CORBA_SOURCE_H) $(CORBA_SOURCE_C)
-
-idls = \
- $(srcdir)/../idl/addressbook.idl
-
-$(CORBA_SOURCE_H): $(idls)
- $(ORBIT_IDL) $(IDL_INCLUDES) -I $(srcdir) $(srcdir)/../idl/addressbook.idl
-
-$(CORBA_SOURCE_C): $(CORBA_SOURCE_H)
-
-
-INCLUDES = \
- $(DB3_CFLAGS) \
- $(LDAP_CFLAGS) \
- -DG_LOG_DOMAIN=\"wombat-pas\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
- -DG_DISABLE_DEPRECATED \
- -DLIBGNOME_DISABLE_DEPRECATED \
- $(EVOLUTION_ADDRESSBOOK_CFLAGS)
-
-LDAP_SCHEMA = \
- evolutionperson.schema
-
-LDAP_BACKEND_FILES = \
- pas-backend-ldap.c \
- pas-backend-ldap.h
-
-if ENABLE_LDAP
-LDAP_BACKEND = libpasldap.la
-endif
-
-ldapschemadir = $(privdatadir)
-ldapschema_DATA= $(LDAP_SCHEMA)
-
-privlib_LTLIBRARIES = libpas.la
-noinst_LTLIBRARIES = libpasfile.la libpasvcf.la $(LDAP_BACKEND)
-
-pasincludedir = $(privincludedir)/pas
-
-pasinclude_HEADERS = \
- $(CORBA_SOURCE_H) \
- pas-book-factory.h \
- pas-book-view.h \
- pas-book.h \
- pas-backend-card-sexp.h \
- pas-backend.h \
- pas-backend-summary.h \
- pas-backend-sync.h \
- pas-types.h
-
-libpas_la_SOURCES = \
- $(pasinclude_HEADERS) \
- $(CORBA_SOURCE_C) \
- pas-book-factory.c \
- pas-book-view.c \
- pas-book.c \
- pas-backend-card-sexp.c \
- pas-backend.c \
- pas-backend-summary.c \
- pas-backend-sync.c \
- pas-marshal.c \
- ximian-vcard.h
-
-libpas_la_LIBADD = \
- $(top_builddir)/addressbook/backend/ebook/libebook.la
-
-libpasfile_la_SOURCES = \
- pas-backend-file.c \
- pas-backend-file.h
-
-libpasfile_la_LIBADD = \
- libpas.la \
- $(top_builddir)/e-util/libedb3util.la
-
-libpasvcf_la_SOURCES = \
- pas-backend-vcf.c \
- pas-backend-vcf.h
-
-libpasvcf_la_LIBADD = \
- libpas.la
-
-if ENABLE_LDAP
-libpasldap_la_SOURCES = \
- $(LDAP_BACKEND_FILES)
-
-libpasldap_la_LIBADD = \
- libpas.la \
- $(LDAP_LIBS)
-endif
-
-MARSHAL_GENERATED = pas-marshal.c pas-marshal.h
-@EVO_MARSHAL_RULE@
-
-BUILT_SOURCES = $(CORBA_SOURCE) $(MARSHAL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
-
-EXTRA_DIST = $(LDAP_BACKEND_FILES) $(LDAP_SCHEMA) pas-marshal.list
diff --git a/addressbook/backend/pas/TODO b/addressbook/backend/pas/TODO
deleted file mode 100644
index 0c77c1b200..0000000000
--- a/addressbook/backend/pas/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-* Implement pas_book_factory_activate
-* Authentication \ No newline at end of file
diff --git a/addressbook/backend/pas/evolutionperson.schema b/addressbook/backend/pas/evolutionperson.schema
deleted file mode 100644
index cc32a96262..0000000000
--- a/addressbook/backend/pas/evolutionperson.schema
+++ /dev/null
@@ -1,212 +0,0 @@
-#
-# Depends upon
-# Definition of an X.500 Attribute Type and an Object Class to Hold
-# Uniform Resource Identifiers (URIs) [RFC2079]
-# (core.schema)
-#
-# A Summary of the X.500(96) User Schema for use with LDAPv3 [RFC2256]
-# (core.schema)
-#
-# The COSINE and Internet X.500 Schema [RFC1274] (cosine.schema)
-#
-# The Internet Organizational Person Schema (inetorgperson)
-#
-# OIDs are broken up into the following:
-# 1.3.6.1.4.1.8506.1.?
-# .1 Syntaxes
-# .2 Attributes
-# .3 Objectclasses
-
-# primaryPhone
-attributetype ( 1.3.6.1.4.1.8506.1.2.1
- NAME 'primaryPhone'
- DESC 'preferred phone number used to contact a person'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
- SINGLE-VALUE )
-
-# carPhone
-attributetype ( 1.3.6.1.4.1.8506.1.2.2
- NAME 'carPhone'
- DESC 'car phone telephone number of the person'
- EQUALITY telephoneNumberMatch
- SUBSTR telephoneNumberSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.50
- SINGLE-VALUE )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.3
- NAME ( 'homeFacsimileTelephoneNumber' 'homeFax' )
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.22 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.4
- NAME 'otherPhone'
- EQUALITY telephoneNumberMatch
- SUBSTR telephoneNumberSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.5
- NAME 'businessRole'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.6
- NAME 'managerName'
- SUP name )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.7
- NAME 'assistantName'
- SUP name )
-
-# spouseName
-# single valued (/me smirks)
-attributetype ( 1.3.6.1.4.1.8506.1.2.8
- NAME 'spouseName'
- SUP name
- SINGLE-VALUE )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.9
- NAME 'otherPostalAddress'
- EQUALITY caseIgnoreListMatch
- SUBSTR caseIgnoreListSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.10
- NAME ( 'mailer' 'mua' )
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32} )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.11
- NAME ( 'birthDate' 'dob' )
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.12
- NAME 'anniversary'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.13
- NAME 'note'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.14
- NAME 'evolutionArbitrary'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{4096} )
- )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.15
- NAME 'fileAs'
- SUP name )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.16
- NAME 'assistantPhone'
- EQUALITY telephoneNumberMatch
- SUBSTR telephoneNumberSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.17
- NAME 'companyPhone'
- EQUALITY telephoneNumberMatch
- SUBSTR telephoneNumberSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.18
- NAME 'callbackPhone'
- EQUALITY telephoneNumberMatch
- SUBSTR telephoneNumberSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.19
- NAME ( 'otherFacsimileTelephoneNumber' 'otherFax' )
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.22 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.20
- NAME 'radio'
- EQUALITY telephoneNumberMatch
- SUBSTR telephoneNumberSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.21
- NAME 'telex'
- EQUALITY telephoneNumberMatch
- SUBSTR telephoneNumberSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.22
- NAME 'tty'
- EQUALITY telephoneNumberMatch
- SUBSTR telephoneNumberSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
-
-# deprecated - use the multivalued category
-attributetype ( 1.3.6.1.4.1.8506.1.2.23
- NAME 'categories'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{4096} )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.24
- NAME 'contact'
- EQUALITY distinguishedNameMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.25
- NAME 'listName'
- SUP name
- SINGLE-VALUE )
-
-# deprecated - use calEntry and its attributes from RFC 2739
-attributetype ( 1.3.6.1.4.1.8506.1.2.26
- NAME 'calendarURI'
- EQUALITY caseExactIA5Match
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
- SINGLE-VALUE )
-
-# deprecated - use calEntry and its attributes from RFC 2739
-attributetype ( 1.3.6.1.4.1.8506.1.2.27
- NAME 'freeBusyURI'
- EQUALITY caseExactIA5Match
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
- SINGLE-VALUE )
-
-attributetype ( 1.3.6.1.4.1.8506.1.2.28
- NAME 'category'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{4096} )
-
-
-# evolutionPerson
-objectclass ( 1.3.6.1.4.1.8506.1.3.1
- NAME 'evolutionPerson'
- DESC 'Objectclass geared to Evolution Usage'
- SUP inetOrgPerson
- STRUCTURAL
- MAY (
- fileAs $ primaryPhone $ carPhone $ homeFacsimileTelephoneNumber $
- otherPhone $ businessRole $ managerName $ assistantName $ assistantPhone $
- otherPostalAddress $ mailer $ birthDate $ anniversary $ spouseName $
- note $ companyPhone $ callbackPhone $ otherFacsimileTelephoneNumber $
- radio $ telex $ tty $ categories $ category $ calendarURI $ freeBusyURI )
- )
-
-# evolutionPersonList
-objectclass ( 1.3.6.1.4.1.8506.1.3.2
- NAME 'evolutionPersonList'
- DESC 'Objectclass geared to Evolution Contact Lists'
- SUP top
- STRUCTURAL
- MUST (
- listName )
- MAY (
- mail $ contact )
- )
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.c b/addressbook/backend/pas/pas-backend-card-sexp.c
deleted file mode 100644
index 1ccb4f2433..0000000000
--- a/addressbook/backend/pas/pas-backend-card-sexp.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * pas-backend-card-sexp.c
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include "pas-backend-card-sexp.h"
-
-#include <string.h>
-#include <e-util/e-sexp.h>
-#include <gal/widgets/e-unicode.h>
-
-static GObjectClass *parent_class;
-
-typedef struct _SearchContext SearchContext;
-
-struct _PASBackendCardSExpPrivate {
- ESExp *search_sexp;
- SearchContext *search_context;
-};
-
-struct _SearchContext {
- EContact *contact;
-};
-
-static gboolean
-compare_email (EContact *contact, const char *str,
- char *(*compare)(const char*, const char*))
-{
- int i;
-
- for (i = E_CONTACT_EMAIL_1; i <= E_CONTACT_EMAIL_3; i ++) {
- const char *email = e_contact_get_const (contact, i);
-
- if (email && compare(email, str))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-compare_phone (EContact *contact, const char *str,
- char *(*compare)(const char*, const char*))
-{
- int i;
- gboolean rv = FALSE;
-
- for (i = E_CONTACT_FIRST_PHONE_ID; i <= E_CONTACT_LAST_PHONE_ID; i ++) {
- char *phone = e_contact_get (contact, i);
-
- rv = phone && compare(phone, str);
- g_free (phone);
-
- if (rv)
- break;
- }
-
- return rv;
-}
-
-static gboolean
-compare_name (EContact *contact, const char *str,
- char *(*compare)(const char*, const char*))
-{
- const char *name;
-
- name = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
- if (name && compare (name, str))
- return TRUE;
-
- name = e_contact_get_const (contact, E_CONTACT_FAMILY_NAME);
- if (name && compare (name, str))
- return TRUE;
-
- return FALSE;
-}
-
-static gboolean
-compare_address (EContact *contact, const char *str,
- char *(*compare)(const char*, const char*))
-{
- g_warning("address searching not implemented\n");
- return FALSE;
-}
-
-static gboolean
-compare_category (EContact *contact, const char *str,
- char *(*compare)(const char*, const char*))
-{
- GList *categories;
- GList *iterator;
- gboolean ret_val = FALSE;
-
- categories = e_contact_get (contact, E_CONTACT_CATEGORY_LIST);
-
- for (iterator = categories; iterator; iterator = iterator->next) {
- const char *category = iterator->data;
-
- if (compare(category, str)) {
- ret_val = TRUE;
- break;
- }
- }
-
- g_list_foreach (categories, (GFunc)g_free, NULL);
- g_list_free (categories);
-
- return ret_val;
-}
-
-static struct prop_info {
- EContactField field_id;
- const char *query_prop;
-#define PROP_TYPE_NORMAL 0x01
-#define PROP_TYPE_LIST 0x02
- int prop_type;
- gboolean (*list_compare)(EContact *contact, const char *str,
- char *(*compare)(const char*, const char*));
-
-} prop_info_table[] = {
-#define NORMAL_PROP(f,q) {f, q, PROP_TYPE_NORMAL, NULL}
-#define LIST_PROP(q,c) {0, q, PROP_TYPE_LIST, c}
-
- /* query prop, type, list compare function */
- NORMAL_PROP ( E_CONTACT_FILE_AS, "file_as" ),
- LIST_PROP ( "full_name", compare_name), /* not really a list, but we need to compare both full and surname */
- NORMAL_PROP ( E_CONTACT_HOMEPAGE_URL, "url"),
- NORMAL_PROP ( E_CONTACT_MAILER, "mailer"),
- NORMAL_PROP ( E_CONTACT_ORG, "org"),
- NORMAL_PROP ( E_CONTACT_ORG_UNIT, "org_unit"),
- NORMAL_PROP ( E_CONTACT_OFFICE, "office"),
- NORMAL_PROP ( E_CONTACT_TITLE, "title"),
- NORMAL_PROP ( E_CONTACT_ROLE, "role"),
- NORMAL_PROP ( E_CONTACT_MANAGER, "manager"),
- NORMAL_PROP ( E_CONTACT_ASSISTANT, "assistant"),
- NORMAL_PROP ( E_CONTACT_NICKNAME, "nickname"),
- NORMAL_PROP ( E_CONTACT_SPOUSE, "spouse" ),
- NORMAL_PROP ( E_CONTACT_NOTE, "note"),
- NORMAL_PROP ( E_CONTACT_UID, "id"),
- LIST_PROP ( "email", compare_email ),
- LIST_PROP ( "phone", compare_phone ),
- LIST_PROP ( "address", compare_address ),
- LIST_PROP ( "category", compare_category ),
-};
-static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]);
-
-static ESExpResult *
-entry_compare(SearchContext *ctx, struct _ESExp *f,
- int argc, struct _ESExpResult **argv,
- char *(*compare)(const char*, const char*))
-{
- ESExpResult *r;
- int truth = FALSE;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname;
- struct prop_info *info = NULL;
- int i;
- gboolean any_field;
-
- propname = argv[0]->value.string;
-
- any_field = !strcmp(propname, "x-evolution-any-field");
- for (i = 0; i < num_prop_infos; i ++) {
- if (any_field
- || !strcmp (prop_info_table[i].query_prop, propname)) {
- info = &prop_info_table[i];
-
- if (info->prop_type == PROP_TYPE_NORMAL) {
- const char *prop = NULL;
- /* straight string property matches */
-
- prop = e_contact_get_const (ctx->contact, info->field_id);
-
- if (prop && compare(prop, argv[1]->value.string)) {
- truth = TRUE;
- }
- if ((!prop) && compare("", argv[1]->value.string)) {
- truth = TRUE;
- }
- }
- else if (info->prop_type == PROP_TYPE_LIST) {
- /* the special searches that match any of the list elements */
- truth = info->list_compare (ctx->contact, argv[1]->value.string, compare);
- }
-
- /* if we're looking at all fields and find a match,
- or if we're just looking at this one field,
- break. */
- if ((any_field && truth)
- || !any_field)
- break;
- }
- }
-
- }
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-static ESExpResult *
-func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
-
- return entry_compare (ctx, f, argc, argv, (char *(*)(const char*, const char*)) e_utf8_strstrcase);
-}
-
-static char *
-is_helper (const char *s1, const char *s2)
-{
- if (!strcasecmp(s1, s2))
- return (char*)s1;
- else
- return NULL;
-}
-
-static ESExpResult *
-func_is(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
-
- return entry_compare (ctx, f, argc, argv, is_helper);
-}
-
-static char *
-endswith_helper (const char *s1, const char *s2)
-{
- char *p;
- if ((p = (char*)e_utf8_strstrcase(s1, s2))
- && (strlen(p) == strlen(s2)))
- return p;
- else
- return NULL;
-}
-
-static ESExpResult *
-func_endswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
-
- return entry_compare (ctx, f, argc, argv, endswith_helper);
-}
-
-static char *
-beginswith_helper (const char *s1, const char *s2)
-{
- char *p;
- if ((p = (char*)e_utf8_strstrcase(s1, s2))
- && (p == s1))
- return p;
- else
- return NULL;
-}
-
-static ESExpResult *
-func_beginswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
-
- return entry_compare (ctx, f, argc, argv, beginswith_helper);
-}
-
-static ESExpResult *
-func_exists(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- SearchContext *ctx = data;
- ESExpResult *r;
- int truth = FALSE;
-
- if (argc == 1
- && argv[0]->type == ESEXP_RES_STRING) {
- char *propname;
- struct prop_info *info = NULL;
- int i;
-
- propname = argv[0]->value.string;
-
- for (i = 0; i < num_prop_infos; i ++) {
- if (!strcmp (prop_info_table[i].query_prop, propname)) {
- info = &prop_info_table[i];
-
- if (info->prop_type == PROP_TYPE_NORMAL) {
- const char *prop = NULL;
- /* searches where the query's property
- maps directly to an ecard property */
-
- prop = e_contact_get_const (ctx->contact, info->field_id);
-
- if (prop && *prop)
- truth = TRUE;
- }
- else if (info->prop_type == PROP_TYPE_LIST) {
- /* the special searches that match any of the list elements */
- truth = info->list_compare (ctx->contact, "", (char *(*)(const char*, const char*)) e_utf8_strstrcase);
- }
-
- break;
- }
- }
-
- }
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-/* 'builtin' functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "contains", func_contains, 0 },
- { "is", func_is, 0 },
- { "beginswith", func_beginswith, 0 },
- { "endswith", func_endswith, 0 },
- { "exists", func_exists, 0 },
-};
-
-gboolean
-pas_backend_card_sexp_match_contact (PASBackendCardSExp *sexp, EContact *contact)
-{
- ESExpResult *r;
- gboolean retval;
-
- if (!contact) {
- g_warning ("null EContact passed to pas_backend_card_sexp_match_contact");
- return FALSE;
- }
-
- sexp->priv->search_context->contact = g_object_ref (contact);
-
- r = e_sexp_eval(sexp->priv->search_sexp);
-
- retval = (r && r->type == ESEXP_RES_BOOL && r->value.bool);
-
- g_object_unref(sexp->priv->search_context->contact);
-
- e_sexp_result_free(sexp->priv->search_sexp, r);
-
- return retval;
-}
-
-gboolean
-pas_backend_card_sexp_match_vcard (PASBackendCardSExp *sexp, const char *vcard)
-{
- EContact *contact;
- gboolean retval;
-
- contact = e_contact_new_from_vcard (vcard);
-
- retval = pas_backend_card_sexp_match_contact (sexp, contact);
-
- g_object_unref(contact);
-
- return retval;
-}
-
-
-
-/**
- * pas_backend_card_sexp_new:
- */
-PASBackendCardSExp *
-pas_backend_card_sexp_new (const char *text)
-{
- PASBackendCardSExp *sexp = g_object_new (PAS_TYPE_BACKEND_CARD_SEXP, NULL);
- int esexp_error;
- int i;
-
- sexp->priv->search_sexp = e_sexp_new();
-
- for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction(sexp->priv->search_sexp, 0, symbols[i].name,
- (ESExpIFunc *)symbols[i].func, sexp->priv->search_context);
- }
- else {
- e_sexp_add_function(sexp->priv->search_sexp, 0, symbols[i].name,
- symbols[i].func, sexp->priv->search_context);
- }
- }
-
- e_sexp_input_text(sexp->priv->search_sexp, text, strlen(text));
- esexp_error = e_sexp_parse(sexp->priv->search_sexp);
-
- if (esexp_error == -1) {
- g_object_unref (sexp);
- sexp = NULL;
- }
-
- return sexp;
-}
-
-static void
-pas_backend_card_sexp_dispose (GObject *object)
-{
- PASBackendCardSExp *sexp = PAS_BACKEND_CARD_SEXP (object);
-
- if (sexp->priv) {
- e_sexp_unref(sexp->priv->search_sexp);
-
- g_free (sexp->priv->search_context);
- g_free (sexp->priv);
- sexp->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-pas_backend_card_sexp_class_init (PASBackendCardSExpClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- /* Set the virtual methods. */
-
- object_class->dispose = pas_backend_card_sexp_dispose;
-}
-
-static void
-pas_backend_card_sexp_init (PASBackendCardSExp *sexp)
-{
- PASBackendCardSExpPrivate *priv;
-
- priv = g_new0 (PASBackendCardSExpPrivate, 1);
-
- sexp->priv = priv;
- priv->search_context = g_new (SearchContext, 1);
-}
-
-/**
- * pas_backend_card_sexp_get_type:
- */
-GType
-pas_backend_card_sexp_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendCardSExpClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_card_sexp_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PASBackendCardSExp),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_card_sexp_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "PASBackendCardSExp", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.h b/addressbook/backend/pas/pas-backend-card-sexp.h
deleted file mode 100644
index 7efb697fb0..0000000000
--- a/addressbook/backend/pas/pas-backend-card-sexp.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * pas-backend-card-sexp.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef __PAS_BACKEND_CARD_SEXP_H__
-#define __PAS_BACKEND_CARD_SEXP_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <ebook/e-contact.h>
-#include <pas/pas-types.h>
-
-#define PAS_TYPE_BACKEND_CARD_SEXP (pas_backend_card_sexp_get_type ())
-#define PAS_BACKEND_CARD_SEXP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_CARD_SEXP, PASBackendCardSExp))
-#define PAS_BACKEND_CARD_SEXP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendCardSExpClass))
-#define PAS_IS_BACKEND_CARD_SEXP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_CARD_SEXP))
-#define PAS_IS_BACKEND_CARD_SEXP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_CARD_SEXP))
-#define PAS_BACKEND_CARD_SEXP_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_CARD_SEXP, PASBackendCardSExpClass))
-
-typedef struct _PASBackendCardSExpPrivate PASBackendCardSExpPrivate;
-
-struct _PASBackendCardSExp {
- GObject parent_object;
- PASBackendCardSExpPrivate *priv;
-};
-
-struct _PASBackendCardSExpClass {
- GObjectClass parent_class;
-};
-
-PASBackendCardSExp *pas_backend_card_sexp_new (const char *text);
-GType pas_backend_card_sexp_get_type (void);
-
-gboolean pas_backend_card_sexp_match_vcard (PASBackendCardSExp *sexp, const char *vcard);
-gboolean pas_backend_card_sexp_match_contact (PASBackendCardSExp *sexp, EContact *contact);
-
-#endif /* __PAS_BACKEND_CARD_SEXP_H__ */
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
deleted file mode 100644
index 73f1797320..0000000000
--- a/addressbook/backend/pas/pas-backend-file.c
+++ /dev/null
@@ -1,1169 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include "config.h"
-#include "pas-backend-file.h"
-#include "pas-backend-card-sexp.h"
-#include "pas-backend-summary.h"
-#include "pas-book.h"
-#include "pas-book-view.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <time.h>
-#include <errno.h>
-#include <db.h>
-#include <sys/stat.h>
-
-#include <e-util/e-db3-utils.h>
-
-#if DB_VERSION_MAJOR != 3 || \
- DB_VERSION_MINOR != 1 || \
- DB_VERSION_PATCH != 17
-#error Including wrong DB3. Need libdb 3.1.17.
-#endif
-
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-unicode.h>
-
-#include <ebook/e-contact.h>
-#include <e-util/e-dbhash.h>
-#include <e-util/e-db3-utils.h>
-#include <libgnome/gnome-i18n.h>
-
-#define CHANGES_DB_SUFFIX ".changes.db"
-
-#define PAS_BACKEND_FILE_VERSION_NAME "PAS-DB-VERSION"
-#define PAS_BACKEND_FILE_VERSION "0.2"
-
-#define PAS_ID_PREFIX "pas-id-"
-#define SUMMARY_FLUSH_TIMEOUT 5000
-
-static PASBackendSyncClass *pas_backend_file_parent_class;
-
-struct _PASBackendFilePrivate {
- char *uri;
- char *dirname;
- char *filename;
- char *summary_filename;
- DB *file_db;
- PASBackendSummary *summary;
-};
-
-static void
-string_to_dbt(const char *str, DBT *dbt)
-{
- memset (dbt, 0, sizeof (*dbt));
- dbt->data = (void*)str;
- dbt->size = strlen (str) + 1;
-}
-
-static void
-build_summary (PASBackendFilePrivate *bfpriv)
-{
- DB *db = bfpriv->file_db;
- DBC *dbc;
- int db_error;
- DBT id_dbt, vcard_dbt;
-
- db_error = db->cursor (db, NULL, &dbc, 0);
-
- if (db_error != 0) {
- g_warning ("build_summary: error building list\n");
- return;
- }
-
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
- memset (&id_dbt, 0, sizeof (id_dbt));
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_FIRST);
-
- while (db_error == 0) {
-
- /* don't include the version in the list of cards */
- if (id_dbt.size != strlen(PAS_BACKEND_FILE_VERSION_NAME) + 1
- || strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) {
- EContact *contact = e_contact_new_from_vcard (vcard_dbt.data);
- pas_backend_summary_add_contact (bfpriv->summary, contact);
- g_object_unref (contact);
- }
-
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_NEXT);
-
- }
-}
-
-static char *
-pas_backend_file_create_unique_id (void)
-{
- /* use a 32 counter and the 32 bit timestamp to make an id.
- it's doubtful 2^32 id's will be created in a second, so we
- should be okay. */
- static guint c = 0;
- return g_strdup_printf (PAS_ID_PREFIX "%08lX%08X", time(NULL), c++);
-}
-
-static EContact *
-do_create(PASBackendFile *bf,
- const char *vcard_req)
-{
- DB *db = bf->priv->file_db;
- DBT id_dbt, vcard_dbt;
- int db_error;
- char *id;
- EContact *contact;
- char *vcard;
-
- id = pas_backend_file_create_unique_id ();
-
- string_to_dbt (id, &id_dbt);
-
- contact = e_contact_new_from_vcard (vcard_req);
- e_contact_set(contact, E_CONTACT_UID, id);
- vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
- string_to_dbt (vcard, &vcard_dbt);
-
- db_error = db->put (db, NULL, &id_dbt, &vcard_dbt, 0);
-
- g_free (vcard);
-
- if (0 == db_error) {
- db_error = db->sync (db, 0);
- if (db_error != 0)
- g_warning ("db->sync failed.\n");
- }
- else {
- g_object_unref (contact);
- contact = NULL;
- }
-
- g_free (id);
- return contact;
-}
-
-static PASBackendSyncStatus
-pas_backend_file_create_contact (PASBackendSync *backend,
- PASBook *book,
- const char *vcard,
- EContact **contact)
-{
- PASBackendFile *bf = PAS_BACKEND_FILE (backend);
-
- *contact = do_create (bf, vcard);
- if (*contact) {
- pas_backend_summary_add_contact (bf->priv->summary, *contact);
- return GNOME_Evolution_Addressbook_Success;
- }
- else {
- /* XXX need a different call status for this case, i
- think */
- return GNOME_Evolution_Addressbook_ContactNotFound;
- }
-}
-
-static PASBackendSyncStatus
-pas_backend_file_remove_contacts (PASBackendSync *backend,
- PASBook *book,
- GList *id_list,
- GList **ids)
-{
- PASBackendFile *bf = PAS_BACKEND_FILE (backend);
- DB *db = bf->priv->file_db;
- DBT id_dbt, vcard_dbt;
- int db_error;
- char *id;
- GList *l;
- GList *removed_cards = NULL;
- GNOME_Evolution_Addressbook_CallStatus rv = GNOME_Evolution_Addressbook_Success;
-
- for (l = id_list; l; l = l->next) {
- id = l->data;
-
- string_to_dbt (id, &id_dbt);
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-
- db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
- if (0 != db_error) {
- rv = GNOME_Evolution_Addressbook_ContactNotFound;
- continue;
- }
-
- db_error = db->del (db, NULL, &id_dbt, 0);
- if (0 != db_error) {
- rv = GNOME_Evolution_Addressbook_ContactNotFound;
- continue;
- }
-
- removed_cards = g_list_prepend (removed_cards, id);
- }
-
- /* if we actually removed some, try to sync */
- if (removed_cards) {
- db_error = db->sync (db, 0);
- if (db_error != 0)
- g_warning ("db->sync failed.\n");
- }
-
- *ids = removed_cards;
-
- for (l = removed_cards; l; l = l->next) {
- char *id = l->data;
- pas_backend_summary_remove_contact (bf->priv->summary, id);
- }
-
- return rv;
-}
-
-static PASBackendSyncStatus
-pas_backend_file_modify_contact (PASBackendSync *backend,
- PASBook *book,
- const char *vcard,
- EContact **contact)
-{
- PASBackendFile *bf = PAS_BACKEND_FILE (backend);
- DB *db = bf->priv->file_db;
- DBT id_dbt, vcard_dbt;
- int db_error;
- char *id, *lookup_id;
-
- *contact = e_contact_new_from_vcard (vcard);
- id = e_contact_get(*contact, E_CONTACT_UID);
-
- /* This is disgusting, but for a time cards were added with
- ID's that are no longer used (they contained both the uri
- and the id.) If we recognize it as a uri (file:///...) trim
- off everything before the last '/', and use that as the
- id.*/
- if (!strncmp (id, "file:///", strlen ("file:///"))) {
- lookup_id = strrchr (id, '/') + 1;
- }
- else
- lookup_id = id;
-
- string_to_dbt (lookup_id, &id_dbt);
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-
- /* get the old ecard - the one that's presently in the db */
- db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
- if (0 != db_error)
- return GNOME_Evolution_Addressbook_ContactNotFound;
-
- string_to_dbt (vcard, &vcard_dbt);
-
- db_error = db->put (db, NULL, &id_dbt, &vcard_dbt, 0);
-
- if (0 == db_error) {
- db_error = db->sync (db, 0);
- if (db_error != 0)
- g_warning ("db->sync failed.\n");
-
- pas_backend_summary_remove_contact (bf->priv->summary, id);
- pas_backend_summary_add_contact (bf->priv->summary, *contact);
- }
- g_free (id);
-
- if (0 == db_error)
- return GNOME_Evolution_Addressbook_Success;
- else
- return GNOME_Evolution_Addressbook_ContactNotFound;
-}
-
-static PASBackendSyncStatus
-pas_backend_file_get_contact (PASBackendSync *backend,
- PASBook *book,
- const char *id,
- char **vcard)
-{
- PASBackendFile *bf;
- DB *db;
- DBT id_dbt, vcard_dbt;
- int db_error = 0;
-
- bf = PAS_BACKEND_FILE (pas_book_get_backend (book));
- db = bf->priv->file_db;
-
- string_to_dbt (id, &id_dbt);
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-
- db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
-
- if (db_error == 0) {
- *vcard = g_strdup (vcard_dbt.data);
- return GNOME_Evolution_Addressbook_Success;
- } else {
- *vcard = g_strdup ("");
- return GNOME_Evolution_Addressbook_ContactNotFound;
- }
-}
-
-static PASBackendSyncStatus
-pas_backend_file_get_contact_list (PASBackendSync *backend,
- PASBook *book,
- const char *query,
- GList **contacts)
-{
- PASBackendFile *bf = PAS_BACKEND_FILE (backend);
- DB *db = bf->priv->file_db;
- DBC *dbc;
- int db_error;
- DBT id_dbt, vcard_dbt;
- PASBackendCardSExp *card_sexp = NULL;
- gboolean search_needed;
- const char *search = query;
- GList *contact_list = NULL;
-
- printf ("pas_backend_file_get_contact_list (%s)\n", search);
-
- search_needed = TRUE;
-
- if (!strcmp (search, "(contains \"x-evolution-any-field\" \"\")"))
- search_needed = FALSE;
-
- card_sexp = pas_backend_card_sexp_new (search);
- if (!card_sexp) {
- /* XXX this needs to be an invalid query error of some sort*/
- return GNOME_Evolution_Addressbook_ContactNotFound;
- }
-
- db_error = db->cursor (db, NULL, &dbc, 0);
-
- if (db_error != 0) {
- /* XXX this needs to be some CouldNotOpen error */
- return GNOME_Evolution_Addressbook_ContactNotFound;
- }
-
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
- memset (&id_dbt, 0, sizeof (id_dbt));
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_FIRST);
-
- while (db_error == 0) {
-
- /* don't include the version in the list of cards */
- if (id_dbt.size != strlen(PAS_BACKEND_FILE_VERSION_NAME) + 1
- || strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) {
-
- if ((!search_needed) || (card_sexp != NULL && pas_backend_card_sexp_match_vcard (card_sexp, vcard_dbt.data))) {
- contact_list = g_list_append (contact_list, g_strdup (vcard_dbt.data));
- }
- }
-
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_NEXT);
-
- }
-
- *contacts = contact_list;
- return db_error != DB_NOTFOUND
- ? GNOME_Evolution_Addressbook_OtherError
- : GNOME_Evolution_Addressbook_Success;
-}
-
-typedef struct {
- GMutex *mutex;
- gboolean stopped;
-} FileBackendSearchClosure;
-
-static void
-pas_backend_file_start_book_view (PASBackend *backend,
- PASBookView *book_view)
-{
- FileBackendSearchClosure *closure = g_new0 (FileBackendSearchClosure, 1);
- PASBackendFile *bf = PAS_BACKEND_FILE (backend);
- const char *query;
- DB *db;
- DBT id_dbt, vcard_dbt;
- int db_error;
- gboolean stopped = FALSE;
-
- printf ("starting initial population of book view\n");
-
- /* ref the book view because it'll be removed and unrefed
- when/if it's stopped */
- g_object_ref (book_view);
-
- db = bf->priv->file_db;
- query = pas_book_view_get_card_query (book_view);
-
- closure->mutex = g_mutex_new();
- closure->stopped = FALSE;
- g_object_set_data (G_OBJECT (book_view), "PASBackendFile.BookView::closure", closure);
-
- if ( ! strcmp (query, "(contains \"x-evolution-any-field\" \"\")"))
- pas_book_view_notify_status_message (book_view, _("Loading..."));
- else
- pas_book_view_notify_status_message (book_view, _("Searching..."));
-
- if (pas_backend_summary_is_summary_query (bf->priv->summary, query)) {
- /* do a summary query */
- GPtrArray *ids = pas_backend_summary_search (bf->priv->summary, pas_book_view_get_card_query (book_view));
- int i;
-
- for (i = 0; i < ids->len; i ++) {
- char *id = g_ptr_array_index (ids, i);
-
- g_mutex_lock (closure->mutex);
- stopped = closure->stopped;
- g_mutex_unlock (closure->mutex);
-
- if (stopped) {
- g_mutex_free (closure->mutex);
- g_free (closure);
- break;
- }
-
- string_to_dbt (id, &id_dbt);
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-
- db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
-
- if (db_error == 0) {
- EContact *contact = e_contact_new_from_vcard (vcard_dbt.data);
- pas_book_view_notify_update (book_view, contact);
- g_object_unref (contact);
- }
- }
-
- g_ptr_array_free (ids, TRUE);
- }
- else {
- /* iterate over the db and do the query there */
- DBC *dbc;
-
- memset (&id_dbt, 0, sizeof (id_dbt));
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-
- db_error = db->cursor (db, NULL, &dbc, 0);
-
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_FIRST);
- while (db_error == 0) {
-
- g_mutex_lock (closure->mutex);
- stopped = closure->stopped;
- g_mutex_unlock (closure->mutex);
-
- if (stopped) {
- g_mutex_free (closure->mutex);
- g_free (closure);
- break;
- }
-
- /* don't include the version in the list of cards */
- if (strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) {
- char *vcard_string = vcard_dbt.data;
- EContact *contact = e_contact_new_from_vcard (vcard_string);
-
- /* notify_update will check if it matches for us */
- pas_book_view_notify_update (book_view, contact);
- g_object_unref (contact);
- }
-
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_NEXT);
- }
-
- dbc->c_close (dbc);
-
- if (db_error != DB_NOTFOUND)
- g_warning ("pas_backend_file_search: error building list\n");
-
- }
-
- g_mutex_lock (closure->mutex);
- stopped = closure->stopped;
- g_mutex_unlock (closure->mutex);
- if (!stopped)
- pas_book_view_notify_complete (book_view, GNOME_Evolution_Addressbook_Success);
-
- g_mutex_free (closure->mutex);
- g_free (closure);
-
- g_object_set_data (G_OBJECT (book_view), "PASBackendFile.BookView::closure", NULL);
-
- /* unref the */
- g_object_unref (book_view);
-
- printf ("finished initial population of book view\n");
-}
-
-static void
-pas_backend_file_stop_book_view (PASBackend *backend,
- PASBookView *book_view)
-{
- FileBackendSearchClosure *closure = g_object_get_data (G_OBJECT (book_view), "PASBackendFile.BookView::closure");
- if (!closure) {
- printf ("book view is already done populating\n");
- return;
- }
-
- printf ("stopping book view!\n");
- g_mutex_lock (closure->mutex);
- closure->stopped = TRUE;
- g_mutex_lock (closure->mutex);
-}
-
-typedef struct {
- DB *db;
-
- GList *add_cards;
- GList *add_ids;
- GList *mod_cards;
- GList *mod_ids;
- GList *del_ids;
- GList *del_cards;
-} PASBackendFileChangeContext;
-
-static void
-pas_backend_file_changes_foreach_key (const char *key, gpointer user_data)
-{
- PASBackendFileChangeContext *ctx = user_data;
- DB *db = ctx->db;
- DBT id_dbt, vcard_dbt;
- int db_error = 0;
-
- string_to_dbt (key, &id_dbt);
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
- db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
-
- if (db_error != 0) {
- EContact *contact;
- char *id = id_dbt.data;
- char *vcard_string;
-
- contact = e_contact_new ();
- e_contact_set (contact, E_CONTACT_UID, id);
-
- vcard_string = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
- ctx->del_ids = g_list_append (ctx->del_ids,
- g_strdup (id));
- ctx->del_cards = g_list_append (ctx->del_cards,
- vcard_string);
-
- g_object_unref (contact);
- }
-}
-
-static PASBackendSyncStatus
-pas_backend_file_get_changes (PASBackendSync *backend,
- PASBook *book,
- const char *change_id,
- GList **changes_out)
-{
- PASBackendFile *bf = PAS_BACKEND_FILE (backend);
- int db_error = 0;
- DBT id_dbt, vcard_dbt;
- char *filename;
- EDbHash *ehash;
- GList *i, *v;
- DB *db = bf->priv->file_db;
- DBC *dbc;
- GList *changes = NULL;
- PASBackendFileChangeContext ctx;
- PASBackendSyncStatus result;
-
- memset (&id_dbt, 0, sizeof (id_dbt));
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-
- memset (&ctx, 0, sizeof (ctx));
-
- ctx.db = db;
-
- /* Find the changed ids */
- filename = g_strdup_printf ("%s/%s" CHANGES_DB_SUFFIX, bf->priv->dirname, change_id);
- ehash = e_dbhash_new (filename);
- g_free (filename);
-
- db_error = db->cursor (db, NULL, &dbc, 0);
-
- if (db_error != 0) {
- g_warning ("pas_backend_file_changes: error building list\n");
- } else {
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_FIRST);
-
- while (db_error == 0) {
-
- /* don't include the version in the list of cards */
- if (id_dbt.size != strlen(PAS_BACKEND_FILE_VERSION_NAME) + 1
- || strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) {
- EContact *contact;
- char *id = id_dbt.data;
- char *vcard_string;
-
- /* Remove fields the user can't change
- * and can change without the rest of the
- * card changing
- */
- contact = e_contact_new_from_vcard (vcard_dbt.data);
-#if notyet
- g_object_set (card, "last_use", NULL, "use_score", 0.0, NULL);
-#endif
- vcard_string = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
- g_object_unref (contact);
-
- /* check what type of change has occurred, if any */
- switch (e_dbhash_compare (ehash, id, vcard_string)) {
- case E_DBHASH_STATUS_SAME:
- break;
- case E_DBHASH_STATUS_NOT_FOUND:
- ctx.add_cards = g_list_append (ctx.add_cards, vcard_string);
- ctx.add_ids = g_list_append (ctx.add_ids, g_strdup(id));
- break;
- case E_DBHASH_STATUS_DIFFERENT:
- ctx.mod_cards = g_list_append (ctx.mod_cards, vcard_string);
- ctx.mod_ids = g_list_append (ctx.mod_ids, g_strdup(id));
- break;
- }
- }
-
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_NEXT);
- }
- dbc->c_close (dbc);
- }
-
- e_dbhash_foreach_key (ehash, (EDbHashFunc)pas_backend_file_changes_foreach_key, &ctx);
-
- /* Send the changes */
- if (db_error != DB_NOTFOUND) {
- g_warning ("pas_backend_file_changes: error building list\n");
- *changes_out = NULL;
- result = GNOME_Evolution_Addressbook_OtherError;
- }
- else {
- /* Update the hash and build our changes list */
- for (i = ctx.add_ids, v = ctx.add_cards; i != NULL; i = i->next, v = v->next){
- char *id = i->data;
- char *vcard = v->data;
-
- e_dbhash_add (ehash, id, vcard);
- changes = g_list_prepend (changes,
- pas_backend_change_add_new (vcard));
-
- g_free (i->data);
- g_free (v->data);
- }
- for (i = ctx.mod_ids, v = ctx.mod_cards; i != NULL; i = i->next, v = v->next){
- char *id = i->data;
- char *vcard = v->data;
-
- e_dbhash_add (ehash, id, vcard);
- changes = g_list_prepend (changes,
- pas_backend_change_modify_new (vcard));
-
- g_free (i->data);
- g_free (v->data);
- }
- for (i = ctx.del_ids, v = ctx.del_cards; i != NULL; i = i->next, v = v->next){
- char *id = i->data;
- char *vcard = v->data;
-
- e_dbhash_remove (ehash, id);
-
- changes = g_list_prepend (changes,
- pas_backend_change_delete_new (vcard));
- g_free (i->data);
- g_free (v->data);
- }
-
- e_dbhash_write (ehash);
-
- result = GNOME_Evolution_Addressbook_Success;
- *changes_out = changes;
- }
-
- e_dbhash_destroy (ehash);
-
- return GNOME_Evolution_Addressbook_Success;
-}
-
-static char *
-pas_backend_file_extract_path_from_uri (const char *uri)
-{
- g_assert (strncasecmp (uri, "file://", 7) == 0);
-
- return g_strdup (uri + 7);
-}
-
-static PASBackendSyncStatus
-pas_backend_file_authenticate_user (PASBackendSync *backend,
- PASBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method)
-{
- return GNOME_Evolution_Addressbook_Success;
-}
-
-static PASBackendSyncStatus
-pas_backend_file_get_supported_fields (PASBackendSync *backend,
- PASBook *book,
- GList **fields_out)
-{
- GList *fields = NULL;
- int i;
-
- /* XXX we need a way to say "we support everything", since the
- file backend does */
- for (i = 1; i < E_CONTACT_FIELD_LAST; i ++)
- fields = g_list_append (fields, g_strdup (e_contact_field_name (i)));
-
- *fields_out = fields;
- return GNOME_Evolution_Addressbook_Success;
-}
-
-/*
-** versions:
-**
-** 0.0 just a list of cards
-**
-** 0.1 same as 0.0, but with the version tag
-**
-** 0.2 not a real format upgrade, just a hack to fix broken ids caused
-** by a bug in early betas, but we only need to convert them if
-** the previous version is 0.1, since the bug existed after 0.1
-** came about.
-*/
-static gboolean
-pas_backend_file_upgrade_db (PASBackendFile *bf, char *old_version)
-{
- DB *db = bf->priv->file_db;
- int db_error;
- DBT version_name_dbt, version_dbt;
-
- if (strcmp (old_version, "0.0")
- && strcmp (old_version, "0.1")) {
- g_warning ("unsupported version '%s' found in PAS backend file\n",
- old_version);
- return FALSE;
- }
-
- if (!strcmp (old_version, "0.1")) {
- /* we just loop through all the cards in the db,
- giving them valid ids if they don't have them */
- DBT id_dbt, vcard_dbt;
- DBC *dbc;
- int card_failed = 0;
-
- db_error = db->cursor (db, NULL, &dbc, 0);
- if (db_error != 0) {
- g_warning ("unable to get cursor");
- return FALSE;
- }
-
- memset (&id_dbt, 0, sizeof (id_dbt));
- memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_FIRST);
-
- while (db_error == 0) {
- if (id_dbt.size != strlen(PAS_BACKEND_FILE_VERSION_NAME) + 1
- || strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) {
- EContact *contact;
-
- contact = e_contact_new_from_vcard (vcard_dbt.data);
-
- /* the cards we're looking for are
- created with a normal id dbt, but
- with the id field in the vcard set
- to something that doesn't match.
- so, we need to modify the card to
- have the same id as the the dbt. */
- if (strcmp (id_dbt.data, e_contact_get_const (contact, E_CONTACT_UID))) {
- char *vcard;
-
- e_contact_set (contact, E_CONTACT_UID, id_dbt.data);
-
- vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
- string_to_dbt (vcard, &vcard_dbt);
-
- db_error = db->put (db, NULL,
- &id_dbt, &vcard_dbt, 0);
-
- g_free (vcard);
-
- if (db_error != 0)
- card_failed++;
- }
-
- g_object_unref (contact);
- }
-
- db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_NEXT);
- }
-
- if (card_failed) {
- g_warning ("failed to update %d cards\n", card_failed);
- return FALSE;
- }
- }
-
- string_to_dbt (PAS_BACKEND_FILE_VERSION_NAME, &version_name_dbt);
- string_to_dbt (PAS_BACKEND_FILE_VERSION, &version_dbt);
-
- db_error = db->put (db, NULL, &version_name_dbt, &version_dbt, 0);
- if (db_error == 0)
- return TRUE;
- else
- return FALSE;
-}
-
-static gboolean
-pas_backend_file_maybe_upgrade_db (PASBackendFile *bf)
-{
- DB *db = bf->priv->file_db;
- DBT version_name_dbt, version_dbt;
- int db_error;
- char *version;
- gboolean ret_val = TRUE;
-
- string_to_dbt (PAS_BACKEND_FILE_VERSION_NAME, &version_name_dbt);
- memset (&version_dbt, 0, sizeof (version_dbt));
-
- db_error = db->get (db, NULL, &version_name_dbt, &version_dbt, 0);
- if (db_error == 0) {
- /* success */
- version = g_strdup (version_dbt.data);
- }
- else {
- /* key was not in file */
- version = g_strdup ("0.0");
- }
-
- if (strcmp (version, PAS_BACKEND_FILE_VERSION))
- ret_val = pas_backend_file_upgrade_db (bf, version);
-
- g_free (version);
-
- return ret_val;
-}
-
-#include "ximian-vcard.h"
-
-static GNOME_Evolution_Addressbook_CallStatus
-pas_backend_file_load_uri (PASBackend *backend,
- const char *uri,
- gboolean only_if_exists)
-{
- PASBackendFile *bf = PAS_BACKEND_FILE (backend);
- char *dirname, *filename;
- gboolean writable = FALSE;
- int db_error;
- DB *db;
- int major, minor, patch;
- time_t db_mtime;
- struct stat sb;
-
- g_free(bf->priv->uri);
- bf->priv->uri = g_strdup (uri);
-
- db_version (&major, &minor, &patch);
-
- if (major != 3 ||
- minor != 1 ||
- patch != 17) {
- g_warning ("Wrong version of libdb.");
- return GNOME_Evolution_Addressbook_OtherError;
- }
-
- dirname = pas_backend_file_extract_path_from_uri (uri);
- filename = g_build_filename (dirname, "addressbook.db", NULL);
-
- db_error = e_db3_utils_maybe_recover (filename);
- if (db_error != 0)
- return GNOME_Evolution_Addressbook_OtherError;
-
- db_error = db_create (&db, NULL, 0);
- if (db_error != 0)
- return GNOME_Evolution_Addressbook_OtherError;
-
- db_error = db->open (db, filename, NULL, DB_HASH, 0, 0666);
-
- if (db_error == DB_OLD_VERSION) {
- db_error = e_db3_utils_upgrade_format (filename);
-
- if (db_error != 0)
- return GNOME_Evolution_Addressbook_OtherError;
-
- db_error = db->open (db, filename, NULL, DB_HASH, 0, 0666);
- }
-
- bf->priv->file_db = db;
-
- if (db_error == 0) {
- writable = TRUE;
- } else {
- db_error = db->open (db, filename, NULL, DB_HASH, DB_RDONLY, 0666);
-
- if (db_error != 0) {
- int rv;
-
- /* the database didn't exist, so we create the
- directory then the .db */
- rv = mkdir (dirname, 0777);
- if (rv == -1 && errno != EEXIST) {
- g_warning ("failed to make directory %s: %s", dirname, strerror (errno));
- if (errno == EACCES || errno == EPERM)
- return GNOME_Evolution_Addressbook_PermissionDenied;
- else
- return GNOME_Evolution_Addressbook_OtherError;
- }
-
- db_error = db->open (db, filename, NULL, DB_HASH, DB_CREATE, 0666);
-
- if (db_error == 0 && !only_if_exists) {
- EContact *contact;
-
- contact = do_create(bf, XIMIAN_VCARD);
- /* XXX check errors here */
- g_object_unref (contact);
-
- writable = TRUE;
- }
- }
- }
-
- if (db_error != 0) {
- bf->priv->file_db = NULL;
- return GNOME_Evolution_Addressbook_OtherError;
- }
-
- if (!pas_backend_file_maybe_upgrade_db (bf)) {
- db->close (db, 0);
- bf->priv->file_db = NULL;
- return GNOME_Evolution_Addressbook_OtherError;
- }
-
- g_free (bf->priv->dirname);
- g_free (bf->priv->filename);
- bf->priv->dirname = dirname;
- bf->priv->filename = filename;
-
- if (stat (bf->priv->filename, &sb) == -1) {
- db->close (db, 0);
- bf->priv->file_db = NULL;
- return GNOME_Evolution_Addressbook_OtherError;
- }
- db_mtime = sb.st_mtime;
-
- g_free (bf->priv->summary_filename);
- bf->priv->summary_filename = g_strconcat (bf->priv->filename, ".summary", NULL);
- bf->priv->summary = pas_backend_summary_new (bf->priv->summary_filename, SUMMARY_FLUSH_TIMEOUT);
-
- if (pas_backend_summary_is_up_to_date (bf->priv->summary, db_mtime) == FALSE
- || pas_backend_summary_load (bf->priv->summary) == FALSE ) {
- build_summary (bf->priv);
- }
-
- pas_backend_set_is_loaded (backend, TRUE);
- pas_backend_set_is_writable (backend, writable);
-
- return GNOME_Evolution_Addressbook_Success;
-}
-
-static int
-select_changes (const struct dirent *d)
-{
- char *p;
-
- if (strlen (d->d_name) < strlen (CHANGES_DB_SUFFIX))
- return 0;
-
- p = strstr (d->d_name, CHANGES_DB_SUFFIX);
- if (!p)
- return 0;
-
- if (strlen (p) != strlen (CHANGES_DB_SUFFIX))
- return 0;
-
- return 1;
-}
-
-static PASBackendSyncStatus
-pas_backend_file_remove (PASBackendSync *backend,
- PASBook *book)
-{
- PASBackendFile *bf = PAS_BACKEND_FILE (backend);
- struct dirent **namelist;
- int n;
-
- if (-1 == unlink (bf->priv->filename)) {
- if (errno == EACCES || errno == EPERM)
- return GNOME_Evolution_Addressbook_PermissionDenied;
- else
- return GNOME_Evolution_Addressbook_OtherError;
- }
-
- /* unref the summary before we remove the file so it's not written out again */
- g_object_unref (bf->priv->summary);
- bf->priv->summary = NULL;
- if (-1 == unlink (bf->priv->filename))
- g_warning ("failed to remove summary file `%s`: %s", bf->priv->summary_filename, strerror (errno));
-
- /* scandir to select all the "*.changes.db" files, then remove them */
- n = scandir (bf->priv->dirname,
- &namelist, select_changes, alphasort);
- if (n < 0) {
- g_warning ("scandir of directory `%s' failed: %s", bf->priv->dirname, strerror (errno));
- }
- else {
- while (n -- ) {
- char *full_path = g_build_filename (bf->priv->dirname, namelist[n]->d_name, NULL);
- if (-1 == unlink (full_path)) {
- g_warning ("failed to remove change db `%s': %s", full_path, strerror (errno));
- }
- g_free (full_path);
- free (namelist[n]);
- }
- free (namelist);
- }
-
- if (-1 == rmdir (bf->priv->dirname))
- g_warning ("failed to remove directory `%s`: %s", bf->priv->dirname, strerror (errno));
-
- /* we may not have actually succeeded in removing the
- backend's files/dirs, but there's nothing we can do about
- it here.. the only time we should return failure is if we
- failed to remove the actual data. a failure should mean
- that the addressbook is still valid */
- return GNOME_Evolution_Addressbook_Success;
-}
-
-static char *
-pas_backend_file_get_static_capabilities (PASBackend *backend)
-{
- return g_strdup("local,do-initial-query,bulk-removes");
-}
-
-static GNOME_Evolution_Addressbook_CallStatus
-pas_backend_file_cancel_operation (PASBackend *backend, PASBook *book)
-{
- return GNOME_Evolution_Addressbook_CouldNotCancel;
-}
-
-static gboolean
-pas_backend_file_construct (PASBackendFile *backend)
-{
- g_assert (backend != NULL);
- g_assert (PAS_IS_BACKEND_FILE (backend));
-
- if (! pas_backend_construct (PAS_BACKEND (backend)))
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * pas_backend_file_new:
- */
-PASBackend *
-pas_backend_file_new (void)
-{
- PASBackendFile *backend;
-
- backend = g_object_new (PAS_TYPE_BACKEND_FILE, NULL);
-
- if (! pas_backend_file_construct (backend)) {
- g_object_unref (backend);
-
- return NULL;
- }
-
- return PAS_BACKEND (backend);
-}
-
-static void
-pas_backend_file_dispose (GObject *object)
-{
- PASBackendFile *bf;
-
- bf = PAS_BACKEND_FILE (object);
-
- if (bf->priv) {
- if (bf->priv->summary)
- g_object_unref(bf->priv->summary);
- g_free (bf->priv->uri);
- g_free (bf->priv->filename);
- g_free (bf->priv->dirname);
- g_free (bf->priv->summary_filename);
-
- g_free (bf->priv);
- bf->priv = NULL;
- }
-
- G_OBJECT_CLASS (pas_backend_file_parent_class)->dispose (object);
-}
-
-static void
-pas_backend_file_class_init (PASBackendFileClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PASBackendSyncClass *sync_class;
- PASBackendClass *backend_class;
-
- pas_backend_file_parent_class = g_type_class_peek_parent (klass);
-
- sync_class = PAS_BACKEND_SYNC_CLASS (klass);
- backend_class = PAS_BACKEND_CLASS (klass);
-
- /* Set the virtual methods. */
- backend_class->load_uri = pas_backend_file_load_uri;
- backend_class->get_static_capabilities = pas_backend_file_get_static_capabilities;
- backend_class->start_book_view = pas_backend_file_start_book_view;
- backend_class->stop_book_view = pas_backend_file_stop_book_view;
- backend_class->cancel_operation = pas_backend_file_cancel_operation;
-
- sync_class->remove_sync = pas_backend_file_remove;
- sync_class->create_contact_sync = pas_backend_file_create_contact;
- sync_class->remove_contacts_sync = pas_backend_file_remove_contacts;
- sync_class->modify_contact_sync = pas_backend_file_modify_contact;
- sync_class->get_contact_sync = pas_backend_file_get_contact;
- sync_class->get_contact_list_sync = pas_backend_file_get_contact_list;
- sync_class->get_changes_sync = pas_backend_file_get_changes;
- sync_class->authenticate_user_sync = pas_backend_file_authenticate_user;
- sync_class->get_supported_fields_sync = pas_backend_file_get_supported_fields;
-
- object_class->dispose = pas_backend_file_dispose;
-}
-
-static void
-pas_backend_file_init (PASBackendFile *backend)
-{
- PASBackendFilePrivate *priv;
-
- priv = g_new0 (PASBackendFilePrivate, 1);
- priv->uri = NULL;
-
- backend->priv = priv;
-}
-
-/**
- * pas_backend_file_get_type:
- */
-GType
-pas_backend_file_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendFileClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_file_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PASBackendFile),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_file_init
- };
-
- type = g_type_register_static (PAS_TYPE_BACKEND_SYNC, "PASBackendFile", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/backend/pas/pas-backend-file.h b/addressbook/backend/pas/pas-backend-file.h
deleted file mode 100644
index 6e1a77b119..0000000000
--- a/addressbook/backend/pas/pas-backend-file.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __PAS_BACKEND_FILE_H__
-#define __PAS_BACKEND_FILE_H__
-
-#include "pas-backend-sync.h"
-
-#define PAS_TYPE_BACKEND_FILE (pas_backend_file_get_type ())
-#define PAS_BACKEND_FILE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_FILE, PASBackendFile))
-#define PAS_BACKEND_FILE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendFileClass))
-#define PAS_IS_BACKEND_FILE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_FILE))
-#define PAS_IS_BACKEND_FILE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_FILE))
-#define PAS_BACKEND_FILE_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_FILE, PASBackendFileClass))
-
-typedef struct _PASBackendFilePrivate PASBackendFilePrivate;
-
-typedef struct {
- PASBackendSync parent_object;
- PASBackendFilePrivate *priv;
-} PASBackendFile;
-
-typedef struct {
- PASBackendSyncClass parent_class;
-} PASBackendFileClass;
-
-PASBackend *pas_backend_file_new (void);
-GType pas_backend_file_get_type (void);
-
-#endif /* ! __PAS_BACKEND_FILE_H__ */
-
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
deleted file mode 100644
index d4aa4ea82d..0000000000
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ /dev/null
@@ -1,3206 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author:
- * Chris Toshok (toshok@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#define DEBUG
-
-#include "config.h"
-#include <fcntl.h>
-#include <string.h>
-
-#ifdef DEBUG
-#define LDAP_DEBUG
-#define LDAP_DEBUG_ADD
-#endif
-#include <ldap.h>
-#ifdef DEBUG
-#undef LDAP_DEBUG
-#endif
-
-#if LDAP_VENDOR_VERSION > 20000
-#define OPENLDAP2
-#else
-#define OPENLDAP1
-#endif
-
-#ifdef OPENLDAP2
-#include <ldap_schema.h>
-#endif
-
-#include <sys/time.h>
-
-#include <e-util/e-sexp.h>
-#include <ebook/e-contact.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "pas-backend-ldap.h"
-#include "pas-backend-card-sexp.h"
-#include "pas-book.h"
-#include "pas-book-view.h"
-
-#include <stdlib.h>
-
-/* this is broken currently, don't enable it */
-/*#define ENABLE_SASL_BINDS*/
-
-typedef enum {
- PAS_BACKEND_LDAP_TLS_NO,
- PAS_BACKEND_LDAP_TLS_ALWAYS,
- PAS_BACKEND_LDAP_TLS_WHEN_POSSIBLE,
-} PASBackendLDAPUseTLS;
-
-/* interval for our poll_ldap timeout */
-#define LDAP_POLL_INTERVAL 20
-
-/* timeout for ldap_result */
-#define LDAP_RESULT_TIMEOUT_MILLIS 10
-
-#define TV_TO_MILLIS(timeval) ((timeval).tv_sec * 1000 + (timeval).tv_usec / 1000)
-
-/* the objectClasses we need */
-#define TOP "top"
-#define PERSON "person"
-#define ORGANIZATIONALPERSON "organizationalPerson"
-#define INETORGPERSON "inetOrgPerson"
-#define CALENTRY "calEntry"
-#define EVOLUTIONPERSON "evolutionPerson"
-
-static gchar *query_prop_to_ldap(gchar *query_prop);
-
-static PASBackendClass *pas_backend_ldap_parent_class;
-typedef struct _PASBackendLDAPCursorPrivate PASBackendLDAPCursorPrivate;
-typedef struct _PASBackendLDAPBookView PASBackendLDAPBookView;
-typedef struct LDAPOp LDAPOp;
-
-
-struct _PASBackendLDAPPrivate {
- char *uri;
- gboolean connected;
-
- gchar *ldap_host; /* the hostname of the server */
- int ldap_port; /* the port of the server */
- char *schema_dn; /* the base dn for schema information */
- gchar *ldap_rootdn; /* the base dn of our searches */
- int ldap_scope; /* the scope used for searches */
- int ldap_limit; /* the search limit */
- int ldap_timeout; /* the search timeout */
-
- gchar *auth_dn;
- gchar *auth_passwd;
-
- gboolean ldap_v3; /* TRUE if the server supports protocol
- revision 3 (necessary for TLS) */
- gboolean starttls; /* TRUE if the *library* supports
- starttls. will be false if openssl
- was not built into openldap. */
- PASBackendLDAPUseTLS use_tls;
-
- LDAP *ldap;
-
- GList *supported_fields;
- GList *supported_auth_methods;
-
- /* whether or not there's support for the objectclass we need
- to store all our additional fields */
- gboolean evolutionPersonSupported;
- gboolean calEntrySupported;
- gboolean evolutionPersonChecked;
-
- /* our operations */
- GHashTable *id_to_op;
- int active_ops;
- int poll_timeout;
-};
-
-struct _PASBackendLDAPCursorPrivate {
- PASBackend *backend;
- PASBook *book;
-
- GList *elements;
- long num_elements;
-};
-
-struct _PASBackendLDAPBookView {
- PASBookView *book_view;
- PASBackendLDAPPrivate *blpriv;
- gchar *search;
- int limit;
-
- LDAPOp *search_op;
-};
-
-typedef void (*LDAPOpHandler)(LDAPOp *op, LDAPMessage *res);
-typedef void (*LDAPOpDtor)(LDAPOp *op);
-
-struct LDAPOp {
- LDAPOpHandler handler;
- LDAPOpDtor dtor;
- PASBackend *backend;
- PASBook *book;
- PASBookView *view;
- int id;
-};
-
-static void ldap_op_add (LDAPOp *op, PASBackend *backend, PASBook *book,
- PASBookView *view, int id, LDAPOpHandler handler, LDAPOpDtor dtor);
-static void ldap_op_finished (LDAPOp *op);
-
-static gboolean poll_ldap (PASBackendLDAP *bl);
-
-static EContact *build_contact_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasses);
-
-static void email_populate (EContact *contact, char **values);
-struct berval** email_ber (EContact *contact);
-static gboolean email_compare (EContact *contact1, EContact *contact2);
-
-static void homephone_populate (EContact *contact, char **values);
-struct berval** homephone_ber (EContact *contact);
-static gboolean homephone_compare (EContact *contact1, EContact *contact2);
-
-static void business_populate (EContact *contact, char **values);
-struct berval** business_ber (EContact *contact);
-static gboolean business_compare (EContact *contact1, EContact *contact2);
-
-static void anniversary_populate (EContact *contact, char **values);
-struct berval** anniversary_ber (EContact *contact);
-static gboolean anniversary_compare (EContact *contact1, EContact *contact2);
-
-static void birthday_populate (EContact *contact, char **values);
-struct berval** birthday_ber (EContact *contact);
-static gboolean birthday_compare (EContact *contact1, EContact *contact2);
-
-static void category_populate (EContact *contact, char **values);
-struct berval** category_ber (EContact *contact);
-static gboolean category_compare (EContact *contact1, EContact *contact2);
-
-static void photo_populate (EContact *contact, struct berval **ber_values);
-
-struct prop_info {
- EContactField field_id;
- char *ldap_attr;
-#define PROP_TYPE_STRING 0x01
-#define PROP_TYPE_COMPLEX 0x02
-#define PROP_TYPE_BINARY 0x04
-#define PROP_DN 0x08
-#define PROP_EVOLVE 0x10
-#define PROP_WRITE_ONLY 0x20
- int prop_type;
-
- /* the remaining items are only used for the TYPE_COMPLEX props */
-
- /* used when reading from the ldap server populates EContact with the values in **values. */
- void (*populate_contact_func)(EContact *contact, char **values);
- /* used when writing to an ldap server. returns a NULL terminated array of berval*'s */
- struct berval** (*ber_func)(EContact *contact);
- /* used to compare list attributes */
- gboolean (*compare_func)(EContact *contact1, EContact *contact2);
-
- void (*binary_populate_contact_func)(EContact *contact, struct berval **ber_values);
-
-} prop_info[] = {
-
-#define BINARY_PROP(fid,a,ctor,ber,cmp) {fid, a, PROP_TYPE_BINARY, NULL, ber, cmp, ctor}
-#define COMPLEX_PROP(fid,a,ctor,ber,cmp) {fid, a, PROP_TYPE_COMPLEX, ctor, ber, cmp}
-#define E_COMPLEX_PROP(fid,a,ctor,ber,cmp) {fid, a, PROP_TYPE_COMPLEX | PROP_EVOLVE, ctor, ber, cmp}
-#define STRING_PROP(fid,a) {fid, a, PROP_TYPE_STRING}
-#define WRITE_ONLY_STRING_PROP(fid,a) {fid, a, PROP_TYPE_STRING | PROP_WRITE_ONLY}
-#define E_STRING_PROP(fid,a) {fid, a, PROP_TYPE_STRING | PROP_EVOLVE}
-
-
- /* name fields */
- STRING_PROP (E_CONTACT_FULL_NAME, "cn" ),
- WRITE_ONLY_STRING_PROP (E_CONTACT_FAMILY_NAME, "sn" ),
-
- /* email addresses */
- COMPLEX_PROP (E_CONTACT_EMAIL, "mail", email_populate, email_ber, email_compare),
-
- /* phone numbers */
- E_STRING_PROP (E_CONTACT_PHONE_PRIMARY, "primaryPhone"),
- COMPLEX_PROP (E_CONTACT_PHONE_BUSINESS, "telephoneNumber", business_populate, business_ber, business_compare),
- COMPLEX_PROP (E_CONTACT_PHONE_HOME, "homePhone", homephone_populate, homephone_ber, homephone_compare),
- STRING_PROP (E_CONTACT_PHONE_MOBILE, "mobile"),
- E_STRING_PROP (E_CONTACT_PHONE_CAR, "carPhone"),
- STRING_PROP (E_CONTACT_PHONE_BUSINESS_FAX, "facsimileTelephoneNumber"),
- E_STRING_PROP (E_CONTACT_PHONE_HOME_FAX, "homeFacsimileTelephoneNumber"),
- E_STRING_PROP (E_CONTACT_PHONE_OTHER, "otherPhone"),
- E_STRING_PROP (E_CONTACT_PHONE_OTHER_FAX, "otherFacsimileTelephoneNumber"),
- STRING_PROP (E_CONTACT_PHONE_ISDN, "internationaliSDNNumber"),
- STRING_PROP (E_CONTACT_PHONE_PAGER, "pager"),
- E_STRING_PROP (E_CONTACT_PHONE_RADIO, "radio"),
- E_STRING_PROP (E_CONTACT_PHONE_TELEX, "telex"),
- E_STRING_PROP (E_CONTACT_PHONE_ASSISTANT, "assistantPhone"),
- E_STRING_PROP (E_CONTACT_PHONE_COMPANY, "companyPhone"),
- E_STRING_PROP (E_CONTACT_PHONE_CALLBACK, "callbackPhone"),
- E_STRING_PROP (E_CONTACT_PHONE_TTYTDD, "tty"),
-
- /* org information */
- STRING_PROP (E_CONTACT_ORG, "o"),
- STRING_PROP (E_CONTACT_ORG_UNIT, "ou"),
- STRING_PROP (E_CONTACT_OFFICE, "roomNumber"),
- STRING_PROP (E_CONTACT_TITLE, "title"),
- E_STRING_PROP (E_CONTACT_ROLE, "businessRole"),
- E_STRING_PROP (E_CONTACT_MANAGER, "managerName"),
- E_STRING_PROP (E_CONTACT_ASSISTANT, "assistantName"),
-
- /* addresses */
- STRING_PROP (E_CONTACT_ADDRESS_LABEL_WORK, "postalAddress"),
- STRING_PROP (E_CONTACT_ADDRESS_LABEL_HOME, "homePostalAddress"),
- E_STRING_PROP (E_CONTACT_ADDRESS_LABEL_OTHER, "otherPostalAddress"),
-
- /* photos */
- BINARY_PROP (E_CONTACT_PHOTO, "jpegPhoto", photo_populate, NULL/*XXX*/, NULL/*XXX*/),
-
- /* misc fields */
- STRING_PROP (E_CONTACT_HOMEPAGE_URL, "labeledURI"),
- /* map nickname to displayName */
- STRING_PROP (E_CONTACT_NICKNAME, "displayName"),
- E_STRING_PROP (E_CONTACT_SPOUSE, "spouseName"),
- E_STRING_PROP (E_CONTACT_NOTE, "note"),
- E_COMPLEX_PROP (E_CONTACT_ANNIVERSARY, "anniversary", anniversary_populate, anniversary_ber, anniversary_compare),
- E_COMPLEX_PROP (E_CONTACT_BIRTH_DATE, "birthDate", birthday_populate, birthday_ber, birthday_compare),
- E_STRING_PROP (E_CONTACT_MAILER, "mailer"),
-
- E_STRING_PROP (E_CONTACT_FILE_AS, "fileAs"),
-#if notyet
- E_COMPLEX_PROP (E_CONTACT_CATEGORIES, "category", category_populate, category_ber, category_compare),
-
- STRING_PROP (E_CONTACT_CALURI, "calCalURI"),
- STRING_PROP (E_CONTACT_FBURL, "calFBURL"),
- STRING_PROP (E_CONTACT_ICSCALENDAR, "icsCalendar"),
-#endif
-
-#undef E_STRING_PROP
-#undef STRING_PROP
-#undef E_COMPLEX_PROP
-#undef COMPLEX_PROP
-};
-
-static int num_prop_infos = sizeof(prop_info) / sizeof(prop_info[0]);
-
-#if 0
-static void
-remove_view (int msgid, LDAPOp *op, PASBookView *view)
-{
- if (op->view == view)
- op->view = NULL;
-}
-
-static void
-view_destroy(gpointer data, GObject *where_object_was)
-{
- PASBook *book = (PASBook *)data;
- PASBackendLDAP *bl;
- EIterator *iter;
-
- bl = PAS_BACKEND_LDAP(pas_book_get_backend(book));
-
- iter = e_list_get_iterator (bl->priv->book_views);
-
- while (e_iterator_is_valid (iter)) {
- PASBackendLDAPBookView *view = (PASBackendLDAPBookView*)e_iterator_get (iter);
-
- if (view->book_view == (PASBookView*)where_object_was) {
- GNOME_Evolution_Addressbook_Book corba_book;
- CORBA_Environment ev;
-
- /* if we have an active search, interrupt it */
- if (view->search_op) {
- ldap_op_finished (view->search_op);
- }
- /* and remove us as the view for any other
- operations that might be using us to spew
- status messages to the gui */
- g_hash_table_foreach (bl->priv->id_to_op, (GHFunc)remove_view, view->book_view);
-
- /* free up the view structure */
- g_free (view->search);
- g_free (view);
-
- /* and remove it from our list */
- e_iterator_delete (iter);
-
- /* unref the book now */
- corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
-
- CORBA_exception_init(&ev);
-
- GNOME_Evolution_Addressbook_Book_unref(corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("view_destroy: Exception unreffing "
- "corba book.\n");
- }
-
- CORBA_exception_free(&ev);
- break;
- }
-
- e_iterator_next (iter);
- }
-
- g_object_unref (iter);
-
-}
-#endif
-
-static void
-book_view_notify_status (PASBookView *view, const char *status)
-{
- if (!view)
- return;
- pas_book_view_notify_status_message (view, status);
-}
-
-static PASBookView*
-find_book_view (PASBackendLDAP *bl)
-{
-#if 0
- EIterator *iter = e_list_get_iterator (bl->priv->book_views);
- PASBookView *rv = NULL;
-
- if (e_iterator_is_valid (iter)) {
- /* just always use the first book view */
- PASBackendLDAPBookView *v = (PASBackendLDAPBookView*)e_iterator_get(iter);
- if (v)
- rv = v->book_view;
- }
-
- g_object_unref (iter);
-
- return rv;
-#endif
-}
-
-static void
-add_to_supported_fields (PASBackendLDAP *bl, char **attrs, GHashTable *attr_hash)
-{
- int i;
- for (i = 0; attrs[i]; i ++) {
- char *query_prop = g_hash_table_lookup (attr_hash, g_strdup (attrs[i]));
-
- if (query_prop) {
- bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (query_prop));
-
- /* handle the list attributes here */
- if (!strcmp (query_prop, "email")) {
- bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup ("email_2"));
- bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup ("email_3"));
- }
- else if (!strcmp (query_prop, "business_phone")) {
- bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup ("business_phone_2"));
- }
- else if (!strcmp (query_prop, "home_phone")) {
- bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup ("home_phone_2"));
- }
- }
- }
-}
-
-static void
-add_oc_attributes_to_supported_fields (PASBackendLDAP *bl, LDAPObjectClass *oc)
-{
- int i;
- GHashTable *attr_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- for (i = 0; i < num_prop_infos; i ++)
- g_hash_table_insert (attr_hash, prop_info[i].ldap_attr, (char*)e_contact_field_name (prop_info[i].field_id));
-
- if (oc->oc_at_oids_must)
- add_to_supported_fields (bl, oc->oc_at_oids_must, attr_hash);
-
- if (oc->oc_at_oids_may)
- add_to_supported_fields (bl, oc->oc_at_oids_may, attr_hash);
-
- g_hash_table_destroy (attr_hash);
-}
-
-static void
-check_schema_support (PASBackendLDAP *bl)
-{
- char *attrs[2];
- LDAPMessage *resp;
- LDAP *ldap = bl->priv->ldap;
- struct timeval timeout;
-
- if (!bl->priv->schema_dn)
- return;
-
- bl->priv->evolutionPersonChecked = TRUE;
-
- attrs[0] = "objectClasses";
- attrs[1] = NULL;
-
- timeout.tv_sec = 30;
- timeout.tv_usec = 0;
-
- if (ldap_search_ext_s (ldap, bl->priv->schema_dn, LDAP_SCOPE_BASE,
- "(objectClass=subschema)", attrs, 0,
- NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp) == LDAP_SUCCESS) {
- char **values;
-
- values = ldap_get_values (ldap, resp, "objectClasses");
-
- if (values) {
- int i;
- for (i = 0; values[i]; i ++) {
- int j;
- int code;
- const char *err;
- LDAPObjectClass *oc = ldap_str2objectclass (values[i], &code, &err, 0);
-
- if (!oc)
- continue;
-
- for (j = 0; oc->oc_names[j]; j++)
- if (!g_ascii_strcasecmp (oc->oc_names[j], EVOLUTIONPERSON)) {
- g_print ("support found on ldap server for objectclass evolutionPerson\n");
- bl->priv->evolutionPersonSupported = TRUE;
-
- add_oc_attributes_to_supported_fields (bl, oc);
- }
- else if (!g_ascii_strcasecmp (oc->oc_names[j], CALENTRY)) {
- g_print ("support found on ldap server for objectclass calEntry\n");
- bl->priv->calEntrySupported = TRUE;
- add_oc_attributes_to_supported_fields (bl, oc);
- }
- else if (!g_ascii_strcasecmp (oc->oc_names[j], INETORGPERSON)
- || !g_ascii_strcasecmp (oc->oc_names[j], ORGANIZATIONALPERSON)
- || !g_ascii_strcasecmp (oc->oc_names[j], PERSON)) {
- add_oc_attributes_to_supported_fields (bl, oc);
- }
-
- ldap_objectclass_free (oc);
- }
-
- ldap_value_free (values);
- }
- else {
- /* the reason for this is so that if the user
- ends up authenticating to the ldap server,
- we will requery for the subschema values.
- This makes it a bit more robust in the face
- of draconian acl's that keep subschema
- reads from working until the user is
- authed. */
- if (!pas_backend_is_writable (PAS_BACKEND (bl))) {
- g_warning ("subschema read returned nothing before successful auth");
- bl->priv->evolutionPersonChecked = FALSE;
- }
- else {
- g_warning ("subschema read returned nothing after successful auth");
- }
- }
-
- ldap_msgfree (resp);
- }
-}
-
-static void
-get_ldap_library_info ()
-{
- LDAPAPIInfo info;
- LDAP *ldap;
-
- if (LDAP_SUCCESS != ldap_create (&ldap)) {
- g_warning ("couldn't create LDAP* for getting at the client lib api info");
- return;
- }
-
- info.ldapai_info_version = LDAP_API_INFO_VERSION;
-
- if (LDAP_OPT_SUCCESS != ldap_get_option (ldap, LDAP_OPT_API_INFO, &info)) {
- g_warning ("couldn't get ldap api info");
- }
- else {
- int i;
- g_message ("libldap vendor/version: %s %2d.%02d.%02d",
- info.ldapai_vendor_name,
- info.ldapai_vendor_version / 10000,
- (info.ldapai_vendor_version % 10000) / 1000,
- info.ldapai_vendor_version % 1000);
-
- g_message ("extensions present:");
- /* yuck. we have to free these? */
- for (i = 0; info.ldapai_extensions[i]; i++) {
- char *extension = info.ldapai_extensions[i];
- g_message (extension);
- ldap_memfree (extension);
- }
- ldap_memfree (info.ldapai_extensions);
- ldap_memfree (info.ldapai_vendor_name);
- }
-
- ldap_unbind_ext_s (ldap, NULL, NULL);
-}
-
-static int
-query_ldap_root_dse (PASBackendLDAP *bl)
-{
-#define MAX_DSE_ATTRS 20
- LDAP *ldap = bl->priv->ldap;
- LDAPMessage *resp;
- int ldap_error;
- char *attrs[MAX_DSE_ATTRS], **values;
- int i = 0;
- struct timeval timeout;
-
- attrs[i++] = "supportedControl";
- attrs[i++] = "supportedExtension";
- attrs[i++] = "supportedFeatures";
- attrs[i++] = "supportedSASLMechanisms";
- attrs[i++] = "supportedLDAPVersion";
- attrs[i++] = "subschemaSubentry"; /* OpenLDAP's dn for schema information */
- attrs[i++] = "schemaNamingContext"; /* Active directory's dn for schema information */
- attrs[i] = NULL;
-
- timeout.tv_sec = 30;
- timeout.tv_usec = 0;
-
- ldap_error = ldap_search_ext_s (ldap,
- LDAP_ROOT_DSE, LDAP_SCOPE_BASE,
- "(objectclass=*)",
- attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp);
- if (ldap_error != LDAP_SUCCESS) {
- g_warning ("could not perform query on Root DSE (ldap_error 0x%02x)", ldap_error);
- return ldap_error;
- }
-
- values = ldap_get_values (ldap, resp, "supportedControl");
- if (values) {
- for (i = 0; values[i]; i++)
- g_message ("supported server control: %s", values[i]);
- ldap_value_free (values);
- }
-
- values = ldap_get_values (ldap, resp, "supportedExtension");
- if (values) {
- for (i = 0; values[i]; i++) {
- g_message ("supported server extension: %s", values[i]);
- if (!strcmp (values[i], LDAP_EXOP_START_TLS)) {
- g_message ("server reports LDAP_EXOP_START_TLS");
- }
- }
- ldap_value_free (values);
- }
-
- values = ldap_get_values (ldap, resp, "supportedSASLMechanisms");
- if (values) {
- char *auth_method;
- if (bl->priv->supported_auth_methods) {
- g_list_foreach (bl->priv->supported_auth_methods, (GFunc)g_free, NULL);
- g_list_free (bl->priv->supported_auth_methods);
- }
- bl->priv->supported_auth_methods = NULL;
-
- auth_method = g_strdup_printf ("ldap/simple-binddn|%s", _("Using Distinguished Name (DN)"));
- bl->priv->supported_auth_methods = g_list_append (bl->priv->supported_auth_methods, auth_method);
-
- auth_method = g_strdup_printf ("ldap/simple-email|%s", _("Using Email Address"));
- bl->priv->supported_fields = g_list_append (bl->priv->supported_auth_methods, auth_method);
-
- for (i = 0; values[i]; i++) {
- auth_method = g_strdup_printf ("sasl/%s|%s", values[i], values[i]);
- bl->priv->supported_fields = g_list_append (bl->priv->supported_auth_methods, auth_method);
- g_message ("supported SASL mechanism: %s", values[i]);
- }
- ldap_value_free (values);
- }
-
-
- values = ldap_get_values (ldap, resp, "subschemaSubentry");
- if (!values || !values[0]) {
- if (values) ldap_value_free (values);
- values = ldap_get_values (ldap, resp, "schemaNamingContext");
- }
- if (values && values[0]) {
- g_free (bl->priv->schema_dn);
- bl->priv->schema_dn = g_strdup (values[0]);
- }
- else {
- g_warning ("could not determine location of schema information on LDAP server");
- }
- if (values)
- ldap_value_free (values);
-
- ldap_msgfree (resp);
-
- return LDAP_SUCCESS;
-}
-
-static GNOME_Evolution_Addressbook_CallStatus
-pas_backend_ldap_connect (PASBackendLDAP *bl)
-{
- PASBackendLDAPPrivate *blpriv = bl->priv;
-
- /* close connection first if it's open first */
- if (blpriv->ldap)
- ldap_unbind_ext (blpriv->ldap, NULL, NULL);
-
- blpriv->ldap = ldap_init (blpriv->ldap_host, blpriv->ldap_port);
-#if defined (DEBUG) && defined (LDAP_OPT_DEBUG_LEVEL)
- {
- int debug_level = 4;
- ldap_set_option (blpriv->ldap, LDAP_OPT_DEBUG_LEVEL, &debug_level);
- }
-#endif
-
- if (NULL != blpriv->ldap) {
- int ldap_error;
-
- if (bl->priv->use_tls != PAS_BACKEND_LDAP_TLS_NO) {
- int protocol_version = LDAP_VERSION3;
- ldap_error = ldap_set_option (blpriv->ldap, LDAP_OPT_PROTOCOL_VERSION, &protocol_version);
- if (LDAP_OPT_SUCCESS != ldap_error) {
- g_warning ("failed to set protocol version to LDAPv3");
- bl->priv->ldap_v3 = FALSE;
- }
- else
- bl->priv->ldap_v3 = TRUE;
-
- if (!bl->priv->ldap_v3 && bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
- g_message ("TLS not available (fatal version), v3 protocol could not be established (ldap_error 0x%02x)", ldap_error);
- ldap_unbind (blpriv->ldap);
- blpriv->ldap = NULL;
- return GNOME_Evolution_Addressbook_TLSNotAvailable;
- }
-
- if (bl->priv->ldap_port == LDAPS_PORT && bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
- int tls_level = LDAP_OPT_X_TLS_HARD;
- ldap_set_option (blpriv->ldap, LDAP_OPT_X_TLS, &tls_level);
- }
- else if (bl->priv->use_tls) {
- ldap_error = ldap_start_tls_s (blpriv->ldap, NULL, NULL);
- if (LDAP_SUCCESS != ldap_error) {
- if (bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
- g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", ldap_error);
- ldap_unbind (blpriv->ldap);
- blpriv->ldap = NULL;
- return GNOME_Evolution_Addressbook_TLSNotAvailable;
- }
- else {
- g_message ("TLS not available (ldap_error 0x%02x)", ldap_error);
- }
- }
- else
- g_message ("TLS active");
- }
- }
-
- /* bind anonymously initially, we'll actually
- authenticate the user properly later (in
- authenticate_user) if they've selected
- authentication */
- ldap_error = ldap_simple_bind_s (blpriv->ldap, NULL, NULL);
- if (ldap_error == LDAP_SERVER_DOWN) {
- /* we only want this to be fatal if the server is down. */
- g_warning ("failed to bind anonymously while connecting (ldap_error 0x%02x)", ldap_error);
- return GNOME_Evolution_Addressbook_RepositoryOffline;
- }
-
- ldap_error = query_ldap_root_dse (bl);
- /* query_ldap_root_dse will cause the actual
- connect(), so any tcpip problems will show up
- here */
-
- /* we can't just check for LDAP_SUCCESS here since in
- older servers (namely openldap1.x servers), there's
- not a root DSE at all, so the query will fail with
- LDAP_NO_SUCH_OBJECT. */
- if (ldap_error == LDAP_SUCCESS || LDAP_NAME_ERROR (ldap_error)) {
- blpriv->connected = TRUE;
-
- /* check to see if evolutionPerson is supported, if we can (me
- might not be able to if we can't authenticate. if we
- can't, try again in auth_user.) */
- if (!bl->priv->evolutionPersonChecked)
- check_schema_support (bl);
-
- pas_backend_set_is_loaded (PAS_BACKEND (bl), TRUE);
- return GNOME_Evolution_Addressbook_Success;
- }
- else
- g_warning ("Failed to perform root dse query anonymously, (ldap_error 0x%02x)", ldap_error);
- }
-
- g_warning ("pas_backend_ldap_connect failed for "
- "'ldap://%s:%d/%s'\n",
- blpriv->ldap_host,
- blpriv->ldap_port,
- blpriv->ldap_rootdn ? blpriv->ldap_rootdn : "");
- blpriv->connected = FALSE;
- return GNOME_Evolution_Addressbook_RepositoryOffline;
-}
-
-static gboolean
-pas_backend_ldap_reconnect (PASBackendLDAP *bl, PASBookView *book_view, int ldap_status)
-{
- /* we need to reconnect if we were previously connected */
- if (bl->priv->connected && ldap_status == LDAP_SERVER_DOWN) {
- GNOME_Evolution_Addressbook_CallStatus status;
- int ldap_error = LDAP_SUCCESS;
-
- book_view_notify_status (book_view, _("Reconnecting to LDAP server..."));
-
- status = pas_backend_ldap_connect (bl);
-
- if (status != GNOME_Evolution_Addressbook_Success) {
- book_view_notify_status (book_view, "");
- return FALSE;
- }
-
- if (bl->priv->auth_dn)
- ldap_error = ldap_simple_bind_s(bl->priv->ldap,
- bl->priv->auth_dn,
- bl->priv->auth_passwd);
- book_view_notify_status (book_view, "");
- return (ldap_error == LDAP_SUCCESS);
- }
- else {
- return FALSE;
- }
-}
-
-static void
-ldap_op_add (LDAPOp *op, PASBackend *backend,
- PASBook *book, PASBookView *view,
- int id,
- LDAPOpHandler handler, LDAPOpDtor dtor)
-{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
-
- op->backend = backend;
- op->book = book;
- op->view = view;
- op->id = id;
- op->handler = handler;
- op->dtor = dtor;
-
- if (g_hash_table_lookup (bl->priv->id_to_op, &op->id)) {
- g_warning ("conflicting ldap msgid's");
- }
-
- g_hash_table_insert (bl->priv->id_to_op,
- &op->id, op);
-
- bl->priv->active_ops ++;
-
- if (bl->priv->poll_timeout == -1)
- bl->priv->poll_timeout = g_timeout_add (LDAP_POLL_INTERVAL,
- (GSourceFunc) poll_ldap,
- bl);
-}
-
-static void
-ldap_op_finished (LDAPOp *op)
-{
- PASBackend *backend = op->backend;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
-
- g_hash_table_remove (bl->priv->id_to_op, &op->id);
-
- /* should handle errors here */
- ldap_abandon (bl->priv->ldap, op->id);
-
- op->dtor (op);
-
- bl->priv->active_ops--;
-
- if (bl->priv->active_ops == 0) {
- if (bl->priv->poll_timeout != -1)
- g_source_remove (bl->priv->poll_timeout);
- bl->priv->poll_timeout = -1;
- }
-}
-
-static void
-ldap_op_change_id (LDAPOp *op, int msg_id)
-{
- PASBackend *backend = op->backend;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
-
- g_hash_table_remove (bl->priv->id_to_op, &op->id);
-
- op->id = msg_id;
-
- g_hash_table_insert (bl->priv->id_to_op,
- &op->id, op);
-}
-
-static int
-ldap_error_to_response (int ldap_error)
-{
- if (ldap_error == LDAP_SUCCESS)
- return GNOME_Evolution_Addressbook_Success;
- else if (LDAP_NAME_ERROR (ldap_error))
- return GNOME_Evolution_Addressbook_ContactNotFound;
- else if (ldap_error == LDAP_INSUFFICIENT_ACCESS)
- return GNOME_Evolution_Addressbook_PermissionDenied;
- else if (ldap_error == LDAP_SERVER_DOWN)
- return GNOME_Evolution_Addressbook_RepositoryOffline;
- else if (ldap_error == LDAP_ALREADY_EXISTS)
- return GNOME_Evolution_Addressbook_ContactIdAlreadyExists;
- else
- return GNOME_Evolution_Addressbook_OtherError;
-}
-
-
-static char *
-create_dn_from_contact (EContact *contact, const char *root_dn)
-{
- char *cn, *cn_part = NULL;
- char *dn;
-
- cn = e_contact_get (contact, E_CONTACT_FULL_NAME);
- if (cn) {
- if (strchr (cn, ',')) {
- /* need to escape commas */
- char *new_cn = g_malloc0 (strlen (cn) * 3 + 1);
- int i, j;
-
- for (i = 0, j = 0; i < strlen (cn); i ++) {
- if (cn[i] == ',') {
- sprintf (new_cn + j, "%%%02X", cn[i]);
- j += 3;
- }
- else {
- new_cn[j++] = cn[i];
- }
- }
- cn_part = g_strdup_printf ("cn=%s", new_cn);
- g_free (new_cn);
- }
- else {
- cn_part = g_strdup_printf ("cn=%s", cn);
- }
- }
- else {
- cn_part = g_strdup ("");
- }
-
- dn = g_strdup_printf ("%s%s%s", cn_part,
- (root_dn && strlen(root_dn)) ? "," : "",
- (root_dn && strlen(root_dn)) ? root_dn: "");
-
- g_free (cn_part);
-
- g_print ("generated dn: %s\n", dn);
-
- return dn;
-}
-
-static void
-free_mods (GPtrArray *mods)
-{
- int i = 0;
- LDAPMod *mod;
-
- while ((mod = g_ptr_array_index (mods, i++))) {
- int j;
- g_free (mod->mod_type);
-
- if (mod->mod_op & LDAP_MOD_BVALUES) {
- for (j = 0; mod->mod_bvalues[j]; j++) {
- g_free (mod->mod_bvalues[j]->bv_val);
- g_free (mod->mod_bvalues[j]);
- }
- }
- else {
- for (j = 0; mod->mod_values[j]; j++)
- g_free (mod->mod_values[j]);
- }
- g_free (mod);
- }
-
- g_ptr_array_free (mods, TRUE);
-}
-
-static GPtrArray*
-build_mods_from_contacts (PASBackendLDAP *bl, EContact *current, EContact *new, gboolean *new_dn_needed)
-{
- gboolean adding = (current == NULL);
- GPtrArray *result = g_ptr_array_new();
- int i;
-
- if (new_dn_needed)
- *new_dn_needed = FALSE;
-
- /* we walk down the list of properties we can deal with (that
- big table at the top of the file) */
-
- for (i = 0; i < num_prop_infos; i ++) {
- gboolean include;
- gboolean new_prop_present = FALSE;
- gboolean current_prop_present = FALSE;
- struct berval** new_prop_bers = NULL;
- char *new_prop = NULL;
- char *current_prop = NULL;
-
- /* XXX if it's an evolutionPerson prop and the ldap
- server doesn't support that objectclass, skip it. */
- if (prop_info[i].prop_type & PROP_EVOLVE && !bl->priv->evolutionPersonSupported)
- continue;
-
- /* get the value for the new contact, and compare it to
- the value in the current contact to see if we should
- update it -- if adding is TRUE, short circuit the
- check. */
- if (prop_info[i].prop_type & PROP_TYPE_STRING) {
- new_prop = e_contact_get (new, prop_info[i].field_id);
- new_prop_present = (new_prop != NULL);
- }
- else {
- new_prop_bers = prop_info[i].ber_func (new);
- new_prop_present = (new_prop_bers != NULL);
- }
-
- /* need to set INCLUDE to true if the field needs to
- show up in the ldap modify request */
- if (adding) {
- /* if we're creating a new contact, include it if the
- field is there at all */
- if (prop_info[i].prop_type & PROP_TYPE_STRING)
- include = (new_prop_present && *new_prop); /* empty strings cause problems */
- else
- include = new_prop_present;
- }
- else {
- /* if we're modifying an existing contact,
- include it if the current field value is
- different than the new one, if it didn't
- exist previously, or if it's been
- removed. */
- if (prop_info[i].prop_type & PROP_TYPE_STRING) {
- current_prop = e_contact_get (current, prop_info[i].field_id);
- current_prop_present = (current_prop != NULL);
-
- if (new_prop && current_prop)
- include = *new_prop && strcmp (new_prop, current_prop);
- else
- include = (!!new_prop != !!current_prop);
- }
- else {
- int j;
- struct berval **current_prop_bers = prop_info[i].ber_func (current);
-
- current_prop_present = (current_prop_bers != NULL);
-
- /* free up the current_prop_bers */
- if (current_prop_bers) {
- for (j = 0; current_prop_bers[j]; j++) {
- g_free (current_prop_bers[j]->bv_val);
- g_free (current_prop_bers[j]);
- }
- g_free (current_prop_bers);
- }
-
- include = !prop_info[i].compare_func (new, current);
- }
- }
-
- if (include) {
- LDAPMod *mod = g_new (LDAPMod, 1);
-
- /* the included attribute has changed - we
- need to update the dn if it's one of the
- attributes we compute the dn from. */
- if (new_dn_needed)
- *new_dn_needed |= prop_info[i].prop_type & PROP_DN;
-
- if (adding) {
- mod->mod_op = LDAP_MOD_ADD;
- }
- else {
- if (!new_prop_present)
- mod->mod_op = LDAP_MOD_DELETE;
- else if (!current_prop_present)
- mod->mod_op = LDAP_MOD_ADD;
- else
- mod->mod_op = LDAP_MOD_REPLACE;
- }
-
- mod->mod_type = g_strdup (prop_info[i].ldap_attr);
-
- if (prop_info[i].prop_type & PROP_TYPE_STRING) {
- mod->mod_values = g_new (char*, 2);
- mod->mod_values[0] = new_prop;
- mod->mod_values[1] = NULL;
- }
- else { /* PROP_TYPE_COMPLEX */
- mod->mod_op |= LDAP_MOD_BVALUES;
- mod->mod_bvalues = new_prop_bers;
- }
-
- g_ptr_array_add (result, mod);
- }
-
- }
-
- /* NULL terminate the list of modifications */
- g_ptr_array_add (result, NULL);
-
- return result;
-}
-
-static void
-add_objectclass_mod (PASBackendLDAP *bl, GPtrArray *mod_array, GList *existing_objectclasses)
-{
-#define FIND_INSERT(oc) \
- if (!g_list_find_custom (existing_objectclasses, (oc), (GCompareFunc)g_ascii_strcasecmp)) \
- g_ptr_array_add (objectclasses, g_strdup ((oc)))
-#define INSERT(oc) \
- g_ptr_array_add (objectclasses, g_strdup ((oc)))
-
- LDAPMod *objectclass_mod;
- GPtrArray *objectclasses = g_ptr_array_new();
-
- if (existing_objectclasses) {
- objectclass_mod = g_new (LDAPMod, 1);
- objectclass_mod->mod_op = LDAP_MOD_ADD;
- objectclass_mod->mod_type = g_strdup ("objectClass");
-
- /* yes, this is a linear search for each of our
- objectclasses, but really, how many objectclasses
- are there going to be in any sane ldap entry? */
- FIND_INSERT (TOP);
- FIND_INSERT (PERSON);
- FIND_INSERT (ORGANIZATIONALPERSON);
- FIND_INSERT (INETORGPERSON);
- if (bl->priv->calEntrySupported)
- FIND_INSERT (CALENTRY);
- if (bl->priv->evolutionPersonSupported)
- FIND_INSERT (EVOLUTIONPERSON);
-
- if (objectclasses->len) {
- g_ptr_array_add (objectclasses, NULL);
- objectclass_mod->mod_values = (char**)objectclasses->pdata;
- g_ptr_array_add (mod_array, objectclass_mod);
- g_ptr_array_free (objectclasses, FALSE);
- }
- else {
- g_ptr_array_free (objectclasses, TRUE);
- g_free (objectclass_mod->mod_type);
- g_free (objectclass_mod);
- }
-
- }
- else {
- objectclass_mod = g_new (LDAPMod, 1);
- objectclass_mod->mod_op = LDAP_MOD_ADD;
- objectclass_mod->mod_type = g_strdup ("objectClass");
-
- INSERT(TOP);
- INSERT(PERSON);
- INSERT(ORGANIZATIONALPERSON);
- INSERT(INETORGPERSON);
- if (bl->priv->calEntrySupported)
- INSERT(CALENTRY);
- if (bl->priv->evolutionPersonSupported)
- INSERT(EVOLUTIONPERSON);
- g_ptr_array_add (objectclasses, NULL);
- objectclass_mod->mod_values = (char**)objectclasses->pdata;
- g_ptr_array_add (mod_array, objectclass_mod);
- g_ptr_array_free (objectclasses, FALSE);
- }
-}
-
-typedef struct {
- LDAPOp op;
- char *dn;
- EContact *new_contact;
-} LDAPCreateOp;
-
-static void
-create_contact_handler (LDAPOp *op, LDAPMessage *res)
-{
- LDAPCreateOp *create_op = (LDAPCreateOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- EContact *contact;
- int ldap_error;
- int response;
-
- if (LDAP_RES_ADD != ldap_msgtype (res)) {
- g_warning ("incorrect msg type %d passed to create_contact_handler", ldap_msgtype (res));
- pas_book_respond_create (op->book,
- GNOME_Evolution_Addressbook_OtherError,
- NULL);
- ldap_op_finished (op);
- return;
- }
-
- ldap_parse_result (ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
-
- /* and lastly respond */
- response = ldap_error_to_response (ldap_error);
- pas_book_respond_create (op->book,
- response,
- create_op->new_contact);
-
- ldap_op_finished (op);
-}
-
-static void
-create_contact_dtor (LDAPOp *op)
-{
- LDAPCreateOp *create_op = (LDAPCreateOp*)op;
-
- g_free (create_op->dn);
- g_object_unref (create_op->new_contact);
- g_free (create_op);
-}
-
-static void
-pas_backend_ldap_process_create_contact (PASBackend *backend,
- PASBook *book,
- const char *vcard)
-{
- LDAPCreateOp *create_op = g_new (LDAPCreateOp, 1);
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- PASBookView *book_view;
- int create_contact_msgid;
- int response;
- int err;
- GPtrArray *mod_array;
- LDAPMod **ldap_mods;
- LDAP *ldap;
-
- book_view = find_book_view (bl);
-
- printf ("vcard = %s\n", vcard);
-
- create_op->new_contact = e_contact_new_from_vcard (vcard);
-
- create_op->dn = create_dn_from_contact (create_op->new_contact, bl->priv->ldap_rootdn);
- e_contact_set (create_op->new_contact, E_CONTACT_UID, create_op->dn);
-
- ldap = bl->priv->ldap;
-
- /* build our mods */
- mod_array = build_mods_from_contacts (bl, NULL, create_op->new_contact, NULL);
-
-#if 0
- if (!mod_array) {
- /* there's an illegal field in there. report
- UnsupportedAttribute back */
- pas_book_respond_create (book,
- GNOME_Evolution_Addressbook_BookListener_UnsupportedField,
- NULL);
-
- g_free (create_op->dn);
- g_object_unref (create_op->new_contact);
- g_free (create_op);
- return;
- }
-#endif
-
- /* remove the NULL at the end */
- g_ptr_array_remove (mod_array, NULL);
-
- /* add our objectclass(es) */
- add_objectclass_mod (bl, mod_array, NULL);
-
- /* then put the NULL back */
- g_ptr_array_add (mod_array, NULL);
-
-#ifdef LDAP_DEBUG_ADD
- {
- int i;
- printf ("Sending the following to the server as ADD\n");
-
- for (i = 0; g_ptr_array_index(mod_array, i); i ++) {
- LDAPMod *mod = g_ptr_array_index(mod_array, i);
- if (mod->mod_op & LDAP_MOD_DELETE)
- printf ("del ");
- else if (mod->mod_op & LDAP_MOD_REPLACE)
- printf ("rep ");
- else
- printf ("add ");
- if (mod->mod_op & LDAP_MOD_BVALUES)
- printf ("ber ");
- else
- printf (" ");
-
- printf (" %s:\n", mod->mod_type);
-
- if (mod->mod_op & LDAP_MOD_BVALUES) {
- int j;
- for (j = 0; mod->mod_bvalues[j] && mod->mod_bvalues[j]->bv_val; j++)
- printf ("\t\t'%s'\n", mod->mod_bvalues[j]->bv_val);
- }
- else {
- int j;
-
- for (j = 0; mod->mod_values[j]; j++)
- printf ("\t\t'%s'\n", mod->mod_values[j]);
- }
- }
- }
-#endif
-
- ldap_mods = (LDAPMod**)mod_array->pdata;
-
- do {
- book_view_notify_status (book_view, _("Adding contact to LDAP server..."));
-
- err = ldap_add_ext (ldap, create_op->dn, ldap_mods,
- NULL, NULL, &create_contact_msgid);
-
- } while (pas_backend_ldap_reconnect (bl, book_view, err));
-
- /* and clean up */
- free_mods (mod_array);
-
- if (LDAP_SUCCESS != err) {
- response = ldap_error_to_response (err);
- pas_book_respond_create (create_op->op.book,
- response,
- NULL);
- create_contact_dtor ((LDAPOp*)create_op);
- return;
- }
- else {
- g_print ("ldap_add_ext returned %d\n", err);
- ldap_op_add ((LDAPOp*)create_op, backend, book,
- book_view, create_contact_msgid,
- create_contact_handler, create_contact_dtor);
- }
-}
-
-
-typedef struct {
- LDAPOp op;
- char *id;
-} LDAPRemoveOp;
-
-static void
-remove_contact_handler (LDAPOp *op, LDAPMessage *res)
-{
- LDAPRemoveOp *remove_op = (LDAPRemoveOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- int ldap_error;
- GList *ids = NULL;
-
- if (LDAP_RES_DELETE != ldap_msgtype (res)) {
- g_warning ("incorrect msg type %d passed to remove_contact_handler", ldap_msgtype (res));
- pas_book_respond_remove_contacts (op->book,
- GNOME_Evolution_Addressbook_OtherError,
- NULL);
- ldap_op_finished (op);
- return;
- }
-
- ldap_parse_result (bl->priv->ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
-
- ids = g_list_append (ids, remove_op->id);
- pas_book_respond_remove_contacts (remove_op->op.book,
- ldap_error_to_response (ldap_error),
- ids);
- g_list_free (ids);
-}
-
-static void
-remove_contact_dtor (LDAPOp *op)
-{
- LDAPRemoveOp *remove_op = (LDAPRemoveOp*)op;
-
- g_free (remove_op->id);
- g_free (remove_op);
-}
-
-static void
-pas_backend_ldap_process_remove_contacts (PASBackend *backend,
- PASBook *book,
- GList *ids)
-{
- LDAPRemoveOp *remove_op = g_new (LDAPRemoveOp, 1);
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- PASBookView *book_view;
- int remove_msgid;
- int ldap_error;
-
- book_view = find_book_view (bl);
-
- /*
- ** since we didn't pass "bulk-removes" in our static
- ** capabilities, we should only get 1 length lists here, so
- ** the id we're deleting is the first and only id in the list.
- */
- remove_op->id = g_strdup (ids->data);
-
- do {
- book_view_notify_status (book_view, _("Removing contact from LDAP server..."));
-
- ldap_error = ldap_delete_ext (bl->priv->ldap,
- remove_op->id,
- NULL, NULL, &remove_msgid);
- } while (pas_backend_ldap_reconnect (bl, book_view, ldap_error));
-
- if (ldap_error != LDAP_SUCCESS) {
- pas_book_respond_remove_contacts (remove_op->op.book,
- ldap_error_to_response (ldap_error),
- NULL);
- remove_contact_dtor ((LDAPOp*)remove_op);
- return;
- }
- else {
- g_print ("ldap_delete_ext returned %d\n", ldap_error);
- ldap_op_add ((LDAPOp*)remove_op, backend, book,
- book_view, remove_msgid,
- remove_contact_handler, remove_contact_dtor);
- }
-}
-
-
-/*
-** MODIFY
-**
-** The modification request is actually composed of 2 separate
-** requests. Since we need to get a list of theexisting objectclasses
-** used by the ldap server for the entry, and since the UI only sends
-** us the current contact, we need to query the ldap server for the
-** existing contact.
-**
-*/
-
-typedef struct {
- LDAPOp op;
- const char *id; /* the id of the contact we're modifying */
- EContact *current_contact;
- EContact *contact;
- GList *existing_objectclasses;
-} LDAPModifyOp;
-
-static void
-modify_contact_modify_handler (LDAPOp *op, LDAPMessage *res)
-{
- LDAPModifyOp *modify_op = (LDAPModifyOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- int ldap_error;
-
- if (LDAP_RES_MODIFY != ldap_msgtype (res)) {
- g_warning ("incorrect msg type %d passed to modify_contact_handler", ldap_msgtype (res));
- pas_book_respond_modify (op->book,
- GNOME_Evolution_Addressbook_OtherError,
- NULL);
- ldap_op_finished (op);
- return;
- }
-
- ldap_parse_result (ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
-
- /* and lastly respond */
- pas_book_respond_modify (op->book,
- ldap_error_to_response (ldap_error),
- modify_op->contact);
- ldap_op_finished (op);
-}
-
-static void
-modify_contact_search_handler (LDAPOp *op, LDAPMessage *res)
-{
- LDAPModifyOp *modify_op = (LDAPModifyOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- int msg_type;
-
- /* if it's successful, we should get called with a
- RES_SEARCH_ENTRY and a RES_SEARCH_RESULT. if it's
- unsuccessful, we should only see a RES_SEARCH_RESULT */
-
- msg_type = ldap_msgtype (res);
- if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- LDAPMessage *e = ldap_first_entry(ldap, res);
-
- if (!e) {
- g_warning ("uh, this shouldn't happen");
- pas_book_respond_modify (op->book,
- GNOME_Evolution_Addressbook_OtherError,
- NULL);
- ldap_op_finished (op);
- return;
- }
-
- modify_op->current_contact = build_contact_from_entry (ldap, e,
- &modify_op->existing_objectclasses);
- }
- else if (msg_type == LDAP_RES_SEARCH_RESULT) {
- int ldap_error;
- LDAPMod **ldap_mods;
- GPtrArray *mod_array;
- gboolean differences;
- gboolean need_new_dn;
- int modify_contact_msgid;
-
- /* grab the result code, and set up the actual modify
- if it was successful */
- ldap_parse_result (bl->priv->ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
-
- if (ldap_error != LDAP_SUCCESS) {
- /* more here i'm sure */
- pas_book_respond_modify (op->book,
- ldap_error_to_response (ldap_error),
- NULL);
- ldap_op_finished (op);
- return;
- }
-
- /* build our mods */
- mod_array = build_mods_from_contacts (bl, modify_op->current_contact, modify_op->contact, &need_new_dn);
- differences = mod_array->len > 0;
-
- if (differences) {
- /* remove the NULL at the end */
- g_ptr_array_remove (mod_array, NULL);
-
- /* add our objectclass(es), making sure
- evolutionPerson is there if it's supported */
- add_objectclass_mod (bl, mod_array, modify_op->existing_objectclasses);
-
- /* then put the NULL back */
- g_ptr_array_add (mod_array, NULL);
-
- ldap_mods = (LDAPMod**)mod_array->pdata;
-
- /* actually perform the ldap modify */
- ldap_error = ldap_modify_ext (ldap, modify_op->id, ldap_mods,
- NULL, NULL, &modify_contact_msgid);
-
- if (ldap_error == LDAP_SUCCESS) {
- op->handler = modify_contact_modify_handler;
- ldap_op_change_id ((LDAPOp*)modify_op,
- modify_contact_msgid);
- }
- else {
- g_warning ("ldap_modify_ext returned %d\n", ldap_error);
- pas_book_respond_modify (op->book,
- ldap_error_to_response (ldap_error),
- NULL);
- ldap_op_finished (op);
- return;
- }
- }
-
- /* and clean up */
- free_mods (mod_array);
- }
- else {
- g_warning ("unhandled result type %d returned", msg_type);
- pas_book_respond_modify (op->book,
- GNOME_Evolution_Addressbook_OtherError,
- NULL);
- ldap_op_finished (op);
- }
-}
-
-static void
-modify_contact_dtor (LDAPOp *op)
-{
- LDAPModifyOp *modify_op = (LDAPModifyOp*)op;
-
- g_list_foreach (modify_op->existing_objectclasses, (GFunc)g_free, NULL);
- g_list_free (modify_op->existing_objectclasses);
- if (modify_op->current_contact)
- g_object_unref (modify_op->current_contact);
- if (modify_op->contact)
- g_object_unref (modify_op->contact);
- g_free (modify_op);
-}
-
-static void
-pas_backend_ldap_process_modify_contact (PASBackend *backend,
- PASBook *book,
- const char *vcard)
-{
- LDAPModifyOp *modify_op = g_new0 (LDAPModifyOp, 1);
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- int ldap_error;
- LDAP *ldap;
- int modify_contact_msgid;
- PASBookView *book_view;
-
- book_view = find_book_view (bl);
-
- modify_op->contact = e_contact_new_from_vcard (vcard);
- modify_op->id = e_contact_get_const (modify_op->contact, E_CONTACT_UID);
-
- ldap = bl->priv->ldap;
-
- book_view_notify_status (book_view, _("Modifying contact from LDAP server..."));
-
- do {
- book_view_notify_status (book_view, _("Modifying contact from LDAP server..."));
-
- ldap_error = ldap_search_ext (ldap, modify_op->id,
- LDAP_SCOPE_BASE,
- "(objectclass=*)",
- NULL, 0, NULL, NULL,
- NULL, /* XXX timeout */
- 1, &modify_contact_msgid);
-
- } while (pas_backend_ldap_reconnect (bl, book_view, ldap_error));
-
- if (ldap_error == LDAP_SUCCESS) {
- ldap_op_add ((LDAPOp*)modify_op, backend, book,
- book_view, modify_contact_msgid,
- modify_contact_search_handler, modify_contact_dtor);
- }
- else {
- g_warning ("ldap_search_ext returned %d\n", ldap_error);
- pas_book_respond_modify (book,
- GNOME_Evolution_Addressbook_OtherError,
- NULL);
- modify_contact_dtor ((LDAPOp*)modify_op);
- }
-}
-
-
-typedef struct {
- LDAPOp op;
-} LDAPGetContactOp;
-
-static void
-get_contact_handler (LDAPOp *op, LDAPMessage *res)
-{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- int msg_type;
-
- /* the msg_type will be either SEARCH_ENTRY (if we're
- successful) or SEARCH_RESULT (if we're not), so we finish
- the op after either */
- msg_type = ldap_msgtype (res);
- if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- LDAPMessage *e = ldap_first_entry(bl->priv->ldap, res);
- EContact *contact;
- char *vcard;
-
- if (!e) {
- g_warning ("uh, this shouldn't happen");
- pas_book_respond_get_contact (op->book,
- GNOME_Evolution_Addressbook_OtherError,
- "");
- ldap_op_finished (op);
- return;
- }
-
- contact = build_contact_from_entry (bl->priv->ldap, e, NULL);
- vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
- pas_book_respond_get_contact (op->book,
- GNOME_Evolution_Addressbook_Success,
- vcard);
- g_free (vcard);
- g_object_unref (contact);
- ldap_op_finished (op);
- }
- else if (msg_type == LDAP_RES_SEARCH_RESULT) {
- int ldap_error;
- ldap_parse_result (bl->priv->ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
- pas_book_respond_get_contact (op->book, ldap_error_to_response (ldap_error), "");
- ldap_op_finished (op);
- }
- else {
- g_warning ("unhandled result type %d returned", msg_type);
- pas_book_respond_get_contact (op->book, GNOME_Evolution_Addressbook_OtherError,
- "");
- ldap_op_finished (op);
- }
-
-}
-
-static void
-get_contact_dtor (LDAPOp *op)
-{
- LDAPGetContactOp *get_contact_op = (LDAPGetContactOp*)op;
-
- g_free (get_contact_op);
-}
-
-static void
-pas_backend_ldap_process_get_contact (PASBackend *backend,
- PASBook *book,
- const char *id)
-{
- LDAPGetContactOp *get_contact_op = g_new0 (LDAPGetContactOp, 1);
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- LDAP *ldap = bl->priv->ldap;
- int get_contact_msgid;
- PASBookView *book_view;
- int ldap_error;
-
- book_view = find_book_view (bl);
-
- do {
- ldap_error = ldap_search_ext (ldap, id,
- LDAP_SCOPE_BASE,
- "(objectclass=*)",
- NULL, 0, NULL, NULL,
- NULL, /* XXX timeout */
- 1, &get_contact_msgid);
- } while (pas_backend_ldap_reconnect (bl, book_view, ldap_error));
-
- if (ldap_error == LDAP_SUCCESS) {
- ldap_op_add ((LDAPOp*)get_contact_op, backend, book,
- book_view, get_contact_msgid,
- get_contact_handler, get_contact_dtor);
- }
- else {
- pas_book_respond_get_contact (book,
- ldap_error_to_response (ldap_error),
- "");
- get_contact_dtor ((LDAPOp*)get_contact_op);
- }
-}
-
-
-
-static EContactField email_ids[3] = {
- E_CONTACT_EMAIL_1,
- E_CONTACT_EMAIL_2,
- E_CONTACT_EMAIL_3
-};
-
-/* List property functions */
-static void
-email_populate(EContact *contact, char **values)
-{
- int i;
- for (i = 0; values[i] && i < 3; i ++)
- e_contact_set (contact, email_ids[i], values[i]);
-}
-
-struct berval**
-email_ber(EContact *contact)
-{
- struct berval** result;
- const char *emails[3];
- int i, j, num = 0;
-
- for (i = 0; i < 3; i ++) {
- emails[i] = e_contact_get (contact, email_ids[i]);
- if (emails[i])
- num++;
- }
-
- if (num == 0)
- return NULL;
-
- result = g_new (struct berval*, num + 1);
-
- for (i = 0; i < num; i ++)
- result[i] = g_new (struct berval, 1);
-
- j = 0;
- for (i = 0; i < 3; i ++) {
- if (emails[i]) {
- result[j]->bv_val = g_strdup (emails[i]);
- result[j++]->bv_len = strlen (emails[i]);
- }
- }
-
- result[num] = NULL;
-
- return result;
-}
-
-static gboolean
-email_compare (EContact *contact1, EContact *contact2)
-{
- const char *email1, *email2;
- int i;
-
- for (i = 0; i < 3; i ++) {
- gboolean equal;
- email1 = e_contact_get_const (contact1, email_ids[i]);
- email2 = e_contact_get_const (contact2, email_ids[i]);
-
- if (email1 && email2)
- equal = !strcmp (email1, email2);
- else
- equal = (!!email1 == !!email2);
-
- if (!equal)
- return equal;
- }
-
- return TRUE;
-}
-
-static void
-homephone_populate(EContact *contact, char **values)
-{
- if (values[0]) {
- e_contact_set (contact, E_CONTACT_PHONE_HOME, values[0]);
- if (values[1])
- e_contact_set (contact, E_CONTACT_PHONE_HOME_2, values[1]);
- }
-}
-
-struct berval**
-homephone_ber(EContact *contact)
-{
- struct berval** result;
- const char *homephones[3];
- int i, j, num;
-
- num = 0;
- if ((homephones[0] = e_contact_get (contact, E_CONTACT_PHONE_HOME)))
- num++;
- if ((homephones[1] = e_contact_get (contact, E_CONTACT_PHONE_HOME_2)))
- num++;
-
- if (num == 0)
- return NULL;
-
- result = g_new (struct berval*, num + 1);
-
- for (i = 0; i < num; i ++)
- result[i] = g_new (struct berval, 1);
-
- j = 0;
- for (i = 0; i < 2; i ++) {
- if (homephones[i]) {
- result[j]->bv_val = g_strdup (homephones[i]);
- result[j++]->bv_len = strlen (homephones[i]);
- }
- }
-
- result[num] = NULL;
-
- return result;
-}
-
-static gboolean
-homephone_compare (EContact *contact1, EContact *contact2)
-{
- int phone_ids[2] = { E_CONTACT_PHONE_HOME, E_CONTACT_PHONE_HOME_2 };
- const char *phone1, *phone2;
- int i;
-
- for (i = 0; i < 2; i ++) {
- gboolean equal;
- phone1 = e_contact_get (contact1, phone_ids[i]);
- phone2 = e_contact_get (contact2, phone_ids[i]);
-
- if (phone1 && phone2)
- equal = !strcmp (phone1, phone2);
- else
- equal = (!!phone1 == !!phone2);
-
- if (!equal)
- return equal;
- }
-
- return TRUE;
-}
-
-static void
-business_populate(EContact *contact, char **values)
-{
- if (values[0]) {
- e_contact_set (contact, E_CONTACT_PHONE_BUSINESS, values[0]);
- if (values[1])
- e_contact_set (contact, E_CONTACT_PHONE_BUSINESS_2, values[1]);
- }
-}
-
-struct berval**
-business_ber(EContact *contact)
-{
- struct berval** result;
- const char *business_phones[3];
- int i, j, num;
-
- num = 0;
- if ((business_phones[0] = e_contact_get (contact, E_CONTACT_PHONE_BUSINESS)))
- num++;
- if ((business_phones[1] = e_contact_get (contact, E_CONTACT_PHONE_BUSINESS_2)))
- num++;
-
- if (num == 0)
- return NULL;
-
- result = g_new (struct berval*, num + 1);
-
- for (i = 0; i < num; i ++)
- result[i] = g_new (struct berval, 1);
-
- j = 0;
- for (i = 0; i < 2; i ++) {
- if (business_phones[i]) {
- result[j]->bv_val = g_strdup (business_phones[i]);
- result[j++]->bv_len = strlen (business_phones[i]);
- }
- }
-
- result[num] = NULL;
-
- return result;
-}
-
-static gboolean
-business_compare (EContact *contact1, EContact *contact2)
-{
- int phone_ids[2] = { E_CONTACT_PHONE_BUSINESS, E_CONTACT_PHONE_BUSINESS_2 };
- const char *phone1, *phone2;
- int i;
-
- for (i = 0; i < 2; i ++) {
- gboolean equal;
- phone1 = e_contact_get (contact1, phone_ids[i]);
- phone2 = e_contact_get (contact2, phone_ids[i]);
-
- if (phone1 && phone2)
- equal = !strcmp (phone1, phone2);
- else
- equal = (!!phone1 == !!phone2);
-
- if (!equal)
- return equal;
- }
-
- return TRUE;
-}
-
-static void
-anniversary_populate (EContact *contact, char **values)
-{
- if (values[0]) {
- EContactDate *dt = e_contact_date_from_string (values[0]);
- e_contact_set (contact, E_CONTACT_ANNIVERSARY, &dt);
- }
-}
-
-struct berval**
-anniversary_ber (EContact *contact)
-{
- EContactDate *dt;
- struct berval** result = NULL;
-
- dt = e_contact_get (contact, E_CONTACT_ANNIVERSARY);
-
- if (dt) {
- char *anniversary;
-
- anniversary = e_contact_date_to_string (dt);
-
- result = g_new (struct berval*, 2);
- result[0] = g_new (struct berval, 1);
- result[0]->bv_val = anniversary;
- result[0]->bv_len = strlen (anniversary);
-
- result[1] = NULL;
-
- e_contact_date_free (dt);
- }
-
- return result;
-}
-
-static gboolean
-anniversary_compare (EContact *contact1, EContact *contact2)
-{
- EContactDate *dt;
- char *date1 = NULL, *date2 = NULL;
- gboolean equal;
-
- dt = e_contact_get (contact1, E_CONTACT_ANNIVERSARY);
- if (dt) {
- date1 = e_contact_date_to_string (dt);
- e_contact_date_free (dt);
- }
-
- dt = e_contact_get (contact2, E_CONTACT_ANNIVERSARY);
- if (dt) {
- date2 = e_contact_date_to_string (dt);
- e_contact_date_free (dt);
- }
-
- if (date1 && date2)
- equal = !strcmp (date1, date2);
- else
- equal = (!!date1 == !!date2);
-
- g_free (date1);
- g_free (date2);
-
- return equal;
-}
-
-static void
-birthday_populate (EContact *contact, char **values)
-{
- if (values[0]) {
- EContactDate *dt = e_contact_date_from_string (values[0]);
- e_contact_set (contact, E_CONTACT_BIRTH_DATE, dt);
- e_contact_date_free (dt);
- }
-}
-
-struct berval**
-birthday_ber (EContact *contact)
-{
- EContactDate *dt;
- struct berval** result = NULL;
-
- dt = e_contact_get (contact, E_CONTACT_BIRTH_DATE);
- if (dt) {
- char *birthday;
-
- birthday = e_contact_date_to_string (dt);
-
- result = g_new (struct berval*, 2);
- result[0] = g_new (struct berval, 1);
- result[0]->bv_val = birthday;
- result[0]->bv_len = strlen (birthday);
-
- result[1] = NULL;
-
- e_contact_date_free (dt);
- }
-
- return result;
-}
-
-static gboolean
-birthday_compare (EContact *contact1, EContact *contact2)
-{
- EContactDate *dt;
- char *date1 = NULL, *date2 = NULL;
- gboolean equal;
-
- dt = e_contact_get (contact1, E_CONTACT_BIRTH_DATE);
- if (dt) {
- date1 = e_contact_date_to_string (dt);
- e_contact_date_free (dt);
- }
-
- dt = e_contact_get (contact2, E_CONTACT_BIRTH_DATE);
- if (dt) {
- date2 = e_contact_date_to_string (dt);
- e_contact_date_free (dt);
- }
-
- if (date1 && date2)
- equal = !strcmp (date1, date2);
- else
- equal = (!!date1 == !!date2);
-
- g_free (date1);
- g_free (date2);
-
- return equal;
-}
-
-static void
-category_populate (EContact *contact, char **values)
-{
-#if notyet
- int i;
- EContact *ecard;
- EList *categories;
-
- g_object_get (card,
- "card", &ecard,
- NULL);
-
- categories = e_list_new((EListCopyFunc) g_strdup,
- (EListFreeFunc) g_free,
- NULL);
-
- for (i = 0; values[i]; i++)
- e_list_append (categories, values[i]);
-
- g_object_set (ecard,
- "category_list", categories,
- NULL);
-
- g_object_unref (categories);
-
- e_card_simple_sync_card (card);
- g_object_unref (ecard);
-#endif
-}
-
-struct berval**
-category_ber (EContact *contact)
-{
-#if notyet
- struct berval** result = NULL;
- EList *categories;
- EIterator *iterator;
- EContact *ecard;
- int i;
-
- g_object_get (card,
- "card", &ecard,
- NULL);
-
- g_object_get (ecard,
- "category_list", &categories,
- NULL);
-
- if (e_list_length (categories) != 0) {
- result = g_new0 (struct berval*, e_list_length (categories) + 1);
-
- for (iterator = e_list_get_iterator(categories), i = 0; e_iterator_is_valid (iterator);
- e_iterator_next (iterator), i++) {
- const char *category = e_iterator_get (iterator);
-
- result[i] = g_new (struct berval, 1);
- result[i]->bv_val = g_strdup (category);
- result[i]->bv_len = strlen (category);
- }
-
- g_object_unref (iterator);
- }
-
- g_object_unref (categories);
- g_object_unref (ecard);
- return result;
-#endif
-}
-
-static gboolean
-category_compare (EContact *contact1, EContact *contact2)
-{
-#if notyet
- char *categories1, *categories2;
- gboolean equal;
-
- categories1 = e_card_simple_get (ecard1, E_CONTACT_CATEGORIES);
- categories2 = e_card_simple_get (ecard2, E_CONTACT_CATEGORIES);
-
- equal = !strcmp (categories1, categories2);
-
- g_free (categories1);
- g_free (categories2);
-
- return equal;
-#endif
-}
-
-static void
-photo_populate (EContact *contact, struct berval **ber_values)
-{
- if (ber_values && ber_values[0]) {
- EContactPhoto photo;
- photo.data = ber_values[0]->bv_val;
- photo.length = ber_values[0]->bv_len;
-
- e_contact_set (contact, E_CONTACT_PHOTO, &photo);
- }
-}
-
-typedef struct {
- GList *list;
- PASBackendLDAP *bl;
-} PASBackendLDAPSExpData;
-
-#define IS_RFC2254_CHAR(c) ((c) == '*' || (c) =='\\' || (c) == '(' || (c) == ')' || (c) == '\0')
-static char *
-rfc2254_escape(char *str)
-{
- int i;
- int len = strlen(str);
- int newlen = 0;
-
- for (i = 0; i < len; i ++) {
- if (IS_RFC2254_CHAR(str[i]))
- newlen += 3;
- else
- newlen ++;
- }
-
- if (len == newlen) {
- return g_strdup (str);
- }
- else {
- char *newstr = g_malloc0 (newlen + 1);
- int j = 0;
- for (i = 0; i < len; i ++) {
- if (IS_RFC2254_CHAR(str[i])) {
- sprintf (newstr + j, "\\%02x", str[i]);
- j+= 3;
- }
- else {
- newstr[j++] = str[i];
- }
- }
- return newstr;
- }
-}
-
-static ESExpResult *
-func_and(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendLDAPSExpData *ldap_data = data;
- ESExpResult *r;
- char ** strings;
-
- if (argc > 0) {
- int i;
-
- strings = g_new0(char*, argc+3);
- strings[0] = g_strdup ("(&");
- strings[argc+3 - 2] = g_strdup (")");
-
- for (i = 0; i < argc; i ++) {
- GList *list_head = ldap_data->list;
- if (!list_head)
- break;
- strings[argc - i] = list_head->data;
- ldap_data->list = g_list_remove_link(list_head, list_head);
- g_list_free_1(list_head);
- }
-
- ldap_data->list = g_list_prepend(ldap_data->list, g_strjoinv(" ", strings));
-
- for (i = 0 ; i < argc + 2; i ++)
- g_free (strings[i]);
-
- g_free (strings);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_or(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendLDAPSExpData *ldap_data = data;
- ESExpResult *r;
- char ** strings;
-
- if (argc > 0) {
- int i;
-
- strings = g_new0(char*, argc+3);
- strings[0] = g_strdup ("(|");
- strings[argc+3 - 2] = g_strdup (")");
-
- for (i = 0; i < argc; i ++) {
- GList *list_head = ldap_data->list;
- if (!list_head)
- break;
- strings[argc - i] = list_head->data;
- ldap_data->list = g_list_remove_link(list_head, list_head);
- g_list_free_1(list_head);
- }
-
- ldap_data->list = g_list_prepend(ldap_data->list, g_strjoinv(" ", strings));
-
- for (i = 0 ; i < argc + 2; i ++)
- g_free (strings[i]);
-
- g_free (strings);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_not(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendLDAPSExpData *ldap_data = data;
- ESExpResult *r;
-
- /* just replace the head of the list with the NOT of it. */
- if (argc > 0) {
- char *term = ldap_data->list->data;
- ldap_data->list->data = g_strdup_printf("(!%s)", term);
- g_free (term);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendLDAPSExpData *ldap_data = data;
- ESExpResult *r;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
- char *str = rfc2254_escape(argv[1]->value.string);
- gboolean one_star = FALSE;
-
- if (strlen(str) == 0)
- one_star = TRUE;
-
- if (!strcmp (propname, "x-evolution-any-field")) {
- int i;
- int query_length;
- char *big_query;
- char *match_str;
-
- match_str = g_strdup_printf("=*%s%s)",
- str, one_star ? "" : "*");
-
- query_length = 3; /* strlen ("(|") + strlen (")") */
-
- for (i = 0; i < num_prop_infos; i ++) {
- query_length += 1 /* strlen ("(") */ + strlen(prop_info[i].ldap_attr) + strlen (match_str);
- }
-
- big_query = g_malloc0(query_length + 1);
- strcat (big_query, "(|");
- for (i = 0; i < num_prop_infos; i ++) {
- strcat (big_query, "(");
- strcat (big_query, prop_info[i].ldap_attr);
- strcat (big_query, match_str);
- }
- strcat (big_query, ")");
-
- ldap_data->list = g_list_prepend(ldap_data->list, big_query);
-
- g_free (match_str);
- }
- else {
- char *ldap_attr = query_prop_to_ldap(propname);
-
- if (ldap_attr)
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup_printf("(%s=*%s%s)",
- ldap_attr,
- str,
- one_star ? "" : "*"));
- }
-
- g_free (str);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_is(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendLDAPSExpData *ldap_data = data;
- ESExpResult *r;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
- char *str = rfc2254_escape(argv[1]->value.string);
- char *ldap_attr = query_prop_to_ldap(propname);
-
- if (ldap_attr)
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup_printf("(%s=%s)",
- ldap_attr, str));
- else {
- g_warning ("unknown query property\n");
- /* we want something that'll always be false */
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup("objectClass=MyBarnIsBiggerThanYourBarn"));
- }
-
- g_free (str);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_beginswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendLDAPSExpData *ldap_data = data;
- ESExpResult *r;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
- char *str = rfc2254_escape(argv[1]->value.string);
- char *ldap_attr = query_prop_to_ldap(propname);
-
- /* insert hack for fileAs queries, since we need to do
- the right thing if the server supports them or not,
- and for entries that have no fileAs attribute. */
- if (ldap_attr) {
- if (!strcmp (propname, "full_name")) {
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup_printf(
- "(|(cn=%s*)(sn=%s*))",
- str, str));
- }
- else if (!strcmp (ldap_attr, "fileAs")) {
- if (ldap_data->bl->priv->evolutionPersonSupported)
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup_printf("(|(fileAs=%s*)(&(!(fileAs=*))(sn=%s*)))",
- str, str));
- else
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup_printf("(sn=%s*)", str));
- }
- else {
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup_printf("(%s=%s*)",
- ldap_attr,
- str));
- }
- }
-
- g_free (str);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_endswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendLDAPSExpData *ldap_data = data;
- ESExpResult *r;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
- char *str = rfc2254_escape(argv[1]->value.string);
- char *ldap_attr = query_prop_to_ldap(propname);
-
- if (ldap_attr)
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup_printf("(%s=*%s)",
- ldap_attr,
- str));
- g_free (str);
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-func_exists(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendLDAPSExpData *ldap_data = data;
- ESExpResult *r;
-
- if (argc == 1
- && argv[0]->type == ESEXP_RES_STRING) {
- char *propname = argv[0]->value.string;
-
- if (!strcmp (propname, "x-evolution-any-field")) {
- int i;
- int query_length;
- char *big_query;
- char *match_str;
-
- match_str = g_strdup("=*)");
-
- query_length = 3; /* strlen ("(|") + strlen (")") */
-
- for (i = 0; i < num_prop_infos; i ++) {
- query_length += 1 /* strlen ("(") */ + strlen(prop_info[i].ldap_attr) + strlen (match_str);
- }
-
- big_query = g_malloc0(query_length + 1);
- strcat (big_query, "(|");
- for (i = 0; i < num_prop_infos; i ++) {
- strcat (big_query, "(");
- strcat (big_query, prop_info[i].ldap_attr);
- strcat (big_query, match_str);
- }
- strcat (big_query, ")");
-
- ldap_data->list = g_list_prepend(ldap_data->list, big_query);
-
- g_free (match_str);
- }
- else {
- char *ldap_attr = query_prop_to_ldap(propname);
-
- if (ldap_attr)
- ldap_data->list = g_list_prepend(ldap_data->list,
- g_strdup_printf("(%s=*)", ldap_attr));
- }
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-/* 'builtin' functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "and", func_and, 0 },
- { "or", func_or, 0 },
- { "not", func_not, 0 },
- { "contains", func_contains, 0 },
- { "is", func_is, 0 },
- { "beginswith", func_beginswith, 0 },
- { "endswith", func_endswith, 0 },
- { "exists", func_exists, 0 },
-};
-
-static gchar *
-pas_backend_ldap_build_query (PASBackendLDAP *bl, const char *query)
-{
- ESExp *sexp;
- ESExpResult *r;
- gchar *retval;
- PASBackendLDAPSExpData data;
- int i;
-
- data.list = NULL;
- data.bl = bl;
-
- sexp = e_sexp_new();
-
- for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction(sexp, 0, symbols[i].name,
- (ESExpIFunc *)symbols[i].func, &data);
- } else {
- e_sexp_add_function(sexp, 0, symbols[i].name,
- symbols[i].func, &data);
- }
- }
-
- e_sexp_input_text(sexp, query, strlen(query));
- e_sexp_parse(sexp);
-
- r = e_sexp_eval(sexp);
-
- e_sexp_result_free(sexp, r);
- e_sexp_unref (sexp);
-
- if (data.list) {
- if (data.list->next) {
- g_warning ("conversion to ldap query string failed");
- retval = NULL;
- g_list_foreach (data.list, (GFunc)g_free, NULL);
- }
- else {
- retval = data.list->data;
- }
- }
- else {
- g_warning ("conversion to ldap query string failed");
- retval = NULL;
- }
-
- g_list_free (data.list);
- return retval;
-}
-
-static gchar *
-query_prop_to_ldap(gchar *query_prop)
-{
- int i;
-
- for (i = 0; i < num_prop_infos; i ++)
- if (!strcmp (query_prop, e_contact_field_name (prop_info[i].field_id)))
- return prop_info[i].ldap_attr;
-
- return NULL;
-}
-
-
-typedef struct {
- LDAPOp op;
- PASBookView *view;
-
- /* used by search_handler to only send the status messages once */
- gboolean notified_receiving_results;
-} LDAPSearchOp;
-
-static EContact *
-build_contact_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasses)
-{
- EContact *contact = e_contact_new ();
- char *dn;
- char *attr;
- BerElement *ber = NULL;
-
- dn = ldap_get_dn(ldap, e);
- e_contact_set (contact, E_CONTACT_UID, dn);
- ldap_memfree (dn);
-
- for (attr = ldap_first_attribute (ldap, e, &ber); attr;
- attr = ldap_next_attribute (ldap, e, ber)) {
- int i;
- struct prop_info *info = NULL;
- char **values;
-
- if (existing_objectclasses && !g_ascii_strcasecmp (attr, "objectclass")) {
- values = ldap_get_values (ldap, e, attr);
- for (i = 0; values[i]; i ++)
- *existing_objectclasses = g_list_append (*existing_objectclasses, g_strdup (values[i]));
-
- ldap_value_free (values);
- }
- else {
- for (i = 0; i < num_prop_infos; i ++)
- if (!g_ascii_strcasecmp (attr, prop_info[i].ldap_attr)) {
- info = &prop_info[i];
- break;
- }
-
- printf ("attr = %s, ", attr);
- printf ("info = %p\n", info);
-
- if (info) {
- if (info->prop_type & PROP_WRITE_ONLY)
- continue;
-
- if (info->prop_type & PROP_TYPE_BINARY) {
- struct berval **ber_values = ldap_get_values_len (ldap, e, attr);
-
- if (ber_values) {
- info->binary_populate_contact_func (contact, ber_values);
-
- ldap_value_free_len (ber_values);
- }
- }
- else {
- values = ldap_get_values (ldap, e, attr);
-
- if (values) {
- if (info->prop_type & PROP_TYPE_STRING) {
- printf ("value = %s\n", values[0]);
- /* if it's a normal property just set the string */
- if (values[0])
- e_contact_set (contact, info->field_id, values[0]);
- }
- else if (info->prop_type & PROP_TYPE_COMPLEX) {
- /* if it's a list call the contact-populate function,
- which calls g_object_set to set the property */
- info->populate_contact_func(contact,
- values);
- }
-
- ldap_value_free (values);
- }
- }
- }
- }
-
- ldap_memfree (attr);
- }
-
- if (ber)
- ber_free (ber, 0);
-
- return contact;
-}
-
-static gboolean
-poll_ldap (PASBackendLDAP *bl)
-{
- LDAP *ldap = bl->priv->ldap;
- int rc;
- LDAPMessage *res;
- struct timeval timeout;
-
- if (!bl->priv->active_ops) {
- g_warning ("poll_ldap being called for backend with no active operations");
- return FALSE;
- }
-
- timeout.tv_sec = 0;
- timeout.tv_usec = LDAP_RESULT_TIMEOUT_MILLIS * 1000;
-
- rc = ldap_result (ldap, LDAP_RES_ANY, 0, &timeout, &res);
- if (rc != 0) {/* rc == 0 means timeout exceeded */
- if (rc == -1) {
- PASBookView *book_view = find_book_view (bl);
- g_warning ("ldap_result returned -1, restarting ops");
-
- pas_backend_ldap_reconnect (bl, book_view, LDAP_SERVER_DOWN);
-#if 0
- if (bl->priv->connected)
- restart_ops (bl);
-#endif
- }
- else {
- int msgid = ldap_msgid (res);
- LDAPOp *op;
-
- op = g_hash_table_lookup (bl->priv->id_to_op, &msgid);
-
- if (op)
- op->handler (op, res);
- else
- g_warning ("unknown operation, msgid = %d", msgid);
-
- ldap_msgfree(res);
- }
- }
-
- return TRUE;
-}
-
-static void
-ldap_search_handler (LDAPOp *op, LDAPMessage *res)
-{
- LDAPSearchOp *search_op = (LDAPSearchOp*)op;
- PASBookView *view = search_op->view;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- LDAPMessage *e;
- int msg_type;
-
- bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(view)), NULL);
-
- if (!search_op->notified_receiving_results) {
- search_op->notified_receiving_results = TRUE;
- book_view_notify_status (op->view, _("Receiving LDAP search results..."));
- }
-
- msg_type = ldap_msgtype (res);
- if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- e = ldap_first_entry(ldap, res);
-
- while (NULL != e) {
- EContact *contact = build_contact_from_entry (ldap, e, NULL);
-
- pas_book_view_notify_update (view, contact);
-
- g_object_unref (contact);
-
- e = ldap_next_entry(ldap, e);
- }
- }
- else if (msg_type == LDAP_RES_SEARCH_RESULT) {
- int ldap_error;
-
- ldap_parse_result (ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
-
- g_warning ("search returned %d\n", ldap_error);
-
- if (ldap_error == LDAP_TIMELIMIT_EXCEEDED)
- pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_SearchTimeLimitExceeded);
- else if (ldap_error == LDAP_SIZELIMIT_EXCEEDED)
- pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_SearchSizeLimitExceeded);
- else if (ldap_error == LDAP_SUCCESS)
- pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_Success);
- else
- pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_OtherError);
-
- ldap_op_finished (op);
- }
- else {
- g_warning ("unhandled search result type %d returned", msg_type);
- pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_OtherError);
- ldap_op_finished (op);
- }
-
-
- bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view)), NULL);
-}
-
-static void
-ldap_search_dtor (LDAPOp *op)
-{
- LDAPSearchOp *search_op = (LDAPSearchOp*) op;
-
-#if notyet
- /* unhook us from our PASBackendLDAPBookView */
- if (search_op->view)
- search_op->view->search_op = NULL;
-#endif
-
- g_free (search_op);
-}
-
-static void
-pas_backend_ldap_search (PASBackendLDAP *bl,
- PASBook *book,
- PASBookView *view)
-{
- char *ldap_query;
-
- ldap_query = pas_backend_ldap_build_query (bl, pas_book_view_get_card_query (view));
-
- if (ldap_query != NULL) {
- LDAP *ldap = bl->priv->ldap;
- int ldap_err;
- int search_msgid;
-
- printf ("searching server using filter: %s\n", ldap_query);
-
- do {
- book_view_notify_status (view, _("Searching..."));
-
- ldap_err = ldap_search_ext (ldap, bl->priv->ldap_rootdn,
- bl->priv->ldap_scope,
- ldap_query,
- NULL, 0,
- NULL, /* XXX */
- NULL, /* XXX */
- NULL, /* XXX timeout */
- 0 /* XXX we need this back in view->limit*/, &search_msgid);
- } while (pas_backend_ldap_reconnect (bl, view, ldap_err));
-
- g_free (ldap_query);
-
- if (ldap_err != LDAP_SUCCESS) {
- book_view_notify_status (view, ldap_err2string(ldap_err));
- return;
- }
- else if (search_msgid == -1) {
- book_view_notify_status (view,
- _("Error performing search"));
- return;
- }
- else {
- LDAPSearchOp *op = g_new0 (LDAPSearchOp, 1);
-
- op->view = view;
-
-#if notyet
- view->search_op = (LDAPOp*)op;
-#endif
-
- ldap_op_add ((LDAPOp*)op, PAS_BACKEND(bl), book, view,
- search_msgid,
- ldap_search_handler, ldap_search_dtor);
-
- }
- return;
- }
- else {
- pas_book_view_notify_complete (view,
- GNOME_Evolution_Addressbook_InvalidQuery);
- return;
- }
-
-}
-
-static void
-pas_backend_ldap_process_start_book_view (PASBackend *backend,
- PASBookView *view)
-{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
-
- pas_backend_ldap_search (bl, NULL /* XXX ugh */, view);
-}
-
-static void
-pas_backend_ldap_process_stop_book_view (PASBackend *backend,
- PASBookView *view)
-{
- /* FIXME we don't stop them... */
-}
-
-static void
-pas_backend_ldap_process_get_changes (PASBackend *backend,
- PASBook *book,
- const char *change_id)
-{
- /* FIXME: implement */
-}
-
-#define LDAP_SIMPLE_PREFIX "ldap/simple-"
-#define SASL_PREFIX "sasl/"
-
-static void
-pas_backend_ldap_process_authenticate_user (PASBackend *backend,
- PASBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method)
-{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- int ldap_error;
- char *dn = NULL;
-
- if (!strncasecmp (auth_method, LDAP_SIMPLE_PREFIX, strlen (LDAP_SIMPLE_PREFIX))) {
-
- if (!strcmp (auth_method, "ldap/simple-email")) {
- LDAPMessage *res, *e;
- char *query = g_strdup_printf ("(mail=%s)", user);
-
- ldap_error = ldap_search_s (bl->priv->ldap,
- bl->priv->ldap_rootdn,
- bl->priv->ldap_scope,
- query,
- NULL, 0, &res);
- g_free (query);
-
- if (ldap_error == LDAP_SUCCESS) {
- char *entry_dn;
-
- e = ldap_first_entry (bl->priv->ldap, res);
-
- entry_dn = ldap_get_dn (bl->priv->ldap, e);
- dn = g_strdup(entry_dn);
-
- ldap_memfree (entry_dn);
- ldap_msgfree (res);
- }
- else {
- pas_book_respond_authenticate_user (book,
- GNOME_Evolution_Addressbook_PermissionDenied);
- return;
- }
- }
- else if (!strcmp (auth_method, "ldap/simple-binddn")) {
- dn = g_strdup (user);
- }
-
- /* now authenticate against the DN we were either supplied or queried for */
- printf ("simple auth as %s\n", dn);
- ldap_error = ldap_simple_bind_s(bl->priv->ldap,
- dn,
- passwd);
-
- pas_book_respond_authenticate_user (book,
- ldap_error_to_response (ldap_error));
- }
-#ifdef ENABLE_SASL_BINDS
- else if (!strncasecmp (auth_method, SASL_PREFIX, strlen (SASL_PREFIX))) {
- g_print ("sasl bind (mech = %s) as %s", auth_method + strlen (SASL_PREFIX), user);
- ldap_error = ldap_sasl_bind_s (bl->priv->ldap,
- NULL,
- auth_method + strlen (SASL_PREFIX),
- passwd,
- NULL,
- NULL,
- NULL);
-
- if (ldap_error == LDAP_NOT_SUPPORTED)
- pas_book_respond_authenticate_user (book,
- GNOME_Evolution_Addressbook_UnsupportedAuthenticationMethod);
- else
- pas_book_respond_authenticate_user (book,
- ldap_error_to_response (ldap_error));
- }
-#endif
- else {
- pas_book_respond_authenticate_user (book,
- GNOME_Evolution_Addressbook_UnsupportedAuthenticationMethod);
- return;
- }
-
- if (ldap_error == LDAP_SUCCESS) {
- bl->priv->auth_dn = dn;
- bl->priv->auth_passwd = g_strdup (passwd);
-
- pas_backend_set_is_writable (backend, TRUE);
-
- /* force a requery on the root dse since some ldap
- servers are set up such that they don't report
- anything (including the schema DN) until the user
- is authenticated */
- if (!bl->priv->evolutionPersonChecked) {
- ldap_error = query_ldap_root_dse (bl);
-
- if (LDAP_SUCCESS == ldap_error) {
- if (!bl->priv->evolutionPersonChecked)
- check_schema_support (bl);
- }
- else
- g_warning ("Failed to perform root dse query after authenticating, (ldap_error 0x%02x)", ldap_error);
- }
-
- pas_book_report_writable (book, TRUE);
- }
-
-}
-
-static void
-pas_backend_ldap_process_get_supported_fields (PASBackend *backend,
- PASBook *book)
-
-{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
-
- pas_book_respond_get_supported_fields (book,
- GNOME_Evolution_Addressbook_Success,
- bl->priv->supported_fields);
-}
-
-static void
-pas_backend_ldap_process_get_supported_auth_methods (PASBackend *backend,
- PASBook *book)
-
-{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
-
- pas_book_respond_get_supported_auth_methods (book,
- GNOME_Evolution_Addressbook_Success,
- bl->priv->supported_auth_methods);
-}
-
-static GNOME_Evolution_Addressbook_CallStatus
-pas_backend_ldap_load_uri (PASBackend *backend,
- const char *uri,
- gboolean only_if_exists)
-{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- LDAPURLDesc *lud;
- int ldap_error;
- char **attributes;
- int i;
- int limit = 100;
- int timeout = 60; /* 1 minute */
-
- g_assert (bl->priv->connected == FALSE);
-
- attributes = g_strsplit (uri, ";", 0);
-
- if (attributes[0] == NULL)
- return FALSE;
-
- for (i = 1; attributes[i]; i++) {
- char *equals;
- char *value;
- int key_length;
- equals = strchr (attributes[i], '=');
- if (equals) {
- key_length = equals - attributes[i];
- value = equals + 1;
- } else {
- key_length = strlen (attributes[i]);
- value = NULL;
- }
-
- if (key_length == strlen("limit") && !strncmp (attributes[i], "limit", key_length)) {
- if (value)
- limit = atoi(value);
- }
- else if (key_length == strlen("ssl") && !strncmp (attributes[i], "ssl", key_length)) {
- if (value) {
- if (!strncmp (value, "always", 6)) {
- bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_ALWAYS;
- }
- else if (!strncmp (value, "whenever_possible", 3)) {
- bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_WHEN_POSSIBLE;
- }
- else if (strncmp (value, "never", 5)) {
- g_warning ("unhandled value for use_tls, not using it");
- }
- }
- else {
- bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_WHEN_POSSIBLE;
- }
- }
- else if (key_length == strlen("timeout") && !strncmp (attributes[i], "timeout", key_length)) {
- if (value)
- timeout = atoi (value);
- }
- }
-
- ldap_error = ldap_url_parse ((char*)attributes[0], &lud);
- g_strfreev (attributes);
-
- if (ldap_error == LDAP_SUCCESS) {
- g_free(bl->priv->uri);
- bl->priv->uri = g_strdup (uri);
- bl->priv->ldap_host = g_strdup(lud->lud_host);
- bl->priv->ldap_port = lud->lud_port;
- /* if a port wasn't specified, default to LDAP_PORT */
- if (bl->priv->ldap_port == 0)
- bl->priv->ldap_port = LDAP_PORT;
- bl->priv->ldap_rootdn = g_strdup(lud->lud_dn);
- bl->priv->ldap_limit = limit;
- bl->priv->ldap_timeout = timeout;
- bl->priv->ldap_scope = lud->lud_scope;
-
- ldap_free_urldesc(lud);
-
- return pas_backend_ldap_connect (bl);
- } else
- return GNOME_Evolution_Addressbook_OtherError;
-}
-
-static char*
-pas_backend_ldap_get_static_capabilities (PASBackend *backend)
-{
- return g_strdup("net");
-}
-
-static gboolean
-pas_backend_ldap_construct (PASBackendLDAP *backend)
-{
- g_assert (backend != NULL);
- g_assert (PAS_IS_BACKEND_LDAP (backend));
-
- if (! pas_backend_construct (PAS_BACKEND (backend)))
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * pas_backend_ldap_new:
- */
-PASBackend *
-pas_backend_ldap_new (void)
-{
- PASBackendLDAP *backend;
-
- backend = g_object_new (PAS_TYPE_BACKEND_LDAP, NULL);
-
- if (! pas_backend_ldap_construct (backend)) {
- g_object_unref (backend);
-
- return NULL;
- }
-
- return PAS_BACKEND (backend);
-}
-
-static gboolean
-call_dtor (int msgid, LDAPOp *op, gpointer data)
-{
- ldap_abandon (PAS_BACKEND_LDAP(op->backend)->priv->ldap, op->id);
-
- op->dtor (op);
-
- return TRUE;
-}
-
-static void
-pas_backend_ldap_dispose (GObject *object)
-{
- PASBackendLDAP *bl;
-
- bl = PAS_BACKEND_LDAP (object);
-
- if (bl->priv) {
- g_hash_table_foreach_remove (bl->priv->id_to_op, (GHRFunc)call_dtor, NULL);
- g_hash_table_destroy (bl->priv->id_to_op);
-
- if (bl->priv->poll_timeout != -1) {
- printf ("removing timeout\n");
- g_source_remove (bl->priv->poll_timeout);
- }
-
- if (bl->priv->supported_fields) {
- g_list_foreach (bl->priv->supported_fields, (GFunc)g_free, NULL);
- g_list_free (bl->priv->supported_fields);
- }
-
- if (bl->priv->supported_auth_methods) {
- g_list_foreach (bl->priv->supported_auth_methods, (GFunc)g_free, NULL);
- g_list_free (bl->priv->supported_auth_methods);
- }
-
- g_free (bl->priv->uri);
-
- g_free (bl->priv);
- bl->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (pas_backend_ldap_parent_class)->dispose)
- G_OBJECT_CLASS (pas_backend_ldap_parent_class)->dispose (object);
-}
-
-static void
-pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PASBackendClass *parent_class;
-
- /* get client side information (extensions present in the library) */
- get_ldap_library_info ();
-
- pas_backend_ldap_parent_class = g_type_class_peek_parent (klass);
-
- parent_class = PAS_BACKEND_CLASS (klass);
-
- /* Set the virtual methods. */
- parent_class->load_uri = pas_backend_ldap_load_uri;
- parent_class->get_static_capabilities = pas_backend_ldap_get_static_capabilities;
-
- parent_class->create_contact = pas_backend_ldap_process_create_contact;
- parent_class->remove_contacts = pas_backend_ldap_process_remove_contacts;
- parent_class->modify_contact = pas_backend_ldap_process_modify_contact;
- parent_class->get_contact = pas_backend_ldap_process_get_contact;
- parent_class->start_book_view = pas_backend_ldap_process_start_book_view;
- parent_class->stop_book_view = pas_backend_ldap_process_stop_book_view;
- parent_class->get_changes = pas_backend_ldap_process_get_changes;
- parent_class->authenticate_user = pas_backend_ldap_process_authenticate_user;
- parent_class->get_supported_fields = pas_backend_ldap_process_get_supported_fields;
- parent_class->get_supported_auth_methods = pas_backend_ldap_process_get_supported_auth_methods;
-
- object_class->dispose = pas_backend_ldap_dispose;
-}
-
-static void
-pas_backend_ldap_init (PASBackendLDAP *backend)
-{
- PASBackendLDAPPrivate *priv;
-
- priv = g_new0 (PASBackendLDAPPrivate, 1);
-
- priv->supported_fields = NULL;
- priv->supported_auth_methods = NULL;
- priv->ldap_limit = 100;
- priv->id_to_op = g_hash_table_new (g_int_hash, g_int_equal);
- priv->poll_timeout = -1;
-
- backend->priv = priv;
-}
-
-/**
- * pas_backend_ldap_get_type:
- */
-GType
-pas_backend_ldap_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendLDAPClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_ldap_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PASBackendLDAP),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_ldap_init
- };
-
- type = g_type_register_static (PAS_TYPE_BACKEND, "PASBackendLDAP", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/backend/pas/pas-backend-ldap.h b/addressbook/backend/pas/pas-backend-ldap.h
deleted file mode 100644
index ca04ee6a21..0000000000
--- a/addressbook/backend/pas/pas-backend-ldap.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __PAS_BACKEND_LDAP_H__
-#define __PAS_BACKEND_LDAP_H__
-
-#include "pas-backend.h"
-
-#define PAS_TYPE_BACKEND_LDAP (pas_backend_ldap_get_type ())
-#define PAS_BACKEND_LDAP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_LDAP, PASBackendLDAP))
-#define PAS_BACKEND_LDAP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendLDAPClass))
-#define PAS_IS_BACKEND_LDAP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_LDAP))
-#define PAS_IS_BACKEND_LDAP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_LDAP))
-#define PAS_BACKEND_LDAP_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_LDAP, PASBackendLDAPClass))
-
-typedef struct _PASBackendLDAPPrivate PASBackendLDAPPrivate;
-
-typedef struct {
- PASBackend parent_object;
- PASBackendLDAPPrivate *priv;
-} PASBackendLDAP;
-
-typedef struct {
- PASBackendClass parent_class;
-} PASBackendLDAPClass;
-
-PASBackend *pas_backend_ldap_new (void);
-GType pas_backend_ldap_get_type (void);
-
-#endif /* ! __PAS_BACKEND_LDAP_H__ */
-
diff --git a/addressbook/backend/pas/pas-backend-summary.c b/addressbook/backend/pas/pas-backend-summary.c
deleted file mode 100644
index 268a0c7062..0000000000
--- a/addressbook/backend/pas/pas-backend-summary.c
+++ /dev/null
@@ -1,1078 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * pas-backend-summary.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <netinet/in.h>
-
-#include <gal/widgets/e-unicode.h>
-
-#include "ebook/e-contact.h"
-#include "pas-backend-summary.h"
-#include "e-util/e-sexp.h"
-
-static GObjectClass *parent_class;
-
-struct _PASBackendSummaryPrivate {
- char *summary_path;
- FILE *fp;
- guint32 file_version;
- time_t mtime;
- gboolean upgraded;
- gboolean dirty;
- int flush_timeout_millis;
- int flush_timeout;
- GPtrArray *items;
- GHashTable *id_to_item;
- guint32 num_items; /* used only for loading */
-#ifdef SUMMARY_STATS
- int size;
-#endif
-};
-
-typedef struct {
- char *id;
- char *nickname;
- char *full_name;
- char *given_name;
- char *surname;
- char *file_as;
- char *email_1;
- char *email_2;
- char *email_3;
- gboolean wants_html;
- gboolean wants_html_set;
- gboolean list;
- gboolean list_show_addresses;
-} PASBackendSummaryItem;
-
-typedef struct {
- /* these lengths do *not* including the terminating \0, as
- it's not stored on disk. */
- guint16 id_len;
- guint16 nickname_len;
- guint16 full_name_len; /* version 3.0 field */
- guint16 given_name_len;
- guint16 surname_len;
- guint16 file_as_len;
- guint16 email_1_len;
- guint16 email_2_len;
- guint16 email_3_len;
- guint8 wants_html;
- guint8 wants_html_set;
- guint8 list;
- guint8 list_show_addresses;
-} PASBackendSummaryDiskItem;
-
-typedef struct {
- guint32 file_version;
- guint32 num_items;
- guint32 summary_mtime; /* version 2.0 field */
-} PASBackendSummaryHeader;
-
-#define PAS_SUMMARY_MAGIC "PAS-SUMMARY"
-#define PAS_SUMMARY_MAGIC_LEN 11
-
-#define PAS_SUMMARY_FILE_VERSION_1_0 1000
-#define PAS_SUMMARY_FILE_VERSION_2_0 2000
-#define PAS_SUMMARY_FILE_VERSION_3_0 3000
-#define PAS_SUMMARY_FILE_VERSION_4_0 4000
-
-#define PAS_SUMMARY_FILE_VERSION PAS_SUMMARY_FILE_VERSION_4_0
-
-static void
-free_summary_item (PASBackendSummaryItem *item)
-{
- g_free (item->id);
- g_free (item->nickname);
- g_free (item->full_name);
- g_free (item->given_name);
- g_free (item->surname);
- g_free (item->file_as);
- g_free (item->email_1);
- g_free (item->email_2);
- g_free (item->email_3);
- g_free (item);
-}
-
-static void
-clear_items (PASBackendSummary *summary)
-{
- int i;
- int num = summary->priv->items->len;
- for (i = 0; i < num; i++) {
- PASBackendSummaryItem *item = g_ptr_array_remove_index_fast (summary->priv->items, 0);
- g_hash_table_remove (summary->priv->id_to_item, item->id);
- free_summary_item (item);
- }
-}
-
-PASBackendSummary*
-pas_backend_summary_new (const char *summary_path, int flush_timeout_millis)
-{
- PASBackendSummary *summary = g_object_new (PAS_TYPE_BACKEND_SUMMARY, NULL);
-
- summary->priv->summary_path = g_strdup (summary_path);
- summary->priv->flush_timeout_millis = flush_timeout_millis;
- summary->priv->file_version = PAS_SUMMARY_FILE_VERSION_4_0;
-
- return summary;
-}
-
-static void
-pas_backend_summary_dispose (GObject *object)
-{
- PASBackendSummary *summary = PAS_BACKEND_SUMMARY (object);
-
- if (summary->priv) {
- if (summary->priv->dirty)
- g_warning ("Destroying dirty summary");
-
- if (summary->priv->flush_timeout) {
- g_source_remove (summary->priv->flush_timeout);
- summary->priv->flush_timeout = 0;
- }
-
- if (summary->priv->fp)
- fclose (summary->priv->fp);
-
- g_free (summary->priv->summary_path);
- clear_items (summary);
- g_ptr_array_free (summary->priv->items, TRUE);
-
- g_hash_table_destroy (summary->priv->id_to_item);
-
- g_free (summary->priv);
- summary->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-pas_backend_summary_class_init (PASBackendSummaryClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- /* Set the virtual methods. */
-
- object_class->dispose = pas_backend_summary_dispose;
-}
-
-static void
-pas_backend_summary_init (PASBackendSummary *summary)
-{
- PASBackendSummaryPrivate *priv;
-
- priv = g_new(PASBackendSummaryPrivate, 1);
-
- summary->priv = priv;
-
- priv->summary_path = NULL;
- priv->fp = NULL;
- priv->dirty = FALSE;
- priv->upgraded = FALSE;
- priv->items = g_ptr_array_new();
- priv->id_to_item = g_hash_table_new (g_str_hash, g_str_equal);
- priv->flush_timeout_millis = 0;
- priv->flush_timeout = 0;
-#ifdef SUMMARY_STATS
- priv->size = 0;
-#endif
-}
-
-/**
- * pas_backend_summary_get_type:
- */
-GType
-pas_backend_summary_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendSummaryClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_summary_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PASBackendSummary),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_summary_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "PASBackendSummary", &info, 0);
- }
-
- return type;
-}
-
-
-static gboolean
-pas_backend_summary_check_magic (PASBackendSummary *summary, FILE *fp)
-{
- char buf [PAS_SUMMARY_MAGIC_LEN + 1];
- int rv;
-
- memset (buf, 0, sizeof (buf));
-
- rv = fread (buf, PAS_SUMMARY_MAGIC_LEN, 1, fp);
- if (rv != 1)
- return FALSE;
- if (strcmp (buf, PAS_SUMMARY_MAGIC))
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-pas_backend_summary_load_header (PASBackendSummary *summary, FILE *fp,
- PASBackendSummaryHeader *header)
-{
- int rv;
-
- rv = fread (&header->file_version, sizeof (header->file_version), 1, fp);
- if (rv != 1)
- return FALSE;
-
- header->file_version = ntohl (header->file_version);
-
- if (header->file_version < PAS_SUMMARY_FILE_VERSION) {
- return FALSE; /* this will cause the entire summary to be rebuilt */
- }
-
- rv = fread (&header->num_items, sizeof (header->num_items), 1, fp);
- if (rv != 1)
- return FALSE;
-
- header->num_items = ntohl (header->num_items);
-
- rv = fread (&header->summary_mtime, sizeof (header->summary_mtime), 1, fp);
- if (rv != 1)
- return FALSE;
- header->summary_mtime = ntohl (header->summary_mtime);
-
- return TRUE;
-}
-
-static char *
-read_string (FILE *fp, int len)
-{
- char *buf;
- int rv;
-
- buf = g_new0 (char, len + 1);
-
- rv = fread (buf, len, 1, fp);
- if (rv != 1) {
- g_free (buf);
- return NULL;
- }
-
- return buf;
-}
-
-static gboolean
-pas_backend_summary_load_item (PASBackendSummary *summary,
- PASBackendSummaryItem **new_item)
-{
- PASBackendSummaryItem *item;
- char *buf;
- FILE *fp = summary->priv->fp;
-
- if (summary->priv->file_version >= PAS_SUMMARY_FILE_VERSION_4_0) {
- PASBackendSummaryDiskItem disk_item;
- int rv = fread (&disk_item, sizeof (disk_item), 1, fp);
- if (rv != 1)
- return FALSE;
-
- disk_item.id_len = ntohs (disk_item.id_len);
- disk_item.nickname_len = ntohs (disk_item.nickname_len);
- disk_item.full_name_len = ntohs (disk_item.full_name_len);
- disk_item.given_name_len = ntohs (disk_item.given_name_len);
- disk_item.surname_len = ntohs (disk_item.surname_len);
- disk_item.file_as_len = ntohs (disk_item.file_as_len);
- disk_item.email_1_len = ntohs (disk_item.email_1_len);
- disk_item.email_2_len = ntohs (disk_item.email_2_len);
- disk_item.email_3_len = ntohs (disk_item.email_3_len);
-
- item = g_new0 (PASBackendSummaryItem, 1);
-
- item->wants_html = disk_item.wants_html;
- item->wants_html_set = disk_item.wants_html_set;
- item->list = disk_item.list;
- item->list_show_addresses = disk_item.list_show_addresses;
-
- if (disk_item.id_len) {
- buf = read_string (fp, disk_item.id_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->id = buf;
- }
-
- if (disk_item.nickname_len) {
- buf = read_string (fp, disk_item.nickname_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->nickname = buf;
- }
-
- if (disk_item.full_name_len) {
- buf = read_string (fp, disk_item.full_name_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->full_name = buf;
- }
-
- if (disk_item.given_name_len) {
- buf = read_string (fp, disk_item.given_name_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->given_name = buf;
- }
-
- if (disk_item.surname_len) {
- buf = read_string (fp, disk_item.surname_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->surname = buf;
- }
-
- if (disk_item.file_as_len) {
- buf = read_string (fp, disk_item.file_as_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->file_as = buf;
- }
-
- if (disk_item.email_1_len) {
- buf = read_string (fp, disk_item.email_1_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->email_1 = buf;
- }
-
- if (disk_item.email_2_len) {
- buf = read_string (fp, disk_item.email_2_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->email_2 = buf;
- }
-
- if (disk_item.email_3_len) {
- buf = read_string (fp, disk_item.email_3_len);
- if (!buf) {
- free_summary_item (item);
- return FALSE;
- }
- item->email_3 = buf;
- }
-
- /* the only field that has to be there is the id */
- if (!item->id) {
- free_summary_item (item);
- return FALSE;
- }
- }
- else {
- /* unhandled file version */
- return FALSE;
- }
-
- *new_item = item;
- return TRUE;
-}
-
-/* opens the file and loads the header */
-static gboolean
-pas_backend_summary_open (PASBackendSummary *summary)
-{
- FILE *fp;
- PASBackendSummaryHeader header;
- struct stat sb;
-
- if (summary->priv->fp)
- return TRUE;
-
- if (stat (summary->priv->summary_path, &sb) == -1) {
- /* if there's no summary present, look for the .new
- file and rename it if it's there, and attempt to
- load that */
- char *new_filename = g_strconcat (summary->priv->summary_path, ".new", NULL);
- if (stat (new_filename, &sb) == -1) {
- g_warning ("no summary present");
- g_free (new_filename);
- return FALSE;
- }
- else {
- rename (new_filename, summary->priv->summary_path);
- g_free (new_filename);
- }
- }
-
- fp = fopen (summary->priv->summary_path, "r");
- if (!fp) {
- g_warning ("failed to open summary file");
- return FALSE;
- }
-
- if (!pas_backend_summary_check_magic (summary, fp)) {
- g_warning ("file is not a valid summary file");
- fclose (fp);
- return FALSE;
- }
-
- if (!pas_backend_summary_load_header (summary, fp, &header)) {
- g_warning ("failed to read summary header");
- fclose (fp);
- return FALSE;
- }
-
- summary->priv->num_items = header.num_items;
- summary->priv->file_version = header.file_version;
- summary->priv->mtime = header.summary_mtime;
- summary->priv->fp = fp;
-
- return TRUE;
-}
-
-gboolean
-pas_backend_summary_load (PASBackendSummary *summary)
-{
- PASBackendSummaryItem *new_item;
- int i;
-
- if (!pas_backend_summary_open (summary))
- return FALSE;
-
- for (i = 0; i < summary->priv->num_items; i ++) {
- if (!pas_backend_summary_load_item (summary, &new_item)) {
- g_warning ("error while reading summary item");
- clear_items (summary);
- fclose (summary->priv->fp);
- summary->priv->fp = NULL;
- summary->priv->dirty = FALSE;
- return FALSE;
- }
-
- g_ptr_array_add (summary->priv->items, new_item);
- g_hash_table_insert (summary->priv->id_to_item, new_item->id, new_item);
- }
-
- if (summary->priv->upgraded) {
- pas_backend_summary_save (summary);
- }
- summary->priv->dirty = FALSE;
-
- return TRUE;
-}
-
-static gboolean
-pas_backend_summary_save_magic (FILE *fp)
-{
- int rv;
- rv = fwrite (PAS_SUMMARY_MAGIC, PAS_SUMMARY_MAGIC_LEN, 1, fp);
- if (rv != 1)
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-pas_backend_summary_save_header (PASBackendSummary *summary, FILE *fp)
-{
- PASBackendSummaryHeader header;
- int rv;
-
- header.file_version = htonl (PAS_SUMMARY_FILE_VERSION);
- header.num_items = htonl (summary->priv->items->len);
- header.summary_mtime = htonl (time (NULL));
-
- rv = fwrite (&header, sizeof (header), 1, fp);
- if (rv != 1)
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-save_string (const char *str, FILE *fp)
-{
- int rv;
-
- if (!str || !*str)
- return TRUE;
-
- rv = fwrite (str, strlen (str), 1, fp);
- return (rv == 1);
-}
-
-static gboolean
-pas_backend_summary_save_item (PASBackendSummary *summary, FILE *fp, PASBackendSummaryItem *item)
-{
- PASBackendSummaryDiskItem disk_item;
- int len;
- int rv;
-
- len = item->id ? strlen (item->id) : 0;
- disk_item.id_len = htons (len);
-
- len = item->nickname ? strlen (item->nickname) : 0;
- disk_item.nickname_len = htons (len);
-
- len = item->given_name ? strlen (item->given_name) : 0;
- disk_item.given_name_len = htons (len);
-
- len = item->full_name ? strlen (item->full_name) : 0;
- disk_item.full_name_len = htons (len);
-
- len = item->surname ? strlen (item->surname) : 0;
- disk_item.surname_len = htons (len);
-
- len = item->file_as ? strlen (item->file_as) : 0;
- disk_item.file_as_len = htons (len);
-
- len = item->email_1 ? strlen (item->email_1) : 0;
- disk_item.email_1_len = htons (len);
-
- len = item->email_2 ? strlen (item->email_2) : 0;
- disk_item.email_2_len = htons (len);
-
- len = item->email_3 ? strlen (item->email_3) : 0;
- disk_item.email_3_len = htons (len);
-
- disk_item.wants_html = item->wants_html;
- disk_item.wants_html_set = item->wants_html_set;
- disk_item.list = item->list;
- disk_item.list_show_addresses = item->list_show_addresses;
-
- rv = fwrite (&disk_item, sizeof(disk_item), 1, fp);
- if (rv != 1)
- return FALSE;
-
- if (!save_string (item->id, fp))
- return FALSE;
- if (!save_string (item->nickname, fp))
- return FALSE;
- if (!save_string (item->full_name, fp))
- return FALSE;
- if (!save_string (item->given_name, fp))
- return FALSE;
- if (!save_string (item->surname, fp))
- return FALSE;
- if (!save_string (item->file_as, fp))
- return FALSE;
- if (!save_string (item->email_1, fp))
- return FALSE;
- if (!save_string (item->email_2, fp))
- return FALSE;
- if (!save_string (item->email_3, fp))
- return FALSE;
-
- return TRUE;
-}
-
-gboolean
-pas_backend_summary_save (PASBackendSummary *summary)
-{
- struct stat sb;
- FILE *fp = NULL;
- char *new_filename = NULL;
- int i;
-
- if (!summary->priv->dirty)
- return TRUE;
-
- new_filename = g_strconcat (summary->priv->summary_path, ".new", NULL);
-
- fp = fopen (new_filename, "w");
- if (!fp) {
- g_warning ("could not create new summary file");
- goto lose;
- }
-
- if (!pas_backend_summary_save_magic (fp)) {
- g_warning ("could not write magic to new summary file");
- goto lose;
- }
-
- if (!pas_backend_summary_save_header (summary, fp)) {
- g_warning ("could not write header to new summary file");
- goto lose;
- }
-
- for (i = 0; i < summary->priv->items->len; i ++) {
- PASBackendSummaryItem *item = g_ptr_array_index (summary->priv->items, i);
- if (!pas_backend_summary_save_item (summary, fp, item)) {
- g_warning ("failed to write an item to new summary file, errno = %d", errno);
- goto lose;
- }
- }
-
- fclose (fp);
-
- /* if we have a queued flush, clear it (since we just flushed) */
- if (summary->priv->flush_timeout) {
- g_source_remove (summary->priv->flush_timeout);
- summary->priv->flush_timeout = 0;
- }
-
- /* unlink the old summary and rename the new one */
- unlink (summary->priv->summary_path);
- rename (new_filename, summary->priv->summary_path);
-
- g_free (new_filename);
-
- /* lastly, update the in memory mtime to that of the file */
- if (stat (summary->priv->summary_path, &sb) == -1) {
- g_warning ("error stat'ing saved summary");
- }
- else {
- summary->priv->mtime = sb.st_mtime;
- }
-
- return TRUE;
-
- lose:
- if (fp)
- fclose (fp);
- if (new_filename)
- unlink (new_filename);
- g_free (new_filename);
- return FALSE;
-}
-
-void
-pas_backend_summary_add_contact (PASBackendSummary *summary, EContact *contact)
-{
- PASBackendSummaryItem *new_item;
-
- new_item = g_new0 (PASBackendSummaryItem, 1);
-
- new_item->id = e_contact_get (contact, E_CONTACT_UID);
- new_item->nickname = e_contact_get (contact, E_CONTACT_NICKNAME);
- new_item->full_name = e_contact_get (contact, E_CONTACT_FULL_NAME);
- new_item->given_name = e_contact_get (contact, E_CONTACT_GIVEN_NAME);
- new_item->surname = e_contact_get (contact, E_CONTACT_FAMILY_NAME);
- new_item->file_as = e_contact_get (contact, E_CONTACT_FILE_AS);
- new_item->email_1 = e_contact_get (contact, E_CONTACT_EMAIL_1);
- new_item->email_2 = e_contact_get (contact, E_CONTACT_EMAIL_2);
- new_item->email_3 = e_contact_get (contact, E_CONTACT_EMAIL_3);
- new_item->list = GPOINTER_TO_INT (e_contact_get (contact, E_CONTACT_IS_LIST));
- new_item->list_show_addresses = GPOINTER_TO_INT (e_contact_get (contact, E_CONTACT_LIST_SHOW_ADDRESSES));
- new_item->wants_html = GPOINTER_TO_INT (e_contact_get (contact, E_CONTACT_WANTS_HTML));
-
- g_ptr_array_add (summary->priv->items, new_item);
- g_hash_table_insert (summary->priv->id_to_item, new_item->id, new_item);
-
-#ifdef SUMMARY_STATS
- summary->priv->size += sizeof (PASBackendSummaryItem);
- summary->priv->size += new_item->id ? strlen (new_item->id) : 0;
- summary->priv->size += new_item->nickname ? strlen (new_item->nickname) : 0;
- summary->priv->size += new_item->full_name ? strlen (new_item->full_name) : 0;
- summary->priv->size += new_item->given_name ? strlen (new_item->given_name) : 0;
- summary->priv->size += new_item->surname ? strlen (new_item->surname) : 0;
- summary->priv->size += new_item->file_as ? strlen (new_item->file_as) : 0;
- summary->priv->size += new_item->email_1 ? strlen (new_item->email_1) : 0;
- summary->priv->size += new_item->email_2 ? strlen (new_item->email_2) : 0;
- summary->priv->size += new_item->email_3 ? strlen (new_item->email_3) : 0;
-#endif
- pas_backend_summary_touch (summary);
-}
-
-void
-pas_backend_summary_remove_contact (PASBackendSummary *summary, const char *id)
-{
- PASBackendSummaryItem *item = g_hash_table_lookup (summary->priv->id_to_item, id);
-
- if (item) {
- g_ptr_array_remove (summary->priv->items, item);
- g_hash_table_remove (summary->priv->id_to_item, id);
- free_summary_item (item);
- pas_backend_summary_touch (summary);
- return;
- }
-
- g_warning ("pas_backend_summary_remove_contact: unable to locate id `%s'", id);
-}
-
-static gboolean
-summary_flush_func (gpointer data)
-{
- PASBackendSummary *summary = PAS_BACKEND_SUMMARY (data);
-
- if (!summary->priv->dirty) {
- summary->priv->flush_timeout = 0;
- return FALSE;
- }
-
- if (!pas_backend_summary_save (summary)) {
- /* this isn't fatal, as we can just either 1) flush
- out with the next change, or 2) regen the summary
- when we next load the uri */
- g_warning ("failed to flush summary file to disk");
- return TRUE; /* try again after the next timeout */
- }
-
- g_warning ("flushed summary to disk");
-
- /* we only want this to execute once, so return FALSE and set
- summary->flush_timeout to 0 */
- summary->priv->flush_timeout = 0;
- return FALSE;
-}
-
-void
-pas_backend_summary_touch (PASBackendSummary *summary)
-{
- summary->priv->dirty = TRUE;
- if (!summary->priv->flush_timeout
- && summary->priv->flush_timeout_millis)
- summary->priv->flush_timeout = g_timeout_add (summary->priv->flush_timeout_millis,
- summary_flush_func, summary);
-}
-
-gboolean
-pas_backend_summary_is_up_to_date (PASBackendSummary *summary, time_t t)
-{
- if (!pas_backend_summary_open (summary))
- return FALSE;
- else
- return summary->priv->mtime >= t;
-}
-
-
-/* we only want to do summary queries if the query is over the set fields in the summary */
-
-static ESExpResult *
-func_check(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- ESExpResult *r;
- int truth = FALSE;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
- char *query_name = argv[0]->value.string;
-
- if (!strcmp (query_name, "nickname") ||
- !strcmp (query_name, "full_name") ||
- !strcmp (query_name, "file_as") ||
- !strcmp (query_name, "email")) {
- truth = TRUE;
- }
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-/* 'builtin' functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} check_symbols[] = {
- { "contains", func_check, 0 },
- { "is", func_check, 0 },
- { "beginswith", func_check, 0 },
- { "endswith", func_check, 0 },
-};
-
-gboolean
-pas_backend_summary_is_summary_query (PASBackendSummary *summary, const char *query)
-{
- ESExp *sexp;
- ESExpResult *r;
- gboolean retval;
- int i;
- int esexp_error;
-
- sexp = e_sexp_new();
-
- for(i=0;i<sizeof(check_symbols)/sizeof(check_symbols[0]);i++) {
- if (check_symbols[i].type == 1) {
- e_sexp_add_ifunction(sexp, 0, check_symbols[i].name,
- (ESExpIFunc *)check_symbols[i].func, summary);
- } else {
- e_sexp_add_function(sexp, 0, check_symbols[i].name,
- check_symbols[i].func, summary);
- }
- }
-
- e_sexp_input_text(sexp, query, strlen(query));
- esexp_error = e_sexp_parse(sexp);
-
- if (esexp_error == -1) {
- return FALSE;
- }
-
- r = e_sexp_eval(sexp);
-
- retval = (r && r->type == ESEXP_RES_BOOL && r->value.bool);
-
- e_sexp_result_free(sexp, r);
-
- e_sexp_unref (sexp);
-
- return retval;
-}
-
-
-
-/* the actual query mechanics */
-static ESExpResult *
-do_compare (PASBackendSummary *summary, struct _ESExp *f, int argc,
- struct _ESExpResult **argv,
- char *(*compare)(const char*, const char*))
-{
- GPtrArray *result = g_ptr_array_new ();
- ESExpResult *r;
- int i;
-
- if (argc == 2
- && argv[0]->type == ESEXP_RES_STRING
- && argv[1]->type == ESEXP_RES_STRING) {
-
- for (i = 0; i < summary->priv->items->len; i ++) {
- PASBackendSummaryItem *item = g_ptr_array_index (summary->priv->items, i);
- if (!strcmp (argv[0]->value.string, "full_name")) {
- char *given = item->given_name;
- char *surname = item->surname;
- if ((given && compare (given, argv[1]->value.string))
- || (surname && compare (surname, argv[1]->value.string)))
- g_ptr_array_add (result, item->id);
- }
- else if (!strcmp (argv[0]->value.string, "email")) {
- char *email_1 = item->email_1;
- char *email_2 = item->email_2;
- char *email_3 = item->email_3;
- if ((email_1 && compare (email_1, argv[1]->value.string))
- || (email_2 && compare (email_2, argv[1]->value.string))
- || (email_3 && compare (email_3, argv[1]->value.string)))
- g_ptr_array_add (result, item->id);
- }
- else if (!strcmp (argv[0]->value.string, "file_as")) {
- char *file_as = item->file_as;
- if (file_as && compare (file_as, argv[1]->value.string))
- g_ptr_array_add (result, item->id);
- }
- else if (!strcmp (argv[0]->value.string, "nickname")) {
- char *nickname = item->nickname;
- if (nickname && compare (nickname, argv[1]->value.string))
- g_ptr_array_add (result, item->id);
- }
- }
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = result;
-
- return r;
-}
-
-static ESExpResult *
-func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendSummary *summary = data;
-
- return do_compare (summary, f, argc, argv, (char *(*)(const char*, const char*)) e_utf8_strstrcase);
-}
-
-static char *
-is_helper (const char *s1, const char *s2)
-{
- if (!strcasecmp(s1, s2))
- return (char*)s1;
- else
- return NULL;
-}
-
-static ESExpResult *
-func_is(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendSummary *summary = data;
-
- return do_compare (summary, f, argc, argv, is_helper);
-}
-
-static char *
-endswith_helper (const char *s1, const char *s2)
-{
- char *p;
- if ((p = (char*)e_utf8_strstrcase(s1, s2))
- && (strlen(p) == strlen(s2)))
- return p;
- else
- return NULL;
-}
-
-static ESExpResult *
-func_endswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendSummary *summary = data;
-
- return do_compare (summary, f, argc, argv, endswith_helper);
-}
-
-static char *
-beginswith_helper (const char *s1, const char *s2)
-{
- char *p;
- if ((p = (char*)e_utf8_strstrcase(s1, s2))
- && (p == s1))
- return p;
- else
- return NULL;
-}
-
-static ESExpResult *
-func_beginswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- PASBackendSummary *summary = data;
-
- return do_compare (summary, f, argc, argv, beginswith_helper);
-}
-
-/* 'builtin' functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "contains", func_contains, 0 },
- { "is", func_is, 0 },
- { "beginswith", func_beginswith, 0 },
- { "endswith", func_endswith, 0 },
-};
-
-GPtrArray*
-pas_backend_summary_search (PASBackendSummary *summary, const char *query)
-{
- ESExp *sexp;
- ESExpResult *r;
- GPtrArray *retval = g_ptr_array_new();
- int i;
- int esexp_error;
-
- sexp = e_sexp_new();
-
- for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction(sexp, 0, symbols[i].name,
- (ESExpIFunc *)symbols[i].func, summary);
- } else {
- e_sexp_add_function(sexp, 0, symbols[i].name,
- symbols[i].func, summary);
- }
- }
-
- e_sexp_input_text(sexp, query, strlen(query));
- esexp_error = e_sexp_parse(sexp);
-
- if (esexp_error == -1) {
- return NULL;
- }
-
- r = e_sexp_eval(sexp);
-
- if (r && r->type == ESEXP_RES_ARRAY_PTR && r->value.ptrarray) {
- GPtrArray *ptrarray = r->value.ptrarray;
- int i;
-
- for (i = 0; i < ptrarray->len; i ++)
- g_ptr_array_add (retval, g_ptr_array_index (ptrarray, i));
- }
-
- e_sexp_result_free(sexp, r);
-
- e_sexp_unref (sexp);
-
- return retval;
-}
-
-char*
-pas_backend_summary_get_summary_vcard(PASBackendSummary *summary, const char *id)
-{
- PASBackendSummaryItem *item = g_hash_table_lookup (summary->priv->id_to_item, id);
-
- if (item) {
- EContact *contact = e_contact_new ();
- char *vcard;
-
- e_contact_set (contact, E_CONTACT_UID, item->id);
- e_contact_set (contact, E_CONTACT_FILE_AS, item->file_as);
- e_contact_set (contact, E_CONTACT_GIVEN_NAME, item->given_name);
- e_contact_set (contact, E_CONTACT_FAMILY_NAME, item->surname);
- e_contact_set (contact, E_CONTACT_NICKNAME, item->nickname);
- e_contact_set (contact, E_CONTACT_FULL_NAME, item->full_name);
- e_contact_set (contact, E_CONTACT_EMAIL_1, item->email_1);
- e_contact_set (contact, E_CONTACT_EMAIL_2, item->email_2);
- e_contact_set (contact, E_CONTACT_EMAIL_3, item->email_3);
-
- e_contact_set (contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (item->list));
- e_contact_set (contact, E_CONTACT_LIST_SHOW_ADDRESSES, GINT_TO_POINTER (item->list_show_addresses));
- e_contact_set (contact, E_CONTACT_WANTS_HTML, GINT_TO_POINTER (item->wants_html));
-
- vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
- g_object_unref (contact);
-
- return vcard;
- }
- else {
- g_warning ("in unable to locate card `%s' in summary", id);
- return NULL;
- }
-}
-
diff --git a/addressbook/backend/pas/pas-backend-summary.h b/addressbook/backend/pas/pas-backend-summary.h
deleted file mode 100644
index bb07e0fb27..0000000000
--- a/addressbook/backend/pas/pas-backend-summary.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * pas-backend-summary.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef __PAS_BACKEND_SUMMARY_H__
-#define __PAS_BACKEND_SUMMARY_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <pas/pas-types.h>
-#include <ebook/e-contact.h>
-
-#define PAS_TYPE_BACKEND_SUMMARY (pas_backend_summary_get_type ())
-#define PAS_BACKEND_SUMMARY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_SUMMARY, PASBackendSummary))
-#define PAS_BACKEND_SUMMARY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendSummaryClass))
-#define PAS_IS_BACKEND_SUMMARY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_SUMMARY))
-#define PAS_IS_BACKEND_SUMMARY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_SUMMARY))
-#define PAS_BACKEND_SUMMARY_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_SUMMARY, PASBackendSummaryClass))
-
-typedef struct _PASBackendSummaryPrivate PASBackendSummaryPrivate;
-
-struct _PASBackendSummary{
- GObject parent_object;
- PASBackendSummaryPrivate *priv;
-};
-
-struct _PASBackendSummaryClass{
- GObjectClass parent_class;
-};
-
-PASBackendSummary* pas_backend_summary_new (const char *summary_path,
- int flush_timeout_millis);
-GType pas_backend_summary_get_type (void);
-
-/* returns FALSE if the load fails for any reason (including that the
- summary is out of date), TRUE if it succeeds */
-gboolean pas_backend_summary_load (PASBackendSummary *summary);
-/* returns FALSE if the save fails, TRUE if it succeeds (or isn't required due to no changes) */
-gboolean pas_backend_summary_save (PASBackendSummary *summary);
-
-void pas_backend_summary_add_contact (PASBackendSummary *summary, EContact *contact);
-void pas_backend_summary_remove_contact (PASBackendSummary *summary, const char *id);
-
-void pas_backend_summary_touch (PASBackendSummary *summary);
-
-/* returns TRUE if the summary's mtime is >= @t. */
-gboolean pas_backend_summary_is_up_to_date (PASBackendSummary *summary, time_t t);
-
-gboolean pas_backend_summary_is_summary_query (PASBackendSummary *summary, const char *query);
-GPtrArray* pas_backend_summary_search (PASBackendSummary *summary, const char *query);
-char* pas_backend_summary_get_summary_vcard (PASBackendSummary *summary, const char *id);
-
-#endif /* __PAS_BACKEND_SUMMARY_H__ */
diff --git a/addressbook/backend/pas/pas-backend-sync.c b/addressbook/backend/pas/pas-backend-sync.c
deleted file mode 100644
index 45063eddc6..0000000000
--- a/addressbook/backend/pas/pas-backend-sync.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author:
- * Chris Toshok (toshok@ximian.com)
- *
- * Copyright (C) 2003, Ximian, Inc.
- */
-
-#include <config.h>
-#include "pas-backend-sync.h"
-#include "pas-marshal.h"
-
-struct _PASBackendSyncPrivate {
- int mumble;
-};
-
-static GObjectClass *parent_class;
-
-gboolean
-pas_backend_sync_construct (PASBackendSync *backend)
-{
- return TRUE;
-}
-
-PASBackendSyncStatus
-pas_backend_sync_create_contact (PASBackendSync *backend,
- PASBook *book,
- const char *vcard,
- EContact **contact)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (vcard, GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (contact, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->create_contact_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->create_contact_sync) (backend, book, vcard, contact);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_remove (PASBackendSync *backend,
- PASBook *book)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->remove_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->remove_sync) (backend, book);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_remove_contacts (PASBackendSync *backend,
- PASBook *book,
- GList *id_list,
- GList **removed_ids)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (id_list, GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (removed_ids, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->remove_contacts_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->remove_contacts_sync) (backend, book, id_list, removed_ids);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_modify_contact (PASBackendSync *backend,
- PASBook *book,
- const char *vcard,
- EContact **contact)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (vcard, GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (contact, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->modify_contact_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->modify_contact_sync) (backend, book, vcard, contact);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_get_contact (PASBackendSync *backend,
- PASBook *book,
- const char *id,
- char **vcard)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (id, GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (vcard, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->get_contact_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->get_contact_sync) (backend, book, id, vcard);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_get_contact_list (PASBackendSync *backend,
- PASBook *book,
- const char *query,
- GList **contacts)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (query, GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (contacts, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->get_contact_list_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->get_contact_list_sync) (backend, book, query, contacts);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_get_changes (PASBackendSync *backend,
- PASBook *book,
- const char *change_id,
- GList **changes)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (change_id, GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (changes, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->get_changes_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->get_changes_sync) (backend, book, change_id, changes);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_authenticate_user (PASBackendSync *backend,
- PASBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (user && passwd && auth_method, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->authenticate_user_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->authenticate_user_sync) (backend, book, user, passwd, auth_method);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_get_supported_fields (PASBackendSync *backend,
- PASBook *book,
- GList **fields)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (fields, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->get_supported_fields_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->get_supported_fields_sync) (backend, book, fields);
-}
-
-PASBackendSyncStatus
-pas_backend_sync_get_supported_auth_methods (PASBackendSync *backend,
- PASBook *book,
- GList **methods)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND_SYNC (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (methods, GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_SYNC_GET_CLASS (backend)->get_supported_auth_methods_sync);
-
- return (* PAS_BACKEND_SYNC_GET_CLASS (backend)->get_supported_auth_methods_sync) (backend, book, methods);
-}
-
-static void
-_pas_backend_remove (PASBackend *backend,
- PASBook *book)
-{
- PASBackendSyncStatus status;
-
- status = pas_backend_sync_remove (PAS_BACKEND_SYNC (backend), book);
-
- pas_book_respond_remove (book, status);
-}
-
-static void
-_pas_backend_create_contact (PASBackend *backend,
- PASBook *book,
- const char *vcard)
-{
- PASBackendSyncStatus status;
- EContact *contact;
-
- status = pas_backend_sync_create_contact (PAS_BACKEND_SYNC (backend), book, vcard, &contact);
-
- pas_book_respond_create (book, status, contact);
-
- g_object_unref (contact);
-}
-
-static void
-_pas_backend_remove_contacts (PASBackend *backend,
- PASBook *book,
- GList *id_list)
-{
- PASBackendSyncStatus status;
- GList *ids = NULL;
-
- status = pas_backend_sync_remove_contacts (PAS_BACKEND_SYNC (backend), book, id_list, &ids);
-
- pas_book_respond_remove_contacts (book, status, ids);
-
- g_list_free (ids);
-}
-
-static void
-_pas_backend_modify_contact (PASBackend *backend,
- PASBook *book,
- const char *vcard)
-{
- PASBackendSyncStatus status;
- EContact *contact;
-
- status = pas_backend_sync_modify_contact (PAS_BACKEND_SYNC (backend), book, vcard, &contact);
-
- pas_book_respond_modify (book, status, contact);
-
- g_object_unref (contact);
-}
-
-static void
-_pas_backend_get_contact (PASBackend *backend,
- PASBook *book,
- const char *id)
-{
- PASBackendSyncStatus status;
- char *vcard;
-
- status = pas_backend_sync_get_contact (PAS_BACKEND_SYNC (backend), book, id, &vcard);
-
- pas_book_respond_get_contact (book, status, vcard);
-
- g_free (vcard);
-}
-
-static void
-_pas_backend_get_contact_list (PASBackend *backend,
- PASBook *book,
- const char *query)
-{
- PASBackendSyncStatus status;
- GList *cards = NULL;
-
- status = pas_backend_sync_get_contact_list (PAS_BACKEND_SYNC (backend), book, query, &cards);
-
- pas_book_respond_get_contact_list (book, status, cards);
-}
-
-static void
-_pas_backend_get_changes (PASBackend *backend,
- PASBook *book,
- const char *change_id)
-{
- PASBackendSyncStatus status;
- GList *changes = NULL;
-
- status = pas_backend_sync_get_changes (PAS_BACKEND_SYNC (backend), book, change_id, &changes);
-
- pas_book_respond_get_changes (book, status, changes);
-
- /* XXX free view? */
-}
-
-static void
-_pas_backend_authenticate_user (PASBackend *backend,
- PASBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method)
-{
- PASBackendSyncStatus status;
-
- status = pas_backend_sync_authenticate_user (PAS_BACKEND_SYNC (backend), book, user, passwd, auth_method);
-
- pas_book_respond_authenticate_user (book, status);
-}
-
-static void
-_pas_backend_get_supported_fields (PASBackend *backend,
- PASBook *book)
-{
- PASBackendSyncStatus status;
- GList *fields = NULL;
-
- status = pas_backend_sync_get_supported_fields (PAS_BACKEND_SYNC (backend), book, &fields);
-
- pas_book_respond_get_supported_fields (book, status, fields);
-
- g_list_foreach (fields, (GFunc)g_free, NULL);
- g_list_free (fields);
-}
-
-static void
-_pas_backend_get_supported_auth_methods (PASBackend *backend,
- PASBook *book)
-{
- PASBackendSyncStatus status;
- GList *methods = NULL;
-
- status = pas_backend_sync_get_supported_auth_methods (PAS_BACKEND_SYNC (backend), book, &methods);
-
- pas_book_respond_get_supported_auth_methods (book, status, methods);
-
- g_list_foreach (methods, (GFunc)g_free, NULL);
- g_list_free (methods);
-}
-
-static void
-pas_backend_sync_init (PASBackendSync *backend)
-{
- PASBackendSyncPrivate *priv;
-
- priv = g_new0 (PASBackendSyncPrivate, 1);
-
- backend->priv = priv;
-}
-
-static void
-pas_backend_sync_dispose (GObject *object)
-{
- PASBackendSync *backend;
-
- backend = PAS_BACKEND_SYNC (object);
-
- if (backend->priv) {
- g_free (backend->priv);
-
- backend->priv = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-pas_backend_sync_class_init (PASBackendSyncClass *klass)
-{
- GObjectClass *object_class;
- PASBackendClass *backend_class = PAS_BACKEND_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class = (GObjectClass *) klass;
-
- backend_class->remove = _pas_backend_remove;
- backend_class->create_contact = _pas_backend_create_contact;
- backend_class->remove_contacts = _pas_backend_remove_contacts;
- backend_class->modify_contact = _pas_backend_modify_contact;
- backend_class->get_contact = _pas_backend_get_contact;
- backend_class->get_contact_list = _pas_backend_get_contact_list;
- backend_class->get_changes = _pas_backend_get_changes;
- backend_class->authenticate_user = _pas_backend_authenticate_user;
- backend_class->get_supported_fields = _pas_backend_get_supported_fields;
- backend_class->get_supported_auth_methods = _pas_backend_get_supported_auth_methods;
-
- object_class->dispose = pas_backend_sync_dispose;
-}
-
-/**
- * pas_backend_get_type:
- */
-GType
-pas_backend_sync_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendSyncClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_sync_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PASBackendSync),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_sync_init
- };
-
- type = g_type_register_static (PAS_TYPE_BACKEND, "PASBackendSync", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/backend/pas/pas-backend-sync.h b/addressbook/backend/pas/pas-backend-sync.h
deleted file mode 100644
index 2e176d9f5d..0000000000
--- a/addressbook/backend/pas/pas-backend-sync.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- */
-
-#ifndef __PAS_BACKEND_SYNC_H__
-#define __PAS_BACKEND_SYNC_H__
-
-#include <glib.h>
-#include <pas/pas-types.h>
-#include <pas/pas-backend.h>
-#include <pas/addressbook.h>
-
-#define PAS_TYPE_BACKEND_SYNC (pas_backend_sync_get_type ())
-#define PAS_BACKEND_SYNC(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_SYNC, PASBackendSync))
-#define PAS_BACKEND_SYNC_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_TYPE_BACKEND_SYNC, PASBackendSyncClass))
-#define PAS_IS_BACKEND_SYNC(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_SYNC))
-#define PAS_IS_BACKEND_SYNC_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_SYNC))
-#define PAS_BACKEND_SYNC_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((k), PAS_TYPE_BACKEND_SYNC, PASBackendSyncClass))
-
-typedef struct _PASBackendSyncPrivate PASBackendSyncPrivate;
-
-typedef GNOME_Evolution_Addressbook_CallStatus PASBackendSyncStatus;
-
-struct _PASBackendSync {
- PASBackend parent_object;
- PASBackendSyncPrivate *priv;
-};
-
-struct _PASBackendSyncClass {
- PASBackendClass parent_class;
-
- /* Virtual methods */
- PASBackendSyncStatus (*remove_sync) (PASBackendSync *backend, PASBook *book);
- PASBackendSyncStatus (*create_contact_sync) (PASBackendSync *backend, PASBook *book,
- const char *vcard, EContact **contact);
- PASBackendSyncStatus (*remove_contacts_sync) (PASBackendSync *backend, PASBook *book,
- GList *id_list, GList **removed_ids);
- PASBackendSyncStatus (*modify_contact_sync) (PASBackendSync *backend, PASBook *book,
- const char *vcard, EContact **contact);
- PASBackendSyncStatus (*get_contact_sync) (PASBackendSync *backend, PASBook *book,
- const char *id, char **vcard);
- PASBackendSyncStatus (*get_contact_list_sync) (PASBackendSync *backend, PASBook *book,
- const char *query, GList **contacts);
- PASBackendSyncStatus (*get_changes_sync) (PASBackendSync *backend, PASBook *book,
- const char *change_id, GList **changes);
- PASBackendSyncStatus (*authenticate_user_sync) (PASBackendSync *backend, PASBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method);
- PASBackendSyncStatus (*get_supported_fields_sync) (PASBackendSync *backend, PASBook *book,
- GList **fields);
- PASBackendSyncStatus (*get_supported_auth_methods_sync) (PASBackendSync *backend, PASBook *book,
- GList **methods);
-
- /* Padding for future expansion */
- void (*_pas_reserved0) (void);
- void (*_pas_reserved1) (void);
- void (*_pas_reserved2) (void);
- void (*_pas_reserved3) (void);
- void (*_pas_reserved4) (void);
-
-};
-
-typedef PASBackendSync * (*PASBackendSyncFactoryFn) (void);
-
-gboolean pas_backend_sync_construct (PASBackendSync *backend);
-
-GType pas_backend_sync_get_type (void);
-
-PASBackendSyncStatus pas_backend_sync_remove (PASBackendSync *backend, PASBook *book);
-PASBackendSyncStatus pas_backend_sync_create_contact (PASBackendSync *backend, PASBook *book, const char *vcard, EContact **contact);
-PASBackendSyncStatus pas_backend_sync_remove_contacts (PASBackendSync *backend, PASBook *book, GList *id_list, GList **removed_ids);
-PASBackendSyncStatus pas_backend_sync_modify_contact (PASBackendSync *backend, PASBook *book, const char *vcard, EContact **contact);
-PASBackendSyncStatus pas_backend_sync_get_contact (PASBackendSync *backend, PASBook *book, const char *id, char **vcard);
-PASBackendSyncStatus pas_backend_sync_get_contact_list (PASBackendSync *backend, PASBook *book, const char *query, GList **contacts);
-PASBackendSyncStatus pas_backend_sync_get_changes (PASBackendSync *backend, PASBook *book, const char *change_id, GList **changes);
-PASBackendSyncStatus pas_backend_sync_authenticate_user (PASBackendSync *backend, PASBook *book, const char *user, const char *passwd, const char *auth_method);
-PASBackendSyncStatus pas_backend_sync_get_supported_fields (PASBackendSync *backend, PASBook *book, GList **fields);
-PASBackendSyncStatus pas_backend_sync_get_supported_auth_methods (PASBackendSync *backend, PASBook *book, GList **methods);
-
-#endif /* ! __PAS_BACKEND_SYNC_H__ */
diff --git a/addressbook/backend/pas/pas-backend-vcf.c b/addressbook/backend/pas/pas-backend-vcf.c
deleted file mode 100644
index e82fe04f56..0000000000
--- a/addressbook/backend/pas/pas-backend-vcf.c
+++ /dev/null
@@ -1,675 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author:
- * Chris Toshok (toshok@ximian.com)
- *
- * Copyright (C) 2003, Ximian, Inc.
- */
-
-#include "config.h"
-#include "pas-backend-vcf.h"
-#include "pas-backend-card-sexp.h"
-#include "pas-book.h"
-#include "pas-book-view.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <time.h>
-#include <sys/stat.h>
-
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-unicode.h>
-
-#include <ebook/e-contact.h>
-#include <libgnome/gnome-i18n.h>
-
-#define PAS_ID_PREFIX "pas-id-"
-#define FILE_FLUSH_TIMEOUT 5000
-
-static PASBackendSyncClass *pas_backend_vcf_parent_class;
-typedef struct _PASBackendVCFBookView PASBackendVCFBookView;
-typedef struct _PASBackendVCFSearchContext PASBackendVCFSearchContext;
-
-struct _PASBackendVCFPrivate {
- char *uri;
- char *filename;
- GMutex *mutex;
- GHashTable *contacts;
- gboolean dirty;
- int flush_timeout_tag;
-};
-
-static char *
-pas_backend_vcf_create_unique_id ()
-{
- /* use a 32 counter and the 32 bit timestamp to make an id.
- it's doubtful 2^32 id's will be created in a second, so we
- should be okay. */
- static guint c = 0;
- return g_strdup_printf (PAS_ID_PREFIX "%08lX%08X", time(NULL), c++);
-}
-
-typedef struct {
- PASBackendVCF *bvcf;
- PASBook *book;
- PASBookView *view;
-} VCFBackendSearchClosure;
-
-static void
-free_search_closure (VCFBackendSearchClosure *closure)
-{
- g_free (closure);
-}
-
-static void
-foreach_search_compare (char *id, char *vcard_string, VCFBackendSearchClosure *closure)
-{
- EContact *contact;
-
- contact = e_contact_new_from_vcard (vcard_string);
- pas_book_view_notify_update (closure->view, contact);
- g_object_unref (contact);
-}
-
-static gboolean
-pas_backend_vcf_search_timeout (gpointer data)
-{
- VCFBackendSearchClosure *closure = data;
-
- g_hash_table_foreach (closure->bvcf->priv->contacts,
- (GHFunc)foreach_search_compare,
- closure);
-
- pas_book_view_notify_complete (closure->view, GNOME_Evolution_Addressbook_Success);
-
- free_search_closure (closure);
-
- return FALSE;
-}
-
-
-static void
-pas_backend_vcf_search (PASBackendVCF *bvcf,
- PASBookView *book_view)
-{
- const char *query = pas_book_view_get_card_query (book_view);
- VCFBackendSearchClosure *closure = g_new0 (VCFBackendSearchClosure, 1);
-
- if ( ! strcmp (query, "(contains \"x-evolution-any-field\" \"\")"))
- pas_book_view_notify_status_message (book_view, _("Loading..."));
- else
- pas_book_view_notify_status_message (book_view, _("Searching..."));
-
- closure->view = book_view;
- closure->bvcf = bvcf;
-
- g_idle_add (pas_backend_vcf_search_timeout, closure);
-}
-
-static void
-insert_contact (PASBackendVCF *vcf, char *vcard)
-{
- EContact *contact = e_contact_new_from_vcard (vcard);
- char *id;
-
- id = e_contact_get (contact, E_CONTACT_UID);
- if (id)
- g_hash_table_insert (vcf->priv->contacts,
- id,
- e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30));
-}
-
-static void
-load_file (PASBackendVCF *vcf, int fd)
-{
- FILE *fp;
- GString *str;
- char buf[1024];
-
- fp = fdopen (fd, "r");
- if (!fp) {
- g_warning ("failed to open `%s' for reading", vcf->priv->filename);
- return;
- }
-
- str = g_string_new ("");
-
- while (fgets (buf, sizeof (buf), fp)) {
- if (!strcmp (buf, "\r\n")) {
- /* if the string has accumulated some stuff, create a contact for it and start over */
- if (str->len) {
- insert_contact (vcf, str->str);
- g_string_assign (str, "");
- }
- }
- else {
- g_string_append (str, buf);
- }
- }
- if (str->len) {
- insert_contact (vcf, str->str);
- }
-
- g_string_free (str, TRUE);
-
- fclose (fp);
-}
-
-static void
-foreach_build_list (char *id, char *vcard_string, GList **list)
-{
- *list = g_list_append (*list, vcard_string);
-}
-
-static gboolean
-save_file (PASBackendVCF *vcf)
-{
- GList *vcards = NULL;
- GList *l;
- char *new_path;
- int fd, rv;
-
- g_warning ("PASBackendVCF flushing file to disk");
-
- g_mutex_lock (vcf->priv->mutex);
- g_hash_table_foreach (vcf->priv->contacts, (GHFunc)foreach_build_list, &vcards);
-
- new_path = g_strdup_printf ("%s.new", vcf->priv->filename);
-
- fd = open (new_path, O_CREAT | O_TRUNC | O_WRONLY, 0666);
-
- for (l = vcards; l; l = l->next) {
- char *vcard_str = l->data;
- int len = strlen (vcard_str);
-
- rv = write (fd, vcard_str, len);
-
- if (rv < len) {
- /* XXX */
- g_warning ("write failed. we need to handle short writes\n");
- close (fd);
- unlink (new_path);
- return FALSE;
- }
-
- rv = write (fd, "\r\n\r\n", 4);
- if (rv < 4) {
- /* XXX */
- g_warning ("write failed. we need to handle short writes\n");
- close (fd);
- unlink (new_path);
- return FALSE;
- }
- }
-
- if (0 > rename (new_path, vcf->priv->filename)) {
- g_warning ("Failed to rename %s: %s\n", vcf->priv->filename, strerror(errno));
- unlink (new_path);
- return FALSE;
- }
-
- g_list_free (vcards);
- g_free (new_path);
-
- vcf->priv->dirty = FALSE;
-
- g_mutex_unlock (vcf->priv->mutex);
-
- return TRUE;
-}
-
-static gboolean
-vcf_flush_file (gpointer data)
-{
- PASBackendVCF *bvcf = PAS_BACKEND_VCF (data);
-
- if (!bvcf->priv->dirty) {
- bvcf->priv->flush_timeout_tag = 0;
- return FALSE;
- }
-
- if (!save_file (bvcf)) {
- g_warning ("failed to flush the .vcf file to disk, will try again next timeout");
- return TRUE;
- }
-
- bvcf->priv->flush_timeout_tag = 0;
- return FALSE;
-}
-
-static EContact *
-do_create(PASBackendVCF *bvcf,
- const char *vcard_req,
- gboolean dirty_the_file)
-{
- char *id;
- EContact *contact;
- char *vcard;
-
- /* at the very least we need the unique_id generation to be
- protected by the lock, even if the actual vcard parsing
- isn't. */
- g_mutex_lock (bvcf->priv->mutex);
- id = pas_backend_vcf_create_unique_id ();
-
- contact = e_contact_new_from_vcard (vcard_req);
- e_contact_set(contact, E_CONTACT_UID, id);
- vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
- g_hash_table_insert (bvcf->priv->contacts, id, vcard);
-
- if (dirty_the_file) {
- bvcf->priv->dirty = TRUE;
-
- if (!bvcf->priv->flush_timeout_tag)
- bvcf->priv->flush_timeout_tag = g_timeout_add (FILE_FLUSH_TIMEOUT,
- vcf_flush_file, bvcf);
- }
-
- g_mutex_unlock (bvcf->priv->mutex);
-
- return contact;
-}
-
-static PASBackendSyncStatus
-pas_backend_vcf_process_create_contact (PASBackendSync *backend,
- PASBook *book,
- const char *vcard,
- EContact **contact)
-{
- PASBackendVCF *bvcf = PAS_BACKEND_VCF (backend);
-
- *contact = do_create(bvcf, vcard, TRUE);
- if (*contact) {
- return GNOME_Evolution_Addressbook_Success;
- }
- else {
- /* XXX need a different call status for this case, i
- think */
- return GNOME_Evolution_Addressbook_ContactNotFound;
- }
-}
-
-static PASBackendSyncStatus
-pas_backend_vcf_process_remove_contacts (PASBackendSync *backend,
- PASBook *book,
- GList *id_list,
- GList **ids)
-{
- /* FIXME: make this handle bulk deletes like the file backend does */
- PASBackendVCF *bvcf = PAS_BACKEND_VCF (backend);
- char *id = id_list->data;
- gboolean success;
-
- g_mutex_lock (bvcf->priv->mutex);
- success = g_hash_table_remove (bvcf->priv->contacts, id);
-
- if (!success) {
- g_mutex_unlock (bvcf->priv->mutex);
- return GNOME_Evolution_Addressbook_ContactNotFound;
- }
- else {
- bvcf->priv->dirty = TRUE;
- if (!bvcf->priv->flush_timeout_tag)
- bvcf->priv->flush_timeout_tag = g_timeout_add (FILE_FLUSH_TIMEOUT,
- vcf_flush_file, bvcf);
- g_mutex_unlock (bvcf->priv->mutex);
-
- *ids = g_list_append (*ids, id);
-
- return GNOME_Evolution_Addressbook_Success;
- }
-}
-
-static PASBackendSyncStatus
-pas_backend_vcf_process_modify_contact (PASBackendSync *backend,
- PASBook *book,
- const char *vcard,
- EContact **contact)
-{
- PASBackendVCF *bvcf = PAS_BACKEND_VCF (backend);
- char *old_id, *old_vcard_string;
- const char *id;
- gboolean success;
-
- /* create a new ecard from the request data */
- *contact = e_contact_new_from_vcard (vcard);
- id = e_contact_get_const (*contact, E_CONTACT_UID);
-
- g_mutex_lock (bvcf->priv->mutex);
- success = g_hash_table_lookup_extended (bvcf->priv->contacts, id, (gpointer)&old_id, (gpointer)&old_vcard_string);
-
- if (!success) {
- g_mutex_unlock (bvcf->priv->mutex);
- return GNOME_Evolution_Addressbook_ContactNotFound;
- }
- else {
- g_hash_table_insert (bvcf->priv->contacts, old_id, g_strdup (vcard));
- bvcf->priv->dirty = TRUE;
- if (!bvcf->priv->flush_timeout_tag)
- bvcf->priv->flush_timeout_tag = g_timeout_add (FILE_FLUSH_TIMEOUT,
- vcf_flush_file, bvcf);
- g_mutex_unlock (bvcf->priv->mutex);
-
- g_free (old_vcard_string);
-
- return GNOME_Evolution_Addressbook_Success;
- }
-}
-
-static PASBackendSyncStatus
-pas_backend_vcf_process_get_contact (PASBackendSync *backend,
- PASBook *book,
- const char *id,
- char **vcard)
-{
- PASBackendVCF *bvcf = PAS_BACKEND_VCF (backend);
- char *v;
-
- v = g_hash_table_lookup (bvcf->priv->contacts, id);
-
- if (v) {
- *vcard = g_strdup (v);
- return GNOME_Evolution_Addressbook_Success;
- } else {
- *vcard = g_strdup ("");
- return GNOME_Evolution_Addressbook_ContactNotFound;
- }
-}
-
-
-typedef struct {
- PASBackendVCF *bvcf;
- gboolean search_needed;
- PASBackendCardSExp *card_sexp;
- GList *list;
-} GetContactListClosure;
-
-static void
-foreach_get_contact_compare (char *id, char *vcard_string, GetContactListClosure *closure)
-{
- if ((!closure->search_needed) || pas_backend_card_sexp_match_vcard (closure->card_sexp, vcard_string)) {
- closure->list = g_list_append (closure->list, g_strdup (vcard_string));
- }
-}
-
-static PASBackendSyncStatus
-pas_backend_vcf_process_get_contact_list (PASBackendSync *backend,
- PASBook *book,
- const char *query,
- GList **contacts)
-{
- PASBackendVCF *bvcf = PAS_BACKEND_VCF (backend);
- const char *search = query;
- GetContactListClosure closure;
-
- closure.bvcf = bvcf;
- closure.search_needed = strcmp (search, "(contains \"x-evolution-any-field\" \"\")");
- closure.card_sexp = pas_backend_card_sexp_new (search);
- closure.list = NULL;
-
- g_hash_table_foreach (bvcf->priv->contacts, (GHFunc)foreach_get_contact_compare, &closure);
-
- g_object_unref (closure.card_sexp);
-
- *contacts = closure.list;
- return GNOME_Evolution_Addressbook_Success;
-}
-
-static void
-pas_backend_vcf_start_book_view (PASBackend *backend,
- PASBookView *book_view)
-{
- pas_backend_vcf_search (PAS_BACKEND_VCF (backend), book_view);
-}
-
-static void
-pas_backend_vcf_stop_book_view (PASBackend *backend,
- PASBookView *book_view)
-{
- /* XXX nothing here yet, and there should be. */
-}
-
-static char *
-pas_backend_vcf_extract_path_from_uri (const char *uri)
-{
- g_assert (strncasecmp (uri, "vcf://", 6) == 0);
-
- return g_strdup (uri + 6);
-}
-
-static PASBackendSyncStatus
-pas_backend_vcf_process_authenticate_user (PASBackendSync *backend,
- PASBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method)
-{
- return GNOME_Evolution_Addressbook_Success;
-}
-
-static PASBackendSyncStatus
-pas_backend_vcf_process_get_supported_fields (PASBackendSync *backend,
- PASBook *book,
- GList **fields_out)
-{
- GList *fields = NULL;
- int i;
-
- /* XXX we need a way to say "we support everything", since the
- vcf backend does */
- for (i = 0; i < E_CONTACT_FIELD_LAST; i ++)
- fields = g_list_append (fields, (char*)e_contact_field_name (i));
-
- *fields_out = fields;
- return GNOME_Evolution_Addressbook_Success;
-}
-
-#include "ximian-vcard.h"
-
-static GNOME_Evolution_Addressbook_CallStatus
-pas_backend_vcf_load_uri (PASBackend *backend,
- const char *uri,
- gboolean only_if_exists)
-{
- PASBackendVCF *bvcf = PAS_BACKEND_VCF (backend);
- char *dirname;
- gboolean writable = FALSE;
- int fd;
-
- g_free(bvcf->priv->uri);
- bvcf->priv->uri = g_strdup (uri);
-
- dirname = pas_backend_vcf_extract_path_from_uri (uri);
- bvcf->priv->filename = g_build_filename (dirname, "addressbook.vcf", NULL);
-
- fd = open (bvcf->priv->filename, O_RDWR);
-
- bvcf->priv->contacts = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, g_free);
-
- if (fd != -1) {
- writable = TRUE;
- } else {
- fd = open (bvcf->priv->filename, O_RDONLY);
-
- if (fd == -1) {
- fd = open (bvcf->priv->filename, O_CREAT, 0666);
-
- if (fd != -1 && !only_if_exists) {
- EContact *contact;
-
- contact = do_create(bvcf, XIMIAN_VCARD, FALSE);
- save_file (bvcf);
-
- /* XXX check errors here */
- g_object_unref (contact);
-
- writable = TRUE;
- }
- }
- }
-
- if (fd == -1) {
- g_warning ("Failed to open addressbook at uri `%s'", uri);
- g_warning ("error == %s", strerror(errno));
- return GNOME_Evolution_Addressbook_OtherError;
- }
-
- load_file (bvcf, fd);
-
- pas_backend_set_is_loaded (backend, TRUE);
- pas_backend_set_is_writable (backend, writable);
-
- return GNOME_Evolution_Addressbook_Success;
-}
-
-static char *
-pas_backend_vcf_get_static_capabilities (PASBackend *backend)
-{
- return g_strdup("local,do-initial-query");
-}
-
-static GNOME_Evolution_Addressbook_CallStatus
-pas_backend_vcf_cancel_operation (PASBackend *backend, PASBook *book)
-{
- return GNOME_Evolution_Addressbook_CouldNotCancel;
-}
-
-static gboolean
-pas_backend_vcf_construct (PASBackendVCF *backend)
-{
- g_assert (backend != NULL);
- g_assert (PAS_IS_BACKEND_VCF (backend));
-
- if (! pas_backend_construct (PAS_BACKEND (backend)))
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * pas_backend_vcf_new:
- */
-PASBackend *
-pas_backend_vcf_new (void)
-{
- PASBackendVCF *backend;
-
- backend = g_object_new (PAS_TYPE_BACKEND_VCF, NULL);
-
- if (! pas_backend_vcf_construct (backend)) {
- g_object_unref (backend);
-
- return NULL;
- }
-
- return PAS_BACKEND (backend);
-}
-
-static void
-pas_backend_vcf_dispose (GObject *object)
-{
- PASBackendVCF *bvcf;
-
- bvcf = PAS_BACKEND_VCF (object);
-
- if (bvcf->priv) {
-
- g_mutex_lock (bvcf->priv->mutex);
-
- if (bvcf->priv->flush_timeout_tag) {
- g_source_remove (bvcf->priv->flush_timeout_tag);
- bvcf->priv->flush_timeout_tag = 0;
- }
-
- if (bvcf->priv->dirty)
- save_file (bvcf);
-
- g_hash_table_destroy (bvcf->priv->contacts);
-
- g_free (bvcf->priv->uri);
- g_free (bvcf->priv->filename);
-
- g_mutex_unlock (bvcf->priv->mutex);
-
- g_mutex_free (bvcf->priv->mutex);
-
- g_free (bvcf->priv);
- bvcf->priv = NULL;
- }
-
- G_OBJECT_CLASS (pas_backend_vcf_parent_class)->dispose (object);
-}
-
-static void
-pas_backend_vcf_class_init (PASBackendVCFClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PASBackendSyncClass *sync_class;
- PASBackendClass *backend_class;
-
- pas_backend_vcf_parent_class = g_type_class_peek_parent (klass);
-
- sync_class = PAS_BACKEND_SYNC_CLASS (klass);
- backend_class = PAS_BACKEND_CLASS (klass);
-
- /* Set the virtual methods. */
- backend_class->load_uri = pas_backend_vcf_load_uri;
- backend_class->get_static_capabilities = pas_backend_vcf_get_static_capabilities;
- backend_class->start_book_view = pas_backend_vcf_start_book_view;
- backend_class->stop_book_view = pas_backend_vcf_stop_book_view;
- backend_class->cancel_operation = pas_backend_vcf_cancel_operation;
-
- sync_class->create_contact_sync = pas_backend_vcf_process_create_contact;
- sync_class->remove_contacts_sync = pas_backend_vcf_process_remove_contacts;
- sync_class->modify_contact_sync = pas_backend_vcf_process_modify_contact;
- sync_class->get_contact_sync = pas_backend_vcf_process_get_contact;
- sync_class->get_contact_list_sync = pas_backend_vcf_process_get_contact_list;
- sync_class->authenticate_user_sync = pas_backend_vcf_process_authenticate_user;
- sync_class->get_supported_fields_sync = pas_backend_vcf_process_get_supported_fields;
-
- object_class->dispose = pas_backend_vcf_dispose;
-}
-
-static void
-pas_backend_vcf_init (PASBackendVCF *backend)
-{
- PASBackendVCFPrivate *priv;
-
- priv = g_new0 (PASBackendVCFPrivate, 1);
- priv->uri = NULL;
- priv->mutex = g_mutex_new();
-
- backend->priv = priv;
-}
-
-/**
- * pas_backend_vcf_get_type:
- */
-GType
-pas_backend_vcf_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendVCFClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_vcf_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PASBackendVCF),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_vcf_init
- };
-
- type = g_type_register_static (PAS_TYPE_BACKEND_SYNC, "PASBackendVCF", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/backend/pas/pas-backend-vcf.h b/addressbook/backend/pas/pas-backend-vcf.h
deleted file mode 100644
index 81c872dcf1..0000000000
--- a/addressbook/backend/pas/pas-backend-vcf.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author:
- * Chris Toshok (toshok@ximian.com)
- * Copyright (C) 2003, Ximian, Inc.
- */
-
-#ifndef __PAS_BACKEND_VCF_H__
-#define __PAS_BACKEND_VCF_H__
-
-#include "pas-backend-sync.h"
-
-#define PAS_TYPE_BACKEND_VCF (pas_backend_vcf_get_type ())
-#define PAS_BACKEND_VCF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_VCF, PASBackendVCF))
-#define PAS_BACKEND_VCF_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendVCFClass))
-#define PAS_IS_BACKEND_VCF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_VCF))
-#define PAS_IS_BACKEND_VCF_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_VCF))
-#define PAS_BACKEND_VCF_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_VCF, PASBackendVCFClass))
-
-typedef struct _PASBackendVCFPrivate PASBackendVCFPrivate;
-
-typedef struct {
- PASBackendSync parent_object;
- PASBackendVCFPrivate *priv;
-} PASBackendVCF;
-
-typedef struct {
- PASBackendSyncClass parent_class;
-} PASBackendVCFClass;
-
-PASBackend *pas_backend_vcf_new (void);
-GType pas_backend_vcf_get_type (void);
-
-#endif /* ! __PAS_BACKEND_VCF_H__ */
-
diff --git a/addressbook/backend/pas/pas-backend.c b/addressbook/backend/pas/pas-backend.c
deleted file mode 100644
index a447d64851..0000000000
--- a/addressbook/backend/pas/pas-backend.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <config.h>
-#include <pthread.h>
-#include "pas-book-view.h"
-#include "pas-backend.h"
-#include "pas-marshal.h"
-
-struct _PASBackendPrivate {
- GMutex *open_mutex;
-
- GMutex *clients_mutex;
- GList *clients;
-
- char *uri;
- gboolean loaded, writable, removed;
-
- GMutex *views_mutex;
- EList *views;
-};
-
-/* Signal IDs */
-enum {
- LAST_CLIENT_GONE,
- LAST_SIGNAL
-};
-
-static guint pas_backend_signals[LAST_SIGNAL];
-
-static GObjectClass *parent_class;
-
-gboolean
-pas_backend_construct (PASBackend *backend)
-{
- return TRUE;
-}
-
-GNOME_Evolution_Addressbook_CallStatus
-pas_backend_load_uri (PASBackend *backend,
- const char *uri,
- gboolean only_if_exists)
-{
- GNOME_Evolution_Addressbook_CallStatus status;
-
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), FALSE);
- g_return_val_if_fail (uri, FALSE);
- g_return_val_if_fail (backend->priv->loaded == FALSE, FALSE);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->load_uri);
-
- status = (* PAS_BACKEND_GET_CLASS (backend)->load_uri) (backend, uri, only_if_exists);
-
- if (status == GNOME_Evolution_Addressbook_Success)
- backend->priv->uri = g_strdup (uri);
-
- return status;
-}
-
-/**
- * pas_backend_get_uri:
- * @backend: An addressbook backend.
- *
- * Queries the URI that an addressbook backend is serving.
- *
- * Return value: URI for the backend.
- **/
-const char *
-pas_backend_get_uri (PASBackend *backend)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), NULL);
-
- return backend->priv->uri;
-}
-
-void
-pas_backend_open (PASBackend *backend,
- PASBook *book,
- gboolean only_if_exists)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
-
- g_mutex_lock (backend->priv->open_mutex);
-
- if (backend->priv->loaded) {
- pas_book_respond_open (
- book, GNOME_Evolution_Addressbook_Success);
-
- pas_book_report_writable (book, backend->priv->writable);
- } else {
- GNOME_Evolution_Addressbook_CallStatus status =
- pas_backend_load_uri (backend, pas_book_get_uri (book), only_if_exists);
-
- pas_book_respond_open (book, status);
-
- if (status == GNOME_Evolution_Addressbook_Success)
- pas_book_report_writable (book, backend->priv->writable);
- }
-
- g_mutex_unlock (backend->priv->open_mutex);
-}
-
-void
-pas_backend_remove (PASBackend *backend,
- PASBook *book)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->remove);
-
- (* PAS_BACKEND_GET_CLASS (backend)->remove) (backend, book);
-}
-
-void
-pas_backend_create_contact (PASBackend *backend,
- PASBook *book,
- const char *vcard)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
- g_return_if_fail (vcard);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->create_contact);
-
- (* PAS_BACKEND_GET_CLASS (backend)->create_contact) (backend, book, vcard);
-}
-
-void
-pas_backend_remove_contacts (PASBackend *backend,
- PASBook *book,
- GList *id_list)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
- g_return_if_fail (id_list);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->remove_contacts);
-
- (* PAS_BACKEND_GET_CLASS (backend)->remove_contacts) (backend, book, id_list);
-}
-
-void
-pas_backend_modify_contact (PASBackend *backend,
- PASBook *book,
- const char *vcard)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
- g_return_if_fail (vcard);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->modify_contact);
-
- (* PAS_BACKEND_GET_CLASS (backend)->modify_contact) (backend, book, vcard);
-}
-
-void
-pas_backend_get_contact (PASBackend *backend,
- PASBook *book,
- const char *id)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
- g_return_if_fail (id);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->get_contact);
-
- (* PAS_BACKEND_GET_CLASS (backend)->get_contact) (backend, book, id);
-}
-
-void
-pas_backend_get_contact_list (PASBackend *backend,
- PASBook *book,
- const char *query)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
- g_return_if_fail (query);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->get_contact_list);
-
- (* PAS_BACKEND_GET_CLASS (backend)->get_contact_list) (backend, book, query);
-}
-
-void
-pas_backend_start_book_view (PASBackend *backend,
- PASBookView *book_view)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book_view && PAS_IS_BOOK_VIEW (book_view));
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->start_book_view);
-
- (* PAS_BACKEND_GET_CLASS (backend)->start_book_view) (backend, book_view);
-}
-
-void
-pas_backend_stop_book_view (PASBackend *backend,
- PASBookView *book_view)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book_view && PAS_IS_BOOK_VIEW (book_view));
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->stop_book_view);
-
- (* PAS_BACKEND_GET_CLASS (backend)->stop_book_view) (backend, book_view);
-}
-
-void
-pas_backend_get_changes (PASBackend *backend,
- PASBook *book,
- const char *change_id)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
- g_return_if_fail (change_id);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->get_changes);
-
- (* PAS_BACKEND_GET_CLASS (backend)->get_changes) (backend, book, change_id);
-}
-
-void
-pas_backend_authenticate_user (PASBackend *backend,
- PASBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
- g_return_if_fail (user && passwd && auth_method);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->authenticate_user);
-
- (* PAS_BACKEND_GET_CLASS (backend)->authenticate_user) (backend, book, user, passwd, auth_method);
-}
-
-void
-pas_backend_get_supported_fields (PASBackend *backend,
- PASBook *book)
-
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->get_supported_fields);
-
- (* PAS_BACKEND_GET_CLASS (backend)->get_supported_fields) (backend, book);
-}
-
-void
-pas_backend_get_supported_auth_methods (PASBackend *backend,
- PASBook *book)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->get_supported_auth_methods);
-
- (* PAS_BACKEND_GET_CLASS (backend)->get_supported_auth_methods) (backend, book);
-}
-
-GNOME_Evolution_Addressbook_CallStatus
-pas_backend_cancel_operation (PASBackend *backend,
- PASBook *book)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), GNOME_Evolution_Addressbook_OtherError);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), GNOME_Evolution_Addressbook_OtherError);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->cancel_operation);
-
- return (* PAS_BACKEND_GET_CLASS (backend)->cancel_operation) (backend, book);
-}
-
-static void
-book_destroy_cb (gpointer data, GObject *where_book_was)
-{
- PASBackend *backend = PAS_BACKEND (data);
-
- pas_backend_remove_client (backend, (PASBook *)where_book_was);
-}
-
-static void
-listener_died_cb (gpointer cnx, gpointer user_data)
-{
- PASBook *book = PAS_BOOK (user_data);
-
- pas_backend_remove_client (pas_book_get_backend (book), book);
-}
-
-static void
-last_client_gone (PASBackend *backend)
-{
- g_signal_emit (backend, pas_backend_signals[LAST_CLIENT_GONE], 0);
-}
-
-EList*
-pas_backend_get_book_views (PASBackend *backend)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), FALSE);
-
- return g_object_ref (backend->priv->views);
-}
-
-void
-pas_backend_add_book_view (PASBackend *backend,
- PASBookView *view)
-{
- g_mutex_lock (backend->priv->views_mutex);
-
- e_list_append (backend->priv->views, view);
-
- g_mutex_unlock (backend->priv->views_mutex);
-}
-
-void
-pas_backend_remove_book_view (PASBackend *backend,
- PASBookView *view)
-{
- g_mutex_lock (backend->priv->views_mutex);
-
- e_list_remove (backend->priv->views, view);
-
- g_mutex_unlock (backend->priv->views_mutex);
-}
-
-/**
- * pas_backend_add_client:
- * @backend: An addressbook backend.
- * @book: the corba object representing the client connection.
- *
- * Adds a client to an addressbook backend.
- *
- * Return value: TRUE on success, FALSE on failure to add the client.
- */
-gboolean
-pas_backend_add_client (PASBackend *backend,
- PASBook *book)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), FALSE);
- g_return_val_if_fail (book && PAS_IS_BOOK (book), FALSE);
-
- bonobo_object_set_immortal (BONOBO_OBJECT (book), TRUE);
-
- g_object_weak_ref (G_OBJECT (book), book_destroy_cb, backend);
-
- ORBit_small_listen_for_broken (pas_book_get_listener (book), G_CALLBACK (listener_died_cb), book);
-
- g_mutex_lock (backend->priv->clients_mutex);
- backend->priv->clients = g_list_prepend (backend->priv->clients, book);
- g_mutex_unlock (backend->priv->clients_mutex);
-
- return TRUE;
-}
-
-void
-pas_backend_remove_client (PASBackend *backend,
- PASBook *book)
-{
- /* XXX this needs a bit more thinking wrt the mutex - we
- should be holding it when we check to see if clients is
- NULL */
-
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
- g_return_if_fail (book && PAS_IS_BOOK (book));
-
- /* Disconnect */
- g_mutex_lock (backend->priv->clients_mutex);
- backend->priv->clients = g_list_remove (backend->priv->clients, book);
- g_mutex_unlock (backend->priv->clients_mutex);
-
- /* When all clients go away, notify the parent factory about it so that
- * it may decide whether to kill the backend or not.
- */
- if (!backend->priv->clients)
- last_client_gone (backend);
-}
-
-char *
-pas_backend_get_static_capabilities (PASBackend *backend)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), NULL);
-
- g_assert (PAS_BACKEND_GET_CLASS (backend)->get_static_capabilities);
-
- return PAS_BACKEND_GET_CLASS (backend)->get_static_capabilities (backend);
-}
-
-gboolean
-pas_backend_is_loaded (PASBackend *backend)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), FALSE);
-
- return backend->priv->loaded;
-}
-
-void
-pas_backend_set_is_loaded (PASBackend *backend, gboolean is_loaded)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
-
- backend->priv->loaded = is_loaded;
-}
-
-gboolean
-pas_backend_is_writable (PASBackend *backend)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), FALSE);
-
- return backend->priv->writable;
-}
-
-void
-pas_backend_set_is_writable (PASBackend *backend, gboolean is_writable)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
-
- backend->priv->writable = is_writable;
-}
-
-gboolean
-pas_backend_is_removed (PASBackend *backend)
-{
- g_return_val_if_fail (backend && PAS_IS_BACKEND (backend), FALSE);
-
- return backend->priv->removed;
-}
-
-void
-pas_backend_set_is_removed (PASBackend *backend, gboolean is_removed)
-{
- g_return_if_fail (backend && PAS_IS_BACKEND (backend));
-
- backend->priv->removed = is_removed;
-}
-
-
-
-GNOME_Evolution_Addressbook_BookChangeItem*
-pas_backend_change_add_new (const char *vcard)
-{
- GNOME_Evolution_Addressbook_BookChangeItem* new_change = GNOME_Evolution_Addressbook_BookChangeItem__alloc();
-
- new_change->changeType= GNOME_Evolution_Addressbook_ContactAdded;
- new_change->vcard = CORBA_string_dup (vcard);
-
- return new_change;
-}
-
-GNOME_Evolution_Addressbook_BookChangeItem*
-pas_backend_change_modify_new (const char *vcard)
-{
- GNOME_Evolution_Addressbook_BookChangeItem* new_change = GNOME_Evolution_Addressbook_BookChangeItem__alloc();
-
- new_change->changeType= GNOME_Evolution_Addressbook_ContactModified;
- new_change->vcard = CORBA_string_dup (vcard);
-
- return new_change;
-}
-
-GNOME_Evolution_Addressbook_BookChangeItem*
-pas_backend_change_delete_new (const char *vcard)
-{
- GNOME_Evolution_Addressbook_BookChangeItem* new_change = GNOME_Evolution_Addressbook_BookChangeItem__alloc();
-
- new_change->changeType= GNOME_Evolution_Addressbook_ContactDeleted;
- new_change->vcard = CORBA_string_dup (vcard);
-
- return new_change;
-}
-
-
-
-static void
-pas_backend_foreach_view (PASBackend *backend,
- void (*callback) (PASBookView *, gpointer),
- gpointer user_data)
-{
- EList *views;
- PASBookView *view;
- EIterator *iter;
-
- views = pas_backend_get_book_views (backend);
- iter = e_list_get_iterator (views);
-
- while (e_iterator_is_valid (iter)) {
- view = (PASBookView*)e_iterator_get (iter);
-
- bonobo_object_ref (view);
- callback (view, user_data);
- bonobo_object_unref (view);
-
- e_iterator_next (iter);
- }
-
- g_object_unref (iter);
- g_object_unref (views);
-}
-
-
-static void
-view_notify_update (PASBookView *view, gpointer contact)
-{
- pas_book_view_notify_update (view, contact);
-}
-
-/**
- * pas_backend_notify_update:
- * @backend: an addressbook backend
- * @contact: a new or modified contact
- *
- * Notifies all of @backend's book views about the new or modified
- * contacts @contact.
- *
- * pas_book_respond_create() and pas_book_respond_modify() call this
- * function for you. You only need to call this from your backend if
- * contacts are created or modified by another (non-PAS-using) client.
- **/
-void
-pas_backend_notify_update (PASBackend *backend, EContact *contact)
-{
- pas_backend_foreach_view (backend, view_notify_update, contact);
-}
-
-
-static void
-view_notify_remove (PASBookView *view, gpointer id)
-{
- pas_book_view_notify_remove (view, id);
-}
-
-/**
- * pas_backend_notify_remove:
- * @backend: an addressbook backend
- * @id: a contact id
- *
- * Notifies all of @backend's book views that the contact with UID
- * @id has been removed.
- *
- * pas_book_respond_remove_contacts() calls this function for you. You
- * only need to call this from your backend if contacts are removed by
- * another (non-PAS-using) client.
- **/
-void
-pas_backend_notify_remove (PASBackend *backend, const char *id)
-{
- pas_backend_foreach_view (backend, view_notify_remove, (gpointer)id);
-}
-
-
-static void
-view_notify_complete (PASBookView *view, gpointer unused)
-{
- pas_book_view_notify_complete (view, GNOME_Evolution_Addressbook_Success);
-}
-
-/**
- * pas_backend_notify_complete:
- * @backend: an addressbook backend
- *
- * Notifies all of @backend's book views that the current set of
- * notifications is complete; use this after a series of
- * pas_backend_notify_update() and pas_backend_notify_remove() calls.
- **/
-void
-pas_backend_notify_complete (PASBackend *backend)
-{
- pas_backend_foreach_view (backend, view_notify_complete, NULL);
-}
-
-
-
-static void
-pas_backend_init (PASBackend *backend)
-{
- PASBackendPrivate *priv;
-
- priv = g_new0 (PASBackendPrivate, 1);
- priv->uri = NULL;
- priv->clients = NULL;
- priv->views = e_list_new((EListCopyFunc) g_object_ref, (EListFreeFunc) g_object_unref, NULL);
- priv->open_mutex = g_mutex_new ();
- priv->clients_mutex = g_mutex_new ();
- priv->views_mutex = g_mutex_new ();
-
- backend->priv = priv;
-}
-
-static void
-pas_backend_dispose (GObject *object)
-{
- PASBackend *backend;
-
- backend = PAS_BACKEND (object);
-
- if (backend->priv) {
- g_list_free (backend->priv->clients);
-
- if (backend->priv->uri)
- g_free (backend->priv->uri);
-
- if (backend->priv->views) {
- g_object_unref (backend->priv->views);
- backend->priv->views = NULL;
- }
-
- g_mutex_free (backend->priv->open_mutex);
- g_mutex_free (backend->priv->clients_mutex);
- g_mutex_free (backend->priv->views_mutex);
-
- g_free (backend->priv);
- backend->priv = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-pas_backend_class_init (PASBackendClass *klass)
-{
- GObjectClass *object_class;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class = (GObjectClass *) klass;
-
- object_class->dispose = pas_backend_dispose;
-
- pas_backend_signals[LAST_CLIENT_GONE] =
- g_signal_new ("last_client_gone",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (PASBackendClass, last_client_gone),
- NULL, NULL,
- pas_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-}
-
-/**
- * pas_backend_get_type:
- */
-GType
-pas_backend_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PASBackend),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "PASBackend", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/backend/pas/pas-backend.h b/addressbook/backend/pas/pas-backend.h
deleted file mode 100644
index b71d438441..0000000000
--- a/addressbook/backend/pas/pas-backend.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * An abstract class which defines the API to a given backend.
- * There will be one PASBackend object for every URI which is loaded.
- *
- * Two people will call into the PASBackend API:
- *
- * 1. The PASBookFactory, when it has been asked to load a book.
- * It will create a new PASBackend if one is not already running
- * for the requested URI. It will call pas_backend_add_client to
- * add a new client to an existing PASBackend server.
- *
- * 2. A PASBook, when a client has requested an operation on the
- * GNOME_Evolution_Addressbook_Book interface.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __PAS_BACKEND_H__
-#define __PAS_BACKEND_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <pas/addressbook.h>
-#include <pas/pas-types.h>
-#include <ebook/e-contact.h>
-
-#define PAS_TYPE_BACKEND (pas_backend_get_type ())
-#define PAS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND, PASBackend))
-#define PAS_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_TYPE_BACKEND, PASBackendClass))
-#define PAS_IS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND))
-#define PAS_IS_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND))
-#define PAS_BACKEND_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((k), PAS_TYPE_BACKEND, PASBackendClass))
-
-typedef struct _PASBackendPrivate PASBackendPrivate;
-
-#include <pas/pas-book.h>
-
-struct _PASBackend {
- GObject parent_object;
- PASBackendPrivate *priv;
-};
-
-struct _PASBackendClass {
- GObjectClass parent_class;
-
- /* Virtual methods */
- GNOME_Evolution_Addressbook_CallStatus (*load_uri) (PASBackend *backend, const char *uri, gboolean only_if_exists);
- void (*remove) (PASBackend *backend, PASBook *book);
- char *(*get_static_capabilities) (PASBackend *backend);
-
- void (*create_contact) (PASBackend *backend, PASBook *book, const char *vcard);
- void (*remove_contacts) (PASBackend *backend, PASBook *book, GList *id_list);
- void (*modify_contact) (PASBackend *backend, PASBook *book, const char *vcard);
- void (*get_contact) (PASBackend *backend, PASBook *book, const char *id);
- void (*get_contact_list) (PASBackend *backend, PASBook *book, const char *query);
- void (*start_book_view) (PASBackend *backend, PASBookView *book_view);
- void (*stop_book_view) (PASBackend *backend, PASBookView *book_view);
- void (*get_changes) (PASBackend *backend, PASBook *book, const char *change_id);
- void (*authenticate_user) (PASBackend *backend, PASBook *book, const char *user, const char *passwd, const char *auth_method);
- void (*get_supported_fields) (PASBackend *backend, PASBook *book);
- void (*get_supported_auth_methods) (PASBackend *backend, PASBook *book);
- GNOME_Evolution_Addressbook_CallStatus (*cancel_operation) (PASBackend *backend, PASBook *book);
-
- /* Notification signals */
- void (* last_client_gone) (PASBackend *backend);
-
- /* Padding for future expansion */
- void (*_pas_reserved0) (void);
- void (*_pas_reserved1) (void);
- void (*_pas_reserved2) (void);
- void (*_pas_reserved3) (void);
- void (*_pas_reserved4) (void);
-};
-
-typedef PASBackend * (*PASBackendFactoryFn) (void);
-
-gboolean pas_backend_construct (PASBackend *backend);
-
-GNOME_Evolution_Addressbook_CallStatus
- pas_backend_load_uri (PASBackend *backend,
- const char *uri,
- gboolean only_if_exists);
-const char *pas_backend_get_uri (PASBackend *backend);
-
-gboolean pas_backend_add_client (PASBackend *backend,
- PASBook *book);
-void pas_backend_remove_client (PASBackend *backend,
- PASBook *book);
-char *pas_backend_get_static_capabilities (PASBackend *backend);
-
-gboolean pas_backend_is_loaded (PASBackend *backend);
-
-gboolean pas_backend_is_writable (PASBackend *backend);
-
-gboolean pas_backend_is_removed (PASBackend *backend);
-
-void pas_backend_open (PASBackend *backend,
- PASBook *book,
- gboolean only_if_exists);
-void pas_backend_remove (PASBackend *backend,
- PASBook *book);
-void pas_backend_create_contact (PASBackend *backend,
- PASBook *book,
- const char *vcard);
-void pas_backend_remove_contacts (PASBackend *backend,
- PASBook *book,
- GList *id_list);
-void pas_backend_modify_contact (PASBackend *backend,
- PASBook *book,
- const char *vcard);
-void pas_backend_get_contact (PASBackend *backend,
- PASBook *book,
- const char *id);
-void pas_backend_get_contact_list (PASBackend *backend,
- PASBook *book,
- const char *query);
-void pas_backend_get_changes (PASBackend *backend,
- PASBook *book,
- const char *change_id);
-void pas_backend_authenticate_user (PASBackend *backend,
- PASBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method);
-void pas_backend_get_supported_fields (PASBackend *backend,
- PASBook *book);
-void pas_backend_get_supported_auth_methods (PASBackend *backend,
- PASBook *book);
-GNOME_Evolution_Addressbook_CallStatus pas_backend_cancel_operation (PASBackend *backend,
- PASBook *book);
-
-void pas_backend_start_book_view (PASBackend *backend,
- PASBookView *view);
-void pas_backend_stop_book_view (PASBackend *backend,
- PASBookView *view);
-
-void pas_backend_add_book_view (PASBackend *backend,
- PASBookView *view);
-
-void pas_backend_remove_book_view (PASBackend *backend,
- PASBookView *view);
-
-EList *pas_backend_get_book_views (PASBackend *backend);
-
-void pas_backend_notify_update (PASBackend *backend,
- EContact *contact);
-void pas_backend_notify_remove (PASBackend *backend,
- const char *id);
-void pas_backend_notify_complete (PASBackend *backend);
-
-
-GType pas_backend_get_type (void);
-
-
-/* protected functions for subclasses */
-void pas_backend_set_is_loaded (PASBackend *backend,
- gboolean is_loaded);
-void pas_backend_set_is_writable (PASBackend *backend,
- gboolean is_writable);
-void pas_backend_set_is_removed (PASBackend *backend,
- gboolean is_removed);
-
-/* useful for implementing _get_changes in backends */
-GNOME_Evolution_Addressbook_BookChangeItem* pas_backend_change_add_new (const char *vcard);
-GNOME_Evolution_Addressbook_BookChangeItem* pas_backend_change_modify_new (const char *vcard);
-GNOME_Evolution_Addressbook_BookChangeItem* pas_backend_change_delete_new (const char *id);
-
-#endif /* ! __PAS_BACKEND_H__ */
-
diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c
deleted file mode 100644
index 34e97aa780..0000000000
--- a/addressbook/backend/pas/pas-book-factory.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <config.h>
-#include <pthread.h>
-#include <string.h>
-
-#include "addressbook.h"
-#include "pas-book-factory.h"
-#include "pas-marshal.h"
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-arg.h>
-
-#define DEFAULT_PAS_BOOK_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_ServerFactory"
-
-static BonoboObjectClass *pas_book_factory_parent_class;
-
-typedef struct {
- char *uri;
- GNOME_Evolution_Addressbook_BookListener listener;
-} PASBookFactoryQueuedRequest;
-
-struct _PASBookFactoryPrivate {
- GMutex *map_mutex;
-
- GHashTable *backends;
- GHashTable *active_server_map;
-
- /* OAFIID of the factory */
- char *iid;
-
- /* Whether the factory has been registered with OAF yet */
- guint registered : 1;
-};
-
-/* Signal IDs */
-enum {
- LAST_BOOK_GONE,
- LAST_SIGNAL
-};
-
-static guint factory_signals[LAST_SIGNAL];
-
-static char *
-pas_book_factory_canonicalize_uri (const char *uri)
-{
- /* FIXME: What do I do here? */
-
- return g_strdup (uri);
-}
-
-static char *
-pas_book_factory_extract_proto_from_uri (const char *uri)
-{
- char *proto;
- char *p;
-
- p = strchr (uri, ':');
-
- if (p == NULL)
- return NULL;
-
- proto = g_malloc0 (p - uri + 1);
-
- strncpy (proto, uri, p - uri);
-
- return proto;
-}
-
-/**
- * pas_book_factory_register_backend:
- * @factory:
- * @proto:
- * @backend:
- */
-void
-pas_book_factory_register_backend (PASBookFactory *factory,
- const char *proto,
- PASBackendFactoryFn backend)
-{
- g_return_if_fail (factory != NULL);
- g_return_if_fail (PAS_IS_BOOK_FACTORY (factory));
- g_return_if_fail (proto != NULL);
- g_return_if_fail (backend != NULL);
-
- if (g_hash_table_lookup (factory->priv->backends, proto) != NULL) {
- g_warning ("pas_book_factory_register_backend: "
- "Proto \"%s\" already registered!\n", proto);
- }
-
- g_hash_table_insert (factory->priv->backends,
- g_strdup (proto), backend);
-}
-
-/**
- * pas_book_factory_get_n_backends:
- * @factory: An addressbook factory.
- *
- * Queries the number of running addressbook backends in an addressbook factory.
- *
- * Return value: Number of running backends.
- **/
-int
-pas_book_factory_get_n_backends (PASBookFactory *factory)
-{
- int n_backends;
-
- g_return_val_if_fail (factory != NULL, -1);
- g_return_val_if_fail (PAS_IS_BOOK_FACTORY (factory), -1);
-
- g_mutex_lock (factory->priv->map_mutex);
- n_backends = g_hash_table_size (factory->priv->active_server_map);
- g_mutex_unlock (factory->priv->map_mutex);
-
- return n_backends;
-}
-
-static void
-dump_active_server_map_entry (gpointer key, gpointer value, gpointer data)
-{
- char *uri;
- PASBackend *backend;
-
- uri = key;
- backend = PAS_BACKEND (value);
-
- g_message (" %s: %p", uri, backend);
-}
-
-void
-pas_book_factory_dump_active_backends (PASBookFactory *factory)
-{
- g_message ("Active PAS backends");
-
- g_mutex_lock (factory->priv->map_mutex);
- g_hash_table_foreach (factory->priv->active_server_map,
- dump_active_server_map_entry,
- NULL);
- g_mutex_unlock (factory->priv->map_mutex);
-}
-
-/* Callback used when a backend loses its last connected client */
-static void
-backend_last_client_gone_cb (PASBackend *backend, gpointer data)
-{
- PASBookFactory *factory;
- const char *uri;
-
- factory = PAS_BOOK_FACTORY (data);
-
- /* Remove the backend from the active server map */
-
- uri = pas_backend_get_uri (backend);
- if (uri) {
- gpointer orig_key;
- gboolean result;
- char *orig_uri;
-
- g_mutex_lock (factory->priv->map_mutex);
-
- result = g_hash_table_lookup_extended (factory->priv->active_server_map, uri,
- &orig_key, NULL);
- g_assert (result != FALSE);
-
- orig_uri = orig_key;
-
- g_hash_table_remove (factory->priv->active_server_map, orig_uri);
- g_free (orig_uri);
-
- g_object_unref (backend);
-
- g_mutex_unlock (factory->priv->map_mutex);
- }
-
- if (g_hash_table_size (factory->priv->active_server_map) == 0) {
- /* Notify upstream if there are no more backends */
- g_signal_emit (G_OBJECT (factory), factory_signals[LAST_BOOK_GONE], 0);
- }
-}
-
-
-
-static PASBackendFactoryFn
-pas_book_factory_lookup_backend_factory (PASBookFactory *factory,
- const char *uri)
-{
- PASBackendFactoryFn backend_fn;
- char *proto;
- char *canonical_uri;
-
- g_assert (factory != NULL);
- g_assert (PAS_IS_BOOK_FACTORY (factory));
- g_assert (uri != NULL);
-
- canonical_uri = pas_book_factory_canonicalize_uri (uri);
- if (canonical_uri == NULL)
- return NULL;
-
- proto = pas_book_factory_extract_proto_from_uri (canonical_uri);
- if (proto == NULL) {
- g_free (canonical_uri);
- return NULL;
- }
-
- backend_fn = g_hash_table_lookup (factory->priv->backends, proto);
-
- g_free (proto);
- g_free (canonical_uri);
-
- return backend_fn;
-}
-
-static PASBackend *
-pas_book_factory_launch_backend (PASBookFactory *factory,
- PASBackendFactoryFn backend_factory,
- GNOME_Evolution_Addressbook_BookListener listener,
- const char *uri)
-{
- PASBackend *backend;
-
- backend = (* backend_factory) ();
- if (!backend)
- return NULL;
-
- g_hash_table_insert (factory->priv->active_server_map,
- g_strdup (uri),
- backend);
-
- g_signal_connect (backend, "last_client_gone",
- G_CALLBACK (backend_last_client_gone_cb),
- factory);
-
- return backend;
-}
-
-static GNOME_Evolution_Addressbook_Book
-impl_GNOME_Evolution_Addressbook_BookFactory_getBook (PortableServer_Servant servant,
- const CORBA_char *uri,
- const GNOME_Evolution_Addressbook_BookListener listener,
- CORBA_Environment *ev)
-{
- PASBookFactory *factory = PAS_BOOK_FACTORY (bonobo_object (servant));
- PASBackend *backend;
- PASBook *book;
-
- printf ("impl_GNOME_Evolution_Addressbook_BookFactory_getBook\n");
-
- /* Look up the backend and create one if needed */
- g_mutex_lock (factory->priv->map_mutex);
-
- backend = g_hash_table_lookup (factory->priv->active_server_map, uri);
-
- if (!backend) {
- PASBackendFactoryFn backend_factory;
-
- backend_factory = pas_book_factory_lookup_backend_factory (factory, uri);
-
- if (backend_factory == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Addressbook_BookFactory_ProtocolNotSupported,
- NULL);
-
- g_mutex_unlock (factory->priv->map_mutex);
-
- return CORBA_OBJECT_NIL;
- }
-
- backend = pas_book_factory_launch_backend (factory, backend_factory, listener, uri);
- }
-
- if (backend) {
- GNOME_Evolution_Addressbook_BookListener listener_copy;
-
- listener_copy = bonobo_object_dup_ref (listener, NULL);
-
- g_mutex_unlock (factory->priv->map_mutex);
-
- book = pas_book_new (backend, uri, listener);
-
- pas_backend_add_client (backend, book);
-
- return bonobo_object_corba_objref (BONOBO_OBJECT (book));
- }
- else {
- /* probably need a more descriptive exception here */
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Addressbook_BookFactory_ProtocolNotSupported,
- NULL);
- g_mutex_unlock (factory->priv->map_mutex);
-
- return CORBA_OBJECT_NIL;
- }
-}
-
-static void
-pas_book_factory_construct (PASBookFactory *factory)
-{
- /* nothing to do here.. */
-}
-
-/**
- * pas_book_factory_new:
- */
-PASBookFactory *
-pas_book_factory_new (void)
-{
- PASBookFactory *factory;
-
- factory = g_object_new (PAS_TYPE_BOOK_FACTORY,
- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL),
- NULL);
-
- pas_book_factory_construct (factory);
-
- return factory;
-}
-
-/**
- * pas_book_factory_activate:
- */
-gboolean
-pas_book_factory_activate (PASBookFactory *factory, const char *iid)
-{
- PASBookFactoryPrivate *priv;
- Bonobo_RegistrationResult result;
- char *tmp_iid;
-
- g_return_val_if_fail (factory != NULL, FALSE);
- g_return_val_if_fail (PAS_IS_BOOK_FACTORY (factory), FALSE);
-
- priv = factory->priv;
-
- g_return_val_if_fail (!priv->registered, FALSE);
-
- /* if iid is NULL, use the default factory OAFIID */
- if (iid)
- tmp_iid = g_strdup (iid);
- else
- tmp_iid = g_strdup (DEFAULT_PAS_BOOK_FACTORY_OAF_ID);
-
- result = bonobo_activation_active_server_register (tmp_iid, bonobo_object_corba_objref (BONOBO_OBJECT (factory)));
-
- switch (result) {
- case Bonobo_ACTIVATION_REG_SUCCESS:
- priv->registered = TRUE;
- priv->iid = tmp_iid;
- return TRUE;
- case Bonobo_ACTIVATION_REG_NOT_LISTED:
- g_message ("Error registering the PAS factory: not listed");
- break;
- case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
- g_message ("Error registering the PAS factory: already active");
- break;
- case Bonobo_ACTIVATION_REG_ERROR:
- default:
- g_message ("Error registering the PAS factory: generic error");
- break;
- }
-
- g_free (tmp_iid);
- return FALSE;
-}
-
-static void
-pas_book_factory_init (PASBookFactory *factory)
-{
- factory->priv = g_new0 (PASBookFactoryPrivate, 1);
-
- factory->priv->map_mutex = g_mutex_new();
- factory->priv->active_server_map = g_hash_table_new (g_str_hash, g_str_equal);
- factory->priv->backends = g_hash_table_new (g_str_hash, g_str_equal);
- factory->priv->registered = FALSE;
-}
-
-static void
-free_active_server_map_entry (gpointer key, gpointer value, gpointer data)
-{
- char *uri;
- PASBackend *backend;
-
- uri = key;
- g_free (uri);
-
- backend = PAS_BACKEND (value);
- g_object_unref (backend);
-}
-
-static void
-remove_backends_entry (gpointer key, gpointer value, gpointer data)
-{
- char *uri;
-
- uri = key;
- g_free (uri);
-}
-
-static void
-pas_book_factory_dispose (GObject *object)
-{
- PASBookFactory *factory = PAS_BOOK_FACTORY (object);
-
- if (factory->priv) {
- PASBookFactoryPrivate *priv = factory->priv;
-
- g_mutex_free (priv->map_mutex);
-
- g_hash_table_foreach (priv->active_server_map,
- free_active_server_map_entry,
- NULL);
- g_hash_table_destroy (priv->active_server_map);
- priv->active_server_map = NULL;
-
- g_hash_table_foreach (priv->backends,
- remove_backends_entry,
- NULL);
- g_hash_table_destroy (priv->backends);
- priv->backends = NULL;
-
- if (priv->registered) {
- bonobo_activation_active_server_unregister (priv->iid,
- bonobo_object_corba_objref (BONOBO_OBJECT (factory)));
- priv->registered = FALSE;
- }
-
- g_free (priv->iid);
-
- g_free (priv);
- factory->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (pas_book_factory_parent_class)->dispose)
- G_OBJECT_CLASS (pas_book_factory_parent_class)->dispose (object);
-}
-
-static void
-pas_book_factory_class_init (PASBookFactoryClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- POA_GNOME_Evolution_Addressbook_BookFactory__epv *epv;
-
- pas_book_factory_parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = pas_book_factory_dispose;
-
- factory_signals[LAST_BOOK_GONE] =
- g_signal_new ("last_book_gone",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (PASBookFactoryClass, last_book_gone),
- NULL, NULL,
- pas_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
-
- epv = &klass->epv;
-
- epv->getBook = impl_GNOME_Evolution_Addressbook_BookFactory_getBook;
-}
-
-BONOBO_TYPE_FUNC_FULL (
- PASBookFactory,
- GNOME_Evolution_Addressbook_BookFactory,
- BONOBO_TYPE_OBJECT,
- pas_book_factory);
diff --git a/addressbook/backend/pas/pas-book-factory.h b/addressbook/backend/pas/pas-book-factory.h
deleted file mode 100644
index 9d099a6f2c..0000000000
--- a/addressbook/backend/pas/pas-book-factory.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <pas/pas-backend.h>
-#include <bonobo/bonobo-object.h>
-
-#ifndef __PAS_BOOK_FACTORY_H__
-#define __PAS_BOOK_FACTORY_H__
-
-G_BEGIN_DECLS
-
-#define PAS_TYPE_BOOK_FACTORY (pas_book_factory_get_type ())
-#define PAS_BOOK_FACTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BOOK_FACTORY, PASBookFactory))
-#define PAS_BOOK_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_TYPE_BOOK_FACTORY, PASBookFactoryClass))
-#define PAS_IS_BOOK_FACTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BOOK_FACTORY))
-#define PAS_IS_BOOK_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BOOK_FACTORY))
-#define PAS_BOOK_FACTORY_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BOOK_FACTORY, PASBookFactoryClass))
-
-typedef struct _PASBookFactoryPrivate PASBookFactoryPrivate;
-
-typedef struct {
- BonoboObject parent_object;
- PASBookFactoryPrivate *priv;
-} PASBookFactory;
-
-typedef struct {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Addressbook_BookFactory__epv epv;
-
- /* Notification signals */
-
- void (* last_book_gone) (PASBookFactory *factory);
-} PASBookFactoryClass;
-
-PASBookFactory *pas_book_factory_new (void);
-
-void pas_book_factory_register_backend (PASBookFactory *factory,
- const char *proto,
- PASBackendFactoryFn backend_factory);
-
-int pas_book_factory_get_n_backends (PASBookFactory *factory);
-
-void pas_book_factory_dump_active_backends (PASBookFactory *factory);
-
-gboolean pas_book_factory_activate (PASBookFactory *factory, const char *iid);
-
-GType pas_book_factory_get_type (void);
-
-G_END_DECLS
-
-#endif /* ! __PAS_BOOK_FACTORY_H__ */
diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c
deleted file mode 100644
index afdfb1dacb..0000000000
--- a/addressbook/backend/pas/pas-book-view.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * pas-book-view.c
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <config.h>
-#include <string.h>
-#include <glib.h>
-#include <bonobo/bonobo-main.h>
-#include "pas-backend.h"
-#include "pas-backend-card-sexp.h"
-#include "pas-book-view.h"
-
-static BonoboObjectClass *pas_book_view_parent_class;
-
-struct _PASBookViewPrivate {
- GNOME_Evolution_Addressbook_BookViewListener listener;
-
-#define INITIAL_THRESHOLD 20
-#define THRESHOLD_MAX 3000
-
- GMutex *pending_mutex;
-
- CORBA_sequence_GNOME_Evolution_Addressbook_VCard adds;
- int next_threshold;
- int threshold_max;
-
- CORBA_sequence_GNOME_Evolution_Addressbook_VCard changes;
- CORBA_sequence_GNOME_Evolution_Addressbook_ContactId removes;
-
- PASBackend *backend;
- char *card_query;
- PASBackendCardSExp *card_sexp;
- GHashTable *ids;
-};
-
-static void
-send_pending_adds (PASBookView *book_view, gboolean reset)
-{
- CORBA_Environment ev;
- CORBA_sequence_GNOME_Evolution_Addressbook_VCard *adds;
-
- adds = &book_view->priv->adds;
- if (adds->_length == 0)
- return;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookViewListener_notifyContactsAdded (
- book_view->priv->listener, adds, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("send_pending_adds: Exception signaling BookViewListener!\n");
- }
-
- CORBA_exception_free (&ev);
-
- CORBA_free (adds->_buffer);
- adds->_buffer = NULL;
- adds->_maximum = 0;
- adds->_length = 0;
-
- if (reset)
- book_view->priv->next_threshold = INITIAL_THRESHOLD;
-}
-
-static void
-send_pending_changes (PASBookView *book_view)
-{
- CORBA_Environment ev;
- CORBA_sequence_GNOME_Evolution_Addressbook_VCard *changes;
-
- changes = &book_view->priv->changes;
- if (changes->_length == 0)
- return;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookViewListener_notifyContactsChanged (
- book_view->priv->listener, changes, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("send_pending_changes: Exception signaling BookViewListener!\n");
- }
-
- CORBA_exception_free (&ev);
-
- CORBA_free (changes->_buffer);
- changes->_buffer = NULL;
- changes->_maximum = 0;
- changes->_length = 0;
-}
-
-static void
-send_pending_removes (PASBookView *book_view)
-{
- CORBA_Environment ev;
- CORBA_sequence_GNOME_Evolution_Addressbook_VCard *removes;
-
- removes = &book_view->priv->removes;
- if (removes->_length == 0)
- return;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookViewListener_notifyContactsRemoved (
- book_view->priv->listener, removes, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("send_pending_removes: Exception signaling BookViewListener!\n");
- }
-
- CORBA_exception_free (&ev);
-
- CORBA_free (removes->_buffer);
- removes->_buffer = NULL;
- removes->_maximum = 0;
- removes->_length = 0;
-}
-
-#define MAKE_REALLOC(type) \
-static void \
-CORBA_sequence_ ## type ## _realloc (CORBA_sequence_ ## type *seq, \
- CORBA_unsigned_long new_max) \
-{ \
- type *new_buf; \
- \
- new_buf = CORBA_sequence_ ## type ## _allocbuf (new_max); \
- memcpy (new_buf, seq->_buffer, seq->_maximum * sizeof (type)); \
- CORBA_free (seq->_buffer); \
- seq->_buffer = new_buf; \
- seq->_maximum = new_max; \
-}
-
-MAKE_REALLOC (GNOME_Evolution_Addressbook_VCard)
-MAKE_REALLOC (GNOME_Evolution_Addressbook_ContactId)
-
-static void
-notify_change (PASBookView *book_view, const char *vcard)
-{
- CORBA_sequence_GNOME_Evolution_Addressbook_VCard *changes;
-
- send_pending_adds (book_view, TRUE);
- send_pending_removes (book_view);
-
- changes = &book_view->priv->changes;
-
- if (changes->_length == changes->_maximum) {
- CORBA_sequence_GNOME_Evolution_Addressbook_VCard_realloc (
- changes, 2 * (changes->_maximum + 1));
- }
-
- changes->_buffer[changes->_length++] = CORBA_string_dup (vcard);
-}
-
-static void
-notify_remove (PASBookView *book_view, const char *id)
-{
- CORBA_sequence_GNOME_Evolution_Addressbook_ContactId *removes;
-
- send_pending_adds (book_view, TRUE);
- send_pending_changes (book_view);
-
- removes = &book_view->priv->removes;
-
- if (removes->_length == removes->_maximum) {
- CORBA_sequence_GNOME_Evolution_Addressbook_ContactId_realloc (
- removes, 2 * (removes->_maximum + 1));
- }
-
- removes->_buffer[removes->_length++] = CORBA_string_dup (id);
- g_hash_table_remove (book_view->priv->ids, id);
-}
-
-static void
-notify_add (PASBookView *book_view, const char *id, const char *vcard)
-{
- CORBA_sequence_GNOME_Evolution_Addressbook_VCard *adds;
- PASBookViewPrivate *priv = book_view->priv;
-
- send_pending_changes (book_view);
- send_pending_removes (book_view);
-
- adds = &priv->adds;
-
- if (adds->_length == adds->_maximum) {
- send_pending_adds (book_view, FALSE);
-
- adds->_buffer = CORBA_sequence_GNOME_Evolution_Addressbook_VCard_allocbuf (priv->next_threshold);
- adds->_maximum = priv->next_threshold;
-
- if (priv->next_threshold < priv->threshold_max) {
- priv->next_threshold = MIN (2 * priv->next_threshold,
- priv->threshold_max);
- }
- }
-
- adds->_buffer[adds->_length++] = CORBA_string_dup (vcard);
- g_hash_table_insert (book_view->priv->ids, g_strdup (id),
- GUINT_TO_POINTER (1));
-}
-
-/**
- * pas_book_view_notify_update:
- */
-void
-pas_book_view_notify_update (PASBookView *book_view,
- EContact *contact)
-{
- gboolean currently_in_view, want_in_view;
- const char *id;
- char *vcard;
-
- g_mutex_lock (book_view->priv->pending_mutex);
-
- id = e_contact_get_const (contact, E_CONTACT_UID);
-
- currently_in_view =
- g_hash_table_lookup (book_view->priv->ids, id) != NULL;
- want_in_view = pas_backend_card_sexp_match_contact (
- book_view->priv->card_sexp, contact);
-
- if (want_in_view) {
- vcard = e_vcard_to_string (E_VCARD (contact),
- EVC_FORMAT_VCARD_30);
-
- if (currently_in_view)
- notify_change (book_view, vcard);
- else
- notify_add (book_view, id, vcard);
-
- g_free (vcard);
- } else {
- if (currently_in_view)
- pas_book_view_notify_remove (book_view, id);
- /* else nothing; we're removing a card that wasn't there */
- }
-
- g_mutex_unlock (book_view->priv->pending_mutex);
-}
-
-/**
- * pas_book_view_notify_remove:
- */
-void
-pas_book_view_notify_remove (PASBookView *book_view,
- const char *id)
-{
- g_mutex_lock (book_view->priv->pending_mutex);
- notify_remove (book_view, id);
- g_mutex_unlock (book_view->priv->pending_mutex);
-}
-
-
-void
-pas_book_view_notify_complete (PASBookView *book_view,
- GNOME_Evolution_Addressbook_CallStatus status)
-{
- CORBA_Environment ev;
-
- g_mutex_lock (book_view->priv->pending_mutex);
-
- send_pending_adds (book_view, TRUE);
- send_pending_changes (book_view);
- send_pending_removes (book_view);
-
- g_mutex_unlock (book_view->priv->pending_mutex);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookViewListener_notifySequenceComplete (
- book_view->priv->listener, status, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_view_notify_complete: Exception signaling BookViewListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-void
-pas_book_view_notify_status_message (PASBookView *book_view,
- const char *message)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookViewListener_notifyProgress (
- book_view->priv->listener, message, 0, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_view_notify_status_message: Exception signaling BookViewListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-static void
-pas_book_view_construct (PASBookView *book_view,
- PASBackend *backend,
- GNOME_Evolution_Addressbook_BookViewListener listener,
- const char *card_query,
- PASBackendCardSExp *card_sexp)
-{
- PASBookViewPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (book_view != NULL);
- g_return_if_fail (listener != CORBA_OBJECT_NIL);
-
- priv = book_view->priv;
-
- CORBA_exception_init (&ev);
-
- priv->listener = CORBA_Object_duplicate (listener, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("Unable to duplicate listener object in pas-book-view.c\n");
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_exception_free (&ev);
-
- priv->backend = backend;
- priv->card_query = g_strdup (card_query);
- priv->card_sexp = card_sexp;
-}
-
-/**
- * pas_book_view_new:
- */
-static void
-impl_GNOME_Evolution_Addressbook_BookView_start (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- PASBookView *view = PAS_BOOK_VIEW (bonobo_object (servant));
-
- pas_backend_start_book_view (pas_book_view_get_backend (view), view);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_BookView_stop (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- PASBookView *view = PAS_BOOK_VIEW (bonobo_object (servant));
-
- pas_backend_stop_book_view (pas_book_view_get_backend (view), view);
-}
-
-/**
- * pas_book_view_get_card_query
- */
-const char*
-pas_book_view_get_card_query (PASBookView *book_view)
-{
- return book_view->priv->card_query;
-}
-
-/**
- * pas_book_view_get_card_sexp
- */
-PASBackendCardSExp*
-pas_book_view_get_card_sexp (PASBookView *book_view)
-{
- return book_view->priv->card_sexp;
-}
-
-PASBackend*
-pas_book_view_get_backend (PASBookView *book_view)
-{
- return book_view->priv->backend;
-}
-
-GNOME_Evolution_Addressbook_BookViewListener
-pas_book_view_get_listener (PASBookView *book_view)
-{
- return book_view->priv->listener;
-}
-
-/**
- * pas_book_view_new:
- */
-PASBookView *
-pas_book_view_new (PASBackend *backend,
- GNOME_Evolution_Addressbook_BookViewListener listener,
- const char *card_query,
- PASBackendCardSExp *card_sexp)
-{
- PASBookView *book_view;
-
- book_view = g_object_new (PAS_TYPE_BOOK_VIEW, NULL);
-
- pas_book_view_construct (book_view, backend, listener, card_query, card_sexp);
-
- return book_view;
-}
-
-static void
-pas_book_view_dispose (GObject *object)
-{
- PASBookView *book_view = PAS_BOOK_VIEW (object);
-
- if (book_view->priv) {
- bonobo_object_release_unref (book_view->priv->listener, NULL);
-
- if (book_view->priv->adds._buffer)
- CORBA_free (book_view->priv->adds._buffer);
- if (book_view->priv->changes._buffer)
- CORBA_free (book_view->priv->changes._buffer);
- if (book_view->priv->removes._buffer)
- CORBA_free (book_view->priv->removes._buffer);
-
- g_free (book_view->priv->card_query);
- g_object_unref (book_view->priv->card_sexp);
-
- g_mutex_free (book_view->priv->pending_mutex);
- book_view->priv->pending_mutex = NULL;
-
- g_free (book_view->priv);
- book_view->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (pas_book_view_parent_class)->dispose)
- G_OBJECT_CLASS (pas_book_view_parent_class)->dispose (object);
-}
-
-static void
-pas_book_view_class_init (PASBookViewClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- POA_GNOME_Evolution_Addressbook_BookView__epv *epv;
-
- pas_book_view_parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = pas_book_view_dispose;
-
- epv = &klass->epv;
-
- epv->start = impl_GNOME_Evolution_Addressbook_BookView_start;
- epv->stop = impl_GNOME_Evolution_Addressbook_BookView_stop;
-
-}
-
-static void
-pas_book_view_init (PASBookView *book_view)
-{
- book_view->priv = g_new0 (PASBookViewPrivate, 1);
-
- book_view->priv->pending_mutex = g_mutex_new();
-
- book_view->priv->next_threshold = INITIAL_THRESHOLD;
- book_view->priv->threshold_max = THRESHOLD_MAX;
-
- book_view->priv->ids = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, NULL);
-}
-
-BONOBO_TYPE_FUNC_FULL (
- PASBookView,
- GNOME_Evolution_Addressbook_BookView,
- BONOBO_TYPE_OBJECT,
- pas_book_view);
diff --git a/addressbook/backend/pas/pas-book-view.h b/addressbook/backend/pas/pas-book-view.h
deleted file mode 100644
index 3b292d11db..0000000000
--- a/addressbook/backend/pas/pas-book-view.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * A wrapper object which exports the GNOME_Evolution_Addressbook_Book CORBA interface
- * and which maintains a request queue.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __PAS_BOOK_VIEW_H__
-#define __PAS_BOOK_VIEW_H__
-
-#include <bonobo/bonobo-object.h>
-#include <pas/addressbook.h>
-#include <glib.h>
-#include <glib-object.h>
-#include <pas/pas-types.h>
-#include <ebook/e-contact.h>
-
-#define PAS_TYPE_BOOK_VIEW (pas_book_view_get_type ())
-#define PAS_BOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BOOK_VIEW, PASBookView))
-#define PAS_BOOK_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_TYPE_BOOK_VIEW, PASBookViewClass))
-#define PAS_IS_BOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BOOK_VIEW))
-#define PAS_IS_BOOK_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BOOK_VIEW))
-#define PAS_BOOK_VIEW_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BOOK_VIEW, PASBookView))
-
-typedef struct _PASBookViewPrivate PASBookViewPrivate;
-
-struct _PASBookView {
- BonoboObject parent_object;
- PASBookViewPrivate *priv;
-};
-
-struct _PASBookViewClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Addressbook_BookView__epv epv;
-};
-
-
-PASBookView *pas_book_view_new (PASBackend *backend,
- GNOME_Evolution_Addressbook_BookViewListener listener,
- const char *card_query,
- PASBackendCardSExp *card_sexp);
-
-const char* pas_book_view_get_card_query (PASBookView *book_view);
-PASBackendCardSExp* pas_book_view_get_card_sexp (PASBookView *book_view);
-PASBackend* pas_book_view_get_backend (PASBookView *book_view);
-GNOME_Evolution_Addressbook_BookViewListener pas_book_view_get_listener (PASBookView *book_view);
-
-void pas_book_view_notify_update (PASBookView *book_view,
- EContact *contact);
-void pas_book_view_notify_remove (PASBookView *book_view,
- const char *id);
-void pas_book_view_notify_complete (PASBookView *book_view,
- GNOME_Evolution_Addressbook_CallStatus);
-void pas_book_view_notify_status_message (PASBookView *book_view,
- const char *message);
-
-GType pas_book_view_get_type (void);
-
-#endif /* ! __PAS_BOOK_VIEW_H__ */
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
deleted file mode 100644
index 346b37ceed..0000000000
--- a/addressbook/backend/pas/pas-book.c
+++ /dev/null
@@ -1,770 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * pas-book.c
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <config.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-arg.h>
-#include "e-util/e-list.h"
-#include "ebook/e-contact.h"
-#include "pas-book-view.h"
-#include "pas-backend.h"
-#include "pas-backend-card-sexp.h"
-#include "pas-marshal.h"
-
-static BonoboObjectClass *pas_book_parent_class;
-POA_GNOME_Evolution_Addressbook_Book__vepv pas_book_vepv;
-
-struct _PASBookPrivate {
- PASBackend *backend;
- GNOME_Evolution_Addressbook_BookListener listener;
- char *uri;
-};
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_open (PortableServer_Servant servant,
- const CORBA_boolean only_if_exists,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- printf ("impl_GNOME_Evolution_Addressbook_Book_open\n");
-
- pas_backend_open (pas_book_get_backend (book), book, only_if_exists);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_remove (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- printf ("impl_GNOME_Evolution_Addressbook_Book_remove\n");
-
- pas_backend_remove (pas_book_get_backend (book), book);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_getContact (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- printf ("impl_GNOME_Evolution_Addressbook_Book_getContact\n");
-
- pas_backend_get_contact (pas_book_get_backend (book), book, id);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_getContactList (PortableServer_Servant servant,
- const CORBA_char *query,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- printf ("impl_GNOME_Evolution_Addressbook_Book_getContactList\n");
-
- pas_backend_get_contact_list (pas_book_get_backend (book), book, query);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_authenticateUser (PortableServer_Servant servant,
- const char* user,
- const char* passwd,
- const char* auth_method,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- pas_backend_authenticate_user (pas_book_get_backend (book), book,
- user, passwd, auth_method);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_addContact (PortableServer_Servant servant,
- const CORBA_char *vcard,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- pas_backend_create_contact (pas_book_get_backend (book), book, vcard);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_removeContacts (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_ContactIdList *ids,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
- int i;
- GList *id_list = NULL;
-
- for (i = 0; i < ids->_length; i ++)
- id_list = g_list_append (id_list, ids->_buffer[i]);
-
- pas_backend_remove_contacts (pas_book_get_backend (book), book, id_list);
-
- g_list_free (id_list);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_modifyContact (PortableServer_Servant servant,
- const CORBA_char *vcard,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- pas_backend_modify_contact (pas_book_get_backend (book), book, vcard);
-}
-
-static void
-view_listener_died_cb (gpointer cnx, gpointer user_data)
-{
- PASBookView *book_view = PAS_BOOK_VIEW (user_data);
-
- pas_backend_stop_book_view (pas_book_view_get_backend (book_view), book_view);
- pas_backend_remove_book_view (pas_book_view_get_backend (book_view), book_view);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_getBookView (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_BookViewListener listener,
- const CORBA_char *search,
- const GNOME_Evolution_Addressbook_stringlist* requested_fields,
- const CORBA_long max_results,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
- PASBackend *backend = pas_book_get_backend (book);
- PASBackendCardSExp *card_sexp;
- PASBookView *view;
-
- g_warning ("impl_GNOME_Evolution_Addressbook_Book_getBookView (%s)\n", search);
-
- /* we handle this entirely here, since it doesn't require any
- backend involvement now that we have pas_book_view_start to
- actually kick off the search. */
-
- card_sexp = pas_backend_card_sexp_new (search);
- if (!card_sexp) {
- pas_book_respond_get_book_view (book, GNOME_Evolution_Addressbook_InvalidQuery, NULL);
- return;
- }
-
- view = pas_book_view_new (backend, listener, search, card_sexp);
-
- if (!view) {
- g_object_unref (card_sexp);
- pas_book_respond_get_book_view (book, GNOME_Evolution_Addressbook_OtherError, NULL);
- return;
- }
-
- ORBit_small_listen_for_broken (pas_book_view_get_listener (view), G_CALLBACK (view_listener_died_cb), view);
-
- pas_backend_add_book_view (backend, view);
-
- pas_book_respond_get_book_view (book, GNOME_Evolution_Addressbook_Success, view);
-
- g_object_unref (view);
-}
-
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_getChanges (PortableServer_Servant servant,
- const CORBA_char *change_id,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- pas_backend_get_changes (pas_book_get_backend (book), book, change_id);
-}
-
-static char *
-impl_GNOME_Evolution_Addressbook_Book_getStaticCapabilities (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
- char *temp;
- char *ret_val;
-
- temp = pas_backend_get_static_capabilities (book->priv->backend);
- ret_val = CORBA_string_dup(temp);
- g_free(temp);
- return ret_val;
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_getSupportedFields (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- pas_backend_get_supported_fields (pas_book_get_backend (book), book);
-}
-
-static void
-impl_GNOME_Evolution_Addressbook_Book_getSupportedAuthMethods (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- pas_backend_get_supported_auth_methods (pas_book_get_backend (book), book);
-}
-
-static GNOME_Evolution_Addressbook_CallStatus
-impl_GNOME_Evolution_Addressbook_Book_cancelOperation (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- PASBook *book = PAS_BOOK (bonobo_object (servant));
-
- return pas_backend_cancel_operation (pas_book_get_backend (book), book);
-}
-
-/**
- * pas_book_get_backend:
- */
-PASBackend *
-pas_book_get_backend (PASBook *book)
-{
- g_return_val_if_fail (book && PAS_IS_BOOK (book), NULL);
-
- return book->priv->backend;
-}
-
-GNOME_Evolution_Addressbook_BookListener
-pas_book_get_listener (PASBook *book)
-{
- g_return_val_if_fail (book && PAS_IS_BOOK (book), CORBA_OBJECT_NIL);
-
- return book->priv->listener;
-}
-
-const char*
-pas_book_get_uri (PASBook *book)
-{
- return book->priv->uri;
-}
-
-/**
- * pas_book_respond_open:
- */
-void
-pas_book_respond_open (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Addressbook_BookListener_notifyBookOpened (book->priv->listener, status, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_respond_open: Exception "
- "responding to BookListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * pas_book_respond_remove:
- */
-void
-pas_book_respond_remove (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Addressbook_BookListener_notifyBookRemoved (book->priv->listener, status, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_respond_remove: Exception "
- "responding to BookListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * pas_book_respond_create:
- */
-void
-pas_book_respond_create (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- EContact *contact)
-{
- CORBA_Environment ev;
-
- if (status == GNOME_Evolution_Addressbook_Success) {
- pas_backend_notify_update (book->priv->backend, contact);
- pas_backend_notify_complete (book->priv->backend);
- }
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookListener_notifyContactCreated (
- book->priv->listener, status,
- e_contact_get_const (contact, E_CONTACT_UID), &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_respond_create: Exception "
- "responding to BookListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * pas_book_respond_remove_contacts:
- */
-void
-pas_book_respond_remove_contacts (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *ids)
-{
- CORBA_Environment ev;
- GList *i;
-
- CORBA_exception_init (&ev);
-
- if (ids) {
- for (i = ids; i; i = i->next)
- pas_backend_notify_remove (book->priv->backend, i->data);
- pas_backend_notify_complete (book->priv->backend);
- }
-
- GNOME_Evolution_Addressbook_BookListener_notifyContactsRemoved (
- book->priv->listener, status, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_respond_remove: Exception "
- "responding to BookListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * pas_book_respond_modify:
- */
-void
-pas_book_respond_modify (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- EContact *contact)
-{
- CORBA_Environment ev;
-
- if (status == GNOME_Evolution_Addressbook_Success) {
- pas_backend_notify_update (book->priv->backend, contact);
- pas_backend_notify_complete (book->priv->backend);
- }
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookListener_notifyContactModified (
- book->priv->listener, status, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_respond_modify: Exception "
- "responding to BookListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * pas_book_respond_authenticate_user:
- */
-void
-pas_book_respond_authenticate_user (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookListener_notifyAuthenticationResult (
- book->priv->listener, status, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_respond_authenticate_user: Exception "
- "responding to BookListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-void
-pas_book_respond_get_supported_fields (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *fields)
-{
- CORBA_Environment ev;
- GNOME_Evolution_Addressbook_stringlist stringlist;
- int num_fields;
- int i;
- GList *iter;
-
- CORBA_exception_init (&ev);
-
- num_fields = g_list_length (fields);
-
- stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_fields);
- stringlist._maximum = num_fields;
- stringlist._length = num_fields;
-
- for (i = 0, iter = fields; iter; iter = iter->next, i ++) {
- stringlist._buffer[i] = CORBA_string_dup ((char*)iter->data);
- }
-
- printf ("calling GNOME_Evolution_Addressbook_BookListener_notifySupportedFields\n");
-
- GNOME_Evolution_Addressbook_BookListener_notifySupportedFields (
- book->priv->listener, status,
- &stringlist,
- &ev);
-
- CORBA_exception_free (&ev);
-
- CORBA_free(stringlist._buffer);
-}
-
-void
-pas_book_respond_get_supported_auth_methods (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *auth_methods)
-{
- CORBA_Environment ev;
- GNOME_Evolution_Addressbook_stringlist stringlist;
- int num_auth_methods;
- GList *iter;
- int i;
-
- CORBA_exception_init (&ev);
-
- num_auth_methods = g_list_length (auth_methods);
-
- stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_auth_methods);
- stringlist._maximum = num_auth_methods;
- stringlist._length = num_auth_methods;
-
- for (i = 0, iter = auth_methods; iter; iter = iter->next, i ++) {
- stringlist._buffer[i] = CORBA_string_dup ((char*)iter->data);
- }
-
- GNOME_Evolution_Addressbook_BookListener_notifySupportedAuthMethods (
- book->priv->listener, status,
- &stringlist,
- &ev);
-
- CORBA_exception_free (&ev);
-
- CORBA_free(stringlist._buffer);
-}
-
-static void
-view_destroy(gpointer data, GObject *where_object_was)
-{
- PASBook *book = (PASBook *)data;
- EIterator *iterator;
- gboolean success = FALSE;
- EList *views = pas_backend_get_book_views (book->priv->backend);
-
- for (iterator = e_list_get_iterator(views);
- e_iterator_is_valid(iterator);
- e_iterator_next(iterator)) {
- const PASBookView *view = e_iterator_get(iterator);
- if (view == (PASBookView*)where_object_was) {
- e_iterator_delete(iterator);
- success = TRUE;
- break;
- }
- }
- if (!success)
- g_warning ("Failed to remove from book_views list");
- g_object_unref(iterator);
- g_object_unref(views);
-}
-
-/**
- * pas_book_respond_get_book_view:
- */
-void
-pas_book_respond_get_book_view (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- PASBookView *book_view)
-{
- CORBA_Environment ev;
- CORBA_Object object = CORBA_OBJECT_NIL;
-
- printf ("pas_book_respond_get_book_view\n");
-
- CORBA_exception_init (&ev);
-
- if (book_view) {
- object = bonobo_object_corba_objref(BONOBO_OBJECT(book_view));
-
- g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
- }
-
- GNOME_Evolution_Addressbook_BookListener_notifyViewRequested (
- book->priv->listener, status, object, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_respond_get_book_view: Exception "
- "responding to BookListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * pas_book_respond_get_contact:
- */
-void
-pas_book_respond_get_contact (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- char *vcard)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookListener_notifyContactRequested (book->priv->listener,
- status,
- vcard,
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("could not notify listener of get-contact response");
-
- CORBA_exception_free (&ev);
-}
-
-/**
- * pas_book_respond_get_contact_list:
- */
-void
-pas_book_respond_get_contact_list (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *card_list)
-{
- CORBA_Environment ev;
- GNOME_Evolution_Addressbook_stringlist stringlist;
- int num_cards;
- int i;
- GList *l;
-
- CORBA_exception_init (&ev);
-
- num_cards = g_list_length (card_list);
-
- stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_cards);
- stringlist._maximum = num_cards;
- stringlist._length = num_cards;
-
- for (i = 0, l = card_list; l; l = l->next, i ++)
- stringlist._buffer[i] = CORBA_string_dup (l->data);
-
- g_list_foreach (card_list, (GFunc)g_free, NULL);
- g_list_free (card_list);
-
-
- GNOME_Evolution_Addressbook_BookListener_notifyContactListRequested (book->priv->listener,
- status,
- &stringlist,
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("could not notify listener of get-contact-list response");
-
- CORBA_exception_free (&ev);
-
- CORBA_free(stringlist._buffer);
-}
-
-/**
- * pas_book_respond_get_changes:
- */
-void
-pas_book_respond_get_changes (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *changes)
-{
- CORBA_Environment ev;
- GNOME_Evolution_Addressbook_BookChangeList changelist;
- int num_changes;
- int i;
- GList *l;
-
- CORBA_exception_init (&ev);
-
- num_changes = g_list_length (changes);
-
- changelist._buffer = CORBA_sequence_GNOME_Evolution_Addressbook_BookChangeItem_allocbuf (num_changes);
- changelist._maximum = num_changes;
- changelist._length = num_changes;
-
- for (i = 0, l = changes; l; l = l->next, i ++) {
- GNOME_Evolution_Addressbook_BookChangeItem *change = (GNOME_Evolution_Addressbook_BookChangeItem*)l->data;
- changelist._buffer[i] = *change;
- changelist._buffer[i].vcard = CORBA_string_dup (change->vcard);
- }
-
- g_list_foreach (changes, (GFunc)CORBA_free, NULL);
- g_list_free (changes);
-
- GNOME_Evolution_Addressbook_BookListener_notifyChangesRequested (book->priv->listener,
- status,
- &changelist,
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("could not notify listener of get-changes response");
-
- CORBA_exception_free (&ev);
-
- CORBA_free(changelist._buffer);
-}
-
-/**
- * pas_book_report_writable:
- */
-void
-pas_book_report_writable (PASBook *book,
- gboolean writable)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookListener_notifyWritable (
- book->priv->listener, (CORBA_boolean) writable, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("pas_book_report_writable: Exception "
- "responding to BookListener!\n");
- }
-
- CORBA_exception_free (&ev);
-}
-
-static void
-pas_book_construct (PASBook *book,
- PASBackend *backend,
- const char *uri,
- GNOME_Evolution_Addressbook_BookListener listener)
-{
- PASBookPrivate *priv;
- CORBA_Environment ev;
-
- g_return_if_fail (book != NULL);
-
- priv = book->priv;
-
- CORBA_exception_init (&ev);
- book->priv->listener = CORBA_Object_duplicate (listener, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_message ("pas_book_construct(): could not duplicate the listener");
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_exception_free (&ev);
-
- priv->backend = backend;
- priv->uri = g_strdup (uri);
-
-}
-
-/**
- * pas_book_new:
- */
-PASBook *
-pas_book_new (PASBackend *backend,
- const char *uri,
- GNOME_Evolution_Addressbook_BookListener listener)
-{
- PASBook *book;
- char *caps = pas_backend_get_static_capabilities (backend);
-
- book = g_object_new (PAS_TYPE_BOOK,
- "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL),
- NULL);
-
- pas_book_construct (book, backend, uri, listener);
-
- g_free (caps);
-
- return book;
-}
-
-static void
-pas_book_dispose (GObject *object)
-{
- PASBook *book = PAS_BOOK (object);
-
- if (book->priv) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- CORBA_Object_release (book->priv->listener, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("pas_book_construct(): could not release the listener");
-
- CORBA_exception_free (&ev);
-
- g_free (book->priv->uri);
- g_free (book->priv);
- book->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (pas_book_parent_class)->dispose)
- G_OBJECT_CLASS (pas_book_parent_class)->dispose (object);
-}
-
-static void
-pas_book_class_init (PASBookClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- POA_GNOME_Evolution_Addressbook_Book__epv *epv;
-
- pas_book_parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = pas_book_dispose;
-
- epv = &klass->epv;
-
- epv->open = impl_GNOME_Evolution_Addressbook_Book_open;
- epv->remove = impl_GNOME_Evolution_Addressbook_Book_remove;
- epv->getContact = impl_GNOME_Evolution_Addressbook_Book_getContact;
- epv->getContactList = impl_GNOME_Evolution_Addressbook_Book_getContactList;
- epv->authenticateUser = impl_GNOME_Evolution_Addressbook_Book_authenticateUser;
- epv->addContact = impl_GNOME_Evolution_Addressbook_Book_addContact;
- epv->removeContacts = impl_GNOME_Evolution_Addressbook_Book_removeContacts;
- epv->modifyContact = impl_GNOME_Evolution_Addressbook_Book_modifyContact;
- epv->getStaticCapabilities = impl_GNOME_Evolution_Addressbook_Book_getStaticCapabilities;
- epv->getSupportedFields = impl_GNOME_Evolution_Addressbook_Book_getSupportedFields;
- epv->getSupportedAuthMethods = impl_GNOME_Evolution_Addressbook_Book_getSupportedAuthMethods;
- epv->getBookView = impl_GNOME_Evolution_Addressbook_Book_getBookView;
- epv->getChanges = impl_GNOME_Evolution_Addressbook_Book_getChanges;
- epv->cancelOperation = impl_GNOME_Evolution_Addressbook_Book_cancelOperation;
-}
-
-static void
-pas_book_init (PASBook *book)
-{
- book->priv = g_new0 (PASBookPrivate, 1);
-}
-
-BONOBO_TYPE_FUNC_FULL (
- PASBook,
- GNOME_Evolution_Addressbook_Book,
- BONOBO_TYPE_OBJECT,
- pas_book);
diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h
deleted file mode 100644
index 2cb84569c2..0000000000
--- a/addressbook/backend/pas/pas-book.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * A wrapper object which exports the GNOME_Evolution_Addressbook_Book CORBA interface
- * and which maintains a request queue.
- *
- * Author:
- * Nat Friedman (nat@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __PAS_BOOK_H__
-#define __PAS_BOOK_H__
-
-#include <pas/addressbook.h>
-#include <bonobo/bonobo-object.h>
-#include "e-util/e-list.h"
-
-#include <pas/pas-types.h>
-
-#define PAS_TYPE_BOOK (pas_book_get_type ())
-#define PAS_BOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BOOK, PASBook))
-#define PAS_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BOOK_FACTORY_TYPE, PASBookClass))
-#define PAS_IS_BOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BOOK))
-#define PAS_IS_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BOOK))
-#define PAS_BOOK_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BOOK, PASBookClass))
-
-typedef struct _PASBookPrivate PASBookPrivate;
-
-struct _PASBook {
- BonoboObject parent_object;
- PASBookPrivate *priv;
-};
-
-struct _PASBookClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Addressbook_Book__epv epv;
-
- /* Padding for future expansion */
- void (*_pas_reserved0) (void);
- void (*_pas_reserved1) (void);
- void (*_pas_reserved2) (void);
- void (*_pas_reserved3) (void);
- void (*_pas_reserved4) (void);
-};
-
-
-PASBook *pas_book_new (PASBackend *backend,
- const char *uri,
- GNOME_Evolution_Addressbook_BookListener listener);
-GNOME_Evolution_Addressbook_BookListener pas_book_get_listener (PASBook *book);
-PASBackend *pas_book_get_backend (PASBook *book);
-const char *pas_book_get_uri (PASBook *book);
-
-void pas_book_respond_open (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status);
-void pas_book_respond_remove (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status);
-void pas_book_respond_create (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- EContact *contact);
-void pas_book_respond_remove_contacts (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *ids);
-void pas_book_respond_modify (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- EContact *contact);
-void pas_book_respond_authenticate_user (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status);
-void pas_book_respond_get_supported_fields (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *fields);
-void pas_book_respond_get_supported_auth_methods (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *fields);
-
-void pas_book_respond_get_book_view (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- PASBookView *book_view);
-void pas_book_respond_get_contact (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- char *vcard);
-void pas_book_respond_get_contact_list (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *cards);
-void pas_book_respond_get_changes (PASBook *book,
- GNOME_Evolution_Addressbook_CallStatus status,
- GList *changes);
-
-void pas_book_report_writable (PASBook *book,
- gboolean writable);
-
-GType pas_book_get_type (void);
-
-#endif /* ! __PAS_BOOK_H__ */
diff --git a/addressbook/backend/pas/pas-marshal.list b/addressbook/backend/pas/pas-marshal.list
deleted file mode 100644
index 9d6744db44..0000000000
--- a/addressbook/backend/pas/pas-marshal.list
+++ /dev/null
@@ -1,2 +0,0 @@
-NONE:NONE
-NONE:POINTER
diff --git a/addressbook/backend/pas/pas-types.h b/addressbook/backend/pas/pas-types.h
deleted file mode 100644
index 19611a4e23..0000000000
--- a/addressbook/backend/pas/pas-types.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Blanket header containing the typedefs for object types used in the
- * PAS stuff, so we can disentangle the #includes.
- *
- * Author: Chris Toshok <toshok@ximian.com>
- *
- * Copyright 2003, Ximian, Inc.
- */
-
-#ifndef __PAS_TYPES_H__
-#define __PAS_TYPES_H__
-
-typedef struct _PASBookView PASBookView;
-typedef struct _PASBookViewClass PASBookViewClass;
-
-typedef struct _PASBackendCardSExp PASBackendCardSExp;
-typedef struct _PASBackendCardSExpClass PASBackendCardSExpClass;
-
-typedef struct _PASBackend PASBackend;
-typedef struct _PASBackendClass PASBackendClass;
-
-typedef struct _PASBackendSummary PASBackendSummary;
-typedef struct _PASBackendSummaryClass PASBackendSummaryClass;
-
-typedef struct _PASBackendSync PASBackendSync;
-typedef struct _PASBackendSyncClass PASBackendSyncClass;
-
-typedef struct _PASBook PASBook;
-typedef struct _PASBookClass PASBookClass;
-
-#endif /* __PAS_TYPES_H__ */
diff --git a/addressbook/backend/pas/ximian-vcard.h b/addressbook/backend/pas/ximian-vcard.h
deleted file mode 100644
index 961a5cadb4..0000000000
--- a/addressbook/backend/pas/ximian-vcard.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#define XIMIAN_VCARD \
-"BEGIN:VCARD\n" \
-"X-EVOLUTION-FILE-AS:Ximian\\, Inc.\n" \
-"ADR;TYPE=WORK:;Suite 3 West;401 Park Drive;Boston;MA;02215;USA\n" \
-"LABEL;TYPE=WORK:401 Park Drive\\nSuite 3 West\\nBoston\\, MA\\n02215\\nUSA\n" \
-"TEL;WORK;VOICE:(617) 375-3800\n" \
-"TEL;WORK;FAX:(617) 236-8630\n" \
-"EMAIL;INTERNET:hello@ximian.com\n" \
-"URL:http://www.ximian.com/\n" \
-"ORG:Ximian\\, Inc.;\n" \
-"NOTE:Welcome to the Ximian Addressbook.\n" \
-"PHOTO;ENCODING=b;TYPE=JPEG:/9j/4AAQSkZJRgABAQEARwBHAAD//gAXQ3JlYXRlZCB3aXRo\n" \
-" IFRoZSBHSU1Q/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCM\n" \
-" cHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIyMj\n" \
-" IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgAbgBkAwEiAAIRAQMRAf/EA\n" \
-" BwAAAIDAQEBAQAAAAAAAAAAAAAHBQYIBAMBAv/EAEYQAAEDAwEFBgMEBgQPAAAAAAECAwQABREG\n" \
-" BxIhMWETIkFRcYEUkaEIMkLBFSNSsbLRFmJydRgkMzY3Q0RGgpKTosLh8P/EABsBAQACAwEBAAA\n" \
-" AAAAAAAAAAAAEBQIDBgEH/8QALREAAQMCAwYGAgMAAAAAAAAAAQACAwQREiFRBRMiMUFhMnGBkb\n" \
-" HRBsEUofD/2gAMAwEAAhEDEQA/AH/RRRREVwXe9W2wwFzbpNZixkc1uqwPQeZ6CoHXevLfom1ds\n" \
-" 9h6a6D8PGCsFZHMk+CR4n86yzdbrqfaZqYBSnp0hRPZMoG62ynoOSR1Pua8Lg0XPJegX5Jv6k+0\n" \
-" bBjrWxp22LlkcBIlHs0HqEjiR64peT9umupqyWrhHhpP4WI6eHureNW7Tmw+DGaTI1FJVJdxksM\n" \
-" qKG09CrmfbFMCHpCw2xATDs8JrH4gykq+Z4mqifbMUZsxpd/QUllK53M2SCb2xa+bXvf0gcV0Uw\n" \
-" 0R/DVktH2hdUwlpFxjQrg1490tLPuOH0pvv2qE4jdchx1p8lNAj91Va87OtM3RCt+2Nx3Dyci/q\n" \
-" yPYcD7g1EZ+RR4rSMI9b/S2mhdbhKsmkdtWmNTuNxnXVW2cvgGZRASo+SV8j74PSmOlQUMpORWP\n" \
-" NU7MrjY0rlQFmdDTxOE4cQOo8R1Hyqe2Z7ZJ2m32bXfHnJVpJCUuqO8uP7+Kenh4eVXkFRFUMxx\n" \
-" G4UOSN0Zs4LU1FeEOWxOityYzqHWXEhSFoOQoHkQa963rBFFFFERUdfr1E09Y5d1mr3Y8ZsrV5n\n" \
-" yA6k4A6mpGkL9ojUym0W/TrLmAsGU+AeYBwgfPJ/4RREqrrcb1tJ1oUpBXLmObqUZ7rSByT0SkZ\n" \
-" J8zk1pHQmiLXo+zpbabC3SAp55Q7zyvM9PIUudiGmURbS7fpCMvzFFton8LSTxx6qH0FM7VV9VY\n" \
-" 9MzZ7aQt5tASw3+26ohKB/zEVSVFVvZzGMw02tqe/kpbI8LMR6/C/Xxq9QagfbbP+IW1QQ4Rycf\n" \
-" xncHRAIJ/rEfsmu2a9Fgsl2XIZjtj8bqwgfM1+9L2VFksESAV9o6hG886ebjqjvLWepUSarutdn\n" \
-" MXV+obRcZks/CwCQ5DKMpeBOTxzwzgA9KwfTtfxPOSB5GQUXc9pOjoC+zXe2HV5xiOC6PmkEfWp\n" \
-" xe6tAWghSVDIIOQRXxekNOx4b0WPZYLLTram19mwlJKSMHjjNUzQd2dZM7SNxczcLOsttqVzdYz\n" \
-" 3FewI9iKpK2mjMZdFe7ed9NfT9qZDI4OAd1Vkko50ndoui22kuXq2NBOO9JZSOH9sD9/z86c8gc\n" \
-" DUJNQlaFJUkKSoYII4EVGoKp9PIHt9e6lyRNlZhcqlsJ2guQpydL3F4mO7kw1KP3Fcyj0PEjrnz\n" \
-" rSAIIyOVYfvsJ3TGqlCKpTfYuJfjLHMDOR8jw9q2Foy+o1FpWBckY/XMpUoeRxxHsciu/jeJGB7\n" \
-" eRXPvaWuLT0U/RRRWaxQeVY82x3BVw2oXbJyhgoZR0AQM/UmthK+6fSsWbRQW9pV73x/tZPtwNE\n" \
-" Wj9Nw0WuwwIKQAGI6G/cAZ+tRW0lx5nTEW4Ntqdat9xjy5CEjJLSFZP5H2qaYdCkpUk5BGQa7Ap\n" \
-" DrSm3EpWhYKVJUMgg8wRXz+kqyyTG7VXUsV22Clrfc48+CzMiPIejvIC23EHIUDXNe79b7HbXbh\n" \
-" c5SI8ZvmtZ5nyA5k9BS7d0nfdMPuSdD3JtEZaitdom5Uznx3DzT6cPWkvq/V1611fGW5nZtBCgy\n" \
-" zFbXhtCycE5JxknxPhXR07RUeB3D11H+9lAfwcxmrrqLbxcHpikWGAw1FScByUkqWvrgEBPpxqi\n" \
-" ztdXWdqmNqIIjx7gykJUphJCXAM/eBJ5g4PQCmBZNiDKWEu364uF0jJYh4AT6qUDn2FVu6bPIkT\n" \
-" aTB08xKeMOU2H99eCtKRvZGQMZ7hwceNZxVGzsbmMzIBv5dfNeOjnsCdUwbTtKsV8nJgIccZkqw\n" \
-" lJcThDqvJJz8s4zUtLVzpc2vZZKt+qBIkyUKt0V0ONKSe+7g5SCPDr9Kv0tznXP1cNMyQfxnXBC\n" \
-" tqUyuB3gslftPjJLkGWB3u82o/Ij86bf2e7iqRoxyIpWfhpC0JHQ4V/5GlVtJcBt0RPiXif+00w\n" \
-" Ps5BQtNxP4TJP8Ka6rZZJpW37/Kq68ATlPeiiirBQ0HlWR9t9qVbtpEp/dwiY0h5J8Mgbp/h+ta\n" \
-" 4pM7fdKLumn2rxGbKn4BKl4HEtn73ywD7GiL7o28JuulLbKCsqLKUL/tJ7p+oqyIe4c6RGyzU4g\n" \
-" THLNJc3WpCt9gk8A54j3GPcdaZuoosy82V23QpaYpkEIdeIJKUeIAHieXPkTXA11DuassJsCefY\n" \
-" /SvYZN5FiGZU9edRwLDAXJny2mRukoStQBWQOQHjSjg7PYE7ZmzcZb7cG6KK5CZD6txOCcJQvPg\n" \
-" QAQfAn2q6RNOWi1D9J3R5dwlR2xmZPVv9mlI8ByTj59ar09Lm0jUIQl5Y0zAUMrQSPiXfHHpyz4\n" \
-" D1qTRvMQIieQAQXOtllfIDre/X2WqVmI8Qz6D9q0bP9SO37SrSpW8ZUVXw7q+YcKeSgeRyMZ65q\n" \
-" qammvWTalEv1yjOJtaWfh25CBvBOUkHPlxUeHlyq/MiPCitxorSGWG07qG0DASK45xZlx3GJDaH\n" \
-" WljCkLGQR6VGinY2ofIG8Lri2gOi37hxYG3zC+uT2HY6ZDbyFMrAUlwK7pB5HNRcp7nxqpzdN3G\n" \
-" CFQ7NObTa3nApcaSN/suOe4SDw6VK3O4swojsp9WGmxk9fIDrW4UzWkbt2K/v691vjec8YtZUTa\n" \
-" BL+IuMaIjiWWytXQn/wBD608tgtrVC0W2+tOFSFqd9icD6AVnmFFl6n1AhoAmRPdwcfgR4n2H7q\n" \
-" 2Ppi1N2exRojaQlKEBIHkAK7Gmi3MTWaLn6iTeSF+qmaKKK3rSiuedEanQ3I7qQpC0kEEZzXRRR\n" \
-" FjnaRoSVoq/KcYQv9HOr3mHB/qzz3SenhVi0ftAbnNNwLo6G5iQEodUcJd9fJX760ZqLTkHUdsd\n" \
-" hTWEOtuJwQoVl/XGyS7aakOPwGnJcDORujK0DqPH2qJV0cdUzC/0Oi3QTuhddqY84IuFukwnFFK\n" \
-" JDSmlEcwFDGR86ISI1tgtQ4jYaYaTuoSP/udJS1azvFoAZLnbsp4dm/klPQHmKs0faVEWkfEw32\n" \
-" 1f1CFj8q56XZNSwYG5t7fSt46yB5ucimM5L4c643pXWqU5tCteMpRKUfIIH86ipmvnnAUwoQSf2\n" \
-" 3lZ+g/nWEey5yfCtrquBo8Su0+4sQ46pEp1LTSeZUfoPOlnfr67fZKQlK0QkK/VtficV5nrXOkX\n" \
-" XUk9KQHp0gnghI7qPyAp1bOdkCmH2rneQHHxxQjHdb9OvWr2j2c2Didm74VZVVplGFuQXRsc2fO\n" \
-" Qgb1cmsSXQN1JH+TT4D+dPEAAADkK848duMylppISkDGBXrVkoCKKKKIiiqrrbX9m0JARIua1re\n" \
-" dJDMdoArcI58+AA8zVLsO26RqiS9Gsukpct5lHaKbTLaSrd8wFEZ9s0RN6vGRGZktlDqAoHzFKq\n" \
-" JtomzrPOuzGjZvwEBRTJfckttpbUOae9jJ5cBk8R514Wrbo7e489+3aTlvtQGTIkqElsdm2Mkq4\n" \
-" 4zyPKiKf1Hsj09flKdXEQh4/jR3VfMUvJ/2et1ZMOe8keSgFfyqz2LbfJ1M9IZs2kJsx2O0XnEN\n" \
-" yEAhA4ZwcZ58hxr7ZdtkvUS5SbTo2fJMRsuPkPoSG0jzKsDPPhz4HyoipDewC47+FXFWOjYH51Y\n" \
-" bTsAgtrSqc88/jwWrA+QxUlYtujupZ6oNo0nLlSUtqdKEyW04SMZOVYHiKjP8ACUt5/wB3pX/XT\n" \
-" /KiJnWLQ1nsTSURorad39lIFWZKUoThIAHSlNqDbLP0siKu96MnQ0ygSyVyGzvYxnlnB4jga87F\n" \
-" ttlamXJbs2j50xcZvtXUtyEZCfPB5+gyaIm9RSetm3J68RbhJgaSmPM25vtZaviW09knjxIOM8j\n" \
-" y8q7LHtzstwv/AOhrlBftkkudkFOLS43v5xgqSeHHx5daImrRX5QtK0hSTkGiiLMP2ho8wa1iSn\n" \
-" QoxVRQ20fAKClFQ9eIqq7LLJe7vreG7ZZCoZhqD8iZjustjnnwORkY8c+Wa1ZqbStt1PBMa4MId\n" \
-" Rz7wzg+dL8bEbA1vpa7RtK+CkpdWAfXjRFB7UpCNe6Kdm6NnJft1qluKuUJlvdKznPbYH3hzPXJ\n" \
-" PMGqZsk/zc2gf3G5/Cumc3sRsTO92Rcb3uB3XVjP1r4jYfYGwoN76QsYUEurGR5HjREudhUt2BP\n" \
-" 1TMYID0eyuuoJGRvJII+oq96I2iwtVz7rb7ZZWbalyzyJ9wKUjLsrKEkjH4cE8+Jz049bew+wNb\n" \
-" 3Z76N4YO66sZHlzob2H2Bkktb6CRglLqxkeXOiJZbAv9IMj+7X/wB6ag9lGnEaj17CRJA+BhZmy\n" \
-" lK+6EI44PQq3R6E06W9h9gZVvNb6FYxlLqwcfOhvYhYWt7s99G8MK3XVjI68aIo7UxgbR9IajhQ\n" \
-" 7/Du9yiSF3S3tMNrStlkAAt94DPDI4eJFUvYfNetqNYz4xAfjWZx5skZAUnJHD1FMVrYhYWVbzW\n" \
-" +2ojGUOrBx86EbD7A0FBvfRvDCt11YyPI8aIo23zdP6i2e621TaUJiXCfa1IucFPJt5KVnfHRWS\n" \
-" euPPNZ2YadfkNsspUp1aglCU8yTyrTSNh9gbCgjfSFjCgl1YyPI8al9PbItP2WamUywkuJ5KOVE\n" \
-" emeVEVw02ZH9H4YkEqdDYCifE4oqXbaS02lCRhIGBRRF//Z\n" \
-"END:VCARD"
diff --git a/addressbook/conduit/Makefile.am b/addressbook/conduit/Makefile.am
index ca6d7fab30..02df188703 100644
--- a/addressbook/conduit/Makefile.am
+++ b/addressbook/conduit/Makefile.am
@@ -18,9 +18,6 @@ libeaddress_conduit_la_SOURCES = \
libeaddress_conduit_la_LDFLAGS = -module -avoid-version
libeaddress_conduit_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/e-util/ename/libename.la \
- $(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/libeconduit.la \
$(top_builddir)/camel/libcamel.la \
$(EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS)
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
index a85dda4587..5d6530fd85 100644
--- a/addressbook/conduit/address-conduit.c
+++ b/addressbook/conduit/address-conduit.c
@@ -31,7 +31,7 @@
#include <pi-socket.h>
#include <pi-dlp.h>
#include <pi-address.h>
-#include <ebook/e-book.h>
+#include <libebook/e-book.h>
#include <gpilotd/gnome-pilot-conduit.h>
#include <gpilotd/gnome-pilot-conduit-sync-abs.h>
#include <libgpilotdCM/gnome-pilot-conduit-management.h>
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index 458e8edbd7..0d6b6e2461 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -54,7 +54,6 @@ libevolution_addressbook_la_LIBADD = \
$(top_builddir)/addressbook/gui/search/libeaddressbooksearch.la \
$(top_builddir)/filter/libfilter.la \
$(top_builddir)/addressbook/util/libeabutil.la \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
$(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
$(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 32c5ab1288..ddf7b8616a 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -53,7 +53,7 @@
#include "addressbook/printing/e-contact-print.h"
#include "addressbook/util/eab-book-util.h"
-#include <ebook/e-book-async.h>
+#include <libebook/e-book-async.h>
#include <widgets/misc/e-search-bar.h>
#include <widgets/misc/e-filter-bar.h>
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h
index 573adbf38d..5e6ff05f64 100644
--- a/addressbook/gui/component/addressbook.h
+++ b/addressbook/gui/component/addressbook.h
@@ -5,7 +5,7 @@
#include <e-util/e-config-listener.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-moniker-util.h>
-#include <ebook/e-book-async.h>
+#include <libebook/e-book-async.h>
/* use this instead of e_book_load_uri everywhere where you want the
authentication to be handled for you. */
diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am
index f6d1fc6e5e..59ef7fc6b2 100644
--- a/addressbook/gui/component/select-names/Makefile.am
+++ b/addressbook/gui/component/select-names/Makefile.am
@@ -70,7 +70,6 @@ libeselectnames_la_SOURCES = \
e-select-names.h
libeselectnames_la_LIBADD = \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
$(EVOLUTION_ADDRESSBOOK_LIBS)
# We'll need these again when we split out the select names control
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c
index 7bfbfd2a5a..39b5f7a008 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ b/addressbook/gui/component/select-names/e-select-names-completion.c
@@ -34,10 +34,10 @@
#include <gtk/gtksignal.h>
+#include <libebook/e-contact.h>
#include <addressbook/util/eab-book-util.h>
#include <addressbook/util/eab-destination.h>
#include <addressbook/gui/merging/eab-contact-compare.h>
-#include <addressbook/backend/ebook/e-contact.h>
typedef struct {
EBook *book;
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.h b/addressbook/gui/component/select-names/e-select-names-completion.h
index 435fe80041..4ad1f4fd52 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.h
+++ b/addressbook/gui/component/select-names/e-select-names-completion.h
@@ -28,7 +28,7 @@
#define E_SELECT_NAMES_COMPLETION_H
#include <gal/e-text/e-completion.h>
-#include <addressbook/backend/ebook/e-book-async.h>
+#include <libebook/e-book-async.h>
#include "e-select-names-text-model.h"
G_BEGIN_DECLS
diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c
index d95aebde5d..74bda7a74b 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -16,10 +16,9 @@
#include <gtk/gtksignal.h>
#include <gal/util/e-util.h>
-
+#include <libebook/e-contact.h>
#include "e-select-names-model.h"
#include "e-select-names-marshal.h"
-#include "addressbook/backend/ebook/e-contact.h"
#define MAX_LENGTH 2047
diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h
index 41d5100f59..0d21ee86b3 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.h
+++ b/addressbook/gui/component/select-names/e-select-names-model.h
@@ -15,7 +15,7 @@
#include <gtk/gtkobject.h>
#include <stdio.h>
#include <e-util/e-list.h>
-#include <addressbook/backend/ebook/e-contact.h>
+#include <libebook/e-contact.h>
#include <addressbook/util/eab-destination.h>
#define E_TYPE_SELECT_NAMES_MODEL (e_select_names_model_get_type ())
diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c
index 14261e9d80..aaa6936c8d 100644
--- a/addressbook/gui/component/select-names/e-select-names-table-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-table-model.c
@@ -14,9 +14,8 @@
#include <gtk/gtksignal.h>
#include <gal/util/e-util.h>
#include <libgnome/gnome-i18n.h>
-
+#include <libebook/e-contact.h>
#include "e-select-names-table-model.h"
-#include "addressbook/backend/ebook/e-contact.h"
/* Object argument IDs */
enum {
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index b50a6d0ca0..4423107fca 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -28,9 +28,10 @@
#include <gal/e-table/e-table-without.h>
#include <gal/widgets/e-popup-menu.h>
+#include <libebook/e-book-async.h>
+#include <libebook/e-contact.h>
#include <addressbook/gui/widgets/e-addressbook-model.h>
#include <addressbook/gui/widgets/e-addressbook-table-adapter.h>
-#include <addressbook/backend/ebook/e-book-async.h>
#include <addressbook/util/eab-book-util.h>
#include <addressbook/gui/component/addressbook-component.h>
#include <addressbook/gui/component/addressbook-storage.h>
@@ -39,7 +40,6 @@
#include <shell/evolution-folder-selector-button.h>
#include "e-select-names.h"
-#include <addressbook/backend/ebook/e-contact.h>
#include "e-select-names-table-model.h"
#include <gal/widgets/e-categories-master-list-option-menu.h>
#include <gal/e-text/e-entry.h>
diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.h b/addressbook/gui/contact-editor/e-contact-editor-address.h
index c20f020152..893a2ea2f7 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-address.h
+++ b/addressbook/gui/contact-editor/e-contact-editor-address.h
@@ -22,7 +22,7 @@
#include <gtk/gtkdialog.h>
#include <glade/glade.h>
-#include <ebook/e-contact.h>
+#include <libebook/e-contact.h>
G_BEGIN_DECLS
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.h b/addressbook/gui/contact-editor/e-contact-editor-fullname.h
index 408fcffdc3..0b254c789c 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.h
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.h
@@ -22,7 +22,7 @@
#include <gtk/gtkdialog.h>
#include <glade/glade.h>
-#include <ebook/e-contact.h>
+#include <libebook/e-contact.h>
G_BEGIN_DECLS
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index efee496539..27baa9f0fc 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -25,8 +25,8 @@
#include <bonobo/bonobo-ui-component.h>
#include <glade/glade.h>
-#include "addressbook/backend/ebook/e-book-async.h"
-#include "addressbook/backend/ebook/e-contact.h"
+#include <libebook/e-book-async.h>
+#include <libebook/e-contact.h>
G_BEGIN_DECLS
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 65b321c997..0f59c1145f 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -35,10 +35,10 @@
#include <gtk/gtkstock.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-app.h>
+#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
#include <addressbook/gui/component/addressbook.h>
-#include <addressbook/backend/ebook/e-book.h>
#include <addressbook/util/eab-book-util.h>
-#include <addressbook/backend/ebook/e-contact.h>
#include "e-contact-editor.h"
#include "e-contact-quick-add.h"
#include "eab-contact-merging.h"
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.h b/addressbook/gui/contact-editor/e-contact-quick-add.h
index ad98c73c23..a969211915 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.h
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.h
@@ -27,7 +27,7 @@
#ifndef __E_CONTACT_QUICK_ADD_H__
#define __E_CONTACT_QUICK_ADD_H__
-#include <addressbook/backend/ebook/e-contact.h>
+#include <libebook/e-contact.h>
typedef void (*EContactQuickAddCallback) (EContact *new_contact, gpointer closure);
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
index 62334c17bf..52e78a6a23 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
@@ -26,8 +26,8 @@
#include <glade/glade.h>
#include <gal/e-table/e-table-model.h>
-#include "addressbook/backend/ebook/e-book-async.h"
-#include "addressbook/backend/ebook/e-contact.h"
+#include <libebook/e-book-async.h>
+#include <libebook/e-contact.h>
G_BEGIN_DECLS
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.h b/addressbook/gui/contact-list-editor/e-contact-list-model.h
index 92d3d9bc60..504f31b9d8 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.h
+++ b/addressbook/gui/contact-list-editor/e-contact-list-model.h
@@ -4,8 +4,8 @@
#include <gtk/gtk.h>
#include <gal/e-table/e-table-model.h>
-#include "addressbook/backend/ebook/e-book-async.h"
-#include "addressbook/backend/ebook/e-contact.h"
+#include <libebook/e-book-async.h>
+#include <libebook/e-contact.h>
#include "addressbook/util/eab-destination.h"
G_BEGIN_DECLS
diff --git a/addressbook/gui/merging/eab-contact-compare.h b/addressbook/gui/merging/eab-contact-compare.h
index 07a9cd7e35..4b97b3c698 100644
--- a/addressbook/gui/merging/eab-contact-compare.h
+++ b/addressbook/gui/merging/eab-contact-compare.h
@@ -28,8 +28,8 @@
#ifndef __EAB_CONTACT_COMPARE_H__
#define __EAB_CONTACT_COMPARE_H__
-#include "ebook/e-book.h"
-#include "ebook/e-contact.h"
+#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
typedef enum {
EAB_CONTACT_MATCH_NOT_APPLICABLE = 0,
diff --git a/addressbook/gui/merging/eab-contact-merging.h b/addressbook/gui/merging/eab-contact-merging.h
index 6011263f31..d6d60e57de 100644
--- a/addressbook/gui/merging/eab-contact-merging.h
+++ b/addressbook/gui/merging/eab-contact-merging.h
@@ -12,7 +12,7 @@
#ifndef __E_CONTACT_MERGING_H__
#define __E_CONTACT_MERGING_H__
-#include <addressbook/backend/ebook/e-book-async.h>
+#include <libebook/e-book-async.h>
G_BEGIN_DECLS
diff --git a/addressbook/gui/search/e-addressbook-search-dialog.h b/addressbook/gui/search/e-addressbook-search-dialog.h
index ef501766ea..8634074f69 100644
--- a/addressbook/gui/search/e-addressbook-search-dialog.h
+++ b/addressbook/gui/search/e-addressbook-search-dialog.h
@@ -21,7 +21,7 @@
#ifndef __EAB_SEARCH_DIALOG_H__
#define __EAB_SEARCH_DIALOG_H__
-#include <ebook/e-book.h>
+#include <libebook/e-book.h>
#include "addressbook/gui/widgets/e-addressbook-view.h"
#include "filter/rule-context.h"
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index 35f9d0e87f..64ce6c3845 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -4,8 +4,8 @@
#include <glib.h>
#include <glib-object.h>
-#include "addressbook/backend/ebook/e-book-async.h"
-#include "addressbook/backend/ebook/e-book-view.h"
+#include <libebook/e-book-async.h>
+#include <libebook/e-book-view.h>
#define EAB_TYPE_MODEL (eab_model_get_type ())
#define EAB_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_MODEL, EABModel))
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
index 9ba7d2cf2d..1321b27bb4 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
@@ -3,8 +3,8 @@
#define _E_ADDRESSBOOK_REFLOW_ADAPTER_H_
#include <gal/widgets/e-reflow-model.h>
+#include <libebook/e-contact.h>
#include "e-addressbook-model.h"
-#include "addressbook/backend/ebook/e-contact.h"
#define E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER (e_addressbook_reflow_adapter_get_type ())
#define E_ADDRESSBOOK_REFLOW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, EAddressbookReflowAdapter))
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.h b/addressbook/gui/widgets/e-addressbook-table-adapter.h
index 6f4bfd2960..cf139e2bee 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.h
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.h
@@ -3,8 +3,8 @@
#define _EAB_TABLE_ADAPTER_H_
#include <gal/e-table/e-table-model.h>
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-book-view.h"
+#include <libebook/e-book.h>
+#include <libebook/e-book-view.h>
#define E_TYPE_AB_TABLE_ADAPTER (eab_table_adapter_get_type ())
#define EAB_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_AB_TABLE_ADAPTER, EAddressbookTableAdapter))
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 1573f682ed..f819704550 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -23,10 +23,10 @@
#include <gtk/gtkeventbox.h>
#include <bonobo/bonobo-ui-component.h>
#include <gal/menus/gal-view-instance.h>
+#include <libebook/e-book.h>
#include "e-addressbook-model.h"
#include "eab-contact-display.h"
#include "widgets/menus/gal-view-menus.h"
-#include "addressbook/backend/ebook/e-book.h"
G_BEGIN_DECLS
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h
index 4e2da4cedf..ef8401b88c 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.h
+++ b/addressbook/gui/widgets/e-minicard-view-widget.h
@@ -21,7 +21,7 @@
#define __E_MINICARD_VIEW_WIDGET_H__
#include <gal/widgets/e-canvas.h>
-#include "addressbook/backend/ebook/e-book.h"
+#include <libebook/e-book.h>
#include "e-minicard-view.h"
G_BEGIN_DECLS
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
index afd432fd8e..2614b7577a 100644
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ b/addressbook/gui/widgets/e-minicard-view.h
@@ -24,7 +24,7 @@
#include <gal/widgets/e-reflow.h>
#include <gal/widgets/e-selection-model-simple.h>
-#include "addressbook/backend/ebook/e-book.h"
+#include <libebook/e-book.h>
#include "e-addressbook-reflow-adapter.h"
G_BEGIN_DECLS
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index f9aa893dc3..85060ce156 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -32,7 +32,7 @@
#include <gal/util/e-util.h>
#include <gal/widgets/e-canvas-utils.h>
#include <gal/widgets/e-canvas.h>
-#include "addressbook/backend/ebook/e-book.h"
+#include <libebook/e-book.h>
#include "eab-marshal.h"
#include "eab-gui-util.h"
#include "e-minicard.h"
diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h
index e4673fe4d9..2d0cfd8ed5 100644
--- a/addressbook/gui/widgets/e-minicard.h
+++ b/addressbook/gui/widgets/e-minicard.h
@@ -23,7 +23,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "addressbook/gui/contact-editor/e-contact-editor.h"
#include <libgnomecanvas/gnome-canvas.h>
-#include "addressbook/backend/ebook/e-contact.h"
+#include <libebook/e-contact.h>
#ifdef __cplusplus
extern "C" {
diff --git a/addressbook/gui/widgets/eab-contact-display.h b/addressbook/gui/widgets/eab-contact-display.h
index 83bad9ae64..e7f47031ce 100644
--- a/addressbook/gui/widgets/eab-contact-display.h
+++ b/addressbook/gui/widgets/eab-contact-display.h
@@ -25,7 +25,7 @@
#include <gtk/gtkvbox.h>
#include <gtkhtml/gtkhtml.h>
-#include <ebook/e-contact.h>
+#include <libebook/e-contact.h>
#define EAB_TYPE_CONTACT_DISPLAY (eab_contact_display_get_type ())
#define EAB_CONTACT_DISPLAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplay))
diff --git a/addressbook/gui/widgets/eab-gui-util.h b/addressbook/gui/widgets/eab-gui-util.h
index 71a80bc7a6..24a0a78577 100644
--- a/addressbook/gui/widgets/eab-gui-util.h
+++ b/addressbook/gui/widgets/eab-gui-util.h
@@ -21,7 +21,7 @@
#define __E_ADDRESSBOOK_UTIL_H__
#include <gtk/gtkwindow.h>
-#include "addressbook/backend/ebook/e-book.h"
+#include <libebook/e-book.h>
#include "addressbook/gui/contact-editor/e-contact-editor.h"
#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
diff --git a/addressbook/gui/widgets/eab-popup-control.c b/addressbook/gui/widgets/eab-popup-control.c
index e2d0299d6e..6e2ad6a603 100644
--- a/addressbook/gui/widgets/eab-popup-control.c
+++ b/addressbook/gui/widgets/eab-popup-control.c
@@ -37,7 +37,7 @@
#include <bonobo/bonobo-property-bag.h>
#include <bonobo/bonobo-generic-factory.h>
#include <gal/widgets/e-popup-menu.h>
-#include <addressbook/backend/ebook/e-book-async.h>
+#include <libebook/e-book-async.h>
#include <addressbook/util/eab-book-util.h>
#include <addressbook/gui/contact-editor/e-contact-editor.h>
#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
diff --git a/addressbook/gui/widgets/eab-popup-control.h b/addressbook/gui/widgets/eab-popup-control.h
index 4d223f02cb..2feb3ac7d0 100644
--- a/addressbook/gui/widgets/eab-popup-control.h
+++ b/addressbook/gui/widgets/eab-popup-control.h
@@ -28,10 +28,10 @@
#ifndef __EAB_POPUP_CONTROL_H__
#define __EAB_POPUP_CONTROL_H__
-#include <gtk/gtk.h>
-#include <addressbook/backend/ebook/e-book-async.h>
-#include <addressbook/backend/ebook/e-contact.h>
#include <bonobo/bonobo-event-source.h>
+#include <gtk/gtk.h>
+#include <libebook/e-book-async.h>
+#include <libebook/e-contact.h>
G_BEGIN_DECLS
diff --git a/addressbook/gui/widgets/eab-vcard-control.c b/addressbook/gui/widgets/eab-vcard-control.c
index 82c5fd6032..8e4235d78e 100644
--- a/addressbook/gui/widgets/eab-vcard-control.c
+++ b/addressbook/gui/widgets/eab-vcard-control.c
@@ -33,10 +33,10 @@
#include <bonobo/bonobo-stream-client.h>
#include <gal/util/e-util.h>
+#include <libebook/e-book-async.h>
+#include <libebook/e-contact.h>
#include <addressbook/gui/component/addressbook.h>
#include <addressbook/gui/widgets/eab-contact-display.h>
-#include <addressbook/backend/ebook/e-book-async.h>
-#include <addressbook/backend/ebook/e-contact.h>
#include <addressbook/util/eab-book-util.h>
#include "eab-vcard-control.h"
diff --git a/addressbook/printing/Makefile.am b/addressbook/printing/Makefile.am
index f9e9661890..8da93df0b8 100644
--- a/addressbook/printing/Makefile.am
+++ b/addressbook/printing/Makefile.am
@@ -40,7 +40,6 @@ contact_print_test_SOURCES = \
contact_print_test_LDADD = \
libecontactprint.la \
$(top_builddir)/addressbook/util/libeabutil.la \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
$(EVOLUTION_ADDRESSBOOK_LIBS)
contact_print_style_editor_test_SOURCES = \
@@ -49,7 +48,6 @@ contact_print_style_editor_test_SOURCES = \
contact_print_style_editor_test_LDADD = \
libecontactprint.la \
$(top_builddir)/addressbook/util/libeabutil.la \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
$(EVOLUTION_ADDRESSBOOK_LIBS)
diff --git a/addressbook/printing/e-contact-print-envelope.h b/addressbook/printing/e-contact-print-envelope.h
index d9e24b1794..a7a8492638 100644
--- a/addressbook/printing/e-contact-print-envelope.h
+++ b/addressbook/printing/e-contact-print-envelope.h
@@ -22,8 +22,8 @@
#ifndef E_CONTACT_PRINT_ENVELOPE_H
#define E_CONTACT_PRINT_ENVELOPE_H
-#include <addressbook/backend/ebook/e-contact.h>
#include <gtk/gtkwidget.h>
+#include <libebook/e-contact.h>
#include "e-contact-print-types.h"
GtkWidget *e_contact_print_envelope_dialog_new(EContact *contact);
diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c
index 0aa2e67900..1a9b83c62d 100644
--- a/addressbook/printing/e-contact-print.c
+++ b/addressbook/printing/e-contact-print.c
@@ -38,8 +38,8 @@
#include <libgnomeprint/gnome-print-job.h>
#include <libgnomeprintui/gnome-print-dialog.h>
#include <libgnomeprintui/gnome-print-job-preview.h>
-#include <addressbook/backend/ebook/e-book-async.h>
-#include <addressbook/backend/ebook/e-contact.h>
+#include <libebook/e-book-async.h>
+#include <libebook/e-contact.h>
#include <addressbook/util/eab-destination.h>
#define SCALE 5
diff --git a/addressbook/printing/e-contact-print.h b/addressbook/printing/e-contact-print.h
index 8c2fbb6acb..4edc948082 100644
--- a/addressbook/printing/e-contact-print.h
+++ b/addressbook/printing/e-contact-print.h
@@ -24,8 +24,8 @@
#include <glib.h>
#include <gtk/gtkwidget.h>
-#include <addressbook/backend/ebook/e-book.h>
-#include <addressbook/backend/ebook/e-contact.h>
+#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
#include "e-contact-print-types.h"
GtkWidget *e_contact_print_dialog_new(EBook *book, char *query);
diff --git a/addressbook/util/Makefile.am b/addressbook/util/Makefile.am
index 51b6e7fc28..56aadd1153 100644
--- a/addressbook/util/Makefile.am
+++ b/addressbook/util/Makefile.am
@@ -19,16 +19,14 @@ INCLUDES = \
noinst_LTLIBRARIES = libeabutil.la
libeabutil_la_SOURCES = \
- eab-marshal.c \
+ eab-marshal.c  \
eab-destination.c \
eab-destination.h \
eab-book-util.c \
eab-book-util.h
-libeabutil_la_LIBADD = \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/ename/libename.la \
+libeabutil_la_LIBADD = \
+ $(top_builddir)/camel/libcamel.la \
$(top_builddir)/e-util/libeutil.la
MARSHAL_GENERATED = eab-marshal.c eab-marshal.h
diff --git a/addressbook/util/eab-book-util.h b/addressbook/util/eab-book-util.h
index be5451b795..7fda98adf3 100644
--- a/addressbook/util/eab-book-util.h
+++ b/addressbook/util/eab-book-util.h
@@ -28,10 +28,10 @@
#ifndef __EAB_UTIL_H__
#define __EAB_UTIL_H__
-#include "ebook/e-book-async.h"
-#include "e-util/e-config-listener.h"
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-moniker-util.h>
+#include <libebook/e-book-async.h>
+#include "e-util/e-config-listener.h"
G_BEGIN_DECLS
diff --git a/addressbook/util/eab-destination.c b/addressbook/util/eab-destination.c
index d83ad8563a..07557b1455 100644
--- a/addressbook/util/eab-destination.c
+++ b/addressbook/util/eab-destination.c
@@ -31,7 +31,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
-#include "ebook/e-book.h"
+#include <libebook/e-book.h>
#include "eab-marshal.h"
#include "eab-book-util.h"
#include <gal/widgets/e-unicode.h>
diff --git a/addressbook/util/eab-destination.h b/addressbook/util/eab-destination.h
index 452d893e44..2c8e2abc11 100644
--- a/addressbook/util/eab-destination.h
+++ b/addressbook/util/eab-destination.h
@@ -30,8 +30,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <ebook/e-contact.h>
-#include <ebook/e-book.h>
+#include <libebook/e-contact.h>
+#include <libebook/e-book.h>
#include <libxml/tree.h>
#define EAB_TYPE_DESTINATION (eab_destination_get_type ())