summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-06-16 21:27:59 +0200
committerAlfred E. Heggestad <aeh@db.org>2015-06-16 21:27:59 +0200
commit3905f6ccd0700b98046015c37cdd9af9eb2550cb (patch)
tree398b7d61daa0e3579f54688e3f34e00806ca811b /modules
parent2753cdfc7c3574a2d32f5b251cb857027074d3d7 (diff)
account: add doxygen group and check return value
Diffstat (limited to 'modules')
-rw-r--r--modules/account/account.c29
-rw-r--r--modules/account/module.mk2
2 files changed, 27 insertions, 4 deletions
diff --git a/modules/account/account.c b/modules/account/account.c
index 9a9f282..46a6861 100644
--- a/modules/account/account.c
+++ b/modules/account/account.c
@@ -1,16 +1,37 @@
/**
* @file account/account.c Load SIP accounts from file
*
- * Copyright (C) 2010 Creytiv.com
+ * Copyright (C) 2010 - 2015 Creytiv.com
*/
#include <re.h>
#include <baresip.h>
+/**
+ * @defgroup account account
+ *
+ * Load SIP accounts from a file
+ *
+ * This module is loading SIP accounts from file ~/.baresip/accounts.
+ * If the file exist and is readable, all SIP accounts will be populated
+ * from this file. If the file does not exist, a template file will be
+ * created.
+ *
+ * Examples:
+ \verbatim
+ "User 1 with password prompt" <sip:user@domain.com>
+ "User 2 with stored password" <sip:user:pass@domain.com>
+ "User 2 with ICE" <sip:user@1.2.3.4;transport=tcp>;medianat=ice
+ "User 3 with IPv6" <sip:user@[2001:df8:0:16:216:6fff:fe91:614c]:5070>
+ \endverbatim
+ */
+
+
static int account_write_template(const char *file)
{
FILE *f = NULL;
const char *login, *pass, *domain;
+ int r, err = 0;
info("account: creating accounts template %s\n", file);
@@ -28,7 +49,7 @@ static int account_write_template(const char *file)
if (!domain)
domain = "domain";
- (void)re_fprintf(f,
+ r = re_fprintf(f,
"#\n"
"# SIP accounts - one account per line\n"
"#\n"
@@ -66,11 +87,13 @@ static int account_write_template(const char *file)
";transport=tcp>\n"
"#\n"
"#<sip:%s:%s@%s>\n", login, pass, domain);
+ if (r < 0)
+ err = ENOMEM;
if (f)
(void)fclose(f);
- return 0;
+ return err;
}
diff --git a/modules/account/module.mk b/modules/account/module.mk
index 37e3ba0..8f461d6 100644
--- a/modules/account/module.mk
+++ b/modules/account/module.mk
@@ -1,7 +1,7 @@
#
# module.mk
#
-# Copyright (C) 2010 Creytiv.com
+# Copyright (C) 2010 - 2015 Creytiv.com
#
MOD := account