]> git.llucax.com Git - software/mutt-debian.git/blob - debian/patches/mutt-patched/sidebar-dotted
incorporating fixes of http://bugs.mutt.org/3308 into the existing patch
[software/mutt-debian.git] / debian / patches / mutt-patched / sidebar-dotted
1 From: Evgeni Golov <sargentd@die-welt.net>
2 License: 3-BSD
3
4 When using IMAP, a '.' is often used as a separator instead of '/'.
5 This patch enables mutt to find these dots and
6 1. correctly intend the dir in the sidebar
7 2. if "sidebar_shortpath" is set, shorten the dir to the part after
8    the last dot
9
10 I hope, it's usefull for someone ;)
11
12 Index: mutt/sidebar.c
13 ===================================================================
14 --- mutt.orig/sidebar.c 2009-06-25 12:36:53.000000000 +0200
15 +++ mutt/sidebar.c      2009-06-25 12:36:59.000000000 +0200
16 @@ -255,14 +255,23 @@
17                         int i;
18                         tmp_folder_name = tmp->path + strlen(Maildir);
19                         for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
20 -                               if (tmp_folder_name[i] == '/') sidebar_folder_depth++;
21 +                               if (tmp_folder_name[i] == '/'  || tmp_folder_name[i] == '.') sidebar_folder_depth++;
22                         }
23                         if (sidebar_folder_depth > 0) {
24 -                               sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1);
25 +                               if (option(OPTSIDEBARSHORTPATH)) {
26 +                                       tmp_folder_name = strrchr(tmp->path, '.');
27 +                                       if (tmp_folder_name == NULL)
28 +                                               tmp_folder_name = tmp->path;
29 +                                       else
30 +                                               tmp_folder_name++;
31 +                               }
32 +                               else
33 +                                       tmp_folder_name = tmp->path;
34 +                               sidebar_folder_name = malloc(strlen(basename(tmp_folder_name)) + sidebar_folder_depth + 1);
35                                 for (i=0; i < sidebar_folder_depth; i++)
36                                         sidebar_folder_name[i]=' ';
37                                 sidebar_folder_name[i]=0;
38 -                               strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth);
39 +                               strncat(sidebar_folder_name, basename(tmp_folder_name), strlen(basename(tmp_folder_name)) + sidebar_folder_depth);
40                         }
41                 }
42                 printw( "%.*s", SidebarWidth - delim_len + 1,
43 Index: mutt/init.h
44 ===================================================================
45 --- mutt.orig/init.h    2009-06-25 12:36:53.000000000 +0200
46 +++ mutt/init.h 2009-06-25 12:36:59.000000000 +0200
47 @@ -1969,6 +1969,11 @@
48    ** .pp
49    ** The width of the sidebar.
50    */
51 +  { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
52 +  /*
53 +  ** .pp
54 +  ** Should the sidebar shorten the path showed.
55 +  */
56    { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
57    /*
58    ** .pp
59 Index: mutt/mutt.h
60 ===================================================================
61 --- mutt.orig/mutt.h    2009-06-25 12:36:53.000000000 +0200
62 +++ mutt/mutt.h 2009-06-25 12:36:59.000000000 +0200
63 @@ -426,6 +426,7 @@
64    OPTSAVENAME,
65    OPTSCORE,
66    OPTSIDEBAR,
67 +  OPTSIDEBARSHORTPATH,
68    OPTSIGDASHES,
69    OPTSIGONTOP,
70    OPTSORTRE,