[Commits] [SCM] claws branch, quota-info, updated. 4.3.1-35-g7118a2e74
miras at claws-mail.org
miras at claws-mail.org
Fri Mar 7 16:14:25 UTC 2025
The branch, quota-info has been updated
via 7118a2e7463897dd87266e17b8e83565fc4d08b4 (commit)
from cda3dae3ec9771b9f9581d14481e5c3cf67110b3 (commit)
Summary of changes:
src/etpan/imap-thread.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++-
src/etpan/imap-thread.h | 1 +
src/imap.c | 35 +++++++++++++++++++++++++++++++++
src/imap.h | 1 +
4 files changed, 87 insertions(+), 1 deletion(-)
- Log -----------------------------------------------------------------
commit 7118a2e7463897dd87266e17b8e83565fc4d08b4
Author: Michael Rasmussen <mir at datanom.net>
Date: Fri Mar 7 17:14:14 2025 +0100
Backend to support RFC 9208
Signed-off-by: Michael Rasmussen <mir at datanom.net>
diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c
index 0c563777e..5c07e985c 100644
--- a/src/etpan/imap-thread.c
+++ b/src/etpan/imap-thread.c
@@ -762,7 +762,56 @@ int imap_threaded_capability(Folder *folder, struct mailimap_capability_data **
return result.error;
}
-
+
+struct quota_param {
+ mailimap * imap;
+};
+
+struct quotaroot_result {
+ int error;
+ struct mailimap_quota_complete_data *quota_data;
+};
+
+static void quotaroot_run(struct etpan_thread_op * op)
+{
+ int r;
+ struct quota_param * param;
+ struct quotaroot_result * result;
+ struct mailimap_quota_complete_data *quota_data;
+
+ param = op->param;
+ result = op->result;
+
+ CHECK_IMAP();
+
+ r = mailimap_quota_getquotaroot(param->imap, "INBOX", "a_data);
+
+ result->error = r;
+ result->quota_data = (r == 0 ? quota_data : NULL);
+}
+
+int imap_threaded_quotaroot(Folder *folder, struct mailimap_quota_complete_data ** quota_data)
+{
+ struct quota_param param;
+ struct quotaroot_result result;
+ mailimap *imap;
+
+ imap = get_imap(folder);
+
+ param.imap = imap;
+
+ threaded_run(folder, ¶m, &result, quotaroot_run);
+
+ debug_print("quotaroot %d\n", result.error);
+
+ if ((result.error == MAILIMAP_NO_ERROR) /* only testing no_error may leak? */
+ || (result.error == MAILIMAP_NO_ERROR_AUTHENTICATED)
+ || (result.error == MAILIMAP_NO_ERROR_NON_AUTHENTICATED))
+ *quota_data = result.quota_data;
+
+ return result.error;
+}
+
struct disconnect_param {
mailimap * imap;
};
diff --git a/src/etpan/imap-thread.h b/src/etpan/imap-thread.h
index 4518ba989..61b555287 100644
--- a/src/etpan/imap-thread.h
+++ b/src/etpan/imap-thread.h
@@ -46,6 +46,7 @@ void imap_done(Folder * folder);
int imap_threaded_connect(Folder * folder, const char * server, int port, ProxyInfo *proxy_info);
int imap_threaded_connect_ssl(Folder * folder, const char * server, int port, ProxyInfo *proxy_info);
int imap_threaded_capability(Folder *folder, struct mailimap_capability_data ** caps);
+int imap_threaded_quotaroot(Folder *folder, struct mailimap_quota_complete_data ** quota_data);
#ifndef G_OS_WIN32
int imap_threaded_connect_cmd(Folder * folder, const char * command,
diff --git a/src/imap.c b/src/imap.c
index febab4c30..c4a58be1f 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -3849,6 +3849,41 @@ static void imap_delete_all_cached_messages(FolderItem *item)
debug_print("Deleting all cached messages done.\n");
}
+gint imap_folder_quotaroot(Folder *folder, guint *usage, guint *limit)
+{
+ IMAPSession *session = NULL;
+ struct mailimap_quota_complete_data *quota_data = NULL;
+ clistiter *cur_data;
+ clistiter *cur_res;
+ int result;
+
+ session = imap_session_get(FOLDER(folder));
+
+ if (imap_has_capability(session, "QUOTA") == FALSE) {
+ return MAILIMAP_ERROR_CAPABILITY;
+ }
+
+ result = imap_threaded_quotaroot(session->folder, "a_data);
+
+ if (result != MAILIMAP_NO_ERROR) {
+ return result;
+ }
+
+ for(cur_data = clist_begin(quota_data->quota_list); cur_data != NULL; cur_data = clist_next(cur_data)) {
+ struct mailimap_quota_quota_data *quota = (struct mailimap_quota_quota_data*)clist_content(cur_data);
+ for (cur_res = clist_begin(quota->quota_list); cur_res != NULL; cur_res = clist_next(cur_res)) {
+ struct mailimap_quota_quota_resource *res = (struct mailimap_quota_quota_resource*)clist_content(cur_res);
+ if (!strcasecmp("STORAGE", res->resource_name)) {
+ *usage = res->usage;
+ *limit = res->limit;
+ debug_print("quota storage: usage=%u limit=%u\n", res->usage, res->limit);
+ }
+ }
+ }
+ mailimap_quota_complete_data_free(quota_data);
+ return MAILIMAP_NO_ERROR;
+}
+
gchar imap_get_path_separator_for_item(FolderItem *item)
{
Folder *folder = NULL;
diff --git a/src/imap.h b/src/imap.h
index e2fa71cc5..ac2a92517 100644
--- a/src/imap.h
+++ b/src/imap.h
@@ -43,6 +43,7 @@ FolderClass *imap_get_class (void);
guint imap_folder_get_refcnt(Folder *folder);
void imap_folder_ref(Folder *folder);
void imap_folder_unref(Folder *folder);
+gint imap_folder_quotaroot(Folder *folder, guint *usage, guint *limit);
gchar imap_get_path_separator_for_item (FolderItem *item);
void imap_disconnect_all(gboolean have_connectivity);
gint imap_subscribe(Folder *folder, FolderItem *item, gchar *rpath, gboolean sub);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list