Re: [evolution-patches] patch for adding GW camel provider



On Wed, 2003-12-24 at 17:30 +0100, Rodrigo Moya wrote:
> Hi
> 
> Based on Sivaiah's patch sent last week, here's a patch for adding the
> Groupwise provider to Camel. It doesn't work for me, since Groupwise
> doesn't show up in the account types, but since I am leaving for
> vacation today (I'll still check mail tomorrow) and will be back (2nd
> January) after Sivaiah's (28th December) come back, I've:
> 
> * committed the camel/providers/groupwise files. The rest hasn't been
> committed, to not include the provider yet in the build, until it works.
> 
> * debugged the loading of the provider, which needs the imap and smtp
> providers loaded first in order to avoid undefined references. I tried
> using g_module_open on those providers to have them loaded, but I'm
> still getting the same problem.
> 
> * not committed the groupwise-listener class Sivaiah wrote, so that
> needs to be committed and fixed.
> 
> have a nice holiday and see you next year




Is the provider just using the imap provider and the smtp transport
for implementation, what is the groupwise bit for?  Why not just setup
an imap account with a matcihng smtp server?

I don't get it.

Anyway you shouldn't use the imap and smtp symbols directly, just open
the imap and smtp CamelProvider[s], and then peek in there for various
info.  Otherwise you wont pick up changes to config etc.

I'm kind of sketchy on whether this approach will even work though.


> ? camel-cms-context.c
> ? camel-cms-context.h
> ? providers/groupwise/Makefile
> ? providers/groupwise/Makefile.in
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
> retrieving revision 1.1944
> diff -u -p -r1.1944 ChangeLog
> --- ChangeLog	11 Dec 2003 17:30:29 -0000	1.1944
> +++ ChangeLog	24 Dec 2003 16:19:26 -0000
> @@ -1,3 +1,24 @@
> +2003-12-24  Rodrigo Moya <rodrigo ximian com>
> +
> +	* providers/groupwise/camel-groupwise-provider.c
> +	(camel_provider_module_init): g_module_open the other providers we
> +	depend on to avoid load ordering problems.
> +
> +2003-12-22  Rodrigo Moya <rodrigo ximian com>
> +
> +	* providers/groupwise/camel-groupwise-provider.c: removed useless
> +	configuration options, and added other options from the IMAP
> +	provider.
> +	(camel_provider_module_init): register a SMTP transport object also,
and
> +	removed SASL registration, since we don't support it.
> +
> +2003-12-19  Sivaiah Nallagatla <snallagatla novell com>
> +
> +	* providers/groupwise/Makefile.am:
> +	* providers/groupwise/libcamelgroupwise.urls:
> +	* providers/groupwise/camel-groupwise-provider.c: added Camel
> +	provider for Groupwise accounts, based on the IMAP one.
> +
>  2003-12-11  Jeffrey Stedfast  <fejj ximian com>
>  
>  	* camel-gpg-context.c (gpg_ctx_parse_status): Don't immediately
> Index: providers/Makefile.am
> ===================================================================
> RCS file: /cvs/gnome/evolution/camel/providers/Makefile.am,v
> retrieving revision 1.27
> diff -u -p -r1.27 Makefile.am
> --- providers/Makefile.am	1 Aug 2003 21:08:03 -0000	1.27
> +++ providers/Makefile.am	24 Dec 2003 16:19:26 -0000
> @@ -8,5 +8,5 @@ if ENABLE_IMAPP
>  IMAPP_DIR=imapp
>  endif
>  
> -SUBDIRS = pop3 sendmail smtp imap $(NNTP_DIR) local $(IMAPP_DIR)
> +SUBDIRS = pop3 sendmail smtp imap $(NNTP_DIR) local $(IMAPP_DIR)
groupwise
>  
> Index: providers/groupwise/Makefile.am
> ===================================================================
> RCS file: providers/groupwise/Makefile.am
> diff -N providers/groupwise/Makefile.am
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ providers/groupwise/Makefile.am	24 Dec 2003 16:19:26 -0000
> @@ -0,0 +1,32 @@
> +## Process this file with automake to produce Makefile.in
> +
> +libcamelimapincludedir = $(privincludedir)/camel
> +
> +camel_provider_LTLIBRARIES = libcamelgroupwise.la
> +camel_provider_DATA = libcamelgroupwise.urls
> +
> +INCLUDES = -I.. \
> +	-I$(srcdir)/..					\
> +	-I$(top_srcdir)/camel				\
> +	-I$(top_srcdir)/intl				\
> +	-I$(top_srcdir)/e-util				\
> +	-I$(top_srcdir)					\
> +	-I$(top_srcdir)/camel/providers/imap		\
> +	-I$(top_srcdir)/camel/providers/smtp		\
> +	$(CAMEL_CFLAGS)					\
> +	$(GNOME_INCLUDEDIR)				\
> +	$(GTK_INCLUDEDIR)				\
> +	-DCAMEL_PROVIDERDIR=\"$(camel_providerdir)\"	\
> +	-DG_LOG_DOMAIN=\"camel-groupwise-provider\"
> +
> +libcamelgroupwise_la_SOURCES = 			\
> +	camel-groupwise-provider.c			
> +
> +libcamelgroupwise_la_LDFLAGS = -avoid-version -module
> +
> +# libcamelgroupwise_la_LIBADD =
> +#	$(top_builddir)/camel/providers/imap/libcamelimap.la	\
> +#	$(top_builddir)/camel/providers/smtp/libcamelsmtp.la
> +
> +
> +EXTRA_DIST = libcamelimap.urls
> Index: providers/groupwise/camel-groupwise-provider.c
> ===================================================================
> RCS file: providers/groupwise/camel-groupwise-provider.c
> diff -N providers/groupwise/camel-groupwise-provider.c
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ providers/groupwise/camel-groupwise-provider.c	24 Dec 2003
16:19:26 -0000
> @@ -0,0 +1,172 @@
> +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8
-*- */
> +/* camel-groupwise-provider.c: Groupwise provider registration code
*/
> +
> +/*
> + *  Authors: Jeffrey Stedfast <fejj ximian com>
> + *           Sivaiah Nallagatla <snallagatla novell com>
> + *           Rodrigo Moya <rodrigo ximian com>
> + *
> + *  Copyright 2003 Novell, Inc. (www.novell.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.
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> +#include <string.h>
> +#include <gmodule.h>
> +#include "camel-imap-store.h"
> +#include "camel-provider.h"
> +#include "camel-session.h"
> +#include "camel-smtp-transport.h"
> +#include "camel-url.h"
> +#include "camel-sasl.h"
> +
> +static void add_hash (guint *hash, char *s);
> +static guint imap_url_hash (gconstpointer key);
> +static gint check_equal (char *s1, char *s2);
> +static gint imap_url_equal (gconstpointer a, gconstpointer b);

Should really rename these from imap_*.


> +CamelProviderConfEntry groupwise_conf_entries[] = {
> +	/* override the labels/defaults of the standard settings */
> +
> +	{ CAMEL_PROVIDER_CONF_SECTION_START, "mailcheck", NULL,
> +	  N_("Checking for new mail") },
> +	{ CAMEL_PROVIDER_CONF_CHECKBOX, "check_all", NULL,
> +	  N_("Check for new messages in all folders"), "1" },
> +	{ CAMEL_PROVIDER_CONF_SECTION_END },
> +
> +	/* extra Groupwise  configuration settings */
> +	{ CAMEL_PROVIDER_CONF_SECTION_START, "ldapserver", NULL,
> +	  N_("Address Book") },
> +
> +	{ CAMEL_PROVIDER_CONF_ENTRY, "ldap_server", NULL,
> +	  N_("LDAP Server Name:") },
> +
> +	{ CAMEL_PROVIDER_CONF_CHECKSPIN, "ldap_download_limit", NULL,
> +	  N_("LDAP Download limit: %s"), "y:1:500:10000" },
> +
> +	{ CAMEL_PROVIDER_CONF_SECTION_END },
> +
> +	{ CAMEL_PROVIDER_CONF_CHECKBOX, "filter", NULL,
> +	  N_("Apply filters to new messages in Inbox on this server"),
"0" },
> +
> +	{ CAMEL_PROVIDER_CONF_CHECKBOX, "offline_sync", NULL,
> +	  N_("Automatically synchronize remote mail locally"), "0" },
> +
> +	{ CAMEL_PROVIDER_CONF_END }
> +};
> +
> +
> +static CamelProvider groupwise_provider = {
> +	"groupwise",
> +	N_("Novell GroupWise"),
> +
> +	N_("For accesing Novell Groupwise servers"),
> +
> +	"mail",
> +
> +	CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
> +	CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_SUPPORTS_SSL,
> +
> +	CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH,
> +
> +	groupwise_conf_entries,
> +
> +	/* ... */
> +};
> +
> +CamelServiceAuthType camel_groupwise_password_authtype = {
> +	N_("Password"),
> +	
> +	N_("This option will connect to the IMAP server using a "
> +	   "plaintext password."),
> +	
> +	"",
> +	TRUE
> +};
> +
> +void
> +camel_provider_module_init (CamelSession *session)
> +{
> +	GModule *module;
> +
> +	/* make sure the IMAP and SMTP providers are loaded */
> +	module = g_module_open (CAMEL_PROVIDERDIR "/libcamelimap.so",
G_MODULE_BIND_LAZY);
> +	g_module_make_resident (module);
> +
> +	module = g_module_open (CAMEL_PROVIDERDIR "/libcamelsmtp.so",
G_MODULE_BIND_LAZY);
> +	g_module_make_resident (module);
> +
> +	groupwise_provider.object_types[CAMEL_PROVIDER_STORE] =
camel_imap_store_get_type ();
> +	groupwise_provider.object_types[CAMEL_PROVIDER_TRANSPORT] =
camel_smtp_transport_get_type ();
> +	groupwise_provider.url_hash = imap_url_hash;
> +	groupwise_provider.url_equal = imap_url_equal;
> +	groupwise_provider.authtypes = g_list_prepend (groupwise_provider.
authtypes,
> +						  &camel_groupwise_password_authtype);
> +
> +	camel_session_register_provider (session, &groupwise_provider);
> +}
> +
> +static void
> +add_hash (guint *hash, char *s)
> +{
> +	if (s)
> +		*hash ^= g_str_hash(s);
> +}
> +
> +static guint
> +imap_url_hash (gconstpointer key)
> +{
> +	const CamelURL *u = (CamelURL *)key;
> +	guint hash = 0;
> +
> +	add_hash (&hash, u->user);
> +	add_hash (&hash, u->authmech);
> +	add_hash (&hash, u->host);
> +	hash ^= u->port;
> +	
> +	return hash;
> +}
> +
> +static gint
> +check_equal (char *s1, char *s2)
> +{
> +	if (s1 == NULL) {
> +		if (s2 == NULL)
> +			return TRUE;
> +		else
> +			return FALSE;
> +	}
> +	
> +	if (s2 == NULL)
> +		return FALSE;
> +
> +	return strcmp (s1, s2) == 0;
> +}
> +
> +static gint
> +imap_url_equal (gconstpointer a, gconstpointer b)
> +{
> +	const CamelURL *u1 = a, *u2 = b;
> +	
> +	return check_equal (u1->user, u2->user)
> +		&& check_equal (u1->authmech, u2->authmech)
> +		&& check_equal (u1->host, u2->host)
> +		&& u1->port == u2->port;
> +}
> Index: providers/groupwise/libcamelgroupwise.urls
> ===================================================================
> RCS file: providers/groupwise/libcamelgroupwise.urls
> diff -N providers/groupwise/libcamelgroupwise.urls
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ providers/groupwise/libcamelgroupwise.urls	24 Dec 2003 16:19:26 -
0000
> @@ -0,0 +1 @@
> +groupwise
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]