[asterisk-commits] branch mogorman/asterisk-xmpp r8947 - /team/mogorman/asterisk-xmpp/res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 31 14:21:03 MST 2006


Author: mogorman
Date: Mon Jan 30 17:39:39 2006
New Revision: 8947

URL: http://svn.digium.com/view/asterisk?rev=8947&view=rev
Log:
small changes

Modified:
    team/mogorman/asterisk-xmpp/res/res_xmpp.c

Modified: team/mogorman/asterisk-xmpp/res/res_xmpp.c
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/res/res_xmpp.c?rev=8947&r1=8946&r2=8947&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/res_xmpp.c (original)
+++ team/mogorman/asterisk-xmpp/res/res_xmpp.c Mon Jan 30 17:39:39 2006
@@ -283,6 +283,7 @@
 
 static int axi_act_hook(void *udata, int type, iks * node)
 {
+	ast_verbose("Stuck on you\n");
 	struct axi_master *asterisk = ASTOBJ_REF((struct axi_master *) udata);
 	ikspak *pak;
 	pak=iks_packet(node);
@@ -385,6 +386,7 @@
 					break;
 				default:
 					ast_verbose(VERBOSE_PREFIX_3 "XMPP: I Dont know %i\n",pak->type );
+					break;
 			}
 			break;
 		}
@@ -468,11 +470,8 @@
 	ASTOBJ_CONTAINER_TRAVERSE2(&masters,1,1, {
 		ASTOBJ_RDLOCK(iterator1);
 		ASTOBJ_CONTAINER_TRAVERSE2(&iterator1->buddies,2,1, {
-			ASTOBJ_RDLOCK(iterator2);
 				sprintf(action,"axi_agent %s",iterator2->user);
 				axi_execute(iterator1,action,iterator2->user,iterator2->channel,iterator2->status);
-
-			ASTOBJ_UNLOCK(iterator2);
 		});
 		ASTOBJ_UNLOCK(iterator1);
 	});
@@ -611,6 +610,7 @@
 	int res=0;
 	struct axi_master *asterisk = ASTOBJ_REF((struct axi_master *) data);
 	while (res == IKS_OK) {
+		ast_verbose("waiting %d is the longest time\n",asterisk->timeout);
 		res =iks_recv(asterisk->p,1);
 		printf("res = %d\n",res);
 		if(res==IKS_HOOK) {
@@ -730,7 +730,6 @@
 {
 	int res=0;
 	iks *removeiq, *removequery, *removeitem, *send;	
-	struct axi_buddy *delete;
 	ASTOBJ_CONTAINER_TRAVERSE(&asterisk->buddies,1, {
 	ASTOBJ_RDLOCK(iterator);
 	switch(iterator->on_roster)
@@ -756,10 +755,7 @@
 			iks_delete(removeiq);
 			iks_delete(removequery);
 			iks_delete(removeitem);
-			delete = ASTOBJ_CONTAINER_FIND_UNLINK(&asterisk->buddies,iterator->name);
-			if(delete) {
-				ASTOBJ_UNREF(delete,axi_buddy_destroy);
-			}
+			ASTOBJ_CONTAINER_UNLINK(&asterisk->buddies,iterator);
 			break;
 		case AXI_REGISTER:
 			ast_verbose("REGISTER THIS USER %s\n",iterator->name);
@@ -862,8 +858,11 @@
 	}
 	
 	iks_delete(x);
-//	axi_pruneregister(asterisk);
+	axi_pruneregister(asterisk);
 	iks_filter_remove_hook(asterisk->f,axi_filter_roster);
+	if(asterisk)
+		ASTOBJ_UNREF(asterisk, axi_master_destroy);
+
 	return IKS_FILTER_EAT;
 }
 
@@ -1100,11 +1099,9 @@
 	struct axi_master *asterisk;
 	asterisk = ASTOBJ_CONTAINER_FIND(&masters,"asterisk");
 	ast_axi_send(asterisk,"mogorman at astjab.org","blah blah blah");
-	ast_verbose("INDEED!\n");
-	if(1) {
+	if(asterisk) {
 		ASTOBJ_CONTAINER_TRAVERSE(&asterisk->buddies,1, {
 			ASTOBJ_RDLOCK(iterator);
-			ast_verbose("INDEED! THe sequel\n");
 			ast_verbose("User: %s\n",iterator->name);
 			ast_verbose("User: %s\n",iterator->user);
 			ast_verbose("Pass: %s\n",iterator->pass);
@@ -1385,14 +1382,12 @@
 		ast_verbose("pruneregister: %d\n",iterator1->pruneregister);
 		ast_verbose("component: %d\n\n\n",iterator1->component);
 			ASTOBJ_CONTAINER_TRAVERSE2(&iterator1->buddies,2,1, {
-			ASTOBJ_RDLOCK(iterator2);
 			ast_verbose("User: %s\n",iterator2->name);
 			ast_verbose("User: %s\n",iterator2->user);
 			ast_verbose("Pass: %s\n",iterator2->pass);
 			ast_verbose("Host: %s\n",iterator2->host);
 			ast_verbose("status: %d\n",iterator2->status);
 			ast_verbose("DefChannel: %s\n\n",iterator2->channel);
-			ASTOBJ_UNLOCK(iterator2);
 			});
 		ASTOBJ_UNLOCK(iterator1);
 	});



More information about the asterisk-commits mailing list