diff options
Diffstat (limited to 'mail/mail-folder-cache.c')
-rw-r--r-- | mail/mail-folder-cache.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 46e9446566..5433616a1b 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -1,12 +1,12 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * + * * Authors: Peter Williams <peterw@ximian.com> * Michael Zucchi <notzed@ximian.com> * * Copyright 2000,2001 Ximian, Inc. (www.ximian.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 + * 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, @@ -80,9 +80,9 @@ struct _folder_info { char *full_name; /* full name of folder/folderinfo */ char *uri; /* uri of folder */ - + guint32 flags; - + CamelFolder *folder; /* if known */ }; @@ -160,9 +160,9 @@ notify_idle_cb (gpointer user_data) { GConfClient *gconf; char *filename; - + gconf = mail_config_get_gconf_client (); - + switch (notify_type) { case MAIL_CONFIG_NOTIFY_PLAY_SOUND: filename = gconf_client_get_string (gconf, "/apps/evolution/mail/notify/sound", NULL); @@ -177,11 +177,11 @@ notify_idle_cb (gpointer user_data) default: break; } - + time (&last_notify); - + notify_idle_id = 0; - + return FALSE; } @@ -198,10 +198,10 @@ real_flush_updates(void *o, void *event_data, void *data) struct _MailComponent *component; struct _EMFolderTreeModel *model; struct _folder_update *up; - + component = mail_component_peek (); model = mail_component_peek_tree_model (component); - + LOCK(info_lock); while ((up = (struct _folder_update *)e_dlist_remhead(&updates))) { UNLOCK(info_lock); @@ -223,18 +223,18 @@ real_flush_updates(void *o, void *event_data, void *data) mail_config_uri_renamed(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(up->store))->compare_folder_name, up->olduri, up->uri); } - + if (!up->olduri && up->add) mail_vfolder_add_uri(up->store, up->uri, FALSE); } - + /* update unread counts */ em_folder_tree_model_set_unread_count (model, up->store, up->full_name, up->unread); /* new mail notification */ if (notify_type == -1) { /* need to track the user's new-mail-notification settings... */ GConfClient *gconf; - + gconf = mail_config_get_gconf_client (); gconf_client_add_dir (gconf, "/apps/evolution/mail/notify", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); @@ -242,10 +242,10 @@ real_flush_updates(void *o, void *event_data, void *data) notify_type_changed, NULL, NULL, NULL); notify_type = gconf_client_get_int (gconf, "/apps/evolution/mail/notify/type", NULL); } - + if (notify_type != 0 && up->new && notify_idle_id == 0 && (last_newmail - last_notify >= NOTIFY_THROTTLE)) notify_idle_id = g_idle_add_full (G_PRIORITY_LOW, notify_idle_cb, NULL, NULL); - + if (up->uri) { EMEvent *e = em_event_peek(); EMEventTargetFolder *t = em_event_target_new_folder(e, up->uri, up->new); @@ -258,7 +258,7 @@ real_flush_updates(void *o, void *event_data, void *data) /** @Event: folder.changed * @Title: Folder changed * @Target: EMEventTargetFolder - * + * * folder.changed is emitted whenever a folder changes. There is no detail on how the folder has changed. * UPDATE: We tell the number of new UIDs added rather than the new mails received */ @@ -266,7 +266,7 @@ real_flush_updates(void *o, void *event_data, void *data) } free_update(up); - + LOCK(info_lock); } update_id = -1; @@ -348,7 +348,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) CamelFolder *folder; int unread = -1; int deleted; - + folder = mfi->folder; if (folder) { d(printf("update 1 folder '%s'\n", folder->full_name)); @@ -358,7 +358,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) || (count_sent && folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT))) { d(printf(" total count\n")); unread = camel_folder_get_message_count (folder); - if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX) + if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX) || folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)) { guint32 junked = 0; @@ -368,7 +368,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) camel_object_get (folder, NULL, CAMEL_FOLDER_JUNKED, &junked, NULL); if (junked > 0) unread -= junked; - + } } else { d(printf(" unread count\n")); @@ -412,7 +412,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) mfi->uri = g_strdup(fi->uri); mfi->store_info = si; mfi->flags = fi->flags; - + g_hash_table_insert(si->folders, mfi->full_name, mfi); g_hash_table_insert(si->folders_uri, mfi->uri, mfi); @@ -422,7 +422,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) up->unread = fi->unread; up->store = si->store; camel_object_ref(up->store); - + if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) up->add = TRUE; @@ -458,7 +458,7 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) int new = 0; int i; guint32 flags; - + d(printf("folder '%s' changed\n", folder->full_name)); if (!CAMEL_IS_VEE_FOLDER(folder) @@ -480,10 +480,10 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) } } } - + if (new > 0) time (&last_newmail); - + LOCK(info_lock); if (stores != NULL && (si = g_hash_table_lookup(stores, store)) != NULL @@ -671,7 +671,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, mfi->full_name = g_strdup(fi->full_name); mfi->uri = g_strdup(fi->uri); mfi->flags = fi->flags; - + g_hash_table_insert(si->folders, mfi->full_name, mfi); g_hash_table_insert(si->folders_uri, mfi->uri, mfi); } else { @@ -682,7 +682,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, mfi->uri = g_strdup(fi->uri); mfi->store_info = si; mfi->flags = fi->flags; - + g_hash_table_insert(si->folders, mfi->full_name, mfi); g_hash_table_insert(si->folders_uri, mfi->uri, mfi); } @@ -692,7 +692,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, up->unread = fi->unread==-1?0:fi->unread; up->store = si->store; camel_object_ref(up->store); - + if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) up->add = TRUE; @@ -783,7 +783,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) struct _update_data { struct _update_data *next; struct _update_data *prev; - + int id; /* id for cancellation */ guint cancel:1; /* also tells us we're cancelled */ @@ -835,7 +835,7 @@ mail_note_store_remove(CamelStore *store) ud->cancel = 1; ud = ud->next; } - + camel_object_unref(si->store); g_hash_table_foreach(si->folders, (GHFunc)free_folder_info_hash, NULL); g_hash_table_destroy(si->folders); @@ -874,7 +874,7 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, void *data) struct _ping_store_msg { struct _mail_msg msg; - + CamelStore *store; }; @@ -884,10 +884,10 @@ ping_store_desc (struct _mail_msg *mm, int done) struct _ping_store_msg *m = (struct _ping_store_msg *) mm; char *service_name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE); char *msg; - + msg = g_strdup_printf (_("Pinging %s"), service_name); g_free (service_name); - + return msg; } @@ -896,12 +896,12 @@ ping_store_ping (struct _mail_msg *mm) { gboolean online = FALSE; struct _ping_store_msg *m = (struct _ping_store_msg *) mm; - + if (CAMEL_SERVICE (m->store)->status == CAMEL_SERVICE_CONNECTED) { if (CAMEL_IS_DISCO_STORE (m->store) && camel_disco_store_status (CAMEL_DISCO_STORE (m->store)) != CAMEL_DISCO_STORE_OFFLINE) online = TRUE; - else if (CAMEL_IS_OFFLINE_STORE (m->store) && + else if (CAMEL_IS_OFFLINE_STORE (m->store) && CAMEL_OFFLINE_STORE (m->store)->state != CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) online = TRUE; } @@ -913,7 +913,7 @@ static void ping_store_free (struct _mail_msg *mm) { struct _ping_store_msg *m = (struct _ping_store_msg *) mm; - + camel_object_unref (m->store); } @@ -929,14 +929,14 @@ ping_store (gpointer key, gpointer val, gpointer user_data) { CamelStore *store = (CamelStore *) key; struct _ping_store_msg *m; - + if (CAMEL_SERVICE (store)->status != CAMEL_SERVICE_CONNECTED) return; - + m = mail_msg_new (&ping_store_op, NULL, sizeof (struct _ping_store_msg)); m->store = store; camel_object_ref (store); - + e_thread_put (mail_thread_queued_slow, (EMsg *) m); } @@ -944,11 +944,11 @@ static gboolean ping_cb (gpointer user_data) { LOCK (info_lock); - + g_hash_table_foreach (stores, ping_store, NULL); - + UNLOCK (info_lock); - + return TRUE; } @@ -980,7 +980,7 @@ mail_note_store(CamelStore *store, CamelOperation *op, const char *buf; guint timeout; int hook = 0; - + g_return_if_fail (CAMEL_IS_STORE(store)); g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread)); @@ -1009,12 +1009,12 @@ mail_note_store(CamelStore *store, CamelOperation *op, e_dlist_init(&si->folderinfo_updates); hook = TRUE; } - + ud = g_malloc(sizeof(*ud)); ud->done = done; ud->data = data; ud->cancel = 0; - + /* We might get a race when setting up a store, such that it is still left in offline mode, after we've gone online. This catches and fixes it up when the shell opens us */ if (CAMEL_IS_DISCO_STORE (store)) { @@ -1036,9 +1036,9 @@ mail_note_store(CamelStore *store, CamelOperation *op, normal_setup: ud->id = mail_get_folderinfo (store, op, update_folders, ud); } - + e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud); - + UNLOCK(info_lock); /* there is potential for race here, but it is safe as we check for the store anyway */ |