]> granicus.if.org Git - neomutt/commitdiff
merge Config and normal Accounts
authorRichard Russon <rich@flatcap.org>
Sun, 2 Jun 2019 23:32:30 +0000 (00:32 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 3 Jun 2019 11:03:37 +0000 (12:03 +0100)
27 files changed:
Makefile.autosetup
account.c
account.h
config/cfgaccount.c [deleted file]
config/cfgaccount.h [deleted file]
config/inheritance.h
config/lib.h
po/POTFILES.in
test/Makefile.autosetup
test/config/account.c
test/config/address.c
test/config/bool.c
test/config/command.c
test/config/common.c
test/config/dump.c
test/config/initial.c
test/config/long.c
test/config/magic.c
test/config/mbtable.c
test/config/number.c
test/config/path.c
test/config/quad.c
test/config/regex.c
test/config/set.c
test/config/sort.c
test/config/string.c
test/config/synonym.c

index d5cf1d73f7bec0cc23b9923973614e648fb6499a..3db9275d7292a77b4624e2f463a142f228f60a7d 100644 (file)
@@ -224,7 +224,7 @@ ALLOBJS+=   $(PGPEWRAPOBJS)
 ###############################################################################
 # libconfig
 LIBCONFIG=     libconfig.a
-LIBCONFIGOBJS= config/address.o config/bool.o config/cfgaccount.o config/command.o config/dump.o \
+LIBCONFIGOBJS= config/address.o config/bool.o config/command.o config/dump.o \
                config/long.o config/magic.o config/mbtable.o config/number.o \
                config/path.o config/quad.o config/regex.o config/set.o \
                config/sort.o config/string.o
index 6d181ab62bc72a1a30866a526ed553a70ca15c35..b8808d345ba3f6518b9dd430d55f7cbc4d5e0d41 100644 (file)
--- a/account.c
+++ b/account.c
@@ -44,6 +44,100 @@ struct Account *account_new(void)
   return a;
 }
 
+/**
+ * account_add_config - Add some inherited Config items
+ * @param a         Account to add to
+ * @param cs        Parent Config set
+ * @param name      Account name
+ * @param var_names Names of Config items
+ * @retval bool True, if Config was successfully added
+ */
+bool account_add_config(struct Account *a, const struct ConfigSet *cs,
+                        const char *name, const char *var_names[])
+{
+  if (!a || !cs || !name || !var_names)
+    return false;
+
+  size_t count = 0;
+  for (; var_names[count]; count++)
+    ;
+
+  a->name = mutt_str_strdup(name);
+  a->cs = cs;
+  a->var_names = var_names;
+  a->vars = mutt_mem_calloc(count, sizeof(struct HashElem *));
+  a->num_vars = count;
+
+  char a_name[64];
+
+  for (size_t i = 0; i < a->num_vars; i++)
+  {
+    struct HashElem *parent = cs_get_elem(cs, a->var_names[i]);
+    if (!parent)
+    {
+      mutt_debug(LL_DEBUG1, "%s doesn't exist\n", a->var_names[i]);
+      return false;
+    }
+
+    snprintf(a_name, sizeof(a_name), "%s:%s", name, a->var_names[i]);
+    a->vars[i] = cs_inherit_variable(cs, parent, a_name);
+    if (!a->vars[i])
+    {
+      mutt_debug(LL_DEBUG1, "failed to create %s\n", a_name);
+      return false;
+    }
+  }
+
+  return true;
+}
+
+/**
+ * account_free_config - Remove an Account's Config items
+ * @param a Account
+ */
+void account_free_config(struct Account *a)
+{
+  if (!a)
+    return;
+
+  char child[128];
+  struct Buffer *err = mutt_buffer_alloc(128);
+
+  for (size_t i = 0; i < a->num_vars; i++)
+  {
+    snprintf(child, sizeof(child), "%s:%s", a->name, a->var_names[i]);
+    mutt_buffer_reset(err);
+    int result = cs_str_reset(a->cs, child, err);
+    if (CSR_RESULT(result) != CSR_SUCCESS)
+      mutt_debug(LL_DEBUG1, "reset failed for %s: %s\n", child, mutt_b2s(err));
+    mutt_hash_delete(a->cs->hash, child, NULL);
+  }
+
+  mutt_buffer_free(&err);
+  FREE(&a->name);
+  FREE(&a->vars);
+}
+
+/**
+ * account_free - Free an Account
+ * @param[out] ptr Account to free
+ */
+void account_free(struct Account **ptr)
+{
+  if (!ptr || !*ptr)
+    return;
+
+  struct Account *a = *ptr;
+  if (!TAILQ_EMPTY(&AllAccounts))
+    TAILQ_REMOVE(&AllAccounts, a, entries);
+  if (a->free_adata)
+    a->free_adata(&a->adata);
+
+  account_free_config(a);
+
+  FREE(ptr);
+}
+
 /**
  * account_remove_mailbox - Remove a Mailbox from an Account
  * @param a Account
@@ -63,9 +157,50 @@ void account_remove_mailbox(struct Account *a, struct Mailbox *m)
 
   if (STAILQ_EMPTY(&a->mailboxes))
   {
-    TAILQ_REMOVE(&AllAccounts, a, entries);
-    if (a->free_adata)
-      a->free_adata(&a->adata);
-    FREE(&a);
+    account_free(&a);
   }
 }
+
+/**
+ * account_set_value - Set an Account-specific config item
+ * @param a     Account
+ * @param vid   Value ID (index into Account's HashElem's)
+ * @param value Native pointer/value to set
+ * @param err   Buffer for error messages
+ * @retval num Result, e.g. #CSR_SUCCESS
+ */
+int account_set_value(const struct Account *a, size_t vid, intptr_t value, struct Buffer *err)
+{
+  if (!a)
+    return CSR_ERR_CODE;
+  if (vid >= a->num_vars)
+    return CSR_ERR_UNKNOWN;
+
+  struct HashElem *he = a->vars[vid];
+  return cs_he_native_set(a->cs, he, value, err);
+}
+
+/**
+ * account_get_value - Get an Account-specific config item
+ * @param a      Account
+ * @param vid    Value ID (index into Account's HashElem's)
+ * @param result Buffer for results or error messages
+ * @retval num Result, e.g. #CSR_SUCCESS
+ */
+int account_get_value(const struct Account *a, size_t vid, struct Buffer *result)
+{
+  if (!a)
+    return CSR_ERR_CODE;
+  if (vid >= a->num_vars)
+    return CSR_ERR_UNKNOWN;
+
+  struct HashElem *he = a->vars[vid];
+
+  if ((he->type & DT_INHERITED) && (DTYPE(he->type) == 0))
+  {
+    struct Inheritance *i = he->data;
+    he = i->parent;
+  }
+
+  return cs_he_string_get(a->cs, he, result);
+}
index 36facbc5a10972f244917e61e2ca2428aee84313..2be4f49cc1e9fb38caba83d6803e40b190d151cf 100644 (file)
--- a/account.h
+++ b/account.h
@@ -40,12 +40,23 @@ struct Account
   TAILQ_ENTRY(Account) entries;
   void *adata;
   void (*free_adata)(void **);
+
+  char *name;                 ///< Name of Account
+  const struct ConfigSet *cs; ///< Parent ConfigSet
+  const char **var_names;     ///< Array of the names of local config items
+  size_t num_vars;            ///< Number of local config items
+  struct HashElem **vars;     ///< Array of the HashElems of local config items
 };
 TAILQ_HEAD(AccountList, Account);
 
 extern struct AccountList AllAccounts; ///< List of all Accounts
 
+bool            account_add_config(struct Account *a, const struct ConfigSet *cs, const char *name, const char *var_names[]);
+void            account_free(struct Account **ptr);
+void            account_free_config(struct Account *a);
+int             account_get_value(const struct Account *a, size_t vid, struct Buffer *result);
 struct Account *account_new(void);
 void            account_remove_mailbox(struct Account *a, struct Mailbox *m);
+int             account_set_value(const struct Account *a, size_t vid, intptr_t value, struct Buffer *err);
 
 #endif /* MUTT_ACCOUNT_H */
diff --git a/config/cfgaccount.c b/config/cfgaccount.c
deleted file mode 100644 (file)
index 39b5eaf..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * @file
- * A collection of account-specific config items
- *
- * @authors
- * Copyright (C) 2017-2018 Richard Russon <rich@flatcap.org>
- *
- * @copyright
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 2 of the License, or (at your option) any later
- * version.
- *
- * 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/>.
- */
-
-/**
- * @page config_cfgaccount Account-specific config items
- *
- * A collection of account-specific config items.
- */
-
-#include "config.h"
-#include <stdbool.h>
-#include <stdio.h>
-#include "mutt/mutt.h"
-#include "cfgaccount.h"
-#include "inheritance.h"
-#include "set.h"
-#include "types.h"
-
-/**
- * ac_new - Create an CfgAccount
- * @param cs        Config items
- * @param name      Name of CfgAccount
- * @param var_names List of config items (NULL terminated)
- * @retval ptr New CfgAccount object
- */
-struct CfgAccount *ac_new(const struct ConfigSet *cs, const char *name,
-                          const char *var_names[])
-{
-  if (!cs || !name || !var_names)
-    return NULL;
-
-  int count = 0;
-  for (; var_names[count]; count++)
-    ;
-
-  struct CfgAccount *ac = mutt_mem_calloc(1, sizeof(*ac));
-  ac->name = mutt_str_strdup(name);
-  ac->cs = cs;
-  ac->var_names = var_names;
-  ac->vars = mutt_mem_calloc(count, sizeof(struct HashElem *));
-  ac->num_vars = count;
-
-  bool success = true;
-  char acname[64];
-
-  for (size_t i = 0; i < ac->num_vars; i++)
-  {
-    struct HashElem *parent = cs_get_elem(cs, ac->var_names[i]);
-    if (!parent)
-    {
-      mutt_debug(LL_DEBUG1, "%s doesn't exist\n", ac->var_names[i]);
-      success = false;
-      break;
-    }
-
-    snprintf(acname, sizeof(acname), "%s:%s", name, ac->var_names[i]);
-    ac->vars[i] = cs_inherit_variable(cs, parent, acname);
-    if (!ac->vars[i])
-    {
-      mutt_debug(LL_DEBUG1, "failed to create %s\n", acname);
-      success = false;
-      break;
-    }
-  }
-
-  if (success)
-    return ac;
-
-  ac_free(cs, &ac);
-  return NULL;
-}
-
-/**
- * ac_free - Free an CfgAccount object
- * @param[in]  cs Config items
- * @param[out] ac CfgAccount to free
- */
-void ac_free(const struct ConfigSet *cs, struct CfgAccount **ac)
-{
-  if (!cs || !ac || !*ac)
-    return;
-
-  char child[128];
-  struct Buffer *err = mutt_buffer_new();
-
-  for (size_t i = 0; i < (*ac)->num_vars; i++)
-  {
-    snprintf(child, sizeof(child), "%s:%s", (*ac)->name, (*ac)->var_names[i]);
-    mutt_buffer_reset(err);
-    int result = cs_str_reset(cs, child, err);
-    if (CSR_RESULT(result) != CSR_SUCCESS)
-      mutt_debug(LL_DEBUG1, "reset failed for %s: %s\n", child, mutt_b2s(err));
-    mutt_hash_delete(cs->hash, child, NULL);
-  }
-
-  mutt_buffer_free(&err);
-  FREE(&(*ac)->name);
-  FREE(&(*ac)->vars);
-  FREE(ac);
-}
-
-/**
- * ac_set_value - Set an CfgAccount-specific config item
- * @param ac    CfgAccount-specific config items
- * @param vid   Value ID (index into CfgAccount's HashElem's)
- * @param value Native pointer/value to set
- * @param err   Buffer for error messages
- * @retval num Result, e.g. #CSR_SUCCESS
- */
-int ac_set_value(const struct CfgAccount *ac, size_t vid, intptr_t value, struct Buffer *err)
-{
-  if (!ac)
-    return CSR_ERR_CODE;
-  if (vid >= ac->num_vars)
-    return CSR_ERR_UNKNOWN;
-
-  struct HashElem *he = ac->vars[vid];
-  return cs_he_native_set(ac->cs, he, value, err);
-}
-
-/**
- * ac_get_value - Get an account-specific config item
- * @param ac     Account-specific config items
- * @param vid    Value ID (index into CfgAccount's HashElem's)
- * @param result Buffer for results or error messages
- * @retval num Result, e.g. #CSR_SUCCESS
- */
-int ac_get_value(const struct CfgAccount *ac, size_t vid, struct Buffer *result)
-{
-  if (!ac)
-    return CSR_ERR_CODE;
-  if (vid >= ac->num_vars)
-    return CSR_ERR_UNKNOWN;
-
-  struct HashElem *he = ac->vars[vid];
-
-  if ((he->type & DT_INHERITED) && (DTYPE(he->type) == 0))
-  {
-    struct Inheritance *i = he->data;
-    he = i->parent;
-  }
-
-  return cs_he_string_get(ac->cs, he, result);
-}
diff --git a/config/cfgaccount.h b/config/cfgaccount.h
deleted file mode 100644 (file)
index 3754f43..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @file
- * A collection of account-specific config items
- *
- * @authors
- * Copyright (C) 2017-2018 Richard Russon <rich@flatcap.org>
- *
- * @copyright
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 2 of the License, or (at your option) any later
- * version.
- *
- * 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/>.
- */
-
-#ifndef _CONFIG_ACCOUNT_H
-#define _CONFIG_ACCOUNT_H
-
-#include <stdint.h>
-#include <stdio.h>
-
-struct Buffer;
-struct ConfigSet;
-
-/**
- * struct CfgAccount - Account-local config items
- */
-struct CfgAccount
-{
-  char *name;                 /**< Name of Account */
-  const struct ConfigSet *cs; /**< Parent ConfigSet */
-  const char **var_names;     /**< Array of the names of local config items */
-  size_t num_vars;            /**< Number of local config items */
-  struct HashElem **vars;     /**< Array of the HashElems of local config items */
-};
-
-struct CfgAccount *ac_new(const struct ConfigSet *cs, const char *name, const char *var_names[]);
-void ac_free(const struct ConfigSet *cs, struct CfgAccount **ac);
-
-int ac_set_value(const struct CfgAccount *ac, size_t vid, intptr_t value, struct Buffer *err);
-int ac_get_value(const struct CfgAccount *ac, size_t vid, struct Buffer *result);
-
-#endif /* _CONFIG_ACCOUNT_H */
index 616f7309ef96986c51675bae48b78b068dee7326..2b334bd58bf95dcaa9a75167969bf462badb852b 100644 (file)
  */
 struct Inheritance
 {
-  struct HashElem *parent; /**< HashElem of parent config item */
-  const char *name;        /**< Name of this config item */
-  struct CfgAccount *ac;   /**< CfgAccount holding this config item */
-  intptr_t var;            /**< (Pointer to) value, of config item */
+  struct HashElem *parent; ///< HashElem of parent config item
+  const char *name;        ///< Name of this config item
+  intptr_t var;            ///< (Pointer to) value, of config item
 };
 
 #endif /* MUTT_CONFIG_INHERITANCE_H */
index a12c21520e8e93ca3c8371fb00fd30e5e432036e..5c79eb2173989c0634aeff5f09e4a3f01322a8d0 100644 (file)
@@ -29,7 +29,6 @@
  * | :------------------ | :------------------------- |
  * | config/address.c    | @subpage config_address    |
  * | config/bool.c       | @subpage config_bool       |
- * | config/cfgaccount.c | @subpage config_cfgaccount |
  * | config/command.c    | @subpage config_command    |
  * | config/dump.c       | @subpage config_dump       |
  * | config/long.c       | @subpage config_long       |
@@ -49,7 +48,6 @@
 
 #include "address.h"
 #include "bool.h"
-#include "cfgaccount.h"
 #include "command.h"
 #include "dump.h"
 #include "inheritance.h"
index c1eae3d2446d349ffec3c32d67e54861676dcc93..994e26d7b345ece68e823d5e13a05e4e16527c48 100644 (file)
@@ -13,7 +13,6 @@ compose.c
 compress.c
 config/address.c
 config/bool.c
-config/cfgaccount.c
 config/command.c
 config/dump.c
 config/long.c
@@ -111,6 +110,7 @@ mutt/mapping.c
 mutt/mbyte.c
 mutt/md5.c
 mutt/memory.c
+mutt/notify.c
 mutt/path.c
 mutt/pool.c
 mutt/regex.c
@@ -148,6 +148,7 @@ ncrypt/pgplib.c
 ncrypt/pgpmicalg.c
 ncrypt/pgppacket.c
 ncrypt/smime.c
+neomutt.c
 nntp/browse.c
 nntp/complete.c
 nntp/newsrc.c
index ec472c94967c6f383afdd1286ecea76bd76fd759..80d0597724db84c4459fc279ed1481f1541ceb94 100644 (file)
@@ -98,7 +98,8 @@ CONFIG_OBJS   = test/config/account.o \
                  test/config/set.o \
                  test/config/sort.o \
                  test/config/string.o \
-                 test/config/synonym.o
+                 test/config/synonym.o \
+                 account.o
 
 DATE_OBJS      = test/date/mutt_date_add_timeout.o \
                  test/date/mutt_date_check_month.o \
index 7f5586d9cb4f98126ce88aff21f31facc4c64982..bc68c2804254040fa824cd49449870c58c6c976f 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * @file
- * Test code for the CfgAccount object
+ * Test code for the Account object
  *
  * @authors
  * Copyright (C) 2017-2018 Richard Russon <rich@flatcap.org>
@@ -28,6 +28,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static short VarApple;
 static short VarBanana;
@@ -68,68 +69,78 @@ void config_account(void)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, BrokenVarStr);
-  if (TEST_CHECK(!ac))
+  struct Account *a = account_new();
+  bool result = account_add_config(a, cs, account, BrokenVarStr);
+  account_free(&a);
+
+  if (TEST_CHECK(!result))
   {
     TEST_MSG("Expected error:\n");
   }
   else
   {
-    ac_free(cs, &ac);
     TEST_MSG("This test should have failed\n");
     return;
   }
 
-  const char *CfgAccountVarStr2[] = {
+  const char *AccountVarStr2[] = {
     "Apple",
     "Apple",
     NULL,
   };
 
   TEST_MSG("Expect error for next test\n");
-  ac = ac_new(cs, account, CfgAccountVarStr2);
-  if (!TEST_CHECK(!ac))
+  a = account_new();
+  result = account_add_config(a, cs, account, AccountVarStr2);
+  account_free(&a);
+
+  if (!TEST_CHECK(!result))
   {
-    ac_free(cs, &ac);
     TEST_MSG("This test should have failed\n");
     return;
   }
 
   account = "fruit";
-  const char *CfgAccountVarStr[] = {
+  const char *AccountVarStr[] = {
     "Apple",
     "Cherry",
     NULL,
   };
 
-  ac = ac_new(NULL, account, CfgAccountVarStr);
-  if (!TEST_CHECK(ac == NULL))
+  a = account_new();
+
+  result = account_add_config(NULL, cs, account, AccountVarStr);
+  if (!TEST_CHECK(!result))
+    return;
+
+  result = account_add_config(a, NULL, account, AccountVarStr);
+  if (!TEST_CHECK(!result))
     return;
 
-  ac = ac_new(cs, NULL, CfgAccountVarStr);
-  if (!TEST_CHECK(ac == NULL))
+  result = account_add_config(a, cs, NULL, AccountVarStr);
+  if (!TEST_CHECK(!result))
     return;
 
-  ac = ac_new(cs, account, NULL);
-  if (!TEST_CHECK(ac == NULL))
+  result = account_add_config(a, cs, account, NULL);
+  if (!TEST_CHECK(!result))
     return;
 
-  ac = ac_new(cs, account, CfgAccountVarStr);
-  if (!TEST_CHECK(ac != NULL))
+  result = account_add_config(a, cs, account, AccountVarStr);
+  if (!TEST_CHECK(result))
     return;
 
   size_t index = 0;
   mutt_buffer_reset(&err);
-  int rc = ac_set_value(NULL, index, 33, &err);
+  int rc = account_set_value(NULL, index, 33, &err);
 
-  rc = ac_set_value(ac, index, 33, &err);
+  rc = account_set_value(a, index, 33, &err);
   if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
   {
     TEST_MSG("%s\n", err.data);
   }
 
   mutt_buffer_reset(&err);
-  rc = ac_set_value(ac, 99, 42, &err);
+  rc = account_set_value(a, 99, 42, &err);
   if (TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_UNKNOWN))
   {
     TEST_MSG("Expected error: %s\n", err.data);
@@ -141,36 +152,36 @@ void config_account(void)
   }
 
   mutt_buffer_reset(&err);
-  rc = ac_get_value(NULL, index, &err);
+  rc = account_get_value(NULL, index, &err);
   if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE))
   {
     TEST_MSG("%s\n", err.data);
   }
 
-  rc = ac_get_value(ac, index, &err);
+  rc = account_get_value(a, index, &err);
   if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
   {
     TEST_MSG("%s\n", err.data);
   }
   else
   {
-    TEST_MSG("%s = %s\n", CfgAccountVarStr[index], err.data);
+    TEST_MSG("%s = %s\n", AccountVarStr[index], err.data);
   }
 
   index++;
   mutt_buffer_reset(&err);
-  rc = ac_get_value(ac, index, &err);
+  rc = account_get_value(a, index, &err);
   if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
   {
     TEST_MSG("%s\n", err.data);
   }
   else
   {
-    TEST_MSG("%s = %s\n", CfgAccountVarStr[index], err.data);
+    TEST_MSG("%s = %s\n", AccountVarStr[index], err.data);
   }
 
   mutt_buffer_reset(&err);
-  rc = ac_get_value(ac, 99, &err);
+  rc = account_get_value(a, 99, &err);
   if (TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_UNKNOWN))
   {
     TEST_MSG("Expected error\n");
@@ -251,10 +262,9 @@ void config_account(void)
     return;
   }
 
-  ac_free(NULL, &ac);
-  ac_free(cs, NULL);
+  account_free(NULL);
 
-  ac_free(cs, &ac);
+  account_free(&a);
   cs_free(&cs);
   FREE(&err.data);
   log_line(__func__);
index 1d1af2aa6c649c95a9097995eb779e1f1584755a..e15cc8436ee6984cc59f1a2117fb0fc8b8de3b17 100644 (file)
@@ -31,6 +31,7 @@
 #include "address/lib.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static struct Address *VarApple;
 static struct Address *VarBanana;
@@ -546,7 +547,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarAddr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarAddr);
 
   // set parent
   mutt_buffer_reset(err);
@@ -591,7 +593,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index adc641645008afc2811a43b47857e7b9df06345e..1157120cc302f89e52ae5c7867337a33c0efaaad 100644 (file)
@@ -30,6 +30,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static bool VarApple;
 static bool VarBanana;
@@ -534,7 +535,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   VarMango = false;
@@ -587,7 +589,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index 51665335467a02d4ada0a72703631345f2dfa72d..9ffb4b8d57a1998a441fbef8ccb46b8a834230ba 100644 (file)
@@ -29,6 +29,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static char *VarApple;
 static char *VarBanana;
@@ -573,7 +574,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   mutt_buffer_reset(err);
@@ -618,7 +620,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index 2be588bb43c7d7601d47fdc2efc78c2b5171b1ee..de07ad01118cb90ec214afb708243654cb68069c 100644 (file)
@@ -31,6 +31,7 @@
 #include "mutt/mutt.h"
 #include "config/lib.h"
 #include "common.h"
+#include "account.h"
 
 const char *line = "----------------------------------------"
                    "----------------------------------------";
index 227ed8c7a8db7ca44ccf2921ef18f33b1aec742d..039b857b7854b700ad22c8cf73b162500fea451e 100644 (file)
@@ -26,6 +26,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static bool VarApple;
 static bool VarBanana;
index be82e403d83c52d41673ed1b43ba9e2bea6aad42..571586b3c0c82d2db463102c472a8ef13c96aa5f 100644 (file)
@@ -28,6 +28,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static char *VarApple;
 static char *VarBanana;
index eefa5a5bf6b27d3ecc0af22ea89bd04565fc581e..875378fd051aa3f5cb7548233bf0c1134e5f257e 100644 (file)
@@ -30,6 +30,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static long VarApple;
 static long VarBanana;
@@ -520,7 +521,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   VarOlive = 123;
@@ -569,7 +571,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index aa9d5298e9f083912c232a5c6ddfc0f545bf5d48..30b9a0d2172e7f90955b9852fa95697959ff697d 100644 (file)
@@ -30,6 +30,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static short VarApple;
 static short VarBanana;
@@ -511,7 +512,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   mutt_buffer_reset(err);
@@ -556,7 +558,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index 9825a74f5da5d628ac305d2516712c6dce7bc87c..f612a9ea7ddc7b5f1ce83230758896d4a5de0a18 100644 (file)
@@ -29,6 +29,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static struct MbTable *VarApple;
 static struct MbTable *VarBanana;
@@ -562,7 +563,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarMb);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarMb);
 
   // set parent
   mutt_buffer_reset(err);
@@ -607,7 +609,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index fa3603b16a37f4ce7ea2af79edad42b77d23d065..bf3cdd5c412145c71fd60343f0994649cd0e1961 100644 (file)
@@ -30,6 +30,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static short VarApple;
 static short VarBanana;
@@ -539,7 +540,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   VarOlive = 123;
@@ -588,7 +590,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index ba767874166f3683fa3c9034a8d5cb1ae96d69bc..880746867d5ea3cd74ff3a50aabd2a23951f17a1 100644 (file)
@@ -29,6 +29,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static char *VarApple;
 static char *VarBanana;
@@ -573,7 +574,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   mutt_buffer_reset(err);
@@ -618,7 +620,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index 040a4ad9e256dca2c2d0696fb3cbc1099f368bff..1651a97688e0d5f84a47526e772faabf20578365 100644 (file)
@@ -30,6 +30,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static char VarApple;
 static char VarBanana;
@@ -532,7 +533,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   mutt_buffer_reset(err);
@@ -584,7 +586,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index f8ad60cedd31bacfe8ec0cc737591ec18e27a0b5..e741b4e107969be3724ff863948e1aee8ad94295 100644 (file)
@@ -29,6 +29,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static struct Regex *VarApple;
 static struct Regex *VarBanana;
@@ -622,7 +623,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarRegex);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarRegex);
 
   // set parent
   mutt_buffer_reset(err);
@@ -667,7 +669,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index 4892f6ca2f21239d8e2027a4c73c2ac43ab091e3..9fb392e1e1b9e4163a3451d762a5471bec29a3e7 100644 (file)
@@ -30,6 +30,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static short VarApple;
 static bool VarBanana;
index 2a2fef43ad50f19ee1353c9af003277a66fd7e10..8071c6329f5cd2657df3234a67555963b066aeaf 100644 (file)
@@ -29,6 +29,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static short VarApple;
 static short VarBanana;
@@ -636,7 +637,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   VarStrawberry = SORT_SUBJECT;
@@ -682,7 +684,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index bfefd3cbf71f24d84857912f1d0b4091ab5e005e..3cfb2f0201f70dba4ea7a62bac68dc31d57255c9 100644 (file)
@@ -29,6 +29,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static char *VarApple;
 static char *VarBanana;
@@ -573,7 +574,8 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
     NULL,
   };
 
-  struct CfgAccount *ac = ac_new(cs, account, AccountVarStr);
+  struct Account *a = account_new();
+  account_add_config(a, cs, account, AccountVarStr);
 
   // set parent
   mutt_buffer_reset(err);
@@ -618,7 +620,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
   result = true;
 ti_out:
-  ac_free(cs, &ac);
+  account_free(&a);
   return result;
 }
 
index ef48127eb0de3359b52e0d3246f13aa69671a562..cd69183488a2c298008df2cb221081615c33fde7 100644 (file)
@@ -29,6 +29,7 @@
 #include "mutt/mutt.h"
 #include "config/common.h"
 #include "config/lib.h"
+#include "account.h"
 
 static char *VarApple;
 static char *VarCherry;