NeoMutt  2024-12-12-19-ge4b57e
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 ExpandoRenderCallbackfind_get_number (const struct ExpandoRenderCallback *erc, int did, int uid)
 Find a get_number() callback function.
 
const struct ExpandoRenderCallbackfind_get_string (const struct ExpandoRenderCallback *erc, 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 ExpandoRenderCallback * find_get_number ( const struct ExpandoRenderCallback erc,
int  did,
int  uid 
)

Find a get_number() callback function.

Parameters
ercRender callbacks 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 (!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}
int uid
Unique ID, e.g. ExpandoDataAlias.
Definition: render.h:78
int did
Domain ID, ExpandoDomain.
Definition: render.h:77
get_number_t get_number
Definition: render.h:81
+ Here is the caller graph for this function:

◆ find_get_string()

const struct ExpandoRenderCallback * find_get_string ( const struct ExpandoRenderCallback erc,
int  did,
int  uid 
)

Find a get_string() callback function.

Parameters
ercRender callbacks 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 (!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}
get_string_t get_string
Definition: render.h:80
+ 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: