imap-msgpart-url.c revision 0177594fa5217b02001f4ec8752154fd2b05c545
/* Copyright (c) 2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "network.h"
#include "istream.h"
#include "message-parser.h"
#include "mail-storage.h"
#include "mail-namespace.h"
#include "imap-url.h"
#include "imap-msgpart.h"
#include "imap-msgpart-url.h"
struct imap_msgpart_url {
char *mailbox;
char *section;
struct mailbox_transaction_context *trans;
};
struct imap_msgpart_url *
{
struct imap_msgpart_url *mpurl;
return mpurl;
}
const char **error_r)
{
struct mailbox_status box_status;
const char *error;
/* build base url */
if (selected_box != NULL) {
&box_status);
}
/* parse url */
return -1;
}
*error_r = "Mailbox-relative IMAP URL, but no mailbox selected";
return -1;
}
*error_r = "Invalid messagepart IMAP URL";
return -1;
}
return 0;
}
{
}
{
struct mailbox_status box_status;
enum mail_error error_code;
struct mail_namespace *ns;
return 1;
}
/* find mailbox namespace */
*error_r = "Nonexistent mailbox namespace";
return 0;
}
/* open mailbox */
if (mailbox_open(box) < 0) {
&error_code);
mailbox_free(&box);
}
/* verify UIDVALIDITY */
if (mpurl->uidvalidity > 0 &&
*error_r = "Invalid UIDVALIDITY";
mailbox_free(&box);
return 0;
}
return 1;
}
{
struct mailbox_transaction_context *t;
int ret;
return 1;
}
/* open mailbox if it is not yet open */
return ret;
/* start transaction */
t = mailbox_transaction_begin(box, 0);
/* find the message */
*error_r = "Message not found";
return 0;
}
return 1;
}
static int
{
int ret;
return ret;
*error_r = "Invalid section";
return 0;
}
return 1;
}
const char **error_r)
{
struct imap_msgpart *msgpart;
struct imap_msgpart_open_result result;
int ret;
return 1;
}
/* open mail if it is not yet open */
if (ret <= 0)
return ret;
/* open the referenced part as a stream */
if (ret < 0) {
return ret;
}
return 1;
}
const char **error_r)
{
struct imap_msgpart *msgpart;
int ret;
return 1;
/* open mail if it is not yet open */
if (ret > 0)
return ret;
}
{
}