[asterisk-commits] marquis: branch marquis/pubsub-distributed-events r223052 - in /team/marquis/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Oct 9 09:30:55 CDT 2009
Author: marquis
Date: Fri Oct 9 09:30:50 2009
New Revision: 223052
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=223052
Log:
Move PubSub flags into their own struct. Odds are good more (perhaps many) will be added later, so let's stop polluting the general global flags struct.
Modified:
team/marquis/pubsub-distributed-events/include/asterisk/jabber.h
team/marquis/pubsub-distributed-events/res/res_jabber.c
Modified: team/marquis/pubsub-distributed-events/include/asterisk/jabber.h
URL: http://svnview.digium.com/svn/asterisk/team/marquis/pubsub-distributed-events/include/asterisk/jabber.h?view=diff&rev=223052&r1=223051&r2=223052
==============================================================================
--- team/marquis/pubsub-distributed-events/include/asterisk/jabber.h (original)
+++ team/marquis/pubsub-distributed-events/include/asterisk/jabber.h Fri Oct 9 09:30:50 2009
@@ -83,9 +83,12 @@
enum {
AJI_AUTOPRUNE = (1 << 0),
AJI_AUTOREGISTER = (1 << 1),
- AJI_XEP0248 = (1 << 2),
- AJI_PUBSUB = (1 << 3),
- AJI_PUBSUB_AUTOCREATE = (1 << 4)
+};
+
+enum {
+ AJI_XEP0248 = (1 << 0),
+ AJI_PUBSUB = (1 << 1),
+ AJI_PUBSUB_AUTOCREATE = (1 << 2)
};
enum aji_btype {
Modified: team/marquis/pubsub-distributed-events/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/team/marquis/pubsub-distributed-events/res/res_jabber.c?view=diff&rev=223052&r1=223051&r2=223052
==============================================================================
--- team/marquis/pubsub-distributed-events/res/res_jabber.c (original)
+++ team/marquis/pubsub-distributed-events/res/res_jabber.c Fri Oct 9 09:30:50 2009
@@ -306,6 +306,9 @@
/*! \brief Global flags, initialized to default values */
static struct ast_flags globalflags = { AJI_AUTOREGISTER };
+/*! \brief PubSub flags, initialized to default values */
+static struct ast_flags pubsubflags = { AJI_AUTOREGISTER };
+/
/*!
* \brief Deletes the aji_client data structure.
* \param obj aji_client The structure we will delete.
@@ -2695,11 +2698,11 @@
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");
+ if (ast_test_flag(&pubsubflags, AJI_PUBSUB_AUTOCREATE)) {
+ if (ast_test_flag(&pubsubflags, AJI_XEP0248)) {
+ aji_create_pubsub_node(client,"leaf", device, "device_state");
} else {
- aji_create_pubsub_node(client, NULL, device_state, NULL);
+ aji_create_pubsub_node(client, NULL, device, NULL);
}
}
ast_eid_to_str(eid_str, sizeof(eid_str), &ast_eid_default);
@@ -2782,7 +2785,7 @@
}
if (!strcasecmp(iks_name(orig_request), "publish")) {
- if (ast_test_flag(&globalflags, AJI_XEP0248)) {
+ if (ast_test_flag(&pubsubflags, AJI_XEP0248)) {
if (iks_find(iks_find(orig_request, "item"), "state")) {
aji_create_pubsub_leaf(client, "device_state", node_name);
} else if (iks_find(iks_find(orig_request, "item"), "mailbox")) {
@@ -2797,7 +2800,7 @@
iks_delete(request);
return IKS_FILTER_EAT;
} else if (!strcasecmp(iks_name(orig_request), "subscribe")) {
- if (ast_test_flag(&globalflags, AJI_XEP0248)) {
+ if (ast_test_flag(&pubsubflags, AJI_XEP0248)) {
aji_create_pubsub_collection(client, node_name);
} else {
aji_create_pubsub_node(client, NULL, node_name, NULL);
@@ -2946,7 +2949,7 @@
ast_cli(a->fd, "Unable to find client '%s'!\n", name);
return CLI_FAILURE;
}
- if (ast_test_flag(&globalflags, AJI_XEP0248)) {
+ if (ast_test_flag(&pubsubflags, AJI_XEP0248)) {
aji_pubsub_purge_nodes(client, a->argv[4]);
} else {
aji_delete_pubsub_node(client, a->argv[4]);
@@ -3557,10 +3560,10 @@
if (client->component) {
ast_log(LOG_ERROR, "Client cannot be configured to be both a component and to distribute events! Event distribution will be disabled.\n");
} else {
- if (ast_test_flag(&globalflags, AJI_PUBSUB)) {
+ if (ast_test_flag(&pubsubflags, AJI_PUBSUB)) {
ast_log(LOG_ERROR, "Only one connection can be configured for distributed events.\n");
} else {
- ast_set_flag(&globalflags, AJI_PUBSUB);
+ ast_set_flag(&pubsubflags, AJI_PUBSUB);
client->distribute_events = 1;
}
}
@@ -3782,9 +3785,9 @@
} else if (!strcasecmp(var->name, "autoregister")) {
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);
+ ast_set2_flag(&pubsubflags, ast_true(var->value), AJI_XEP0248);
} else if (!strcasecmp(var->name, "pubsub_autocreate")) {
- ast_set2_flag(&globalflags, ast_true(var->value), AJI_PUBSUB_AUTOCREATE);
+ ast_set2_flag(&pubsubflags, ast_true(var->value), AJI_PUBSUB_AUTOCREATE);
}
}
More information about the asterisk-commits
mailing list