[neomutt-devel] neomutt NNTP and Active Directory usernames

Reto reto at labrat.space
Sun Apr 7 17:07:54 CEST 2024


On Sun, Apr 07, 2024 at 02:45:26PM +0200, Sirius via neomutt-devel wrote:
> For some reason, it has replaced the '@' with '_' in the path. Is someone
> able to explain to me where in the code this transposition might be
> happening so I can attempt to hack up a fix (I was looking at the code
> last night and did not know where to even begin)

My guess?
Here

```c
/**
 * mutt_encode_path - Convert a path to 'us-ascii'
 * @param buf Buffer for the result
 * @param src Path to convert (OPTIONAL)
 *
 * If `src` is NULL, the path in `buf` will be converted in-place.
 */
void mutt_encode_path(struct Buffer *buf, const char *src)
{
  char *p = mutt_str_dup(src);
  int rc = mutt_ch_convert_string(&p, cc_charset(), "us-ascii", MUTT_ICONV_NO_FLAGS);
  size_t len = buf_strcpy(buf, (rc == 0) ? NONULL(p) : NONULL(src));

  /* convert the path to POSIX "Portable Filename Character Set" */
  for (size_t i = 0; i < len; i++)
  {
    if (!isalnum(buf->data[i]) && !strchr("/.-_", buf->data[i]))
    {
      buf->data[i] = '_';
    }
  }
  FREE(&p);
}
```

called from nntp/newsrc.c:525 in cache_expand()

Cheers,
Reto


More information about the neomutt-devel mailing list