core modification for Qblog

*final modifications to qblog network messages: might need to consider 
wstring for profile kvsets tho
*update qblog core to hanldle messages
*updated interface with all methods we will ever need hopefully


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@614 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2008-06-19 21:34:13 +00:00
parent 18112f7116
commit 2a44784999
11 changed files with 489 additions and 378 deletions

View file

@ -44,7 +44,7 @@ bool p3Blog::addToFilter(std::string &usrId)
return mQblog->addToFilter(usrId);
}
bool p3Blog::getBlogs(std::map< std::string, std::multimap<long int, std:: string> > &blogs)
bool p3Blog::getBlogs(std::map< std::string, std::multimap<long int, std::wstring> > &blogs)
{
return mQblog->getBlogs(blogs);
}
@ -54,17 +54,7 @@ bool p3Blog::getFilterSwitch(void)
return mQblog->getFilterSwitch();
}
bool p3Blog::getProfile(std::map<std::string, std::string> &profile)
{
return mQblog->getProfile(profile);
}
bool p3Blog::getStatus(std::map<std::string, std::string> &usrStatus)
{
return mQblog->getStatus(usrStatus);
}
bool p3Blog::sendBlog(const std::string &msg)
bool p3Blog::sendBlog(const std::wstring &msg)
{
return mQblog->sendBlog(msg);
}
@ -74,21 +64,23 @@ bool p3Blog::setFilterSwitch(bool &filterSwitch)
return mQblog->setFilterSwitch(filterSwitch);
}
bool p3Blog::setProfile(const std::string &favSong)
{
return mQblog->setProfile(favSong);
}
bool p3Blog::setStatus(const std::string &status)
{
return mQblog->setStatus(status);
}
bool p3Blog::removeFiltFriend(std::string &usrId)
{
return mQblog->removeFiltFriend(usrId);
}
bool p3Blog::setFavorites(FileInfo favFile)
{
//TODO
//return mQblog->setFavorites(favFile);
}
bool p3Blog::setProfile(std::pair<std::wstring, std::wstring> entry)
{
//TODO
//return mQblog->setProfile(entry);
}
bool p3Blog::getPeerLatestBlog(std::string id, uint32_t &ts, std::wstring &post)
{
//return mQblog->getPeerLatestBlog(id, ts, post);

View file

@ -43,17 +43,14 @@ class p3Blog : public RsQblog
p3Blog(p3Qblog* qblog);
virtual ~p3Blog();
virtual bool setStatus(const std::string &status);
virtual bool getStatus(std::map<std::string, std::string> &usrStatus);
virtual bool setFilterSwitch(bool &filterSwitch);
virtual bool getFilterSwitch(void);
virtual bool addToFilter(std::string &usrId);
virtual bool removeFiltFriend(std::string &usrId);
virtual bool getProfile(std::map<std::string, std::string> &profile);
virtual bool setProfile(const std::string &favSong);
virtual bool sendBlog(const std::string &msg);
virtual bool getBlogs(std::map< std::string, std::multimap<long int, std:: string> > &blogs);
virtual bool sendBlog(const std::wstring &msg);
virtual bool getBlogs(std::map< std::string, std::multimap<long int, std::wstring> > &blogs);
virtual bool setFavorites(FileInfo favFile);
virtual bool setProfile(std::pair<std::wstring, std::wstring> entry);
virtual bool getPeerLatestBlog(std::string id, uint32_t &ts, std::wstring &post);
virtual bool getPeerProfile(std::string id, std::list< std::pair<std::wstring, std::wstring> > &entries);
virtual bool getPeerFavourites(std::string id, std::list<FileInfo> &favs);

View file

@ -28,8 +28,10 @@
#include "pqi/p3authmgr.h"
#include <iostream>
#include <fstream>
#include <sstream>
RsPeers *rsPeers = NULL;
/*******
@ -789,6 +791,32 @@ uint32_t RsPeerTranslateTrust(uint32_t trustLvl)
return RS_TRUST_LVL_UNKNOWN;
}
bool p3Peers::certToFile(void)
{
std::string invite = GetRetroshareInvite();
const int SIZE = 400;
char certStore[SIZE]; // enough store to reach certification part of string
std::ofstream cert_file; // to help with counting non cert part of string
std::istringstream certFind(invite); // tie invite to stream
/* find out how long it takes to reach certification part of string */
certFind.get(certStore, SIZE, '=');
invite.erase(0, certFind.gcount()); // delete all characters before certificate part
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::certToFile() : certificate" << invite;
#endif
std::string usrId = getPeerName(getOwnId()); // replace with actual textual id
usrId += ".pqi";
cert_file.open(usrId.c_str());
cert_file << invite; //store cert to file
cert_file.close();
return true;
}

View file

@ -75,6 +75,7 @@ virtual std::string SaveCertificateToString(std::string id);
virtual bool AuthCertificate(std::string id, std::string code);
virtual bool SignCertificate(std::string id);
virtual bool TrustCertificate(std::string id, bool trust);
virtual bool certToFile(void);
private: