return 0;
}
+/**
+ * comp_path_pretty - Implements MxOps::path_pretty
+ */
+int comp_path_pretty(char *buf, size_t buflen, const char *folder)
+{
+ if (!buf)
+ return -1;
+
+ if (mutt_path_abbr_folder(buf, buflen, folder))
+ return 0;
+
+ if (mutt_path_pretty(buf, buflen, HomeDir))
+ return 0;
+
+ return -1;
+}
+
// clang-format off
/**
* struct mx_comp_ops - Mailbox callback functions for compressed mailboxes
.tags_commit = NULL,
.path_probe = comp_path_probe,
.path_canon = comp_path_canon,
- .path_pretty = NULL,
+ .path_pretty = comp_path_pretty,
};
// clang-format on
return imap_expand_path(buf, buflen);
}
+/**
+ * imap_path_pretty - Implements MxOps::path_pretty
+ */
+int imap_path_pretty(char *buf, size_t buflen, const char *folder)
+{
+ if (!buf || !folder)
+ return -1;
+
+ imap_pretty_mailbox(buf, folder);
+ return 0;
+}
+
// clang-format off
/**
* struct mx_imap_ops - Mailbox callback functions for IMAP mailboxes
.tags_commit = imap_tags_commit,
.path_probe = imap_path_probe,
.path_canon = imap_path_canon,
- .path_pretty = NULL,
+ .path_pretty = imap_path_pretty,
};
// clang-format on
return 0;
}
+/**
+ * maildir_path_pretty - Implements MxOps::path_pretty
+ */
+int maildir_path_pretty(char *buf, size_t buflen, const char *folder)
+{
+ if (!buf)
+ return -1;
+
+ if (mutt_path_abbr_folder(buf, buflen, folder))
+ return 0;
+
+ if (mutt_path_pretty(buf, buflen, HomeDir))
+ return 0;
+
+ return -1;
+}
+
// clang-format off
/**
* struct mx_maildir_ops - Mailbox callback functions for Maildir mailboxes
.tags_commit = NULL,
.path_probe = maildir_path_probe,
.path_canon = maildir_path_canon,
- .path_pretty = NULL,
+ .path_pretty = maildir_path_pretty,
};
/**
.tags_commit = NULL,
.path_probe = mh_path_probe,
.path_canon = maildir_path_canon,
- .path_pretty = NULL,
+ .path_pretty = maildir_path_pretty,
};
// clang-format on
return 0;
}
+/**
+ * mbox_path_pretty - Implements MxOps::path_pretty
+ */
+int mbox_path_pretty(char *buf, size_t buflen, const char *folder)
+{
+ if (!buf)
+ return -1;
+
+ if (mutt_path_abbr_folder(buf, buflen, folder))
+ return 0;
+
+ if (mutt_path_pretty(buf, buflen, HomeDir))
+ return 0;
+
+ return -1;
+}
+
// clang-format off
/**
* struct mx_mbox_ops - Mailbox callback functions for mbox mailboxes
.tags_commit = NULL,
.path_probe = mbox_path_probe,
.path_canon = mbox_path_canon,
- .path_pretty = NULL,
+ .path_pretty = mbox_path_pretty,
};
/**
.tags_commit = NULL,
.path_probe = mbox_path_probe,
.path_canon = mbox_path_canon,
- .path_pretty = NULL,
+ .path_pretty = mbox_path_pretty,
};
// clang-format on
* The slash is omitted when dir or fname is of 0 length.
*/
char *mutt_path_concatn(char *dst, size_t dstlen, const char *dir,
- size_t dirlen, const char *fname, size_t fnamelen)
+ size_t dirlen, const char *fname, size_t fnamelen)
{
size_t req;
size_t offset = 0;
*/
int mx_path_pretty(char *buf, size_t buflen, const char *folder)
{
- return -1;
+ int magic = mx_path_probe(buf, NULL);
+ const struct MxOps *ops = mx_get_ops(magic);
+ if (!ops)
+ return -1;
+
+ if (!ops->path_canon)
+ return -1;
+
+ if (ops->path_canon(buf, buflen, folder) < 0)
+ return -1;
+
+ if (!ops->path_pretty)
+ return -1;
+
+ if (ops->path_pretty(buf, buflen, folder) < 0)
+ return -1;
+
+ return 0;
}
return 0;
}
+/**
+ * nntp_path_pretty - Implements MxOps::path_pretty
+ */
+int nntp_path_pretty(char *buf, size_t buflen, const char *folder)
+{
+ /* Succeed, but don't do anything, for now */
+ return 0;
+}
+
// clang-format off
/**
* struct mx_nntp_ops - Mailbox callback functions for NNTP mailboxes
.tags_commit = NULL,
.path_probe = nntp_path_probe,
.path_canon = nntp_path_canon,
- .path_pretty = NULL,
+ .path_pretty = nntp_path_pretty,
};
// clang-format on
return 0;
}
+/**
+ * nm_path_pretty - Implements MxOps::path_pretty
+ */
+int nm_path_pretty(char *buf, size_t buflen, const char *folder)
+{
+ /* Succeed, but don't do anything, for now */
+ return 0;
+}
+
// clang-format off
/**
* struct mx_notmuch_ops - Mailbox callback functions for Notmuch mailboxes
.tags_commit = nm_tags_commit,
.path_probe = nm_path_probe,
.path_canon = nm_path_canon,
- .path_pretty = NULL,
+ .path_pretty = nm_path_pretty,
};
// clang-format on
return 0;
}
+/**
+ * pop_path_pretty - Implements MxOps::path_pretty
+ */
+int pop_path_pretty(char *buf, size_t buflen, const char *folder)
+{
+ /* Succeed, but don't do anything, for now */
+ return 0;
+}
+
// clang-format off
/**
* mx_pop_ops - Mailbox callback functions for POP mailboxes
.tags_commit = NULL,
.path_probe = pop_path_probe,
.path_canon = pop_path_canon,
- .path_pretty = NULL,
+ .path_pretty = pop_path_pretty,
};
// clang-format on