[asterisk-commits] mmichelson: trunk r413469 - /trunk/funcs/func_presencestate.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 7 16:58:42 CDT 2014


Author: mmichelson
Date: Wed May  7 16:58:37 2014
New Revision: 413469

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=413469
Log:
Ensure that presence state is decoded properly on Asterisk startup.

The CustomPresence provider callback will automatically base64 decode
stored data if the 'e' option was present when the state was set. However,
since the provider callback was bypassed on Asterisk startup, encoded
presence subtypes and messages were being sent instead. This fix makes
it so the provider callback is always used when providing presence
state updates.


Modified:
    trunk/funcs/func_presencestate.c

Modified: trunk/funcs/func_presencestate.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_presencestate.c?view=diff&rev=413469&r1=413468&r2=413469
==============================================================================
--- trunk/funcs/func_presencestate.c (original)
+++ trunk/funcs/func_presencestate.c Wed May  7 16:58:37 2014
@@ -263,6 +263,7 @@
 
 	if ((strchr(_options, 'e'))) {
 		char tmp[1301];
+
 		if (ast_strlen_zero(_subtype)) {
 			*subtype = NULL;
 		} else {
@@ -848,20 +849,16 @@
 	db_entry = db_tree = ast_db_gettree(astdb_family, NULL);
 	for (; db_entry; db_entry = db_entry->next) {
 		const char *dev_name = strrchr(db_entry->key, '/') + 1;
-		char state_info[1301];
 		enum ast_presence_state state;
 		char *message;
 		char *subtype;
-		char *options;
 		if (dev_name <= (const char *) 1) {
 			continue;
 		}
-		ast_copy_string(state_info, db_entry->data, sizeof(state_info));
-		if (parse_data(state_info, &state, &subtype, &message, &options)) {
-			ast_log(LOG_WARNING, "Invalid CustomPresence entry %s encountered\n", db_entry->data);
-			continue;
-		}
+		state = custom_presence_callback(dev_name, &subtype, &message);
 		ast_presence_state_changed(state, subtype, message, "CustomPresence:%s", dev_name);
+		ast_free(subtype);
+		ast_free(message);
 	}
 	ast_db_freetree(db_tree);
 	db_tree = NULL;




More information about the asterisk-commits mailing list