NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
helpers.c File Reference

Shared code. More...

#include "config.h"
#include <ctype.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "helpers.h"
#include "mutt_thread.h"
#include "render.h"
+ Include dependency graph for helpers.c:

Go to the source code of this file.

Functions

const struct ExpandoRenderDatafind_get_number (const struct ExpandoRenderData *rdata, int did, int uid)
 Find a get_number() callback function.
 
const struct ExpandoRenderDatafind_get_string (const struct ExpandoRenderData *rdata, int did, int uid)
 Find a get_string() callback function.
 
void buf_lower_special (struct Buffer *buf)
 Convert to lowercase, excluding special characters.
 

Detailed Description

Shared code.

Authors
  • Tóth János
  • 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 helpers.c.

Function Documentation

◆ find_get_number()

const struct ExpandoRenderData * find_get_number ( const struct ExpandoRenderData rdata,
int  did,
int  uid 
)

Find a get_number() callback function.

Parameters
rdataRender data to search
didDomain ID to match
uidUnique ID to match
Return values
ptrMatching Render data

Definition at line 45 of file helpers.c.

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}
long(* get_number)(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Definition: render.h:78
int did
Domain ID.
Definition: render.h:49
int uid
Unique ID.
Definition: render.h:50
+ Here is the caller graph for this function:

◆ find_get_string()

const struct ExpandoRenderData * find_get_string ( const struct ExpandoRenderData rdata,
int  did,
int  uid 
)

Find a get_string() callback function.

Parameters
rdataRender data to search
didDomain ID to match
uidUnique ID to match
Return values
ptrMatching Render data

Definition at line 69 of file helpers.c.

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}
void(* get_string)(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Definition: render.h:64
+ Here is the caller graph for this function:

◆ buf_lower_special()

void buf_lower_special ( struct Buffer buf)

Convert to lowercase, excluding special characters.

Parameters
bufString to lowercase

The string is transformed in place.

Definition at line 92 of file helpers.c.

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}
@ MUTT_TREE_MAX
Definition: mutt_thread.h:71
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition: mutt_thread.h:73
char * data
Pointer to data.
Definition: buffer.h:37
+ Here is the caller graph for this function: