[asterisk-commits] oej: trunk r55514 - in /trunk: ./ res/res_jabber.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Feb 20 00:48:13 MST 2007


Author: oej
Date: Tue Feb 20 01:48:12 2007
New Revision: 55514

URL: http://svn.digium.com/view/asterisk?view=rev&rev=55514
Log:
Merged revisions 55483 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r55483 | oej | 2007-02-19 22:12:55 +0100 (Mon, 19 Feb 2007) | 3 lines

- Not sending arguments to an application is not "out of memory"
- Making error messages a bit more clear

........

Modified:
    trunk/   (props changed)
    trunk/res/res_jabber.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_jabber.c?view=diff&rev=55514&r1=55513&r2=55514
==============================================================================
--- trunk/res/res_jabber.c (original)
+++ trunk/res/res_jabber.c Tue Feb 20 01:48:12 2007
@@ -339,23 +339,23 @@
 	char *s = NULL, *sender = NULL, *jid = NULL, *screenname = NULL, *resource = NULL, *variable = NULL;
 	int stat = 7;
 	char status[2];
-	if (data) {
-		s = ast_strdupa((char *) data);
-		if (s) {
-			sender = strsep(&s, "|");
-			if (sender && (sender[0] != '\0')) {
-				jid = strsep(&s, "|");
-				if (jid && (jid[0] != '\0')) {
-					variable = s;
-				} else {
-					ast_log(LOG_ERROR, "Bad arguments\n");
-					return -1;
-				}
+
+	if (!data) {
+		ast_log(LOG_ERROR, "This application requires arguments.\n");
+		return 0;
+	}
+	s = ast_strdupa((char *) data);
+	if (s) {
+		sender = strsep(&s, "|");
+		if (sender && (sender[0] != '\0')) {
+			jid = strsep(&s, "|");
+			if (jid && (jid[0] != '\0')) {
+				variable = s;
+			} else {
+				ast_log(LOG_ERROR, "Bad arguments\n");
+				return -1;
 			}
 		}
-	} else {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		return -1;
 	}
 
 	if(!strchr(jid, '/')) {
@@ -366,25 +366,23 @@
 	}
 	client = ast_aji_get_client(sender);
 	if (!client) {
-		ast_log(LOG_WARNING, "Could not find Connection.\n");
+		ast_log(LOG_WARNING, "Could not find sender connection: %s\n", sender);
 		return -1;
 	}
 	if(!&client->buddies) {
-		ast_log(LOG_WARNING, "No buddies for connection.\n");
+		ast_log(LOG_WARNING, "No buddies for connection : %s\n", sender);
 		return -1;
 	}
-	buddy = ASTOBJ_CONTAINER_FIND(&client->buddies, (resource)?screenname:jid);
+	buddy = ASTOBJ_CONTAINER_FIND(&client->buddies, resource ? screenname: jid);
 	if (!buddy) {
-		ast_log(LOG_WARNING, "Could not find Buddy in list.\n");
+		ast_log(LOG_WARNING, "Could not find buddy in list : %s\n", resource ? screenname : jid);
 		return -1;
 	}
 	r = aji_find_resource(buddy, resource);
-	if(!r && buddy->resources) {
+	if(!r && buddy->resources) 
 		r = buddy->resources;
-	}
-	if(!r){
+	if(!r)
 		ast_log(LOG_NOTICE, "Resource %s of buddy %s not found \n", resource, screenname);
-	}
 	stat = r->status;
 	sprintf(status, "%d", stat);
 	pbx_builtin_setvar_helper(chan, variable, status);
@@ -403,8 +401,8 @@
 	char *s = NULL, *sender = NULL, *recipient = NULL, *message = NULL;
 
 	if (!data) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		return -1;
+		ast_log(LOG_ERROR, "This application requires arguments.\n");
+		return 0;
 	}
 	s = ast_strdupa((char *) data);
 	if (s) {
@@ -414,13 +412,13 @@
 			if (recipient && (recipient[0] != '\0')) {
 				message = s;
 			} else {
-				ast_log(LOG_ERROR, "Bad arguments \n");
+				ast_log(LOG_ERROR, "Bad arguments: %s\n", (char *) data);
 				return -1;
 			}
 		}
 	}
 	if (!(client = ast_aji_get_client(sender))) {
-		ast_log(LOG_WARNING, "Could not find Sender.\n");
+		ast_log(LOG_WARNING, "Could not find sender connection: %s\n", sender);
 		return -1;
 	}
 	if (strchr(recipient, '@') && message)
@@ -2263,6 +2261,9 @@
 	struct ast_config *cfg = NULL;
 	struct ast_variable *var = NULL;
 
+	/* Reset flags to default value */
+	globalflags = { AJI_AUTOPRUNE | AJI_AUTOREGISTER };
+
 	cfg = ast_config_load(JABBER_CONFIG);
 	if (!cfg) {
 		ast_log(LOG_WARNING, "No such configuration file %s\n", JABBER_CONFIG);



More information about the asterisk-commits mailing list