[svn-commits] branch bweschke/func_realtime_bug_5695 r13963 - /team/bweschke/func_realtime_...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Mar 21 11:44:25 MST 2006


Author: bweschke
Date: Tue Mar 21 12:44:23 2006
New Revision: 13963

URL: http://svn.digium.com/view/asterisk?rev=13963&view=rev
Log:
 Not only does it compile, it might actually work with Asterisk now! :-p


Modified:
    team/bweschke/func_realtime_bug_5695/funcs/func_realtime.c

Modified: team/bweschke/func_realtime_bug_5695/funcs/func_realtime.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/func_realtime_bug_5695/funcs/func_realtime.c?rev=13963&r1=13962&r2=13963&view=diff
==============================================================================
--- team/bweschke/func_realtime_bug_5695/funcs/func_realtime.c (original)
+++ team/bweschke/func_realtime_bug_5695/funcs/func_realtime.c Tue Mar 21 12:44:23 2006
@@ -42,12 +42,20 @@
 #include "asterisk/utils.h"
 #include "asterisk/app.h"
 
+LOCAL_USER_DECL;
+
+static char *tdesc = "Read/Write values from a RealTime repository";
+
 static int function_realtime_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) 
 {
 
 	struct ast_variable *var=NULL,*head=NULL;
+        struct localuser *u;
 	char *results;
 	unsigned int resultslen=0;
+
+	LOCAL_USER_ADD(u);
+
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(family);
 		AST_APP_ARG(metamatch);
@@ -85,13 +93,19 @@
 	else
 		return -1;
 	ast_copy_string(buf, results, len);
+
+	LOCAL_USER_REMOVE(u);
 	
 	return 0;
 }
 
 static int function_realtime_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
 {
+        struct localuser *u;
 	int res = 0;
+
+	LOCAL_USER_ADD(u);
+
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(family);
 		AST_APP_ARG(metamatch);
@@ -110,6 +124,8 @@
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Failed to update. Check the debug log for possible data repository related entries.\n");
 	}
+
+	LOCAL_USER_REMOVE(u);
 
 	return 0;
 }
@@ -132,3 +148,40 @@
 	.write = function_realtime_write,
 };
 
+int unload_module(void)
+{
+        int res = 0;
+
+        res |= ast_custom_function_unregister(&realtime_function);
+
+        STANDARD_HANGUP_LOCALUSERS;
+
+        return res;
+}
+
+int load_module(void)
+{
+        int res = 0;
+
+        res |= ast_custom_function_register(&realtime_function);
+
+        return res;
+}
+
+char *description(void)
+{
+        return tdesc;
+}
+
+int usecount(void)
+{
+        int res;
+        STANDARD_USECOUNT(res);
+        return res;
+}
+
+char *key()
+{
+        return ASTERISK_GPL_KEY;
+}
+



More information about the svn-commits mailing list