~ubuntu-branches/ubuntu/natty/evolution-data-server/natty

« back to all changes in this revision

Viewing changes to .pc/199-git-backport-2.32.1-to-b08a6a1.patch/camel/providers/imapx/camel-imapx-provider.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2011-02-07 14:11:56 UTC
  • mfrom: (1.1.84 upstream)
  • Revision ID: james.westby@ubuntu.com-20110207141156-jakojbbkzee62447
Tags: 2.32.2-0ubuntu1
* New upstream release
* debian/patches/01_various_linking_issues.patch:
* debian/patches/02_fix_sources_migration.patch:
* debian/patches/199-git-backport-2.32.1-b08a6a1_to_2d0f4a3.patch:
* debian/patches/199-git-backport-2.32.1-to-b08a6a1.patch:
* debian/patches/199-git-skip-empty-cache-files-ee21a86.patch:
  - Fixed upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
 
/* camel-pop3-provider.c: pop3 provider registration code */
3
 
/*
4
 
 * Authors :
5
 
 *   Dan Winship <danw@ximian.com>
6
 
 *   Michael Zucchi <notzed@ximian.com>
7
 
 *
8
 
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
9
 
 *
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.
13
 
 *
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.
18
 
 *
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.
23
 
 */
24
 
 
25
 
#ifdef HAVE_CONFIG_H
26
 
#include <config.h>
27
 
#endif
28
 
 
29
 
#include <string.h>
30
 
#include <camel/camel.h>
31
 
#include <glib/gi18n-lib.h>
32
 
 
33
 
#include "camel-imapx-store.h"
34
 
 
35
 
static guint imapx_url_hash (gconstpointer key);
36
 
static gint  imapx_url_equal (gconstpointer a, gconstpointer b);
37
 
 
38
 
CamelProviderConfEntry imapx_conf_entries[] = {
39
 
                { CAMEL_PROVIDER_CONF_SECTION_START, "mailcheck", NULL,
40
 
          N_("Checking for New Mail") },
41
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "use_qresync", NULL,
42
 
          N_("Use _Quick Resync if the server supports it"), "1" },
43
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "use_idle", NULL,
44
 
          N_("Use I_dle if the server supports it"), "1" },
45
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "check_all", NULL,
46
 
          N_("C_heck for new messages in all folders"), "1" },
47
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "check_lsub", NULL,
48
 
          N_("Ch_eck for new messages in subscribed folders"), "0" },
49
 
        { CAMEL_PROVIDER_CONF_SECTION_END },
50
 
#ifndef G_OS_WIN32
51
 
        { CAMEL_PROVIDER_CONF_SECTION_START, "cmdsection", NULL,
52
 
          N_("Connection to Server") },
53
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "use_command", NULL,
54
 
          N_("_Use custom command to connect to server"), "0" },
55
 
        { CAMEL_PROVIDER_CONF_ENTRY, "command", "use_command",
56
 
          N_("Command:"), "ssh -C -l %u %h exec /usr/sbin/dovecot --exec-mail imap" },
57
 
        { CAMEL_PROVIDER_CONF_CHECKSPIN, "cachedconn", NULL,
58
 
          N_("Numbe_r of cached connections to use"), "y:1:5:7" },
59
 
        { CAMEL_PROVIDER_CONF_SECTION_END },
60
 
#endif
61
 
        { CAMEL_PROVIDER_CONF_SECTION_START, "folders", NULL,
62
 
          N_("Folders") },
63
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "use_lsub", NULL,
64
 
          N_("_Show only subscribed folders"), "1" },
65
 
#if 0
66
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "override_namespace", NULL,
67
 
          N_("O_verride server-supplied folder namespace"), "0" },
68
 
        { CAMEL_PROVIDER_CONF_ENTRY, "namespace", "override_namespace",
69
 
          N_("Namespace:") },
70
 
#endif
71
 
        { CAMEL_PROVIDER_CONF_SECTION_END },
72
 
        { CAMEL_PROVIDER_CONF_SECTION_START, "general", NULL, N_("Options") },
73
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "filter", NULL,
74
 
          N_("_Apply filters to new messages in INBOX on this server"), "0" },
75
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "filter_junk", NULL,
76
 
          N_("Check new messages for Jun_k contents"), "0" },
77
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "filter_junk_inbox", "filter_junk",
78
 
          N_("Only check for Junk messages in the IN_BOX folder"), "0" },
79
 
        { CAMEL_PROVIDER_CONF_CHECKBOX, "sync_offline", NULL,
80
 
          N_("Automatically synchroni_ze remote mail locally"), "0" },
81
 
        { CAMEL_PROVIDER_CONF_SECTION_END },
82
 
        { CAMEL_PROVIDER_CONF_END }
83
 
};
84
 
 
85
 
static CamelProvider imapx_provider = {
86
 
        "imapx",
87
 
 
88
 
        N_("IMAP+"),
89
 
 
90
 
        N_("For reading and storing mail on IMAP servers."),
91
 
        "mail",
92
 
 
93
 
        CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
94
 
        CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_SUPPORTS_SSL,
95
 
 
96
 
        CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH,
97
 
 
98
 
        imapx_conf_entries,
99
 
 
100
 
        /* ... */
101
 
};
102
 
 
103
 
CamelServiceAuthType camel_imapx_password_authtype = {
104
 
        N_("Password"),
105
 
 
106
 
        N_("This option will connect to the IMAP server using a "
107
 
           "plaintext password."),
108
 
 
109
 
        "",
110
 
        TRUE
111
 
};
112
 
 
113
 
void camel_imapx_module_init(void);
114
 
 
115
 
extern void imapx_utils_init(void);
116
 
 
117
 
void
118
 
camel_imapx_module_init(void)
119
 
{
120
 
        imapx_provider.object_types[CAMEL_PROVIDER_STORE] = camel_imapx_store_get_type();
121
 
        imapx_provider.url_hash = imapx_url_hash;
122
 
        imapx_provider.url_equal = imapx_url_equal;
123
 
        imapx_provider.authtypes = camel_sasl_authtype_list(FALSE);
124
 
        imapx_provider.authtypes = g_list_prepend(imapx_provider.authtypes, &camel_imapx_password_authtype);
125
 
        imapx_provider.translation_domain = GETTEXT_PACKAGE;
126
 
 
127
 
        /* TEMPORARY */
128
 
        imapx_utils_init();
129
 
 
130
 
        camel_provider_register(&imapx_provider);
131
 
}
132
 
 
133
 
void
134
 
camel_provider_module_init(void)
135
 
{
136
 
        camel_imapx_module_init();
137
 
}
138
 
 
139
 
static void
140
 
imapx_add_hash (guint *hash, gchar *s)
141
 
{
142
 
        if (s)
143
 
                *hash ^= g_str_hash(s);
144
 
}
145
 
 
146
 
static guint
147
 
imapx_url_hash (gconstpointer key)
148
 
{
149
 
        const CamelURL *u = (CamelURL *)key;
150
 
        guint hash = 0;
151
 
 
152
 
        imapx_add_hash (&hash, u->user);
153
 
        imapx_add_hash (&hash, u->host);
154
 
        hash ^= u->port;
155
 
 
156
 
        return hash;
157
 
}
158
 
 
159
 
static gint
160
 
imapx_check_equal (gchar *s1, gchar *s2)
161
 
{
162
 
        if (s1 == NULL) {
163
 
                if (s2 == NULL)
164
 
                        return TRUE;
165
 
                else
166
 
                        return FALSE;
167
 
        }
168
 
 
169
 
        if (s2 == NULL)
170
 
                return FALSE;
171
 
 
172
 
        return strcmp (s1, s2) == 0;
173
 
}
174
 
 
175
 
static gint
176
 
imapx_url_equal (gconstpointer a, gconstpointer b)
177
 
{
178
 
        const CamelURL *u1 = a, *u2 = b;
179
 
 
180
 
        return imapx_check_equal (u1->protocol, u2->protocol)
181
 
                && imapx_check_equal (u1->user, u2->user)
182
 
                && imapx_check_equal (u1->host, u2->host)
183
 
                && u1->port == u2->port;
184
 
}