[asterisk-commits] marquis: branch marquis/pubsub-distributed-events r217667 - in /team/marquis/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 10 13:56:47 CDT 2009
Author: marquis
Date: Thu Sep 10 13:56:43 2009
New Revision: 217667
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=217667
Log:
Some PubSub servers force support of node auto-create, so in the name of compatibility give an option that will pre-create nodes before publishing them. It's not exactly efficient, but it works.
Modified:
team/marquis/pubsub-distributed-events/configs/jabber.conf.sample
team/marquis/pubsub-distributed-events/include/asterisk/jabber.h
team/marquis/pubsub-distributed-events/res/res_jabber.c
Modified: team/marquis/pubsub-distributed-events/configs/jabber.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/team/marquis/pubsub-distributed-events/configs/jabber.conf.sample?view=diff&rev=217667&r1=217666&r2=217667
==============================================================================
--- team/marquis/pubsub-distributed-events/configs/jabber.conf.sample (original)
+++ team/marquis/pubsub-distributed-events/configs/jabber.conf.sample Thu Sep 10 13:56:43 2009
@@ -6,6 +6,10 @@
;autoregister=yes ;;Auto register users from buddy list.
;collection_nodes=yes ;;Enable support for XEP-0248 for use with
;;distributed device state. Default is 'no'.
+;pubsub_autocreate=yes ;;Whether or not the PubSub server supports/is using
+ ;;auto-create for nodes. If it is, we have to
+ ;;explicitly pre-create nodes before publishing them.
+ ;;Default is 'no'.
;[asterisk] ;;label
;type=client ;;Client or Component connection
Modified: team/marquis/pubsub-distributed-events/include/asterisk/jabber.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/marquis/pubsub-distributed-events/include/asterisk/jabber.h?view=diff&rev=217667&r1=217666&r2=217667
==============================================================================
--- team/marquis/pubsub-distributed-events/include/asterisk/jabber.h (original)
+++ team/marquis/pubsub-distributed-events/include/asterisk/jabber.h Thu Sep 10 13:56:43 2009
@@ -83,8 +83,9 @@
enum {
AJI_AUTOPRUNE = (1 << 0),
AJI_AUTOREGISTER = (1 << 1),
- AJI_XEP0248 = ( 1 << 2),
- AJI_PUBSUB = ( 1 << 3)
+ AJI_XEP0248 = (1 << 2),
+ AJI_PUBSUB = (1 << 3),
+ AJI_PUBSUB_AUTOCREATE = (1 << 4)
};
enum aji_btype {
Modified: team/marquis/pubsub-distributed-events/res/res_jabber.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/marquis/pubsub-distributed-events/res/res_jabber.c?view=diff&rev=217667&r1=217666&r2=217667
==============================================================================
--- team/marquis/pubsub-distributed-events/res/res_jabber.c (original)
+++ team/marquis/pubsub-distributed-events/res/res_jabber.c Thu Sep 10 13:56:43 2009
@@ -2703,6 +2703,13 @@
iks *request = aji_build_publish_skeleton(client, device, "device_state");
iks *state;
char eid_str[20];
+ if (ast_test_flag(&globalflags, AJI_PUBSUB_AUTOCREATE)) {
+ if (ast_test_flag(&globalflags, AJI_XEP0248)) {
+ aji_create_pubsub_node(client,"leaf", device_state, "device_state");
+ } else {
+ aji_create_pubsub_node(client, NULL, device_state, NULL);
+ }
+ }
ast_eid_to_str(eid_str, sizeof(eid_str), &ast_eid_default);
state = iks_insert(request, "state");
iks_insert_attrib(state, "xmlns", "http://asterisk.org");
@@ -3784,6 +3791,8 @@
ast_set2_flag(&globalflags, ast_true(var->value), AJI_AUTOREGISTER);
} else if (!strcasecmp(var->name, "collection_nodes")) {
ast_set2_flag(&globalflags, ast_true(var->value), AJI_XEP0248);
+ } else if (!strcasecmp(var->name, "pubsub_autocreate")) {
+ ast_set2_flag(&globalflags, ast_true(var->value), AJI_PUBSUB_AUTOCREATE);
}
}
More information about the asterisk-commits
mailing list