~ubuntu-branches/ubuntu/natty/evolution-exchange/natty

« back to all changes in this revision

Viewing changes to storage/exchange-config-listener.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2009-06-16 00:24:12 UTC
  • mfrom: (1.1.57 upstream)
  • Revision ID: james.westby@ubuntu.com-20090616002412-g7ucx327w7rpqhij
Tags: 2.27.3-0ubuntu1
* New upstream version 
* debian/control:
  - updated evolution requirement
* debian/patches/20_fix-crash-on-personal-calendar.patch:
  - the change is in the new version

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        GConfClient *gconf;
57
57
        guint idle_id;
58
58
 
59
 
        char *configured_uri, *configured_name;
 
59
        gchar *configured_uri, *configured_name;
60
60
        EAccount *configured_account;
61
61
 
62
62
        ExchangeAccount *exchange_account;
63
63
};
64
64
 
65
65
typedef struct {
66
 
        const char *name;
67
 
        const char *uri;
68
 
        int type;
 
66
        const gchar *name;
 
67
        const gchar *uri;
 
68
        gint type;
69
69
}FolderInfo;
70
70
 
71
71
enum {
192
192
}
193
193
 
194
194
static void
195
 
update_foreign_uri (const char *path, const char *account_uri)
 
195
update_foreign_uri (const gchar *path, const gchar *account_uri)
196
196
{
197
 
        char *file_path, *phy_uri, *foreign_uri, *new_phy_uri;
 
197
        gchar *file_path, *phy_uri, *foreign_uri, *new_phy_uri;
198
198
        GHashTable *old_props = NULL;
199
199
        xmlDoc *old_doc = NULL, *new_doc = NULL;
200
200
 
228
228
 
229
229
        new_phy_uri = g_strdup_printf ("exchange://%s/;%s", account_uri, foreign_uri + 1);
230
230
        g_hash_table_remove (old_props, "physical_uri_prefix");
231
 
        g_hash_table_insert (old_props, (char *)g_strdup ("physical_uri_prefix"), new_phy_uri);
 
231
        g_hash_table_insert (old_props, (gchar *)g_strdup ("physical_uri_prefix"), new_phy_uri);
232
232
 
233
233
        new_doc = e_xml_from_hash (old_props, E_XML_HASH_TYPE_PROPERTY, "foreign-hierarchy");
234
234
        e_xml_save_file (file_path, new_doc);
246
246
migrate_foreign_hierarchy (ExchangeAccount *account)
247
247
{
248
248
        GDir *d;
249
 
        const char *dentry;
250
 
        char *dir;
 
249
        const gchar *dentry;
 
250
        gchar *dir;
251
251
 
252
252
        d = g_dir_open (account->storage_dir, 0, NULL);
253
253
        if (d) {
264
264
}
265
265
 
266
266
static void
267
 
ex_set_relative_uri (ESource *source, const char *url)
 
267
ex_set_relative_uri (ESource *source, const gchar *url)
268
268
{
269
 
        const char *rel_uri = e_source_peek_relative_uri (source);
270
 
        char *folder_name;
271
 
        char *new_rel_uri;
 
269
        const gchar *rel_uri = e_source_peek_relative_uri (source);
 
270
        gchar *folder_name;
 
271
        gchar *new_rel_uri;
272
272
 
273
273
        if (!rel_uri)
274
274
                return;
287
287
 
288
288
static void
289
289
migrate_account_esource (EAccount *account,
290
 
                        FolderType folder_type)
 
290
                        FolderType folder_type)
291
291
{
292
292
        ESourceGroup *group;
293
293
        ESource *source = NULL;
294
294
        GSList *groups;
295
295
        GSList *sources;
296
296
        gboolean found_group;
297
 
        const char *user_name, *authtype;
 
297
        const gchar *user_name, *authtype;
298
298
        GConfClient *client;
299
299
        ESourceList *source_list = NULL;
300
300
        CamelURL *camel_url;
301
 
        char *url_string;
 
301
        gchar *url_string;
302
302
 
303
303
        camel_url = camel_url_new (account->source->url, NULL);
304
304
        if (!camel_url)
328
328
        groups = e_source_list_peek_groups (source_list);
329
329
        found_group = FALSE;
330
330
 
331
 
        for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) {
 
331
        for (; groups != NULL && !found_group; groups = g_slist_next (groups)) {
332
332
                group = E_SOURCE_GROUP (groups->data);
333
333
 
334
334
                if (strcmp (e_source_group_peek_name (group), account->name) == 0
337
337
                        sources = e_source_group_peek_sources (group);
338
338
 
339
339
                        found_group = TRUE;
340
 
                        for( ; sources != NULL; sources = g_slist_next (sources)) {
 
340
                        for(; sources != NULL; sources = g_slist_next (sources)) {
341
341
                                source = E_SOURCE (sources->data);
342
342
 
343
343
                                ex_set_relative_uri (source, url_string + strlen ("exchange://"));
429
429
}
430
430
 
431
431
static gboolean
432
 
requires_relogin (char *current_url, char *new_url)
 
432
requires_relogin (gchar *current_url, gchar *new_url)
433
433
{
434
434
        E2kUri *current_uri, *new_uri;
435
 
        const char *current_param_val, *new_param_val;
436
 
        const char *params [] = { "owa_url", "ad_server", "use_ssl" };
437
 
        const int n_params = G_N_ELEMENTS (params);
438
 
        int i;
 
435
        const gchar *current_param_val, *new_param_val;
 
436
        const gchar *params [] = { "owa_url", "ad_server", "use_ssl" };
 
437
        const gint n_params = G_N_ELEMENTS (params);
 
438
        gint i;
439
439
        gboolean relogin = FALSE;
440
440
 
441
441
        current_uri = e2k_uri_new (current_url);
449
449
 
450
450
        if (current_uri->authmech || new_uri->authmech) {
451
451
                if (current_uri->authmech && new_uri->authmech) {
452
 
                        if (strcmp (current_uri->authmech, new_uri->authmech)) {
 
452
                        if (strcmp (current_uri->authmech, new_uri->authmech)) {
453
453
                                /* Auth mechanism has changed */
454
454
                                relogin = TRUE;
455
455
                                goto end;
665
665
exchange_camel_urls_is_equal (const gchar *url1, const gchar *url2)
666
666
{
667
667
        CamelURL *curl1, *curl2;
668
 
        const char *param1, *param2;
669
 
        const char *params[] = {
 
668
        const gchar *param1, *param2;
 
669
        const gchar *params[] = {
670
670
                "auth",
671
671
                "owa_url",
672
672
                "owa_path",
673
673
                "mailbox",
674
674
                "ad_server",
675
675
        };
676
 
        const int n_params = 5;
677
 
        int i;
 
676
        const gint n_params = 5;
 
677
        gint i;
678
678
 
679
679
        curl1 = camel_url_new (url1, NULL);
680
680
        curl2 = camel_url_new (url2, NULL);
681
681
 
682
682
        for (i = 0; i < n_params; ++i) {
683
 
                param1 = (gchar*) camel_url_get_param (curl1, params[i]);
684
 
                param2 = (gchar*) camel_url_get_param (curl2, params[i]);
 
683
                param1 = (gchar *) camel_url_get_param (curl1, params[i]);
 
684
                param2 = (gchar *) camel_url_get_param (curl2, params[i]);
685
685
                if ((param1 && !param2) || (!param1 && param2) || /* Missing */
686
686
                    (param1 && param2 && strcmp (param1, param2))) { /* Differing */
687
687
                        camel_url_free (curl1);