Package: icewm Version: 1.2.37+1.3.4pre2-3 Severity: wishlist Tags: patch --- Please enter the report below this line. ---
I wrote patch for displaying 'unseen' messages status for a mail indicator in IMAP mode. --- System information. --- Architecture: amd64 Kernel: Linux 2.6.26-2-amd64 Debian Release: squeeze/sid 990 testing apt-proxy 500 unstable apt-proxy 500 stable apt-proxy --- Package information. --- Depends (Version) | Installed =========================================-+-======================= icewm-common (= 1.2.37+1.3.4pre2-3) | 1.2.37+1.3.4pre2-3 libc6 (>= 2.3) | 2.9-12 libesd-alsa0 (>= 0.2.35) | 0.2.41-5 OR libesd0 (>= 0.2.35) | libfontconfig1 (>= 2.4.0) | 2.6.0-4 libgcc1 (>= 1:4.1.1) | 1:4.4.0-5 libglib2.0-0 (>= 2.12.0) | 2.20.1-2 libgtk2.0-0 (>= 2.8.0) | 2.16.1-2 libice6 (>= 1:1.0.0) | 2:1.0.5-1 libsm6 | 2:1.1.0-2 libx11-6 | 2:1.2.2-1 libxext6 | 2:1.0.4-1 libxft2 (>> 2.1.1) | 2.1.13-3 libxinerama1 | 2:1.0.3-2 libxrandr2 (>= 2:1.2.0) | 2:1.3.0-2 Package's Recommends field is empty. Suggests (Version) | Installed ==================================-+-=========== ttf-bitstream-vera | icewm-gnome-support | -- Alexander Galanin http://galanin.nnov.ru
diff -ru icewm-1.3.4pre2-old/src/amailbox.cc icewm-1.3.4pre2/src/amailbox.cc --- icewm-1.3.4pre2-old/src/amailbox.cc 2009-04-27 21:57:44.000000000 +0400 +++ icewm-1.3.4pre2/src/amailbox.cc 2009-08-04 22:22:13.000000000 +0400 @@ -278,13 +278,26 @@ 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 * unseen(cstrJoin("0002 STATUS ", + (fURL->path() == null || fURL->path().equals("/")) ? "INBOX" : cstring(fURL->path()).c_str() + 1, + " (UNSEEN)\r\n", NULL)); + char folder[128]; if (sscanf(bf, "* STATUS %127s (MESSAGES %lu)", folder, &fCurCount) != 2) { fCurCount = 0; } fCurUnseen = 0; + sk.write(unseen, strlen(unseen)); + state = WAIT_UNSEEN; + delete [] unseen; + } else if (state == WAIT_UNSEEN) { + MSG(("imap: logout")); + char logout[] = "0003 LOGOUT\r\n", folder[128]; + if (sscanf(bf, "* STATUS %127s (UNSEEN %lu)", + folder, &fCurUnseen) != 2) { + fCurUnseen = 0; + } sk.write(logout, strlen(logout)); state = WAIT_QUIT; } else if (state == WAIT_QUIT) { @@ -294,10 +307,11 @@ state = SUCCESS; if (fCurCount == 0) fMbx->mailChecked(MailBoxStatus::mbxNoMail, fCurCount); - else if (fCurCount > fLastCount && fLastCount != -1) - fMbx->mailChecked(MailBoxStatus::mbxHasNewMail, fCurCount); + // A.Galanin: I think that 'has unseen' flag has priority higner that 'has new' flag else if (fCurUnseen != 0) fMbx->mailChecked(MailBoxStatus::mbxHasUnreadMail, fCurCount); + else if (fCurCount > fLastCount && fLastCount != -1) + fMbx->mailChecked(MailBoxStatus::mbxHasNewMail, fCurCount); else fMbx->mailChecked(MailBoxStatus::mbxHasMail, fCurCount); fLastUnseen = fCurUnseen; diff -ru icewm-1.3.4pre2-old/src/amailbox.h icewm-1.3.4pre2/src/amailbox.h --- icewm-1.3.4pre2-old/src/amailbox.h 2009-04-27 21:57:44.000000000 +0400 +++ icewm-1.3.4pre2/src/amailbox.h 2009-08-04 21:49:36.000000000 +0400 @@ -25,6 +25,7 @@ WAIT_USER, WAIT_PASS, WAIT_STAT, + WAIT_UNSEEN, WAIT_QUIT, ERROR, SUCCESS
pgp6sX2oXRAGF.pgp
Description: PGP signature