NeoMutt  2024-03-23-23-gec7045
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
win_hosts.h File Reference

Mixmaster Hosts Window. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct Remailerwin_hosts_get_selection (struct MuttWindow *win)
 Get the current selection.
 
struct MuttWindowwin_hosts_new (struct RemailerArray *ra)
 Create a new Hosts Window.
 

Detailed Description

Mixmaster Hosts Window.

Authors
  • 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 win_hosts.h.

Function Documentation

◆ win_hosts_get_selection()

struct Remailer * win_hosts_get_selection ( struct MuttWindow win)

Get the current selection.

Parameters
winHosts Window
Return values
ptrCurrently selected Remailer

Definition at line 206 of file win_hosts.c.

207{
208 if (!win || !win->wdata)
209 return NULL;
210
211 struct Menu *menu = win->wdata;
212 if (!menu->mdata)
213 return NULL;
214
215 struct RemailerArray *ra = menu->mdata;
216
217 const int sel = menu_get_index(menu);
218 if (sel < 0)
219 return NULL;
220
221 struct Remailer **r = ARRAY_GET(ra, sel);
222 if (!r)
223 return NULL;
224
225 return *r;
226}
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:109
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:161
Definition: lib.h:79
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
void * mdata
Private data.
Definition: lib.h:147
void * wdata
Private data.
Definition: mutt_window.h:145
A Mixmaster remailer.
Definition: remailer.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ win_hosts_new()

struct MuttWindow * win_hosts_new ( struct RemailerArray *  ra)

Create a new Hosts Window.

Parameters
raArray of Remailer hosts
Return values
ptrNew Hosts Window

Definition at line 185 of file win_hosts.c.

186{
187 struct MuttWindow *win_hosts = menu_window_new(MENU_MIXMASTER, NeoMutt->sub);
188 win_hosts->focus = win_hosts;
189
190 struct Menu *menu = win_hosts->wdata;
191
192 menu->max = ARRAY_SIZE(ra);
194 menu->tag = NULL;
195 menu->mdata = ra;
196 menu->mdata_free = NULL; // Menu doesn't own the data
197
198 return win_hosts;
199}
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:87
static int mix_make_entry(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Format a Remailer for the Menu - Implements Menu::make_entry() -.
Definition: win_hosts.c:161
struct MuttWindow * menu_window_new(enum MenuType type, struct ConfigSubset *sub)
Create a new Menu Window.
Definition: window.c:140
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:161
int(* tag)(struct Menu *menu, int sel, int act)
Definition: lib.h:131
int(* make_entry)(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Definition: lib.h:106
int max
Number of entries in the menu.
Definition: lib.h:81
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
@ MENU_MIXMASTER
Create/edit a Mixmaster chain.
Definition: type.h:53
+ Here is the call graph for this function:
+ Here is the caller graph for this function: