NeoMutt  2024-12-12-14-g7b49f7
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
accountcmd.h File Reference

Connection Credentials External Command. More...

#include "connaccount.h"
+ Include dependency graph for accountcmd.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

MuttAccountFlags mutt_account_call_external_cmd (struct ConnAccount *cac)
 Retrieve account credentials via an external command.
 

Detailed Description

Connection Credentials External Command.

Authors
  • Pietro Cerutti

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 accountcmd.h.

Function Documentation

◆ mutt_account_call_external_cmd()

MuttAccountFlags mutt_account_call_external_cmd ( struct ConnAccount cac)

Retrieve account credentials via an external command.

Parameters
cacConnAccount to fill
Return values
numA bitmask of MuttAccountFlags that were retrieved on success
MUTT_ACCT_NO_FLAGSFailure

Definition at line 165 of file accountcmd.c.

166{
167 if (!cac || (cac->host[0] == '\0') || (cac->type == MUTT_ACCT_TYPE_NONE))
168 {
169 return MUTT_ACCT_NO_FLAGS;
170 }
171
172 const char *c_account_command = cs_subset_string(NeoMutt->sub, "account_command");
173 if (!c_account_command)
174 {
175 return MUTT_ACCT_NO_FLAGS;
176 }
177
179 struct Buffer *cmd_buf = buf_pool_get();
180
181 make_cmd(cmd_buf, cac, c_account_command);
182 rc = call_cmd(cac, cmd_buf);
183 cac->flags |= rc;
184
185 buf_pool_release(&cmd_buf);
186 return rc;
187}
static MuttAccountFlags call_cmd(struct ConnAccount *cac, const struct Buffer *cmd)
Call the account command.
Definition: accountcmd.c:132
static void make_cmd(struct Buffer *buf, const struct ConnAccount *cac, const char *cmd)
Build the command line for the external account command.
Definition: accountcmd.c:47
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:291
uint8_t MuttAccountFlags
Flags, Which ConnAccount fields are initialised, e.g. MUTT_ACCT_PORT.
Definition: connaccount.h:41
#define MUTT_ACCT_NO_FLAGS
No flags are set.
Definition: connaccount.h:42
@ MUTT_ACCT_TYPE_NONE
Account type is unknown.
Definition: mutt_account.h:35
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:82
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:96
String manipulation buffer.
Definition: buffer.h:36
char host[128]
Server to login to.
Definition: connaccount.h:54
unsigned char type
Connection type, e.g. MUTT_ACCT_TYPE_IMAP.
Definition: connaccount.h:59
MuttAccountFlags flags
Which fields are initialised, e.g. MUTT_ACCT_USER.
Definition: connaccount.h:60
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function: