NeoMutt  2024-12-12-14-g7b49f7
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
46 int did, int uid)
47{
48 if (!erc)
49 return NULL;
50
51 for (; erc->did != -1; erc++)
52 {
53 if ((erc->did == did) && (erc->uid == uid) && erc->get_number)
54 {
55 return erc;
56 }
57 }
58
59 return NULL;
60}
61
70 int did, int uid)
71{
72 if (!erc)
73 return NULL;
74
75 for (; erc->did != -1; erc++)
76 {
77 if ((erc->did == did) && (erc->uid == uid) && erc->get_string)
78 {
79 return erc;
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 ExpandoRenderCallback * find_get_string(const struct ExpandoRenderCallback *erc, 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
const struct ExpandoRenderCallback * find_get_number(const struct ExpandoRenderCallback *erc, int did, int uid)
Find a get_number() callback function.
Definition: helpers.c:45
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
int uid
Unique ID, e.g. ExpandoDataAlias.
Definition: render.h:78
int did
Domain ID, ExpandoDomain.
Definition: render.h:77
get_string_t get_string
Definition: render.h:80
get_number_t get_number
Definition: render.h:81