[svn-commits] kmoore: branch kmoore/stasis-presence_state r383503 - in /team/kmoore/stasis-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 20 22:59:16 CDT 2013


Author: kmoore
Date: Wed Mar 20 22:59:12 2013
New Revision: 383503

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383503
Log:
Add initial stasis structures necessary to convert presence state

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

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=383503&r1=383502&r2=383503
==============================================================================
--- team/kmoore/stasis-presence_state/include/asterisk/presencestate.h (original)
+++ team/kmoore/stasis-presence_state/include/asterisk/presencestate.h Wed Mar 20 22:59:12 2013
@@ -149,6 +149,29 @@
  */
 int ast_presence_state_prov_del(const char *label);
 
+/*!
+ * \brief Get presence state message type
+ * \retval Stasis message type for presence state messages
+ * \since 12
+ */
+struct stasis_message_type *stasis_presence_state_message(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_presence_state {
+		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 */
+			AST_STRING_FIELD(message);	/*!< The message to convey */
+		);
+		enum ast_presence_state state;		/*!< The state associated with this presence state message */
+};
+
 int ast_presence_state_engine_init(void);
 #endif
 

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=383503&r1=383502&r2=383503
==============================================================================
--- team/kmoore/stasis-presence_state/main/presencestate.c (original)
+++ team/kmoore/stasis-presence_state/main/presencestate.c Wed Mar 20 22:59:12 2013
@@ -52,6 +52,9 @@
 	{ "chat", AST_PRESENCE_CHAT},
 	{ "dnd", AST_PRESENCE_DND},
 };
+
+struct stasis_message_type *presence_state_message;
+struct stasis_topic *presence_state_topic_all;
 
 /*! \brief Flag for the queue */
 static ast_cond_t change_pending;
@@ -312,8 +315,37 @@
 	return NULL;
 }
 
+struct stasis_message_type *stasis_presence_state_message(void)
+{
+	return presence_state_message;
+}
+
+struct stasis_topic *stasis_presence_state_topic_all(void)
+{
+	return presence_state_topic_all;
+}
+
+static void presence_state_engine_cleanup(void)
+{
+	ao2_cleanup(presence_state_topic_all);
+	presence_state_topic_all = NULL;
+	ao2_cleanup(presence_state_message);
+	presence_state_message = NULL;
+}
+
 int ast_presence_state_engine_init(void)
 {
+	presence_state_message = stasis_message_type_create("stasis_presence_state_message");
+	if (!presence_state_message) {
+		return -1;
+	}
+
+	presence_state_topic_all = stasis_topic_create("stasis_presence_state_topic_all");
+	if (!presence_state_topic_all) {
+		return -1;
+	}
+	ast_register_atexit(presence_state_engine_cleanup);
+
 	ast_cond_init(&change_pending, NULL);
 	if (ast_pthread_create_background(&change_thread, NULL, do_presence_changes, NULL) < 0) {
 		ast_log(LOG_ERROR, "Unable to start presence state change thread.\n");




More information about the svn-commits mailing list