[dovecot-cvs] dovecot/src/lib-storage/index index-storage.c,1.26,1.27 index-storage.h,1.30,1.31
cras at procontrol.fi
cras at procontrol.fi
Wed Feb 12 14:07:54 EET 2003
Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv28114/lib-storage/index
Modified Files:
index-storage.c index-storage.h
Log Message:
Locking code cleanups and small fixes
Index: index-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- index-storage.c 20 Jan 2003 14:52:51 -0000 1.26
+++ index-storage.c 12 Feb 2003 12:07:52 -0000 1.27
@@ -157,11 +157,21 @@
alarm(secs_left%15);
}
+ /* if notify type changes, print the message immediately */
now = time(NULL);
- if (now < ibox->next_lock_notify || secs_left < 15)
- return;
+ if (ibox->last_notify_type == (enum mail_lock_notify_type)-1 ||
+ ibox->last_notify_type == notify_type) {
+ if (ibox->last_notify_type == (enum mail_lock_notify_type)-1 &&
+ notify_type == MAIL_LOCK_NOTIFY_MAILBOX_OVERRIDE) {
+ /* first override notification, show it */
+ } else {
+ if (now < ibox->next_lock_notify || secs_left < 15)
+ return;
+ }
+ }
ibox->next_lock_notify = now + LOCK_NOTIFY_INTERVAL;
+ ibox->last_notify_type = notify_type;
switch (notify_type) {
case MAIL_LOCK_NOTIFY_MAILBOX_ABORT:
@@ -188,6 +198,8 @@
void index_storage_init_lock_notify(struct index_mailbox *ibox)
{
ibox->next_lock_notify = time(NULL) + LOCK_NOTIFY_INTERVAL;
+ ibox->last_notify_type = (enum mail_lock_notify_type)-1;
+
ibox->index->set_lock_notify_callback(ibox->index, lock_notify, ibox);
}
Index: index-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- index-storage.h 22 Jan 2003 19:23:28 -0000 1.30
+++ index-storage.h 12 Feb 2003 12:07:52 -0000 1.31
@@ -23,6 +23,7 @@
unsigned int synced_messages_count;
time_t next_lock_notify; /* temporary */
+ enum mail_lock_notify_type last_notify_type;
unsigned int sent_diskspace_warning:1;
};
More information about the dovecot-cvs
mailing list