[asterisk-commits] trunk r36175 - /trunk/res/res_jabber.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jun 27 07:07:24 MST 2006


Author: mogorman
Date: Tue Jun 27 09:07:24 2006
New Revision: 36175

URL: http://svn.digium.com/view/asterisk?rev=36175&view=rev
Log:
dont copy an id or a message if they dont exist.


Modified:
    trunk/res/res_jabber.c

Modified: trunk/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_jabber.c?rev=36175&r1=36174&r2=36175&view=diff
==============================================================================
--- trunk/res/res_jabber.c (original)
+++ trunk/res/res_jabber.c Tue Jun 27 09:07:24 2006
@@ -1031,12 +1031,14 @@
 {
 	struct aji_message *insert, *tmp;
 	int flag = 0;
-
+	
 	if (!(insert = ast_calloc(1, sizeof(struct aji_message))))
 		return;
 	time(&insert->arrived);
-	insert->message = ast_strdup(iks_find_cdata(pak->x, "body"));
-	ast_copy_string(insert->id, pak->id, sizeof(insert->message));
+	if(iks_find_cdata(pak->x, "body")
+		insert->message = ast_strdup(iks_find_cdata(pak->x, "body"));
+	if(pak->id)
+		ast_copy_string(insert->id, pak->id, sizeof(insert->message));
 	insert->from = ast_strdup(pak->from->full);
 	AST_LIST_LOCK(&client->messages);
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&client->messages, tmp, list) {
@@ -1942,7 +1944,7 @@
 	ast_verbose("\nOooh a working message stack!\n");
 	AST_LIST_LOCK(&client->messages);
 	AST_LIST_TRAVERSE(&client->messages, tmp, list) {
-		ast_verbose("	Message from: %s with id %s @ %s	%s\n",tmp->from, tmp->id, ctime(&tmp->arrived), tmp->message);
+		ast_verbose("	Message from: %s with id %s @ %s	%s\n",tmp->from, S_OR(tmp->id,""), ctime(&tmp->arrived), S_OR(tmp->message, ""));
 	}
 	AST_LIST_UNLOCK(&client->messages);
 	ASTOBJ_UNREF(client, aji_client_destroy);



More information about the asterisk-commits mailing list