subscription-file.c revision 8ecbb74bc4c7f6f6145da3525941d1d0e20e67f1
/* Copyright (C) 2002-2003 Timo Sirainen */
#include "lib.h"
#include "istream.h"
#include "ostream.h"
#include "file-dotlock.h"
#include "mail-storage-private.h"
#include "subscription-file.h"
#include <unistd.h>
#include <fcntl.h>
#define MAX_MAILBOX_LENGTH PATH_MAX
#define SUBSCRIPTION_FILE_LOCK_TIMEOUT 120
#define SUBSCRIPTION_FILE_CHANGE_TIMEOUT 30
struct subsfile_list_context {
struct mail_storage *storage;
const char *path;
bool failed;
};
{
else {
"%s failed with subscription file %s: %m",
}
}
{
const char *line;
return NULL;
switch (i_stream_read(input)) {
case -1:
return NULL;
case -2:
/* mailbox name too large */
"Subscription file %s contains lines longer "
"than %u characters", path,
return NULL;
}
}
return line;
}
{
struct dotlock_settings dotlock_set;
const char *line;
name = "INBOX";
/* FIXME: set lock notification callback */
if (fd_out == -1) {
"Timeout waiting for subscription file lock");
} else {
"file_dotlock_open()", path);
}
return -1;
}
(void)file_dotlock_delete(&dotlock);
return -1;
}
if (!set)
continue;
}
path);
break;
}
}
/* append subscription */
}
}
if (file_dotlock_delete(&dotlock) < 0) {
"file_dotlock_delete()", path);
}
} else {
enum dotlock_replace_flags flags =
"file_dotlock_replace()", path);
}
}
return failed ? -1 : 0;
}
struct subsfile_list_context *
{
struct subsfile_list_context *ctx;
int fd;
return NULL;
}
return ctx;
}
{
bool failed;
return failed ? -1 : 0;
}
{
return NULL;
}