1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-pop3-provider.c: pop3 provider registration code */
5 * Dan Winship <danw@ximian.com>
6 * Michael Zucchi <notzed@ximian.com>
8 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU Lesser General Public
12 * License as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
30 #include <camel/camel.h>
31 #include <glib/gi18n-lib.h>
33 static guint imapx_url_hash (gconstpointer key);
34 static gint imapx_url_equal (gconstpointer a, gconstpointer b);
36 CamelProviderConfEntry imapx_conf_entries[] = {
37 { CAMEL_PROVIDER_CONF_SECTION_START, "mailcheck", NULL,
38 N_("Checking for New Mail") },
39 { CAMEL_PROVIDER_CONF_CHECKBOX, "check-all", NULL,
40 N_("C_heck for new messages in all folders"), "1" },
41 { CAMEL_PROVIDER_CONF_CHECKBOX, "check-subscribed", NULL,
42 N_("Ch_eck for new messages in subscribed folders"), "0" },
43 { CAMEL_PROVIDER_CONF_CHECKBOX, "use-qresync", NULL,
44 N_("Use _Quick Resync if the server supports it"), "0" },
45 { CAMEL_PROVIDER_CONF_CHECKBOX, "use-idle", NULL,
46 N_("_Listen for server change notifications"), "0" },
47 { CAMEL_PROVIDER_CONF_SECTION_END },
48 { CAMEL_PROVIDER_CONF_SECTION_START, "folders", NULL,
50 { CAMEL_PROVIDER_CONF_CHECKBOX, "use-subscriptions", NULL,
51 N_("_Show only subscribed folders"), "0" },
53 { CAMEL_PROVIDER_CONF_CHECKBOX, "use-namespace", NULL,
54 N_("O_verride server-supplied folder namespace"), "0" },
55 { CAMEL_PROVIDER_CONF_ENTRY, "namespace", "use-namespace",
58 { CAMEL_PROVIDER_CONF_SECTION_END },
59 { CAMEL_PROVIDER_CONF_SECTION_START, "general", NULL, N_("Options") },
60 { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-all", NULL,
61 N_("Apply _filters to new messages in all folders"), "0" },
62 { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-inbox", "!filter-all",
63 N_("_Apply filters to new messages in Inbox on this server"), "1" },
64 { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-junk", NULL,
65 N_("Check new messages for _Junk contents"), "0" },
66 { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-junk-inbox", "filter-junk",
67 N_("Only check for Junk messages in the IN_BOX folder"), "0" },
68 { CAMEL_PROVIDER_CONF_CHECKBOX, "stay-synchronized", NULL,
69 N_("Automatically synchroni_ze remote mail locally"), "0" },
70 { CAMEL_PROVIDER_CONF_SECTION_END },
71 { CAMEL_PROVIDER_CONF_END }
74 CamelProviderPortEntry imapx_port_entries[] = {
75 { 143, N_("Default IMAP port"), FALSE },
76 { 993, N_("IMAP over SSL"), TRUE },
80 static CamelProvider imapx_provider = {
85 N_("For reading and storing mail on IMAP servers."),
89 CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
90 CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_SUPPORTS_SSL|
91 CAMEL_PROVIDER_SUPPORTS_MOBILE_DEVICES |
92 CAMEL_PROVIDER_SUPPORTS_BATCH_FETCH |
93 CAMEL_PROVIDER_SUPPORTS_PURGE_MESSAGE_CACHE,
95 CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH,
104 extern CamelServiceAuthType camel_imapx_password_authtype;
106 void camel_imapx_module_init (void);
109 camel_imapx_module_init (void)
111 imapx_provider.object_types[CAMEL_PROVIDER_STORE] =
112 CAMEL_TYPE_IMAPX_STORE;
113 imapx_provider.url_hash = imapx_url_hash;
114 imapx_provider.url_equal = imapx_url_equal;
115 imapx_provider.authtypes = camel_sasl_authtype_list (FALSE);
116 imapx_provider.authtypes = g_list_prepend (
117 imapx_provider.authtypes, &camel_imapx_password_authtype);
118 imapx_provider.translation_domain = GETTEXT_PACKAGE;
120 camel_provider_register (&imapx_provider);
124 camel_provider_module_init (void)
126 camel_imapx_module_init ();
130 imapx_add_hash (guint *hash,
134 *hash ^= g_str_hash(s);
138 imapx_url_hash (gconstpointer key)
140 const CamelURL *u = (CamelURL *) key;
143 imapx_add_hash (&hash, u->user);
144 imapx_add_hash (&hash, u->host);
151 imapx_check_equal (gchar *s1,
164 return strcmp (s1, s2) == 0;
168 imapx_url_equal (gconstpointer a,
171 const CamelURL *u1 = a, *u2 = b;
173 return imapx_check_equal (u1->protocol, u2->protocol)
174 && imapx_check_equal (u1->user, u2->user)
175 && imapx_check_equal (u1->host, u2->host)
176 && u1->port == u2->port;