mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-11 18:38:45 +00:00
smarter new mail checking for imap
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@638 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
77b9d8e118
commit
b2bd458834
@ -1214,6 +1214,7 @@ void *imap_thread(struct mail_s* mail)
|
||||
char *reply;
|
||||
int fail = 0;
|
||||
unsigned int old_unseen = UINT_MAX;
|
||||
unsigned int old_messages = UINT_MAX;
|
||||
struct hostent *he;
|
||||
struct sockaddr_in their_addr; // connector's address information
|
||||
if ((he = gethostbyname(mail->host)) == NULL) { // get the host info
|
||||
@ -1374,13 +1375,14 @@ void *imap_thread(struct mail_s* mail)
|
||||
continue;
|
||||
}
|
||||
close(sockfd);
|
||||
if (strlen(mail->command) > 1 && mail->unseen > old_unseen) { // new mail goodie
|
||||
if (strlen(mail->command) > 1 && (mail->unseen > old_unseen || (mail->messages > old_messages && mail->unseen > 0))) { // new mail goodie
|
||||
if (system(mail->command) == -1) {
|
||||
perror("system()");
|
||||
}
|
||||
}
|
||||
fail = 0;
|
||||
old_unseen = mail->unseen;
|
||||
old_messages = mail->messages;
|
||||
mail->last_update = update_time;
|
||||
usleep(100); // prevent race condition
|
||||
if (get_time() - mail->last_update >
|
||||
|
Loading…
Reference in New Issue
Block a user