mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Updated libretroshare.a interface files.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@629 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
473f3f75f3
commit
6d3c5679c5
135
retroshare-gui/src/rsiface/rsfiles.h
Normal file
135
retroshare-gui/src/rsiface/rsfiles.h
Normal file
@ -0,0 +1,135 @@
|
||||
#ifndef RS_FILES_GUI_INTERFACE_H
|
||||
#define RS_FILES_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsiface: rsfiles.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 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 <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "rsiface/rstypes.h"
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
|
||||
|
||||
class RsFiles;
|
||||
extern RsFiles *rsFiles;
|
||||
|
||||
|
||||
const uint32_t RS_FILE_CTRL_PAUSE = 0x0100;
|
||||
const uint32_t RS_FILE_CTRL_START = 0x0200;
|
||||
|
||||
const uint32_t RS_FILE_CTRL_TRICKLE = 0x0001;
|
||||
const uint32_t RS_FILE_CTRL_SLOW = 0x0002;
|
||||
const uint32_t RS_FILE_CTRL_STANDARD = 0x0003;
|
||||
const uint32_t RS_FILE_CTRL_FAST = 0x0004;
|
||||
const uint32_t RS_FILE_CTRL_STREAM_AUDIO = 0x0005;
|
||||
const uint32_t RS_FILE_CTRL_STREAM_VIDEO = 0x0006;
|
||||
|
||||
|
||||
const uint32_t RS_FILE_EXTRA_DELETE = 0x0010;
|
||||
|
||||
|
||||
class RsFiles
|
||||
{
|
||||
public:
|
||||
|
||||
RsFiles() { return; }
|
||||
virtual ~RsFiles() { return; }
|
||||
|
||||
/****************************************/
|
||||
/* download */
|
||||
|
||||
/* Required Interfaces ......
|
||||
*
|
||||
* 1) Access to downloading / uploading files.
|
||||
*/
|
||||
|
||||
/* get Details of File Transfers */
|
||||
virtual bool FileDownloads(std::list<std::string> &hashs)= 0;
|
||||
virtual bool FileUploads(std::list<std::string> &hashs)= 0;
|
||||
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info)= 0;
|
||||
|
||||
|
||||
/*
|
||||
* 2) Control of Downloads.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
virtual int FileRequest(std::string fname, std::string hash,
|
||||
uint32_t size, std::string dest, uint32_t flags)= 0;
|
||||
virtual int FileCancel(std::string hash)= 0;
|
||||
virtual int FileControl(std::string hash, uint32_t flags)= 0;
|
||||
virtual int FileClearCompleted()= 0;
|
||||
|
||||
|
||||
/*
|
||||
* 3) Addition of Extra Files... From File System
|
||||
* These are Hashed and stored in the 'Hidden Files' section
|
||||
* which can only be accessed if you know the hash.
|
||||
*
|
||||
* FileHash is called to start the hashing process,
|
||||
* and add the file to the HiddenStore.
|
||||
*
|
||||
* FileHashStatus is called to lookup files
|
||||
* and see if the hashing is completed.
|
||||
*/
|
||||
|
||||
/* Access ftExtraList - Details */
|
||||
virtual int ExtraFileAdd(std::string fname, std::string hash, uint32_t size,
|
||||
uint32_t period, uint32_t flags)= 0;
|
||||
virtual int ExtraFileRemove(std::string hash, uin32_t flags)= 0;
|
||||
virtual bool ExtraFileHash(std::string localpath,
|
||||
uint32_t period, uint32_t flags)= 0;
|
||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info)= 0;
|
||||
|
||||
|
||||
/*
|
||||
* 4) Search and Listing Interface
|
||||
*/
|
||||
|
||||
/* Directory Listing / Search Interface */
|
||||
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details)= 0;
|
||||
virtual int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags)= 0;
|
||||
|
||||
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results)= 0;
|
||||
virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results)= 0;
|
||||
|
||||
/*
|
||||
* 5) Utility Functions.
|
||||
*/
|
||||
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
|
||||
virtual void ForceDirectoryCheck() = 0;
|
||||
virtual bool InDirectoryCheck() = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -91,15 +91,6 @@ virtual void unlockData() = 0;
|
||||
const std::list<FileTransferInfo> &getTransferList()
|
||||
{ return mTransferList; }
|
||||
|
||||
const std::list<PersonInfo> &getRemoteDirectoryList()
|
||||
{ return mRemoteDirList; }
|
||||
|
||||
const std::list<PersonInfo> &getLocalDirectoryList()
|
||||
{ return mLocalDirList; }
|
||||
|
||||
const PersonInfo *getPerson(std::string id);
|
||||
const DirInfo *getDirectory(std::string id, std::string path);
|
||||
|
||||
const std::list<FileInfo> &getRecommendList()
|
||||
{ return mRecommendList; }
|
||||
|
||||
@ -135,15 +126,9 @@ bool hasChanged(DataFlags set); /* resets it */
|
||||
|
||||
private:
|
||||
|
||||
/* Internal Fn for getting the Directory Entry */
|
||||
PersonInfo *getPersonMod(std::string id);
|
||||
DirInfo *getDirectoryMod(std::string id, std::string path);
|
||||
|
||||
void fillLists(); /* create some dummy data to display */
|
||||
|
||||
/* Internals */
|
||||
std::list<PersonInfo> mRemoteDirList;
|
||||
std::list<PersonInfo> mLocalDirList;
|
||||
std::list<FileTransferInfo> mTransferList;
|
||||
std::list<FileInfo> mRecommendList;
|
||||
|
||||
|
@ -38,28 +38,19 @@ typedef std::string RsMsgId;
|
||||
typedef std::string RsAuthId;
|
||||
|
||||
|
||||
/* forward declarations of the classes */
|
||||
|
||||
#define INFO_SAME 0x01
|
||||
#define INFO_CHG 0x02
|
||||
#define INFO_NEW 0x04
|
||||
#define INFO_DEL 0x08
|
||||
|
||||
class BaseInfo
|
||||
class FileInfo
|
||||
{
|
||||
/* old BaseInfo Entries */
|
||||
public:
|
||||
BaseInfo() :flags(0), mId(0) { return; }
|
||||
|
||||
FileInfo() :flags(0), mId(0) { return; }
|
||||
RsCertId id; /* key for matching everything */
|
||||
int flags; /* INFO_TAG above */
|
||||
|
||||
/* allow this to be tweaked by the GUI Model */
|
||||
mutable unsigned int mId; /* (GUI) Model Id -> unique number */
|
||||
};
|
||||
|
||||
/********************** For the Directory Listing *****************/
|
||||
|
||||
class FileInfo: public BaseInfo
|
||||
{
|
||||
/* Old FileInfo Entries */
|
||||
public:
|
||||
|
||||
static const int kRsFiStatusNone = 0;
|
||||
@ -83,52 +74,8 @@ static const int kRsFiStatusDone = 2;
|
||||
|
||||
double rank;
|
||||
int age;
|
||||
};
|
||||
|
||||
class DirInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
|
||||
DirInfo() :infoAge(0), nofiles(0), nobytes(0) { return; }
|
||||
std::string path;
|
||||
std::string dirname;
|
||||
std::list<DirInfo> subdirs;
|
||||
std::list<FileInfo> files;
|
||||
int infoAge;
|
||||
int nofiles;
|
||||
int nobytes;
|
||||
|
||||
double rank;
|
||||
int age;
|
||||
|
||||
int merge(const DirInfo &udir);
|
||||
|
||||
bool exists(const DirInfo&);
|
||||
DirInfo* existsPv(const DirInfo&);
|
||||
bool add(const DirInfo&);
|
||||
int update(const DirInfo &udir);
|
||||
|
||||
|
||||
bool exists(const FileInfo&);
|
||||
FileInfo* existsPv(const FileInfo&);
|
||||
bool add(const FileInfo&);
|
||||
|
||||
};
|
||||
|
||||
class PersonInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
bool online;
|
||||
int infoAge; /* time() at when this was last updated */
|
||||
|
||||
DirInfo rootdir;
|
||||
};
|
||||
|
||||
/********************** For Messages and Channels *****************/
|
||||
|
||||
class FileTransferInfo: public FileInfo
|
||||
{
|
||||
/* Old FileTransferInfo Entries */
|
||||
public:
|
||||
std::string source;
|
||||
std::list<std::string> peerIds;
|
||||
@ -138,6 +85,12 @@ class FileTransferInfo: public FileInfo
|
||||
int downloadStatus; /* 0 = Err, 1 = Ok, 2 = Done */
|
||||
};
|
||||
|
||||
class FileTransferInfo: public FileInfo
|
||||
{
|
||||
public:
|
||||
FileTransferInfo() { return; }
|
||||
};
|
||||
|
||||
/* matched to the uPnP states */
|
||||
#define UPNP_STATE_UNINITIALISED 0
|
||||
#define UPNP_STATE_UNAVAILABILE 1
|
||||
@ -210,9 +163,6 @@ class SearchRequest
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const PersonInfo &info);
|
||||
std::ostream &print(std::ostream &out, const DirInfo &info, int indentLvl);
|
||||
|
||||
/********************** For FileCache Interface *****************/
|
||||
|
||||
#define DIR_TYPE_ROOT 0x01
|
||||
|
Loading…
Reference in New Issue
Block a user