[asterisk-commits] marquis: branch marquis/pubsub-distributed-events r214352 - /team/marquis/pub...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 27 08:04:03 CDT 2009


Author: marquis
Date: Thu Aug 27 08:03:59 2009
New Revision: 214352

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=214352
Log:
No sense in singling out 403 errors when we can handle most 4xx and 5xx responses just as easily.

Modified:
    team/marquis/pubsub-distributed-events/res/res_jabber.c

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=214352&r1=214351&r2=214352
==============================================================================
--- team/marquis/pubsub-distributed-events/res/res_jabber.c (original)
+++ team/marquis/pubsub-distributed-events/res/res_jabber.c Thu Aug 27 08:03:59 2009
@@ -2698,16 +2698,24 @@
 static int aji_handle_pubsub_error(void *data, ikspak *pak)
 {
 	char *node_name;
+	char *error;
+	int error_num;
 	iks *orig_request;
 	iks *orig_pubsub = iks_find(pak->x, "pubsub");
 	struct aji_client *client = ASTOBJ_REF((struct aji_client *) data);
 	if (orig_pubsub) {
 		orig_request = iks_child(orig_pubsub);
+		error = iks_find_attrib(iks_find(pak->x, "error"), "code");
 		node_name = iks_find_attrib(orig_request, "node");
-		
-		if (strcasecmp(iks_find_attrib(iks_find(pak->x, "error"), "code"), "403")) {
+		if(!sscanf(error, "%30d", &error_num)) {
+			return IKS_FILTER_EAT;
+		}
+		if (error_num > 399 && error_num < 500) {
 			ast_log(LOG_ERROR,
-				"Error performing operation on PubSub node %s, forbidden.\n", node_name);
+				"Error performing operation on PubSub node %s, %s.\n", node_name, error);
+			return IKS_FILTER_EAT;
+		} else if (error_num > 499 && error_num < 600) {
+			ast_log(LOG_ERROR, "PubSub Server error, %s\n", error);
 			return IKS_FILTER_EAT;
 		}
 		




More information about the asterisk-commits mailing list