soc.2009.transport: 139da6c9: Fixed getSettings function
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Tue Jun 9 15:41:19 EDT 2009
-----------------------------------------------------------------
Revision: 139da6c93682eed4c4c4dc66095f08f7795a2ff2
Ancestor: 3aea4062a39f2324c1ca7bd93b5a7fdeac02baab
Author: hanzz at soc.pidgin.im
Date: 2009-06-09T19:37:35
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/139da6c93682eed4c4c4dc66095f08f7795a2ff2
Modified files:
registerhandler.cpp sql.cpp
ChangeLog:
Fixed getSettings function
-------------- next part --------------
============================================================
--- registerhandler.cpp 76468ce31cdb36168462cc3cc9810ad4d342a274
+++ registerhandler.cpp bb486e25d42fb1e8c852e996592a6ebb366255a4
@@ -71,7 +71,15 @@ bool GlooxRegisterHandler::handleIq (con
query->addChild( new Tag("password"));
query->addChild( new Tag("language", res.language) );
}
+
+// Tag *x = new Tag("x");
+// x->addAttribute("xmlns", "jabber:x:data");
+// x->addAttribute("type", "form");
+// x->addChild( new Tag("title","Registration") )
+// x->addChild( new Tag("instructions", p->protocol()->text("instructions")) );
+// <field type='text-single' label='The name of your bot' var='botname'/>
+
reply->addChild(query);
p->j->send( reply );
return true;
============================================================
--- sql.cpp e7fcf6f5f428ef4849f11fa49ab6eb5404037051
+++ sql.cpp d9016ca070e9c5be2d6121d84caca97c2b0dc001
@@ -346,7 +346,7 @@ void SQLClass::getSetting(const std::str
}
-void SQLClass::getSettings(const std::string &jid) {
+GHashTable * SQLClass::getSettings(const std::string &jid) {
GHashTable *settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
mysqlpp::Query query = sql->query();
#if MYSQLPP_HEADER_VERSION < 0x030000
@@ -360,18 +360,21 @@ void SQLClass::getSettings(const std::st
res = query.store();
#if MYSQLPP_HEADER_VERSION < 0x030000
- if (res) {
- if (row = res.fetch_row()) {
- status = (std::string)row["reklama"];
- }
- }
+ if (res) {
+ mysqlpp::Row row;
+ while(row = res.fetch_row()){
+ g_hash_table_replace(settings, g_strdup(row["var"]), g_strdup(row["value"]));
+ }
+ }
#else
- if (res.num_rows() > 0) {
- if (row = res[0]) {
- status = (std::string)row["reklama"];
- }
- }
+ mysqlpp::StoreQueryResult::size_type i;
+ mysqlpp::Row row;
+ for (i = 0; i < res.num_rows(); ++i) {
+ row = res[i];
+ g_hash_table_replace(settings, g_strdup(row["var"]), g_strdup(row["value"]));
+ }
#endif
+ return settings;
}
// SQLClass::~SQLClass(){
More information about the Commits
mailing list