summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-07-24 18:08:02 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-07-24 18:08:02 +0200
commitff3961ad2920ba674272b4f842f4456ed685a4a7 (patch)
tree4b54f90607d45857712e23bd451c1a627e89cdf4 /modules
parent713f55a1f9958222f85238bde40482b566cf040e (diff)
conf: add handler argument to line-handler
Diffstat (limited to 'modules')
-rw-r--r--modules/account/account.c5
-rw-r--r--modules/contact/contact.c10
2 files changed, 9 insertions, 6 deletions
diff --git a/modules/account/account.c b/modules/account/account.c
index 9cd4235..c70a216 100644
--- a/modules/account/account.c
+++ b/modules/account/account.c
@@ -104,9 +104,10 @@ static int account_write_template(const char *file)
*
* @return 0 if success, otherwise errorcode
*/
-static int line_handler(const struct pl *addr)
+static int line_handler(const struct pl *addr, void *arg)
{
char buf[512];
+ (void)arg;
(void)pl_strcpy(addr, buf, sizeof(buf));
@@ -143,7 +144,7 @@ static int account_read_file(void)
return err;
}
- err = conf_parse(file, line_handler);
+ err = conf_parse(file, line_handler, NULL);
if (err)
return err;
diff --git a/modules/contact/contact.c b/modules/contact/contact.c
index 2a566eb..c71c370 100644
--- a/modules/contact/contact.c
+++ b/modules/contact/contact.c
@@ -22,9 +22,10 @@ static const char *chat_peer; /**< Selected chat peer */
static char cmd_desc[128] = "Send MESSAGE to peer";
-static int confline_handler(const struct pl *addr)
+static int confline_handler(const struct pl *addr, void *arg)
{
- return contact_add(baresip_contacts(), NULL, addr);
+ struct contacts *contacts = arg;
+ return contact_add(contacts, NULL, addr);
}
@@ -182,6 +183,7 @@ static int write_template(const char *file)
static int module_init(void)
{
+ struct contacts *contacts = baresip_contacts();
char path[256] = "", file[256] = "";
int err;
@@ -201,7 +203,7 @@ static int module_init(void)
return err;
}
- err = conf_parse(file, confline_handler);
+ err = conf_parse(file, confline_handler, contacts);
if (err)
return err;
@@ -210,7 +212,7 @@ static int module_init(void)
return err;
info("Populated %u contacts\n",
- list_count(contact_list(baresip_contacts())));
+ list_count(contact_list(contacts)));
return err;
}