struct _CamelIMAPXFolderPrivate {
GMutex property_lock;
GWeakRef mailbox;
- gchar **quota_root_names;
GMutex move_to_hash_table_lock;
GHashTable *move_to_real_junk_uids;
enum {
PROP_0,
PROP_MAILBOX,
- PROP_QUOTA_ROOT_NAMES,
PROP_APPLY_FILTERS = 0x2501
};
CAMEL_IMAPX_FOLDER (object),
g_value_get_object (value));
return;
-
- case PROP_QUOTA_ROOT_NAMES:
- camel_imapx_folder_set_quota_root_names (
- CAMEL_IMAPX_FOLDER (object),
- g_value_get_boxed (value));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
camel_imapx_folder_ref_mailbox (
CAMEL_IMAPX_FOLDER (object)));
return;
-
- case PROP_QUOTA_ROOT_NAMES:
- g_value_take_boxed (
- value,
- camel_imapx_folder_dup_quota_root_names (
- CAMEL_IMAPX_FOLDER (object)));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
g_mutex_clear (&folder->stream_lock);
g_mutex_clear (&folder->priv->property_lock);
- g_strfreev (folder->priv->quota_root_names);
g_mutex_clear (&folder->priv->move_to_hash_table_lock);
g_hash_table_destroy (folder->priv->move_to_real_junk_uids);
if (!success)
goto exit;
- quota_roots = camel_imapx_folder_dup_quota_root_names (
- CAMEL_IMAPX_FOLDER (folder));
+ quota_roots = camel_imapx_mailbox_dup_quota_roots (mailbox);
/* XXX Just return info for the first quota root, I guess. */
if (quota_roots != NULL && quota_roots[0] != NULL) {
CAMEL_TYPE_IMAPX_MAILBOX,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (
- object_class,
- PROP_QUOTA_ROOT_NAMES,
- g_param_spec_boxed (
- "quota-root-names",
- "Quota Root Names",
- "Quota root names for this folder",
- G_TYPE_STRV,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
}
static void
return mailbox;
}
-gchar **
-camel_imapx_folder_dup_quota_root_names (CamelIMAPXFolder *folder)
-{
- gchar **duplicate;
-
- g_return_val_if_fail (CAMEL_IS_IMAPX_FOLDER (folder), NULL);
-
- g_mutex_lock (&folder->priv->property_lock);
-
- duplicate = g_strdupv (folder->priv->quota_root_names);
-
- g_mutex_unlock (&folder->priv->property_lock);
-
- return duplicate;
-}
-
-void
-camel_imapx_folder_set_quota_root_names (CamelIMAPXFolder *folder,
- const gchar **quota_root_names)
-{
- g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
-
- g_mutex_lock (&folder->priv->property_lock);
-
- g_strfreev (folder->priv->quota_root_names);
- folder->priv->quota_root_names =
- g_strdupv ((gchar **) quota_root_names);
-
- g_mutex_unlock (&folder->priv->property_lock);
-
- g_object_notify (G_OBJECT (folder), "quota-root-names");
-}
-
/**
* camel_imapx_folder_copy_message_map:
* @folder: a #CamelIMAPXFolder
camel_imapx_folder_list_mailbox (CamelIMAPXFolder *folder,
GCancellable *cancellable,
GError **error);
-gchar ** camel_imapx_folder_dup_quota_root_names
- (CamelIMAPXFolder *folder);
-void camel_imapx_folder_set_quota_root_names
- (CamelIMAPXFolder *folder,
- const gchar **quota_root_names);
GSequence * camel_imapx_folder_copy_message_map
(CamelIMAPXFolder *folder);
void camel_imapx_folder_add_move_to_real_junk
GCancellable *cancellable,
GError **error)
{
- CamelIMAPXStore *store;
- CamelIMAPXStoreNamespace *ns;
- CamelFolder *folder = NULL;
+ CamelIMAPXMailbox *mailbox;
gchar *mailbox_name = NULL;
gchar **quota_roots = NULL;
gboolean success;
- GError *local_error = NULL;
success = camel_imapx_parse_quotaroot (
stream, cancellable, &mailbox_name, "a_roots, error);
if (!success)
return FALSE;
- store = camel_imapx_server_ref_store (is);
-
- ns = camel_imapx_store_summary_namespace_find_by_mailbox (
- store->summary, mailbox_name);
- if (ns != NULL) {
- gchar *folder_path;
-
- folder_path = camel_imapx_mailbox_to_folder_path (
- mailbox_name, ns->sep);
- if (folder_path != NULL) {
- folder = camel_store_get_folder_sync (
- CAMEL_STORE (store), folder_path, 0,
- cancellable, &local_error);
- g_free (folder_path);
- }
- }
-
- if (folder != NULL) {
- camel_imapx_folder_set_quota_root_names (
- CAMEL_IMAPX_FOLDER (folder),
- (const gchar **) quota_roots);
- g_object_unref (folder);
- }
+ mailbox = camel_imapx_server_ref_mailbox (is, mailbox_name);
- if (local_error != NULL) {
+ if (mailbox != NULL) {
+ camel_imapx_mailbox_set_quota_roots (
+ mailbox, (const gchar **) quota_roots);
+ g_object_unref (mailbox);
+ } else {
g_warning (
- "%s: Failed to get folder '%s': %s",
- G_STRFUNC, mailbox_name, local_error->message);
- g_error_free (local_error);
+ "%s: Unknown mailbox '%s'",
+ G_STRFUNC, mailbox_name);
}
g_free (mailbox_name);
camel_imapx_folder_ref_mailbox
camel_imapx_folder_set_mailbox
camel_imapx_folder_list_mailbox
-camel_imapx_folder_dup_quota_root_names
-camel_imapx_folder_set_quota_root_names
camel_imapx_folder_copy_message_map
camel_imapx_folder_add_move_to_real_junk
camel_imapx_folder_add_move_to_real_trash