mail[Wesnoth-commits] r28677 - in /trunk/src/server: forum_user_handler.cpp forum_user_handler.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by thomas . baumhauer on August 17, 2008 - 17:43:
Author: baufo
Date: Sun Aug 17 17:25:01 2008
New Revision: 28677

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28677&view=rev
Log:
Add functions to pull friends/ignores from forum tables

Modified:
    trunk/src/server/forum_user_handler.cpp
    trunk/src/server/forum_user_handler.hpp

Modified: trunk/src/server/forum_user_handler.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/forum_user_handler.cpp?rev=28677&r1=28676&r2=28677&view=diff
==============================================================================
--- trunk/src/server/forum_user_handler.cpp (original)
+++ trunk/src/server/forum_user_handler.cpp Sun Aug 17 17:25:01 2008
@@ -206,6 +206,60 @@
        }
 }
 
+std::vector<std::string> fuh::get_friends(const std::string& user) {
+       std::string sql("SELECT user_id FROM phpbb_users WHERE username='");
+       sql.append(user);
+       sql.append("'");
+
+       std::string id = db_query_to_string(sql);
+
+       sql = "SELECT zebra_id, friend FROM phpbb_zebra WHERE user_id='";
+       sql.append(id);
+       sql.append("'");
+       
+       mysqlpp::StoreQueryResult sqr = db_query(sql);
+
+       std::vector<std::string> friends;
+
+       for(int i = 0; i < sqr.num_rows(); i++) {
+               if(std::string(sqr[i][1]) == "1") {
+                       sql = "SELECT username FROM phpbb_users WHERE 
user_id='";
+                       sql.append(std::string(sqr[i][0]));
+                       sql.append("'");
+                       friends.push_back(db_query_to_string(sql));
+               }
+       }
+
+       return friends;
+}
+
+std::vector<std::string> fuh::get_ignores(const std::string& user) {
+       std::string sql("SELECT user_id FROM phpbb_users WHERE username='");
+       sql.append(user);
+       sql.append("'");
+
+       std::string id = db_query_to_string(sql);
+
+       sql = "SELECT zebra_id, friend FROM phpbb_zebra WHERE user_id='";
+       sql.append(id);
+       sql.append("'");
+       
+       mysqlpp::StoreQueryResult sqr = db_query(sql);
+
+       std::vector<std::string> ignores;
+
+       for(int i = 0; i < sqr.num_rows(); i++) {
+               if(std::string(sqr[i][1]) == "0") {
+                       sql = "SELECT username FROM phpbb_users WHERE 
user_id='";
+                       sql.append(std::string(sqr[i][0]));
+                       sql.append("'");
+                       ignores.push_back(db_query_to_string(sql));
+               }
+       }
+
+       return ignores;
+}
+
 time_t fuh::get_lastlogin(const std::string& user) {
        std::string sql("SELECT user_lastvisit FROM phpbb_users WHERE 
username='");
        sql.append(user);
@@ -253,7 +307,8 @@
        std::stringstream info;
        info << "Name: " << name << "\n"
                 << "Registered: " << reg_string
-                << "Last login: " << ll_string << create_pepper(name, 0) << 
"\n" << create_pepper(name,1);
+                << "Last login: " << ll_string;
+
        return info.str();
 }
 

Modified: trunk/src/server/forum_user_handler.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/forum_user_handler.hpp?rev=28677&r1=28676&r2=28677&view=diff
==============================================================================
--- trunk/src/server/forum_user_handler.hpp (original)
+++ trunk/src/server/forum_user_handler.hpp Sun Aug 17 17:25:01 2008
@@ -2,6 +2,8 @@
 #define FORUM_USER_HANDLER_HPP_INCLUDED
 
 #include "user_handler.hpp"
+
+#include <vector>
 
 #include <mysql++/mysql++.h>
 #include "../md5.hpp"
@@ -51,6 +53,8 @@
        private:
                std::string get_hash(const std::string& user);
                std::string get_mail(const std::string& user);
+               std::vector<std::string> get_friends(const std::string& user);
+               std::vector<std::string> get_ignores(const std::string& user);
                time_t get_lastlogin(const std::string& user);
                time_t get_registrationdate(const std::string& user);
 




Related Messages


Powered by MHonArc, Updated Sun Aug 17 19:41:17 2008