NeoMutt  2024-03-23-142-g2b2e76
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 166 of file accountcmd.c.

167{
168 if (!cac || (cac->host[0] == '\0') || (cac->type == MUTT_ACCT_TYPE_NONE))
169 {
170 return MUTT_ACCT_NO_FLAGS;
171 }
172
173 const char *c_account_command = cs_subset_string(NeoMutt->sub, "account_command");
174 if (!c_account_command)
175 {
176 return MUTT_ACCT_NO_FLAGS;
177 }
178
180 struct Buffer *cmd_buf = buf_pool_get();
181
182 make_cmd(cmd_buf, cac, c_account_command);
183 rc = call_cmd(cac, cmd_buf);
184 cac->flags |= rc;
185
186 buf_pool_release(&cmd_buf);
187 return rc;
188}
static MuttAccountFlags call_cmd(struct ConnAccount *cac, const struct Buffer *cmd)
Call the account command.
Definition: accountcmd.c:133
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:48
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
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:37
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
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:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function: