[asterisk-commits] branch mogorman/asterisk-xmpp r8695 - in /team/mogorman/asterisk-xmpp: ./ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 25 15:34:22 MST 2006


Author: mogorman
Date: Wed Jan 25 16:34:22 2006
New Revision: 8695

URL: http://svn.digium.com/view/asterisk?rev=8695&view=rev
Log:
gonna have it tonight!

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

Modified: team/mogorman/asterisk-xmpp/Makefile
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/Makefile?rev=8695&r1=8694&r2=8695&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/Makefile (original)
+++ team/mogorman/asterisk-xmpp/Makefile Wed Jan 25 16:34:22 2006
@@ -56,7 +56,7 @@
 OVERWRITE=y
 
 #Include debug and macro symbols in the executables (-g) and profiling info (-pg)
-DEBUG=-g3 #-pg
+DEBUG=-g3 -pg
 
 #Set NOCRYPTO to yes if you do not want to have crypto support or 
 #dependencies

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=8695&r1=8694&r2=8695&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/res_xmpp.c (original)
+++ team/mogorman/asterisk-xmpp/res/res_xmpp.c Wed Jan 25 16:34:22 2006
@@ -78,9 +78,9 @@
 static int axi_test(int fd, int argc, char *argv[]);
 static int axi_show_clients(int fd, int argc, char *argv[]);
 static int axi_register_struct(struct axi_action *act);
-static struct axi_master *axi_create_master(char *label,struct ast_variable *var,int debug,int pruneregister,char *utype);
-static struct axi_buddy *axi_create_buddy(char *label);
-static struct axi_buddy *axi_create_transport(char *label);
+static int *axi_create_master(char *label,struct ast_variable *var,int debug,int pruneregister,char *utype, struct axi_master *asterisk);
+static int *axi_create_buddy(char *label, struct axi_buddy *buddy);
+static int *axi_create_transport(char *label, struct axi_buddy *buddy);
 static int axi_load_config(void);
 static void axi_handle_message(struct axi_master *asterisk, ikspak *pak);
 static void axi_pruneregister(struct axi_master *asterisk);
@@ -644,7 +644,7 @@
 		}
 
 	}
-
+	ast_verbose("\n\nIM NOT LISTENING!!!!!!!!!!!\n\n");
 	if(asterisk)
 		ASTOBJ_UNREF(asterisk, axi_master_destroy);
 
@@ -1021,10 +1021,17 @@
 static void axi_set_presence(struct axi_master *asterisk, char *user, int level, char *desc)
 {
 	int res=0;
-	iks *presence;
+	iks *presence, *cnode;
 	presence=iks_make_pres(level, desc);
+	cnode = iks_new("c");
+	iks_insert_attrib(cnode,"node","http://www.google.com/xmpp/client/caps");
+	iks_insert_attrib(cnode,"ver","asterisk");
+	iks_insert_attrib(cnode,"ext","voice-v1");
+	iks_insert_attrib(cnode,"xmlns","http://jabber.org/protocol/caps");
+	iks_insert_node(presence,cnode);
 //	iks_insert_attrib(presence,"from", user);
 	res =iks_send(asterisk->p, presence);
+	iks_delete(cnode);
 	iks_delete(presence);
 }
 
@@ -1118,18 +1125,22 @@
 {
 	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) {
+		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);
+			ast_verbose("Host: %s\n",iterator->host);
+			ast_verbose("status: %d\n",iterator->status);
+			ast_verbose("DefChannel: %s\n\n",iterator->channel);
+			ASTOBJ_UNLOCK(iterator);
+		});
+	}
 	
-	ASTOBJ_CONTAINER_TRAVERSE2(&asterisk->buddies,1,1, {
-		ASTOBJ_RDLOCK(iterator1);
-		ast_verbose("User: %s\n",iterator1->name);
-		ast_verbose("User: %s\n",iterator1->user);
-		ast_verbose("Pass: %s\n",iterator1->pass);
-		ast_verbose("Host: %s\n",iterator1->host);
-		ast_verbose("status: %d\n",iterator1->status);
-		ast_verbose("DefChannel: %s\n\n",iterator1->channel);
-		ASTOBJ_UNLOCK(iterator1);
-	});
-	ast_axi_send(asterisk,"mogorman at astjab.org","blah blah blah");
 	if(asterisk)
 		ASTOBJ_UNREF(asterisk,axi_master_destroy);
 
@@ -1197,15 +1208,11 @@
 	return 0;
 }
 
-static struct axi_master *axi_create_master(char *label,struct ast_variable *var, int debug, int pruneregister,char *utype)
-{
-	struct axi_master *asterisk;
+static int *axi_create_master(char *label,struct ast_variable *var, int debug, int pruneregister,char *utype, struct axi_master *asterisk)
+{
 	struct axi_buddy *buddy;
-	asterisk = (struct axi_master *) malloc(sizeof(struct axi_master));
 	if(!asterisk)
 		ast_log(LOG_WARNING, "Out of memory\n");
-	memset(asterisk,0,sizeof(struct axi_master));
-	ASTOBJ_INIT(asterisk);
 	ast_copy_string(asterisk->name, label,sizeof(asterisk->name));
 	ast_copy_string(asterisk->mid, "aaaaa",sizeof(asterisk->mid));
 
@@ -1257,28 +1264,23 @@
 			ASTOBJ_INIT(buddy);
 			ASTOBJ_WRLOCK(buddy);
 			if(!strcasecmp(var->name,"buddy"))
-				buddy = axi_create_buddy(var->value);
+				axi_create_buddy(var->value,buddy);
 			else
-				buddy = axi_create_transport(var->value);
+				axi_create_transport(var->value,buddy);
 			ASTOBJ_UNLOCK(buddy);
 			ASTOBJ_CONTAINER_LINK(&asterisk->buddies,buddy);
 			ASTOBJ_UNREF(buddy,axi_buddy_destroy);
 		}
 		var = var->next;
 	}
-	return asterisk;
-}
-
-static struct axi_buddy *axi_create_transport(char *label)
-{
-	struct axi_buddy *buddy;
+	return 1;
+}
+
+static int *axi_create_transport(char *label, struct axi_buddy *buddy)
+{
 	char *server=NULL,*buddyname=NULL,*user=NULL,*pass=NULL;
-	buddy = (struct axi_buddy *) malloc(sizeof(struct axi_buddy));
 	if(!buddy)
 		ast_log(LOG_WARNING, "Out of memory\n");
-	memset(buddy,0,sizeof(struct axi_buddy));
-	ASTOBJ_INIT(buddy);
-	ASTOBJ_WRLOCK(buddy);
 	server=label;
 	if((buddyname = strchr(label,',')))
 	{
@@ -1300,26 +1302,20 @@
 						ast_copy_string(buddy->user,user,sizeof(buddy->user));
 						ast_copy_string(buddy->name,buddyname,sizeof(buddy->name));
 						ast_copy_string(buddy->server,server,sizeof(buddy->server));
-						return buddy;
+						return 1;
 					}
 				}
 			}
 		}
 	}
-	ASTOBJ_UNLOCK(buddy);
-	ASTOBJ_UNREF(buddy, axi_buddy_destroy);
-	return NULL;
-}
-
-static struct axi_buddy *axi_create_buddy(char *label)
-{
-	struct axi_buddy *buddy;
+	return 0;
+}
+
+static int *axi_create_buddy(char *label, struct axi_buddy *buddy)
+{
 	char *channel=NULL;
-	buddy = (struct axi_buddy *) malloc(sizeof(struct axi_buddy));
 	if(!buddy)
 		ast_log(LOG_WARNING, "Out of memory\n");
-	memset(buddy,0,sizeof(struct axi_buddy));
-	ASTOBJ_INIT(buddy);
 	if((channel = strchr(label,',')))
 	{
 		*channel='\0';
@@ -1327,7 +1323,7 @@
 		ast_copy_string(buddy->channel,channel,sizeof(buddy->channel));
 	}
 	ast_copy_string(buddy->name,label,sizeof(buddy->name));
-	return buddy;
+	return 1;
 }
 
 static int axi_load_config(void)
@@ -1356,7 +1352,7 @@
 				memset(asterisk,0,sizeof(struct axi_master));
 				ASTOBJ_INIT(asterisk);
 				ASTOBJ_WRLOCK(asterisk);
-				asterisk = axi_create_master(cat,var,debug,pruneregister,utype);
+				axi_create_master(cat, var, debug, pruneregister, utype, asterisk);
 				ASTOBJ_UNLOCK(asterisk);
 				ASTOBJ_CONTAINER_LINK(&masters,asterisk);
 				ASTOBJ_UNREF(asterisk,axi_master_destroy);
@@ -1439,11 +1435,11 @@
 				switch (iterator->component){
 					
 					case AXI_COMPONENT:
-												axi_component_initialize(iterator);
-												break;
+							axi_component_initialize(iterator);
+							break;
 					case AXI_CLIENT:
-												axi_client_initialize(iterator);
-												break;
+							axi_client_initialize(iterator);
+							break;
 				}
 				ast_pthread_create(&iterator->thread, NULL, axi_recv_loop, iterator);
 				ASTOBJ_UNLOCK(iterator);



More information about the asterisk-commits mailing list