NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
helpers.c File Reference

Shared code. More...

#include "config.h"
#include <stddef.h>
#include "mutt/lib.h"
#include "gui/lib.h"
#include "helpers.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
  • Thomas Klausner

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
Callback function to get a 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
Callback function to get a 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 if (!*(p + 1))
104 break;
105 p += 2;
106 continue;
107 }
108 else if (*p < MUTT_TREE_MAX)
109 {
110 p++;
111 continue;
112 }
113
114 *p = mutt_tolower(*p);
115 p++;
116 }
117}
int mutt_tolower(int arg)
Wrapper for tolower(3)
Definition ctype.c:126
@ MUTT_TREE_MAX
Definition thread.h:70
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition thread.h:72
char * data
Pointer to data.
Definition buffer.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function: