summaryrefslogtreecommitdiff
path: root/pipe.c
diff options
context:
space:
mode:
authorJames Cloos <cloos@jhcloos.com>2010-10-19 12:51:48 -0400
committerJames Cloos <cloos@jhcloos.com>2010-10-19 12:58:58 -0400
commitf84cd95ec0cfa009363c0b2c6f36f0fb1fb9eea8 (patch)
tree906e5fe271998bf30224510ec6ffdca46fdaca85 /pipe.c
parentcf3b344257d865174912ec685f7d92adfee16844 (diff)
parent6907dcb959f8d3b88ffbf614ba591f0c2bfa6f70 (diff)
Use dense, per mailbox UIDs.denseuid
Signed-off-by: James Cloos <cloos@jhcloos.com>
Diffstat (limited to 'pipe.c')
-rw-r--r--pipe.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/pipe.c b/pipe.c
index 1482e4d0..66c7b01b 100644
--- a/pipe.c
+++ b/pipe.c
@@ -502,7 +502,7 @@ static int execute_auto_ran(struct DbmailMessage *message, u64_t useridnr)
int store_message_in_blocks(const char *message, u64_t message_size,
- u64_t msgidnr, u64_t physmsg_id)
+ u64_t mailbox, u64_t msgidnr, u64_t physmsg_id)
{
u64_t tmp_messageblk_idnr;
u64_t rest_size = message_size;
@@ -516,9 +516,9 @@ int store_message_in_blocks(const char *message, u64_t message_size,
rest_size : READ_BLOCK_SIZE);
rest_size = (rest_size < READ_BLOCK_SIZE ?
0 : rest_size - READ_BLOCK_SIZE);
- TRACE(TRACE_DEBUG, "inserting message: size [%llu] block[%d]", message_size, block_nr);
+ TRACE(TRACE_DEBUG, "inserting message: size [%" U64_T_FORMAT "] block[%d]", message_size, block_nr);
if (db_insert_message_block(&message[offset],
- block_size, msgidnr, &physmsg_id,
+ block_size, mailbox, msgidnr, &physmsg_id,
&tmp_messageblk_idnr,0) < 0) {
TRACE(TRACE_ERROR, "db_insert_message_block() failed");
return -1;
@@ -568,7 +568,7 @@ int insert_messages(struct DbmailMessage *message,
struct dm_list *dsnusers)
{
u64_t bodysize, rfcsize;
- u64_t tmpid;
+ u64_t tmpbox, tmpid;
struct element *element;
u64_t msgsize;
@@ -593,7 +593,9 @@ int insert_messages(struct DbmailMessage *message,
if (db_commit_transaction() < 0)
return -1;
- tmpid = message->id; // for later removal
+ /* for later removal */
+ tmpbox = message->mailbox;
+ tmpid = message->id;
bodysize = (u64_t)dbmail_message_get_body_size(message, FALSE);
rfcsize = (u64_t)dbmail_message_get_rfcsize(message);
@@ -702,7 +704,7 @@ int insert_messages(struct DbmailMessage *message,
/* Always delete the temporary message, even if the delivery failed.
* It is the MTA's job to requeue or bounce the message,
* and our job to keep a tidy database ;-) */
- if (db_delete_message(tmpid) < 0)
+ if (db_delete_message(tmpbox, tmpid) < 0)
TRACE(TRACE_ERROR, "failed to delete temporary message [%" U64_T_FORMAT "]", message->id);
TRACE(TRACE_DEBUG, "temporary message deleted from database. Done.");
@@ -755,7 +757,8 @@ int send_alert(u64_t user_idnr, char *subject, char *body)
// Pre-insert the message and get a new_message->id
dbmail_message_store(new_message);
- u64_t tmpid = new_message->id;
+ u64_t tmpbox = new_message->mailbox;
+ u64_t tmpid = new_message->id;
if (sort_deliver_to_mailbox(new_message, user_idnr,
"INBOX", BOX_BRUTEFORCE, msgflags) != DSN_CLASS_OK) {
@@ -763,7 +766,7 @@ int send_alert(u64_t user_idnr, char *subject, char *body)
}
g_free(to);
- db_delete_message(tmpid);
+ db_delete_message(tmpbox, tmpid);
dbmail_message_free(new_message);
return 0;