1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## imap_unseen.dpatch by Alexander Galanin <al@galanin.nnov.ru>
4 ## DP: Debian Bug report logs - #539956
5 ## DP: [icewm] support for unseen messages on IMAP
6 ## DP: with minor changes by Eduard Bloch <blade@debian.org>
9 Index: icewm-1.3.7~pre2/src/amailbox.cc
10 ===================================================================
11 --- icewm-1.3.7~pre2.orig/src/amailbox.cc 2010-04-28 21:00:30.000000000 +0200
12 +++ icewm-1.3.7~pre2/src/amailbox.cc 2010-04-29 22:11:16.950092518 +0200
16 } else if (state == WAIT_STAT) {
17 - MSG(("imap: logout"));
18 - char logout[] = "0002 LOGOUT\r\n", folder[128];
19 + MSG(("imap: unseen"));
20 + char * unseen(cstrJoin("0002 STATUS ",
21 + (fURL->path() == null || fURL->path().equals("/")) ? "INBOX" : cstring(fURL->path()).c_str() + 1,
22 + " (UNSEEN)\r\n", NULL));
23 + char folder[128] = "";
24 if (sscanf(bf, "* STATUS %127s (MESSAGES %lu)",
25 folder, &fCurCount) != 2) {
29 - sk.write(logout, strlen(logout));
30 + sk.write(unseen, strlen(unseen));
31 + state = WAIT_UNSEEN;
33 + } else if (state == WAIT_UNSEEN) {
34 + MSG(("imap: logout"));
35 + const char logout[] = "0003 LOGOUT\r\n", folder[128] = "";
36 + if (sscanf(bf, "* STATUS %127s (UNSEEN %lu)",
37 + folder, &fCurUnseen) != 2) {
40 + sk.write(logout, sizeof(logout)/sizeof(char)-1);
42 } else if (state == WAIT_QUIT) {
47 fMbx->mailChecked(MailBoxStatus::mbxNoMail, fCurCount);
48 - else if (fCurCount > fLastCount && fLastCount != -1)
49 - fMbx->mailChecked(MailBoxStatus::mbxHasNewMail, fCurCount);
50 + // A.Galanin: I think that 'has unseen' flag has priority higher that 'has new' flag
51 else if (fCurUnseen != 0)
52 fMbx->mailChecked(MailBoxStatus::mbxHasUnreadMail, fCurCount);
53 + else if (fCurCount > fLastCount && fLastCount != -1)
54 + fMbx->mailChecked(MailBoxStatus::mbxHasNewMail, fCurCount);
56 fMbx->mailChecked(MailBoxStatus::mbxHasMail, fCurCount);
57 fLastUnseen = fCurUnseen;
58 Index: icewm-1.3.7~pre2/src/amailbox.h
59 ===================================================================
60 --- icewm-1.3.7~pre2.orig/src/amailbox.h 2010-04-28 21:00:30.000000000 +0200
61 +++ icewm-1.3.7~pre2/src/amailbox.h 2010-04-29 22:11:16.950092518 +0200