NeoMutt  2020-06-26-250-g349c94
Teaching an old dog new tricks
DOXYGEN
graphviz.c File Reference

Create a GraphViz dot file from the NeoMutt objects. More...

#include "config.h"
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include "mutt/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "conn/lib.h"
#include "lib.h"
#include "context.h"
#include "imap/private.h"
#include "maildir/private.h"
#include "mutt_globals.h"
#include "notmuch/private.h"
#include "pop/private.h"
#include "compmbox/lib.h"
#include "maildir/lib.h"
#include "mbox/lib.h"
#include "nntp/lib.h"
#include "notmuch/lib.h"
+ Include dependency graph for graphviz.c:

Go to the source code of this file.

Macros

#define GV_HIDE_CONTEXT_CONTENTS
 
#define ADD_BOOL(F)   add_flag(&buf, cont->F, #F)
 
#define ADD_BOOL(F)   add_flag(&buf, b->F, #F)
 
#define ADD_FLAG(F)   add_flag(&buf, (env->changed & F), #F)
 
#define ADDR_LIST(AL)   dot_addr_list(fp, #AL, &env->AL, links)
 
#define ADD_BOOL(F)   add_flag(&buf, e->F, #F)
 
#define ADD_BOOL(F)   add_flag(&buf, (e->security & F), #F)
 

Functions

static void dot_email (FILE *fp, struct Email *e, struct ListHead *links)
 
static void dot_envelope (FILE *fp, const struct Envelope *env, struct ListHead *links)
 
const char * get_content_type (enum ContentType type)
 
const char * get_content_encoding (enum ContentEncoding enc)
 
const char * get_content_disposition (enum ContentDisposition disp)
 
void add_flag (struct Buffer *buf, bool is_set, const char *name)
 
static void dot_type_bool (FILE *fp, const char *name, bool val)
 
static void dot_type_char (FILE *fp, const char *name, char ch)
 
static void dot_type_date (char *buf, size_t buflen, time_t timestamp)
 
static void dot_type_file (FILE *fp, const char *name, FILE *struct_fp)
 
static void dot_type_number (FILE *fp, const char *name, int num)
 
static void dot_type_string_escape (char *buf, size_t buflen)
 
static void dot_type_string (FILE *fp, const char *name, const char *str, bool force)
 
static void dot_type_umask (char *buf, size_t buflen, int umask)
 
static void dot_ptr_name (char *buf, size_t buflen, const void *ptr)
 
static void dot_ptr (FILE *fp, const char *name, void *ptr, const char *colour)
 
static void dot_add_link (struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
 
static void dot_graph_header (FILE *fp)
 
static void dot_graph_footer (FILE *fp, struct ListHead *links)
 
static void dot_object_header (FILE *fp, const void *ptr, const char *name, const char *colour)
 
static void dot_object_footer (FILE *fp)
 
static void dot_node (FILE *fp, void *ptr, const char *name, const char *colour)
 
static void dot_node_link (FILE *fp, void *ptr, const char *name, void *link, const char *colour)
 
static void dot_path_fs (char *buf, size_t buflen, const char *path)
 
static void dot_path_imap (char *buf, size_t buflen, const char *path)
 
static void dot_config (FILE *fp, const char *name, int type, struct ConfigSubset *sub, struct ListHead *links)
 
static void dot_comp (FILE *fp, struct CompressInfo *ci, struct ListHead *links)
 
static void dot_mailbox_type (FILE *fp, const char *name, enum MailboxType type)
 
static void dot_mailbox_imap (FILE *fp, struct ImapMboxData *mdata, struct ListHead *links)
 
static void dot_mailbox_maildir (FILE *fp, struct MaildirMboxData *mdata, struct ListHead *links)
 
static void dot_mailbox_mbox (FILE *fp, struct MboxAccountData *mdata, struct ListHead *links)
 
static void dot_mailbox_nntp (FILE *fp, struct NntpMboxData *mdata, struct ListHead *links)
 
static void dot_mailbox_notmuch (FILE *fp, struct NmMboxData *mdata, struct ListHead *links)
 
static void dot_mailbox_pop (FILE *fp, struct PopAccountData *mdata, struct ListHead *links)
 
static void dot_mailbox (FILE *fp, struct Mailbox *m, struct ListHead *links)
 
static void dot_mailbox_node (FILE *fp, struct MailboxNode *mn, struct ListHead *links)
 
static void dot_mailbox_list (FILE *fp, struct MailboxList *ml, struct ListHead *links, bool abbr)
 
static void dot_connection (FILE *fp, struct Connection *c, struct ListHead *links)
 
static void dot_account_imap (FILE *fp, struct ImapAccountData *adata, struct ListHead *links)
 
static void dot_account_mbox (FILE *fp, struct MboxAccountData *adata, struct ListHead *links)
 
static void dot_account_nntp (FILE *fp, struct NntpAccountData *adata, struct ListHead *links)
 
static void dot_account_notmuch (FILE *fp, struct NmAccountData *adata, struct ListHead *links)
 
static void dot_account_pop (FILE *fp, struct PopAccountData *adata, struct ListHead *links)
 
static void dot_account (FILE *fp, struct Account *a, struct ListHead *links)
 
static void dot_account_list (FILE *fp, struct AccountList *al, struct ListHead *links)
 
static void dot_context (FILE *fp, struct Context *ctx, struct ListHead *links)
 
void dump_graphviz (const char *title)
 
static void dot_parameter_list (FILE *fp, const char *name, const struct ParameterList *pl)
 
static void dot_content (FILE *fp, struct Content *cont, struct ListHead *links)
 
static void dot_attach_ptr (FILE *fp, struct AttachPtr *aptr, struct ListHead *links)
 
static void dot_body (FILE *fp, const struct Body *b, struct ListHead *links, bool link_next)
 
static void dot_list_head (FILE *fp, const char *name, const struct ListHead *list)
 
static void dot_addr_list (FILE *fp, const char *name, const struct AddressList *al, struct ListHead *links)
 
void dump_graphviz_email (struct Email *e)
 

Detailed Description

Create a GraphViz dot file from the NeoMutt objects.

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 graphviz.c.

Macro Definition Documentation

◆ GV_HIDE_CONTEXT_CONTENTS

#define GV_HIDE_CONTEXT_CONTENTS

Definition at line 52 of file graphviz.c.

◆ ADD_BOOL [1/4]

#define ADD_BOOL (   F)    add_flag(&buf, cont->F, #F)

◆ ADD_BOOL [2/4]

#define ADD_BOOL (   F)    add_flag(&buf, b->F, #F)

◆ ADD_FLAG

#define ADD_FLAG (   F)    add_flag(&buf, (env->changed & F), #F)

◆ ADDR_LIST

#define ADDR_LIST (   AL)    dot_addr_list(fp, #AL, &env->AL, links)

◆ ADD_BOOL [3/4]

#define ADD_BOOL (   F)    add_flag(&buf, e->F, #F)

◆ ADD_BOOL [4/4]

#define ADD_BOOL (   F)    add_flag(&buf, (e->security & F), #F)

Function Documentation

◆ dot_email()

static void dot_email ( FILE *  fp,
struct Email e,
struct ListHead *  links 
)
static

Definition at line 1289 of file graphviz.c.

1290 {
1291  struct Buffer buf = mutt_buffer_make(256);
1292  char arr[256];
1293 
1294  dot_object_header(fp, e, "Email", "#ff80ff");
1295 
1296  dot_type_string(fp, "path", e->path, true);
1297 
1298 #define ADD_BOOL(F) add_flag(&buf, e->F, #F)
1299  ADD_BOOL(active);
1300  ADD_BOOL(attach_del);
1301  ADD_BOOL(attach_valid);
1302  ADD_BOOL(changed);
1303  ADD_BOOL(collapsed);
1304  ADD_BOOL(deleted);
1305  ADD_BOOL(display_subject);
1306  ADD_BOOL(expired);
1307  ADD_BOOL(flagged);
1308  ADD_BOOL(limited);
1309  ADD_BOOL(matched);
1310  ADD_BOOL(mime);
1311  ADD_BOOL(old);
1312  ADD_BOOL(purge);
1313  ADD_BOOL(quasi_deleted);
1314  ADD_BOOL(read);
1315  ADD_BOOL(recip_valid);
1316  ADD_BOOL(replied);
1317  ADD_BOOL(searched);
1318  ADD_BOOL(subject_changed);
1319  ADD_BOOL(superseded);
1320  ADD_BOOL(tagged);
1321  ADD_BOOL(threaded);
1322  ADD_BOOL(trash);
1323 #undef ADD_BOOL
1324  dot_type_string(fp, "bools", mutt_buffer_is_empty(&buf) ? "[NONE]" : mutt_b2s(&buf), true);
1325 
1326  mutt_buffer_reset(&buf);
1327 #define ADD_BOOL(F) add_flag(&buf, (e->security & F), #F)
1329  ADD_BOOL(SEC_SIGN);
1342 #undef ADD_BOOL
1343  dot_type_string(fp, "security",
1344  mutt_buffer_is_empty(&buf) ? "[NONE]" : mutt_b2s(&buf), true);
1345 
1346  dot_type_number(fp, "num_hidden", e->num_hidden);
1347  dot_type_number(fp, "offset", e->offset);
1348  dot_type_number(fp, "lines", e->lines);
1349  dot_type_number(fp, "index", e->index);
1350  dot_type_number(fp, "msgno", e->msgno);
1351  dot_type_number(fp, "vnum", e->vnum);
1352  dot_type_number(fp, "score", e->score);
1353  dot_type_number(fp, "attach_total", e->attach_total);
1354 
1356  dot_type_string(fp, "maildir_flags", edata->maildir_flags, false);
1357 
1358  if (e->date_sent != 0)
1359  {
1360  char zone[32];
1361  dot_type_date(arr, sizeof(arr), e->date_sent);
1362  snprintf(zone, sizeof(zone), " (%c%02u%02u)", e->zoccident ? '-' : '+',
1363  e->zhours, e->zminutes);
1364  mutt_str_cat(arr, sizeof(arr), zone);
1365  dot_type_string(fp, "date_sent", arr, false);
1366  }
1367 
1368  if (e->received != 0)
1369  {
1370  dot_type_date(arr, sizeof(arr), e->received);
1371  dot_type_string(fp, "received", arr, false);
1372  }
1373 
1374  dot_object_footer(fp);
1375 
1376  if (e->content)
1377  {
1378  dot_body(fp, e->content, links, true);
1379  dot_add_link(links, e, e->content, "Email->content", false, NULL);
1380  }
1381 
1382  if (e->env)
1383  {
1384  dot_envelope(fp, e->env, links);
1385  dot_add_link(links, e, e->env, "Email->env", false, NULL);
1386 
1387  mutt_buffer_reset(&buf);
1388  mutt_buffer_addstr(&buf, "{ rank=same ");
1389 
1390  dot_ptr_name(arr, sizeof(arr), e);
1391  mutt_buffer_add_printf(&buf, "%s ", arr);
1392 
1393  dot_ptr_name(arr, sizeof(arr), e->env);
1394  mutt_buffer_add_printf(&buf, "%s ", arr);
1395 
1396  mutt_buffer_addstr(&buf, "}");
1397 
1399  }
1400 
1401  // struct TagList tags;
1402 
1403  mutt_buffer_dealloc(&buf);
1404 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
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
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:85
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
struct Body * content
List of MIME parts.
Definition: email.h:91
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
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:94
bool zoccident
True, if west of UTC, False if east.
Definition: email.h:65
Maildir-specific Email data -.
Definition: private.h:42
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:92
struct MaildirEmailData * maildir_edata_get(struct Email *e)
Get the private data for this Email.
Definition: shared.c:95
struct Envelope * env
Envelope information.
Definition: email.h:90
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 mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:203
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
int score
Message score.
Definition: email.h:89
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:82
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
#define mutt_b2s(buf)
Definition: buffer.h:41
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:98
static void dot_type_date(char *buf, size_t buflen, time_t timestamp)
Definition: graphviz.c:162
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:97
static void dot_envelope(FILE *fp, const struct Envelope *env, struct ListHead *links)
Definition: graphviz.c:1230
static void dot_body(FILE *fp, const struct Body *b, struct ListHead *links, bool link_next)
Definition: graphviz.c:1077
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:95
char * data
Pointer to data.
Definition: buffer.h:35
#define SEC_KEYBLOCK
Email has a key attached.
Definition: lib.h:91
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
int vnum
Virtual message number.
Definition: email.h:88
unsigned int zhours
Hours away from UTC.
Definition: email.h:63
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
Definition: lib.h:93
#define SEC_BADSIGN
Email has a bad signature.
Definition: lib.h:88
LOFF_T offset
Where in the stream does this message begin?
Definition: email.h:84
char * mutt_str_cat(char *buf, size_t buflen, const char *s)
Concatenate two strings.
Definition: string.c:390
#define SEC_SIGN
Email is signed.
Definition: lib.h:86
void * edata
Driver-specific data.
Definition: email.h:109
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
char * path
Path of Email (for local Mailboxes)
Definition: email.h:92
#define ADD_BOOL(F)
int index
The absolute (unsorted) message number.
Definition: email.h:86
#define PGP_TRADITIONAL_CHECKED
Email has a traditional (inline) signature.
Definition: lib.h:99
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:87
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:89
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:83
char * maildir_flags
Unknown Maildir flags.
Definition: private.h:44
int msgno
Number displayed to the user.
Definition: email.h:87
#define SEC_SIGNOPAQUE
Email has an opaque signature (encrypted)
Definition: lib.h:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_envelope()

static void dot_envelope ( FILE *  fp,
const struct Envelope env,
struct ListHead *  links 
)
static

Definition at line 1230 of file graphviz.c.

1231 {
1232  struct Buffer buf = mutt_buffer_make(256);
1233 
1234  dot_object_header(fp, env, "Envelope", "#ffff00");
1235 
1236 #define ADD_FLAG(F) add_flag(&buf, (env->changed & F), #F)
1241 #undef ADD_BOOL
1242  dot_type_string(fp, "changed",
1243  mutt_buffer_is_empty(&buf) ? "[NONE]" : mutt_b2s(&buf), true);
1244 
1245 #define ADDR_LIST(AL) dot_addr_list(fp, #AL, &env->AL, links)
1246  ADDR_LIST(return_path);
1247  ADDR_LIST(from);
1248  ADDR_LIST(to);
1249  ADDR_LIST(cc);
1250  ADDR_LIST(bcc);
1251  ADDR_LIST(sender);
1252  ADDR_LIST(reply_to);
1253  ADDR_LIST(mail_followup_to);
1254  ADDR_LIST(x_original_to);
1255 #undef ADDR_LIST
1256 
1257  dot_type_string(fp, "date", env->date, false);
1258  dot_type_string(fp, "disp_subj", env->disp_subj, false);
1259  dot_type_string(fp, "followup_to", env->followup_to, false);
1260  dot_type_string(fp, "list_post", env->list_post, false);
1261  dot_type_string(fp, "message_id", env->message_id, false);
1262  dot_type_string(fp, "newsgroups", env->newsgroups, false);
1263  dot_type_string(fp, "organization", env->organization, false);
1264  dot_type_string(fp, "real_subj", env->real_subj, false);
1265  dot_type_string(fp, "spam", mutt_b2s(&env->spam), false);
1266  dot_type_string(fp, "subject", env->subject, false);
1267  dot_type_string(fp, "supersedes", env->supersedes, false);
1268  dot_type_string(fp, "xref", env->xref, false);
1269  dot_type_string(fp, "x_comment_to", env->x_comment_to, false);
1270  dot_type_string(fp, "x_label", env->x_label, false);
1271 
1272  if (0)
1273  {
1274  dot_list_head(fp, "references", &env->references);
1275  dot_list_head(fp, "in_reply_to", &env->in_reply_to);
1276  dot_list_head(fp, "userhdrs", &env->userhdrs);
1277  }
1278 
1279 #ifdef USE_AUTOCRYPT
1280  dot_ptr(fp, "autocrypt", env->autocrypt, NULL);
1281  dot_ptr(fp, "autocrypt_gossip", env->autocrypt_gossip, NULL);
1282 #endif
1283 
1284  dot_object_footer(fp);
1285 
1286  mutt_buffer_dealloc(&buf);
1287 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
struct AutocryptHeader * autocrypt_gossip
Definition: envelope.h:86
char * supersedes
Supersedes header.
Definition: envelope.h:70
#define ADD_FLAG(F)
char * xref
List of cross-references.
Definition: envelope.h:76
char * disp_subj
Display subject (modified copy of subject)
Definition: envelope.h:68
char * date
Sent date.
Definition: envelope.h:71
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
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
char * real_subj
Offset of the real subject.
Definition: envelope.h:67
struct AutocryptHeader * autocrypt
Definition: envelope.h:85
#define MUTT_ENV_CHANGED_SUBJECT
Protected header update.
Definition: envelope.h:35
#define ADDR_LIST(AL)
struct ListHead in_reply_to
in-reply-to header content
Definition: envelope.h:82
char * message_id
Message ID.
Definition: envelope.h:69
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
#define mutt_b2s(buf)
Definition: buffer.h:41
char * x_comment_to
List of &#39;X-comment-to&#39; fields.
Definition: envelope.h:78
#define MUTT_ENV_CHANGED_XLABEL
X-Label edited.
Definition: envelope.h:34
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
char * list_post
This stores a mailto URL, or nothing.
Definition: envelope.h:65
char * subject
Email&#39;s subject.
Definition: envelope.h:66
static void dot_list_head(FILE *fp, const char *name, const struct ListHead *list)
Definition: graphviz.c:1196
char * newsgroups
List of newsgroups.
Definition: envelope.h:75
static void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:241
char * followup_to
List of &#39;followup-to&#39; fields.
Definition: envelope.h:77
char * organization
Organisation header.
Definition: envelope.h:73
#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
char * x_label
X-Label.
Definition: envelope.h:72
struct Buffer spam
Spam header.
Definition: envelope.h:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_content_type()

const char* get_content_type ( enum ContentType  type)

Definition at line 61 of file graphviz.c.

62 {
63  switch (type)
64  {
65  case TYPE_OTHER:
66  return "TYPE_OTHER";
67  case TYPE_AUDIO:
68  return "TYPE_AUDIO";
69  case TYPE_APPLICATION:
70  return "TYPE_APPLICATION";
71  case TYPE_IMAGE:
72  return "TYPE_IMAGE";
73  case TYPE_MESSAGE:
74  return "TYPE_MESSAGE";
75  case TYPE_MODEL:
76  return "TYPE_MODEL";
77  case TYPE_MULTIPART:
78  return "TYPE_MULTIPART";
79  case TYPE_TEXT:
80  return "TYPE_TEXT";
81  case TYPE_VIDEO:
82  return "TYPE_VIDEO";
83  case TYPE_ANY:
84  return "TYPE_ANY";
85  default:
86  return "UNKNOWN";
87  }
88 }
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:

◆ get_content_encoding()

const char* get_content_encoding ( enum ContentEncoding  enc)

Definition at line 90 of file graphviz.c.

91 {
92  switch (enc)
93  {
94  case ENC_OTHER:
95  return "ENC_OTHER";
96  case ENC_7BIT:
97  return "ENC_7BIT";
98  case ENC_8BIT:
99  return "ENC_8BIT";
101  return "ENC_QUOTED_PRINTABLE";
102  case ENC_BASE64:
103  return "ENC_BASE64";
104  case ENC_BINARY:
105  return "ENC_BINARY";
106  case ENC_UUENCODED:
107  return "ENC_UUENCODED";
108  default:
109  return "UNKNOWN";
110  }
111 }
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_disposition()

const char* get_content_disposition ( enum ContentDisposition  disp)

Definition at line 113 of file graphviz.c.

114 {
115  switch (disp)
116  {
117  case DISP_INLINE:
118  return "DISP_INLINE";
119  case DISP_ATTACH:
120  return "DISP_ATTACH";
121  case DISP_FORM_DATA:
122  return "DISP_FORM_DATA";
123  case DISP_NONE:
124  return "DISP_NONE";
125  default:
126  return "UNKNOWN";
127  }
128 }
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:

◆ add_flag()

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

Definition at line 130 of file graphviz.c.

131 {
132  if (!buf || !name)
133  return;
134 
135  if (is_set)
136  {
137  if (!mutt_buffer_is_empty(buf))
138  mutt_buffer_addch(buf, ',');
139  mutt_buffer_addstr(buf, name);
140  }
141 }
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:

◆ dot_type_bool()

static void dot_type_bool ( FILE *  fp,
const char *  name,
bool  val 
)
static

Definition at line 143 of file graphviz.c.

144 {
145  static const char *values[] = { "false", "true" };
146  fprintf(fp, "\t\t<tr>\n");
147  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
148  fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
149  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", values[val]);
150  fprintf(fp, "\t\t</tr>\n");
151 }
+ Here is the caller graph for this function:

◆ dot_type_char()

static void dot_type_char ( FILE *  fp,
const char *  name,
char  ch 
)
static

Definition at line 153 of file graphviz.c.

154 {
155  fprintf(fp, "\t\t<tr>\n");
156  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
157  fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
158  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%c</td>\n", ch);
159  fprintf(fp, "\t\t</tr>\n");
160 }
+ Here is the caller graph for this function:

◆ dot_type_date()

static void dot_type_date ( char *  buf,
size_t  buflen,
time_t  timestamp 
)
static

Definition at line 162 of file graphviz.c.

163 {
164  mutt_date_localtime_format(buf, buflen, "%Y-%m-%d %H:%M:%S", timestamp);
165 }
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:680
static const char * timestamp(time_t stamp)
Create a YYYY-MM-DD HH:MM:SS timestamp.
Definition: logging.c:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_type_file()

static void dot_type_file ( FILE *  fp,
const char *  name,
FILE *  struct_fp 
)
static

Definition at line 167 of file graphviz.c.

168 {
169  fprintf(fp, "\t\t<tr>\n");
170  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
171  fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
172  if (struct_fp)
173  {
174  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%p (%d)</td>\n",
175  (void *) struct_fp, fileno(struct_fp));
176  }
177  else
178  {
179  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">NULL</td>\n");
180  }
181  fprintf(fp, "\t\t</tr>\n");
182 }
+ Here is the caller graph for this function:

◆ dot_type_number()

static void dot_type_number ( FILE *  fp,
const char *  name,
int  num 
)
static

Definition at line 184 of file graphviz.c.

185 {
186  fprintf(fp, "\t\t<tr>\n");
187  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
188  fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
189  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%d</td>\n", num);
190  fprintf(fp, "\t\t</tr>\n");
191 }
+ Here is the caller graph for this function:

◆ dot_type_string_escape()

static void dot_type_string_escape ( char *  buf,
size_t  buflen 
)
static

Definition at line 193 of file graphviz.c.

194 {
195  for (; buf[0]; buf++)
196  {
197  if (buf[0] == '<')
198  mutt_str_inline_replace(buf, buflen, 1, "&lt;");
199  else if (buf[0] == '>')
200  mutt_str_inline_replace(buf, buflen, 1, "&gt;");
201  else if (buf[0] == '&')
202  mutt_str_inline_replace(buf, buflen, 1, "&amp;");
203  }
204 }
bool mutt_str_inline_replace(char *buf, size_t buflen, size_t xlen, const char *rstr)
Replace the beginning of a string.
Definition: string.c:1018
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_type_string()

static void dot_type_string ( FILE *  fp,
const char *  name,
const char *  str,
bool  force 
)
static

Definition at line 206 of file graphviz.c.

207 {
208  if ((!str || (str[0] == '\0')) && !force)
209  return;
210 
211  char buf[1024] = "[NULL]";
212 
213  if (str)
214  {
215  mutt_str_copy(buf, str, sizeof(buf));
216  dot_type_string_escape(buf, sizeof(buf));
217  }
218 
219  bool quoted = ((buf[0] != '[') && (buf[0] != '*'));
220 
221  fprintf(fp, "\t\t<tr>\n");
222  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
223  fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
224  if (quoted)
225  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">\"%s\"</td>\n", buf);
226  else
227  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", buf);
228  fprintf(fp, "\t\t</tr>\n");
229 }
static void dot_type_string_escape(char *buf, size_t buflen)
Definition: graphviz.c:193
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:721
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_type_umask()

static void dot_type_umask ( char *  buf,
size_t  buflen,
int  umask 
)
static

Definition at line 231 of file graphviz.c.

232 {
233  snprintf(buf, buflen, "0%03o", umask);
234 }
+ Here is the caller graph for this function:

◆ dot_ptr_name()

static void dot_ptr_name ( char *  buf,
size_t  buflen,
const void *  ptr 
)
static

Definition at line 236 of file graphviz.c.

237 {
238  snprintf(buf, buflen, "obj_%p", ptr);
239 }
+ Here is the caller graph for this function:

◆ dot_ptr()

static void dot_ptr ( FILE *  fp,
const char *  name,
void *  ptr,
const char *  colour 
)
static

Definition at line 241 of file graphviz.c.

242 {
243  fprintf(fp, "\t\t<tr>\n");
244  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
245  fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
246  if (colour && ptr)
247  {
248  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\" bgcolor=\"%s\">%p</td>\n",
249  colour, ptr);
250  }
251  else
252  {
253  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%p</td>\n", ptr);
254  }
255  fprintf(fp, "\t\t</tr>\n");
256 }
+ Here is the caller graph for this function:

◆ dot_add_link()

static void dot_add_link ( struct ListHead *  links,
const void *  src,
const void *  dst,
const char *  label,
bool  back,
const char *  colour 
)
static

Definition at line 258 of file graphviz.c.

260 {
261  if (!src || !dst)
262  return;
263  if (!colour)
264  colour = "#c0c0c0";
265 
266  char obj1[16] = { 0 };
267  char obj2[16] = { 0 };
268  char text[256] = { 0 };
269  char lstr[128] = { 0 };
270 
271  dot_ptr_name(obj1, sizeof(obj1), src);
272  dot_ptr_name(obj2, sizeof(obj2), dst);
273 
274  if (label)
275  snprintf(lstr, sizeof(lstr), "edgetooltip=\"%s\"", label);
276 
277  snprintf(text, sizeof(text), "%s -> %s [ %s %s color=\"%s\" ]", obj1, obj2,
278  back ? "dir=back" : "", lstr, colour);
279  mutt_list_insert_tail(links, mutt_str_dup(text));
280 }
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
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_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_graph_header()

static void dot_graph_header ( FILE *  fp)
static

Definition at line 282 of file graphviz.c.

283 {
284  fprintf(fp, "digraph neomutt\n");
285  fprintf(fp, "{\n\n");
286 
287  fprintf(fp, "\tgraph [\n");
288  fprintf(fp, "\t\trankdir=\"TB\"\n");
289  fprintf(fp, "\t\tnodesep=\"0.5\"\n");
290  fprintf(fp, "\t\tranksep=\"0.5\"\n");
291  fprintf(fp, "\t];\n");
292  fprintf(fp, "\n");
293  fprintf(fp, "\tnode [\n");
294  fprintf(fp, "\t\tshape=\"plain\"\n");
295  fprintf(fp, "\t];\n");
296  fprintf(fp, "\n");
297  fprintf(fp, "\tedge [\n");
298  fprintf(fp, "\t\tpenwidth=\"4.5\"\n");
299  fprintf(fp, "\t\tarrowsize=\"1.0\"\n");
300  fprintf(fp, "\t\tcolor=\"#c0c0c0\"\n");
301  fprintf(fp, "\t];\n");
302  fprintf(fp, "\n");
303 }
+ Here is the caller graph for this function:

◆ dot_graph_footer()

static void dot_graph_footer ( FILE *  fp,
struct ListHead *  links 
)
static

Definition at line 305 of file graphviz.c.

306 {
307  fprintf(fp, "\n");
308  struct ListNode *np = NULL;
309  STAILQ_FOREACH(np, links, entries)
310  {
311  fprintf(fp, "\t%s;\n", np->data);
312  }
313  fprintf(fp, "\n}\n");
314 }
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
char * data
String.
Definition: list.h:36
A List node for strings.
Definition: list.h:34
+ Here is the caller graph for this function:

◆ dot_object_header()

static void dot_object_header ( FILE *  fp,
const void *  ptr,
const char *  name,
const char *  colour 
)
static

Definition at line 316 of file graphviz.c.

317 {
318  char obj[16] = { 0 };
319  dot_ptr_name(obj, sizeof(obj), ptr);
320 
321  if (!colour)
322  colour = "#ffff80";
323 
324  fprintf(fp, "\t%s [\n", obj);
325  fprintf(fp, "\t\tlabel=<<table cellspacing=\"0\" border=\"1\" rows=\"*\" "
326  "color=\"#d0d0d0\">\n");
327  fprintf(fp, "\t\t<tr>\n");
328  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\" bgcolor=\"%s\" port=\"top\" colspan=\"3\"><font color=\"#000000\" point-size=\"20\"><b>%s</b></font> <font point-size=\"12\">(%p)</font></td>\n",
329  colour, name, ptr);
330  fprintf(fp, "\t\t</tr>\n");
331 }
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_object_footer()

static void dot_object_footer ( FILE *  fp)
static

Definition at line 333 of file graphviz.c.

334 {
335  fprintf(fp, "\t\t</table>>\n");
336  fprintf(fp, "\t];\n");
337  fprintf(fp, "\n");
338 }
+ Here is the caller graph for this function:

◆ dot_node()

static void dot_node ( FILE *  fp,
void *  ptr,
const char *  name,
const char *  colour 
)
static

Definition at line 340 of file graphviz.c.

341 {
342  char obj[16] = { 0 };
343  dot_ptr_name(obj, sizeof(obj), ptr);
344 
345  fprintf(fp, "\t%s [\n", obj);
346  fprintf(fp, "\t\tlabel=<<table cellspacing=\"0\" border=\"1\" rows=\"*\" "
347  "color=\"#d0d0d0\">\n");
348  fprintf(fp, "\t\t<tr>\n");
349  fprintf(fp, "\t\t\t<td border=\"0\" bgcolor=\"%s\" port=\"top\"><font color=\"#000000\" point-size=\"20\"><b>%s</b></font></td>\n",
350  colour, name);
351  fprintf(fp, "\t\t</tr>\n");
352  dot_object_footer(fp);
353 }
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_node_link()

static void dot_node_link ( FILE *  fp,
void *  ptr,
const char *  name,
void *  link,
const char *  colour 
)
static

Definition at line 355 of file graphviz.c.

356 {
357  char obj[16] = { 0 };
358  dot_ptr_name(obj, sizeof(obj), ptr);
359 
360  fprintf(fp, "\t%s [\n", obj);
361  fprintf(fp, "\t\tlabel=<<table cellspacing=\"0\" border=\"1\" rows=\"*\" "
362  "color=\"#d0d0d0\">\n");
363  fprintf(fp, "\t\t<tr>\n");
364  fprintf(fp, "\t\t\t<td border=\"0\" bgcolor=\"%s\" port=\"top\"><font color=\"#000000\" point-size=\"20\"><b>%s</b></font></td>\n",
365  colour, name);
366  fprintf(fp, "\t\t</tr>\n");
367 
368  fprintf(fp, "\t\t<tr>\n");
369  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\" bgcolor=\"%s\">%p</td>\n", colour, link);
370  fprintf(fp, "\t\t</tr>\n");
371 
372  dot_object_footer(fp);
373 }
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_path_fs()

static void dot_path_fs ( char *  buf,
size_t  buflen,
const char *  path 
)
static

Definition at line 375 of file graphviz.c.

376 {
377  if (!path)
378  {
379  buf[0] = '\0';
380  return;
381  }
382 
383  const char *slash = strrchr(path, '/');
384  if (slash)
385  slash++;
386  else
387  slash = path;
388 
389  mutt_str_copy(buf, slash, buflen);
390 }
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:721
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_path_imap()

static void dot_path_imap ( char *  buf,
size_t  buflen,
const char *  path 
)
static

Definition at line 392 of file graphviz.c.

393 {
394  char tmp[1024] = { 0 };
395  mutt_str_copy(tmp, path, sizeof(tmp));
396 
397  struct Url *u = url_parse(tmp);
398 
399  if (u->path && (u->path[0] != '\0'))
400  mutt_str_copy(buf, u->path, buflen);
401  else
402  snprintf(buf, buflen, "%s:%s", u->host, u->user);
403 
404  url_free(&u);
405 }
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:66
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition: url.c:123
char * user
Username.
Definition: url.h:69
char * host
Host.
Definition: url.h:71
char * path
Path.
Definition: url.h:73
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:721
struct Url * url_parse(const char *src)
Fill in Url.
Definition: url.c:234
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_config()

static void dot_config ( FILE *  fp,
const char *  name,
int  type,
struct ConfigSubset sub,
struct ListHead *  links 
)
static

Definition at line 407 of file graphviz.c.

409 {
410  if (!sub)
411  return;
412 
413  struct Buffer value = mutt_buffer_make(256);
414  dot_object_header(fp, (void *) name, "Config", "#ffff80");
415  dot_type_string(fp, "scope", sub->name, true);
416 
417  if (sub->name)
418  {
419  char scope[256];
420  snprintf(scope, sizeof(scope), "%s:", sub->name);
421 
422  struct HashElem **list = get_elem_list(sub->cs);
423  for (size_t i = 0; list[i]; i++)
424  {
425  struct HashElem *item = list[i];
426  if ((item->type & type) == 0)
427  continue;
428 
429  const char *iname = item->key.strkey;
430  size_t slen = strlen(scope);
431  if (mutt_str_startswith(iname, scope) != 0)
432  {
433  if (strchr(iname + slen, ':'))
434  continue;
435  if ((DTYPE(item->type) == DT_STRING) && (item->type & DT_SENSITIVE))
436  {
437  dot_type_string(fp, iname + slen, "***", true);
438  }
439  else
440  {
441  mutt_buffer_reset(&value);
442  cs_subset_he_string_get(sub, item, &value);
443  dot_type_string(fp, iname + slen, value.data, true);
444  }
445  }
446  }
447  }
448  else
449  {
450  struct HashElem **list = get_elem_list(sub->cs);
451  int i = 0;
452  for (; list[i]; i++)
453  ; // do nothing
454 
455  dot_type_number(fp, "count", i);
456  }
457 
458  dot_object_footer(fp);
459  mutt_buffer_dealloc(&value);
460 }
union HashKey key
Key representing the data.
Definition: hash.h:46
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
struct HashElem ** get_elem_list(struct ConfigSet *cs)
Create a sorted list of all config items.
Definition: subset.c:64
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
const char * name
Scope name of Subset.
Definition: subset.h:48
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
int cs_subset_he_string_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
Definition: subset.c:341
#define DTYPE(x)
Mask for the Data Type.
Definition: types.h:44
#define DT_SENSITIVE
Contains sensitive value, e.g. password.
Definition: types.h:49
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:51
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
#define DT_STRING
a string
Definition: types.h:41
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:165
char * data
Pointer to data.
Definition: buffer.h:35
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
const char * strkey
String key.
Definition: hash.h:36
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:45
The item stored in a Hash Table.
Definition: hash.h:43
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_comp()

static void dot_comp ( FILE *  fp,
struct CompressInfo ci,
struct ListHead *  links 
)
static

Definition at line 462 of file graphviz.c.

463 {
464  dot_object_header(fp, ci, "CompressInfo", "#c0c060");
465  dot_type_string(fp, "append", ci->cmd_append, true);
466  dot_type_string(fp, "close", ci->cmd_close, true);
467  dot_type_string(fp, "open", ci->cmd_open, true);
468  dot_object_footer(fp);
469 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
const char * cmd_append
append-hook command
Definition: lib.h:50
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
const char * cmd_close
close-hook command
Definition: lib.h:51
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
const char * cmd_open
open-hook command
Definition: lib.h:52
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox_type()

static void dot_mailbox_type ( FILE *  fp,
const char *  name,
enum MailboxType  type 
)
static

Definition at line 471 of file graphviz.c.

472 {
473  const char *typestr = NULL;
474 
475  switch (type)
476  {
477  case MUTT_MBOX:
478  typestr = "MBOX";
479  break;
480  case MUTT_MMDF:
481  typestr = "MMDF";
482  break;
483  case MUTT_MH:
484  typestr = "MH";
485  break;
486  case MUTT_MAILDIR:
487  typestr = "MAILDIR";
488  break;
489  case MUTT_NNTP:
490  typestr = "NNTP";
491  break;
492  case MUTT_IMAP:
493  typestr = "IMAP";
494  break;
495  case MUTT_NOTMUCH:
496  typestr = "NOTMUCH";
497  break;
498  case MUTT_POP:
499  typestr = "POP";
500  break;
501  case MUTT_COMPRESSED:
502  typestr = "COMPRESSED";
503  break;
504  default:
505  typestr = "UNKNOWN";
506  }
507 
508  fprintf(fp, "\t\t<tr>\n");
509  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
510  fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
511  fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", typestr);
512  fprintf(fp, "\t\t</tr>\n");
513 }
&#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
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:45
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:53
+ Here is the caller graph for this function:

◆ dot_mailbox_imap()

static void dot_mailbox_imap ( FILE *  fp,
struct ImapMboxData mdata,
struct ListHead *  links 
)
static

Definition at line 515 of file graphviz.c.

516 {
517  dot_object_header(fp, mdata, "ImapMboxData", "#60c060");
518  dot_type_string(fp, "name", mdata->name, true);
519  dot_type_string(fp, "munge_name", mdata->munge_name, true);
520  dot_type_string(fp, "real_name", mdata->real_name, true);
521  dot_object_footer(fp);
522 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
char * name
Mailbox name.
Definition: private.h:218
char * real_name
Original Mailbox name, e.g.: INBOX can be just \0.
Definition: private.h:220
char * munge_name
Munged version of the mailbox name.
Definition: private.h:219
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox_maildir()

static void dot_mailbox_maildir ( FILE *  fp,
struct MaildirMboxData mdata,
struct ListHead *  links 
)
static

Definition at line 524 of file graphviz.c.

525 {
526  char buf[64] = { 0 };
527 
528  dot_object_header(fp, mdata, "MaildirMboxData", "#60c060");
529 
530  dot_type_date(buf, sizeof(buf), mdata->mtime_cur.tv_sec);
531  dot_type_string(fp, "mtime_cur", buf, true);
532 
533  dot_type_umask(buf, sizeof(buf), mdata->mh_umask);
534  dot_type_string(fp, "mh_umask", buf, true);
535  dot_object_footer(fp);
536 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
time_t tv_sec
Definition: file.h:48
static void dot_type_umask(char *buf, size_t buflen, int umask)
Definition: graphviz.c:231
mode_t mh_umask
Definition: private.h:53
static void dot_type_date(char *buf, size_t buflen, time_t timestamp)
Definition: graphviz.c:162
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
struct timespec mtime_cur
Definition: private.h:52
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox_mbox()

static void dot_mailbox_mbox ( FILE *  fp,
struct MboxAccountData mdata,
struct ListHead *  links 
)
static

Definition at line 538 of file graphviz.c.

539 {
540  char buf[64] = { 0 };
541 
542  dot_object_header(fp, mdata, "MboxAccountData", "#60c060");
543  dot_ptr(fp, "fp", mdata->fp, NULL);
544 
545  dot_type_date(buf, sizeof(buf), mdata->atime.tv_sec);
546  dot_type_string(fp, "atime", buf, true);
547 
548  dot_object_footer(fp);
549 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
struct timespec atime
File&#39;s last-access time.
Definition: lib.h:53
time_t tv_sec
Definition: file.h:48
static void dot_type_date(char *buf, size_t buflen, time_t timestamp)
Definition: graphviz.c:162
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:241
FILE * fp
Mailbox file.
Definition: lib.h:52
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox_nntp()

static void dot_mailbox_nntp ( FILE *  fp,
struct NntpMboxData mdata,
struct ListHead *  links 
)
static

Definition at line 551 of file graphviz.c.

552 {
553  dot_object_header(fp, mdata, "NntpMboxData", "#60c060");
554  dot_type_string(fp, "group", mdata->group, true);
555  dot_type_string(fp, "desc", mdata->desc, true);
556 
557  dot_type_number(fp, "first_message", mdata->first_message);
558  dot_type_number(fp, "last_message", mdata->last_message);
559  dot_type_number(fp, "last_loaded", mdata->last_loaded);
560  dot_type_number(fp, "last_cached", mdata->last_cached);
561  dot_type_number(fp, "unread", mdata->unread);
562 
563  dot_type_bool(fp, "subscribed", mdata->subscribed);
564  dot_type_bool(fp, "has_new_mail", mdata->has_new_mail);
565  dot_type_bool(fp, "allowed", mdata->allowed);
566  dot_type_bool(fp, "deleted", mdata->deleted);
567 
568  dot_object_footer(fp);
569 }
bool has_new_mail
Definition: lib.h:148
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
bool subscribed
Definition: lib.h:147
anum_t last_cached
Definition: lib.h:145
anum_t last_loaded
Definition: lib.h:144
char * group
Definition: lib.h:140
bool allowed
Definition: lib.h:149
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_type_bool(FILE *fp, const char *name, bool val)
Definition: graphviz.c:143
bool deleted
Definition: lib.h:150
anum_t first_message
Definition: lib.h:142
anum_t unread
Definition: lib.h:146
char * desc
Definition: lib.h:141
anum_t last_message
Definition: lib.h:143
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox_notmuch()

static void dot_mailbox_notmuch ( FILE *  fp,
struct NmMboxData mdata,
struct ListHead *  links 
)
static

Definition at line 571 of file graphviz.c.

572 {
573  dot_object_header(fp, mdata, "NmMboxData", "#60c060");
574  dot_type_number(fp, "db_limit", mdata->db_limit);
575  dot_object_footer(fp);
576 }
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
int db_limit
Maximum number of results to return.
Definition: private.h:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox_pop()

static void dot_mailbox_pop ( FILE *  fp,
struct PopAccountData mdata,
struct ListHead *  links 
)
static

Definition at line 578 of file graphviz.c.

579 {
580  dot_object_header(fp, mdata, "PopAccountData", "#60c060");
581  dot_ptr(fp, "conn", mdata->conn, "#ff8080");
582  dot_object_footer(fp);
583 }
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
struct Connection * conn
Definition: private.h:80
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:241
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox()

static void dot_mailbox ( FILE *  fp,
struct Mailbox m,
struct ListHead *  links 
)
static

Definition at line 585 of file graphviz.c.

586 {
587  char buf[64] = { 0 };
588 
589  dot_object_header(fp, m, "Mailbox", "#80ff80");
590  dot_mailbox_type(fp, "type", m->type);
591  dot_type_string(fp, "name", m->name, false);
592 
593  if ((m->type == MUTT_IMAP) || (m->type == MUTT_POP))
594  {
595  dot_path_imap(buf, sizeof(buf), mutt_b2s(&m->pathbuf));
596  dot_type_string(fp, "pathbuf", buf, true);
597  dot_path_imap(buf, sizeof(buf), m->realpath);
598  dot_type_string(fp, "realpath", buf, true);
599  }
600  else
601  {
602  dot_path_fs(buf, sizeof(buf), mutt_b2s(&m->pathbuf));
603  dot_type_string(fp, "pathbuf", buf, true);
604  dot_path_fs(buf, sizeof(buf), m->realpath);
605  dot_type_string(fp, "realpath", buf, true);
606  }
607 
608 #ifdef GV_HIDE_MDATA
609  dot_ptr(fp, "mdata", m->mdata, NULL);
610 #endif
611  dot_ptr(fp, "account", m->account, "#80ffff");
612 
613  dot_type_number(fp, "msg_count", m->msg_count);
614  // dot_type_number(fp, "msg_unread", m->msg_unread);
615  // dot_type_number(fp, "msg_flagged", m->msg_flagged);
616  // dot_type_number(fp, "msg_new", m->msg_new);
617  // dot_type_number(fp, "msg_deleted", m->msg_deleted);
618  // dot_type_number(fp, "msg_tagged", m->msg_tagged);
619 
620  dot_ptr(fp, "emails", m->emails, NULL);
621  dot_type_number(fp, "email_max", m->email_max);
622  dot_ptr(fp, "v2r", m->v2r, NULL);
623  dot_type_number(fp, "vcount", m->vcount);
624 
625  dot_object_footer(fp);
626 
627  // dot_add_link(links, m, m->mdata, false, NULL);
628 
629 #ifndef GV_HIDE_MDATA
630  if (m->mdata)
631  {
632  if (m->type == MUTT_MAILDIR)
633  dot_mailbox_maildir(fp, m->mdata, links);
634  else if (m->type == MUTT_IMAP)
635  dot_mailbox_imap(fp, m->mdata, links);
636  else if (m->type == MUTT_POP)
637  dot_mailbox_pop(fp, m->mdata, links);
638  else if (m->type == MUTT_MBOX)
639  dot_mailbox_mbox(fp, m->mdata, links);
640  else if (m->type == MUTT_NNTP)
641  dot_mailbox_nntp(fp, m->mdata, links);
642  else if (m->type == MUTT_NOTMUCH)
643  dot_mailbox_notmuch(fp, m->mdata, links);
644 
645  dot_add_link(links, m, m->mdata, "Mailbox->mdata", false, NULL);
646  }
647 #endif
648 
649  if (m->compress_info)
650  {
651  dot_comp(fp, m->compress_info, links);
652  dot_add_link(links, m, m->compress_info, "Mailbox->compress_info", false, NULL);
653  }
654 
655 #ifndef GV_HIDE_CONFIG
656  if (m->name)
657  {
658  dot_config(fp, m->name, DT_INHERIT_MBOX, m->sub, links);
659  dot_add_link(links, m, m->name, "Mailbox Config", false, NULL);
660  }
661 #endif
662 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
int msg_count
Total number of messages.
Definition: mailbox.h:91
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: mailbox.h:52
static void dot_mailbox_maildir(FILE *fp, struct MaildirMboxData *mdata, struct ListHead *links)
Definition: graphviz.c:524
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
static void dot_mailbox_nntp(FILE *fp, struct NntpMboxData *mdata, struct ListHead *links)
Definition: graphviz.c:551
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:84
static void dot_mailbox_type(FILE *fp, const char *name, enum MailboxType type)
Definition: graphviz.c:471
int vcount
The number of virtual messages.
Definition: mailbox.h:102
static void dot_comp(FILE *fp, struct CompressInfo *ci, struct ListHead *links)
Definition: graphviz.c:462
char * name
A short name for the Mailbox.
Definition: mailbox.h:85
static void dot_path_fs(char *buf, size_t buflen, const char *path)
Definition: graphviz.c:375
static void dot_config(FILE *fp, const char *name, int type, struct ConfigSubset *sub, struct ListHead *links)
Definition: graphviz.c:407
void * mdata
Driver specific data.
Definition: mailbox.h:136
&#39;Maildir&#39; Mailbox type
Definition: mailbox.h:51
#define mutt_b2s(buf)
Definition: buffer.h:41
&#39;POP3&#39; Mailbox type
Definition: mailbox.h:55
int email_max
Number of pointers in emails.
Definition: mailbox.h:100
static void dot_path_imap(char *buf, size_t buflen, const char *path)
Definition: graphviz.c:392
struct ConfigSubset * sub
Inherited config items.
Definition: mailbox.h:86
#define DT_INHERIT_MBOX
Config item can be Mailbox-specific.
Definition: types.h:52
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
&#39;Notmuch&#39; (virtual) Mailbox type
Definition: mailbox.h:54
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:48
int * v2r
Mapping from virtual to real msgno.
Definition: mailbox.h:101
static void dot_mailbox_mbox(FILE *fp, struct MboxAccountData *mdata, struct ListHead *links)
Definition: graphviz.c:538
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:131
static void dot_mailbox_pop(FILE *fp, struct PopAccountData *mdata, struct ListHead *links)
Definition: graphviz.c:578
static void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:241
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:124
struct Buffer pathbuf
Definition: mailbox.h:83
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:53
static void dot_mailbox_notmuch(FILE *fp, struct NmMboxData *mdata, struct ListHead *links)
Definition: graphviz.c:571
static void dot_mailbox_imap(FILE *fp, struct ImapMboxData *mdata, struct ListHead *links)
Definition: graphviz.c:515
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox_node()

static void dot_mailbox_node ( FILE *  fp,
struct MailboxNode mn,
struct ListHead *  links 
)
static

Definition at line 664 of file graphviz.c.

665 {
666  dot_node(fp, mn, "MN", "#80ff80");
667 
668  dot_mailbox(fp, mn->mailbox, links);
669 
670  dot_add_link(links, mn, mn->mailbox, "MailboxNode->mailbox", false, NULL);
671 
672  struct Buffer buf;
673  mutt_buffer_init(&buf);
674 
675  char name[256] = { 0 };
676  mutt_buffer_addstr(&buf, "{ rank=same ");
677 
678  dot_ptr_name(name, sizeof(name), mn);
679  mutt_buffer_add_printf(&buf, "%s ", name);
680 
681  dot_ptr_name(name, sizeof(name), mn->mailbox);
682  mutt_buffer_add_printf(&buf, "%s ", name);
683 
684 #ifndef GV_HIDE_MDATA
685  if (mn->mailbox->mdata)
686  {
687  dot_ptr_name(name, sizeof(name), mn->mailbox->mdata);
688  mutt_buffer_add_printf(&buf, "%s ", name);
689  }
690 #endif
691 
692 #ifndef GV_HIDE_CONFIG
693  if (mn->mailbox->name)
694  {
695  dot_ptr_name(name, sizeof(name), mn->mailbox->name);
696  mutt_buffer_add_printf(&buf, "%s ", name);
697  }
698 #endif
699 
700  mutt_buffer_addstr(&buf, "}");
701 
702  mutt_list_insert_tail(links, mutt_str_dup(buf.data));
703  mutt_buffer_dealloc(&buf);
704 }
static void dot_mailbox(FILE *fp, struct Mailbox *m, struct ListHead *links)
Definition: graphviz.c:585
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
String manipulation buffer.
Definition: buffer.h:33
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
char * name
A short name for the Mailbox.
Definition: mailbox.h:85
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:203
void * mdata
Driver specific data.
Definition: mailbox.h:136
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
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:340
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
struct Buffer * mutt_buffer_init(struct Buffer *buf)
Initialise a new Buffer.
Definition: buffer.c:46
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:152
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_mailbox_list()

static void dot_mailbox_list ( FILE *  fp,
struct MailboxList *  ml,
struct ListHead *  links,
bool  abbr 
)
static

Definition at line 706 of file graphviz.c.

707 {
708  struct MailboxNode *prev = NULL;
709  struct MailboxNode *np = NULL;
710  STAILQ_FOREACH(np, ml, entries)
711  {
712  if (abbr)
713  dot_node_link(fp, np, "MN", np->mailbox, "#80ff80");
714  else
715  dot_mailbox_node(fp, np, links);
716  if (prev)
717  dot_add_link(links, prev, np, "MailboxNode->next", false, NULL);
718  prev = np;
719  }
720 }
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
static void dot_mailbox_node(FILE *fp, struct MailboxNode *mn, struct ListHead *links)
Definition: graphviz.c:664
static void dot_node_link(FILE *fp, void *ptr, const char *name, void *link, const char *colour)
Definition: graphviz.c:355
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
List of Mailboxes.
Definition: mailbox.h:150
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:152
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_connection()

static void dot_connection ( FILE *  fp,
struct Connection c,
struct ListHead *  links 
)
static

Definition at line 722 of file graphviz.c.

723 {
724  dot_object_header(fp, c, "Connection", "#ff8080");
725  // dot_ptr(fp, "sockdata", c->sockdata, "#60c0c0");
726  dot_type_number(fp, "fd", c->fd);
727  dot_object_footer(fp);
728 
729  dot_object_header(fp, c->inbuf, "ConnAccount", "#ff8080");
730  dot_type_string(fp, "user", c->account.user, true);
731  dot_type_string(fp, "host", c->account.host, true);
732  dot_type_number(fp, "port", c->account.port);
733  dot_object_footer(fp);
734 
735  dot_add_link(links, c, c->inbuf, "Connection.ConnAccount", false, NULL);
736 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
char user[128]
Username.
Definition: connaccount.h:55
char host[128]
Server to login to.
Definition: connaccount.h:53
char inbuf[1024]
Buffer for incoming traffic.
Definition: connection.h:38
unsigned short port
Port to connect to.
Definition: connaccount.h:57
int fd
Socket file descriptor.
Definition: connection.h:40
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_account_imap()

static void dot_account_imap ( FILE *  fp,
struct ImapAccountData adata,
struct ListHead *  links 
)
static

Definition at line 738 of file graphviz.c.

739 {
740  dot_object_header(fp, adata, "ImapAccountData", "#60c0c0");
741  // dot_type_string(fp, "mbox_name", adata->mbox_name, true);
742  // dot_type_string(fp, "login", adata->conn->account.login, true);
743  dot_type_string(fp, "user", adata->conn->account.user, true);
744  dot_type_string(fp, "pass", adata->conn->account.pass[0] ? "***" : "", true);
745  dot_type_number(fp, "port", adata->conn->account.port);
746  // dot_ptr(fp, "conn", adata->conn, "#ff8080");
747  dot_type_bool(fp, "unicode", adata->unicode);
748  dot_type_bool(fp, "qresync", adata->qresync);
749  dot_type_char(fp, "seqid", adata->seqid);
750  dot_ptr(fp, "mailbox", adata->mailbox, "#80ff80");
751  dot_object_footer(fp);
752 
753  if (adata->conn)
754  {
755  dot_connection(fp, adata->conn, links);
756  dot_add_link(links, adata, adata->conn, "ImapAccountData->conn", false, NULL);
757  }
758 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
static void dot_connection(FILE *fp, struct Connection *c, struct ListHead *links)
Definition: graphviz.c:722
char user[128]
Username.
Definition: connaccount.h:55
struct Mailbox * mailbox
Current selected mailbox.
Definition: private.h:206
unsigned char seqid
tag sequence prefix
Definition: private.h:186
char pass[256]
Password.
Definition: connaccount.h:56
unsigned short port
Port to connect to.
Definition: connaccount.h:57
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
bool qresync
true, if QRESYNC is successfully ENABLE&#39;d
Definition: private.h:193
static void dot_type_bool(FILE *fp, const char *name, bool val)
Definition: graphviz.c:143
static void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:241
static void dot_type_char(FILE *fp, const char *name, char ch)
Definition: graphviz.c:153
bool unicode
If true, we can send UTF-8, and the server will use UTF8 rather than mUTF7.
Definition: private.h:192
struct Connection * conn
Definition: private.h:171
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_account_mbox()

static void dot_account_mbox ( FILE *  fp,
struct MboxAccountData adata,
struct ListHead *  links 
)
static

Definition at line 760 of file graphviz.c.

761 {
762  char buf[64] = { 0 };
763 
764  dot_object_header(fp, adata, "MboxAccountData", "#60c0c0");
765  dot_ptr(fp, "fp", adata->fp, NULL);
766 
767  dot_type_date(buf, sizeof(buf), adata->atime.tv_sec);
768  dot_type_string(fp, "atime", buf, true);
769  dot_type_bool(fp, "locked", adata->locked);
770  dot_type_bool(fp, "append", adata->append);
771 
772  dot_object_footer(fp);
773 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
bool locked
is the mailbox locked?
Definition: lib.h:55
bool append
mailbox is opened in append mode
Definition: lib.h:56
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
struct timespec atime
File&#39;s last-access time.
Definition: lib.h:53
time_t tv_sec
Definition: file.h:48
static void dot_type_date(char *buf, size_t buflen, time_t timestamp)
Definition: graphviz.c:162
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_type_bool(FILE *fp, const char *name, bool val)
Definition: graphviz.c:143
static void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:241
FILE * fp
Mailbox file.
Definition: lib.h:52
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_account_nntp()

static void dot_account_nntp ( FILE *  fp,
struct NntpAccountData adata,
struct ListHead *  links 
)
static

Definition at line 775 of file graphviz.c.

776 {
777  dot_object_header(fp, adata, "NntpAccountData", "#60c0c0");
778  dot_type_number(fp, "groups_num", adata->groups_num);
779 
780  dot_type_bool(fp, "hasCAPABILITIES", adata->hasCAPABILITIES);
781  dot_type_bool(fp, "hasSTARTTLS", adata->hasSTARTTLS);
782  dot_type_bool(fp, "hasDATE", adata->hasDATE);
783  dot_type_bool(fp, "hasLIST_NEWSGROUPS", adata->hasLIST_NEWSGROUPS);
784  dot_type_bool(fp, "hasXGTITLE", adata->hasXGTITLE);
785  dot_type_bool(fp, "hasLISTGROUP", adata->hasLISTGROUP);
786  dot_type_bool(fp, "hasLISTGROUPrange", adata->hasLISTGROUPrange);
787  dot_type_bool(fp, "hasOVER", adata->hasOVER);
788  dot_type_bool(fp, "hasXOVER", adata->hasXOVER);
789  dot_type_bool(fp, "cacheable", adata->cacheable);
790  dot_type_bool(fp, "newsrc_modified", adata->newsrc_modified);
791 
792  dot_type_string(fp, "authenticators", adata->authenticators, true);
793  dot_type_string(fp, "overview_fmt", adata->overview_fmt, true);
794  dot_type_string(fp, "newsrc_file", adata->newsrc_file, true);
795  dot_type_file(fp, "newsrc_fp", adata->fp_newsrc);
796 
797  dot_type_number(fp, "groups_num", adata->groups_num);
798  dot_type_number(fp, "groups_max", adata->groups_max);
799 
800  char buf[128];
801  dot_type_date(buf, sizeof(buf), adata->mtime);
802  dot_type_string(fp, "mtime", buf, true);
803  dot_type_date(buf, sizeof(buf), adata->newgroups_time);
804  dot_type_string(fp, "newgroups_time", buf, true);
805  dot_type_date(buf, sizeof(buf), adata->check_time);
806  dot_type_string(fp, "check_time", buf, true);
807 
808  dot_object_footer(fp);
809 
810  if (adata->conn)
811  {
812  dot_connection(fp, adata->conn, links);
813  dot_add_link(links, adata, adata->conn, "NntpAccountData->conn", false, NULL);
814  }
815 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
char * newsrc_file
Definition: lib.h:91
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
bool newsrc_modified
Definition: lib.h:89
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
time_t mtime
Definition: lib.h:95
static void dot_connection(FILE *fp, struct Connection *c, struct ListHead *links)
Definition: graphviz.c:722
bool hasSTARTTLS
Definition: lib.h:78
bool cacheable
Definition: lib.h:88
time_t newgroups_time
Definition: lib.h:96
bool hasLIST_NEWSGROUPS
Definition: lib.h:80
char * overview_fmt
Definition: lib.h:93
static void dot_type_date(char *buf, size_t buflen, time_t timestamp)
Definition: graphviz.c:162
bool hasXGTITLE
Definition: lib.h:81
unsigned int groups_max
Definition: lib.h:99
bool hasLISTGROUP
Definition: lib.h:82
unsigned int groups_num
Definition: lib.h:98
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
bool hasOVER
Definition: lib.h:84
static void dot_type_bool(FILE *fp, const char *name, bool val)
Definition: graphviz.c:143
struct Connection * conn
Definition: lib.h:102
char * authenticators
Definition: lib.h:92
time_t check_time
Definition: lib.h:97
bool hasLISTGROUPrange
Definition: lib.h:83
FILE * fp_newsrc
Definition: lib.h:90
bool hasXOVER
Definition: lib.h:85
bool hasDATE
Definition: lib.h:79
bool hasCAPABILITIES
Definition: lib.h:77
static void dot_type_file(FILE *fp, const char *name, FILE *struct_fp)
Definition: graphviz.c:167
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_account_notmuch()

static void dot_account_notmuch ( FILE *  fp,
struct NmAccountData adata,
struct ListHead *  links 
)
static

Definition at line 817 of file graphviz.c.

818 {
819  dot_object_header(fp, adata, "NmAccountData", "#60c0c0");
820  dot_ptr(fp, "db", adata->db, NULL);
821  dot_object_footer(fp);
822 }
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
notmuch_database_t * db
Definition: private.h:50
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:241
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_account_pop()

static void dot_account_pop ( FILE *  fp,
struct PopAccountData adata,
struct ListHead *  links 
)
static

Definition at line 824 of file graphviz.c.

825 {
826  char buf[64] = { 0 };
827 
828  dot_object_header(fp, adata, "PopAccountData", "#60c0c0");
829 
830  dot_type_date(buf, sizeof(buf), adata->check_time);
831  dot_type_string(fp, "check_time", buf, true);
832 
833  dot_type_string(fp, "login", adata->conn->account.login, true);
834  dot_type_string(fp, "user", adata->conn->account.user, true);
835  dot_type_string(fp, "pass", adata->conn->account.pass[0] ? "***" : "", true);
836  dot_type_number(fp, "port", adata->conn->account.port);
837  // dot_ptr(fp, "conn", adata->conn, "#ff8080");
838  dot_object_footer(fp);
839 
840  if (adata->conn)
841  {
842  dot_connection(fp, adata->conn, links);
843  dot_add_link(links, adata, adata->conn, "PopAccountData->conn", false, NULL);
844  }
845 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
char login[128]
Login name.
Definition: connaccount.h:54
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
static void dot_connection(FILE *fp, struct Connection *c, struct ListHead *links)
Definition: graphviz.c:722
char user[128]
Username.
Definition: connaccount.h:55
struct Connection * conn
Definition: private.h:80
char pass[256]
Password.
Definition: connaccount.h:56
time_t check_time
Definition: private.h:93
unsigned short port
Port to connect to.
Definition: connaccount.h:57
static void dot_type_date(char *buf, size_t buflen, time_t timestamp)
Definition: graphviz.c:162
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_account()

static void dot_account ( FILE *  fp,
struct Account a,
struct ListHead *  links 
)
static

Definition at line 847 of file graphviz.c.

848 {
849  dot_object_header(fp, a, "Account", "#80ffff");
850  dot_mailbox_type(fp, "type", a->type);
851  dot_type_string(fp, "name", a->name, true);
852  // dot_ptr(fp, "adata", a->adata, "#60c0c0");
853  dot_object_footer(fp);
854 
855  if (a->adata)
856  {
857  if (a->type == MUTT_IMAP)
858  dot_account_imap(fp, a->adata, links);
859  else if (a->type == MUTT_POP)
860  dot_account_pop(fp, a->adata, links);
861  else if (a->type == MUTT_MBOX)
862  dot_account_mbox(fp, a->adata, links);
863  else if (a->type == MUTT_NNTP)
864  dot_account_nntp(fp, a->adata, links);
865  else if (a->type == MUTT_NOTMUCH)
866  dot_account_notmuch(fp, a->adata, links);
867 
868  dot_add_link(links, a, a->adata, "Account->adata", false, NULL);
869  }
870 
871 #ifndef GV_HIDE_CONFIG
872  if (a->name)
873  {
874  dot_config(fp, a->name, DT_INHERIT_ACC, a->sub, links);
875  dot_add_link(links, a, a->name, "Config", false, NULL);
876 
877  char name[256] = { 0 };
878  struct Buffer buf;
879  mutt_buffer_init(&buf);
880 
881  mutt_buffer_addstr(&buf, "{ rank=same ");
882 
883  dot_ptr_name(name, sizeof(name), a);
884  mutt_buffer_add_printf(&buf, "%s ", name);
885 
886  dot_ptr_name(name, sizeof(name), a->name);
887  mutt_buffer_add_printf(&buf, "%s ", name);
888 
889  mutt_buffer_addstr(&buf, "}");
890  mutt_list_insert_tail(links, mutt_str_dup(buf.data));
891  mutt_buffer_dealloc(&buf);
892  }
893 #endif
894 
895  struct MailboxNode *first = STAILQ_FIRST(&a->mailboxes);
896  dot_add_link(links, a, first, "Account->mailboxes", false, NULL);
897  dot_mailbox_list(fp, &a->mailboxes, links, false);
898 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
char * name
Name of Account.
Definition: account.h:39
static void dot_account_notmuch(FILE *fp, struct NmAccountData *adata, struct ListHead *links)
Definition: graphviz.c:817
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: mailbox.h:52
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
struct MailboxList mailboxes
List of Mailboxes.
Definition: account.h:41
String manipulation buffer.
Definition: buffer.h:33
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
static void dot_mailbox_type(FILE *fp, const char *name, enum MailboxType type)
Definition: graphviz.c:471
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:38
static void dot_account_pop(FILE *fp, struct PopAccountData *adata, struct ListHead *links)
Definition: graphviz.c:824
static void dot_config(FILE *fp, const char *name, int type, struct ConfigSubset *sub, struct ListHead *links)
Definition: graphviz.c:407
static void dot_account_imap(FILE *fp, struct ImapAccountData *adata, struct ListHead *links)
Definition: graphviz.c:738
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:203
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
&#39;POP3&#39; Mailbox type
Definition: mailbox.h:55
static void dot_mailbox_list(FILE *fp, struct MailboxList *ml, struct ListHead *links, bool abbr)
Definition: graphviz.c:706
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_account_nntp(FILE *fp, struct NntpAccountData *adata, struct ListHead *links)
Definition: graphviz.c:775
#define DT_INHERIT_ACC
Config item can be Account-specific.
Definition: types.h:51
&#39;Notmuch&#39; (virtual) Mailbox type
Definition: mailbox.h:54
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:48
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
static void dot_account_mbox(FILE *fp, struct MboxAccountData *adata, struct ListHead *links)
Definition: graphviz.c:760
struct ConfigSubset * sub
Inherited config items.
Definition: account.h:40
List of Mailboxes.
Definition: mailbox.h:150
struct Buffer * mutt_buffer_init(struct Buffer *buf)
Initialise a new Buffer.
Definition: buffer.c:46
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:53
#define STAILQ_FIRST(head)
Definition: queue.h:347
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_account_list()

static void dot_account_list ( FILE *  fp,
struct AccountList *  al,
struct ListHead *  links 
)
static

Definition at line 900 of file graphviz.c.

901 {
902  struct Account *prev = NULL;
903  struct Account *np = NULL;
904  TAILQ_FOREACH(np, al, entries)
905  {
906 #ifdef GV_HIDE_MBOX
907  if (np->type == MUTT_MBOX)
908  continue;
909 #endif
910  dot_account(fp, np, links);
911  if (prev)
912  dot_add_link(links, prev, np, "Account->next", false, NULL);
913 
914  prev = np;
915  }
916 }
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
A group of associated Mailboxes.
Definition: account.h:36
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:38
static void dot_account(FILE *fp, struct Account *a, struct ListHead *links)
Definition: graphviz.c:847
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:48
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_context()

static void dot_context ( FILE *  fp,
struct Context ctx,
struct ListHead *  links 
)
static

Definition at line 918 of file graphviz.c.

919 {
920  dot_object_header(fp, ctx, "Context", "#ff80ff");
921  dot_ptr(fp, "mailbox", ctx->mailbox, "#80ff80");
922 #ifdef GV_HIDE_CONTEXT_CONTENTS
923  dot_type_number(fp, "vsize", ctx->vsize);
924  dot_type_string(fp, "pattern", ctx->pattern, true);
925  dot_type_bool(fp, "collapsed", ctx->collapsed);
926 #endif
927  dot_object_footer(fp);
928 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
struct Mailbox * mailbox
Definition: context.h:50
off_t vsize
Definition: context.h:39
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
static void dot_type_bool(FILE *fp, const char *name, bool val)
Definition: graphviz.c:143
bool collapsed
Are all threads collapsed?
Definition: context.h:48
static void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:241
char * pattern
Limit pattern string.
Definition: context.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_graphviz()

void dump_graphviz ( const char *  title)

Definition at line 930 of file graphviz.c.

931 {
932  char name[256] = { 0 };
933  struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
934 
935  time_t now = time(NULL);
936  if (title)
937  {
938  char date[128];
939  mutt_date_localtime_format(date, sizeof(date), "%R", now);
940  snprintf(name, sizeof(name), "%s-%s.gv", date, title);
941  }
942  else
943  {
944  mutt_date_localtime_format(name, sizeof(name), "%R.gv", now);
945  }
946 
947  umask(022);
948  FILE *fp = fopen(name, "w");
949  if (!fp)
950  return;
951 
952  dot_graph_header(fp);
953 
954 #ifndef GV_HIDE_NEOMUTT
955  dot_node(fp, NeoMutt, "NeoMutt", "#ffa500");
957  "NeoMutt->accounts", false, NULL);
958 #ifndef GV_HIDE_CONFIG
959  dot_config(fp, (const char *) NeoMutt->sub, 0, NeoMutt->sub, &links);
960  dot_add_link(&links, NeoMutt, NeoMutt->sub, "NeoMutt Config", false, NULL);
961  struct Buffer buf = mutt_buffer_make(256);
962  char obj1[16] = { 0 };
963  char obj2[16] = { 0 };
964  dot_ptr_name(obj1, sizeof(obj1), NeoMutt);
965  dot_ptr_name(obj2, sizeof(obj2), NeoMutt->sub);
966  mutt_buffer_printf(&buf, "{ rank=same %s %s }", obj1, obj2);
968  mutt_buffer_dealloc(&buf);
969 #endif
970 #endif
971 
972  dot_account_list(fp, &NeoMutt->accounts, &links);
973 
974 #ifndef GV_HIDE_CONTEXT
975  if (Context)
976  dot_context(fp, Context, &links);
977 
978 #ifndef GV_HIDE_NEOMUTT
979  /* Globals */
980  fprintf(fp, "\t{ rank=same ");
981  if (Context)
982  {
983  dot_ptr_name(name, sizeof(name), Context);
984  fprintf(fp, "%s ", name);
985  }
986  dot_ptr_name(name, sizeof(name), NeoMutt);
987  fprintf(fp, "%s ", name);
988  fprintf(fp, "}\n");
989 #endif
990 #endif
991 
992  fprintf(fp, "\t{ rank=same ");
993  struct Account *np = NULL;
994  TAILQ_FOREACH(np, &NeoMutt->accounts, entries)
995  {
996 #ifdef GV_HIDE_MBOX
997  if (np->type == MUTT_MBOX)
998  continue;
999 #endif
1000  dot_ptr_name(name, sizeof(name), np);
1001  fprintf(fp, "%s ", name);
1002  }
1003  fprintf(fp, "}\n");
1004 
1005  dot_graph_footer(fp, &links);
1006  fclose(fp);
1007  mutt_list_free(&links);
1008 }
The "current" mailbox.
Definition: context.h:37
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
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:680
#define TAILQ_FIRST(head)
Definition: queue.h:716
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
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:375
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 void dot_graph_footer(FILE *fp, struct ListHead *links)
Definition: graphviz.c:305
static void dot_config(FILE *fp, const char *name, int type, struct ConfigSubset *sub, struct ListHead *links)
Definition: graphviz.c:407
static void dot_account_list(FILE *fp, struct AccountList *al, struct ListHead *links)
Definition: graphviz.c:900
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
#define mutt_b2s(buf)
Definition: buffer.h:41
static void dot_node(FILE *fp, void *ptr, const char *name, const char *colour)
Definition: graphviz.c:340
&#39;mbox&#39; Mailbox type
Definition: mailbox.h:48
static void dot_context(FILE *fp, struct Context *ctx, struct ListHead *links)
Definition: graphviz.c:918
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:321
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
static void dot_graph_header(FILE *fp)
Definition: graphviz.c:282
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_parameter_list()

static void dot_parameter_list ( FILE *  fp,
const char *  name,
const struct ParameterList *  pl 
)
static

Definition at line 1010 of file graphviz.c.

1011 {
1012  if (!pl)
1013  return;
1014  if (TAILQ_EMPTY(pl))
1015  return;
1016 
1017  dot_object_header(fp, pl, "ParameterList", "#00ff00");
1018 
1019  struct Parameter *np = NULL;
1020  TAILQ_FOREACH(np, pl, entries)
1021  {
1022  dot_type_string(fp, np->attribute, np->value, false);
1023  }
1024 
1025  dot_object_footer(fp);
1026 }
char * attribute
Parameter name.
Definition: parameter.h:34
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
char * value
Parameter value.
Definition: parameter.h:35
Attribute associated with a MIME part.
Definition: parameter.h:32
#define TAILQ_EMPTY(head)
Definition: queue.h:714
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_content()

static void dot_content ( FILE *  fp,
struct Content cont,
struct ListHead *  links 
)
static

Definition at line 1028 of file graphviz.c.

1029 {
1030  struct Buffer buf = mutt_buffer_make(256);
1031 
1032  dot_object_header(fp, cont, "Content", "#800080");
1033 
1034  dot_type_number(fp, "hibin", cont->hibin);
1035  dot_type_number(fp, "lobin", cont->lobin);
1036  dot_type_number(fp, "nulbin", cont->nulbin);
1037  dot_type_number(fp, "crlf", cont->crlf);
1038  dot_type_number(fp, "ascii", cont->ascii);
1039  dot_type_number(fp, "linemax", cont->linemax);
1040 
1041 #define ADD_BOOL(F) add_flag(&buf, cont->F, #F)
1042  ADD_BOOL(space);
1043  ADD_BOOL(binary);
1044  ADD_BOOL(from);
1045  ADD_BOOL(dot);
1046  ADD_BOOL(cr);
1047 #undef ADD_BOOL
1048 
1049  dot_object_footer(fp);
1050 
1051  mutt_buffer_dealloc(&buf);
1052 }
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
long linemax
Length of the longest line in the file.
Definition: content.h:40
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
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
long hibin
8-bit characters
Definition: content.h:35
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
long ascii
Number of ascii chars.
Definition: content.h:39
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
long lobin
Unprintable 7-bit chars (eg., control chars)
Definition: content.h:36
#define ADD_BOOL(F)
long crlf
\r and \n characters
Definition: content.h:38
long nulbin
Null characters (0x0)
Definition: content.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_attach_ptr()

static void dot_attach_ptr ( FILE *  fp,
struct AttachPtr aptr,
struct ListHead *  links 
)
static

Definition at line 1054 of file graphviz.c.

1055 {
1056  struct Buffer buf = mutt_buffer_make(256);
1057 
1058  dot_object_header(fp, aptr, "AttachPtr", "#ff0000");
1059 
1060  dot_type_file(fp, "fp", aptr->fp);
1061 
1062  dot_type_string(fp, "parent_type", get_content_type(aptr->parent_type), false);
1063 
1064  dot_type_number(fp, "level", aptr->level);
1065  dot_type_number(fp, "num", aptr->num);
1066 
1067  dot_type_bool(fp, "unowned", aptr->unowned);
1068  dot_type_bool(fp, "decrypted", aptr->decrypted);
1069 
1070  dot_object_footer(fp);
1071 
1072  dot_add_link(links, aptr->content, aptr, "AttachPtr->content", true, NULL);
1073 
1074  mutt_buffer_dealloc(&buf);
1075 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
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
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
bool unowned
Don&#39;t unlink on detach.
Definition: attach.h:42
bool decrypted
Not part of message as stored in the email->content.
Definition: attach.h:43
int num
Attachment index number.
Definition: attach.h:41
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
FILE * fp
Used in the recvattach menu.
Definition: attach.h:37
const char * get_content_type(enum ContentType type)
Definition: graphviz.c:61
static void dot_type_bool(FILE *fp, const char *name, bool val)
Definition: graphviz.c:143
struct Body * content
Attachment.
Definition: attach.h:36
int level
Nesting depth of attachment.
Definition: attach.h:40
static void dot_type_file(FILE *fp, const char *name, FILE *struct_fp)
Definition: graphviz.c:167
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_body()

static void dot_body ( FILE *  fp,
const struct Body b,
struct ListHead *  links,
bool  link_next 
)
static

Definition at line 1077 of file graphviz.c.

1078 {
1079  struct Buffer buf = mutt_buffer_make(256);
1080 
1081  dot_object_header(fp, b, "Body", "#2020ff");
1082 
1083  char file[256];
1084  dot_path_fs(file, sizeof(file), b->filename);
1085  dot_type_string(fp, "file", file, false);
1086 
1087  dot_type_string(fp, "charset", b->charset, false);
1088  dot_type_string(fp, "description", b->description, false);
1089  dot_type_string(fp, "d_filename", b->d_filename, false);
1090  dot_type_string(fp, "form_name", b->form_name, false);
1091  dot_type_string(fp, "language", b->language, false);
1092  dot_type_string(fp, "subtype", b->subtype, false);
1093  dot_type_string(fp, "xtype", b->xtype, false);
1094 
1095  dot_type_string(fp, "type", get_content_type(b->type), true);
1096  dot_type_string(fp, "encoding", get_content_encoding(b->encoding), true);
1097  dot_type_string(fp, "disposition", get_content_disposition(b->disposition), true);
1098 
1099  if (b->stamp != 0)
1100  {
1101  char arr[64];
1102  dot_type_date(arr, sizeof(arr), b->stamp);
1103  dot_type_string(fp, "stamp", arr, true);
1104  }
1105 
1106 #define ADD_BOOL(F) add_flag(&buf, b->F, #F)
1107  ADD_BOOL(attach_qualifies);
1108  ADD_BOOL(badsig);
1109  ADD_BOOL(collapsed);
1110  ADD_BOOL(deleted);
1111  ADD_BOOL(force_charset);
1112  ADD_BOOL(goodsig);
1113 #ifdef USE_AUTOCRYPT
1114  ADD_BOOL(is_autocrypt);
1115 #endif
1116  ADD_BOOL(noconv);
1117  ADD_BOOL(tagged);
1118  ADD_BOOL(unlink);
1119  ADD_BOOL(use_disp);
1120  ADD_BOOL(warnsig);
1121 #undef ADD_BOOL
1122  dot_type_string(fp, "bools", mutt_buffer_is_empty(&buf) ? "[NONE]" : mutt_b2s(&buf), true);
1123 
1124  dot_type_number(fp, "attach_count", b->attach_count);
1125  dot_type_number(fp, "hdr_offset", b->hdr_offset);
1126  dot_type_number(fp, "length", b->length);
1127  dot_type_number(fp, "offset", b->offset);
1128 
1129  dot_object_footer(fp);
1130 
1131  if (!TAILQ_EMPTY(&b->parameter))
1132  {
1133  dot_parameter_list(fp, "parameter", &b->parameter);
1134  dot_add_link(links, b, &b->parameter, "Body->mime_headers", false, NULL);
1135  }
1136 
1137  if (b->mime_headers)
1138  {
1139  dot_envelope(fp, b->mime_headers, links);
1140  dot_add_link(links, b, b->mime_headers, "Body->mime_headers", false, NULL);
1141  }
1142 
1143  if (b->email)
1144  {
1145  dot_email(fp, b->email, links);
1146  dot_add_link(links, b, b->email, "Body->email", false, NULL);
1147  }
1148 
1149  if (b->parts)
1150  {
1151  if (!b->email)
1152  dot_body(fp, b->parts, links, true);
1153  dot_add_link(links, b, b->parts, "Body->parts", false, "#ff0000");
1154  }
1155 
1156  if (b->next && link_next)
1157  {
1158  char name[256] = { 0 };
1159  mutt_buffer_reset(&buf);
1160 
1161  mutt_buffer_addstr(&buf, "{ rank=same ");
1162 
1163  dot_ptr_name(name, sizeof(name), b);
1164  mutt_buffer_add_printf(&buf, "%s ", name);
1165 
1166  for (; b->next; b = b->next)
1167  {
1168  dot_body(fp, b->next, links, false);
1169  dot_add_link(links, b, b->next, "Body->next", false, "#008000");
1170 
1171  dot_ptr_name(name, sizeof(name), b->next);
1172  mutt_buffer_add_printf(&buf, "%s ", name);
1173  }
1174 
1175  mutt_buffer_addstr(&buf, "}");
1177  }
1178  else
1179  {
1180  if (b->content)
1181  {
1182  dot_content(fp, b->content, links);
1183  dot_add_link(links, b, b->content, "Body->content", false, NULL);
1184  }
1185 
1186  if (b->aptr)
1187  {
1188  dot_attach_ptr(fp, b->aptr, links);
1189  dot_add_link(links, b, b->aptr, "Body->aptr", false, NULL);
1190  }
1191  }
1192 
1193  mutt_buffer_dealloc(&buf);
1194 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
static void dot_add_link(struct ListHead *links, const void *src, const void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:258
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:46
struct Envelope * mime_headers
Memory hole protected headers.
Definition: body.h:63
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
struct Content * content
Detailed info about the content of the attachment.
Definition: body.h:51
static void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:184
static void dot_content(FILE *fp, struct Content *cont, struct ListHead *links)
Definition: graphviz.c:1028
static void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:316
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
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
LOFF_T offset
offset where the actual data begins
Definition: body.h:44
struct Body * next
next attachment in the list
Definition: body.h:53
char * form_name
Content-Disposition form-data name param.
Definition: body.h:41
const char * get_content_disposition(enum ContentDisposition disp)
Definition: graphviz.c:113
unsigned int disposition
content-disposition, ContentDisposition
Definition: body.h:67
static void dot_attach_ptr(FILE *fp, struct AttachPtr *aptr, struct ListHead *links)
Definition: graphviz.c:1054
static void dot_path_fs(char *buf, size_t buflen, const char *path)
Definition: graphviz.c:375
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
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:203
unsigned int encoding
content-transfer-encoding, ContentEncoding
Definition: body.h:66
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
char * subtype
content-type subtype
Definition: body.h:37
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
#define mutt_b2s(buf)
Definition: buffer.h:41
static void dot_type_date(char *buf, size_t buflen, time_t timestamp)
Definition: graphviz.c:162
static void dot_envelope(FILE *fp, const struct Envelope *env, struct ListHead *links)
Definition: graphviz.c:1230
LOFF_T length
length (in bytes) of attachment
Definition: body.h:45
static void dot_body(FILE *fp, const struct Body *b, struct ListHead *links, bool link_next)
Definition: graphviz.c:1077
struct AttachPtr * aptr
Menu information, used in recvattach.c.
Definition: body.h:57
char * data
Pointer to data.
Definition: buffer.h:35
char * xtype
content-type if x-unknown
Definition: body.h:36
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:54
static void dot_object_footer(FILE *fp)
Definition: graphviz.c:333
char * charset
Send mode: charset of attached file as stored on disk.
Definition: body.h:49
const char * get_content_type(enum ContentType type)
Definition: graphviz.c:61
char * description
content-description
Definition: body.h:40
unsigned int type
content-type primary type, ContentType
Definition: body.h:65
static void dot_email(FILE *fp, struct Email *e, struct ListHead *links)
Definition: graphviz.c:1289
const char * get_content_encoding(enum ContentEncoding enc)
Definition: graphviz.c:90
time_t stamp
Time stamp of last encoding update.
Definition: body.h:61
static void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:236
#define ADD_BOOL(F)
char * language
content-language (RFC8255)
Definition: body.h:38
static void dot_parameter_list(FILE *fp, const char *name, const struct ParameterList *pl)
Definition: graphviz.c:1010
char * d_filename
filename to be used for the content-disposition header.
Definition: body.h:47
long hdr_offset
Offset in stream where the headers begin.
Definition: body.h:42
int const char * file
Definition: acutest.h:617
#define TAILQ_EMPTY(head)
Definition: queue.h:714
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
struct Email * email
header information for message/rfc822
Definition: body.h:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dot_list_head()

static void dot_list_head ( FILE *  fp,
const char *  name,
const struct ListHead *  list 
)
static

Definition at line 1196 of file graphviz.c.

1197 {
1198  if (!list || !name)
1199  return;
1200  if (STAILQ_EMPTY(list))
1201  return;
1202 
1203  struct Buffer buf = mutt_buffer_make(256);
1204 
1205  struct ListNode *np = NULL;
1206  STAILQ_FOREACH(np, list, entries)
1207  {
1208  if (!mutt_buffer_is_empty(&buf))
1209  mutt_buffer_addch(&buf, ',');
1210  mutt_buffer_addstr(&buf, np->data);
1211  }
1212 
1213  dot_type_string(fp, name, mutt_b2s(&buf), false);
1214 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
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
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
#define mutt_b2s(buf)
Definition: buffer.h:41
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:240
char * data
String.
Definition: list.h:36
#define STAILQ_EMPTY(head)
Definition: queue.h:345
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:

◆ dot_addr_list()

static void dot_addr_list ( FILE *  fp,
const char *  name,
const struct AddressList *  al,
struct ListHead *  links 
)
static

Definition at line 1216 of file graphviz.c.

1218 {
1219  if (!al)
1220  return;
1221  if (TAILQ_EMPTY(al))
1222  return;
1223 
1224  char buf[1024] = { 0 };
1225 
1226  mutt_addrlist_write(al, buf, sizeof(buf), true);
1227  dot_type_string(fp, name, buf, false);
1228 }
static void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:206
#define TAILQ_EMPTY(head)
Definition: queue.h:714
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:1147
+ Here is the call graph for this function:

◆ dump_graphviz_email()

void dump_graphviz_email ( struct Email e)

Definition at line 1406 of file graphviz.c.

1407 {
1408  char name[256] = { 0 };
1409  struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
1410 
1411  time_t now = time(NULL);
1412  mutt_date_localtime_format(name, sizeof(name), "%R.gv", now);
1413 
1414  umask(022);
1415  FILE *fp = fopen(name, "w");
1416  if (!fp)
1417  return;
1418 
1419  dot_graph_header(fp);
1420 
1421  dot_email(fp, e, &links);
1422 
1423  dot_graph_footer(fp, &links);
1424  fclose(fp);
1425  mutt_list_free(&links);
1426 }
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:680
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:305
static void dot_email(FILE *fp, struct Email *e, struct ListHead *links)
Definition: graphviz.c:1289
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:321
static void dot_graph_header(FILE *fp)
Definition: graphviz.c:282
+ Here is the call graph for this function: