aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-10-25 23:27:17 +0800
committerDan Winship <danw@src.gnome.org>2000-10-25 23:27:17 +0800
commit82185d7faa88274eccd75e495d2de2a3f8f4237c (patch)
treee6669af593c145764b36408f2bfe283a69f585b5 /camel
parent945c7db44f9faab6e12411c82c8459cba30c60fe (diff)
downloadgsoc2013-evolution-82185d7faa88274eccd75e495d2de2a3f8f4237c.tar
gsoc2013-evolution-82185d7faa88274eccd75e495d2de2a3f8f4237c.tar.gz
gsoc2013-evolution-82185d7faa88274eccd75e495d2de2a3f8f4237c.tar.bz2
gsoc2013-evolution-82185d7faa88274eccd75e495d2de2a3f8f4237c.tar.lz
gsoc2013-evolution-82185d7faa88274eccd75e495d2de2a3f8f4237c.tar.xz
gsoc2013-evolution-82185d7faa88274eccd75e495d2de2a3f8f4237c.tar.zst
gsoc2013-evolution-82185d7faa88274eccd75e495d2de2a3f8f4237c.zip
Add a "parent" field to CamelFolderInfo.
* camel-store.h: Add a "parent" field to CamelFolderInfo. * camel-store.c (camel_folder_info_build): Deal with "parent" (camel_store_folder_subscribed, camel_store_subscribe_folder, camel_store_unsubscribe_folder): Add g_return_if_fails checking that the folder supports subscriptions. * providers/imap/camel-imap-store.c (folder_subscribed, subscribe_folder, unsubscribe_folder): Remove "+ 1"s since the mail subscribe UI won't prepend / to the folder names now. (get_folder_info): Clear the "parent" field of the folderinfos when removing an empty top level. * providers/nntp/camel-nntp-store.c (nntp_store_folder_subscribed, nntp_store_subscribe_folder, nntp_store_unsubscribe_folder): Remove "+ 1"s since the mail subscribe UI won't prepend / to the folder names now. svn path=/trunk/; revision=6167
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog20
-rw-r--r--camel/camel-store.c5
-rw-r--r--camel/camel-store.h2
-rw-r--r--camel/providers/imap/camel-imap-store.c31
-rw-r--r--camel/providers/nntp/camel-nntp-store.c6
5 files changed, 47 insertions, 17 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a4e9575681..822cea90a2 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,23 @@
+2000-10-25 Dan Winship <danw@helixcode.com>
+
+ * camel-store.h: Add a "parent" field to CamelFolderInfo.
+
+ * camel-store.c (camel_folder_info_build): Deal with "parent"
+ (camel_store_folder_subscribed, camel_store_subscribe_folder,
+ camel_store_unsubscribe_folder): Add g_return_if_fails checking
+ that the folder supports subscriptions.
+
+ * providers/imap/camel-imap-store.c (folder_subscribed,
+ subscribe_folder, unsubscribe_folder): Remove "+ 1"s since the
+ mail subscribe UI won't prepend / to the folder names now.
+ (get_folder_info): Clear the "parent" field of the folderinfos
+ when removing an empty top level.
+
+ * providers/nntp/camel-nntp-store.c (nntp_store_folder_subscribed,
+ nntp_store_subscribe_folder, nntp_store_unsubscribe_folder):
+ Remove "+ 1"s since the mail subscribe UI won't prepend / to the
+ folder names now.
+
2000-10-24 Chris Toshok <toshok@helixcode.com>
* providers/imap/camel-imap-store.h: add subscribed_folders.
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 706ade9b97..ac6337acac 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -557,9 +557,11 @@ camel_folder_info_build (GPtrArray *folders, CamelFolderInfo *top,
g_ptr_array_add (folders, pfi);
}
fi->sibling = pfi->child;
+ fi->parent = pfi;
pfi->child = fi;
} else {
fi->sibling = top->child;
+ fi->parent = top;
top->child = fi;
}
}
@@ -591,6 +593,7 @@ camel_store_folder_subscribed (CamelStore *store,
const char *folder_name)
{
g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE);
+ g_return_val_if_fail (store->flags & CAMEL_STORE_SUBSCRIPTIONS, FALSE);
return CS_CLASS (store)->folder_subscribed (store, folder_name);
}
@@ -613,6 +616,7 @@ camel_store_subscribe_folder (CamelStore *store,
CamelException *ex)
{
g_return_if_fail (CAMEL_IS_STORE (store));
+ g_return_if_fail (store->flags & CAMEL_STORE_SUBSCRIPTIONS);
CS_CLASS (store)->subscribe_folder (store, folder_name, ex);
}
@@ -636,6 +640,7 @@ camel_store_unsubscribe_folder (CamelStore *store,
CamelException *ex)
{
g_return_if_fail (CAMEL_IS_STORE (store));
+ g_return_if_fail (store->flags & CAMEL_STORE_SUBSCRIPTIONS);
CS_CLASS (store)->unsubscribe_folder (store, folder_name, ex);
}
diff --git a/camel/camel-store.h b/camel/camel-store.h
index 2be350bca5..7558c0eb5a 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -39,7 +39,7 @@ extern "C" {
typedef struct _CamelFolderInfo {
- struct _CamelFolderInfo *sibling, *child;
+ struct _CamelFolderInfo *parent, *sibling, *child;
char *url, *full_name, *name;
int message_count, unread_message_count;
} CamelFolderInfo;
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 8e3816088d..f0ea3c0aec 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -675,6 +675,8 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
topfi = topfi->child;
fi->child = NULL;
camel_folder_info_free (fi);
+ for (fi = topfi; fi; fi->sibling)
+ fi->parent = NULL;
}
g_free (namespace);
@@ -688,9 +690,10 @@ folder_subscribed (CamelStore *store, const char *folder_name)
CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
char *folder_path;
- folder_path = camel_imap_store_folder_path (imap_store, folder_name + 1 /* bump past the '/' */);
+ folder_path = camel_imap_store_folder_path (imap_store, folder_name);
- return (g_hash_table_lookup (imap_store->subscribed_folders, folder_path) != NULL);
+ return g_hash_table_lookup (imap_store->subscribed_folders,
+ folder_path) != NULL;
}
static void
@@ -701,14 +704,16 @@ subscribe_folder (CamelStore *store, const char *folder_name,
CamelImapResponse *response;
char *folder_path;
- folder_path = camel_imap_store_folder_path (imap_store, folder_name + 1 /* bump past the '/' */);
+ folder_path = camel_imap_store_folder_path (imap_store, folder_name);
response = camel_imap_command (imap_store, NULL, ex,
"SUBSCRIBE \"%s\"",
folder_path);
-
- if (response)
- g_hash_table_insert (imap_store->subscribed_folders, folder_path, folder_path);
+ if (response) {
+ g_hash_table_insert (imap_store->subscribed_folders,
+ folder_path, folder_path);
+ } else
+ g_free (folder_path);
camel_imap_response_free (response);
}
@@ -719,22 +724,22 @@ unsubscribe_folder (CamelStore *store, const char *folder_name,
CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
CamelImapResponse *response;
char *folder_path;
- char *key, *value;
+ gpointer key, value;
- folder_path = camel_imap_store_folder_path (imap_store, folder_name + 1 /* bump past the '/' */);
+ folder_path = camel_imap_store_folder_path (imap_store, folder_name);
response = camel_imap_command (imap_store, NULL, ex,
"UNSUBSCRIBE \"%s\"",
folder_path);
-
if (response) {
- g_hash_table_lookup_extended (imap_store->subscribed_folders, folder_path,
- (gpointer)&key, (gpointer)&value);
- g_hash_table_remove (imap_store->subscribed_folders, folder_path);
+ g_hash_table_lookup_extended (imap_store->subscribed_folders,
+ folder_path, key, value);
+ g_hash_table_remove (imap_store->subscribed_folders,
+ folder_path);
+ g_free (key);
}
camel_imap_response_free (response);
g_free (folder_path);
- g_free (key);
}
static void
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 9bc59e7150..dbba4356be 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -563,7 +563,7 @@ nntp_store_folder_subscribed (CamelStore *store, const char *folder_name)
{
CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
- return camel_nntp_newsrc_group_is_subscribed (nntp_store->newsrc, folder_name + 1);
+ return camel_nntp_newsrc_group_is_subscribed (nntp_store->newsrc, folder_name);
}
static void
@@ -572,7 +572,7 @@ nntp_store_subscribe_folder (CamelStore *store, const char *folder_name,
{
CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
- camel_nntp_newsrc_subscribe_group (nntp_store->newsrc, folder_name + 1);
+ camel_nntp_newsrc_subscribe_group (nntp_store->newsrc, folder_name);
}
static void
@@ -581,7 +581,7 @@ nntp_store_unsubscribe_folder (CamelStore *store, const char *folder_name,
{
CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
- camel_nntp_newsrc_unsubscribe_group (nntp_store->newsrc, folder_name + 1);
+ camel_nntp_newsrc_unsubscribe_group (nntp_store->newsrc, folder_name);
}
static void