diff --git a/retroshare-gui/src/rsiface/rsfiles.h b/retroshare-gui/src/rsiface/rsfiles.h new file mode 100644 index 000000000..acceb3ced --- /dev/null +++ b/retroshare-gui/src/rsiface/rsfiles.h @@ -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 +#include +#include + +#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 &hashs)= 0; +virtual bool FileUploads(std::list &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 keywords, std::list &results)= 0; +virtual int SearchBoolExp(Expression * exp, std::list &results)= 0; + +/* + * 5) Utility Functions. + */ + +virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0; +virtual void ForceDirectoryCheck() = 0; +virtual bool InDirectoryCheck() = 0; + + +}; + + +#endif diff --git a/retroshare-gui/src/rsiface/rsiface.h b/retroshare-gui/src/rsiface/rsiface.h index 36e8ef4d6..7951ddcc2 100644 --- a/retroshare-gui/src/rsiface/rsiface.h +++ b/retroshare-gui/src/rsiface/rsiface.h @@ -91,15 +91,6 @@ virtual void unlockData() = 0; const std::list &getTransferList() { return mTransferList; } - const std::list &getRemoteDirectoryList() - { return mRemoteDirList; } - - const std::list &getLocalDirectoryList() - { return mLocalDirList; } - - const PersonInfo *getPerson(std::string id); - const DirInfo *getDirectory(std::string id, std::string path); - const std::list &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 mRemoteDirList; - std::list mLocalDirList; std::list mTransferList; std::list mRecommendList; diff --git a/retroshare-gui/src/rsiface/rstypes.h b/retroshare-gui/src/rsiface/rstypes.h index 0fab36600..85ffb488f 100644 --- a/retroshare-gui/src/rsiface/rstypes.h +++ b/retroshare-gui/src/rsiface/rstypes.h @@ -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 subdirs; - std::list 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 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