Link Here
|
1 |
Taken from http://lunar-linux.org/~tchan/mutt/patch-1.5.23.sidebar.20140412.txt |
1 |
Taken from http://lunar-linux.org/~tchan/mutt/patch-1.5.23.sidebar.20140412.txt |
2 |
|
2 |
|
3 |
diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c |
3 |
diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c |
4 |
*** mutt-1.5.23-orig/buffy.c 2014-03-12 11:03:44.000000000 -0500 |
4 |
*** mutt-1.5.23-orig/buffy.c.orig 2015-08-30 19:06:38.000000000 +0200 |
5 |
--- mutt-1.5.23/buffy.c 2014-04-12 15:33:54.000000000 -0500 |
5 |
--- mutt-1.5.23/buffy.c 2015-09-10 09:31:22.000000000 +0200 |
6 |
*************** |
6 |
@@ -161,6 +161,49 @@ |
7 |
*** 161,166 **** |
7 |
} |
8 |
--- 161,209 ---- |
8 |
} |
9 |
} |
9 |
|
10 |
} |
10 |
+static int buffy_compare_name(const void *a, const void *b) { |
11 |
|
11 |
+ const BUFFY *b1 = * (BUFFY * const *) a; |
12 |
+ static int buffy_compare_name(const void *a, const void *b) { |
12 |
+ const BUFFY *b2 = * (BUFFY * const *) b; |
13 |
+ const BUFFY *b1 = * (BUFFY * const *) a; |
13 |
+ |
14 |
+ const BUFFY *b2 = * (BUFFY * const *) b; |
14 |
+ return mutt_strcoll(b1->path, b2->path); |
15 |
+ |
15 |
+} |
16 |
+ return mutt_strcoll(b1->path, b2->path); |
16 |
+ |
17 |
+ } |
17 |
+static BUFFY *buffy_sort(BUFFY *b) |
18 |
+ |
18 |
+{ |
19 |
+ static BUFFY *buffy_sort(BUFFY *b) |
19 |
+ BUFFY *tmp = b; |
20 |
+ { |
20 |
+ int buffycount = 0; |
21 |
+ BUFFY *tmp = b; |
21 |
+ BUFFY **ary; |
22 |
+ int buffycount = 0; |
22 |
+ int i; |
23 |
+ BUFFY **ary; |
23 |
+ |
24 |
+ int i; |
24 |
+ if (!option(OPTSIDEBARSORT)) |
25 |
+ |
25 |
+ return b; |
26 |
+ if (!option(OPTSIDEBARSORT)) |
26 |
+ |
27 |
+ return b; |
27 |
+ for (; tmp != NULL; tmp = tmp->next) |
28 |
+ |
28 |
+ buffycount++; |
29 |
+ for (; tmp != NULL; tmp = tmp->next) |
29 |
+ |
30 |
+ buffycount++; |
30 |
+ ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary)); |
31 |
+ |
31 |
+ |
32 |
+ ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary)); |
32 |
+ tmp = b; |
33 |
+ |
33 |
+ for (i = 0; tmp != NULL; tmp = tmp->next, i++) { |
34 |
+ tmp = b; |
34 |
+ ary[i] = tmp; |
35 |
+ for (i = 0; tmp != NULL; tmp = tmp->next, i++) { |
35 |
+ } |
36 |
+ ary[i] = tmp; |
36 |
+ |
37 |
+ } |
37 |
+ qsort(ary, buffycount, sizeof(*ary), buffy_compare_name); |
38 |
+ |
38 |
+ |
39 |
+ qsort(ary, buffycount, sizeof(*ary), buffy_compare_name); |
39 |
+ for (i = 0; i < buffycount - 1; i++) { |
40 |
+ |
40 |
+ ary[i]->next = ary[i+1]; |
41 |
+ for (i = 0; i < buffycount - 1; i++) { |
41 |
+ } |
42 |
+ ary[i]->next = ary[i+1]; |
42 |
+ ary[buffycount - 1]->next = NULL; |
43 |
+ } |
43 |
+ for (i = 1; i < buffycount; i++) { |
44 |
+ ary[buffycount - 1]->next = NULL; |
44 |
+ ary[i]->prev = ary[i-1]; |
45 |
+ for (i = 1; i < buffycount; i++) { |
45 |
+ } |
46 |
+ ary[i]->prev = ary[i-1]; |
46 |
+ ary[0]->prev = NULL; |
47 |
+ } |
47 |
+ |
48 |
+ ary[0]->prev = NULL; |
48 |
+ tmp = ary[0]; |
49 |
+ |
49 |
+ free(ary); |
50 |
+ tmp = ary[0]; |
50 |
+ return tmp; |
51 |
+ free(ary); |
51 |
+} |
52 |
+ return tmp; |
52 |
+ |
53 |
+ } |
53 |
BUFFY *mutt_find_mailbox (const char *path) |
54 |
+ |
54 |
{ |
55 |
BUFFY *mutt_find_mailbox (const char *path) |
55 |
BUFFY *tmp = NULL; |
56 |
{ |
56 |
@@ -196,9 +239,13 @@ |
57 |
BUFFY *tmp = NULL; |
57 |
static BUFFY *buffy_new (const char *path) |
58 |
*************** |
58 |
{ |
59 |
*** 196,204 **** |
59 |
BUFFY* buffy; |
60 |
--- 239,251 ---- |
60 |
+ char rp[PATH_MAX]; |
61 |
static BUFFY *buffy_new (const char *path) |
61 |
+ char *r; |
62 |
{ |
62 |
|
63 |
BUFFY* buffy; |
63 |
buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY)); |
64 |
+ char rp[PATH_MAX]; |
64 |
strfcpy (buffy->path, path, sizeof (buffy->path)); |
65 |
+ char *r; |
65 |
+ r = realpath(path, rp); |
66 |
|
66 |
+ strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath)); |
67 |
buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY)); |
67 |
buffy->next = NULL; |
68 |
strfcpy (buffy->path, path, sizeof (buffy->path)); |
68 |
buffy->magic = 0; |
69 |
+ r = realpath(path, rp); |
69 |
|
70 |
+ strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath)); |
70 |
@@ -243,8 +290,8 @@ |
71 |
buffy->next = NULL; |
71 |
p = realpath (buf, f1); |
72 |
buffy->magic = 0; |
72 |
for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next)) |
73 |
|
73 |
{ |
74 |
*************** |
74 |
- q = realpath ((*tmp)->path, f2); |
75 |
*** 243,250 **** |
75 |
- if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0) |
76 |
p = realpath (buf, f1); |
76 |
+ q = (*tmp)->realpath; |
77 |
for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next)) |
77 |
+ if (mutt_strcmp (p ? p : buf, q) == 0) |
78 |
{ |
78 |
{ |
79 |
! q = realpath ((*tmp)->path, f2); |
79 |
dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path)); |
80 |
! if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0) |
80 |
break; |
81 |
{ |
81 |
@@ -282,6 +329,7 @@ |
82 |
dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path)); |
82 |
else |
83 |
break; |
83 |
(*tmp)->size = 0; |
84 |
--- 290,297 ---- |
84 |
} |
85 |
p = realpath (buf, f1); |
85 |
+ Incoming = buffy_sort(Incoming); |
86 |
for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next)) |
86 |
return 0; |
87 |
{ |
87 |
} |
88 |
! q = (*tmp)->realpath; |
88 |
|
89 |
! if (mutt_strcmp (p ? p : buf, q) == 0) |
89 |
@@ -306,6 +354,11 @@ |
90 |
{ |
90 |
return 0; |
91 |
dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path)); |
91 |
} |
92 |
break; |
92 |
|
93 |
*************** |
93 |
+ if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) { |
94 |
*** 282,287 **** |
94 |
+ mailbox->new = 1; |
95 |
--- 329,335 ---- |
95 |
+ return 1; |
96 |
else |
96 |
+ } |
97 |
(*tmp)->size = 0; |
97 |
+ |
98 |
} |
98 |
if ((dirp = opendir (path)) == NULL) |
99 |
+ Incoming = buffy_sort(Incoming); |
99 |
{ |
100 |
return 0; |
100 |
mailbox->magic = 0; |
101 |
} |
101 |
@@ -357,6 +410,73 @@ |
102 |
|
102 |
|
103 |
*************** |
103 |
return 0; |
104 |
*** 306,311 **** |
104 |
} |
105 |
--- 354,364 ---- |
105 |
+ |
106 |
return 0; |
106 |
+/* update message counts for the sidebar */ |
107 |
} |
107 |
+void buffy_maildir_update (BUFFY* mailbox) |
108 |
|
108 |
+{ |
109 |
+ if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) { |
109 |
+ char path[_POSIX_PATH_MAX]; |
110 |
+ mailbox->new = 1; |
110 |
+ DIR *dirp; |
111 |
+ return 1; |
111 |
+ struct dirent *de; |
112 |
+ } |
112 |
+ char *p; |
113 |
+ |
113 |
+ |
114 |
if ((dirp = opendir (path)) == NULL) |
114 |
+ if(!option(OPTSIDEBAR)) |
115 |
{ |
115 |
+ return; |
116 |
mailbox->magic = 0; |
116 |
+ |
117 |
*************** |
117 |
+ mailbox->msgcount = 0; |
118 |
*** 340,345 **** |
118 |
+ mailbox->msg_unread = 0; |
119 |
--- 393,464 ---- |
119 |
+ mailbox->msg_flagged = 0; |
120 |
return rc; |
120 |
+ |
121 |
} |
121 |
+ snprintf (path, sizeof (path), "%s/new", mailbox->path); |
122 |
|
122 |
+ |
123 |
+ /* update message counts for the sidebar */ |
123 |
+ if ((dirp = opendir (path)) == NULL) |
124 |
+ void buffy_maildir_update (BUFFY* mailbox) |
124 |
+ { |
125 |
+ { |
125 |
+ mailbox->magic = 0; |
126 |
+ char path[_POSIX_PATH_MAX]; |
126 |
+ return; |
127 |
+ DIR *dirp; |
127 |
+ } |
128 |
+ struct dirent *de; |
128 |
+ |
129 |
+ char *p; |
129 |
+ while ((de = readdir (dirp)) != NULL) |
130 |
+ |
130 |
+ { |
131 |
+ if(!option(OPTSIDEBAR)) |
131 |
+ if (*de->d_name == '.') |
132 |
+ return; |
132 |
+ continue; |
133 |
+ |
133 |
+ |
134 |
+ mailbox->msgcount = 0; |
134 |
+ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { |
135 |
+ mailbox->msg_unread = 0; |
135 |
+ mailbox->new = 1; |
136 |
+ mailbox->msg_flagged = 0; |
136 |
+ mailbox->msgcount++; |
137 |
+ |
137 |
+ mailbox->msg_unread++; |
138 |
+ snprintf (path, sizeof (path), "%s/new", mailbox->path); |
138 |
+ } |
139 |
+ |
139 |
+ } |
140 |
+ if ((dirp = opendir (path)) == NULL) |
140 |
+ |
141 |
+ { |
141 |
+ closedir (dirp); |
142 |
+ mailbox->magic = 0; |
142 |
+ snprintf (path, sizeof (path), "%s/cur", mailbox->path); |
143 |
+ return; |
143 |
+ |
144 |
+ } |
144 |
+ if ((dirp = opendir (path)) == NULL) |
145 |
+ |
145 |
+ { |
146 |
+ while ((de = readdir (dirp)) != NULL) |
146 |
+ mailbox->magic = 0; |
147 |
+ { |
147 |
+ return; |
148 |
+ if (*de->d_name == '.') |
148 |
+ } |
149 |
+ continue; |
149 |
+ |
150 |
+ |
150 |
+ while ((de = readdir (dirp)) != NULL) |
151 |
+ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { |
151 |
+ { |
152 |
+ mailbox->new = 1; |
152 |
+ if (*de->d_name == '.') |
153 |
+ mailbox->msgcount++; |
153 |
+ continue; |
154 |
+ mailbox->msg_unread++; |
154 |
+ |
155 |
+ } |
155 |
+ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { |
156 |
+ } |
156 |
+ mailbox->msgcount++; |
157 |
+ |
157 |
+ if ((p = strstr (de->d_name, ":2,"))) { |
158 |
+ closedir (dirp); |
158 |
+ if (!strchr (p + 3, 'T')) { |
159 |
+ snprintf (path, sizeof (path), "%s/cur", mailbox->path); |
159 |
+ if (!strchr (p + 3, 'S')) |
160 |
+ |
160 |
+ mailbox->msg_unread++; |
161 |
+ if ((dirp = opendir (path)) == NULL) |
161 |
+ if (strchr(p + 3, 'F')) |
162 |
+ { |
162 |
+ mailbox->msg_flagged++; |
163 |
+ mailbox->magic = 0; |
163 |
+ } |
164 |
+ return; |
164 |
+ } |
165 |
+ } |
165 |
+ } |
166 |
+ |
166 |
+ } |
167 |
+ while ((de = readdir (dirp)) != NULL) |
167 |
+ |
168 |
+ { |
168 |
+ mailbox->sb_last_checked = time(NULL); |
169 |
+ if (*de->d_name == '.') |
169 |
+ closedir (dirp); |
170 |
+ continue; |
170 |
+} |
171 |
+ |
171 |
+ |
172 |
+ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { |
172 |
/* returns 1 if mailbox has new mail */ |
173 |
+ mailbox->msgcount++; |
173 |
static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb) |
174 |
+ if ((p = strstr (de->d_name, ":2,"))) { |
174 |
{ |
175 |
+ if (!strchr (p + 3, 'T')) { |
175 |
@@ -368,7 +488,7 @@ |
176 |
+ if (!strchr (p + 3, 'S')) |
176 |
else |
177 |
+ mailbox->msg_unread++; |
177 |
statcheck = sb->st_mtime > sb->st_atime |
178 |
+ if (strchr(p + 3, 'F')) |
178 |
|| (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime); |
179 |
+ mailbox->msg_flagged++; |
179 |
- if (statcheck) |
180 |
+ } |
180 |
+ if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0)) |
181 |
+ } |
181 |
{ |
182 |
+ } |
182 |
if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited) |
183 |
+ } |
183 |
{ |
184 |
+ |
184 |
@@ -388,6 +508,27 @@ |
185 |
+ mailbox->sb_last_checked = time(NULL); |
185 |
return rc; |
186 |
+ closedir (dirp); |
186 |
} |
187 |
+ } |
187 |
|
188 |
+ |
188 |
+/* update message counts for the sidebar */ |
189 |
/* returns 1 if mailbox has new mail */ |
189 |
+void buffy_mbox_update (BUFFY* mailbox, struct stat *sb) |
190 |
static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb) |
190 |
+{ |
191 |
{ |
191 |
+ CONTEXT *ctx = NULL; |
192 |
*************** |
192 |
+ |
193 |
*** 351,357 **** |
193 |
+ if(!option(OPTSIDEBAR)) |
194 |
else |
194 |
+ return; |
195 |
statcheck = sb->st_mtime > sb->st_atime |
195 |
+ if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0) |
196 |
|| (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime); |
196 |
+ return; /* no check necessary */ |
197 |
! if (statcheck) |
197 |
+ |
198 |
{ |
198 |
+ ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL); |
199 |
if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited) |
199 |
+ if(ctx) |
200 |
{ |
200 |
+ { |
201 |
--- 470,476 ---- |
201 |
+ mailbox->msgcount = ctx->msgcount; |
202 |
else |
202 |
+ mailbox->msg_unread = ctx->unread; |
203 |
statcheck = sb->st_mtime > sb->st_atime |
203 |
+ mailbox->msg_flagged = ctx->flagged; |
204 |
|| (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime); |
204 |
+ mailbox->sb_last_checked = time(NULL); |
205 |
! if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0)) |
205 |
+ mx_close_mailbox(ctx, 0); |
206 |
{ |
206 |
+ } |
207 |
if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited) |
207 |
+} |
208 |
{ |
208 |
+ |
209 |
*************** |
209 |
int mutt_buffy_check (int force) |
210 |
*** 371,376 **** |
210 |
{ |
211 |
--- 490,516 ---- |
211 |
BUFFY *tmp; |
212 |
return rc; |
212 |
@@ -461,17 +602,20 @@ |
213 |
} |
213 |
{ |
214 |
|
214 |
case M_MBOX: |
215 |
+ /* update message counts for the sidebar */ |
215 |
case M_MMDF: |
216 |
+ void buffy_mbox_update (BUFFY* mailbox, struct stat *sb) |
216 |
+ buffy_mbox_update (tmp, &sb); |
217 |
+ { |
217 |
if (buffy_mbox_hasnew (tmp, &sb) > 0) |
218 |
+ CONTEXT *ctx = NULL; |
218 |
BuffyCount++; |
219 |
+ |
219 |
break; |
220 |
+ if(!option(OPTSIDEBAR)) |
220 |
|
221 |
+ return; |
221 |
case M_MAILDIR: |
222 |
+ if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0) |
222 |
+ buffy_maildir_update (tmp); |
223 |
+ return; /* no check necessary */ |
223 |
if (buffy_maildir_hasnew (tmp) > 0) |
224 |
+ |
224 |
BuffyCount++; |
225 |
+ ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL); |
225 |
break; |
226 |
+ if(ctx) |
226 |
|
227 |
+ { |
227 |
case M_MH: |
228 |
+ mailbox->msgcount = ctx->msgcount; |
228 |
- mh_buffy(tmp); |
229 |
+ mailbox->msg_unread = ctx->unread; |
229 |
+ mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked); |
230 |
+ mailbox->msg_flagged = ctx->flagged; |
230 |
+ mh_buffy(tmp); |
231 |
+ mailbox->sb_last_checked = time(NULL); |
231 |
if (tmp->new) |
232 |
+ mx_close_mailbox(ctx, 0); |
232 |
BuffyCount++; |
233 |
+ } |
233 |
break; |
234 |
+ } |
|
|
235 |
+ |
236 |
int mutt_buffy_check (int force) |
237 |
{ |
238 |
BUFFY *tmp; |
239 |
*************** |
240 |
*** 444,460 **** |
241 |
{ |
242 |
case M_MBOX: |
243 |
case M_MMDF: |
244 |
if (buffy_mbox_hasnew (tmp, &sb) > 0) |
245 |
BuffyCount++; |
246 |
break; |
247 |
|
248 |
case M_MAILDIR: |
249 |
if (buffy_maildir_hasnew (tmp) > 0) |
250 |
BuffyCount++; |
251 |
break; |
252 |
|
253 |
case M_MH: |
254 |
! mh_buffy(tmp); |
255 |
if (tmp->new) |
256 |
BuffyCount++; |
257 |
break; |
258 |
--- 584,603 ---- |
259 |
{ |
260 |
case M_MBOX: |
261 |
case M_MMDF: |
262 |
+ buffy_mbox_update (tmp, &sb); |
263 |
if (buffy_mbox_hasnew (tmp, &sb) > 0) |
264 |
BuffyCount++; |
265 |
break; |
266 |
|
267 |
case M_MAILDIR: |
268 |
+ buffy_maildir_update (tmp); |
269 |
if (buffy_maildir_hasnew (tmp) > 0) |
270 |
BuffyCount++; |
271 |
break; |
272 |
|
273 |
case M_MH: |
274 |
! mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked); |
275 |
! mh_buffy(tmp); |
276 |
if (tmp->new) |
277 |
BuffyCount++; |
278 |
break; |
279 |
*** mutt-1.5.23-orig/buffy.h 2014-03-12 11:03:44.000000000 -0500 |
234 |
*** mutt-1.5.23-orig/buffy.h 2014-03-12 11:03:44.000000000 -0500 |
280 |
--- mutt-1.5.23/buffy.h 2014-04-11 10:14:01.000000000 -0500 |
235 |
--- mutt-1.5.23/buffy.h 2014-04-11 10:14:01.000000000 -0500 |
281 |
*************** |
236 |
*************** |
Link Here
|
300 |
} |
255 |
} |
301 |
BUFFY; |
256 |
BUFFY; |
302 |
|
257 |
|
303 |
*** mutt-1.5.23-orig/color.c 2014-03-12 11:03:45.000000000 -0500 |
258 |
*** mutt-1.5.23-orig/color.c.orig 2015-08-30 19:06:38.000000000 +0200 |
304 |
--- mutt-1.5.23/color.c 2014-04-11 10:14:01.000000000 -0500 |
259 |
--- mutt-1.5.23/color.c 2015-09-10 09:34:06.000000000 +0200 |
305 |
*************** |
260 |
@@ -94,6 +94,8 @@ |
306 |
*** 93,98 **** |
261 |
{ "underline", MT_COLOR_UNDERLINE }, |
307 |
--- 93,100 ---- |
262 |
{ "index", MT_COLOR_INDEX }, |
308 |
{ "bold", MT_COLOR_BOLD }, |
263 |
{ "prompt", MT_COLOR_PROMPT }, |
309 |
{ "underline", MT_COLOR_UNDERLINE }, |
264 |
+ { "sidebar_new", MT_COLOR_NEW }, |
310 |
{ "index", MT_COLOR_INDEX }, |
265 |
+ { "sidebar_flagged", MT_COLOR_FLAGGED }, |
311 |
+ { "sidebar_new", MT_COLOR_NEW }, |
266 |
{ NULL, 0 } |
312 |
+ { "sidebar_flagged", MT_COLOR_FLAGGED }, |
267 |
}; |
313 |
{ NULL, 0 } |
268 |
|
314 |
}; |
269 |
*** mutt-1.5.23-orig/compose.c.orig 2015-09-10 19:24:26.000000000 +0200 |
315 |
|
270 |
--- mutt-1.5.23/compose.c 2015-09-10 20:49:12.000000000 +0200 |
316 |
*** mutt-1.5.23-orig/compose.c.orig 2014-04-13 09:37:15.000000000 +0200 |
|
|
317 |
--- mutt-1.5.23/compose.c 2014-04-13 09:41:42.000000000 +0200 |
318 |
@@ -83,7 +83,7 @@ |
271 |
@@ -83,7 +83,7 @@ |
319 |
|
272 |
|
320 |
#define HDR_XOFFSET 14 |
273 |
#define HDR_XOFFSET 14 |
Link Here
|
333 |
|
286 |
|
334 |
if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0) |
287 |
if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0) |
335 |
{ |
288 |
{ |
336 |
@@ -176,7 +176,7 @@ |
289 |
@@ -179,7 +179,7 @@ |
337 |
} |
290 |
addstr (_(" (OppEnc mode)")); |
338 |
|
291 |
|
339 |
clrtoeol (); |
292 |
clrtoeol (); |
340 |
- move (HDR_CRYPTINFO, 0); |
293 |
- move (HDR_CRYPTINFO, 0); |
Link Here
|
342 |
clrtoeol (); |
295 |
clrtoeol (); |
343 |
|
296 |
|
344 |
if ((WithCrypto & APPLICATION_PGP) |
297 |
if ((WithCrypto & APPLICATION_PGP) |
345 |
@@ -194,7 +194,7 @@ |
298 |
@@ -204,7 +204,7 @@ |
346 |
&& (msg->security & ENCRYPT) |
299 |
&& (msg->security & ENCRYPT) |
347 |
&& SmimeCryptAlg |
300 |
&& SmimeCryptAlg |
348 |
&& *SmimeCryptAlg) { |
301 |
&& *SmimeCryptAlg) { |
Link Here
|
351 |
NONULL(SmimeCryptAlg)); |
304 |
NONULL(SmimeCryptAlg)); |
352 |
} |
305 |
} |
353 |
} |
306 |
} |
354 |
@@ -207,7 +207,7 @@ |
307 |
@@ -217,7 +217,7 @@ |
355 |
int c; |
308 |
int c; |
356 |
char *t; |
309 |
char *t; |
357 |
|
310 |
|
Link Here
|
360 |
|
313 |
|
361 |
if (!chain) |
314 |
if (!chain) |
362 |
{ |
315 |
{ |
363 |
@@ -222,7 +222,7 @@ |
316 |
@@ -232,7 +232,7 @@ |
364 |
if (t && t[0] == '0' && t[1] == '\0') |
317 |
if (t && t[0] == '0' && t[1] == '\0') |
365 |
t = "<random>"; |
318 |
t = "<random>"; |
366 |
|
319 |
|
Link Here
|
369 |
break; |
322 |
break; |
370 |
|
323 |
|
371 |
addstr (NONULL(t)); |
324 |
addstr (NONULL(t)); |
372 |
@@ -274,7 +274,7 @@ |
325 |
@@ -284,7 +284,7 @@ |
373 |
|
326 |
|
374 |
buf[0] = 0; |
327 |
buf[0] = 0; |
375 |
rfc822_write_address (buf, sizeof (buf), addr, 1); |
328 |
rfc822_write_address (buf, sizeof (buf), addr, 1); |
Link Here
|
378 |
mutt_paddstr (W, buf); |
331 |
mutt_paddstr (W, buf); |
379 |
} |
332 |
} |
380 |
|
333 |
|
381 |
@@ -292,21 +292,21 @@ |
334 |
@@ -302,21 +302,21 @@ |
382 |
} |
335 |
} |
383 |
else |
336 |
else |
384 |
{ |
337 |
{ |
Link Here
|
405 |
mutt_paddstr (W, fcc); |
358 |
mutt_paddstr (W, fcc); |
406 |
|
359 |
|
407 |
if (WithCrypto) |
360 |
if (WithCrypto) |
408 |
@@ -317,7 +317,7 @@ |
361 |
@@ -327,7 +327,7 @@ |
409 |
#endif |
362 |
#endif |
410 |
|
363 |
|
411 |
SETCOLOR (MT_COLOR_STATUS); |
364 |
SETCOLOR (MT_COLOR_STATUS); |
Link Here
|
414 |
clrtoeol (); |
367 |
clrtoeol (); |
415 |
|
368 |
|
416 |
NORMAL_COLOR; |
369 |
NORMAL_COLOR; |
417 |
@@ -353,7 +353,7 @@ |
370 |
@@ -363,7 +363,7 @@ |
418 |
/* redraw the expanded list so the user can see the result */ |
371 |
/* redraw the expanded list so the user can see the result */ |
419 |
buf[0] = 0; |
372 |
buf[0] = 0; |
420 |
rfc822_write_address (buf, sizeof (buf), *addr, 1); |
373 |
rfc822_write_address (buf, sizeof (buf), *addr, 1); |
Link Here
|
423 |
mutt_paddstr (W, buf); |
376 |
mutt_paddstr (W, buf); |
424 |
|
377 |
|
425 |
return 0; |
378 |
return 0; |
426 |
@@ -685,7 +685,7 @@ |
379 |
@@ -705,7 +705,7 @@ |
427 |
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) |
380 |
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) |
428 |
{ |
381 |
{ |
429 |
mutt_str_replace (&msg->env->subject, buf); |
382 |
mutt_str_replace (&msg->env->subject, buf); |
Link Here
|
432 |
if (msg->env->subject) |
385 |
if (msg->env->subject) |
433 |
mutt_paddstr (W, msg->env->subject); |
386 |
mutt_paddstr (W, msg->env->subject); |
434 |
else |
387 |
else |
435 |
@@ -703,7 +703,7 @@ |
388 |
@@ -723,7 +723,7 @@ |
436 |
{ |
389 |
{ |
437 |
strfcpy (fcc, buf, fcclen); |
390 |
strfcpy (fcc, buf, fcclen); |
438 |
mutt_pretty_mailbox (fcc, fcclen); |
391 |
mutt_pretty_mailbox (fcc, fcclen); |
Link Here
|
701 |
#ifdef USE_IMAP |
654 |
#ifdef USE_IMAP |
702 |
WHERE short ImapKeepalive; |
655 |
WHERE short ImapKeepalive; |
703 |
WHERE short ImapPipelineDepth; |
656 |
WHERE short ImapPipelineDepth; |
704 |
*** mutt-1.5.23-orig/handler.c 2014-03-12 11:03:45.000000000 -0500 |
657 |
*** mutt-1.5.23-orig/handler.c.orig 2015-09-10 09:34:53.000000000 +0200 |
705 |
--- mutt-1.5.23/handler.c 2014-04-11 10:14:01.000000000 -0500 |
658 |
--- mutt-1.5.23/handler.c 2015-09-10 09:58:03.000000000 +0200 |
706 |
*************** |
659 |
@@ -1625,6 +1625,11 @@ |
707 |
*** 1599,1604 **** |
660 |
int decode = 0; |
708 |
--- 1599,1609 ---- |
661 |
int rc = 0; |
709 |
size_t tmplength = 0; |
662 |
|
710 |
int rc = 0; |
663 |
+#ifdef HAVE_FMEMOPEN |
711 |
|
664 |
+ char *temp; |
712 |
+ #ifdef HAVE_FMEMOPEN |
665 |
+ size_t tempsize; |
713 |
+ char *temp; |
666 |
+#endif |
714 |
+ size_t tempsize; |
667 |
+ |
715 |
+ #endif |
668 |
fseeko (s->fpin, b->offset, 0); |
716 |
+ |
669 |
|
717 |
int oflags = s->flags; |
670 |
/* see if we need to decode this part before processing it */ |
718 |
|
671 |
@@ -1642,6 +1647,14 @@ |
719 |
/* first determine which handler to use to process this part */ |
672 |
{ |
720 |
*************** |
673 |
/* decode to a tempfile, saving the original destination */ |
721 |
*** 1711,1716 **** |
674 |
fp = s->fpout; |
722 |
--- 1716,1729 ---- |
675 |
+#ifdef HAVE_FMEMOPEN |
723 |
{ |
676 |
+ if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL) |
724 |
/* decode to a tempfile, saving the original destination */ |
677 |
+ { |
725 |
fp = s->fpout; |
678 |
+ mutt_error _("Unable to open memory stream!"); |
726 |
+ #ifdef HAVE_FMEMOPEN |
679 |
+ dprint (1, (debugfile, "Can't open memory stream.\n")); |
727 |
+ if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL) |
680 |
+ goto bail; |
728 |
+ { |
681 |
+ } |
729 |
+ mutt_error _("Unable to open memory stream!"); |
682 |
+#else |
730 |
+ dprint (1, (debugfile, "Can't open memory stream.\n")); |
683 |
mutt_mktemp (tempfile, sizeof (tempfile)); |
731 |
+ goto bail; |
684 |
if ((s->fpout = safe_fopen (tempfile, "w")) == NULL) |
732 |
+ } |
685 |
{ |
733 |
+ #else |
686 |
@@ -1649,6 +1662,7 @@ |
734 |
mutt_mktemp (tempfile, sizeof (tempfile)); |
687 |
dprint (1, (debugfile, "Can't open %s.\n", tempfile)); |
735 |
if ((s->fpout = safe_fopen (tempfile, "w")) == NULL) |
688 |
return -1; |
736 |
{ |
689 |
} |
737 |
*************** |
690 |
+#endif |
738 |
*** 1718,1723 **** |
691 |
/* decoding the attachment changes the size and offset, so save a copy |
739 |
--- 1731,1737 ---- |
692 |
* of the "real" values now, and restore them after processing |
740 |
dprint (1, (debugfile, "Can't open %s.\n", tempfile)); |
693 |
*/ |
741 |
goto bail; |
694 |
@@ -1677,8 +1691,19 @@ |
742 |
} |
695 |
/* restore final destination and substitute the tempfile for input */ |
743 |
+ #endif |
696 |
s->fpout = fp; |
744 |
/* decoding the attachment changes the size and offset, so save a copy |
697 |
fp = s->fpin; |
745 |
* of the "real" values now, and restore them after processing |
698 |
+#ifdef HAVE_FMEMOPEN |
746 |
*/ |
699 |
+ if(tempsize) |
747 |
*************** |
700 |
+ s->fpin = fmemopen(temp, tempsize, "r"); |
748 |
*** 1746,1753 **** |
701 |
+ else /* fmemopen cannot handle zero-length buffers */ |
749 |
--- 1760,1778 ---- |
702 |
+ s->fpin = safe_fopen ("/dev/null", "r"); |
750 |
/* restore final destination and substitute the tempfile for input */ |
703 |
+ if(s->fpin == NULL) { |
751 |
s->fpout = fp; |
704 |
+ mutt_perror("failed to re-open memstream!"); |
752 |
fp = s->fpin; |
705 |
+ return (-1); |
753 |
+ #ifdef HAVE_FMEMOPEN |
706 |
+ } |
754 |
+ if(tempsize) |
707 |
+#else |
755 |
+ s->fpin = fmemopen(temp, tempsize, "r"); |
708 |
s->fpin = fopen (tempfile, "r"); |
756 |
+ else /* fmemopen cannot handle zero-length buffers */ |
709 |
unlink (tempfile); |
757 |
+ s->fpin = safe_fopen ("/dev/null", "r"); |
710 |
+#endif |
758 |
+ if(s->fpin == NULL) { |
711 |
|
759 |
+ mutt_perror("failed to re-open memstream!"); |
712 |
/* restore the prefix */ |
760 |
+ return (-1); |
713 |
s->prefix = savePrefix; |
761 |
+ } |
714 |
@@ -1704,9 +1729,14 @@ |
762 |
+ #else |
715 |
|
763 |
s->fpin = fopen (tempfile, "r"); |
716 |
/* restore the original source stream */ |
764 |
unlink (tempfile); |
717 |
safe_fclose (&s->fpin); |
765 |
+ #endif |
718 |
+#ifdef HAVE_FMEMOPEN |
766 |
|
719 |
+ if(tempsize) |
767 |
/* restore the prefix */ |
720 |
+ FREE(&temp); |
768 |
s->prefix = savePrefix; |
721 |
+#endif |
769 |
*************** |
722 |
s->fpin = fp; |
770 |
*** 1773,1778 **** |
723 |
} |
771 |
--- 1798,1807 ---- |
724 |
} |
772 |
|
725 |
+ bail: |
773 |
/* restore the original source stream */ |
726 |
s->flags |= M_FIRSTDONE; |
774 |
safe_fclose (&s->fpin); |
727 |
|
775 |
+ #ifdef HAVE_FMEMOPEN |
728 |
return rc; |
776 |
+ if(tempsize) |
729 |
@@ -1743,6 +1773,7 @@ |
777 |
+ FREE(&temp); |
730 |
handler_t handler = NULL; |
778 |
+ #endif |
731 |
int rc = 0; |
779 |
s->fpin = fp; |
732 |
|
780 |
} |
733 |
+ |
781 |
} |
734 |
int oflags = s->flags; |
|
|
735 |
|
736 |
/* first determine which handler to use to process this part */ |
782 |
*** mutt-1.5.23-orig/init.h 2014-03-12 11:06:17.000000000 -0500 |
737 |
*** mutt-1.5.23-orig/init.h 2014-03-12 11:06:17.000000000 -0500 |
783 |
--- mutt-1.5.23/init.h 2014-04-11 10:14:01.000000000 -0500 |
738 |
--- mutt-1.5.23/init.h 2014-04-11 10:14:01.000000000 -0500 |
784 |
*************** |
739 |
*************** |
Link Here
|
1201 |
static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt) |
1156 |
static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt) |
1202 |
{ |
1157 |
{ |
1203 |
int fd; |
1158 |
int fd; |
1204 |
*** mutt-1.5.23-orig/mutt_curses.h 2014-03-12 11:03:45.000000000 -0500 |
1159 |
*** mutt-1.5.23-orig/mutt_curses.h.orig 2015-08-30 19:06:38.000000000 +0200 |
1205 |
--- mutt-1.5.23/mutt_curses.h 2014-04-11 10:14:01.000000000 -0500 |
1160 |
--- mutt-1.5.23/mutt_curses.h 2015-09-10 09:42:34.000000000 +0200 |
1206 |
*************** |
1161 |
@@ -64,6 +64,7 @@ |
1207 |
*** 64,69 **** |
1162 |
#undef lines |
1208 |
--- 64,70 ---- |
1163 |
#endif /* lines */ |
1209 |
#undef lines |
1164 |
|
1210 |
#endif /* lines */ |
1165 |
+#define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol() |
1211 |
|
1166 |
#define CLEARLINE(x) move(x,0), clrtoeol() |
1212 |
+ #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol() |
1167 |
#define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x) |
1213 |
#define CLEARLINE(x) move(x,0), clrtoeol() |
1168 |
#define BEEP() do { if (option (OPTBEEP)) beep(); } while (0) |
1214 |
#define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x) |
1169 |
@@ -121,6 +122,8 @@ |
1215 |
#define BEEP() do { if (option (OPTBEEP)) beep(); } while (0) |
1170 |
MT_COLOR_UNDERLINE, |
1216 |
*************** |
1171 |
MT_COLOR_INDEX, |
1217 |
*** 120,125 **** |
1172 |
MT_COLOR_PROMPT, |
1218 |
--- 121,128 ---- |
1173 |
+ MT_COLOR_NEW, |
1219 |
MT_COLOR_BOLD, |
1174 |
+ MT_COLOR_FLAGGED, |
1220 |
MT_COLOR_UNDERLINE, |
1175 |
MT_COLOR_MAX |
1221 |
MT_COLOR_INDEX, |
1176 |
}; |
1222 |
+ MT_COLOR_NEW, |
1177 |
|
1223 |
+ MT_COLOR_FLAGGED, |
|
|
1224 |
MT_COLOR_MAX |
1225 |
}; |
1226 |
|
1227 |
*** mutt-1.5.23-orig/mutt_menu.h 2014-03-12 11:06:17.000000000 -0500 |
1178 |
*** mutt-1.5.23-orig/mutt_menu.h 2014-03-12 11:06:17.000000000 -0500 |
1228 |
--- mutt-1.5.23/mutt_menu.h 2014-04-11 10:14:01.000000000 -0500 |
1179 |
--- mutt-1.5.23/mutt_menu.h 2014-04-11 10:14:01.000000000 -0500 |
1229 |
*************** |
1180 |
*************** |