}
/**
- * comp_msg_padding_size - Returns the padding between messages.
+ * comp_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size
+ * @param ctx Mailbox
+ * @retval num Number of bytes of padding
*/
static int comp_msg_padding_size(struct Context *ctx)
{
CHECK_ATTACH;
CHECK_MSGCOUNT;
CHECK_VISIBLE;
- ci_send_message (SEND_TO_SENDER, NULL, NULL, Context, tag ? NULL : CURHDR);
+ ci_send_message(SEND_TO_SENDER, NULL, NULL, Context, tag ? NULL : CURHDR);
menu->redraw = REDRAW_FULL;
break;
return 0;
}
+/**
+ * mbox_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size
+ * @param ctx Mailbox
+ * @retval 1 Always
+ */
static int mbox_msg_padding_size(struct Context *ctx)
{
return 1;
}
+/**
+ * mmdf_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size
+ * @param ctx Mailbox
+ * @retval 10 Always
+ */
static int mmdf_msg_padding_size(struct Context *ctx)
{
return 10;
return b;
}
-/* Increases the allocated size of the buffer */
+/**
+ * mutt_buffer_increase_size - Increase the allocated size of a buffer
+ * @param buf Buffer to change
+ * @param new_size New size
+ */
void mutt_buffer_increase_size(struct Buffer *buf, size_t new_size)
{
- if (new_size > buf->dsize)
- {
- size_t offset = buf->dptr - buf->data;
- buf->dsize = new_size;
- mutt_mem_realloc(&buf->data, buf->dsize);
- buf->dptr = buf->data + offset;
- }
+ if (!buf)
+ return;
+
+ if (new_size <= buf->dsize)
+ return;
+
+ size_t offset = buf->dptr - buf->data;
+ buf->dsize = new_size;
+ mutt_mem_realloc(&buf->data, buf->dsize);
+ buf->dptr = buf->data + offset;
}
{
link_errno = errno;
- /*
- * It is historically documented that link can return -1 if NFS
+ /* It is historically documented that link can return -1 if NFS
* dies after creating the link. In that case, we are supposed
* to use stat to check if the link was created.
*
if ((lstat(src, &ssb) == 0) && (lstat(target, &tsb) == 0) &&
(compare_stat(&ssb, &tsb) == 0))
{
- mutt_debug(1, "link (%s, %s) reported failure: %s (%d) but actually succeded\n",
+ mutt_debug(1, "link (%s, %s) reported failure: %s (%d) but actually succeeded\n",
src, target, strerror(errno), errno);
goto success;
}
return -1;
}
- /*
- * Remove the compare_stat() check, because it causes problems with maildir on
- * filesystems that don't properly support hard links, such as
- * sshfs. The filesystem creates the link, but the resulting file
- * is given a different inode number by the sshfs layer. This
- * results in an infinite loop creating links.
+ /* Remove the compare_stat() check, because it causes problems with maildir
+ * on filesystems that don't properly support hard links, such as sshfs. The
+ * filesystem creates the link, but the resulting file is given a different
+ * inode number by the sshfs layer. This results in an infinite loop
+ * creating links.
*/
#if 0
/* Stat both links and check if they are equal. */
if ((rc != 0) && !ctx->quiet)
{
/* L10N: Displayed if a mailbox sync fails */
- mutt_error(_("Unable to write %s!"), ctx->path);
+ mutt_error(_("Unable to write %s"), ctx->path);
}
return rc;
{
bool passive = ImapPassive;
ImapPassive = false;
- int rv = imap_status(path, 0);
+ int rv = imap_status(path, false);
ImapPassive = passive;
return (rv <= 0);
}
return 0;
}
-/* mx_msg_padding_size: Returns the padding size between messages for the
- * mailbox type pointed to by ctx.
+/**
+ * mx_msg_padding_size - Bytes of padding between messages - Wrapper for MxOps::msg_padding_size
+ * @param ctx Mailbox
+ * @retval num Number of bytes of padding
*
* mmdf and mbox add separators, which leads a small discrepancy when computing
* vsize for a limited view.
return (int) (*p - *q);
}
-/* Checks if buf matches the QuoteRegex and doesn't match Smileys.
- * pmatch, if non-null, is populated with the regexec match against
- * QuoteRegex. This is used by the pager for calling classify_quote.
+/**
+ * mutt_is_quote_line - Is a line of message text a quote?
+ * @param[in] line Line to test
+ * @param[out] pmatch Regex sub-matches
+ * @retval true Line is quoted
+ *
+ * Checks if line matches the QuoteRegex and doesn't match Smileys.
+ * This is used by the pager for calling classify_quote.
*/
-int mutt_is_quote_line(char *buf, regmatch_t *pmatch)
+int mutt_is_quote_line(char *line, regmatch_t *pmatch)
{
- int is_quote = 0;
+ bool is_quote = false;
regmatch_t pmatch_internal[1], smatch[1];
char c;
if (!pmatch)
pmatch = pmatch_internal;
- if (QuoteRegex && QuoteRegex->regex && regexec(QuoteRegex->regex, buf, 1, pmatch, 0) == 0)
+ if (QuoteRegex && QuoteRegex->regex && regexec(QuoteRegex->regex, line, 1, pmatch, 0) == 0)
{
- if (Smileys && Smileys->regex && regexec(Smileys->regex, buf, 1, smatch, 0) == 0)
+ if (Smileys && Smileys->regex && regexec(Smileys->regex, line, 1, smatch, 0) == 0)
{
if (smatch[0].rm_so > 0)
{
- c = buf[smatch[0].rm_so];
- buf[smatch[0].rm_so] = 0;
+ c = line[smatch[0].rm_so];
+ line[smatch[0].rm_so] = 0;
- if (regexec(QuoteRegex->regex, buf, 1, pmatch, 0) == 0)
- is_quote = 1;
+ if (regexec(QuoteRegex->regex, line, 1, pmatch, 0) == 0)
+ is_quote = true;
- buf[smatch[0].rm_so] = c;
+ line[smatch[0].rm_so] = c;
}
}
else
- is_quote = 1;
+ is_quote = true;
}
return is_quote;
break;
case OP_COMPOSE_TO_SENDER:
- CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
+ CHECK_MODE(IsHeader(extra) || IsMsgAttach(extra));
CHECK_ATTACH;
- if (IsMsgAttach (extra))
- mutt_attach_mail_sender (extra->fp, extra->hdr, extra->actx, extra->bdy);
+ if (IsMsgAttach(extra))
+ mutt_attach_mail_sender(extra->fp, extra->hdr, extra->actx, extra->bdy);
else
- ci_send_message (SEND_TO_SENDER, NULL, NULL, extra->ctx, extra->hdr);
+ ci_send_message(SEND_TO_SENDER, NULL, NULL, extra->ctx, extra->hdr);
pager_menu->redraw = REDRAW_FULL;
break;
case OP_COMPOSE_TO_SENDER:
CHECK_ATTACH;
- mutt_attach_mail_sender (CURATTACH->fp, hdr, actx,
- menu->tagprefix ? NULL : CURATTACH->content);
+ mutt_attach_mail_sender(CURATTACH->fp, hdr, actx,
+ menu->tagprefix ? NULL : CURATTACH->content);
menu->redraw = REDRAW_FULL;
break;
}
}
+/**
+ * mutt_attach_mail_sender - Compose an email to the sender in the email attachment
+ * @param fp File containing attachment (UNUSED)
+ * @param hdr Header of email (UNUSED)
+ * @param actx Attachment Context
+ * @param cur Current attachment
+ */
void mutt_attach_mail_sender(FILE *fp, struct Header *hdr,
struct AttachCtx *actx, struct Body *cur)
{
}
else if (flags & SEND_TO_SENDER)
{
- mutt_addr_append(&out->to, in->from, 0);
+ mutt_addr_append(&out->to, in->from, false);
}
else
{
if (!curenv)
return -1;
- if (flags & (SEND_REPLY|SEND_TO_SENDER))
+ if (flags & (SEND_REPLY | SEND_TO_SENDER))
{
#ifdef USE_NNTP
if ((flags & SEND_NEWS))
if (flags & SEND_REPLY)
{
mutt_make_misc_reply_headers(env, curenv);
- make_reference_headers (tag ? NULL : curenv, env, ctx);
+ make_reference_headers(tag ? NULL : curenv, env, ctx);
}
}
else if (flags & SEND_FORWARD)