soc.2009.transport: c076559f: Move protocol related strings from regis...

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Mon May 25 20:45:47 EDT 2009


-----------------------------------------------------------------
Revision: c076559f9be33427654a3883a9b677eb070b6c66
Ancestor: 09898d870ead50d1390747ce3711215fdc7f14c2
Author: hanzz at soc.pidgin.im
Date: 2009-05-26T00:41:49
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/c076559f9be33427654a3883a9b677eb070b6c66

Modified files:
        protocols/abstractprotocol.h protocols/facebook.cpp
        protocols/facebook.h protocols/icq.cpp protocols/icq.h
        registerhandler.cpp sql.cpp

ChangeLog: 

Move protocol related strings from registration handler to protocol files

-------------- next part --------------
============================================================
--- protocols/abstractprotocol.h	3e7bb813a75304fa811508c2b916ab27ab09226e
+++ protocols/abstractprotocol.h	a4abd233d5e5df60a25c5942a9e6a5a584d5ba59
@@ -52,6 +52,10 @@ class AbstractProtocol
 		 * Returns disco features used by contacts
 		 */
 		virtual std::list<std::string> buddyFeatures() = 0;
+		/*
+		 * Returns pregenerated text according to key
+		 */
+		virtual std::string text(std::string &key) = 0;
 };
 
 #endif
============================================================
--- protocols/facebook.cpp	77e6586fa67629e4052c69e42848c9ad3c6bd4d1
+++ protocols/facebook.cpp	a80c86a6c25c07de1ea72c4e538c34f750a5c32d
@@ -90,3 +90,9 @@ std::list<std::string> FacebookProtocol:
 std::list<std::string> FacebookProtocol::buddyFeatures(){
 	return m_buddyFeatures;
 }
+
+std::string FacebookProtocol::text(std::string &key) {
+	if (key == "instructions")
+		return "Enter your Facebook email and password:";
+	return "not defined";
+}
============================================================
--- protocols/facebook.h	e9bce1dc0ffc865f867a7aeeb0a2d648c9c8c947
+++ protocols/facebook.h	c6cf237a3751cf92e61b3d785339ee305196f1a1
@@ -36,6 +36,7 @@ class FacebookProtocol : AbstractProtoco
 		std::string prepareUserName(std::string &username);
 		std::list<std::string> transportFeatures();
 		std::list<std::string> buddyFeatures();
+		std::string text(std::string &key);
 		
 		std::string replace(std::string &str, const char *string_to_replace, const char *new_string);
 	
============================================================
--- protocols/icq.cpp	1f2ffd0abcad7511635cec72b055b04e9e0e64f9
+++ protocols/icq.cpp	da0cd1d0e160e880a8bff2d808139e1dbaf9a307
@@ -72,3 +72,10 @@ std::list<std::string> ICQProtocol::budd
 std::list<std::string> ICQProtocol::buddyFeatures(){
 	return m_buddyFeatures;
 }
+
+std::string ICQProtocol::text(std::string &key) {
+	if (key == "instructions")
+		return "Enter your UIN and password:";
+	return "not defined";
+}
+
============================================================
--- protocols/icq.h	526b6c21e1a9977e95f25d464455b0cf377db415
+++ protocols/icq.h	344cd6f756c3d67139bf4c679525d3b8f69cf76e
@@ -36,6 +36,7 @@ class ICQProtocol : AbstractProtocol
 		std::string prepareUserName(std::string &username);
 		std::list<std::string> transportFeatures();
 		std::list<std::string> buddyFeatures();
+		std::string text(std::string &key);
 		
 		std::string replace(std::string &str, const char *string_to_replace, const char *new_string);
 	
============================================================
--- registerhandler.cpp	eeff68c0c70da91fec0d17fd45fc78d8c2f0e9ea
+++ registerhandler.cpp	890b9981c95dbb9c402f46441f1bc84f7c898d03
@@ -53,17 +53,16 @@ bool GlooxRegisterHandler::handleIq (Sta
 		reply->addAttribute( "from", p->jid() );
 		Tag *query = new Tag( "query" );
 		query->addAttribute( "xmlns", "jabber:iq:register" );
-		query->addChild( new Tag("instructions", "Enter your UIN and password") );
 		UserRow res = p->sql()->getUserByJid(stanza->from().bare());
 		if(res.id==-1) {
 			std::cout << "* sending registration form; user is not registered\n";
-			query->addChild( new Tag("instructions", "Enter your UIN and password") );
+			query->addChild( new Tag("instructions", p->protocol()->text("instructions")) );
 			query->addChild( new Tag("username") );
 			query->addChild( new Tag("password") );
 		}
 		else {
 			std::cout << "* sending registration form; user is registered\n";
-			query->addChild( new Tag("instructions", "Enter your UIN and password") );
+			query->addChild( new Tag("instructions", p->protocol()->text("instructions")) );
 			query->addChild( new Tag("registered") );
 			query->addChild( new Tag("username",res.uin));
 			query->addChild( new Tag("password"));
============================================================
--- sql.cpp	6cb5d2ceef37751c0e94d8762b13674847b29aee
+++ sql.cpp	b2d353094335c8f76aefe5068685a3efda026cc3
@@ -31,7 +31,8 @@ bool SQLClass::isVIP(const std::string &
 }
 
 bool SQLClass::isVIP(const std::string &jid){
-// return false;
+	if (!vipSQL->connected())
+		return true;
 	mysqlpp::Query query = vipSQL->query();
 	mysqlpp::Result res;
 	mysqlpp::Row myrow;


More information about the Commits mailing list