mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-16 18:39:46 -04:00
Source code maintenance
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5897 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8cef4da896
commit
6fba395054
2 changed files with 60 additions and 83 deletions
|
@ -26,16 +26,14 @@
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
/******
|
/******
|
||||||
* #define ID_DEBUG 1
|
* #define ID_DEBUG 1
|
||||||
*****/
|
*****/
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
TokenQueue::TokenQueue(RsTokenService *service, TokenResponse *resp)
|
TokenQueue::TokenQueue(RsTokenService *service, TokenResponse *resp)
|
||||||
:QWidget(NULL), mService(service), mResponder(resp)
|
: QWidget(NULL), mService(service), mResponder(resp)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, std::list<RsGxsGroupId>& ids, uint32_t usertype)
|
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, std::list<RsGxsGroupId>& ids, uint32_t usertype)
|
||||||
|
@ -47,7 +45,6 @@ bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTok
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, uint32_t usertype)
|
bool TokenQueue::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, uint32_t usertype)
|
||||||
{
|
{
|
||||||
uint32_t basictype = TOKENREQ_GROUPINFO;
|
uint32_t basictype = TOKENREQ_GROUPINFO;
|
||||||
|
@ -66,7 +63,6 @@ bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokRe
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueue::requestMsgRelatedInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, const std::vector<RsGxsGrpMsgIdPair> &msgId, uint32_t usertype)
|
bool TokenQueue::requestMsgRelatedInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, const std::vector<RsGxsGrpMsgIdPair> &msgId, uint32_t usertype)
|
||||||
{
|
{
|
||||||
uint32_t basictype = TOKENREQ_MSGINFO;
|
uint32_t basictype = TOKENREQ_MSGINFO;
|
||||||
|
@ -76,7 +72,6 @@ bool TokenQueue::requestMsgRelatedInfo(uint32_t &token, uint32_t anstype, const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
bool TokenQueue::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||||
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
|
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
|
||||||
{
|
{
|
||||||
|
@ -119,14 +114,11 @@ void TokenQueue::doPoll(float dt)
|
||||||
QTimer::singleShot((int) (dt * 1000.0), this, SLOT(pollRequests()));
|
QTimer::singleShot((int) (dt * 1000.0), this, SLOT(pollRequests()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TokenQueue::pollRequests()
|
void TokenQueue::pollRequests()
|
||||||
{
|
{
|
||||||
double pollPeriod = 1.0; // max poll period.
|
double pollPeriod = 1.0; // max poll period.
|
||||||
|
|
||||||
|
if (mRequests.empty()) {
|
||||||
if (mRequests.empty())
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +147,6 @@ void TokenQueue::pollRequests()
|
||||||
std::cerr << "Dropping old Token: " << req.mToken << " Type: " << req.mType;
|
std::cerr << "Dropping old Token: " << req.mToken << " Type: " << req.mType;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRequests.size() > 0)
|
if (mRequests.size() > 0)
|
||||||
|
@ -164,7 +155,6 @@ void TokenQueue::pollRequests()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueue::checkForRequest(uint32_t token)
|
bool TokenQueue::checkForRequest(uint32_t token)
|
||||||
{
|
{
|
||||||
/* check token */
|
/* check token */
|
||||||
|
@ -182,11 +172,8 @@ void TokenQueue::loadRequest(const TokenRequest &req)
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
mResponder->loadRequest(this, req);
|
mResponder->loadRequest(this, req);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TokenQueue::cancelRequest(const uint32_t token)
|
bool TokenQueue::cancelRequest(const uint32_t token)
|
||||||
{
|
{
|
||||||
/* cancel at lower level first */
|
/* cancel at lower level first */
|
||||||
|
@ -212,9 +199,3 @@ bool TokenQueue::cancelRequest(const uint32_t token)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <gxs/rstokenservice.h>
|
#include <gxs/rstokenservice.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define COMPLETED_REQUEST 4
|
#define COMPLETED_REQUEST 4
|
||||||
|
|
||||||
#define TOKENREQ_GROUPINFO 1
|
#define TOKENREQ_GROUPINFO 1
|
||||||
|
@ -45,7 +44,7 @@ class TokenQueue;
|
||||||
|
|
||||||
class TokenRequest
|
class TokenRequest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
uint32_t mToken;
|
uint32_t mToken;
|
||||||
uint32_t mType;
|
uint32_t mType;
|
||||||
uint32_t mAnsType;
|
uint32_t mAnsType;
|
||||||
|
@ -56,7 +55,7 @@ class TokenRequest
|
||||||
|
|
||||||
class TokenResponse
|
class TokenResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//virtual ~TokenResponse() { return; }
|
//virtual ~TokenResponse() { return; }
|
||||||
// These Functions are overloaded to get results out.
|
// These Functions are overloaded to get results out.
|
||||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req) = 0;
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req) = 0;
|
||||||
|
@ -84,7 +83,6 @@ public:
|
||||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||||
std::list<RsGxsGroupId>& ids, uint32_t usertype);
|
std::list<RsGxsGroupId>& ids, uint32_t usertype);
|
||||||
|
|
||||||
|
|
||||||
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, uint32_t usertype);
|
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts, uint32_t usertype);
|
||||||
|
|
||||||
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptions &opts,
|
||||||
|
@ -118,5 +116,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue