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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Apr 11 19:45:13 MST 2006


Author: mogorman
Date: Tue Apr 11 21:45:12 2006
New Revision: 19502

URL: http://svn.digium.com/view/asterisk?rev=19502&view=rev
Log:
woohoo working registration
but still have to move it elsewhere

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

Modified: team/mogorman/asterisk-xmpp/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/res/res_jabber.c?rev=19502&r1=19501&r2=19502&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/res_jabber.c (original)
+++ team/mogorman/asterisk-xmpp/res/res_jabber.c Tue Apr 11 21:45:12 2006
@@ -389,7 +389,7 @@
 	} else {
 		switch(type) {
 			case IKS_NODE_START:{
-				char buffer[160], buffer2[160], buffer3[320],*handshake;
+				char buffer2[160], buffer3[320],*handshake;
 				switch(client->state) {
 					case AXI_DISCONNECTED:
 						sprintf(buffer2,"%s%s",pak->id,client->password);
@@ -475,6 +475,35 @@
 	memset(client,0,sizeof(struct aji_client));
 	client =ASTOBJ_REF((struct aji_client *) udata);
 	
+	if(!(node = iks_find_attrib(pak->query,"node"))) {
+		iks *iq, *query, *instructions, *username, *password;
+		char * explain =	"Welcome to Asterisk the Open Source PBX.\n"
+					"Please enter your username and password.";
+		iq = iks_new("iq");
+		query = iks_new("query");
+		instructions = iks_new("instructions");
+		username = iks_new("username");
+		password = iks_new("password");
+
+		iks_insert_attrib(iq, "from", client->user);
+		iks_insert_attrib(iq, "to", pak->from->full);
+		iks_insert_attrib(iq, "id", pak->id);
+		iks_insert_attrib(iq, "type", "result");
+		iks_insert_attrib(query, "xmlns", "jabber:iq:register");
+		iks_insert_cdata(instructions, explain, 0);
+		iks_insert_node(iq,query);
+		iks_insert_node(query,instructions);
+		iks_insert_node(query,username);
+		iks_insert_node(query,password);
+		iks_send(client->p,iq);
+		
+		iks_delete(iq);
+		iks_delete(query);
+		iks_delete(instructions);
+		iks_delete(username);
+		iks_delete(password);
+	}
+	return IKS_FILTER_EAT;
 }
 
 static int aji_ditems_handler(void *udata,ikspak *pak)



More information about the asterisk-commits mailing list