mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-09-25 19:01:09 -04:00
Cleaning rsserver
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/ammorais_branch@1349 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4b02c46d23
commit
69e0b1f891
8 changed files with 656 additions and 0 deletions
62
libretroshare/src/_rsserver/p3blog.cc
Normal file
62
libretroshare/src/_rsserver/p3blog.cc
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* libretroshare/src/rsserver: p3blog.cc
|
||||||
|
*
|
||||||
|
* RetroShare C++ Interface.
|
||||||
|
*
|
||||||
|
* Copyright 2007-2008 by Chris Evi-Parker.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "_rsserver/p3Blog.h"
|
||||||
|
|
||||||
|
RsQblog* rsQblog = NULL;
|
||||||
|
|
||||||
|
p3Blog::p3Blog(p3Qblog* qblog) :
|
||||||
|
mQblog(qblog)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p3Blog::~p3Blog()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Blog::getBlogs(std::map< std::string, std::multimap<long int, std::wstring> > &blogs)
|
||||||
|
{
|
||||||
|
return mQblog->getBlogs(blogs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool p3Blog::sendBlog(const std::wstring &msg)
|
||||||
|
{
|
||||||
|
return mQblog->sendBlog(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Blog::getPeerLatestBlog(std::string id, uint32_t &ts, std::wstring &post)
|
||||||
|
{
|
||||||
|
//return mQblog->getPeerLatestBlog(id, ts, post);
|
||||||
|
ts = time(NULL);
|
||||||
|
post = L"Hmmm, not much, just eating prawn crackers at the moment... but I'll post this every second if you want ;)";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
57
libretroshare/src/_rsserver/p3blog.h
Normal file
57
libretroshare/src/_rsserver/p3blog.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef P3BLOG_H_
|
||||||
|
#define P3BLOG_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* libretroshare/src/rsserver: p3blog.h
|
||||||
|
*
|
||||||
|
* RetroShare C++ Interface.
|
||||||
|
*
|
||||||
|
* Copyright 2007-2008 by Chris Evi-Parker.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "_rsiface/rsQblog.h"
|
||||||
|
#include "services/p3Qblog.h"
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Interface class using composition (p3Qblog is an attribute)
|
||||||
|
* See derived class for documentation of derived functions
|
||||||
|
*/
|
||||||
|
class p3Blog : public RsQblog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
p3Blog(p3Qblog* qblog);
|
||||||
|
virtual ~p3Blog();
|
||||||
|
|
||||||
|
virtual bool sendBlog(const std::wstring &msg);
|
||||||
|
virtual bool getBlogs(std::map< std::string, std::multimap<long int, std::wstring> > &blogs);
|
||||||
|
virtual bool getPeerLatestBlog(std::string id, uint32_t &ts, std::wstring &post);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/// to make rsCore blog-service calls
|
||||||
|
p3Qblog* mQblog;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*P3BLOG_H_*/
|
59
libretroshare/src/_rsserver/p3discovery.cc
Normal file
59
libretroshare/src/_rsserver/p3discovery.cc
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* libretroshare/src/rsserver: p3discovery.cc
|
||||||
|
*
|
||||||
|
* RetroShare C++ Interface.
|
||||||
|
*
|
||||||
|
* Copyright 2008-2008 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "_rsserver/p3discovery.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
RsDisc *rsDisc = NULL;
|
||||||
|
|
||||||
|
p3Discovery::p3Discovery(p3disc *disc):
|
||||||
|
mDisc(disc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
p3Discovery::~p3Discovery()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Discovery::getDiscFriends(std::string id, std::list<std::string> &friends)
|
||||||
|
{
|
||||||
|
if (mDisc)
|
||||||
|
{
|
||||||
|
return mDisc->potentialproxies(id, friends);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3Discovery::getDiscVersions(std::map<std::string, std::string> &versions)
|
||||||
|
{
|
||||||
|
if (mDisc)
|
||||||
|
{
|
||||||
|
mDisc->getversions(versions);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
47
libretroshare/src/_rsserver/p3discovery.h
Normal file
47
libretroshare/src/_rsserver/p3discovery.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#ifndef P3DISCOVERY_H
|
||||||
|
#define P3DISCOVERY_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* libretroshare/src/rsserver: p3discovery.h
|
||||||
|
*
|
||||||
|
* RetroShare C++ Interface.
|
||||||
|
*
|
||||||
|
* Copyright 2008-2008 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "_rsiface/rsdisc.h"
|
||||||
|
#include "services/p3disc.h"
|
||||||
|
|
||||||
|
class p3Discovery: public RsDisc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
p3Discovery(p3disc *disc);
|
||||||
|
virtual ~p3Discovery();
|
||||||
|
|
||||||
|
virtual bool getDiscFriends(std::string id, std::list<std::string> &friends);
|
||||||
|
virtual bool getDiscVersions(std::map<std::string, std::string> &versions);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
p3disc *mDisc;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
239
libretroshare/src/_rsserver/p3face.cc
Normal file
239
libretroshare/src/_rsserver/p3face.cc
Normal file
|
@ -0,0 +1,239 @@
|
||||||
|
/*
|
||||||
|
* "$Id: p3face-msgs.cc,v 1.7 2007-05-05 16:10:06 rmf24 Exp $"
|
||||||
|
*
|
||||||
|
* RetroShare C++ Interface.
|
||||||
|
*
|
||||||
|
* Copyright 2004-2006 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "p3face.h"
|
||||||
|
#include "util/rsdir.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "util/rsdebug.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
const int p3facemsgzone = 11453;
|
||||||
|
|
||||||
|
void RsServer::lockRsCore()
|
||||||
|
{
|
||||||
|
// std::cerr << "RsServer::lockRsCore()" << std::endl;
|
||||||
|
coreMutex.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsServer::unlockRsCore()
|
||||||
|
{
|
||||||
|
// std::cerr << "RsServer::unlockRsCore()" << std::endl;
|
||||||
|
coreMutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||||
|
int RsServer::ClearInChat()
|
||||||
|
{
|
||||||
|
lockRsCore(); /* LOCK */
|
||||||
|
|
||||||
|
mInChatList.clear();
|
||||||
|
|
||||||
|
unlockRsCore(); /* UNLOCK */
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||||
|
int RsServer::SetInChat(std::string id, bool in) /* friend : chat msgs */
|
||||||
|
{
|
||||||
|
/* so we send this.... */
|
||||||
|
lockRsCore(); /* LOCK */
|
||||||
|
|
||||||
|
//std::cerr << "Set InChat(" << id << ") to " << (in ? "True" : "False") << std::endl;
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
it = std::find(mInChatList.begin(), mInChatList.end(), id);
|
||||||
|
if (it == mInChatList.end())
|
||||||
|
{
|
||||||
|
if (in)
|
||||||
|
{
|
||||||
|
mInChatList.push_back(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!in)
|
||||||
|
{
|
||||||
|
mInChatList.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unlockRsCore(); /* UNLOCK */
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int RsServer::ClearInMsg()
|
||||||
|
{
|
||||||
|
lockRsCore(); /* LOCK */
|
||||||
|
|
||||||
|
mInMsgList.clear();
|
||||||
|
|
||||||
|
unlockRsCore(); /* UNLOCK */
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int RsServer::SetInMsg(std::string id, bool in) /* friend : msgs */
|
||||||
|
{
|
||||||
|
/* so we send this.... */
|
||||||
|
lockRsCore(); /* LOCK */
|
||||||
|
|
||||||
|
//std::cerr << "Set InMsg(" << id << ") to " << (in ? "True" : "False") << std::endl;
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
it = std::find(mInMsgList.begin(), mInMsgList.end(), id);
|
||||||
|
if (it == mInMsgList.end())
|
||||||
|
{
|
||||||
|
if (in)
|
||||||
|
{
|
||||||
|
mInMsgList.push_back(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!in)
|
||||||
|
{
|
||||||
|
mInMsgList.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unlockRsCore(); /* UNLOCK */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RsServer::IsInChat(std::string id) /* friend : chat msgs */
|
||||||
|
{
|
||||||
|
/* so we send this.... */
|
||||||
|
lockRsCore(); /* LOCK */
|
||||||
|
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
it = std::find(mInChatList.begin(), mInChatList.end(), id);
|
||||||
|
bool inChat = (it != mInChatList.end());
|
||||||
|
|
||||||
|
unlockRsCore(); /* UNLOCK */
|
||||||
|
|
||||||
|
return inChat;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool RsServer::IsInMsg(std::string id) /* friend : msg recpts*/
|
||||||
|
{
|
||||||
|
/* so we send this.... */
|
||||||
|
lockRsCore(); /* LOCK */
|
||||||
|
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
it = std::find(mInMsgList.begin(), mInMsgList.end(), id);
|
||||||
|
bool inMsg = (it != mInMsgList.end());
|
||||||
|
|
||||||
|
unlockRsCore(); /* UNLOCK */
|
||||||
|
|
||||||
|
return inMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int RsServer::ClearInBroadcast()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RsServer::ClearInSubscribe()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RsServer::SetInBroadcast(std::string id, bool in) /* channel : channel broadcast */
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RsServer::SetInSubscribe(std::string id, bool in) /* channel : subscribed channels */
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RsServer::ClearInRecommend()
|
||||||
|
{
|
||||||
|
/* find in people ... set chat flag */
|
||||||
|
RsIface &iface = getIface();
|
||||||
|
iface.lockData(); /* LOCK IFACE */
|
||||||
|
|
||||||
|
std::list<FileInfo> &recs = iface.mRecommendList;
|
||||||
|
std::list<FileInfo>::iterator it;
|
||||||
|
|
||||||
|
for(it = recs.begin(); it != recs.end(); it++)
|
||||||
|
{
|
||||||
|
it -> inRecommend = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
iface.unlockData(); /* UNLOCK IFACE */
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int RsServer::SetInRecommend(std::string id, bool in) /* file : recommended file */
|
||||||
|
{
|
||||||
|
/* find in people ... set chat flag */
|
||||||
|
RsIface &iface = getIface();
|
||||||
|
iface.lockData(); /* LOCK IFACE */
|
||||||
|
|
||||||
|
std::list<FileInfo> &recs = iface.mRecommendList;
|
||||||
|
std::list<FileInfo>::iterator it;
|
||||||
|
|
||||||
|
for(it = recs.begin(); it != recs.end(); it++)
|
||||||
|
{
|
||||||
|
if (it -> fname == id)
|
||||||
|
{
|
||||||
|
/* set flag */
|
||||||
|
it -> inRecommend = in;
|
||||||
|
//std::cerr << "Set InRecommend (" << id << ") to " << (in ? "True" : "False") << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iface.unlockData(); /* UNLOCK IFACE */
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string make_path_unix(std::string path)
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < path.length(); i++)
|
||||||
|
{
|
||||||
|
if (path[i] == '\\')
|
||||||
|
path[i] = '/';
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
181
libretroshare/src/_rsserver/p3face.h
Normal file
181
libretroshare/src/_rsserver/p3face.h
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
#ifndef P3FACE_H
|
||||||
|
#define P3FACE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "$Id: p3face.h,v 1.9 2007-05-05 16:10:06 rmf24 Exp $"
|
||||||
|
*
|
||||||
|
* RetroShare C++ Interface.
|
||||||
|
*
|
||||||
|
* Copyright 2004-2006 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#include "server/filedexserver.h"
|
||||||
|
#include "ft/ftserver.h"
|
||||||
|
//#include "pqi/pqissl.h"
|
||||||
|
|
||||||
|
#include "pqi/p3cfgmgr.h"
|
||||||
|
#include "pqi/p3connmgr.h"
|
||||||
|
#include "pqi/pqipersongrp.h"
|
||||||
|
|
||||||
|
#include "_rsiface/rsiface.h"
|
||||||
|
#include "_rsiface/rstypes.h"
|
||||||
|
#include "util/rsthreads.h"
|
||||||
|
|
||||||
|
#include "services/p3disc.h"
|
||||||
|
#include "services/p3msgservice.h"
|
||||||
|
#include "services/p3chatservice.h"
|
||||||
|
#include "services/p3ranking.h"
|
||||||
|
#include "services/p3Qblog.h"
|
||||||
|
|
||||||
|
/* The Main Interface Class - for controlling the server */
|
||||||
|
|
||||||
|
/* The init functions are actually Defined in p3face-startup.cc
|
||||||
|
*/
|
||||||
|
//RsInit *InitRsConfig();
|
||||||
|
//void CleanupRsConfig(RsInit *);
|
||||||
|
//int InitRetroShare(int argc, char **argv, RsInit *config);
|
||||||
|
//int LoadCertificates(RsInit *config);
|
||||||
|
|
||||||
|
RsControl *createRsControl(RsIface &iface, NotifyBase ¬ify);
|
||||||
|
|
||||||
|
|
||||||
|
class RsServer: public RsControl, public RsThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/****************************************/
|
||||||
|
/* p3face-startup.cc: init... */
|
||||||
|
virtual int StartupRetroShare();
|
||||||
|
|
||||||
|
public:
|
||||||
|
/****************************************/
|
||||||
|
/* p3face.cc: main loop / util fns / locking. */
|
||||||
|
|
||||||
|
RsServer(RsIface &i, NotifyBase &callback);
|
||||||
|
virtual ~RsServer();
|
||||||
|
|
||||||
|
/* Thread Fn: Run the Core */
|
||||||
|
virtual void run();
|
||||||
|
|
||||||
|
public: // no longer private:!!!
|
||||||
|
/* locking stuff */
|
||||||
|
void lockRsCore();
|
||||||
|
|
||||||
|
void unlockRsCore();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/* mutex */
|
||||||
|
RsMutex coreMutex;
|
||||||
|
|
||||||
|
/* General Internal Helper Functions
|
||||||
|
(Must be Locked)
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
cert *intFindCert(RsCertId id);
|
||||||
|
RsCertId intGetCertId(cert *c);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************/
|
||||||
|
/****************************************/
|
||||||
|
/* p3face-msg Operations */
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual const std::string& certificateFileName() ;
|
||||||
|
|
||||||
|
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||||
|
virtual int SetInChat(std::string id, bool in); /* friend : chat msgs */
|
||||||
|
virtual int SetInMsg(std::string id, bool in); /* friend : msg receipients */
|
||||||
|
virtual int SetInBroadcast(std::string id, bool in); /* channel : channel broadcast */
|
||||||
|
virtual int SetInSubscribe(std::string id, bool in); /* channel : subscribed channels */
|
||||||
|
virtual int SetInRecommend(std::string id, bool in); /* file : recommended file */
|
||||||
|
virtual int ClearInChat();
|
||||||
|
virtual int ClearInMsg();
|
||||||
|
virtual int ClearInBroadcast();
|
||||||
|
virtual int ClearInSubscribe();
|
||||||
|
virtual int ClearInRecommend();
|
||||||
|
|
||||||
|
virtual bool IsInChat(std::string id); /* friend : chat msgs */
|
||||||
|
virtual bool IsInMsg(std::string id); /* friend : msg recpts*/
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::list<std::string> mInChatList, mInMsgList;
|
||||||
|
|
||||||
|
void initRsMI(RsMsgItem *msg, MessageInfo &mi);
|
||||||
|
|
||||||
|
/****************************************/
|
||||||
|
/****************************************/
|
||||||
|
/****************************************/
|
||||||
|
public:
|
||||||
|
/* Config */
|
||||||
|
|
||||||
|
virtual int ConfigGetDataRates(float &inKb, float &outKb);
|
||||||
|
virtual int ConfigSetDataRates( int totalDownload, int totalUpload );
|
||||||
|
virtual int ConfigSetBootPrompt( bool on );
|
||||||
|
|
||||||
|
virtual void ConfigFinalSave( );
|
||||||
|
/************* Rs shut down function: in upnp 'port lease time' bug *****************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is responsible for ensuring Retroshare exits in a legal state:
|
||||||
|
* i.e. releases all held resources and saves current configuration
|
||||||
|
*/
|
||||||
|
virtual void rsGlobalShutDown( );
|
||||||
|
private:
|
||||||
|
int UpdateAllConfig();
|
||||||
|
|
||||||
|
/****************************************/
|
||||||
|
private:
|
||||||
|
|
||||||
|
// The real Server Parts.
|
||||||
|
//filedexserver *server;
|
||||||
|
ftServer *ftserver;
|
||||||
|
|
||||||
|
p3ConnectMgr *mConnMgr;
|
||||||
|
p3AuthMgr *mAuthMgr;
|
||||||
|
|
||||||
|
pqipersongrp *pqih;
|
||||||
|
|
||||||
|
//sslroot *sslr;
|
||||||
|
|
||||||
|
/* services */
|
||||||
|
p3disc *ad;
|
||||||
|
p3MsgService *msgSrv;
|
||||||
|
p3ChatService *chatSrv;
|
||||||
|
|
||||||
|
/* caches (that need ticking) */
|
||||||
|
p3Ranking *mRanking;
|
||||||
|
p3Qblog *mQblog;
|
||||||
|
|
||||||
|
/* Config */
|
||||||
|
p3ConfigMgr *mConfigMgr;
|
||||||
|
p3GeneralConfig *mGeneralConfig;
|
||||||
|
|
||||||
|
// Worker Data.....
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Helper function to convert windows paths
|
||||||
|
* into unix (ie switch \ to /) for FLTK's file chooser
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::string make_path_unix(std::string winpath);
|
||||||
|
|
||||||
|
#endif
|
10
libretroshare/src/_rsserver/rsserver.pri
Normal file
10
libretroshare/src/_rsserver/rsserver.pri
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
INCLUDEPATH += $$PWD \
|
||||||
|
../$$PWP
|
||||||
|
DEPENDPATH += $$PWD
|
||||||
|
HEADERS = $$PWP/p3face.h \
|
||||||
|
$$PWP/p3blog.h \
|
||||||
|
$$PWP/p3discovery.h
|
||||||
|
|
||||||
|
SOURCES += p3face.cc \
|
||||||
|
$$PWP/p3blog.cc \
|
||||||
|
$$PWP/p3discovery.cc
|
|
@ -1,4 +1,5 @@
|
||||||
include(_rsiface/rsiface.pri)
|
include(_rsiface/rsiface.pri)
|
||||||
|
include(_rsserver/rsserver.pri)
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += static
|
CONFIG += static
|
||||||
TARGET = retroshare
|
TARGET = retroshare
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue