AC_MSG_ERROR([--with-storages needs storage list as parameter])
fi
mail_storages="shared `echo "$withval"|sed 's/,/ /g'`" ],
- mail_storages="shared maildir mbox dbox mdbox cydir")
+ mail_storages="shared maildir mbox sdbox mdbox cydir")
AC_SUBST(mail_storages)
AC_ARG_WITH(moduledir,
maildir_libs='$(top_builddir)/src/lib-storage/index/maildir/libstorage_maildir.la'
mbox_libs='$(top_builddir)/src/lib-storage/index/mbox/libstorage_mbox.la'
dbox_common_libs='$(top_builddir)/src/lib-storage/index/dbox-common/libstorage_dbox_common.la'
-dbox_libs='$(top_builddir)/src/lib-storage/index/dbox-single/libstorage_dbox_single.la'
+sdbox_libs='$(top_builddir)/src/lib-storage/index/dbox-single/libstorage_dbox_single.la'
mdbox_libs='$(top_builddir)/src/lib-storage/index/dbox-multi/libstorage_dbox_multi.la'
cydir_libs='$(top_builddir)/src/lib-storage/index/cydir/libstorage_cydir.la'
raw_libs='$(top_builddir)/src/lib-storage/index/raw/libstorage_raw.la'
mail_storages="$mail_storages raw"
# drop duplicates
mail_storages=`(for i in $mail_storages; do echo $i; done)|sort|uniq|xargs echo`
+have_sdbox=no
for storage in $mail_storages; do
LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS `eval echo \\$${storage}_libs`"
- if test $storage = dbox || test $storage = mdbox; then
+ if test $storage = sdbox; then
+ have_sdbox=yes
+ fi
+ if test $storage = sdbox || test $storage = mdbox; then
LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS $dbox_common_libs"
dbox_common_libs=""
fi
AC_SUBST(LINKED_STORAGE_LIBS)
AC_DEFINE_UNQUOTED(MAIL_STORAGES, "$mail_storages", List of compiled in mail storages)
+if test $have_sdbox = yes; then
+ # create alias for sdbox
+ mail_storages="$mail_storages dbox"
+fi
+
dnl **
dnl ** Shared libraries usage
dnl **
#include "sdbox-sync.h"
#include "sdbox-storage.h"
-extern struct mail_storage dbox_storage;
+extern struct mail_storage dbox_storage, sdbox_storage;
extern struct mailbox sdbox_mailbox;
extern struct dbox_storage_vfuncs sdbox_dbox_storage_vfuncs;
struct sdbox_storage *storage;
pool_t pool;
- pool = pool_alloconly_create("dbox storage", 512+256);
+ pool = pool_alloconly_create("sdbox storage", 512+256);
storage = p_new(pool, struct sdbox_storage, 1);
storage->storage.v = sdbox_dbox_storage_vfuncs;
storage->storage.storage = dbox_storage;
{
#ifndef HAVE_FLOCK
if (master_service_get_client_limit(master_service) > 1) {
- *error_r = "dbox requires client_limit=1 for service "
+ *error_r = "sdbox requires client_limit=1 for service "
"since your OS doesn't support flock()";
return -1;
}
/* dbox can't work without index files */
flags &= ~MAILBOX_FLAG_NO_INDEX_FILES;
- pool = pool_alloconly_create("dbox mailbox", 1024*3);
+ pool = pool_alloconly_create("sdbox mailbox", 1024*3);
mbox = p_new(pool, struct sdbox_mailbox, 1);
mbox->box = sdbox_mailbox;
mbox->box.pool = pool;
if (log_error) {
mail_storage_set_critical(
&mbox->storage->storage.storage,
- "dbox %s: Invalid dbox header size",
+ "sdbox %s: Invalid dbox header size",
mbox->box.path);
}
ret = -1;
return sdbox_write_index_header(box, update, NULL);
}
-struct mail_storage dbox_storage = {
+struct mail_storage sdbox_storage = {
.name = SDBOX_STORAGE_NAME,
.class_flags = 0,
}
};
+struct mail_storage dbox_storage = {
+ .name = "dbox", /* alias */
+ .class_flags = 0,
+
+ .v = {
+ NULL,
+ sdbox_storage_alloc,
+ sdbox_storage_create,
+ NULL,
+ NULL,
+ dbox_storage_get_list_settings,
+ NULL,
+ sdbox_mailbox_alloc,
+ NULL
+ }
+};
+
struct mailbox sdbox_mailbox = {
.v = {
index_storage_is_readonly,
#include "index-storage.h"
#include "dbox-storage.h"
-#define SDBOX_STORAGE_NAME "dbox"
+#define SDBOX_STORAGE_NAME "sdbox"
#define SDBOX_MAIL_FILE_PREFIX "u."
#define SDBOX_MAIL_FILE_FORMAT SDBOX_MAIL_FILE_PREFIX"%u"
if (ret < 0)
return -1;
- i_warning("dbox: Skipping unfixable file: %s", file->cur_path);
+ i_warning("sdbox: Skipping unfixable file: %s", file->cur_path);
return 0;
}
fname += strlen(SDBOX_MAIL_FILE_PREFIX);
if (str_to_uint32(fname, &uid) < 0 || uid == 0) {
- i_warning("dbox %s: Ignoring invalid filename %s",
+ i_warning("sdbox %s: Ignoring invalid filename %s",
ctx->box->path, fname);
return 0;
}
if (ret == 0) {
if (i >= SDBOX_REBUILD_COUNT) {
mail_storage_set_critical(storage,
- "dbox %s: Index keeps breaking",
+ "sdbox %s: Index keeps breaking",
ctx->mbox->box.path);
ret = -1;
} else {
/* do a full resync and try again. */
- i_warning("dbox %s: Rebuilding index",
+ i_warning("sdbox %s: Rebuilding index",
ctx->mbox->box.path);
rebuild = FALSE;
ret = sdbox_sync_index_rebuild(mbox,