mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-28 10:32:22 -04:00
Added Code to convert retroshare-nogui into an "Introduction Server".
Perhaps the community can use this instead of their existing certificate exchanger. The way it works: - Designed to be coupled up with a WEB Interface to allow new users to interact with each other. - Automatically sets up some Chat Lobbies, so that the new users can chat to each other. - If you drop a Certificate File into the NEWCERT directory, it is automatically loaded as a friend. - These Certificates automatically expire after a fixed period (2 Weeks at the moment). So the idea is that Users upload their Certificates to the Intro WebServer, then they have two weeks to test out Retroshare, and use the Intro Server to make some RS Friends. To enable this Build, edit the .pro file. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4900 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fb7bc3e832
commit
446db939b2
4 changed files with 656 additions and 0 deletions
101
retroshare-nogui/src/introserver.h
Normal file
101
retroshare-nogui/src/introserver.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
|
||||
/*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2012-2012 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.1 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".
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RS_INTRO_SERVER_H
|
||||
#define RS_INTRO_SERVER_H
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
#define MIN_CERT_SIZE 100
|
||||
|
||||
class RsIntroStore;
|
||||
|
||||
class RsIntroServer
|
||||
{
|
||||
public:
|
||||
|
||||
RsIntroServer();
|
||||
|
||||
int tick();
|
||||
int displayPeers();
|
||||
|
||||
private:
|
||||
|
||||
int addCertificateFile(std::string);
|
||||
int addNewUser(std::string certificate);
|
||||
int setupChatLobbies();
|
||||
|
||||
int checkForNewCerts();
|
||||
int cleanOldPeers();
|
||||
|
||||
time_t mStartTS;
|
||||
time_t mLastCheck;
|
||||
int mMaxPeerAge;
|
||||
|
||||
std::string mCertLoadPath;
|
||||
time_t mCertCheckTime;
|
||||
|
||||
std::string mPeersFile;
|
||||
RsIntroStore *mStorePeers;
|
||||
|
||||
ChatLobbyId mEnglishLobby;
|
||||
ChatLobbyId mFrenchLobby;
|
||||
ChatLobbyId mGermanLobby;
|
||||
};
|
||||
|
||||
|
||||
class storeData
|
||||
{
|
||||
public:
|
||||
time_t mAdded;
|
||||
uint32_t mFlags;
|
||||
};
|
||||
|
||||
|
||||
class RsIntroStore
|
||||
{
|
||||
public:
|
||||
RsIntroStore(std::string storefile);
|
||||
bool loadPeers();
|
||||
bool addPeer(const RsPeerDetails &pd);
|
||||
bool removePeer(std::string gpgId);
|
||||
bool savePeers();
|
||||
bool getPeersBeforeTS(time_t ts, std::list<std::string> &plist);
|
||||
|
||||
bool isValid(std::string gpgId);
|
||||
uint32_t getFlags(std::string gpgId);
|
||||
|
||||
private:
|
||||
|
||||
std::string mStoreFile;
|
||||
std::string mTempStoreFile;
|
||||
std::map<std::string, storeData> mGpgData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue