RFC3676 Format Flowed routines. More...
#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "rfc3676.h"
Go to the source code of this file.
Data Structures | |
struct | FlowedState |
State of a Format-Flowed line of text. More... | |
Macros | |
#define | FLOWED_MAX 72 |
Functions | |
static int | get_quote_level (const char *line) |
Get the quote level of a line. | |
static int | space_quotes (struct State *state) |
Should we add spaces between quote levels. | |
static bool | add_quote_suffix (struct State *state, int ql) |
Should we add a trailing space to quotes. | |
static size_t | print_indent (int ql, struct State *state, int add_suffix) |
Print indented text. | |
static void | flush_par (struct State *state, struct FlowedState *fst) |
Write out the paragraph. | |
static int | quote_width (struct State *state, int ql) |
Calculate the paragraph width based upon the quote level. | |
static void | print_flowed_line (char *line, struct State *state, int ql, struct FlowedState *fst, bool term) |
Print a format-flowed line. | |
static void | print_fixed_line (const char *line, struct State *state, int ql, struct FlowedState *fst) |
Print a fixed format line. | |
int | rfc3676_handler (struct Body *b_email, struct State *state) |
Handler for format=flowed - Implements handler_t -. | |
bool | mutt_rfc3676_is_format_flowed (struct Body *b) |
Is the Email "format-flowed"? | |
static void | rfc3676_space_stuff (const char *filename, bool unstuff) |
Perform required RFC3676 space stuffing. | |
void | mutt_rfc3676_space_stuff (struct Email *e) |
Perform RFC3676 space stuffing on an Email. | |
void | mutt_rfc3676_space_unstuff (struct Email *e) |
Remove RFC3676 space stuffing. | |
void | mutt_rfc3676_space_unstuff_attachment (struct Body *b, const char *filename) |
Unstuff attachments. | |
void | mutt_rfc3676_space_stuff_attachment (struct Body *b, const char *filename) |
Stuff attachments. | |
RFC3676 Format Flowed routines.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file rfc3676.c.
|
static |
Get the quote level of a line.
line | Text to examine |
num | Quote level |
Definition at line 63 of file rfc3676.c.
|
static |
Should we add spaces between quote levels.
state | State to use |
true | Spaces should be added |
Determines whether to add spacing between/after each quote level: >>>foo
becomes > > > foo
Definition at line 87 of file rfc3676.c.
|
static |
Should we add a trailing space to quotes.
state | State to use |
ql | Quote level |
true | Spaces should be added |
Determines whether to add a trailing space to quotes: >>> foo
as opposed to >>>foo
Definition at line 110 of file rfc3676.c.
|
static |
Print indented text.
ql | Quote level |
state | State to work with |
add_suffix | If true, write a trailing space character |
num | Number of characters written |
Definition at line 136 of file rfc3676.c.
|
static |
|
static |
Calculate the paragraph width based upon the quote level.
state | State to use |
ql | Quote level |
num | Paragraph width |
The start of a quoted line will be ">>> ", so we need to subtract the space required for the prefix from the terminal width.
Definition at line 194 of file rfc3676.c.
|
static |
Print a format-flowed line.
line | Text to print |
state | State to work with |
ql | Quote level |
fst | State of the flowed text |
term | If true, terminate with a new line |
Definition at line 228 of file rfc3676.c.
|
static |
Print a fixed format line.
Definition at line 307 of file rfc3676.c.
bool mutt_rfc3676_is_format_flowed | ( | struct Body * | b | ) |
Is the Email "format-flowed"?
true | Email is "format-flowed" |
Definition at line 394 of file rfc3676.c.
|
static |
Perform required RFC3676 space stuffing.
filename | Attachment file |
unstuff | If true, remove space stuffing |
Space stuffing means that we have to add leading spaces to certain lines:
Care is taken to preserve the e->body->filename, as mutt -i -E can directly edit a passed in filename.
Definition at line 419 of file rfc3676.c.
void mutt_rfc3676_space_stuff | ( | struct Email * | e | ) |
Perform RFC3676 space stuffing on an Email.
e |
$text_flowed
because we want to stuff based the actual content type. The option only decides whether to set format=flowed on new messages. Definition at line 486 of file rfc3676.c.
void mutt_rfc3676_space_unstuff | ( | struct Email * | e | ) |
void mutt_rfc3676_space_unstuff_attachment | ( | struct Body * | b, |
const char * | filename | ||
) |
Unstuff attachments.
This routine is used when saving/piping/viewing rfc3676 attachments.
If b is provided, the function will verify that the Email is format-flowed. The filename will be unstuffed, not b->filename or b->fp.
Definition at line 518 of file rfc3676.c.
void mutt_rfc3676_space_stuff_attachment | ( | struct Body * | b, |
const char * | filename | ||
) |
Stuff attachments.
This routine is used when filtering rfc3676 attachments.
If b is provided, the function will verify that the Email is format-flowed. The filename will be unstuffed, not b->filename or b->fp.
Definition at line 539 of file rfc3676.c.