[asterisk-addons-commits] qwell: trunk r289 - in /trunk: ./ asterisk-ooh323c/src/ format_mp3/ res_sqlite3/

asterisk-addons-commits at lists.digium.com asterisk-addons-commits at lists.digium.com
Thu Aug 31 22:03:34 MST 2006


Author: qwell
Date: Fri Sep  1 00:03:34 2006
New Revision: 289

URL: http://svn.digium.com/view/asterisk-addons?rev=289&view=rev
Log:
More fixage of asterisk-addons.

Used much of the patch from 7809 - thanks Mithraen

Modified:
    trunk/app_addon_sql_mysql.c
    trunk/app_saycountpl.c
    trunk/asterisk-ooh323c/src/chan_h323.c
    trunk/cdr_addon_mysql.c
    trunk/format_mp3/format_mp3.c
    trunk/res_config_mysql.c
    trunk/res_sqlite3/res_sqlite.c

Modified: trunk/app_addon_sql_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/app_addon_sql_mysql.c?rev=289&r1=288&r2=289&view=diff
==============================================================================
--- trunk/app_addon_sql_mysql.c (original)
+++ trunk/app_addon_sql_mysql.c Fri Sep  1 00:03:34 2006
@@ -33,9 +33,9 @@
 #include <asterisk/chanvars.h>
 #include <asterisk/lock.h>
 
+#define AST_MODULE "app_addon_sql_mysql"
+
 #define EXTRA_LOG 0
-
-static char *tdesc = "Simple Mysql Interface";
 
 static char *app = "MYSQL";
 
@@ -74,8 +74,6 @@
 exten => s,8,MYSQL(Clear ${resultid})
 exten => s,9,MYSQL(Disconnect ${connid})
 */
-
-LOCAL_USER_DECL;
 
 AST_MUTEX_DEFINE_STATIC(_mysql_mutex);
 
@@ -374,7 +372,7 @@
 
 static int MYSQL_exec(struct ast_channel *chan, void *data)
 {
-	struct localuser *u;
+	struct ast_module_user *u;
 	int result;
 	char sresult[10];
 
@@ -387,7 +385,7 @@
 		return -1;
 	}
 
-	LOCAL_USER_ADD(u);
+	u = ast_module_user_add(chan);
 	result=0;
 
 	ast_mutex_lock(&_mysql_mutex);
@@ -409,7 +407,7 @@
 		
 	ast_mutex_unlock(&_mysql_mutex);
 
-	LOCAL_USER_REMOVE(u);                                                                                
+	ast_module_user_remove(u);
 	snprintf(sresult, sizeof(sresult), "%d", result);
 	pbx_builtin_setvar_helper(chan, "MYSQL_STATUS", sresult);
 	return 0;
@@ -417,6 +415,7 @@
 
 static int unload_module(void)
 {
+	ast_module_user_hangup_all();
 	return ast_unregister_application(app);
 }
 
@@ -427,14 +426,4 @@
 	return ast_register_application(app, MYSQL_exec, synopsis, descrip);
 }
 
-static const char *description(void)
-{
-	return tdesc;
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Simple Mysql Interface");

Modified: trunk/app_saycountpl.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/app_saycountpl.c?rev=289&r1=288&r2=289&view=diff
==============================================================================
--- trunk/app_saycountpl.c (original)
+++ trunk/app_saycountpl.c Fri Sep  1 00:03:34 2006
@@ -21,8 +21,6 @@
 
 #define AST_MODULE "ast_saycountpl"
 
-static char *tdesc = "Say polish counting words";
-
 static char *app = "SayCountPL";
 
 static char *synopsis = "Say the counting word the fits to a number";
@@ -31,8 +29,6 @@
 "Polish grammar has some funny rules for counting words. for example 1 zloty, 2 zlote, 5 zlotych. This application will take the words for 1, 2-4 and 5 and\n"
 "decide based on grammar rules which one to use with the number you pass to it.\n\n"
 "Example: saycountpl(zloty,zlote,zlotych,122) will give: zlote\n";
-
-LOCAL_USER_DECL;
 
 static int saywords(struct ast_channel *chan, char *word1, char *word2, char *word5, int num)
 {
@@ -73,15 +69,13 @@
 	
         int inum;
 	
-	struct localuser *u;
-
-	u = ast_module_user_add(chan);
+	struct ast_module_user *u;
 
 	if (!data) {
 		ast_log(LOG_WARNING, "You didn't pass any arguments - I need 4 arguments, word-1,word-2,word-5,number\n");
 		return -1;
 	}
-	LOCAL_USER_ADD(u);
+	u = ast_module_user_add(chan);
 	/* Do our shit here */
 
         s = ast_strdupa((void *) data);
@@ -126,17 +120,4 @@
 	return ast_register_application(app, sayword_exec, synopsis, descrip);
 }
 
-static const char *description(void)
-{
-	return tdesc;
-}
-
-static const char *key()
-{
-	return ASTERISK_GPL_KEY;
-}
-
-
-/* Get down on it... get down on it... */
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Say polish counting words");

Modified: trunk/asterisk-ooh323c/src/chan_h323.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/asterisk-ooh323c/src/chan_h323.c?rev=289&r1=288&r2=289&view=diff
==============================================================================
--- trunk/asterisk-ooh323c/src/chan_h323.c (original)
+++ trunk/asterisk-ooh323c/src/chan_h323.c Fri Sep  1 00:03:34 2006
@@ -17,8 +17,7 @@
 
 #include "chan_h323.h"
 
-
-#define AST_MODULE "chan_oo323"
+#define AST_MODULE "chan_ooh323"
 
 /* Defaults */
 #define DEFAULT_CONTEXT "default"
@@ -37,7 +36,6 @@
 #define H323_DISABLEGK          (1<<7)
 
 /* Channel description */
-static const char desc[] = "Objective Systems H323 Channel";
 static const char type[] = "OOH323";
 static const char tdesc[] = "Objective Systems H323 Channel Driver";
 static const char config[] = "ooh323.conf";
@@ -3174,17 +3172,6 @@
    return 0;
 }
 
-static const char *key(void)
-{
-   return ASTERISK_GPL_KEY;
-}
-
-static const char *description(void)
-{
-   return (char*)desc;
-}
-
-
 void ast_ooh323c_exit()
 {
    ooGkClientDestroy();

Modified: trunk/cdr_addon_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/cdr_addon_mysql.c?rev=289&r1=288&r2=289&view=diff
==============================================================================
--- trunk/cdr_addon_mysql.c (original)
+++ trunk/cdr_addon_mysql.c Fri Sep  1 00:03:34 2006
@@ -45,6 +45,7 @@
 #include <errno.h>
 
 #define AST_MODULE "cdr_addon_mysql"
+
 #define DATE_FORMAT "%Y-%m-%d %T"
 
 static char *desc = "MySQL CDR Backend";
@@ -115,7 +116,6 @@
 {
 	struct tm tm;
 	struct timeval tv;
-	struct localuser *u;
 	struct ast_module_user *u;
 	char *userfielddata = NULL;
 	char sqlcmd[2048], timestr[128];
@@ -239,11 +239,6 @@
 	return 0;
 }
 
-static const char *description(void)
-{
-	return desc;
-}
-
 static int my_unload_module(void)
 { 
 	ast_cli_unregister(&cdr_mysql_status_cli);
@@ -458,17 +453,17 @@
 	return res;
 }
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return my_load_module();
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return my_unload_module();
 }
 
-static int reload(void *mod)
+static int reload(void)
 {
 	int ret;
 
@@ -480,9 +475,5 @@
 	return ret;
 }
 
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "MySQL CDR Backend");
 

Modified: trunk/format_mp3/format_mp3.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/format_mp3/format_mp3.c?rev=289&r1=288&r2=289&view=diff
==============================================================================
--- trunk/format_mp3/format_mp3.c (original)
+++ trunk/format_mp3/format_mp3.c Fri Sep  1 00:03:34 2006
@@ -67,7 +67,6 @@
 };
 
 static char *name = "mp3";
-static char *desc = "MP3 format [Any rate but 8000hz mono optimal]";
 
 #define BLOCKSIZE 160
 #define OUTSCALE 4096
@@ -335,15 +334,4 @@
 	return ast_format_unregister(name);
 }	
 
-static const char *description(void)
-{
-	return desc;
-}
-
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "MP3 format [Any rate but 8000hz mono optimal]");
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "MP3 format [Any rate but 8000hz mono is optimal]");

Modified: trunk/res_config_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/res_config_mysql.c?rev=289&r1=288&r2=289&view=diff
==============================================================================
--- trunk/res_config_mysql.c (original)
+++ trunk/res_config_mysql.c Fri Sep  1 00:03:34 2006
@@ -56,7 +56,7 @@
 #include <mysql/mysql_version.h>
 #include <mysql/errmsg.h>
 
-static char *res_config_mysql_desc = "MySQL RealTime Configuration Driver";
+#define AST_MODULE "res_config_mysql"
 
 AST_MUTEX_DEFINE_STATIC(mysql_lock);
 #define RES_CONFIG_MYSQL_CONF "res_mysql.conf"
@@ -73,8 +73,6 @@
 static int parse_config(void);
 static int mysql_reconnect(const char *database);
 static int realtime_mysql_status(int fd, int argc, char **argv);
-
-LOCAL_USER_DECL;
 
 static char cli_realtime_mysql_status_usage[] =
 "Usage: realtime mysql status\n"
@@ -501,6 +499,7 @@
 		ast_verbose("MySQL RealTime unloaded.\n");
 	}
 
+	ast_module_user_hangup_all();
 
 	/* Unlock so something else can destroy the lock. */
 	ast_mutex_unlock(&mysql_lock);
@@ -508,7 +507,7 @@
 	return 0;
 }
 
-static int reload(void *mod)
+static int reload(void)
 {
 	/* Aquire control before doing anything to the module itself. */
 	ast_mutex_lock(&mysql_lock);
@@ -592,16 +591,6 @@
 	ast_log(LOG_DEBUG, "MySQL RealTime Password: %s\n", dbpass);
 
 	return 1;
-}
-
-static const char *description (void)
-{
-	return res_config_mysql_desc;
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
 }
 
 static int mysql_reconnect(const char *database)
@@ -700,3 +689,4 @@
 	}
 }
 
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "MySQL RealTime Configuration Driver");

Modified: trunk/res_sqlite3/res_sqlite.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/res_sqlite3/res_sqlite.c?rev=289&r1=288&r2=289&view=diff
==============================================================================
--- trunk/res_sqlite3/res_sqlite.c (original)
+++ trunk/res_sqlite3/res_sqlite.c Fri Sep  1 00:03:34 2006
@@ -122,20 +122,16 @@
 	int seeheads;
 };
 
-static char *desc = "SQLite Resource Module";
 static char *default_dbdir = "/var/lib/asterisk/sqlite";
 static char *default_dbfile = "/var/lib/asterisk/sqlite/asterisk.db";
 static char clidb[ARRAY_SIZE] = {"/var/lib/asterisk/sqlite/asterisk.db"};
 
 static Hash extens;
-
-
 
 static char *tdesc = "SQLite SQL Interface";
 static char *app = "SQL";
 static char *synopsis = "SQL(\"[sql statement]\"|[dbname])\n" 
 "[if it's a select it will auto-vivify chan vars matching the selected column names.]\n";
-
 
 static void pick_path(char *dbname,char *buf, size_t size) {
 
@@ -161,15 +157,6 @@
 	return db;
 }
 
-
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-
-
-
 static int app_callback(void *pArg, int argc, char **argv, char **columnNames){
 	int x=0;
 	struct ast_channel *chan = pArg;
@@ -184,7 +171,7 @@
 static int sqlite_execapp(struct ast_channel *chan, void *data)
 {
 	int res=0;
-	struct localuser *u;
+	struct ast_module_user *u;
 	char *errmsg;
 	sqlite3 *db;
 	char *filename=NULL;
@@ -222,7 +209,7 @@
 	if (!db)
 		return -1;
 
-	LOCAL_USER_ADD(u);
+	u = ast_module_user_add(chan);
 	/* Do our thing here */
 
 
@@ -240,18 +227,13 @@
 		errmsg = NULL;
 	}
 
-
-	LOCAL_USER_REMOVE(u);
+	ast_module_user_remove(u);
 	sqlite3_close(db);
 	return res;
 }
 
-
-
-
 AST_MUTEX_DEFINE_STATIC(switch_lock);
 AST_MUTEX_DEFINE_STATIC(cdr_lock);
-
 
 static int cli_callback(void *pArg, int argc, char **argv, char **columnNames){
 	int fd=0;
@@ -468,7 +450,6 @@
 	return 0;
 }
 
-
 static int exist_callback(void *pArg, int argc, char **argv, char **columnNames){
 	extension_cache *cache;
 	char key[ARRAY_SIZE];
@@ -526,9 +507,6 @@
 	}
 	return 0;
 }
-
-
-
 
 static int SQLiteSwitch_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
 {
@@ -639,7 +617,6 @@
 
 }
 
-
 static int SQLiteSwitch_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data)
 {
 	struct ast_app *app;
@@ -687,7 +664,6 @@
 	return res;
 
 }
-
 
 static struct ast_switch sqlite_switch = 
 	{
@@ -710,7 +686,6 @@
 "[select][insert][update][delete][begin][rollback][create][drop] <...>\n"
 "\n\nThis is SQLite for asterisk as implemented by Anthony Minessle anthm anthmct at yahoo.com\n"
 "when you discover how kick-ass this module is, please donate money via paypal to jillkm3 at yahoo.com\n\n";
-
 
 static struct ast_cli_entry	 cli_sqlite1 = { { "select", NULL }, sqlite_cli, scmd, shelp};
 static struct ast_cli_entry	 cli_sqlite2 = { { "insert", NULL }, sqlite_cli, scmd, shelp};
@@ -738,7 +713,6 @@
 	int i=0;
 	struct ast_config *config;
 
-
 	/* if the data was not passed from extconfig.conf then get it from sqlite.conf */
 	if(!database || ast_strlen_zero(database)) {
 		if (!file || !strcmp (file, "res_sqlite.conf"))
@@ -765,7 +739,6 @@
 
 	if (configured < 2)
 		return NULL;
-
 
 	db=open_db(path);
 	if (!db)
@@ -835,7 +808,6 @@
 
 	return cfg;
 }
-
 
 static int sqlite_log(struct ast_cdr *cdr)
 {
@@ -915,7 +887,6 @@
 			break;
 		}
 
-
 		if (res != SQLITE_BUSY && res != SQLITE_LOCKED)
 			break;
 		usleep(200);
@@ -974,7 +945,6 @@
 	return res;
 }
 
-
 static void check_table_exists(char *dbfile, char *test_sql, char *create_sql) {
 	sqlite3 *db;
 	char *errmsg;
@@ -1109,7 +1079,6 @@
 	return 0;
 }
 
-
 int reload(void) {
 	return load_config(0);
 }
@@ -1131,7 +1100,6 @@
 	ast_config_engine_register(&sqlite_engine);
 	ast_verbose(VERBOSE_PREFIX_2 "SQLite Config Handler Registered.\n");
 
-
 	if (has_cdr) {
 		ast_verbose(VERBOSE_PREFIX_2 "Loading SQLite CDR\n");
 		res = ast_cdr_register(cdr_name, "RES SQLite CDR", sqlite_log);
@@ -1139,10 +1107,7 @@
 	else 
 		ast_verbose(VERBOSE_PREFIX_2 "SQLite CDR Disabled\n");
 
-
-
 	ast_register_application(app, sqlite_execapp, synopsis, tdesc);
-
 
 	if (has_switch) {
 		if (ast_register_switch(&sqlite_switch))
@@ -1173,8 +1138,6 @@
 	return res;
 }
 
-
-
 int unload_module(void)
 {
 	int res = 0;
@@ -1201,9 +1164,6 @@
 		
 	ast_unregister_application(app);
 
-
-
-
 	if (has_switch) {
 		ast_verbose(VERBOSE_PREFIX_2 "SQLite Switch Disabled\n");
 		ast_unregister_switch(&sqlite_switch);
@@ -1211,11 +1171,6 @@
 	}
 	
 	return res;
-}
-
-char *description(void)
-{
-	return desc;
 }
 
 int usecount(void)
@@ -1225,7 +1180,4 @@
 	return res;
 }
 
-char *key()
-{
-	return ASTERISK_GPL_KEY;
-}
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "SQLite Resource Module");



More information about the asterisk-addons-commits mailing list