NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
helpers.c
Go to the documentation of this file.
1
30#include "config.h"
31#include <ctype.h>
32#include <stddef.h>
33#include "mutt/lib.h"
34#include "helpers.h"
35#include "mutt_thread.h"
36#include "render.h"
37
45const struct ExpandoRenderData *find_get_number(const struct ExpandoRenderData *rdata,
46 int did, int uid)
47{
48 if (!rdata)
49 return NULL;
50
51 for (; rdata->did != -1; rdata++)
52 {
53 if ((rdata->did == did) && (rdata->uid == uid) && rdata->get_number)
54 {
55 return rdata;
56 }
57 }
58
59 return NULL;
60}
61
69const struct ExpandoRenderData *find_get_string(const struct ExpandoRenderData *rdata,
70 int did, int uid)
71{
72 if (!rdata)
73 return NULL;
74
75 for (; rdata->did != -1; rdata++)
76 {
77 if ((rdata->did == did) && (rdata->uid == uid) && rdata->get_string)
78 {
79 return rdata;
80 }
81 }
82
83 return NULL;
84}
85
92void buf_lower_special(struct Buffer *buf)
93{
94 if (!buf || !buf->data)
95 return;
96
97 char *p = buf->data;
98
99 while (*p)
100 {
101 if (*p == MUTT_SPECIAL_INDEX)
102 {
103 p += 2;
104 continue;
105 }
106 else if (*p < MUTT_TREE_MAX)
107 {
108 p++;
109 continue;
110 }
111
112 *p = tolower((unsigned char) *p);
113 p++;
114 }
115}
const struct ExpandoRenderData * find_get_number(const struct ExpandoRenderData *rdata, int did, int uid)
Find a get_number() callback function.
Definition: helpers.c:45
const struct ExpandoRenderData * find_get_string(const struct ExpandoRenderData *rdata, int did, int uid)
Find a get_string() callback function.
Definition: helpers.c:69
void buf_lower_special(struct Buffer *buf)
Convert to lowercase, excluding special characters.
Definition: helpers.c:92
Shared code.
Convenience wrapper for the library headers.
Create/manipulate threading in emails.
@ MUTT_TREE_MAX
Definition: mutt_thread.h:71
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition: mutt_thread.h:73
Render Expandos using Data.
String manipulation buffer.
Definition: buffer.h:36
char * data
Pointer to data.
Definition: buffer.h:37
long(* get_number)(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Definition: render.h:78
int did
Domain ID.
Definition: render.h:49
void(* get_string)(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Definition: render.h:64
int uid
Unique ID.
Definition: render.h:50