subscription-file.c revision fff95fdfb5c8ba917eb80f82b439ee3066e5a051
/* 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;
int 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;
}
{
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;
}
return -1;
}
if (!set)
continue;
}
path);
break;
}
}
/* append subscription */
}
}
"file_dotlock_delete()", path);
}
} else {
"file_dotlock_replace()", path);
}
}
return failed ? -1 : 0;
}
struct subsfile_list_context *
{
struct subsfile_list_context *ctx;
int fd;
return NULL;
}
return ctx;
}
{
int failed;
return failed ? -1 : 0;
}
{
return NULL;
}