diff options
author | Srinivasa Ragavan <sragavan@gnome.org> | 2011-10-03 15:47:30 +0530 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@gnome.org> | 2012-01-17 19:10:58 +0530 |
commit | d35ac6e63e1e1898d2ce12f445045f418442ee6c (patch) | |
tree | 501fb13c20c4f399c5b97cdee1dba8a00e7c86dc | |
parent | 5c52fe678f6d03b50625c385e968650df0e0c068 (diff) | |
download | evolution-data-server-d35ac6e63e1e1898d2ce12f445045f418442ee6c.tar.gz |
Initial commit for basic folder hierarchy for Evolution Mail Daemon in
GNOME 3.3
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | mail/Makefile.am | 7 | ||||
-rw-r--r-- | mail/daemon/Makefile.am | 61 | ||||
-rw-r--r-- | mail/daemon/org.gnome.evolution.dataserver.Mail.service.in | 3 | ||||
-rw-r--r-- | mail/libegdbus/Makefile.am | 20 | ||||
-rw-r--r-- | mail/libemailengine/Makefile.am | 40 | ||||
-rw-r--r-- | mail/libemailengine/libemail-engine.pc.in | 15 | ||||
-rw-r--r-- | mail/libemailutils/Makefile.am | 46 | ||||
-rw-r--r-- | mail/libemailutils/e-account-utils.c | 252 | ||||
-rw-r--r-- | mail/libemailutils/e-account-utils.h | 37 | ||||
-rw-r--r-- | mail/libemailutils/e-marshal.list | 60 | ||||
-rw-r--r-- | mail/libemailutils/libemail-utils.pc.in | 15 |
12 files changed, 567 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index d0b4e0025..939d50761 100644 --- a/configure.ac +++ b/configure.ac @@ -1286,6 +1286,10 @@ AC_SUBST(E_BACKEND_CFLAGS) AC_SUBST(E_BACKEND_LIBS) dnl ****************************** +dnl Email daemon +dnl ****************************** + +dnl ****************************** dnl evolution-addressbook flags dnl ****************************** EVOLUTION_ADDRESSBOOK_DEPS="gio-2.0 libxml-2.0 gconf-2.0" @@ -1571,6 +1575,13 @@ libedataserver/eds-version.h libedataserver/libedataserver.pc libedataserverui/Makefile libedataserverui/libedataserverui.pc +mail/Makefile +mail/libegdbus/Makefile +mail/libemailengine/Makefile +mail/libemailengine/libemail-engine.pc +mail/libemailutils/Makefile +mail/libemailutils/libemail-utils.pc +mail/daemon/Makefile services/Makefile services/evolution-addressbook-factory/Makefile services/evolution-calendar-factory/Makefile diff --git a/mail/Makefile.am b/mail/Makefile.am new file mode 100644 index 000000000..4125c8e46 --- /dev/null +++ b/mail/Makefile.am @@ -0,0 +1,7 @@ +SUBDIRS = libemailutils libemailengine libegdbus daemon + +DISTCHECK_CONFIGURE_FLAGS= + +CLEANFILES = *~ + + diff --git a/mail/daemon/Makefile.am b/mail/daemon/Makefile.am new file mode 100644 index 000000000..4f5f6e802 --- /dev/null +++ b/mail/daemon/Makefile.am @@ -0,0 +1,61 @@ +factorydir = $(libexecdir) + +factory_PROGRAMS = evolution-mail-factory +evolution_mail_factory_SOURCES = + +noinst_PROGRAMS = test-email-client + +test_email_client_SOURCES = test-email-client.c +test_email_client_CPPFLAGS = \ + $(GNOME_PLATFORM_CFLAGS) \ + $(CAMEL_CFLAGS) \ + -Wall -g3 -O0 -ggdb -DPKGDATADIR="\"$(pkgdatadir)\"" \ + -I$(top_srcdir)/mail/ \ + -I$(top_srcdir)/mail/libemailutils \ + -I$(top_srcdir)/mail/libegdbus \ + -I$(top_srcdir) \ + -I$(top_builddir) + +test_email_client_LDADD = \ + $(top_builddir)/mail/libemailutils/libemail-engine.la \ + $(top_builddir)/mail/libemailutils/libemail-utils.la \ + $(top_builddir)/mail/libegdbus/libegdbus-mail.la \ + $(top_builddir)/camel/libcamel-1.2.la \ + $(top_builddir)/camel/libcamel-provider-1.2.la \ + $(top_builddir)/libedataserver/libedataserver-1.2.la \ + $(top_builddir)/libedataserverui/libedataserverui-1.2.la \ + $(GNOME_PLATFORM_LIBS) \ + $(CAMEL_LIBS) + + +evolution_mail_factory_CPPFLAGS = \ + $(CAMEL_CFLAGS) \ + $(GNOME_PLATFORM_CFLAGS) \ + -Wall -g3 -O0 -ggdb -DPKGDATADIR="\"$(pkgdatadir)\"" \ + -I$(top_srcdir)/mail/ \ + -I$(top_srcdir)/mail/libemailutils \ + -I$(top_srcdir)/mail/libegdbus \ + -I$(top_srcdir) \ + -I$(top_builddir) + +evolution_mail_factory_LDADD = \ + $(CAMEL_LIBS) \ + $(GNOME_PLATFORM_LIBS) \ + $(top_builddir)/camel/libcamel-1.2.la \ + $(top_builddir)/camel/libcamel-provider-1.2.la \ + $(top_builddir)/libedataserver/libedataserver-1.2.la \ + $(top_builddir)/libedataserverui/libedataserverui-1.2.la \ + $(top_builddir)/mail/libemailutils/libemail-utils.la \ + $(top_builddir)/mail/libegdbus/libegdbus-mail.la + +service_in_files = org.gnome.evolution.dataserver.Mail.service.in +servicedir = $(datadir)/dbus-1/services +service_DATA = $(service_in_files:.service.in=.service) +@EVO_SUBST_SERVICE_RULE@ + + +EXTRA_DIST = $(service_in_files) + + +CLEANFILES = *~ $(service_DATA) + diff --git a/mail/daemon/org.gnome.evolution.dataserver.Mail.service.in b/mail/daemon/org.gnome.evolution.dataserver.Mail.service.in new file mode 100644 index 000000000..7fb977d22 --- /dev/null +++ b/mail/daemon/org.gnome.evolution.dataserver.Mail.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.gnome.evolution.dataserver.Mail +Exec=@LIBEXECDIR@/evolution-mail-factory@EXEEXT@ diff --git a/mail/libegdbus/Makefile.am b/mail/libegdbus/Makefile.am new file mode 100644 index 000000000..9f6d03005 --- /dev/null +++ b/mail/libegdbus/Makefile.am @@ -0,0 +1,20 @@ +# The library +noinst_LTLIBRARIES = libegdbus-mail.la + +libegdbus_mail_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(CAMEL_CFLAGS) \ + -DG_LOG_DOMAIN=\"libegdbus-mail\" + +libegdbus_mail_la_SOURCES = + +libegdbus_mail_la_LIBADD = \ + $(top_builddir)/camel/libcamel-1.2.la \ + $(top_builddir)/camel/libcamel-provider-1.2.la \ + $(top_builddir)/libedataserver/libedataserver-1.2.la + + +libegdbus_mail_la_LDFLAGS = $(NO_UNDEFINED) + + +-include $(top_srcdir)/git.mk diff --git a/mail/libemailengine/Makefile.am b/mail/libemailengine/Makefile.am new file mode 100644 index 000000000..456ab16bf --- /dev/null +++ b/mail/libemailengine/Makefile.am @@ -0,0 +1,40 @@ + +lib_LTLIBRARIES = libemail-engine.la + +AM_CFLAGS = @GNOME_PLATFORM_CFLAGS@ -Wall -Werror -g3 -O0 -ggdb -DPKGDATADIR="\"$(pkgdatadir)\"" +AM_LDFLAGS = @GNOME_PLATFORM_LIBS@ + + +libemail_engine_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(CAMEL_CFLAGS) \ + $(GNOME_PLATFORM_CFLAGS) + +libemail_engine_la_LIBADD = \ + $(CAMEL_LIBS) \ + $(GNOME_PLATFORM_LIBS) \ + $(top_builddir)/camel/libcamel-1.2.la \ + $(top_builddir)/camel/libcamel-provider-1.2.la \ + $(top_builddir)/libedataserver/libedataserver-1.2.la \ + $(top_builddir)/mail/libemailutils/libemail-utils.la + + +libemail_engine_la_LDFLAGS = + +libemail_engine_la_SOURCES = + +libmailengineincludedir = $(includedir)/libemail-engine +libmailengineinclude_HEADERS = + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libemail-engine.pc + +BUILT_SOURCES = + +EXTRA_DIST = +CLEANFILES = $(BUILT_SOURCES) +DISTCLEANFILES = $(pkgconfig_DATA) + +dist-hook: + cd $(distdir); rm -f $(BUILT_SOURCES) + diff --git a/mail/libemailengine/libemail-engine.pc.in b/mail/libemailengine/libemail-engine.pc.in new file mode 100644 index 000000000..384147b79 --- /dev/null +++ b/mail/libemailengine/libemail-engine.pc.in @@ -0,0 +1,15 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ + +privincludedir=@privincludedir@ + +Name: libemail-utils +Description: Client library for evolution mail +Version: @VERSION@ +Requires: camel-1.2 libedataserver-1.2 gio-2.0 +Libs: -L${libdir} -lemail-utils +Cflags: -I${privincludedir} diff --git a/mail/libemailutils/Makefile.am b/mail/libemailutils/Makefile.am new file mode 100644 index 000000000..2c53cef59 --- /dev/null +++ b/mail/libemailutils/Makefile.am @@ -0,0 +1,46 @@ + +lib_LTLIBRARIES = libemail-utils.la + +AM_CFLAGS = @GNOME_PLATFORM_CFLAGS@ -Wall -Werror -g3 -O0 -ggdb -DPKGDATADIR="\"$(pkgdatadir)\"" +AM_LDFLAGS = @GNOME_PLATFORM_LIBS@ + + +MARSHAL_GENERATED = e-marshal.c e-marshal.h +@EVO_MARSHAL_RULE@ + +libemail_utils_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(CAMEL_CFLAGS) \ + $(GNOME_PLATFORM_CFLAGS) + +libemail_utils_la_LIBADD = \ + $(CAMEL_LIBS) \ + $(GNOME_PLATFORM_LIBS) \ + $(top_builddir)/camel/libcamel-1.2.la \ + $(top_builddir)/camel/libcamel-provider-1.2.la \ + $(top_builddir)/libedataserver/libedataserver-1.2.la + +libemail_utils_la_LDFLAGS = + +libemail_utils_la_SOURCES = \ + mail-mt.c \ + e-marshal.c \ + e-account-utils.c + +libmailutilsincludedir = $(includedir)/libemail-utils +libmailutilsinclude_HEADERS = \ + e-marshal.h \ + e-account-utils.h + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libemail-utils.pc + +BUILT_SOURCES = $(MARSHAL_GENERATED) + +EXTRA_DIST = e-marshal.list +CLEANFILES = $(BUILT_SOURCES) +DISTCLEANFILES = $(pkgconfig_DATA) + +dist-hook: + cd $(distdir); rm -f $(BUILT_SOURCES) + diff --git a/mail/libemailutils/e-account-utils.c b/mail/libemailutils/e-account-utils.c new file mode 100644 index 000000000..6e64d4574 --- /dev/null +++ b/mail/libemailutils/e-account-utils.c @@ -0,0 +1,252 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + */ + +/** + * SECTION: e-account-utils + * @include: e-util/e-account-utils.h + **/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "e-account-utils.h" + +#include <string.h> +#include <gconf/gconf-client.h> + +static EAccountList *global_account_list; + +static gboolean +account_has_transport_url (EAccount *account) +{ + return (account != NULL) && + (account->enabled) && + (account->transport != NULL) && + (account->transport->url != NULL) && + (account->transport->url[0] != '\0'); +} + +/** + * e_get_account_list: + * + * Returns the global #EAccountList. + * + * Returns: the global #EAccountList + **/ +EAccountList * +e_get_account_list (void) +{ + if (G_UNLIKELY (global_account_list == NULL)) { + GConfClient *client; + + client = gconf_client_get_default (); + global_account_list = e_account_list_new (client); + g_object_unref (client); + } + + g_return_val_if_fail (global_account_list != NULL, NULL); + + return global_account_list; +} + +/** + * e_get_default_account: + * + * Returns the #EAccount marked as the default mail account. + * + * Returns: the default #EAccount + **/ +EAccount * +e_get_default_account (void) +{ + EAccountList *account_list; + const EAccount *account; + + account_list = e_get_account_list (); + account = e_account_list_get_default (account_list); + + /* XXX EAccountList misuses const. */ + return (EAccount *) account; +} + +/** + * e_set_default_account: + * @account: an #EAccount + * + * Marks @account as the default mail account. + **/ +void +e_set_default_account (EAccount *account) +{ + EAccountList *account_list; + + g_return_if_fail (E_IS_ACCOUNT (account)); + + account_list = e_get_account_list (); + e_account_list_set_default (account_list, account); +} + +/** + * e_get_account_by_name: + * @name: a mail account name + * + * Returns the #EAccount with the given name, or %NULL if no such + * account exists. + * + * Returns: an #EAccount having the given account name, or %NULL + **/ +EAccount * +e_get_account_by_name (const gchar *name) +{ + EAccountList *account_list; + const EAccount *account; + e_account_find_t find; + + g_return_val_if_fail (name != NULL, NULL); + + find = E_ACCOUNT_FIND_NAME; + account_list = e_get_account_list (); + account = e_account_list_find (account_list, find, name); + + /* XXX EAccountList misuses const. */ + return (EAccount *) account; +} + +/** + * e_get_account_by_uid: + * @uid: a mail account UID + * + * Returns the #EAccount corresponding to the given unique identity (UID), + * or %NULL if no such account exists. The @uid can refer to an #EAccount + * UID, a #CamelStore UID, or even a #CamelTransport UID. + * + * Returns: the corresponding #EAccount, or %NULL + **/ +EAccount * +e_get_account_by_uid (const gchar *uid) +{ + EAccountList *account_list; + const EAccount *account; + e_account_find_t find; + gchar *account_uid; + + g_return_val_if_fail (uid != NULL, NULL); + + /* EAccounts have the following invariant: + * + * CamelStore UID == EAccount UID + * CamelTransport UID == EAccount UID + "-transport" + * + * Therefore we can detect CamelTransport UIDs and convert them. + */ + if (g_str_has_suffix (uid, "-transport")) + account_uid = g_strndup (uid, strlen (uid) - 10); + else + account_uid = g_strdup (uid); + + find = E_ACCOUNT_FIND_UID; + account_list = e_get_account_list (); + account = e_account_list_find (account_list, find, account_uid); + + g_free (account_uid); + + /* XXX EAccountList misuses const. */ + return (EAccount *) account; +} + +/** + * e_get_any_enabled_account: + * + * Returns the default mail account if it's enabled, otherwise the first + * enabled mail account in the global #EAccountList, or finally %NULL if + * all mail accounts are disabled or none exist. + * + * Returns: an enabled #EAccount, or %NULL if there are none + **/ +EAccount * +e_get_any_enabled_account (void) +{ + EAccount *account; + EAccountList *account_list; + EIterator *iter; + + account = e_get_default_account (); + if (account != NULL && account->enabled) + return account; + + account = NULL; + + account_list = e_get_account_list (); + iter = e_list_get_iterator (E_LIST (account_list)); + + while (e_iterator_is_valid (iter) && account == NULL) { + EAccount *candidate; + + /* XXX EIterator misuses const. */ + candidate = (EAccount *) e_iterator_get (iter); + + if (candidate->enabled) + account = candidate; + else + e_iterator_next (iter); + } + + g_object_unref (iter); + + return account; +} + +/** + * e_get_default_transport: + * + * Returns transport information for the default account if it's enabled and + * has transport information, or else from the first enabled mail account in + * the global #EAccountList that has transport information, or finally %NULL + * if no transport information could be found. + * + * Returns: an #EAccount with transport info, or %NULL + **/ +EAccount * +e_get_default_transport (void) +{ + EAccountList *account_list; + EAccount *account; + EIterator *iterator; + + account = e_get_default_account (); + if (account_has_transport_url (account)) + return account; + + account_list = e_get_account_list (); + iterator = e_list_get_iterator (E_LIST (account_list)); + + while (e_iterator_is_valid (iterator)) { + /* XXX EIterator misuses const. */ + account = (EAccount *) e_iterator_get (iterator); + if (account_has_transport_url (account)) { + g_object_unref (iterator); + return account; + } + e_iterator_next (iterator); + } + + g_object_unref (iterator); + + return NULL; +} + diff --git a/mail/libemailutils/e-account-utils.h b/mail/libemailutils/e-account-utils.h new file mode 100644 index 000000000..d7dbd283f --- /dev/null +++ b/mail/libemailutils/e-account-utils.h @@ -0,0 +1,37 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + */ + +#ifndef E_ACCOUNT_UTILS_H +#define E_ACCOUNT_UTILS_H + +#include <camel/camel.h> +#include <libedataserver/e-account.h> +#include <libedataserver/e-account-list.h> + +G_BEGIN_DECLS + +EAccountList * e_get_account_list (void); +EAccount * e_get_default_account (void); +void e_set_default_account (EAccount *account); +EAccount * e_get_account_by_name (const gchar *name); +EAccount * e_get_account_by_uid (const gchar *uid); +EAccount * e_get_any_enabled_account (void); +EAccount * e_get_default_transport (void); + +G_END_DECLS + +#endif /* E_ACCOUNT_UTILS_H */ diff --git a/mail/libemailutils/e-marshal.list b/mail/libemailutils/e-marshal.list new file mode 100644 index 000000000..c42078b2d --- /dev/null +++ b/mail/libemailutils/e-marshal.list @@ -0,0 +1,60 @@ +BOOLEAN:BOXED +BOOLEAN:BOXED,STRING +BOOLEAN:BOXED,POINTER,POINTER +BOOLEAN:INT,INT,BOXED +BOOLEAN:INT,INT,OBJECT,INT,INT,UINT +BOOLEAN:INT,POINTER,INT,BOXED +BOOLEAN:INT,POINTER,INT,OBJECT,INT,INT,UINT +BOOLEAN:NONE +BOOLEAN:OBJECT +BOOLEAN:OBJECT,DOUBLE,DOUBLE,BOOLEAN +BOOLEAN:POINTER +BOOLEAN:POINTER,BOOLEAN,POINTER +BOOLEAN:POINTER,POINTER +BOOLEAN:POINTER,POINTER,POINTER,POINTER +BOOLEAN:STRING +BOOLEAN:STRING,INT +DOUBLE:OBJECT,DOUBLE,DOUBLE,BOOLEAN +INT:BOXED +INT:INT +INT:INT,INT,BOXED +INT:INT,POINTER,INT,BOXED +INT:OBJECT,BOXED +INT:POINTER +NONE:BOXED,INT +NONE:ENUM,OBJECT,OBJECT +NONE:INT,INT +NONE:INT,INT,BOXED +NONE:INT,INT,OBJECT +NONE:INT,INT,OBJECT,BOXED,UINT,UINT +NONE:INT,INT,OBJECT,INT,INT,BOXED,UINT,UINT +NONE:INT,INT,OBJECT,UINT +NONE:INT,OBJECT +NONE:INT,POINTER +NONE:INT,POINTER,INT,BOXED +NONE:INT,POINTER,INT,OBJECT +NONE:INT,POINTER,INT,OBJECT,BOXED,UINT,UINT +NONE:INT,POINTER,INT,OBJECT,INT,INT,BOXED,UINT,UINT +NONE:INT,POINTER,INT,OBJECT,UINT +NONE:LONG,LONG +NONE:OBJECT,BOOLEAN +NONE:OBJECT,DOUBLE,DOUBLE,BOOLEAN +NONE:OBJECT,OBJECT +NONE:OBJECT,STRING +NONE:OBJECT,STRING,INT +NONE:OBJECT,STRING,INT,STRING,STRING,STRING +NONE:OBJECT,STRING,STRING +NONE:OBJECT,STRING,UINT +NONE:POINTER,INT +NONE:POINTER,INT,INT,INT,INT +NONE:POINTER,INT,OBJECT +NONE:POINTER,OBJECT +NONE:POINTER,POINTER +NONE:POINTER,POINTER,INT +NONE:STRING,DOUBLE +NONE:STRING,INT +NONE:STRING,INT,INT +NONE:STRING,POINTER,POINTER +NONE:STRING,STRING +NONE:UINT,STRING +STRING:NONE diff --git a/mail/libemailutils/libemail-utils.pc.in b/mail/libemailutils/libemail-utils.pc.in new file mode 100644 index 000000000..384147b79 --- /dev/null +++ b/mail/libemailutils/libemail-utils.pc.in @@ -0,0 +1,15 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ + +privincludedir=@privincludedir@ + +Name: libemail-utils +Description: Client library for evolution mail +Version: @VERSION@ +Requires: camel-1.2 libedataserver-1.2 gio-2.0 +Libs: -L${libdir} -lemail-utils +Cflags: -I${privincludedir} |