rpms/dbmail/FC-5 dbmail-expunge.patch,NONE,1.1 dbmail.spec,1.3,1.4
Bernard Johnson (bjohnson)
fedora-extras-commits at redhat.com
Wed Mar 21 18:42:55 UTC 2007
Author: bjohnson
Update of /cvs/extras/rpms/dbmail/FC-5
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32541/FC-5
Modified Files:
dbmail.spec
Added Files:
dbmail-expunge.patch
Log Message:
patch to fix expunge bug with Outlook
dbmail-expunge.patch:
--- NEW FILE dbmail-expunge.patch ---
Index: pop3.c
===================================================================
--- pop3.c (revision 2463)
+++ pop3.c (revision 2464)
@@ -176,8 +176,11 @@
session.virtual_totalsize);
/* if everything went well, write down everything and do a cleanup */
- db_update_pop(&session);
- fprintf(ci->tx, "+OK see ya later\r\n");
+ if (db_update_pop(&session) == DM_SUCCESS)
+ fprintf(ci->tx, "+OK see ya later\r\n");
+ else
+ fprintf(ci->tx, "-ERR some deleted messages not removed\r\n");
+
fflush(ci->tx);
break;
Index: db.c
===================================================================
--- db.c (revision 2463)
+++ db.c (revision 2464)
@@ -3941,38 +3941,6 @@
return val;
}
-int db_get_msgflag_all(u64_t msg_idnr, u64_t mailbox_idnr, int *flags)
-{
- int i;
- char query[DEF_QUERYSIZE];
- memset(query,0,DEF_QUERYSIZE);
-
-
- memset(flags, 0, sizeof(int) * IMAP_NFLAGS);
-
- snprintf(query, DEF_QUERYSIZE,
- "SELECT seen_flag, answered_flag, deleted_flag, "
- "flagged_flag, draft_flag, recent_flag FROM %smessages "
- "WHERE message_idnr = %llu AND status < %d "
- "AND mailbox_idnr = %llu",DBPFX, msg_idnr,
- // MESSAGE_STATUS_NEW, MESSAGE_STATUS_SEEN,
- MESSAGE_STATUS_DELETE,
- mailbox_idnr);
-
- if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not select message");
- return (-1);
- }
-
- if (db_num_rows() > 0) {
- for (i = 0; i < IMAP_NFLAGS; i++) {
- flags[i] = db_get_result_bool(0, i);
- }
- }
- db_free_result();
- return DM_SUCCESS;
-}
-
int db_set_msgflag(u64_t msg_idnr, u64_t mailbox_idnr, int *flags, int action_type)
{
size_t i;
@@ -4041,161 +4009,6 @@
return DM_SUCCESS;
}
-int db_set_msgflag_recent(u64_t msg_idnr, u64_t mailbox_idnr)
-{
- return db_set_msgflag_recent_range(msg_idnr, msg_idnr, mailbox_idnr);
-}
-
-int db_set_msgflag_recent_range(u64_t msg_idnr_lo, u64_t msg_idnr_hi, u64_t mailbox_idnr)
-{
- char query[DEF_QUERYSIZE];
- memset(query,0,DEF_QUERYSIZE);
-
- snprintf(query, DEF_QUERYSIZE, "UPDATE %smessages SET recent_flag=0 WHERE "
- " WHERE message_idnr BETWEEN %llu AND %llu AND "
- "status < %d AND mailbox_idnr = %llu",
- DBPFX, msg_idnr_lo, msg_idnr_hi, MESSAGE_STATUS_DELETE, mailbox_idnr);
- if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not update recent_flag");
- return DM_EQUERY;
- }
-
- return DM_SUCCESS;
-}
-
-int db_get_msgdate(u64_t mailbox_idnr, u64_t msg_idnr, char *date)
-{
- const char *query_result;
- char *to_char_str;
- char query[DEF_QUERYSIZE];
- memset(query,0,DEF_QUERYSIZE);
-
-
- to_char_str = date2char_str("pm.internal_date");
- snprintf(query, DEF_QUERYSIZE,
- "SELECT %s FROM %sphysmessage pm, %smessages msg "
- "WHERE msg.mailbox_idnr = %llu "
- "AND msg.message_idnr = %llu "
- "AND pm.id = msg.physmessage_id",
- to_char_str, DBPFX, DBPFX,
- mailbox_idnr, msg_idnr);
- dm_free(to_char_str);
-
- if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not get message");
- return (-1);
- }
-
- if ((db_num_rows() > 0) && (query_result = db_get_result(0, 0))) {
- strncpy(date, query_result, IMAP_INTERNALDATE_LEN);
- date[IMAP_INTERNALDATE_LEN - 1] = '\0';
- } else {
- /* no date ? let's say 1 jan 1970 */
- strncpy(date, "1970-01-01 00:00:01",
- IMAP_INTERNALDATE_LEN);
- date[IMAP_INTERNALDATE_LEN - 1] = '\0';
- }
-
- db_free_result();
- return DM_SUCCESS;
-}
-
-int db_set_rfcsize(u64_t rfcsize, u64_t msg_idnr, u64_t mailbox_idnr)
-{
- u64_t physmessage_id = 0;
- char query[DEF_QUERYSIZE];
- memset(query,0,DEF_QUERYSIZE);
-
-
- snprintf(query, DEF_QUERYSIZE,
- "SELECT physmessage_id FROM %smessages "
- "WHERE message_idnr = %llu "
- "AND mailbox_idnr = %llu",DBPFX, msg_idnr, mailbox_idnr);
- if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not get physmessage_id for "
- "message [%llu]", msg_idnr);
- return DM_EQUERY;
- }
-
- if (db_num_rows() == 0) {
- TRACE(TRACE_DEBUG, "no such message [%llu]", msg_idnr);
- db_free_result();
- return DM_SUCCESS;
- }
-
- physmessage_id = db_get_result_u64(0, 0);
- db_free_result();
-
- memset(query,0,DEF_QUERYSIZE);
- snprintf(query, DEF_QUERYSIZE,
- "UPDATE %sphysmessage SET rfcsize = %llu "
- "WHERE id = %llu",DBPFX, rfcsize, physmessage_id);
- if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not update "
- "message [%llu]", msg_idnr);
- return DM_EQUERY;
- }
-
- return DM_SUCCESS;
-}
-
-int db_get_rfcsize(u64_t msg_idnr, u64_t mailbox_idnr, u64_t * rfc_size)
-{
- char query[DEF_QUERYSIZE];
- memset(query,0,DEF_QUERYSIZE);
-
- assert(rfc_size != NULL);
- *rfc_size = 0;
-
- snprintf(query, DEF_QUERYSIZE,
- "SELECT pm.rfcsize FROM %sphysmessage pm, %smessages msg "
- "WHERE pm.id = msg.physmessage_id "
- "AND msg.message_idnr = %llu "
- "AND msg.status< %d "
- "AND msg.mailbox_idnr = %llu",DBPFX,DBPFX, msg_idnr, MESSAGE_STATUS_DELETE,
- mailbox_idnr);
-
- if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not fetch RFC size from table");
- return DM_EQUERY;
- }
-
- if (db_num_rows() < 1) {
- TRACE(TRACE_ERROR, "message not found");
- db_free_result();
- return DM_EQUERY;
- }
-
- *rfc_size = db_get_result_u64(0, 0);
-
- db_free_result();
- return DM_EGENERAL;
-}
-
-int db_mailbox_msg_match(u64_t mailbox_idnr, u64_t msg_idnr)
-{
- int val;
- char query[DEF_QUERYSIZE];
- memset(query,0,DEF_QUERYSIZE);
-
-
- snprintf(query, DEF_QUERYSIZE,
- "SELECT message_idnr FROM %smessages "
- "WHERE message_idnr = %llu "
- "AND mailbox_idnr = %llu "
- "AND status< %d",DBPFX, msg_idnr,
- mailbox_idnr, MESSAGE_STATUS_DELETE);
-
- if (db_query(query) == -1) {
- TRACE(TRACE_ERROR, "could not get message");
- return (-1);
- }
-
- val = db_num_rows();
- db_free_result();
- return val;
-}
-
int db_acl_has_right(mailbox_t *mailbox, u64_t userid, const char *right_flag)
{
int result;
Index: db.h
===================================================================
--- db.h (revision 2463)
+++ db.h (revision 2464)
@@ -1184,17 +1184,6 @@
u64_t msg_idnr, u64_t mailbox_idnr);
/**
- * \brief get all flags for a message
- * \param msg_idnr
- * \param mailbox_idnr
- * \param flags An array of IMAP_NFLAGS elements.
- * \return
- * - -1 on failure
- * - 0 on success
- */
-int db_get_msgflag_all(u64_t msg_idnr, u64_t mailbox_idnr, int *flags);
-
-/**
* \brief set flags for a message
* \param msg_idnr
* \param mailbox_idnr
@@ -1214,69 +1203,7 @@
int db_set_msgflag(u64_t msg_idnr, u64_t mailbox_idnr, int *flags,
int action_type);
-int db_set_msgflag_recent(u64_t msg_idnr, u64_t mailbox_idnr);
-
-int db_set_msgflag_recent_range(u64_t msg_idnr_lo, u64_t msg_idnr_hi, u64_t mailbox_idnr);
-
-
/**
- * \brief retrieve internal message date
- * \param mailbox_idnr
- * \param msg_idnr
- * \param date string of size IMAP_INTERNALDATE_LEN which will
- * hold the date after call.
- * \return
- * - -1 on failure
- * - 0 on success
- */
-int db_get_msgdate(u64_t mailbox_idnr, u64_t msg_idnr, char *date);
-/**
- * \brief set the RFCSIZE field of a message
- * \param rfcsize new rfc size
- * \param msg_idnr
- * \param mailbox_idnr
- * \return
- * - -1 on failure
- * - 0 on success
- */
-int db_set_rfcsize(u64_t rfcsize, u64_t msg_idnr, u64_t mailbox_idnr);
-/**
- * \brief get the RFCSIZE field of a message
- * \param msg_idnr
- * \param mailbox_idnr
- * \param rfc_size will hold RFCSIZE after return. Must be a valid pointer
- * on call.
- * \return
- * - -1 on failure
- * - 1 on success
- */
-int db_get_rfcsize(u64_t msg_idnr, u64_t mailbox_idnr, u64_t * rfc_size);
-
-/**
- * \brief builds a list containing the fields of
- * the main header.
- * \param msg_idnr
- * \param hdrlist will hold the list when finished
- * \return
- * - -3 parse error
- * - -2 memory error
- * - -1 database error
- * - 0 success
- * \attention hdrlist should be empty on call.
- */
-int db_get_main_header(u64_t msg_idnr, struct dm_list *hdrlist, const char *headername);
-/**
- * \brief check if a message belongs to a mailbox
- * \param mailbox_idnr
- * \param message_idnr
- * \return
- * - -1 on failure
- * - 0 if message does not belong to mailbox
- * - 1 if message belongs to mailbox
- */
-int db_mailbox_msg_match(u64_t mailbox_idnr, u64_t message_idnr);
-
-/**
* \brief check if a user has a certain right to a mailbox
* \param mailbox
* \param user_idnr id of user
Index: imapcommands.c
===================================================================
--- imapcommands.c (revision 2463)
+++ imapcommands.c (revision 2464)
@@ -1181,9 +1181,10 @@
int _ic_expunge(struct ImapSession *self)
{
imap_userdata_t *ud = (imap_userdata_t *) self->ci->userData;
- u64_t *msgids;
- u64_t nmsgs;
+ u64_t *msgids, *msn;
+ u64_t nmsgs, i, uid;
int result;
+
if (!check_state_and_args(self, "EXPUNGE", 0, 0, IMAPCS_SELECTED))
return 1; /* error, return */
@@ -1216,13 +1217,22 @@
dbmail_imap_session_printf(self, "%s OK EXPUNGE completed\r\n", self->tag);
return 1;
}
-
+
+ for (i=0; i<nmsgs; i++) {
+ uid = msgids[i];
+ msn = g_tree_lookup(self->mailbox->ids, &uid);
+
+ if (! msn) {
+ TRACE(TRACE_DEBUG,"can't find uid [%llu]", uid);
+ break;
+ }
+ dbmail_imap_session_printf(self, "* %llu EXPUNGE\r\n", *msn);
+ }
+
if (msgids)
dm_free(msgids);
msgids = NULL;
- dbmail_imap_session_mailbox_status(self, TRUE);
-
// reopen the mailbox
dbmail_mailbox_open(self->mailbox);
@@ -1434,11 +1444,8 @@
static gboolean _do_store(u64_t *id, gpointer UNUSED value, struct ImapSession *self)
{
- int j;
- gboolean isfirstout = TRUE;
imap_userdata_t *ud = (imap_userdata_t *) self->ci->userData;
cmd_store_t *cmd = (cmd_store_t *)self->cmd;
- u64_t *msn;
if (ud->mailbox.permission == IMAPPERM_READWRITE) {
if (db_set_msgflag(*id, ud->mailbox.uid, cmd->flaglist, cmd->action) < 0) {
@@ -1447,31 +1454,6 @@
}
}
- if (cmd->silent)
- return FALSE;
-
- if (db_get_msgflag_all(*id, ud->mailbox.uid, cmd->msgflags) < 0) {
- dbmail_imap_session_printf(self, "\r\n* BYE internal dbase error\r\n");
- return TRUE;
- }
-
- msn = g_tree_lookup(self->ids, id);
-
- dbmail_imap_session_printf(self, "* %llu FETCH (FLAGS (", *msn);
-
- for (j = 0, isfirstout = TRUE; j < IMAP_NFLAGS; j++) {
- if (! cmd->msgflags[j])
- continue;
-
- dbmail_imap_session_printf(self, "%s%s", isfirstout ? "" : " ", imap_flag_desc_escaped [j]);
- isfirstout = FALSE;
- }
-
- if (self->use_uid)
- dbmail_imap_session_printf(self, ") UID %llu)\r\n", *id);
- else
- dbmail_imap_session_printf(self, "))\r\n");
-
return FALSE;
}
@@ -1605,6 +1587,9 @@
g_tree_foreach(self->ids, (GTraverseFunc) _do_store, self);
}
+ if (! cmd.silent)
+ dbmail_imap_session_mailbox_status(self,TRUE);
+
dbmail_imap_session_printf(self, "%s OK %sSTORE completed\r\n", self->tag, self->use_uid ? "UID " : "");
return 0;
}
Index: dbmail-imapsession.c
===================================================================
--- dbmail-imapsession.c (revision 2463)
+++ dbmail-imapsession.c (revision 2464)
@@ -591,7 +591,8 @@
char query[DEF_QUERYSIZE];
memset(query,0,DEF_QUERYSIZE);
- g_return_val_if_fail(ids && g_tree_nnodes(ids)>0 ,NULL);
+ if (! (ids && g_tree_nnodes(ids)>0))
+ return NULL;
l = g_tree_keys(ids);
@@ -1570,11 +1571,8 @@
int dbmail_imap_session_mailbox_status(struct ImapSession * self, gboolean update)
{
/*
- FIXME: this should be called during each command
- but only show status updates for changes
- Currently only changes in EXISTS and RECENT are detected
+ FIXME: this should be called more often?
-
C: a047 NOOP
S: * 22 EXPUNGE
S: * 23 EXISTS
Index: test-scripts/testexpunge.imap
===================================================================
--- test-scripts/testexpunge.imap (revision 0)
+++ test-scripts/testexpunge.imap (revision 2464)
@@ -0,0 +1,5 @@
+1 login testuser1 test
+2 select INBOX
+3 uid store 1:* +FLAGS (\Deleted \Seen)
+4 expunge
+5 logout
Index: test-scripts/testimap.py
===================================================================
--- test-scripts/testimap.py (revision 2463)
+++ test-scripts/testimap.py (revision 2464)
@@ -198,9 +198,13 @@
an `EXPUNGE' response for each deleted message. Returned data
contains a list of `EXPUNGE' message numbers in order received.
"""
- self.o.select('INBOX')
- self.assertEquals(self.o.expunge(),('OK', [None]))
+ getFreshbox('testexpungebox')
+ self.o.select('testexpungebox')
+ self.o.store('1:*', '+FLAGS', '\Deleted')
+ msnlist = self.o.expunge()[1];
+ self.assertEquals(msnlist,['11', '10', '9', '8', '7', '6', '5', '4', '3', '2', '1'])
+
def testFetch(self):
"""
fetch(message_set, message_parts)'
@@ -396,7 +400,6 @@
self.o.select('recenttestbox')
self.o.fetch("1:*","(Flags)")
- print self.o.recent()
self.assertEquals(self.o.status("recenttestbox",'(RECENT)')[1][0], '"recenttestbox" (RECENT 0)')
def testRename(self):
Index: dbmail.spec
===================================================================
RCS file: /cvs/extras/rpms/dbmail/FC-5/dbmail.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dbmail.spec 13 Mar 2007 22:38:07 -0000 1.3
+++ dbmail.spec 21 Mar 2007 18:42:22 -0000 1.4
@@ -12,7 +12,7 @@
Name: dbmail
Version: 2.2.4
-Release: 1%{?dist}%{?repotag:.%{repotag}}
+Release: 2%{?dist}%{?repotag:.%{repotag}}
Summary: The DBMail mail storage system
Group: System Environment/Daemons
@@ -27,6 +27,7 @@
Source6: dbmail.logrotate
Source7: README.fedora
Patch0: kill-module-path.patch
+Patch1: dbmail-expunge.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: fileutils, openssl >= 0.9.7a
@@ -63,6 +64,7 @@
%prep
%setup -q
%patch0 -p1 -b .kill-module-path
+%patch1 -p0 -b .expunge
# we don't need README.solaris and we don't want it caught up in the %%doc
# README* wildcard - but we do want our shiny new README.fedora file to be
@@ -83,7 +85,6 @@
make %{?_smp_mflags}
-
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
@@ -220,6 +221,9 @@
%endif
%changelog
+* Thu Mar 20 2007 Bernard Johnson <bjohnson at symetrix.com> 2.2.4-2
+- patch to fix expunge bug
+
* Tue Mar 13 2007 Bernard Johnson <bjohnson at symetrix.com> 2.2.4-1
- v. 2.2.4
- remove umask patch as it's included upstream now
More information about the fedora-extras-commits
mailing list