NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
lib.h File Reference

Convenience wrapper for the debug headers. More...

#include <stddef.h>
#include <stdbool.h>
#include "email/lib.h"
#include "core/lib.h"
+ Include dependency graph for lib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void show_backtrace (void)
 Log the program's call stack. More...
 
void add_flag (struct Buffer *buf, bool is_set, const char *name)
 
void dump_addr_list (char *buf, size_t buflen, const struct AddressList *al, const char *name)
 
void dump_attach (const struct AttachPtr *att)
 
void dump_body (const struct Body *body)
 
void dump_email (const struct Email *e)
 
void dump_envelope (const struct Envelope *env)
 
void dump_list_head (const struct ListHead *list, const char *name)
 
void dump_param_list (const struct ParameterList *pl)
 
const char * get_content_disposition (enum ContentDisposition disp)
 
const char * get_content_encoding (enum ContentEncoding enc)
 
const char * get_content_type (enum ContentType type)
 
void dump_graphviz (const char *title, struct Context *ctx)
 
void dump_graphviz_attach_ctx (struct AttachCtx *actx)
 
void dump_graphviz_email (struct Email *e)
 
int debug_all_observer (struct NotifyCallback *nc)
 
const char * get_mailbox_type (enum MailboxType type)
 
void test_parse_set (void)
 Test the config parsing. More...
 
void debug_win_dump (void)
 

Detailed Description

Convenience wrapper for the debug headers.

Authors
  • Richard Russon

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 lib.h.

Function Documentation

◆ show_backtrace()

void show_backtrace ( void  )

Log the program's call stack.

Definition at line 39 of file backtrace.c.

40 {
41  unw_cursor_t cursor;
42  unw_context_t uc;
43  unw_word_t ip, sp;
44  char buf[256];
45 
46  printf("\n%s\n", mutt_make_version());
47  printf("Backtrace\n");
48  mutt_debug(LL_DEBUG1, "\nBacktrace\n");
49  unw_getcontext(&uc);
50  unw_init_local(&cursor, &uc);
51  while (unw_step(&cursor) > 0)
52  {
53  unw_get_reg(&cursor, UNW_REG_IP, &ip);
54  unw_get_reg(&cursor, UNW_REG_SP, &sp);
55  unw_get_proc_name(&cursor, buf, sizeof(buf), &ip);
56  if (buf[0] == '_')
57  break;
58  printf(" %s() ip = %lx, sp = %lx\n", buf, (long) ip, (long) sp);
59  mutt_debug(LL_DEBUG1, " %s() ip = %lx, sp = %lx\n", buf, (long) ip, (long) sp);
60  }
61  printf("\n");
62 }
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
Log at debug level 1.
Definition: logging.h:40
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1476
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_flag()

void add_flag ( struct Buffer buf,
bool  is_set,
const char *  name 
)

Definition at line 144 of file graphviz.c.

145 {
146  if (!buf || !name)
147  return;
148 
149  if (is_set)
150  {
151  if (!mutt_buffer_is_empty(buf))
152  mutt_buffer_addch(buf, ',');
153  mutt_buffer_addstr(buf, name);
154  }
155 }
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:240
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
+ Here is the call graph for this function:

◆ dump_addr_list()

void dump_addr_list ( char *  buf,
size_t  buflen,
const struct AddressList *  al,
const char *  name 
)

Definition at line 38 of file email.c.

39 {
40  if (!buf || !al)
41  return;
42  if (TAILQ_EMPTY(al))
43  return;
44 
45  buf[0] = '\0';
46  mutt_addrlist_write(al, buf, buflen, true);
47  mutt_debug(LL_DEBUG1, "\t%s: %s\n", name, buf);
48 }
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
Log at debug level 1.
Definition: logging.h:40
#define TAILQ_EMPTY(head)
Definition: queue.h:721
size_t mutt_addrlist_write(const struct AddressList *al, char *buf, size_t buflen, bool display)
Write an Address to a buffer.
Definition: address.c:1150
+ Here is the call graph for this function:

◆ dump_attach()

void dump_attach ( const struct AttachPtr att)

Definition at line 321 of file email.c.

322 {
323  if (!att)
324  return;
325 
326  struct Buffer buf = mutt_buffer_make(256);
327 
328  mutt_debug(LL_DEBUG1, "AttachPtr\n");
329 
330 #define ADD_FLAG(F) add_flag(&buf, att->F, #F)
331  ADD_FLAG(unowned);
332  ADD_FLAG(decrypted);
333 #undef ADD_FLAG
334 
335  if (att->fp)
336  mutt_debug(LL_DEBUG1, "\tfp: %p (%d)\n", att->fp, fileno(att->fp));
337  mutt_debug(LL_DEBUG1, "\tparent_type: %d\n", att->parent_type);
338  mutt_debug(LL_DEBUG1, "\tlevel: %d\n", att->level);
339  mutt_debug(LL_DEBUG1, "\tnum: %d\n", att->num);
340 
341  // struct Body *content; ///< Attachment
342  mutt_buffer_dealloc(&buf);
343 }
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
#define ADD_FLAG(F)
int parent_type
Type of parent attachment, e.g. TYPE_MULTIPART.
Definition: attach.h:38
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
int num
Attachment index number.
Definition: attach.h:41
FILE * fp
Used in the recvattach menu.
Definition: attach.h:37
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
Log at debug level 1.
Definition: logging.h:40
int level
Nesting depth of attachment.
Definition: attach.h:40
+ Here is the call graph for this function:

◆ dump_body()

void dump_body ( const struct Body body)

Definition at line 239 of file email.c.

240 {
241  if (!body)
242  return;
243 
244  struct Buffer buf = mutt_buffer_make(256);
245  char arr[256];
246 
247  mutt_debug(LL_DEBUG1, "Body\n");
248 
249 #define ADD_FLAG(F) add_flag(&buf, body->F, #F)
250  ADD_FLAG(attach_qualifies);
251  ADD_FLAG(badsig);
252  ADD_FLAG(collapsed);
253  ADD_FLAG(deleted);
254  ADD_FLAG(force_charset);
255  ADD_FLAG(goodsig);
256 #ifdef USE_AUTOCRYPT
257  ADD_FLAG(is_autocrypt);
258 #endif
259  ADD_FLAG(noconv);
260  ADD_FLAG(tagged);
261  ADD_FLAG(unlink);
262  ADD_FLAG(use_disp);
263  ADD_FLAG(warnsig);
264 #undef ADD_FLAG
265  mutt_debug(LL_DEBUG1, "\tFlags: %s\n",
266  mutt_buffer_is_empty(&buf) ? "[NONE]" : mutt_buffer_string(&buf));
267 
268 #define OPT_STRING(S) \
269  if (body->S) \
270  mutt_debug(LL_DEBUG1, "\t%s: %s\n", #S, body->S)
271  OPT_STRING(charset);
272  OPT_STRING(description);
273  OPT_STRING(d_filename);
274  OPT_STRING(filename);
275  OPT_STRING(form_name);
276  OPT_STRING(language);
277  OPT_STRING(subtype);
278  OPT_STRING(xtype);
279 #undef OPT_STRING
280 
281  mutt_debug(LL_DEBUG1, "\thdr_offset: %ld\n", body->hdr_offset);
282  mutt_debug(LL_DEBUG1, "\toffset: %ld\n", body->offset);
283  mutt_debug(LL_DEBUG1, "\tlength: %ld\n", body->length);
284  mutt_debug(LL_DEBUG1, "\tattach_count: %d\n", body->attach_count);
285 
286  mutt_debug(LL_DEBUG1, "\tcontent type: %s\n", get_content_type(body->type));
287  mutt_debug(LL_DEBUG1, "\tcontent encoding: %s\n", get_content_encoding(body->encoding));
288  mutt_debug(LL_DEBUG1, "\tcontent disposition: %s\n",
290 
291  if (body->stamp != 0)
292  {
293  mutt_date_make_tls(arr, sizeof(arr), body->stamp);
294  mutt_debug(LL_DEBUG1, "\tstamp: %s\n", arr);
295  }
296 
297  dump_param_list(&body->parameter);
298 
299  // struct Content *content; ///< Detailed info about the content of the attachment.
300  // struct Body *next; ///< next attachment in the list
301  // struct Body *parts; ///< parts of a multipart or message/rfc822
302  // struct Email *email; ///< header information for message/rfc822
303  // struct AttachPtr *aptr; ///< Menu information, used in recvattach.c
304  // struct Envelope *mime_headers; ///< Memory hole protected headers
305 
306  if (body->next)
307  {
308  mutt_debug(LL_DEBUG1, "-NEXT-------------------------\n");
309  dump_body(body->next);
310  }
311  if (body->parts)
312  {
313  mutt_debug(LL_DEBUG1, "-PARTS-------------------------\n");
314  dump_body(body->parts);
315  }
316  if (body->next || body->parts)
317  mutt_debug(LL_DEBUG1, "--------------------------\n");
318  mutt_buffer_dealloc(&buf);
319 }
const char * get_content_type(enum ContentType type)
Definition: graphviz.c:75
struct Email * arr[10]
Definition: mailbox.c:256
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
LOFF_T offset
offset where the actual data begins
Definition: body.h:44
#define ADD_FLAG(F)
struct Body * next
next attachment in the list
Definition: body.h:53
void dump_param_list(const struct ParameterList *pl)
Definition: email.c:226
unsigned int disposition
content-disposition, ContentDisposition
Definition: body.h:67
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
int mutt_date_make_tls(char *buf, size_t buflen, time_t timestamp)
Format date in TLS certificate verification style.
Definition: date.c:583
const char * get_content_encoding(enum ContentEncoding enc)
Definition: graphviz.c:104
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
signed short attach_count
Number of attachments.
Definition: body.h:59
unsigned int encoding
content-transfer-encoding, ContentEncoding
Definition: body.h:66
const char * get_content_disposition(enum ContentDisposition disp)
Definition: graphviz.c:127
void dump_body(const struct Body *body)
Definition: email.c:239
LOFF_T length
length (in bytes) of attachment
Definition: body.h:45
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:54
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
unsigned int type
content-type primary type, ContentType
Definition: body.h:65
#define OPT_STRING(S)
Log at debug level 1.
Definition: logging.h:40
time_t stamp
Time stamp of last encoding update.
Definition: body.h:61
long hdr_offset
Offset in stream where the headers begin.
Definition: body.h:42
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
struct ParameterList parameter
parameters of the content-type
Definition: body.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_email()

void dump_email ( const struct Email e)

Definition at line 136 of file email.c.

137 {
138  if (!e)
139  return;
140 
141  struct Buffer buf = mutt_buffer_make(256);
142  char arr[256];
143 
144  mutt_debug(LL_DEBUG1, "Email\n");
145  mutt_debug(LL_DEBUG1, "\tpath: %s\n", e->path);
146 
147 #define ADD_FLAG(F) add_flag(&buf, e->F, #F)
148  ADD_FLAG(active);
149  ADD_FLAG(attach_del);
150  ADD_FLAG(attach_valid);
151  ADD_FLAG(changed);
152  ADD_FLAG(collapsed);
153  ADD_FLAG(deleted);
154  ADD_FLAG(display_subject);
155  ADD_FLAG(expired);
156  ADD_FLAG(flagged);
157  ADD_FLAG(matched);
158  ADD_FLAG(mime);
159  ADD_FLAG(old);
160  ADD_FLAG(purge);
161  ADD_FLAG(quasi_deleted);
162  ADD_FLAG(read);
163  ADD_FLAG(recip_valid);
164  ADD_FLAG(replied);
165  ADD_FLAG(searched);
166  ADD_FLAG(subject_changed);
167  ADD_FLAG(superseded);
168  ADD_FLAG(tagged);
169  ADD_FLAG(threaded);
170  ADD_FLAG(trash);
171  ADD_FLAG(visible);
172 #undef ADD_FLAG
173  mutt_debug(LL_DEBUG1, "\tFlags: %s\n",
174  mutt_buffer_is_empty(&buf) ? "[NONE]" : mutt_buffer_string(&buf));
175 
176 #define ADD_FLAG(F) add_flag(&buf, (e->security & F), #F)
177  mutt_buffer_reset(&buf);
192 #undef ADD_FLAG
193  mutt_debug(LL_DEBUG1, "\tSecurity: %s\n",
194  mutt_buffer_is_empty(&buf) ? "[NONE]" : mutt_buffer_string(&buf));
195 
196  mutt_date_make_tls(arr, sizeof(arr), e->date_sent);
197  mutt_debug(LL_DEBUG1, "\tSent: %s (%c%02u%02u)\n", arr,
198  e->zoccident ? '-' : '+', e->zhours, e->zminutes);
199 
200  mutt_date_make_tls(arr, sizeof(arr), e->received);
201  mutt_debug(LL_DEBUG1, "\tRecv: %s\n", arr);
202 
203  mutt_buffer_dealloc(&buf);
204 
205  mutt_debug(LL_DEBUG1, "\tnum_hidden: %ld\n", e->num_hidden);
206  mutt_debug(LL_DEBUG1, "\trecipient: %d\n", e->recipient);
207  mutt_debug(LL_DEBUG1, "\toffset: %ld\n", e->offset);
208  mutt_debug(LL_DEBUG1, "\tlines: %d\n", e->lines);
209  mutt_debug(LL_DEBUG1, "\tindex: %d\n", e->index);
210  mutt_debug(LL_DEBUG1, "\tmsgno: %d\n", e->msgno);
211  mutt_debug(LL_DEBUG1, "\tvnum: %d\n", e->vnum);
212  mutt_debug(LL_DEBUG1, "\tscore: %d\n", e->score);
213  mutt_debug(LL_DEBUG1, "\tattach_total: %d\n", e->attach_total);
214  // if (e->maildir_flags)
215  // mutt_debug(LL_DEBUG1, "\tmaildir_flags: %s\n", e->maildir_flags);
216 
217  // struct MuttThread *thread
218  // struct Envelope *env
219  // struct Body *content
220  // struct TagList tags
221 
222  // void *edata
223  mutt_buffer_dealloc(&buf);
224 }
int lines
How many lines in the body of this message?
Definition: email.h:85
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:75
short recipient
User_is_recipient()&#39;s return value, cached.
Definition: email.h:78
struct Email * arr[10]
Definition: mailbox.c:256
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
#define ADD_FLAG(F)
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:84
bool zoccident
True, if west of UTC, False if east.
Definition: email.h:65
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:82
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
int mutt_date_make_tls(char *buf, size_t buflen, time_t timestamp)
Format date in TLS certificate verification style.
Definition: date.c:583
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
short attach_total
Number of qualifying attachments in message, if attach_valid.
Definition: email.h:97
int score
Message score.
Definition: email.h:89
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:82
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:88
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:87
size_t num_hidden
Number of hidden messages in this view (only valid when collapsed is set)
Definition: email.h:75
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
Definition: lib.h:85
#define SEC_KEYBLOCK
Email has a key attached.
Definition: lib.h:81
int vnum
Virtual message number.
Definition: email.h:88
unsigned int zhours
Hours away from UTC.
Definition: email.h:63
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
Definition: lib.h:83
#define SEC_BADSIGN
Email has a bad signature.
Definition: lib.h:78
LOFF_T offset
Where in the stream does this message begin?
Definition: email.h:84
#define SEC_SIGN
Email is signed.
Definition: lib.h:76
Log at debug level 1.
Definition: logging.h:40
char * path
Path of Email (for local Mailboxes)
Definition: email.h:92
int index
The absolute (unsorted) message number.
Definition: email.h:86
#define PGP_TRADITIONAL_CHECKED
Email has a traditional (inline) signature.
Definition: lib.h:89
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
#define SEC_GOODSIGN
Email has a valid signature.
Definition: lib.h:77
unsigned int zminutes
Minutes away from UTC.
Definition: email.h:64
#define SEC_PARTSIGN
Not all parts of the email is signed.
Definition: lib.h:79
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:83
int msgno
Number displayed to the user.
Definition: email.h:87
#define SEC_SIGNOPAQUE
Email has an opaque signature (encrypted)
Definition: lib.h:80
+ Here is the call graph for this function:

◆ dump_envelope()

void dump_envelope ( const struct Envelope env)

Definition at line 71 of file email.c.

72 {
73  struct Buffer buf = mutt_buffer_make(256);
74  char arr[1024];
75 
76  mutt_debug(LL_DEBUG1, "Envelope\n");
77 
78 #define ADD_FLAG(F) add_flag(&buf, (env->changed & F), #F)
83 #undef ADD_FLAG
84  mutt_debug(LL_DEBUG1, "\tchanged: %s\n",
85  mutt_buffer_is_empty(&buf) ? "[NONE]" : mutt_buffer_string(&buf));
86 
87 #define ADDR_LIST(AL) dump_addr_list(arr, sizeof(arr), &env->AL, #AL)
88  ADDR_LIST(return_path);
89  ADDR_LIST(from);
90  ADDR_LIST(to);
91  ADDR_LIST(cc);
92  ADDR_LIST(bcc);
93  ADDR_LIST(sender);
94  ADDR_LIST(reply_to);
95  ADDR_LIST(mail_followup_to);
96  ADDR_LIST(x_original_to);
97 #undef ADDR_LIST
98 
99 #define OPT_STRING(S) \
100  if (env->S) \
101  mutt_debug(LL_DEBUG1, "\t%s: %s\n", #S, env->S)
102  OPT_STRING(list_post);
103  OPT_STRING(subject);
104  OPT_STRING(real_subj);
105  OPT_STRING(disp_subj);
106  OPT_STRING(message_id);
107  OPT_STRING(supersedes);
108  OPT_STRING(date);
109  OPT_STRING(x_label);
110  OPT_STRING(organization);
111 #ifdef USE_NNTP
112  OPT_STRING(newsgroups);
113  OPT_STRING(xref);
114  OPT_STRING(followup_to);
115  OPT_STRING(x_comment_to);
116 #endif
117 #undef OPT_STRING
118 
119  dump_list_head(&env->references, "references");
120  dump_list_head(&env->in_reply_to, "in_reply_to");
121  dump_list_head(&env->userhdrs, "userhdrs");
122 
123  if (!mutt_buffer_is_empty(&env->spam))
124  mutt_debug(LL_DEBUG1, "\tspam: %s\n", mutt_buffer_string(&env->spam));
125 
126 #ifdef USE_AUTOCRYPT
127  if (env->autocrypt)
128  mutt_debug(LL_DEBUG1, "\tautocrypt: %p\n", (void *) env->autocrypt);
129  if (env->autocrypt_gossip)
130  mutt_debug(LL_DEBUG1, "\tautocrypt_gossip: %p\n", (void *) env->autocrypt_gossip);
131 #endif
132 
133  mutt_buffer_dealloc(&buf);
134 }
struct AutocryptHeader * autocrypt_gossip
Definition: envelope.h:86
struct Email * arr[10]
Definition: mailbox.c:256
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
struct ListHead userhdrs
user defined headers
Definition: envelope.h:83
#define ADD_FLAG(F)
struct AutocryptHeader * autocrypt
Definition: envelope.h:85
#define ADDR_LIST(AL)
#define MUTT_ENV_CHANGED_SUBJECT
Protected header update.
Definition: envelope.h:35
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
struct ListHead in_reply_to
in-reply-to header content
Definition: envelope.h:82
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
void dump_list_head(const struct ListHead *list, const char *name)
Definition: email.c:50
#define MUTT_ENV_CHANGED_XLABEL
X-Label edited.
Definition: envelope.h:34
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
#define OPT_STRING(S)
Log at debug level 1.
Definition: logging.h:40
#define MUTT_ENV_CHANGED_REFS
References changed to break thread.
Definition: envelope.h:33
#define MUTT_ENV_CHANGED_IRT
In-Reply-To changed to link/break threads.
Definition: envelope.h:32
struct ListHead references
message references (in reverse order)
Definition: envelope.h:81
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
struct Buffer spam
Spam header.
Definition: envelope.h:80
+ Here is the call graph for this function:

◆ dump_list_head()

void dump_list_head ( const struct ListHead *  list,
const char *  name 
)

Definition at line 50 of file email.c.

51 {
52  if (!list || !name)
53  return;
54  if (STAILQ_EMPTY(list))
55  return;
56 
57  struct Buffer buf = mutt_buffer_make(256);
58 
59  struct ListNode *np = NULL;
60  STAILQ_FOREACH(np, list, entries)
61  {
62  if (!mutt_buffer_is_empty(&buf))
63  mutt_buffer_addch(&buf, ',');
64  mutt_buffer_addstr(&buf, np->data);
65  }
66 
67  mutt_debug(LL_DEBUG1, "\t%s: %s\n", name, mutt_buffer_string(&buf));
68  mutt_buffer_dealloc(&buf);
69 }
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:240
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
char * data
String.
Definition: list.h:36
Log at debug level 1.
Definition: logging.h:40
#define STAILQ_EMPTY(head)
Definition: queue.h:348
A List node for strings.
Definition: list.h:34
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_param_list()

void dump_param_list ( const struct ParameterList *  pl)

Definition at line 226 of file email.c.

227 {
228  if (!pl || TAILQ_EMPTY(pl))
229  return;
230 
231  mutt_debug(LL_DEBUG1, "\tparameters\n");
232  struct Parameter *np = NULL;
233  TAILQ_FOREACH(np, pl, entries)
234  {
235  mutt_debug(LL_DEBUG1, "\t\t%s = %s\n", NONULL(np->attribute), NONULL(np->value));
236  }
237 }
char * attribute
Parameter name.
Definition: parameter.h:34
#define NONULL(x)
Definition: string2.h:37
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
char * value
Parameter value.
Definition: parameter.h:35
Log at debug level 1.
Definition: logging.h:40
Attribute associated with a MIME part.
Definition: parameter.h:32
#define TAILQ_EMPTY(head)
Definition: queue.h:721
+ Here is the caller graph for this function:

◆ get_content_disposition()

const char* get_content_disposition ( enum ContentDisposition  disp)

Definition at line 127 of file graphviz.c.

128 {
129  switch (disp)
130  {
131  case DISP_INLINE:
132  return "DISP_INLINE";
133  case DISP_ATTACH:
134  return "DISP_ATTACH";
135  case DISP_FORM_DATA:
136  return "DISP_FORM_DATA";
137  case DISP_NONE:
138  return "DISP_NONE";
139  default:
140  return "UNKNOWN";
141  }
142 }
Content is form-data.
Definition: mime.h:64
Content is attached.
Definition: mime.h:63
No preferred disposition.
Definition: mime.h:65
Content is inline.
Definition: mime.h:62
+ Here is the caller graph for this function:

◆ get_content_encoding()

const char* get_content_encoding ( enum ContentEncoding  enc)

Definition at line 104 of file graphviz.c.

105 {
106  switch (enc)
107  {
108  case ENC_OTHER:
109  return "ENC_OTHER";
110  case ENC_7BIT:
111  return "ENC_7BIT";
112  case ENC_8BIT:
113  return "ENC_8BIT";
115  return "ENC_QUOTED_PRINTABLE";
116  case ENC_BASE64:
117  return "ENC_BASE64";
118  case ENC_BINARY:
119  return "ENC_BINARY";
120  case ENC_UUENCODED:
121  return "ENC_UUENCODED";
122  default:
123  return "UNKNOWN";
124  }
125 }
7-bit text
Definition: mime.h:49
8-bit text
Definition: mime.h:50
Base-64 encoded text.
Definition: mime.h:52
Binary.
Definition: mime.h:53
Quoted-printable text.
Definition: mime.h:51
Encoding unknown.
Definition: mime.h:48
UUEncoded text.
Definition: mime.h:54
+ Here is the caller graph for this function:

◆ get_content_type()

const char* get_content_type ( enum ContentType  type)

Definition at line 75 of file graphviz.c.

76 {
77  switch (type)
78  {
79  case TYPE_OTHER:
80  return "TYPE_OTHER";
81  case TYPE_AUDIO:
82  return "TYPE_AUDIO";
83  case TYPE_APPLICATION:
84  return "TYPE_APPLICATION";
85  case TYPE_IMAGE:
86  return "TYPE_IMAGE";
87  case TYPE_MESSAGE:
88  return "TYPE_MESSAGE";
89  case TYPE_MODEL:
90  return "TYPE_MODEL";
91  case TYPE_MULTIPART:
92  return "TYPE_MULTIPART";
93  case TYPE_TEXT:
94  return "TYPE_TEXT";
95  case TYPE_VIDEO:
96  return "TYPE_VIDEO";
97  case TYPE_ANY:
98  return "TYPE_ANY";
99  default:
100  return "UNKNOWN";
101  }
102 }
Unknown Content-Type.
Definition: mime.h:31
Type: &#39;audio/*&#39;.
Definition: mime.h:32
Type: &#39;*&#39; or &#39;.*&#39;.
Definition: mime.h:40
Type: &#39;video/*&#39;.
Definition: mime.h:39
Type: &#39;text/*&#39;.
Definition: mime.h:38
Type: &#39;message/*&#39;.
Definition: mime.h:35
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
Type: &#39;model/*&#39;.
Definition: mime.h:36
Type: &#39;image/*&#39;.
Definition: mime.h:34
Type: &#39;application/*&#39;.
Definition: mime.h:33
+ Here is the caller graph for this function:

◆ dump_graphviz()

void dump_graphviz ( const char *  title,
struct Context ctx 
)

Definition at line 945 of file graphviz.c.

946 {
947  char name[256] = { 0 };
948  struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
949 
950  time_t now = time(NULL);
951  if (title)
952  {
953  char date[128];
954  mutt_date_localtime_format(date, sizeof(date), "%R", now);
955  snprintf(name, sizeof(name), "%s-%s.gv", date, title);
956  }
957  else
958  {
959  mutt_date_localtime_format(name, sizeof(name), "%R.gv", now);
960  }
961 
962  umask(022);
963  FILE *fp = fopen(name, "w");
964  if (!fp)
965  return;
966 
967  dot_graph_header(fp);
968 
969 #ifndef GV_HIDE_NEOMUTT
970  dot_node(fp, NeoMutt, "NeoMutt", "#ffa500");
972  "NeoMutt->accounts", false, NULL);
973 #ifndef GV_HIDE_CONFIG
974  dot_config(fp, (const char *) NeoMutt->sub, 0, NeoMutt->sub, &links);
975  dot_add_link(&links, NeoMutt, NeoMutt->sub, "NeoMutt Config", false, NULL);
976  struct Buffer buf = mutt_buffer_make(256);
977  char obj1[16] = { 0 };
978  char obj2[16] = { 0 };
979  dot_ptr_name(obj1, sizeof(obj1), NeoMutt);
980  dot_ptr_name(obj2, sizeof(obj2), NeoMutt->sub);
981  mutt_buffer_printf(&buf, "{ rank=same %s %s }", obj1, obj2);
983  mutt_buffer_dealloc(&buf);
984 #endif
985 #endif
986 
987  dot_account_list(fp, &NeoMutt->accounts, &links);
988 
989 #ifndef GV_HIDE_CONTEXT
990  if (ctx)
991  dot_context(fp, ctx, &links);
992 
993 #ifndef GV_HIDE_NEOMUTT
994  /* Globals */
995  fprintf(fp, "\t{ rank=same ");
996  if (ctx)
997  {
998  dot_ptr_name(name, sizeof(name), ctx);
999  fprintf(fp, "%s ", name);
1000  }
1001  dot_ptr_name(name, sizeof(name), NeoMutt);
1002  fprintf(fp, "%s ", name);
1003  fprintf(fp, "}\n");
1004 #endif
1005 #endif
1006 
1007  fprintf(fp, "\t{ rank=same ");
1008  struct Account *np = NULL;
1009  TAILQ_FOREACH(np, &NeoMutt->accounts, entries)
1010  {
1011 #ifdef GV_HIDE_MBOX
1012  if (np->type == MUTT_MBOX)
1013  continue;
1014 #endif
1015  dot_ptr_name(name, sizeof(name), np);
1016  fprintf(fp, "%s ", name);
1017  }
1018  fprintf(fp, "}\n");
1019 
1020  dot_graph_footer(fp, &links);
1021  fclose(fp);
1022  mutt_list_free(&links);
1023 }
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:691
#define TAILQ_FIRST(head)
Definition: queue.h:723
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
struct AccountList accounts
List of all Accounts.
Definition: neomutt.h:40
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
A group of associated Mailboxes.
Definition: account.h:36
String manipulation buffer.
Definition: buffer.h:33
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:370
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:38
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
Container for Accounts, Notifications.
Definition: neomutt.h:36
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
static void dot_add_link(struct ListHead *links, void *src, void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:272
static void dot_graph_footer(FILE *fp, struct ListHead *links)
Definition: graphviz.c:319
static void dot_config(FILE *fp, const char *name, int type, struct ConfigSubset *sub, struct ListHead *links)
Definition: graphviz.c:421
static void dot_account_list(FILE *fp, struct AccountList *al, struct ListHead *links)
Definition: graphviz.c:915
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
static void dot_node(FILE *fp, void *ptr, const char *name, const char *colour)
Definition: graphviz.c:354
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:48
static void dot_context(FILE *fp, struct Context *ctx, struct ListHead *links)
Definition: graphviz.c:933
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:250
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
static void dot_graph_header(FILE *fp)
Definition: graphviz.c:296
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_graphviz_attach_ctx()

void dump_graphviz_attach_ctx ( struct AttachCtx actx)

Definition at line 1590 of file graphviz.c.

1591 {
1592  char name[256] = { 0 };
1593  struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
1594 
1595  time_t now = time(NULL);
1596  mutt_date_localtime_format(name, sizeof(name), "%R-actx.gv", now);
1597 
1598  umask(022);
1599  FILE *fp = fopen(name, "w");
1600  if (!fp)
1601  return;
1602 
1603  dot_graph_header(fp);
1604 
1605  dot_attach_ctx(fp, actx, &links);
1606 
1607  dot_graph_footer(fp, &links);
1608  fclose(fp);
1609  mutt_list_free(&links);
1610 }
char * name
Name of Account.
Definition: account.h:39
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:691
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
static void dot_graph_footer(FILE *fp, struct ListHead *links)
Definition: graphviz.c:319
static void dot_attach_ctx(FILE *fp, struct AttachCtx *actx, struct ListHead *links)
Definition: graphviz.c:1551
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
static void dot_graph_header(FILE *fp)
Definition: graphviz.c:296
+ Here is the call graph for this function:

◆ dump_graphviz_email()

void dump_graphviz_email ( struct Email e)

Definition at line 1428 of file graphviz.c.

1429 {
1430  char name[256] = { 0 };
1431  struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
1432 
1433  time_t now = time(NULL);
1434  mutt_date_localtime_format(name, sizeof(name), "%R-email.gv", now);
1435 
1436  umask(022);
1437  FILE *fp = fopen(name, "w");
1438  if (!fp)
1439  return;
1440 
1441  dot_graph_header(fp);
1442 
1443  dot_email(fp, e, &links);
1444 
1445  dot_graph_footer(fp, &links);
1446  fclose(fp);
1447  mutt_list_free(&links);
1448 }
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:691
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
static void dot_graph_footer(FILE *fp, struct ListHead *links)
Definition: graphviz.c:319
static void dot_email(FILE *fp, struct Email *e, struct ListHead *links)
Definition: graphviz.c:1309
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
static void dot_graph_header(FILE *fp)
Definition: graphviz.c:296
+ Here is the call graph for this function:

◆ debug_all_observer()

int debug_all_observer ( struct NotifyCallback nc)

Definition at line 318 of file notify.c.

319 {
320  mutt_debug(LL_DEBUG1, "\033[1;31mNotification:\033[0m %s\n", get_event_type(nc->event_type));
321 
322  switch (nc->event_type)
323  {
324  case NT_ACCOUNT:
326  break;
327  case NT_COLOR:
328  notify_dump_color(nc);
329  break;
330  case NT_COMMAND:
332  break;
333  case NT_CONFIG:
334  notify_dump_config(nc);
335  break;
336  case NT_CONTEXT:
338  break;
339  case NT_EMAIL:
340  notify_dump_email(nc);
341  break;
342  case NT_GLOBAL:
343  notify_dump_global(nc);
344  break;
345  case NT_MAILBOX:
347  break;
348  case NT_WINDOW:
349  if (nc->event_subtype == NT_WINDOW_STATE)
351  else if (nc->event_subtype == NT_WINDOW_FOCUS)
353  break;
354  default:
355  mutt_debug(LL_DEBUG1, " Event Type: %d\n", nc->event_type);
356  mutt_debug(LL_DEBUG1, " Event Sub-type: %d\n", nc->event_subtype);
357  mutt_debug(LL_DEBUG1, " Event Data: %p\n", nc->event_data);
358  break;
359  }
360 
361  mutt_debug(LL_DEBUG1, " Global Data: %p\n", nc->global_data);
362 
363  mutt_debug(LL_DEBUG5, "debug done\n");
364  return 0;
365 }
static void notify_dump_window_state(struct NotifyCallback *nc)
Definition: notify.c:252
static const char * get_event_type(enum NotifyType type)
Definition: notify.c:43
static void notify_dump_email(struct NotifyCallback *nc)
Definition: notify.c:227
static void notify_dump_window_focus(struct NotifyCallback *nc)
Definition: notify.c:288
Window focus has changed.
Definition: mutt_window.h:209
A Command has been executed, Command.
Definition: notify_type.h:40
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:53
static void notify_dump_color(struct NotifyCallback *nc)
Definition: notify.c:168
static void notify_dump_config(struct NotifyCallback *nc)
Definition: notify.c:205
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
static void notify_dump_context(struct NotifyCallback *nc)
Definition: notify.c:216
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:207
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:39
static void notify_dump_command(struct NotifyCallback *nc)
Definition: notify.c:195
Account has changed, NotifyAccount, EventAccount.
Definition: notify_type.h:34
Not object-related, NotifyGlobal.
Definition: notify_type.h:45
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
void * event_data
Data from notify_send()
Definition: observer.h:44
Email has changed, NotifyEmail, EventEmail.
Definition: notify_type.h:44
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:42
Context has changed, NotifyContext, EventContext.
Definition: notify_type.h:43
Log at debug level 1.
Definition: logging.h:40
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:48
Log at debug level 5.
Definition: logging.h:44
static void notify_dump_global(struct NotifyCallback *nc)
Definition: notify.c:238
static void notify_dump_mailbox(struct NotifyCallback *nc)
Definition: notify.c:243
static void notify_dump_account(struct NotifyCallback *nc)
Definition: notify.c:159
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_mailbox_type()

const char* get_mailbox_type ( enum MailboxType  type)

Definition at line 70 of file notify.c.

71 {
72  switch (type)
73  {
74  case MUTT_COMPRESSED:
75  return "compressed";
76  case MUTT_IMAP:
77  return "imap";
78  case MUTT_MAILDIR:
79  return "maildir";
80  case MUTT_MBOX:
81  return "mbox";
82  case MUTT_MH:
83  return "mh";
84  case MUTT_MMDF:
85  return "mmdf";
86  case MUTT_NNTP:
87  return "nntp";
88  case MUTT_NOTMUCH:
89  return "notmuch";
90  case MUTT_POP:
91  return "pop";
92  default:
93  return "UNKNOWN";
94  }
95 }
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: mailbox.h:52
&#39;Maildir&#39; Mailbox type
Definition: mailbox.h:51
&#39;POP3&#39; Mailbox type
Definition: mailbox.h:55
&#39;mmdf&#39; Mailbox type
Definition: mailbox.h:49
Compressed file Mailbox type.
Definition: mailbox.h:56
&#39;MH&#39; Mailbox type
Definition: mailbox.h:50
&#39;Notmuch&#39; (virtual) Mailbox type
Definition: mailbox.h:54
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:48
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:53
+ Here is the caller graph for this function:

◆ test_parse_set()

void test_parse_set ( void  )

Test the config parsing.

Definition at line 39 of file parse_test.c.

40 {
41  const char *vars[] = {
42  "from", // ADDRESS
43  "beep", // BOOL
44  "ispell", // COMMAND
45  "mbox_type", // ENUM
46  "to_chars", // MBTABLE
47  "net_inc", // NUMBER
48  "signature", // PATH
49  "print", // QUAD
50  "mask", // REGEX
51  "sort", // SORT
52  "attribution", // STRING
53  "zzz", // UNKNOWN
54  "my_var", // MY_VAR
55  };
56 
57  const char *commands[] = {
58  "set",
59  "toggle",
60  "reset",
61  "unset",
62  };
63 
64  const char *tests[] = {
65  "%s %s", "%s %s=42", "%s %s?", "%s ?%s", "%s ?%s=42",
66  "%s ?%s?", "%s no%s", "%s no%s=42", "%s no%s?", "%s inv%s",
67  "%s inv%s=42", "%s inv%s?", "%s &%s", "%s &%s=42", "%s &%s?",
68  };
69 
70  struct Buffer err = mutt_buffer_make(256);
71  char line[64];
72 
73  for (size_t v = 0; v < mutt_array_size(vars); v++)
74  {
75  // printf("--------------------------------------------------------------------------------\n");
76  // printf("VARIABLE %s\n", vars[v]);
77  for (size_t c = 0; c < mutt_array_size(commands); c++)
78  {
79  // printf("----------------------------------------\n");
80  // printf("COMMAND %s\n", commands[c]);
81  for (size_t t = 0; t < mutt_array_size(tests); t++)
82  {
83  mutt_buffer_reset(&err);
84 
85  snprintf(line, sizeof(line), tests[t], commands[c], vars[v]);
86  printf("%-26s", line);
87  enum CommandResult rc = mutt_parse_rc_line(line, &err);
88  printf("%2d %s\n", rc, err.data);
89  }
90  printf("\n");
91  }
92  // printf("\n");
93  }
94 
95  mutt_buffer_dealloc(&err);
96 }
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
CommandResult
Error codes for command_t parse functions.
Definition: mutt_commands.h:34
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
enum CommandResult mutt_parse_rc_line(const char *line, struct Buffer *err)
Parse a line of user config.
Definition: init.c:1039
#define mutt_array_size(x)
Definition: memory.h:33
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
char * data
Pointer to data.
Definition: buffer.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ debug_win_dump()

void debug_win_dump ( void  )

Definition at line 91 of file window.c.

92 {
94  mutt_debug(LL_DEBUG1, "\n");
95  win_dump(RootWindow, 0);
96  mutt_debug(LL_DEBUG1, "\n");
97  struct Buffer buf = mutt_buffer_make(1024);
99  mutt_debug(LL_DEBUG1, "%s\n", mutt_buffer_string(&buf));
100  mutt_buffer_dealloc(&buf);
101  win_focus = NULL;
102 }
static void win_serialise(struct MuttWindow *win, struct Buffer *buf)
Definition: window.c:75
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
static void win_dump(struct MuttWindow *win, int indent)
Definition: window.c:56
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
static struct MuttWindow * win_focus
Definition: window.c:36
struct MuttWindow * window_get_focus(void)
Get the currently focussed Window.
Definition: mutt_window.c:664
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: rootwin.c:105
Log at debug level 1.
Definition: logging.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function: