Home/ posts/ subfolder support for mutt-patched

I've written some days ago a patch for the mutt sidebar patch in order to enable subfolder support there.

The big issue was that if there were folders as "Debian/mc/commits" they were displayed as "commits". So everything before the last / is cutted of.

In order to fix this I've to replace this piece of code:

 const char *basename (const char *f)
{
  const char *p = strrchr (f, '/');
  if (p)
    return p + 1;
  else
    return f;
}

with this piece of code:

char *sidebar_foldername(const char *folder) {
  char *p = strstr (folder, NONULL(Spoolfile));
  if ( (p) && !strcmp(folder, p) )
    return p + strlen(NONULL(Spoolfile)) + 1;
  else {
    p = strrchr (folder, '/');
    if (p)
      return p + 1;
  }
  return folder;
}

and (of course) fix the function call in draw_sidebar ;-).

And hey.. subfolders are displayed correctly now in the sidebar. I've send the patch to the debian maintainer and I'll hope that he like it. :)

Tags:

Attachments

Last edited Mi 05 Mär 2008 13:20:37 CET