[asterisk-commits] kmoore: branch kmoore/stasis-presence_state r384477 - in /team/kmoore/stasis-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 1 12:09:04 CDT 2013


Author: kmoore
Date: Mon Apr  1 12:09:01 2013
New Revision: 384477

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384477
Log:
Tweak naming of new presence state functions as per comments from another review

Modified:
    team/kmoore/stasis-presence_state/funcs/func_presencestate.c
    team/kmoore/stasis-presence_state/include/asterisk/presencestate.h
    team/kmoore/stasis-presence_state/main/pbx.c
    team/kmoore/stasis-presence_state/main/presencestate.c

Modified: team/kmoore/stasis-presence_state/funcs/func_presencestate.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-presence_state/funcs/func_presencestate.c?view=diff&rev=384477&r1=384476&r2=384477
==============================================================================
--- team/kmoore/stasis-presence_state/funcs/func_presencestate.c (original)
+++ team/kmoore/stasis-presence_state/funcs/func_presencestate.c Mon Apr  1 12:09:01 2013
@@ -645,7 +645,7 @@
 }
 
 struct test_cb_data {
-	struct stasis_presence_state *presence_state;
+	struct ast_presence_state_message *presence_state;
 	/* That's right. I'm using a semaphore */
 	sem_t sem;
 };
@@ -653,7 +653,7 @@
 static void test_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
 {
 	struct test_cb_data *cb_data = userdata;
-	if (stasis_message_type(msg) != stasis_presence_state_type()) {
+	if (stasis_message_type(msg) != ast_presence_state_message_type()) {
 		return;
 	}
 	cb_data->presence_state = stasis_message_data(msg);
@@ -689,7 +689,7 @@
 		return AST_TEST_FAIL;
 	}
 
-	if (!(test_sub = stasis_subscribe(stasis_presence_state_topic_all(), test_cb, cb_data))) {
+	if (!(test_sub = stasis_subscribe(ast_presence_state_topic_all(), test_cb, cb_data))) {
 		return AST_TEST_FAIL;
 	}
 

Modified: team/kmoore/stasis-presence_state/include/asterisk/presencestate.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-presence_state/include/asterisk/presencestate.h?view=diff&rev=384477&r1=384476&r2=384477
==============================================================================
--- team/kmoore/stasis-presence_state/include/asterisk/presencestate.h (original)
+++ team/kmoore/stasis-presence_state/include/asterisk/presencestate.h Mon Apr  1 12:09:01 2013
@@ -154,23 +154,23 @@
  * \retval Stasis message type for presence state messages
  * \since 12
  */
-struct stasis_message_type *stasis_presence_state_type(void);
+struct stasis_message_type *ast_presence_state_message_type(void);
 
 /*!
  * \brief Get presence state topic
  * \retval Stasis topic for presence state messages
  * \since 12
  */
-struct stasis_topic *stasis_presence_state_topic_all(void);
+struct stasis_topic *ast_presence_state_topic_all(void);
 
 /*!
  * \brief Get caching presence state topic
  * \retval Caching Stasis topic for presence state messages
  * \since 12
  */
-struct stasis_caching_topic *stasis_presence_state_topic_cached(void);
+struct stasis_caching_topic *ast_presence_state_topic_cached(void);
 
-struct stasis_presence_state {
+struct ast_presence_state_message {
 		AST_DECLARE_STRING_FIELDS(
 			AST_STRING_FIELD(provider);	/*!< Provider that produced this presence state message */
 			AST_STRING_FIELD(subtype);	/*!< Subtype associated with this presence state message */

Modified: team/kmoore/stasis-presence_state/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-presence_state/main/pbx.c?view=diff&rev=384477&r1=384476&r2=384477
==============================================================================
--- team/kmoore/stasis-presence_state/main/pbx.c (original)
+++ team/kmoore/stasis-presence_state/main/pbx.c Mon Apr  1 12:09:01 2013
@@ -11537,7 +11537,7 @@
 
 static void presence_state_cb(void *unused, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
 {
-	struct stasis_presence_state *presence_state = stasis_message_data(msg);
+	struct ast_presence_state_message *presence_state = stasis_message_data(msg);
 	struct ast_hint *hint;
 	struct ast_str *hint_app = NULL;
 	struct ao2_iterator hint_iter;
@@ -11545,7 +11545,7 @@
 	char context_name[AST_MAX_CONTEXT];
 	char exten_name[AST_MAX_EXTENSION];
 
-	if (stasis_message_type(msg) != stasis_presence_state_type()) {
+	if (stasis_message_type(msg) != ast_presence_state_message_type()) {
 		return;
 	}
 
@@ -11782,7 +11782,7 @@
 		return -1;
 	}
 
-	if (!(presence_state_sub = stasis_subscribe(stasis_presence_state_topic_all(), presence_state_cb, NULL))) {
+	if (!(presence_state_sub = stasis_subscribe(ast_presence_state_topic_all(), presence_state_cb, NULL))) {
 		return -1;
 	}
 

Modified: team/kmoore/stasis-presence_state/main/presencestate.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-presence_state/main/presencestate.c?view=diff&rev=384477&r1=384476&r2=384477
==============================================================================
--- team/kmoore/stasis-presence_state/main/presencestate.c (original)
+++ team/kmoore/stasis-presence_state/main/presencestate.c Mon Apr  1 12:09:01 2013
@@ -93,9 +93,9 @@
 {
 	enum ast_presence_state res = AST_PRESENCE_INVALID;
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-	struct stasis_presence_state *presence_state;
-
-	msg = stasis_cache_get(stasis_presence_state_topic_cached(), stasis_presence_state_type(), presence_provider);
+	struct ast_presence_state_message *presence_state;
+
+	msg = stasis_cache_get(ast_presence_state_topic_cached(), ast_presence_state_message_type(), presence_provider);
 
 	if (!msg) {
 		return res;
@@ -199,16 +199,16 @@
 
 static void presence_state_dtor(void *obj)
 {
-	struct stasis_presence_state *presence_state = obj;
+	struct ast_presence_state_message *presence_state = obj;
 	ast_string_field_free_memory(presence_state);
 }
 
-static struct stasis_presence_state *presence_state_alloc(const char *provider,
+static struct ast_presence_state_message *presence_state_alloc(const char *provider,
 		enum ast_presence_state state,
 		const char *subtype,
 		const char *message)
 {
-	RAII_VAR(struct stasis_presence_state *, presence_state, ao2_alloc(sizeof(*presence_state), presence_state_dtor), ao2_cleanup);
+	RAII_VAR(struct ast_presence_state_message *, presence_state, ao2_alloc(sizeof(*presence_state), presence_state_dtor), ao2_cleanup);
 
 	if (!presence_state || ast_string_field_init(presence_state, 256)) {
 		return NULL;
@@ -229,18 +229,18 @@
 		const char *message)
 {
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-	RAII_VAR(struct stasis_presence_state *, presence_state, presence_state_alloc(provider, state, subtype, message), ao2_cleanup);
+	RAII_VAR(struct ast_presence_state_message *, presence_state, presence_state_alloc(provider, state, subtype, message), ao2_cleanup);
 
 	if (!presence_state) {
 		return;
 	}
 
-	msg = stasis_message_create(stasis_presence_state_type(), presence_state);
+	msg = stasis_message_create(ast_presence_state_message_type(), presence_state);
 	if (!msg) {
 		return;
 	}
 
-	stasis_publish(stasis_presence_state_topic_all(), msg);
+	stasis_publish(ast_presence_state_topic_all(), msg);
 }
 
 static void do_presence_state_change(const char *provider)
@@ -289,26 +289,26 @@
 	return ast_presence_state_changed_literal(state, subtype, message, buf);
 }
 
-struct stasis_message_type *stasis_presence_state_type(void)
+struct stasis_message_type *ast_presence_state_message_type(void)
 {
 	return presence_state_type;
 }
 
-struct stasis_topic *stasis_presence_state_topic_all(void)
+struct stasis_topic *ast_presence_state_topic_all(void)
 {
 	return presence_state_topic_all;
 }
 
-struct stasis_caching_topic *stasis_presence_state_topic_cached(void)
+struct stasis_caching_topic *ast_presence_state_topic_cached(void)
 {
 	return presence_state_topic_cached;
 }
 
 static const char *presence_state_get_id(struct stasis_message *msg)
 {
-	struct stasis_presence_state *presence_state = stasis_message_data(msg);
-
-	if (stasis_message_type(msg) != stasis_presence_state_type()) {
+	struct ast_presence_state_message *presence_state = stasis_message_data(msg);
+
+	if (stasis_message_type(msg) != ast_presence_state_message_type()) {
 		return NULL;
 	}
 
@@ -327,12 +327,12 @@
 
 int ast_presence_state_engine_init(void)
 {
-	presence_state_type = stasis_message_type_create("stasis_presence_state");
+	presence_state_type = stasis_message_type_create("ast_presence_state_message");
 	if (!presence_state_type) {
 		return -1;
 	}
 
-	presence_state_topic_all = stasis_topic_create("stasis_presence_state_topic_all");
+	presence_state_topic_all = stasis_topic_create("ast_presence_state_topic_all");
 	if (!presence_state_topic_all) {
 		return -1;
 	}




More information about the asterisk-commits mailing list