soc.2009.transport: b9d725cb: Fixed registration handler.

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Fri Jul 24 06:51:20 EDT 2009


-----------------------------------------------------------------
Revision: b9d725cbf0498969e23e08656a9375764b688e04
Ancestor: 9db11b5e93d2d4f2fe6093ba69b59a679c86ace3
Author: hanzz at soc.pidgin.im
Date: 2009-07-24T07:58:12
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/b9d725cbf0498969e23e08656a9375764b688e04

Modified files:
        main.cpp registerhandler.cpp

ChangeLog: 

Fixed registration handler.

-------------- next part --------------
============================================================
--- main.cpp	9aecfa93dbea38978e2737266af68c015e898ad7
+++ main.cpp	2601fa1bc298e8f28030dd71cdb75cf5f5cc0b13
@@ -628,11 +628,9 @@ GlooxMessageHandler::GlooxMessageHandler
 	j->registerIqHandler(m_vcard,ExtVCard);
 	j->registerPresenceHandler(this);
 	j->registerSubscriptionHandler(this);
-	j->connect(false);
-	int mysock = dynamic_cast<ConnectionTCPClient*>( j->connectionImpl() )->socket();
-	connectIO = g_io_channel_unix_new(mysock);
-	g_io_add_watch(connectIO,(GIOCondition) READ_COND,&iter,NULL);
-
+	
+	transportConnect();
+	
  	g_main_loop_run(loop);
 }
 
============================================================
--- registerhandler.cpp	0b6747ae099ca08313771852595fb28e221244be
+++ registerhandler.cpp	3ed3247cda8ca8ef1c2ac08555c8c4ef71f0ba6c
@@ -63,7 +63,7 @@ bool GlooxRegisterHandler::handleIq (con
 			query->addChild( new Tag("instructions", p->protocol()->text("instructions")) );
 			query->addChild( new Tag("username") );
 			query->addChild( new Tag("password") );
-			query->addChild( new Tag("language", p->configuration().language) );
+// 			query->addChild( new Tag("language", p->configuration().language) );
 		}
 		else {
 			std::cout << "* sending registration form; user is registered\n";
@@ -71,7 +71,7 @@ bool GlooxRegisterHandler::handleIq (con
 			query->addChild( new Tag("registered") );
 			query->addChild( new Tag("username",res.uin));
 			query->addChild( new Tag("password"));
-			query->addChild( new Tag("language", res.language) );
+// 			query->addChild( new Tag("language", res.language) );
 		}
 		
 		Tag *x = new Tag("x");
@@ -84,6 +84,7 @@ bool GlooxRegisterHandler::handleIq (con
 		field->addAttribute("type", "hidden");
 		field->addAttribute("var", "FORM_TYPE");
 		field->addChild( new Tag("value", "jabber:iq:register") );
+		x->addChild(field);
 		
 		field = new Tag("field");
 		field->addAttribute("type", "text-single");
@@ -92,12 +93,14 @@ bool GlooxRegisterHandler::handleIq (con
 		field->addChild( new Tag("required") );
 		if (res.id!=-1)
 			field->addChild( new Tag("value", res.uin) );
+		x->addChild(field);
 
 		field = new Tag("field");
 		field->addAttribute("type", "text-private");
 		field->addAttribute("var", "password");
 		field->addAttribute("label", "Password");
 		field->addChild( new Tag("required") );
+		x->addChild(field);
 
 		field = new Tag("field");
 		field->addAttribute("type", "list-single");
@@ -107,23 +110,28 @@ bool GlooxRegisterHandler::handleIq (con
 			field->addChild( new Tag("value", res.language) );
 		else
 			field->addChild( new Tag("value", p->configuration().language) );
+		x->addChild(field);
 
 		Tag *option = new Tag("option");
 		option->addAttribute("label", "Cesky");
 		option->addChild( new Tag("value", "cs") );
+		field->addChild(option);
 
 		option = new Tag("option");
 		option->addAttribute("label", "English");
 		option->addChild( new Tag("value", "en") );
+		field->addChild(option);
 
-		if (res.id!=1) {
+		if (res.id!=-1) {
 			field = new Tag("field");
 			field->addAttribute("type", "boolean");
 			field->addAttribute("var", "unregister");
 			field->addAttribute("label", "Unregister transport");
 			field->addChild( new Tag("value", "0") );
+			x->addChild(field);
 		}
 		
+		query->addChild(x);
 		reply->addChild(query);
 		p->j->send( reply );
 		return true;


More information about the Commits mailing list