]>
Commit | Line | Data |
---|---|---|
1b2a8190 JR |
1 | #! /bin/sh /usr/share/dpatch/dpatch-run |
2 | ## imap_unseen.dpatch by Alexander Galanin <al@galanin.nnov.ru> | |
3 | ## | |
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> | |
7 | ||
8 | @DPATCH@ | |
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 | |
13 | @@ -278,14 +278,27 @@ | |
14 | state = WAIT_STAT; | |
15 | delete[] status; | |
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) { | |
26 | fCurCount = 0; | |
27 | } | |
28 | fCurUnseen = 0; | |
29 | - sk.write(logout, strlen(logout)); | |
30 | + sk.write(unseen, strlen(unseen)); | |
31 | + state = WAIT_UNSEEN; | |
32 | + delete [] 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) { | |
38 | + fCurUnseen = 0; | |
39 | + } | |
40 | + sk.write(logout, sizeof(logout)/sizeof(char)-1); | |
41 | state = WAIT_QUIT; | |
42 | } else if (state == WAIT_QUIT) { | |
43 | MSG(("imap: done")); | |
44 | @@ -294,10 +307,11 @@ | |
45 | state = SUCCESS; | |
46 | if (fCurCount == 0) | |
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); | |
55 | else | |
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 | |
62 | @@ -25,6 +25,7 @@ | |
63 | WAIT_USER, | |
64 | WAIT_PASS, | |
65 | WAIT_STAT, | |
66 | + WAIT_UNSEEN, | |
67 | WAIT_QUIT, | |
68 | ERROR, | |
69 | SUCCESS |