public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in app-admin/conky/files: conky-1.9.0-update-when-message-count-decreases.patch
@ 2013-01-11 18:14 Daniel Pielmeier (billie)
  0 siblings, 0 replies; only message in thread
From: Daniel Pielmeier (billie) @ 2013-01-11 18:14 UTC (permalink / raw
  To: gentoo-commits

billie      13/01/11 18:14:42

  Added:               
                        conky-1.9.0-update-when-message-count-decreases.patch
  Log:
  Add patch missing from the previous commit.
  
  (Portage version: 2.1.11.31/cvs/Linux i686, signed Manifest commit with key 215AD14D)

Revision  Changes    Path
1.1                  app-admin/conky/files/conky-1.9.0-update-when-message-count-decreases.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/conky/files/conky-1.9.0-update-when-message-count-decreases.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/conky/files/conky-1.9.0-update-when-message-count-decreases.patch?rev=1.1&content-type=text/plain

Index: conky-1.9.0-update-when-message-count-decreases.patch
===================================================================
diff --git a/src/mail.c b/src/mail.c
index 7f60ba3..882b7c8 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -630,8 +630,15 @@ int imap_check_status(char *recvbuf, struct mail_s *mail)
 
 void imap_unseen_command(struct mail_s *mail, unsigned long old_unseen, unsigned long old_messages)
 {
-	if (strlen(mail->command) > 1 && (mail->unseen > old_unseen
-				|| (mail->messages > old_messages && mail->unseen > 0))) {
+	/*
+	 * Georg Hopp (2012-12-23):
+	 * Well, i will read mails from time to time and i want the unseen
+	 * count to be reduced when they are read...so, this seems wrong.
+	 * Try a better one.... :)
+	 */
+	if (strlen(mail->command) > 1
+			&& (mail->unseen != old_unseen
+			 || mail->messages != old_messages)) {
 		// new mail goodie
 		if (system(mail->command) == -1) {
 			perror("system()");
@@ -813,7 +820,7 @@ static void *imap_thread(void *arg)
 					if (strlen(recvbuf) > 2) {
 						unsigned long messages, recent = 0;
 						char *buf = recvbuf;
-						char force_check = 0;
+						char force_check = 1;
 						buf = strstr(buf, "EXISTS");
 						while (buf && strlen(buf) > 1 && strstr(buf + 1, "EXISTS")) {
 							buf = strstr(buf + 1, "EXISTS");
@@ -825,9 +832,7 @@ static void *imap_thread(void *arg)
 							}
 							if (sscanf(buf, "* %lu EXISTS\r\n", &messages) == 1) {
 								timed_thread_lock(mail->p_timed_thread);
-								if (mail->messages != messages) {
-									force_check = 1;
-								}
+								force_check = 1;
 								timed_thread_unlock(mail->p_timed_thread);
 							}
 						}
@@ -850,7 +855,10 @@ static void *imap_thread(void *arg)
 						 * something other than 0, or we had a timeout
 						 */
 						buf = recvbuf;
-						if (recent > 0 || (buf && strstr(buf, " FETCH ")) || fetchtimeout.tv_sec == 0 || force_check) {
+						if (recent > 0
+								|| (buf && strstr(buf, " FETCH "))
+								|| (buf && strstr(buf, " EXPUNGE "))
+								|| fetchtimeout.tv_sec == 0 || force_check) {
 							// re-check messages and unseen
 							if (imap_command(sockfd, "DONE\r\n", recvbuf, "a5 OK")) {
 								fail++;
@@ -868,6 +876,9 @@ static void *imap_thread(void *arg)
 								fail++;
 								break;
 							}
+							imap_unseen_command(mail, old_unseen, old_messages);
+							old_unseen = mail->unseen;
+							old_messages = mail->messages;
 							strncpy(sendbuf, "a5 IDLE\r\n", MAXDATASIZE);
 							if (imap_command(sockfd, sendbuf, recvbuf, "+ idling")) {
 								fail++;
@@ -886,10 +897,7 @@ static void *imap_thread(void *arg)
 						fail++;
 						break;
 					}
-					imap_unseen_command(mail, old_unseen, old_messages);
 					fail = 0;
-					old_unseen = mail->unseen;
-					old_messages = mail->messages;
 				}
 				if (fail) break;
 			} else {





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-11 18:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 18:14 [gentoo-commits] gentoo-x86 commit in app-admin/conky/files: conky-1.9.0-update-when-message-count-decreases.patch Daniel Pielmeier (billie)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox