]> git.llucax.com Git - software/mutt-debian.git/blob - debian/patches/mutt-patched/sidebar-sorted
Merge branch 'upstream' of ssh://antonio-guest@git.debian.org/git/pkg-mutt/mutt
[software/mutt-debian.git] / debian / patches / mutt-patched / sidebar-sorted
1 From: Evgeni Golov <sargentd@die-welt.net>
2 License: 3-BSD
3
4 When using IMAP and imap_check_subscribed, the server reports the
5 dirs in a random order.
6 This patch introduces a new option, sidebar_sort. Which, when it is
7 set, sorts the dirs in the sidebar alphabetically.
8
9 I hope, it's usefull for someone ;)
10
11 PS: This has to be applied ontop of my sidebar-dotted patch, but it
12 should be easy to adopt it to a vanilla mutt.
13
14 Index: mutt/sidebar.c
15 ===================================================================
16 --- mutt.orig/sidebar.c 2009-06-25 12:36:59.000000000 +0200
17 +++ mutt/sidebar.c      2009-06-25 12:37:03.000000000 +0200
18 @@ -54,6 +54,35 @@
19         for ( ; tmp->next != 0; tmp = tmp->next )
20                 tmp->next->prev = tmp;
21  
22 +       if (option(OPTSIDEBARSORT)) {
23 +               int needsort=1;
24 +               BUFFY *prev;
25 +               BUFFY *next;
26 +               BUFFY *tmp2;
27 +               while (needsort==1) {
28 +                       needsort=0;
29 +                       tmp = Incoming;
30 +                       for ( ; tmp ; tmp=tmp->next ) {
31 +                               if (tmp->next != NULL && strcmp(tmp->path, tmp->next->path) > 0) {
32 +                                       needsort=1;
33 +                                       prev = tmp->prev;
34 +                                       next = tmp->next;
35 +                                       if (prev != NULL)
36 +                                               prev->next = next;
37 +                                       else
38 +                                               Incoming = next;
39 +                                       next->prev = prev;
40 +                                       tmp2 = next->next;
41 +                                       next->next = tmp;
42 +                                       tmp->prev = next;
43 +                                       tmp->next = tmp2;
44 +                                       if (tmp2 != NULL)
45 +                                               tmp2->prev = tmp;
46 +                               }
47 +                       }
48 +               }
49 +       }
50 +
51         if ( TopBuffy == 0 && BottomBuffy == 0 )
52                 TopBuffy = Incoming;
53         if ( BottomBuffy == 0 ) {
54 Index: mutt/init.h
55 ===================================================================
56 --- mutt.orig/init.h    2009-06-25 12:36:59.000000000 +0200
57 +++ mutt/init.h 2009-06-25 12:37:03.000000000 +0200
58 @@ -1974,6 +1974,11 @@
59    ** .pp
60    ** Should the sidebar shorten the path showed.
61    */
62 +  { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 },
63 +  /*
64 +  ** .pp
65 +  ** Should the sidebar be sorted.
66 +  */
67    { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
68    /*
69    ** .pp
70 Index: mutt/mutt.h
71 ===================================================================
72 --- mutt.orig/mutt.h    2009-06-25 12:36:59.000000000 +0200
73 +++ mutt/mutt.h 2009-06-25 12:37:03.000000000 +0200
74 @@ -427,6 +427,7 @@
75    OPTSCORE,
76    OPTSIDEBAR,
77    OPTSIDEBARSHORTPATH,
78 +  OPTSIDEBARSORT,
79    OPTSIGDASHES,
80    OPTSIGONTOP,
81    OPTSORTRE,