Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1574073
 поиск   регистрация   авторизация 
 
Группа :: Графические оболочки/Icewm
Пакет: icewm

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: icewm-amailbox.patch


--- src1/amailbox.cc	2006-09-03 01:03:53 +0800
+++ src/amailbox.cc	2006-09-03 01:07:50 +0800
@@ -265,7 +265,7 @@
             state = WAIT_USER;
             delete[] login;
         } else if (state == WAIT_USER) {
-            MSG(("imap: status"));
+            MSG(("imap: messagecount"));
             char * status(strJoin("0001 STATUS ",
                                   fURL.path() ? fURL.path() + 1 : "INBOX",
                                   " (MESSAGES)\r\n", NULL));
@@ -273,15 +273,29 @@
             state = WAIT_STAT;
             delete[] status;
         } else if (state == WAIT_STAT) {
-            MSG(("imap: logout"));
-            char logout[] = "0002 LOGOUT\r\n", folder[128];
+            MSG(("imap: unseen"));
+            char folder[128];
             if (sscanf(bf, "* STATUS %127s (MESSAGES %lu)",
                        folder, &fCurCount) != 2) {
                 fCurCount = 0;
             }
-            fCurUnseen = 0;
+	    char * unseen(strJoin("0002 STATUS ",
+                                  fURL.path() ? fURL.path() + 1 : "INBOX",
+                                  " (UNSEEN)\r\n", NULL));
+            sk.write(unseen, strlen(unseen));
+            state = WAIT_UNSEEN;
+	    delete[] unseen;
+        } else if (state == WAIT_UNSEEN) {
+            MSG(("imap: logout"));
+            char * logout(strJoin("0003 LOGOUT\r\n", NULL));
+	    char folder[128];
+	    if (sscanf(bf, "* STATUS %127s (UNSEEN %lu)",
+	    	       folder, &fCurUnseen) != 2) {
+                fCurUnseen = 0;
+            }
             sk.write(logout, strlen(logout));
             state = WAIT_QUIT;
+	    delete[] logout;
         } else if (state == WAIT_QUIT) {
             MSG(("imap: done"));
             //app->exit(0);
@@ -289,9 +303,9 @@
             state = SUCCESS;
             if (fCurCount == 0)
                 fMbx->mailChecked(MailBoxStatus::mbxNoMail, fCurCount);
-            else if (fCurCount > fLastCount && fLastCount != -1)
+            else if (fCurCount > 0 && fCurUnseen > 0)
                 fMbx->mailChecked(MailBoxStatus::mbxHasNewMail, fCurCount);
-            else if (fCurUnseen != 0)
+            else if (fCurUnseen > 0)
                 fMbx->mailChecked(MailBoxStatus::mbxHasUnreadMail, fCurCount);
             else
                 fMbx->mailChecked(MailBoxStatus::mbxHasMail, fCurCount);
--- src1/amailbox.h	2003-09-28 14:41:52.000000000 -0500
+++ src/amailbox.h	2003-09-28 00:18:14.000000000 -0500
@@ -19,6 +19,7 @@
         WAIT_USER,
         WAIT_PASS,
         WAIT_STAT,
+        WAIT_UNSEEN,
         WAIT_QUIT,
         ERROR,
         SUCCESS
 
design & coding: Vladimir Lettiev aka crux © 2004-2005