Lines Matching defs:trash

11 #include "trash-plugin.h"
53 static int trash_clean_mailbox_open(struct trash_mailbox *trash)
57 trash->box = mailbox_alloc(trash->ns->list, trash->name, 0);
58 mailbox_set_reason(trash->box, "trash plugin");
59 if (mailbox_open(trash->box) < 0) {
60 mailbox_free(&trash->box);
64 if (mailbox_sync(trash->box, MAILBOX_SYNC_FLAG_FULL_READ) < 0)
67 trash->trans = mailbox_transaction_begin(trash->box, 0, __func__);
71 trash->search_ctx = mailbox_search_init(trash->trans,
77 return mailbox_search_next(trash->search_ctx, &trash->mail) ? 1 : 0;
80 static int trash_clean_mailbox_get_next(struct trash_mailbox *trash,
85 if (trash->mail == NULL) {
86 if (trash->box == NULL)
87 ret = trash_clean_mailbox_open(trash);
89 ret = mailbox_search_next(trash->search_ctx,
90 &trash->mail) ? 1 : 0;
98 if (mail_get_received_date(trash->mail, received_time_r) < 0)
117 /* expunge oldest mails first in all trash boxes with
160 struct trash_mailbox *trash = &trashes[i];
162 if (trash->box == NULL)
165 trash->mail = NULL;
166 (void)mailbox_search_deinit(&trash->search_ctx);
170 (void)mailbox_transaction_commit(&trash->trans);
171 (void)mailbox_sync(trash->box, 0);
174 mailbox_transaction_rollback(&trash->trans);
177 mailbox_free(&trash->box);
182 i_debug("trash plugin: Failed to remove enough messages "
190 i_debug("trash plugin: Failed to remove enough messages "
237 i_debug("trash plugin: Mail is larger than "
270 struct trash_mailbox *trash)
274 ns = mail_namespace_find(user->namespaces, trash->name);
278 trash->ns = ns;
293 struct trash_mailbox *trash;
298 i_error("trash plugin: open(%s) failed: %m", path);
312 trash = array_append_space(&tuser->trash_boxes);
313 trash->name = p_strdup(user->pool, name+1);
315 &trash->priority) < 0) {
316 i_error("trash: Invalid priority for mailbox '%s'",
317 trash->name);
321 if (!uni_utf8_str_is_valid(trash->name)) {
322 i_error("trash: Mailbox name not UTF-8: %s",
323 trash->name);
326 if (!trash_find_storage(user, trash)) {
327 i_error("trash: Namespace not found for mailbox '%s'",
328 trash->name);
333 i_debug("trash plugin: Added '%s' with priority %d",
334 trash->name, trash->priority);
351 env = mail_user_plugin_getenv(user, "trash");
354 i_debug("trash: No trash setting - plugin disabled");
356 i_error("trash plugin: quota plugin not initialized");