mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-29 11:56:37 -05:00
Major rewrite of New Cache Interface from the GUI side:
- Basics of Wiki, Photo, Id are working with Local Test interface. - Duplicated existing Forum : ForumV2Dialog + forumv2/* - Modified ForumV2Dialog to use Request / Response Data retrieval. - Switched Id to use TokenQueue request system. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5220 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4ba7130884
commit
a8676302ce
31 changed files with 6222 additions and 303 deletions
|
|
@ -34,54 +34,49 @@
|
|||
TokenQueue::TokenQueue(RsTokenService *service, TokenResponse *resp)
|
||||
:QWidget(NULL), mService(service), mResponder(resp)
|
||||
{
|
||||
//mTrigger = new QTimer(this);
|
||||
//mTrigger->connect(mTrigger, SIGNAL(timeout()), this, SLOT(pollRequests()));
|
||||
return;
|
||||
}
|
||||
|
||||
bool TokenQueue::genericRequest(uint32_t basictype, const RsTokReqOptions &opts, std::list<std::string> ids, uint32_t usertype)
|
||||
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, std::list<std::string> ids, uint32_t usertype)
|
||||
{
|
||||
uint32_t token;
|
||||
switch(basictype)
|
||||
{
|
||||
case TOKENREQ_GROUPLIST:
|
||||
mService->requestGroupList(token, opts);
|
||||
break;
|
||||
|
||||
case TOKENREQ_GROUPDATA:
|
||||
mService->requestGroupData(token, ids);
|
||||
break;
|
||||
|
||||
case TOKENREQ_MSGLIST:
|
||||
mService->requestMsgList(token, opts, ids);
|
||||
break;
|
||||
|
||||
case TOKENREQ_MSGRELATEDLIST:
|
||||
mService->requestMsgRelatedList(token, opts, ids);
|
||||
break;
|
||||
|
||||
case TOKENREQ_MSGDATA:
|
||||
mService->requestMsgData(token, ids);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
queueRequest(token, basictype, usertype);
|
||||
uint32_t basictype = TOKENREQ_GROUPINFO;
|
||||
mService->requestGroupInfo(token, anstype, opts, ids);
|
||||
queueRequest(token, basictype, anstype, usertype);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TokenQueue::queueRequest(uint32_t token, uint32_t basictype, uint32_t usertype)
|
||||
bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, std::list<std::string> ids, uint32_t usertype)
|
||||
{
|
||||
std::cerr << "TokenQueue::queueRequest() Token: " << token << " Type: " << basictype << " UserType: " << usertype;
|
||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||
mService->requestMsgInfo(token, anstype, opts, ids);
|
||||
queueRequest(token, basictype, anstype, usertype);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TokenQueue::requestMsgRelatedInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, std::list<std::string> ids, uint32_t usertype)
|
||||
{
|
||||
uint32_t basictype = TOKENREQ_MSGRELATEDINFO;
|
||||
mService->requestMsgRelatedInfo(token, anstype, opts, ids);
|
||||
queueRequest(token, basictype, anstype, usertype);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TokenQueue::queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype)
|
||||
{
|
||||
std::cerr << "TokenQueue::queueRequest() Token: " << token << " Type: " << basictype;
|
||||
std::cerr << " AnsType: " << anstype << " UserType: " << usertype;
|
||||
std::cerr << std::endl;
|
||||
|
||||
TokenRequest req;
|
||||
req.mToken = token;
|
||||
req.mType = basictype;
|
||||
req.mAnsType = anstype;
|
||||
req.mUserType = usertype;
|
||||
|
||||
gettimeofday(&req.mRequestTs, NULL);
|
||||
|
|
@ -143,9 +138,9 @@ bool TokenQueue::checkForRequest(uint32_t token)
|
|||
|
||||
void TokenQueue::loadRequest(const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "TokenQueue::loadRequest() Dummy Function - please Implement";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Token: " << req.mToken << " Type: " << req.mType << " UserType: " << req.mUserType;
|
||||
std::cerr << "TokenQueue::loadRequest(): ";
|
||||
std::cerr << "Token: " << req.mToken << " Type: " << req.mType;
|
||||
std::cerr << " AnsType: " << req.mAnsType << " UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mResponder->loadRequest(this, req);
|
||||
|
|
@ -154,6 +149,32 @@ void TokenQueue::loadRequest(const TokenRequest &req)
|
|||
}
|
||||
|
||||
|
||||
bool TokenQueue::cancelRequest(const uint32_t token)
|
||||
{
|
||||
/* cancel at lower level first */
|
||||
mService->cancelRequest(token);
|
||||
|
||||
std::list<TokenRequest>::iterator it;
|
||||
|
||||
for(it = mRequests.begin(); it != mRequests.end(); it++)
|
||||
{
|
||||
if (it->mToken == token)
|
||||
{
|
||||
mRequests.erase(it);
|
||||
|
||||
std::cerr << "TokenQueue::cancelRequest() Cleared Request: " << token;
|
||||
std::cerr << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "TokenQueue::cancelRequest() Failed to Find Request: " << token;
|
||||
std::cerr << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,13 +35,9 @@
|
|||
|
||||
#define COMPLETED_REQUEST 4
|
||||
|
||||
|
||||
#define TOKENREQ_GROUPLIST 1
|
||||
#define TOKENREQ_GROUPDATA 2
|
||||
#define TOKENREQ_MSGLIST 3
|
||||
#define TOKENREQ_MSGRELATEDLIST 4
|
||||
#define TOKENREQ_MSGDATA 5
|
||||
|
||||
#define TOKENREQ_GROUPINFO 1
|
||||
#define TOKENREQ_MSGINFO 2
|
||||
#define TOKENREQ_MSGRELATEDINFO 3
|
||||
|
||||
class TokenQueue;
|
||||
|
||||
|
|
@ -50,6 +46,7 @@ class TokenRequest
|
|||
public:
|
||||
uint32_t mToken;
|
||||
uint32_t mType;
|
||||
uint32_t mAnsType;
|
||||
uint32_t mUserType;
|
||||
struct timeval mRequestTs;
|
||||
struct timeval mPollTs;
|
||||
|
|
@ -72,8 +69,15 @@ public:
|
|||
TokenQueue(RsTokenService *service, TokenResponse *resp);
|
||||
|
||||
/* generic handling of token / response update behaviour */
|
||||
bool genericRequest(uint32_t basictype, const RsTokReqOptions &opt, std::list<std::string> ids, uint32_t usertype);
|
||||
void queueRequest(uint32_t token, uint32_t basictype, uint32_t usertype);
|
||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
std::list<std::string> ids, uint32_t usertype);
|
||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
std::list<std::string> ids, uint32_t usertype);
|
||||
bool requestMsgRelatedInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||
std::list<std::string> ids, uint32_t usertype);
|
||||
bool cancelRequest(const uint32_t token);
|
||||
|
||||
void queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype);
|
||||
bool checkForRequest(uint32_t token);
|
||||
void loadRequest(const TokenRequest &req);
|
||||
|
||||
|
|
@ -95,3 +99,4 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue