Merge branch 'master' into GSoC2017-evaluation-II

This commit is contained in:
Gioacchino Mazzurco 2017-07-19 13:31:29 +02:00
commit d5c01a3b28
104 changed files with 845 additions and 488 deletions

View File

@ -1,5 +1,78 @@
retroshare06 (0.6.2-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
4718125 csoler Sun, 16 Jul 2017 10:05:33 +0200 updated changelog
991049d csoler Sat, 15 Jul 2017 22:20:43 +0200 Merge pull request #944 from csoler/v0.6-ImprovedGUI
08faa3f csoler Sat, 15 Jul 2017 22:16:45 +0200 fixed p3Gxstunnel so that it sends the data packets in the same order it received them. This fixes the bug in distant chat causing images to not transfer correctly in some cases
9c391cb csoler Sat, 15 Jul 2017 22:15:51 +0200 added an additional param to BinToHex so as to limit the size of the output
6a8b74c csoler Sat, 15 Jul 2017 22:00:35 +0200 fixed compilation for computers where qreal is a float
5ffb549 csoler Thu, 13 Jul 2017 21:49:47 +0200 Merge pull request #930 from myfingerhurt/master
3912118 csoler Thu, 13 Jul 2017 21:42:05 +0200 Merge pull request #925 from PhenomRetroShare/Fix_ChannelCommentLineWrap
98b0585 csoler Thu, 13 Jul 2017 21:23:14 +0200 Merge pull request #937 from csoler/v0.6-ImprovedNoGUI
69aa5b6 Gioacc Thu, 13 Jul 2017 13:00:32 +0200 Clean some garbage from the code
fd452af csoler Wed, 12 Jul 2017 23:03:17 +0200 removed some debut output that perturbated the passwd command line
00c1a9a csoler Wed, 12 Jul 2017 22:53:35 +0200 fixed autologin
66268c8 csoler Wed, 12 Jul 2017 18:48:06 +0200 fixed variable shadowing a parameter
1cdb971 csoler Tue, 11 Jul 2017 23:47:51 +0200 fixed compilation pb due to qtcreator bug
4cfdef5 csoler Tue, 11 Jul 2017 23:39:04 +0200 do not display auto-login option when software is compiled without autologin
a5e0b1c csoler Tue, 11 Jul 2017 23:32:22 +0200 fixed -U option in rs-nogui. Removed debug output that would ruin the terminal interface
3e3ee1a csoler Sun, 9 Jul 2017 22:12:01 +0200 little improvement to command line help display
2c6f11e csoler Sun, 9 Jul 2017 21:59:02 +0200 restored terminal output control class
5465e11 csoler Sun, 9 Jul 2017 21:37:39 +0200 fixed debug output
5dfbce7 csoler Sun, 9 Jul 2017 21:16:41 +0200 fixed Terminal Api Client logic
decbd35 csoler Sat, 8 Jul 2017 17:38:09 +0200 improved the login in the interaction between terminal api client and main
7ee527e csoler Sat, 8 Jul 2017 17:35:34 +0200 removed comments
b5976e1 csoler Sat, 8 Jul 2017 16:48:24 +0200 fixed message when passphrase is empty
4f887ff csoler Sat, 8 Jul 2017 16:47:50 +0200 commented out unused line
36a2053 NeverE Sat, 8 Jul 2017 00:20:09 +0900 add new functions to chat
75c8b71 NeverE Sat, 8 Jul 2017 00:18:51 +0900 add new functions for chat
fcec555 Gioacc Fri, 7 Jul 2017 11:57:17 +0200 Merge pull request #927 from Emotyco/libresapi_lobbies_invitation
fc396dd Gioacc Fri, 7 Jul 2017 11:56:12 +0200 Merge pull request #929 from Emotyco/libresapi_empty_cert
e46d91e Gioacc Fri, 7 Jul 2017 11:35:16 +0200 Merge branch 'android_share_intent'
f5912a3 csoler Thu, 6 Jul 2017 22:52:30 +0200 Merge pull request #928 from PhenomRetroShare/Fix_MultiDownload
f0ad687 Konrad Thu, 6 Jul 2017 22:44:45 +0200 Fixed: Libresapi was throwing exception when requested to add new cert which was empty
54047cd Phenom Thu, 6 Jul 2017 22:35:54 +0200 Fix multi download of same file.
42bf6b2 csoler Thu, 6 Jul 2017 20:57:38 +0200 improved display of password request
a778128 csoler Thu, 6 Jul 2017 20:50:59 +0200 fixed multi-digit numbers in terminal account selection
c630f1f Gioacc Thu, 6 Jul 2017 16:28:59 +0200 Fix unused warning in gxstokenqueue
b935bac Gioacc Thu, 6 Jul 2017 16:28:00 +0200 Add missing break in p3IdService::handleResponse
11d02f4 Konrad Thu, 6 Jul 2017 14:08:50 +0200 Added: Handling requests to answer invitation to lobby
c9bfe4b Konrad Thu, 6 Jul 2017 14:07:33 +0200 Added: Handling requests to get lobbies invitations
aca6233 Konrad Thu, 6 Jul 2017 14:05:48 +0200 Added: Handling requests to invite peers to lobby
dad6abd Phenom Wed, 5 Jul 2017 19:30:31 +0200 Fix channel comments line wrap
8e62a8b csoler Wed, 5 Jul 2017 22:32:54 +0200 updated tooltip for opinion in People
141277b csoler Wed, 5 Jul 2017 22:16:14 +0200 removed debug info
c1e18c7 csoler Wed, 5 Jul 2017 22:12:56 +0200 fixed bug causing an infinite subscribe/unsubscribe loop in GxsTrans
370d50b csoler Wed, 5 Jul 2017 21:36:00 +0200 cleaned a bit the code in rsinit.cc
7ee0b45 csoler Tue, 4 Jul 2017 23:27:43 +0200 Merge pull request #922 from csoler/v0.6-ImprovedGUI
5f7df7c csoler Tue, 4 Jul 2017 23:26:57 +0200 update call to notifySettingsChanged() when changing the thread loading of channels
2aac675 csoler Tue, 4 Jul 2017 23:15:09 +0200 merged upstream/master into v0.6-ImprovedGUI
931ddae csoler Tue, 4 Jul 2017 23:13:03 +0200 set load thread to false for channels on default. Fixed missing () in connect
dafaa56 Gioacc Tue, 4 Jul 2017 16:27:12 +0200 Qml App: better Android interaction on URL export
a97ba80 Gioacc Tue, 4 Jul 2017 16:41:14 +0200 Fix missing include
5b1def1 csoler Tue, 4 Jul 2017 10:25:40 +0200 Merge pull request #912 from Emotyco/libresapi_avatar_handlers
3274852 csoler Tue, 4 Jul 2017 10:24:43 +0200 Merge pull request #913 from Emotyco/libresapi_participants_refresh
ee25722 csoler Tue, 4 Jul 2017 10:24:05 +0200 Merge pull request #915 from PhenomRetroShare/Add_AlwaysAllowFriendTimeOffsetFeed
d7f0141 csoler Tue, 4 Jul 2017 10:23:30 +0200 Merge pull request #916 from PhenomRetroShare/Add_WarningToDirectDonwloadCheckBox
d876bb7 csoler Mon, 3 Jul 2017 23:21:31 +0200 fixing async loading of channels. To be tested.
1dea00d csoler Mon, 3 Jul 2017 23:09:17 +0200 attempt to fix channel post auto-size by limiting the number of lines from message to display in summary depending on available size
719b414 csoler Mon, 3 Jul 2017 22:32:08 +0200 fixed merging of comments in channel post with async-ed loading system
f0ed0dd csoler Mon, 3 Jul 2017 22:07:23 +0200 Merge pull request #918 from RetroShare/revert-917-v0.6-ImprovedGUI
9a5e46d csoler Mon, 3 Jul 2017 22:07:06 +0200 Revert "attempt to delay channel post loading on demand when displayed"
f5abf54 csoler Mon, 3 Jul 2017 21:54:22 +0200 Merge pull request #917 from csoler/v0.6-ImprovedGUI
b6d5c55 csoler Mon, 3 Jul 2017 21:48:17 +0200 attempt to delay channel post loading on demand when displayed
3987f75 Phenom Mon, 3 Jul 2017 17:14:16 +0200 Always allow Friend Time Offset Feed item.
2192a43 Phenom Mon, 3 Jul 2017 18:36:47 +0200 Add a warning to Direct download checkbox depends general setting.
f413433 csoler Mon, 3 Jul 2017 11:25:12 +0200 removed zeroing of preferred group causing a bug in GxsTrans
e9f9856 csoler Sun, 2 Jul 2017 10:42:22 +0200 fixed naming in friend groups in GroupChooser
77b064b csoler Sat, 1 Jul 2017 17:24:58 +0200 fixed translation of built-in group names in GxsGroupDialog
c61536e csoler Sat, 1 Jul 2017 16:21:22 +0200 fixed RsGraphWidget by adding an extra data point in the lower right corner, and fixed typo that caused an invalid point to be drawn
f136210 csoler Sat, 1 Jul 2017 16:20:39 +0200 fixed layout in GxsTrans stats
1323a97 csoler Sat, 1 Jul 2017 15:38:57 +0200 updated changelog
-- Retroshare Dev Team <contact@retroshare.net> Sun, 16 Jul 2017 12:00:00 +0100
retroshare06 (0.6.2-1.20170716.1323a974~trusty) trusty; urgency=low
244e8a8 csoler Sat, 1 Jul 2017 15:29:48 +0200 fixed display of GxsTrans statistics
27774ba csoler Thu, 29 Jun 2017 22:13:04 +0200 Merge pull request #911 from csoler/v0.6-GxsTransport
b294b4b csoler Thu, 29 Jun 2017 22:11:44 +0200 changed sorting of popular forums w.r.t. time of last post rather than number of supplier friends

View File

@ -1305,6 +1305,7 @@ void bdConnectManager::callbackConnectRequest(bdId *srcId, bdId *proxyId, bdId *
}
}
break;
case BITDHT_CONNECT_ERROR_DUPLICATE: // similar attempt. delay/recycle (ANY/ANY)
{

View File

@ -233,7 +233,7 @@ void ChatHandler::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type,
}
}
void ChatHandler::notifyListChange(int list, int type)
void ChatHandler::notifyListChange(int list, int /*type*/)
{
if(list == NOTIFY_LIST_CHAT_LOBBY_INVITATION)
{
@ -968,7 +968,7 @@ void ChatHandler::handleInviteToLobby(Request& req, Response& resp)
resp.setOk();
}
void ChatHandler::handleGetInvitationsToLobby(Request& req, Response& resp)
void ChatHandler::handleGetInvitationsToLobby(Request& /*req*/, Response& resp)
{
std::list<ChatLobbyInvite> invites;
mRsMsgs->getPendingChatLobbyInvites(invites);
@ -1243,7 +1243,7 @@ void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)
if(count && (mit2 != mChatInfo.end()))
{
resp.mDataStream.getStreamToMember()
#warning @deprecated using "id" as key can cause problems in some JS based \
#warning Gioacchino Mazzurco 2017-03-24: @deprecated using "id" as key can cause problems in some JS based \
languages like Qml @see chat_id instead
<< makeKeyValue("id", mit->first.toStdString())
<< makeKeyValue("chat_id", mit->first.toStdString())

View File

@ -243,7 +243,7 @@ void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp)
bool pgp_linked = (grp.mMeta.mGroupFlags &
RSGXSID_GROUPFLAG_REALID_kept_for_compatibility);
resp.mDataStream.getStreamToMember()
#warning @deprecated using "id" as key can cause problems in some JS based \
#warning Gioacchino Mazzurco 2017-03-24: @deprecated using "id" as key can cause problems in some JS based \
languages like Qml @see gxs_id instead
<< makeKeyValueReference("id", grp.mMeta.mGroupId)
<< makeKeyValueReference("gxs_id", grp.mMeta.mGroupId)
@ -718,8 +718,8 @@ void IdentityHandler::handleImportKey(Request& req, Response& resp)
resp.setFail();
}
ResponseTask* IdentityHandler::handleDeleteIdentity(Request& req,
Response& resp)
ResponseTask* IdentityHandler::handleDeleteIdentity(Request& /*req*/,
Response& /*resp*/)
{ return new DeleteIdentityTask(mRsIdentity); }
} // namespace resource_api

View File

@ -667,7 +667,7 @@ void PeersHandler::handleExamineCert(Request &req, Response &resp)
}
}
void PeersHandler::handleGetNetworkOptions(Request& req, Response& resp)
void PeersHandler::handleGetNetworkOptions(Request& /*req*/, Response& resp)
{
RsPeerDetails detail;
if (!mRsPeers->getPeerDetails(mRsPeers->getOwnId(), detail))

View File

@ -50,11 +50,24 @@
//#define DEBUG_DISTANT_CHAT
static const uint32_t DISTANT_CHAT_KEEP_ALIVE_TIMEOUT = 6 ; // send keep alive packet so as to avoid tunnel breaks.
#ifdef DEBUG_DISTANT_CHAT
static const uint32_t RS_DISTANT_CHAT_DH_STATUS_UNINITIALIZED = 0x0000 ;
static const uint32_t RS_DISTANT_CHAT_DH_STATUS_HALF_KEY_DONE = 0x0001 ;
static const uint32_t RS_DISTANT_CHAT_DH_STATUS_KEY_AVAILABLE = 0x0002 ;
#include <sys/time.h>
uint32_t msecs_of_day()
{
timeval tv ;
gettimeofday(&tv,NULL) ;
return tv.tv_usec / 1000 ;
}
#define DISTANT_CHAT_DEBUG() std::cerr << time(NULL) << "." << std::setfill('0') << std::setw(3) << msecs_of_day() << " : DISTANT_CHAT : " << __FUNCTION__ << " : "
#endif
//static const uint32_t DISTANT_CHAT_KEEP_ALIVE_TIMEOUT = 6 ; // send keep alive packet so as to avoid tunnel breaks.
//static const uint32_t RS_DISTANT_CHAT_DH_STATUS_UNINITIALIZED = 0x0000 ;
//static const uint32_t RS_DISTANT_CHAT_DH_STATUS_HALF_KEY_DONE = 0x0001 ;
//static const uint32_t RS_DISTANT_CHAT_DH_STATUS_KEY_AVAILABLE = 0x0002 ;
static const uint32_t DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID = 0xa0001 ;
@ -86,7 +99,7 @@ bool DistantChatService::handleOutgoingItem(RsChatItem *item)
}
#ifdef CHAT_DEBUG
std::cerr << "p3ChatService::handleOutgoingItem(): sending to " << item->PeerId() << ": interpreted as a distant chat virtual peer id." << std::endl;
DISTANT_CHAT_DEBUG() << "p3ChatService::handleOutgoingItem(): sending to " << item->PeerId() << ": interpreted as a distant chat virtual peer id." << std::endl;
#endif
uint32_t size = RsChatSerialiser().size(item) ;
@ -98,7 +111,9 @@ bool DistantChatService::handleOutgoingItem(RsChatItem *item)
return false;
}
#ifdef DEBUG_DISTANT_CHAT
std::cerr << " sending: " << RsUtil::BinToHex(mem,size) << std::endl;
DISTANT_CHAT_DEBUG() << " sending: " << RsUtil::BinToHex(mem,size,100) << std::endl;
DISTANT_CHAT_DEBUG() << " size: " << std::dec << size << std::endl;
DISTANT_CHAT_DEBUG() << " hash: " << RsDirUtil::sha1sum(mem,size) << std::endl;
#endif
mGxsTunnels->sendData( RsGxsTunnelId(item->PeerId()),DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID,mem,size);
@ -110,7 +125,7 @@ void DistantChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
if(cs->flags & RS_CHAT_FLAG_CONNEXION_REFUSED)
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "(II) Distant chat: received notification that peer refuses conversation." << std::endl;
DISTANT_CHAT_DEBUG() << "(II) Distant chat: received notification that peer refuses conversation." << std::endl;
#endif
RsServer::notify()->notifyChatStatus(ChatId(DistantChatPeerId(cs->PeerId())),"Connexion refused by distant peer!") ;
}
@ -140,7 +155,7 @@ bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTun
if(!res)
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "(II) refusing distant chat from peer " << gxs_id << ". Sending a notification back to tunnel " << tunnel_id << std::endl;
DISTANT_CHAT_DEBUG() << "(II) refusing distant chat from peer " << gxs_id << ". Sending a notification back to tunnel " << tunnel_id << std::endl;
#endif
RsChatStatusItem *item = new RsChatStatusItem ;
item->flags = RS_CHAT_FLAG_CONNEXION_REFUSED ;
@ -158,7 +173,11 @@ bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTun
return false;
}
std::cerr << " sending: " << RsUtil::BinToHex(mem,size) << std::endl;
#ifdef DEBUG_DISTANT_CHAT
DISTANT_CHAT_DEBUG() << " sending: " << RsUtil::BinToHex(mem,size,100) << std::endl;
DISTANT_CHAT_DEBUG() << " size: " << std::dec << std::endl;
DISTANT_CHAT_DEBUG() << " hash: " << RsDirUtil::sha1sum(mem,size) << std::endl;
#endif
mGxsTunnels->sendData( RsGxsTunnelId(item->PeerId()),DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID,mem,size);
}
@ -169,7 +188,7 @@ bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTun
void DistantChatService::notifyTunnelStatus(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, uint32_t tunnel_status)
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "DistantChatService::notifyTunnelStatus(): got notification " << std::hex << tunnel_status << std::dec << " for tunnel " << tunnel_id << std::endl;
DISTANT_CHAT_DEBUG() << "DistantChatService::notifyTunnelStatus(): got notification " << std::hex << tunnel_status << std::dec << " for tunnel " << tunnel_id << std::endl;
#endif
switch(tunnel_status)
@ -195,9 +214,10 @@ void DistantChatService::notifyTunnelStatus(const RsGxsTunnelService::RsGxsTunne
void DistantChatService::receiveData(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, unsigned char *data, uint32_t data_size)
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "DistantChatService::receiveData(): got data of size " << data_size << " for tunnel " << tunnel_id << std::endl;
std::cerr << " received: " << RsUtil::BinToHex(data,data_size) << std::endl;
std::cerr << " deserialising..." << std::endl;
DISTANT_CHAT_DEBUG() << "DistantChatService::receiveData(): got data of size " << std::dec << data_size << " for tunnel " << tunnel_id << std::endl;
DISTANT_CHAT_DEBUG() << " received: " << RsUtil::BinToHex(data,data_size,100) << std::endl;
DISTANT_CHAT_DEBUG() << " hash: " << RsDirUtil::sha1sum(data,data_size) << std::endl;
DISTANT_CHAT_DEBUG() << " deserialising..." << std::endl;
#endif
// always make the contact up to date. This is useful for server side, which doesn't know about the chat until it
@ -324,7 +344,7 @@ bool DistantChatService::setDistantChatPermissionFlags(uint32_t flags)
{
mDistantChatPermissions = flags ;
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "(II) Changing distant chat permissions to " << flags << ". Existing openned chats will however remain active until closed" << std::endl;
DISTANT_CHAT_DEBUG() << "(II) Changing distant chat permissions to " << flags << ". Existing openned chats will however remain active until closed" << std::endl;
#endif
triggerConfigSave() ;
}
@ -354,7 +374,7 @@ bool DistantChatService::processLoadListItem(const RsItem *item)
if(kit->key == "DISTANT_CHAT_PERMISSION_FLAGS")
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "Loaded distant chat permission flags: " << kit->value << std::endl ;
DISTANT_CHAT_DEBUG() << "Loaded distant chat permission flags: " << kit->value << std::endl ;
#endif
if (!kit->value.empty())
{

View File

@ -54,7 +54,7 @@ static const time_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask fo
static const time_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work
static const uint32_t MAX_ALLOWED_LOBBIES_IN_LIST_WARNING = 50 ;
static const uint32_t MAX_MESSAGES_PER_SECONDS_NUMBER = 5 ; // max number of messages from a given peer in a window for duration below
//static const uint32_t MAX_MESSAGES_PER_SECONDS_NUMBER = 5 ; // max number of messages from a given peer in a window for duration below
static const uint32_t MAX_MESSAGES_PER_SECONDS_PERIOD = 10 ; // duration window for max number of messages before messages get dropped.
#define IS_PUBLIC_LOBBY(flags) (flags & RS_CHAT_LOBBY_FLAGS_PUBLIC )

View File

@ -264,6 +264,10 @@ void p3ChatService::checkSizeAndSendMessage(RsChatMsgItem *msg)
static const uint32_t MAX_STRING_SIZE = 15000 ;
#ifdef CHAT_DEBUG
std::cerr << "Sending message: size=" << msg->message.size() << ", sha1sum=" << RsDirUtil::sha1sum((uint8_t*)msg->message.c_str(),msg->message.size()) << std::endl;
#endif
while(msg->message.size() > MAX_STRING_SIZE)
{
// chop off the first 15000 wchars
@ -278,11 +282,17 @@ void p3ChatService::checkSizeAndSendMessage(RsChatMsgItem *msg)
//
item->chatFlags &= (RS_CHAT_FLAG_PRIVATE | RS_CHAT_FLAG_PUBLIC | RS_CHAT_FLAG_LOBBY) ;
#ifdef CHAT_DEBUG
std::cerr << "Creating slice of size " << item->message.size() << std::endl;
#endif
// Indicate that the message is to be continued.
//
item->chatFlags |= RS_CHAT_FLAG_PARTIAL_MESSAGE ;
sendChatItem(item) ;
}
#ifdef CHAT_DEBUG
std::cerr << "Creating slice of size " << msg->message.size() << std::endl;
#endif
sendChatItem(msg) ;
}
@ -386,7 +396,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
if(it->second->_own_is_new)
{
#ifdef CHAT_DEBUG
std::cerr << "p3ChatService::sendChat: new avatar never sent to peer " << id << ". Setting <new> flag to packet." << std::endl;
std::cerr << "p3ChatService::sendChat: new avatar never sent to peer " << vpid << ". Setting <new> flag to packet." << std::endl;
#endif
ci->chatFlags |= RS_CHAT_FLAG_AVATAR_AVAILABLE ;
@ -395,7 +405,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
}
#ifdef CHAT_DEBUG
std::cerr << "Sending msg to (maybe virtual) peer " << id << ", flags = " << ci->chatFlags << std::endl ;
std::cerr << "Sending msg to (maybe virtual) peer " << vpid << ", flags = " << ci->chatFlags << std::endl ;
std::cerr << "p3ChatService::sendChat() Item:";
std::cerr << std::endl;
ci->print(std::cerr);
@ -435,7 +445,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
if(should_send_state_string)
{
#ifdef CHAT_DEBUG
std::cerr << "own status string is new for peer " << id << ": sending it." << std::endl ;
std::cerr << "own status string is new for peer " << vpid << ": sending it." << std::endl ;
#endif
RsChatStatusItem *cs = makeOwnCustomStateStringItem() ;
cs->PeerId(vpid) ;
@ -493,7 +503,7 @@ bool p3ChatService::locked_checkAndRebuildPartialMessage(RsChatMsgItem *& ci)
else
{
#ifdef CHAT_DEBUG
std::cerr << "Message is complete, using it now." << std::endl;
std::cerr << "Message is complete, using it now. Size = " << ci->message.size() << ", hash=" << RsDirUtil::sha1sum((uint8_t*)ci->message.c_str(),ci->message.size()) << std::endl;
#endif
return true ;
}

View File

@ -53,10 +53,11 @@ typedef RsPeerId ChatLobbyVirtualPeerId ;
* This service uses rsnotify (callbacks librs clients (e.g. rs-gui))
* @see NotifyBase
*/
struct p3ChatService :
p3Service, DistantChatService, DistributedChatService, p3Config,
pqiServiceMonitor, GxsTransClient
class p3ChatService :
public p3Service, public DistantChatService, public DistributedChatService, public p3Config,
public pqiServiceMonitor, GxsTransClient
{
public:
p3ChatService(p3ServiceControl *cs, p3IdService *pids, p3LinkMgr *cm,
p3HistoryMgr *historyMgr, p3GxsTrans& gxsTransService );

View File

@ -35,7 +35,7 @@
//#define CHAT_DEBUG 1
static const uint32_t RS_CHAT_SERIALIZER_FLAGS_NO_SIGNATURE = 0x0001;
//static const uint32_t RS_CHAT_SERIALIZER_FLAGS_NO_SIGNATURE = 0x0001;
RsItem *RsChatSerialiser::create_item(uint16_t service_id,uint8_t item_sub_id) const
{

View File

@ -975,7 +975,7 @@ bool perform_tests()
fprintf(stdout,"result: q=") ; uint256_32::print(q1) ; fprintf(stdout," r=") ; uint256_32::print(r1) ; fprintf(stdout,"\n") ;
#endif
uint256_32 res(q1) ;
//uint256_32 res(q1) ;
q1 *= p1 ;
q1 += r1 ;

View File

@ -398,6 +398,7 @@ uint32_t PeerConnectStateBox::connectCb_direct()
break;
}
} /* FALLTHROUGH TO START CASE */
/* fallthrough */
default:
case CSB_REVERSE_WAIT:
case CSB_PROXY_WAIT:
@ -411,6 +412,7 @@ uint32_t PeerConnectStateBox::connectCb_direct()
}
} /* FALLTHROUGH TO START CASE */
/* fallthrough */
case CSB_START:
{
/* starting up the connection */
@ -537,6 +539,7 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
break;
}
} /* FALLTHROUGH TO START CASE */
/* fallthrough */
default:
case CSB_DIRECT_WAIT:
{
@ -548,6 +551,7 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
}
} /* FALLTHROUGH TO START CASE */
/* fallthrough */
case CSB_START:
{
/* starting up the connection */

View File

@ -188,6 +188,7 @@ void ChunkMap::updateTotalDownloaded()
switch(_map[i])
{
case FileChunksInfo::CHUNK_CHECKING: _file_is_complete = false ;
/* fallthrough */
case FileChunksInfo::CHUNK_DONE: _total_downloaded += sizeOfChunk(i) ;
break ;
default:

View File

@ -292,7 +292,7 @@ void ftController::searchForDirectSources()
for( std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit )
{
bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) {
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break;
@ -961,7 +961,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
for(std::list<RsPeerId>::iterator it = srcIds.begin(); it != srcIds.end(); )
{
bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) {
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); break;
@ -1026,7 +1026,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
for(it = srcIds.begin(); it != srcIds.end(); ++it)
{
bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) {
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); break;
@ -1088,7 +1088,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
// Because this is auto-add, we only add sources that we allow to DL from using direct transfers.
bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) {
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break;

View File

@ -31,7 +31,7 @@
#include "crypto/chacha20.h"
#include "retroshare/rstypes.h"
#include "retroshare/rspeers.h"
const int ftserverzone = 29539;
//const int ftserverzone = 29539;
#include "file_sharing/p3filelists.h"
#include "ft/ftturtlefiletransferitem.h"

View File

@ -53,7 +53,7 @@ const uint32_t FT_TM_MAX_RESETS = 5;
const uint32_t FT_TM_MINIMUM_CHUNK = 1024; /* ie 1Kb / sec */
const uint32_t FT_TM_RESTART_DOWNLOAD = 20; /* 20 seconds */
const uint32_t FT_TM_DOWNLOAD_TIMEOUT = 10; /* 10 seconds */
const uint32_t FT_TM_CRC_MAP_MAX_WAIT_PER_GIG = 20; /* 20 seconds per gigabyte */
//const uint32_t FT_TM_CRC_MAP_MAX_WAIT_PER_GIG = 20; /* 20 seconds per gigabyte */
// const double FT_TM_MAX_INCREASE = 1.00;
// const double FT_TM_MIN_INCREASE = -0.10;
@ -62,13 +62,13 @@ const double FT_TM_RATE_INCREASE_SLOWER = 0.05 ;
const double FT_TM_RATE_INCREASE_AVERAGE = 0.3 ;
const double FT_TM_RATE_INCREASE_FASTER = 1.0 ;
const int32_t FT_TM_FAST_RTT = 1.0;
const int32_t FT_TM_STD_RTT = 5.0;
const int32_t FT_TM_SLOW_RTT = 20.0;
//const int32_t FT_TM_FAST_RTT = 1.0;
//const int32_t FT_TM_STD_RTT = 5.0;
//const int32_t FT_TM_SLOW_RTT = 20.0;
const uint32_t FT_TM_CRC_MAP_STATE_NOCHECK = 0 ;
const uint32_t FT_TM_CRC_MAP_STATE_DONT_HAVE = 1 ;
const uint32_t FT_TM_CRC_MAP_STATE_HAVE = 2 ;
//const uint32_t FT_TM_CRC_MAP_STATE_NOCHECK = 0 ;
//const uint32_t FT_TM_CRC_MAP_STATE_DONT_HAVE = 1 ;
//const uint32_t FT_TM_CRC_MAP_STATE_HAVE = 2 ;
#define FT_TM_FLAG_DOWNLOADING 0
#define FT_TM_FLAG_CANCELED 1

View File

@ -3076,7 +3076,7 @@ void RsGenExchange::processRecvdMessages()
}
bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData* /*grpMeta*/ ) { return true; }
bool RsGenExchange::acceptNewMessage(const RsGxsMsgMetaData* /*grpMeta*/,uint32_t size ) { return true; }
bool RsGenExchange::acceptNewMessage(const RsGxsMsgMetaData* /*grpMeta*/,uint32_t /*size*/ ) { return true; }
void RsGenExchange::processRecvdGroups()
{

View File

@ -244,11 +244,13 @@
// A small value for MAX_REQLIST_SIZE is likely to help messages to propagate in a chaotic network, but will also slow them down.
// A small SYNC_PERIOD fasten message propagation, but is likely to overload the server side of transactions (e.g. overload outqueues).
//
static const uint32_t GIXS_CUT_OFF = 0;
//static const uint32_t GIXS_CUT_OFF = 0;
static const uint32_t SYNC_PERIOD = 60;
static const uint32_t MAX_REQLIST_SIZE = 20; // No more than 20 items per msg request list => creates smaller transactions that are less likely to be cancelled.
static const uint32_t TRANSAC_TIMEOUT = 2000; // In seconds. Has been increased to avoid epidemic transaction cancelling due to overloaded outqueues.
#ifdef TO_REMOVE
static const uint32_t SECURITY_DELAY_TO_FORCE_CLIENT_REUPDATE = 3600; // force re-update if there happens to be a large delay between our server side TS and the client side TS of friends
#endif
static const uint32_t REJECTED_MESSAGE_RETRY_DELAY = 24*3600; // re-try rejected messages every 24hrs. Most of the time this is because the peer's reputation has changed.
static const uint32_t GROUP_STATS_UPDATE_DELAY = 240; // update unsubscribed group statistics every 3 mins
static const uint32_t GROUP_STATS_UPDATE_NB_PEERS = 2; // number of peers to which the group stats are asked
@ -863,8 +865,8 @@ void RsGxsNetService::subscribeStatusChanged(const RsGxsGroupId& grpId,bool subs
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG__G(grpId) << "Changing subscribe status for grp " << grpId << " to " << subscribed << ": reseting all server msg time stamps for this group, and server global TS." << std::endl;
#endif
std::map<RsGxsGroupId,RsGxsServerMsgUpdate>::iterator it = mServerMsgUpdateMap.find(grpId) ;
#endif
RsGxsServerMsgUpdate& item(mServerMsgUpdateMap[grpId]) ;
@ -2431,7 +2433,9 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
RsPeerId peerFrom = tr->mTransaction->PeerId();
uint32_t updateTS = tr->mTransaction->updateTS;
#ifdef NXS_NET_DEBUG_0
ClientGrpMap::iterator it = mClientGrpUpdateMap.find(peerFrom);
#endif
RsGxsGrpUpdate& item(mClientGrpUpdateMap[peerFrom]) ;

View File

@ -632,7 +632,7 @@ void p3GxsTrans::service_tick()
}
RsGenExchange::ServiceCreate_Return p3GxsTrans::service_CreateGroup(
RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& /*keySet*/ )
RsGxsGrpItem* /*grpItem*/, RsTlvSecurityKeySet& /*keySet*/ )
{
#ifdef DEBUG_GXSTRANS
std::cout << "p3GxsTrans::service_CreateGroup(...) "
@ -670,6 +670,7 @@ void p3GxsTrans::notifyChanges(std::vector<RsGxsNotify*>& changes)
opts, msgChange->msgChangeMap );
GxsTokenQueue::queueRequest(token, MAILS_UPDATE);
#ifdef DEBUG_GXSTRANS
for( GxsMsgReq::const_iterator it = msgChange->msgChangeMap.begin();
it != msgChange->msgChangeMap.end(); ++it )
{
@ -679,15 +680,14 @@ void p3GxsTrans::notifyChanges(std::vector<RsGxsNotify*>& changes)
for(itT vit = msgsIds.begin(); vit != msgsIds.end(); ++vit)
{
const RsGxsMessageId& msgId = *vit;
#ifdef DEBUG_GXSTRANS
std::cout << "p3GxsTrans::notifyChanges(...) got "
<< "notification for message " << msgId
<< " in group " << grpId << std::endl;
}
}
#endif
}
}
}
}
RsGxsIfaceHelper::receiveChanges(changes);
}
@ -869,6 +869,7 @@ void p3GxsTrans::locked_processOutgoingRecord(OutgoingRecord& pr)
pr.mailItem.saltRecipientHint(RsGxsId::random());
pr.sent_ts = time(NULL) ; //pr.mailItem.meta.mPublishTs = time(NULL);
}
/* fallthrough */
case GxsTransSendStatus::PENDING_PREFERRED_GROUP:
{
RS_STACK_MUTEX(mDataMutex);
@ -882,6 +883,7 @@ void p3GxsTrans::locked_processOutgoingRecord(OutgoingRecord& pr)
pr.group_id = mPreferredGroupId ; //pr.mailItem.meta.mGroupId = mPreferredGroupId;
}
/* fallthrough */
case GxsTransSendStatus::PENDING_RECEIPT_CREATE:
{
RsGxsTransPresignedReceipt grcpt;
@ -905,6 +907,7 @@ void p3GxsTrans::locked_processOutgoingRecord(OutgoingRecord& pr)
*pr.presignedReceipt.metaData = grcpt.meta;
pr.presignedReceipt.msg.setBinData(&grsrz[0], grsz);
}
/* fallthrough */
case GxsTransSendStatus::PENDING_RECEIPT_SIGNATURE: // (cyril) This step is never actually used.
{
switch (RsGenExchange::createMessage(&pr.presignedReceipt))
@ -923,6 +926,7 @@ void p3GxsTrans::locked_processOutgoingRecord(OutgoingRecord& pr)
pr.presignedReceipt.metaData->serialise(&srx[0], &metaSize);
pr.presignedReceipt.meta.setBinData(&srx[0], metaSize);
}
/* fallthrough */
case GxsTransSendStatus::PENDING_PAYLOAD_CREATE:
{
uint16_t serv = static_cast<uint16_t>(pr.clientService);
@ -937,6 +941,7 @@ void p3GxsTrans::locked_processOutgoingRecord(OutgoingRecord& pr)
offset += rcptsize;
memcpy(&pr.mailItem.payload[offset], &pr.mailData[0], datasize);
}
/* fallthrough */
case GxsTransSendStatus::PENDING_PAYLOAD_ENCRYPT:
{
switch (pr.mailItem.cryptoType)
@ -981,6 +986,7 @@ void p3GxsTrans::locked_processOutgoingRecord(OutgoingRecord& pr)
goto processingFailed;
}
}
/* fallthrough */
case GxsTransSendStatus::PENDING_PUBLISH:
{
#ifdef DEBUG_GXSTRANS

View File

@ -28,7 +28,7 @@
#include "util/rsthreads.h"
#include "retroshare/rsgxstrans.h"
struct p3GxsTrans;
class p3GxsTrans;
/// Services who want to make use of p3GxsTrans should inherit this struct
struct GxsTransClient

View File

@ -59,7 +59,9 @@ static const uint32_t RS_GXS_TUNNEL_DATA_PRINT_STORAGE_DELAY = 600 ; // store ol
static const uint32_t GXS_TUNNEL_ENCRYPTION_HMAC_SIZE = SHA_DIGEST_LENGTH ;
static const uint32_t GXS_TUNNEL_ENCRYPTION_IV_SIZE = 8 ;
#ifdef DEBUG_GXS_TUNNEL
static const uint32_t INTERVAL_BETWEEN_DEBUG_DUMP = 10 ;
#endif
static std::string GXS_TUNNEL_APP_NAME = "GxsTunnels" ;
@ -74,6 +76,7 @@ p3GxsTunnelService::p3GxsTunnelService(RsGixs *pids)
: mGixs(pids), mGxsTunnelMtx("GXS tunnel")
{
mTurtle = NULL ;
mCurrentPacketCounter = 0 ;
}
void p3GxsTunnelService::connectToTurtleRouter(p3turtle *tr)
@ -104,6 +107,7 @@ int p3GxsTunnelService::tick()
#ifdef DEBUG_GXS_TUNNEL
time_t now = time(NULL);
static time_t last_dump = 0;
if(now > last_dump + INTERVAL_BETWEEN_DEBUG_DUMP )
{
@ -752,7 +756,7 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
std::cerr << " size = " << data_size << std::endl;
std::cerr << " data = " << (void*)data_bytes << std::endl;
std::cerr << " IV = " << std::hex << *(uint64_t*)data_bytes << std::dec << std::endl;
std::cerr << " data = " << RsUtil::BinToHex((char*)data_bytes,data_size) ;
std::cerr << " data = " << RsUtil::BinToHex((unsigned char*)data_bytes,data_size,100) ;
std::cerr << std::endl;
#endif
@ -793,9 +797,9 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
#ifdef DEBUG_GXS_TUNNEL
std::cerr << " Using IV: " << std::hex << *(uint64_t*)data_bytes << std::dec << std::endl;
std::cerr << " Decrypted buffer size: " << decrypted_size << std::endl;
std::cerr << " key : " << RsUtil::BinToHex((char*)aes_key,GXS_TUNNEL_AES_KEY_SIZE) << std::endl;
std::cerr << " hmac : " << RsUtil::BinToHex((char*)data_bytes+GXS_TUNNEL_ENCRYPTION_IV_SIZE,GXS_TUNNEL_ENCRYPTION_HMAC_SIZE) << std::endl;
std::cerr << " data : " << RsUtil::BinToHex((char*)data_bytes,data_size) << std::endl;
std::cerr << " key : " << RsUtil::BinToHex((unsigned char*)aes_key,GXS_TUNNEL_AES_KEY_SIZE) << std::endl;
std::cerr << " hmac : " << RsUtil::BinToHex((unsigned char*)data_bytes+GXS_TUNNEL_ENCRYPTION_IV_SIZE,GXS_TUNNEL_ENCRYPTION_HMAC_SIZE) << std::endl;
std::cerr << " data : " << RsUtil::BinToHex((unsigned char*)data_bytes,data_size,100) << std::endl;
#endif
// first, check the HMAC
@ -1211,7 +1215,7 @@ bool p3GxsTunnelService::locked_sendClearTunnelData(RsGxsTunnelDHPublicKeyItem *
#ifdef DEBUG_GXS_TUNNEL
std::cerr << " GxsTunnelService::sendClearTunnelData(): Sending clear data to virtual peer: " << item->PeerId() << std::endl;
std::cerr << " gitem->data_size = " << gitem->data_size << std::endl;
std::cerr << " data = " << RsUtil::BinToHex((char*)gitem->data_bytes,gitem->data_size) ;
std::cerr << " data = " << RsUtil::BinToHex((unsigned char*)gitem->data_bytes,gitem->data_size,100) ;
std::cerr << std::endl;
#endif
mTurtle->sendTurtleData(item->PeerId(),gitem) ;
@ -1307,7 +1311,7 @@ bool p3GxsTunnelService::locked_sendEncryptedTunnelData(RsGxsTunnelItem *item)
#ifdef DEBUG_GXS_TUNNEL
std::cerr << "GxsTunnelService::sendEncryptedTunnelData(): Sending encrypted data to virtual peer: " << virtual_peer_id << std::endl;
std::cerr << " gitem->data_size = " << gitem->data_size << std::endl;
std::cerr << " serialised data = " << RsUtil::BinToHex((char*)gitem->data_bytes,gitem->data_size) ;
std::cerr << " serialised data = " << RsUtil::BinToHex((unsigned char*)gitem->data_bytes,gitem->data_size,100) ;
std::cerr << std::endl;
#endif
@ -1346,6 +1350,16 @@ bool p3GxsTunnelService::requestSecuredTunnel(const RsGxsId& to_gxs_id, const Rs
return true ;
}
// This method generates an ID that should be unique for each packet sent to a same peer. Rather than a random value,
// we use this counter because outgoing items are sorted in a map by their counter value. Using an increasing value
// ensures that the packets are sent in the same order than received from the service. This can be useful in some cases,
// for instance when services split their items while expecting them to arrive in the same order.
uint64_t p3GxsTunnelService::locked_getPacketCounter()
{
return mCurrentPacketCounter++ ;
}
bool p3GxsTunnelService::sendData(const RsGxsTunnelId &tunnel_id, uint32_t service_id, const uint8_t *data, uint32_t size)
{
// make sure that the tunnel ID is registered.
@ -1381,7 +1395,7 @@ bool p3GxsTunnelService::sendData(const RsGxsTunnelId &tunnel_id, uint32_t servi
RsGxsTunnelDataItem *item = new RsGxsTunnelDataItem ;
item->unique_item_counter = RSRandom::random_u64(); // this allows to make the item unique, except very rarely, we we don't care.
item->unique_item_counter = locked_getPacketCounter() ;// this allows to make the item unique, while respecting the packet order!
item->flags = 0; // not used yet.
item->service_id = service_id;
item->data_size = size; // encrypted data size

View File

@ -230,6 +230,7 @@ private:
void handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item) ;
bool locked_sendDHPublicKey(const DH *dh, const RsGxsId& own_gxs_id, const RsPeerId& virtual_peer_id) ;
bool locked_initDHSessionKey(DH *&dh);
uint64_t locked_getPacketCounter();
TurtleVirtualPeerId virtualPeerIdFromHash(const TurtleFileHash& hash) ; // ... and to a hash for p3turtle
@ -252,6 +253,8 @@ private:
RsGixs *mGixs ;
RsMutex mGxsTunnelMtx ;
uint64_t mCurrentPacketCounter ;
std::map<uint32_t,RsGxsTunnelClientService*> mRegisteredServices ;
void debug_dump();

View File

@ -60,6 +60,7 @@ ops_parse_cb_return_t cb_get_passphrase(const ops_parser_content_t *content_,ops
switch(content_->tag)
{
case OPS_PARSER_CMD_GET_SK_PASSPHRASE_PREV_WAS_BAD: prev_was_bad = true ;
/* fallthrough */
case OPS_PARSER_CMD_GET_SK_PASSPHRASE:
{
std::string passwd;

View File

@ -48,7 +48,7 @@
//#define DEBUG_AUTHGPG 1
const time_t STORE_KEY_TIMEOUT = 1 * 60 * 60; //store key is call around every hour
//const time_t STORE_KEY_TIMEOUT = 1 * 60 * 60; //store key is call around every hour
AuthGPG *AuthGPG::_instance = NULL ;

View File

@ -213,8 +213,9 @@ class p3ConfigMgr
* Aimed at rs services that uses RsItem config data, provide a way for RS
* services to save and load particular configurations as items.
*/
struct p3Config : pqiConfig
class p3Config : public pqiConfig
{
public:
p3Config();
virtual bool loadConfiguration(RsFileHash &loadHash);

View File

@ -365,8 +365,8 @@ bool p3DhtMgr::notifyPeer(const RsPeerId& id)
/* extract current peer status */
bool p3DhtMgr::getPeerStatus(const RsPeerId &id,
struct sockaddr_in &laddr,
struct sockaddr_in &raddr,
struct sockaddr_storage &laddr,
struct sockaddr_storage &raddr,
uint32_t &type, uint32_t &state)
{
RsStackMutex stack(dhtMtx); /* LOCK MUTEX */

View File

@ -129,7 +129,7 @@ virtual bool notifyPeer(const RsPeerId& id);
/* extract current peer status */
virtual bool getPeerStatus(const RsPeerId& id,
struct sockaddr_in &laddr, struct sockaddr_in &raddr,
struct sockaddr_storage &laddr, struct sockaddr_storage &raddr,
uint32_t &type, uint32_t &mode);
/* stun */

View File

@ -75,7 +75,7 @@ static struct RsLog::logInfo p3connectzoneInfo = {RsLog::Default, "p3connect"};
//#define P3CONNMGR_NO_TCP_CONNECTIONS 1
const uint32_t P3CONNMGR_TCP_DEFAULT_DELAY = 3; /* 2 Seconds? is it be enough! */
const uint32_t P3CONNMGR_UDP_DEFAULT_DELAY = 3; /* 2 Seconds? is it be enough! */
//const uint32_t P3CONNMGR_UDP_DEFAULT_DELAY = 3; /* 2 Seconds? is it be enough! */
const uint32_t P3CONNMGR_TCP_DEFAULT_PERIOD = 10;
const uint32_t P3CONNMGR_UDP_DEFAULT_PERIOD = 30; // this represents how long it stays at the default TTL (4), before rising.

View File

@ -57,19 +57,19 @@ const uint32_t RS_NET_UPNP_SETUP = 0x0003;
const uint32_t RS_NET_EXT_SETUP = 0x0004;
const uint32_t RS_NET_DONE = 0x0005;
const uint32_t RS_NET_LOOPBACK = 0x0006;
const uint32_t RS_NET_DOWN = 0x0007;
//const uint32_t RS_NET_DOWN = 0x0007;
/* Stun modes (TODO) */
const uint32_t RS_STUN_DHT = 0x0001;
const uint32_t RS_STUN_DONE = 0x0002;
const uint32_t RS_STUN_LIST_MIN = 100;
const uint32_t RS_STUN_FOUND_MIN = 10;
//const uint32_t RS_STUN_DHT = 0x0001;
//const uint32_t RS_STUN_DONE = 0x0002;
//const uint32_t RS_STUN_LIST_MIN = 100;
//const uint32_t RS_STUN_FOUND_MIN = 10;
const uint32_t MAX_UPNP_INIT = 60; /* seconds UPnP timeout */
const uint32_t MAX_UPNP_COMPLETE = 600; /* 10 min... seems to take a while */
const uint32_t MAX_NETWORK_INIT = 70; /* timeout before network reset */
//const uint32_t MAX_NETWORK_INIT = 70; /* timeout before network reset */
const uint32_t MIN_TIME_BETWEEN_NET_RESET = 5;
//const uint32_t MIN_TIME_BETWEEN_NET_RESET = 5;
/****
* #define NETMGR_DEBUG 1

View File

@ -50,18 +50,19 @@
/* Network setup States */
const uint32_t RS_NET_NEEDS_RESET = 0x0000;
const uint32_t RS_NET_UNKNOWN = 0x0001;
const uint32_t RS_NET_UPNP_INIT = 0x0002;
const uint32_t RS_NET_UPNP_SETUP = 0x0003;
const uint32_t RS_NET_EXT_SETUP = 0x0004;
const uint32_t RS_NET_DONE = 0x0005;
const uint32_t RS_NET_LOOPBACK = 0x0006;
const uint32_t RS_NET_DOWN = 0x0007;
//Defined and used in /libretroshare/src/pqi/p3netmgr.cc
//const uint32_t RS_NET_NEEDS_RESET = 0x0000;
//const uint32_t RS_NET_UNKNOWN = 0x0001;
//const uint32_t RS_NET_UPNP_INIT = 0x0002;
//const uint32_t RS_NET_UPNP_SETUP = 0x0003;
//const uint32_t RS_NET_EXT_SETUP = 0x0004;
//const uint32_t RS_NET_DONE = 0x0005;
//const uint32_t RS_NET_LOOPBACK = 0x0006;
//const uint32_t RS_NET_DOWN = 0x0007;
const uint32_t MIN_TIME_BETWEEN_NET_RESET = 5;
//const uint32_t MIN_TIME_BETWEEN_NET_RESET = 5;
const uint32_t PEER_IP_CONNECT_STATE_MAX_LIST_SIZE = 4;
//const uint32_t PEER_IP_CONNECT_STATE_MAX_LIST_SIZE = 4;
static struct RsLog::logInfo p3peermgrzoneInfo = {RsLog::Default, "p3peermgr"};
#define p3peermgrzone &p3peermgrzoneInfo
@ -2616,7 +2617,7 @@ bool p3PeerMgrIMPL::assignPeersToGroup(const RsNodeGroupId &groupId, const std::
for (std::list<RsPgpId>::const_iterator peerIt = peerIds.begin(); peerIt != peerIds.end(); ++peerIt)
{
std::set<RsPgpId>::iterator peerIt1 = groupItem.peerIds.find(*peerIt);
//std::set<RsPgpId>::iterator peerIt1 = groupItem.peerIds.find(*peerIt);
if (assign)
{

View File

@ -68,8 +68,8 @@ static double getCurrentTS()
struct RsLog::logInfo pqihandlerzoneInfo = {RsLog::Default, "pqihandler"};
#define pqihandlerzone &pqihandlerzoneInfo
static const int PQI_HANDLER_NB_PRIORITY_LEVELS = 10 ;
static const float PQI_HANDLER_NB_PRIORITY_RATIO = 2 ;
//static const int PQI_HANDLER_NB_PRIORITY_LEVELS = 10 ;
//static const float PQI_HANDLER_NB_PRIORITY_RATIO = 2 ;
/****
#define DEBUG_TICK 1

View File

@ -27,7 +27,9 @@
#include "util/rsdebug.h"
#include "util/rsstring.h"
#ifdef SERVICE_DEBUG
const int pqiservicezone = 60478;
#endif
/****
* #define SERVICE_DEBUG 1

View File

@ -452,7 +452,7 @@ int pqissl::ConnectAttempt()
rslog(RSL_DEBUG_BASIC, pqisslzone,
"pqissl::ConnectAttempt() STATE = Not Waiting, starting connection");
#endif
/* fallthrough */
case WAITING_DELAY:
#ifdef PQISSL_LOG_DEBUG

View File

@ -123,6 +123,7 @@ pqiperson * pqisslpersongrp::locked_createPerson(const RsPeerId& id, pqilistener
std::cerr << " - mPeerMgr->isHiddenPeer(id): " << mPeerMgr->isHiddenPeer(id) << std::endl;
std::cerr << " - hidden types: peer=" << typePeer << " own=" << typeOwn << std::endl;
std::cerr << " --> falling back to Tor" << std::endl;
/* fallthrough */
case RS_HIDDEN_TYPE_TOR:
pqip -> addChildInterface(PQI_CONNECT_HIDDEN_TOR_TCP, pqicSOCKSProxy);
break;

View File

@ -289,6 +289,7 @@ public:
/* Operating Mode */
virtual uint32_t getOperatingMode() = 0;
virtual bool setOperatingMode(uint32_t opMode) = 0;
virtual bool setOperatingMode(const std::string &opModeStr) = 0;
/* Data Rate Control - to be moved here */
virtual int SetMaxDataRates( int downKb, int upKb ) = 0;

View File

@ -33,7 +33,7 @@
#include "retroshare/rsinit.h"
#include "plugins/pluginmanager.h"
#include "util/rsdebug.h"
const int p3facemsgzone = 11453;
//const int p3facemsgzone = 11453;
#include <sys/time.h>
#include <time.h>

View File

@ -30,7 +30,7 @@
#include "util/rsdir.h"
#include "util/rsdebug.h"
const int p3facemsgzone = 11453;
//const int p3facemsgzone = 11453;
#include <sys/time.h>
#include <time.h>

View File

@ -49,7 +49,7 @@ const std::string CERT_LOCAL_IP = "--LOCAL--";
const std::string CERT_EXT_IP = "--EXT--";
const std::string CERT_DYNDNS = "--DYNDNS--";
static const int MAX_TIME_KEEP_LOCATION_WITHOUT_CONTACT = 30*24*3600 ; // 30 days.
//static const int MAX_TIME_KEEP_LOCATION_WITHOUT_CONTACT = 30*24*3600 ; // 30 days.
#include "pqi/authssl.h"

View File

@ -294,6 +294,7 @@ uint32_t p3ServerConfig::getUserLevel()
userLevel = RSCONFIG_USER_LEVEL_BASIC;
}
}
/* fallthrough */
case RSCONFIG_USER_LEVEL_BASIC:
{
/* check that we have some lastConnect > 0 */
@ -302,7 +303,7 @@ uint32_t p3ServerConfig::getUserLevel()
userLevel = RSCONFIG_USER_LEVEL_CASUAL;
}
}
/* fallthrough */
case RSCONFIG_USER_LEVEL_CASUAL:
case RSCONFIG_USER_LEVEL_POWER:
@ -379,7 +380,7 @@ uint32_t p3ServerConfig::getOperatingMode()
{
mode = RS_OPMODE_GAMING;
}
else if (modestr == "MINIMAL_TRANSFER")
else if (modestr == "MINIMAL")
{
mode = RS_OPMODE_MINIMAL;
}
@ -409,7 +410,7 @@ bool p3ServerConfig::setOperatingMode(uint32_t opMode)
break;
case RS_OPMODE_MINIMAL:
modestr = "MINIMAL_TRANSFER";
modestr = "MINIMAL";
break;
}
mGeneralConfig->setSetting(RS_CONFIG_OPERATING_STRING, modestr);
@ -422,6 +423,31 @@ bool p3ServerConfig::setOperatingMode(uint32_t opMode)
return switchToOperatingMode(opMode);
}
bool p3ServerConfig::setOperatingMode(const std::string &opModeStr)
{
uint32_t opMode = RS_OPMODE_FULL;
std::string upper;
stringToUpperCase(opModeStr, upper);
if (upper == "NOTURTLE")
{
opMode = RS_OPMODE_NOTURTLE;
}
else if (upper == "GAMING")
{
opMode = RS_OPMODE_GAMING;
}
else if (upper == "MINIMAL")
{
opMode = RS_OPMODE_MINIMAL;
}
else // "FULL" by default
{
opMode = RS_OPMODE_FULL;
}
return setOperatingMode(opMode);
}
bool p3ServerConfig::switchToOperatingMode(uint32_t opMode)
{

View File

@ -91,6 +91,7 @@ virtual bool setConfigurationOption(uint32_t key, const std::string &opt);
/* Operating Mode */
virtual uint32_t getOperatingMode();
virtual bool setOperatingMode(uint32_t opMode);
virtual bool setOperatingMode(const std::string &opModeStr);
virtual int SetMaxDataRates( int downKb, int upKb );
virtual int GetMaxDataRates( int &downKb, int &upKb );

View File

@ -127,7 +127,7 @@ bool RsAccountsDetail::selectAccountByString(const std::string &prefUserString)
std::cerr << "RsAccountsDetail::selectAccountByString(" << prefUserString << ")" << std::endl;
bool pgpNameFound = false;
//bool pgpNameFound = false;
std::map<RsPeerId, AccountDetails>::const_iterator it;
for(it = mAccounts.begin() ; it!= mAccounts.end() ; ++it)
{
@ -138,7 +138,7 @@ bool RsAccountsDetail::selectAccountByString(const std::string &prefUserString)
if(prefUserString == it->second.mPgpName || pgp_id == it->second.mPgpId || ssl_id == it->second.mSslId)
{
mPreferredId = it->second.mSslId;
pgpNameFound = true;
//pgpNameFound = true;
std::cerr << "Account selected: " << ssl_id << std::endl;

View File

@ -138,11 +138,12 @@ class RsInitConfig
std::string load_trustedpeer_file;
bool udpListenerOnly;
std::string opModeStr;
};
static RsInitConfig *rsInitConfig = NULL;
const int p3facestartupzone = 47238;
//const int p3facestartupzone = 47238;
// initial configuration bootstrapping...
//static const std::string configInitFile = "default_cert.txt";
@ -189,6 +190,7 @@ void RsInit::InitRsConfig()
rsInitConfig->passwd = "";
rsInitConfig->debugLevel = PQL_WARNING;
rsInitConfig->udpListenerOnly = false;
rsInitConfig->opModeStr = std::string("FULL");
/* setup the homePath (default save location) */
// rsInitConfig->homePath = getHomePath();
@ -363,11 +365,11 @@ int RsInit::InitRetroShare(int _argc, char **_argv, bool /* strictCheck */)
>> parameter('l',"log-file" ,rsInitConfig->logfname ,"logfile" ,"Set Log filename." ,false)
>> parameter('d',"debug-level" ,rsInitConfig->debugLevel ,"level" ,"Set debug level." ,false)
#ifdef TO_REMOVE
// This as removed because it is not used anymore.
// This was removed because it is not used anymore.
>> parameter('w',"password" ,rsInitConfig->passwd ,"password" ,"Set Login Password." ,false)
#endif
>> parameter('i',"ip-address" ,rsInitConfig->inet ,"nnn.nnn.nnn.nnn", "Force IP address to use (if cannot be detected)." ,false)
>> parameter('o',"opmode" ,rsInitConfig->opModeStr ,"opmode" ,"Set Operating mode (Full, NoTurtle, Gaming, Minimal)." ,false)
>> parameter('p',"port" ,rsInitConfig->port ,"port", "Set listenning port to use." ,false)
>> parameter('c',"base-dir" ,opt_base_dir ,"directory", "Set base directory." ,false)
>> parameter('U',"user-id" ,prefUserString ,"ID", "[ocation Id] Sets Account to Use, Useful when Autologin is enabled.",false)
@ -1594,7 +1596,7 @@ int RsServer::StartupRetroShare()
serviceCtrl->registerServiceMonitor(mDisc, mDisc->getServiceInfo().mServiceType);
serviceCtrl->registerServiceMonitor(mStatusSrv, mStatusSrv->getServiceInfo().mServiceType);
serviceCtrl->registerServiceMonitor(chatSrv, chatSrv->getServiceInfo().mServiceType);
serviceCtrl->registerServiceMonitor(mBwCtrl, mDisc->getServiceInfo().mServiceType);
serviceCtrl->registerServiceMonitor(mBwCtrl, mBwCtrl->getServiceInfo().mServiceType);
/**************************************************************************/
@ -1733,6 +1735,10 @@ int RsServer::StartupRetroShare()
mPeerMgr->forceHiddenNode();
}
if (!rsInitConfig->opModeStr.empty())
{
rsConfig->setOperatingMode(rsInitConfig->opModeStr);
}
mNetMgr -> checkNetAddress();
if (rsInitConfig->hiddenNodeSet) {

View File

@ -36,7 +36,7 @@
#include <time.h>
static const uint32_t MAX_SERIALIZED_ARRAY_SIZE = 500 ;
//static const uint32_t MAX_SERIALIZED_ARRAY_SIZE = 500 ;
static const uint32_t MAX_SERIALIZED_CHUNK_SIZE = 10*1024*1024 ; // 10 MB.
//=================================================================================================//
@ -355,7 +355,7 @@ template<> bool RsTypeSerializer::deserialize( const uint8_t data[],
return true;
}
template<> void RsTypeSerializer::print_data( const std::string& n,
template<> void RsTypeSerializer::print_data( const std::string& /*n*/,
const RsItem& s )
{
RsGenericSerializer::SerializeContext ctx(

View File

@ -127,16 +127,16 @@
* [X] Implement a system to allow not storing info when we don't have it
*/
static const uint32_t LOWER_LIMIT = 0; // used to filter valid Opinion values from serialized data
//static const uint32_t LOWER_LIMIT = 0; // used to filter valid Opinion values from serialized data
static const uint32_t UPPER_LIMIT = 2; // used to filter valid Opinion values from serialized data
static const int kMaximumPeerAge = 180; // half a year.
//static const int kMaximumPeerAge = 180; // half a year.
static const int kMaximumSetSize = 100; // max set of updates to send at once.
static const int CLEANUP_PERIOD = 600 ; // 10 minutes
static const int ACTIVE_FRIENDS_ONLINE_DELAY = 86400*7 ; // 1 week.
//static const int ACTIVE_FRIENDS_ONLINE_DELAY = 86400*7 ; // 1 week.
static const int kReputationRequestPeriod = 600; // 10 mins
static const int kReputationStoreWait = 180; // 3 minutes.
static const float REPUTATION_ASSESSMENT_THRESHOLD_X1 = 0.5f ; // reputation under which the peer gets killed. Warning there's a 1 shift with what's shown in GUI. Be careful.
static const uint32_t PGP_AUTO_BAN_THRESHOLD_DEFAULT = 2 ; // above this, auto ban any GXS id signed by this node
//static const float REPUTATION_ASSESSMENT_THRESHOLD_X1 = 0.5f ; // reputation under which the peer gets killed. Warning there's a 1 shift with what's shown in GUI. Be careful.
//static const uint32_t PGP_AUTO_BAN_THRESHOLD_DEFAULT = 2 ; // above this, auto ban any GXS id signed by this node
static const uint32_t IDENTITY_FLAGS_UPDATE_DELAY = 100 ; //
static const uint32_t BANNED_NODES_UPDATE_DELAY = 313 ; // update approx every 5 mins. Chosen to not be a multiple of IDENTITY_FLAGS_UPDATE_DELAY
static const uint32_t REPUTATION_INFO_KEEP_DELAY_DEFAULT = 86400*35; // remove old reputation info 5 days after last usage limit, in case the ID would come back..

View File

@ -55,10 +55,11 @@ class p3LinkMgr;
class p3IdService;
// Temp tweak to test grouter
struct p3MsgService :
p3Service, p3Config, pqiServiceMonitor, GRouterClientService,
class p3MsgService :
public p3Service, public p3Config, public pqiServiceMonitor, GRouterClientService,
GxsTransClient
{
public:
p3MsgService(p3ServiceControl *sc, p3IdService *id_service, p3GxsTrans& gxsMS);
virtual RsServiceInfo getServiceInfo();

View File

@ -244,6 +244,7 @@ static long tou_socket_ctrl(BIO *b, int cmd, long num, void *ptr)
{
case BIO_CTRL_RESET:
num=0;
/* fallthrough */
case BIO_C_FILE_SEEK:
ret=0;
break;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Xavier Décoret <Xavier.Decoret@imag.fr>
/* Copyright (C) 2004 Xavier Decoret <Xavier.Decoret@imag.fr>
*
* argstream is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -71,8 +71,8 @@ namespace
private:
std::string shortName_;
std::string longName_;
std::string valueName_;
T* value_;
std::string valueName_;
T initialValue_;
std::string description_;
bool mandatory_;
@ -282,8 +282,8 @@ namespace
bool mandatory)
: shortName_(1,s),
longName_(l),
valueName_(valueName),
value_(&v),
valueName_(valueName),
initialValue_(v),
description_(desc),
mandatory_(mandatory)
@ -296,8 +296,8 @@ namespace
const char* desc,
bool mandatory)
: longName_(l),
valueName_(valueName),
value_(&v),
valueName_(valueName),
initialValue_(v),
description_(desc),
mandatory_(mandatory)
@ -310,8 +310,8 @@ namespace
const char* desc,
bool mandatory)
: shortName_(1,s),
valueName_(valueName),
value_(&v),
valueName_(valueName),
initialValue_(v),
description_(desc),
mandatory_(mandatory)

View File

@ -48,7 +48,7 @@ void *solveDNSEntries(void *p)
case DNSResolver::DNS_LOOKUP_ERROR: if(it->second.last_lookup_time + MAX_TIME_BEFORE_RETRY > now)
continue ;
/* fallthrough */ //Not really, but to suppress warning.
case DNSResolver::DNS_DONT_HAVE: next_call = it->first ;
it->second.state = DNSResolver::DNS_SEARCHING ;
it->second.last_lookup_time = now ;

View File

@ -163,6 +163,7 @@ bool RsCompress::uncompress_memory_chunk(const uint8_t *input_mem,const uint32_t
switch (ret) {
case Z_NEED_DICT:
ret = Z_DATA_ERROR; /* and fall through */
/* fallthrough */
case Z_DATA_ERROR:
case Z_MEM_ERROR:
(void)inflateEnd(&strm);

View File

@ -1030,11 +1030,13 @@ bool rs_inet_ntop (const sockaddr_storage &addr, std::string &dst)
const struct sockaddr_in * addrv4p = (const struct sockaddr_in *) &addr;
success = inet_ntop( addr.ss_family, (const void *) &(addrv4p->sin_addr), ipStr, INET_ADDRSTRLEN );
}
break;
case AF_INET6:
{
const struct sockaddr_in6 * addrv6p = (const struct sockaddr_in6 *) &addr;
success = inet_ntop( addr.ss_family, (const void *) &(addrv6p->sin6_addr), ipStr, INET6_ADDRSTRLEN );
}
break;
}
#endif // WINDOWS_SYS

View File

@ -54,8 +54,11 @@ std::string RsUtil::BinToHex(const std::string &bin)
return BinToHex(bin.c_str(), bin.length());
}
std::string RsUtil::BinToHex(const unsigned char *arr, const uint32_t len)
std::string RsUtil::BinToHex(const unsigned char *arr, const uint32_t len,uint32_t max_len)
{
if(max_len > 0)
return BinToHex((char*)arr,std::min(max_len,len)) + ((len > max_len)?"...":"") ;
else
return BinToHex((char*)arr,len) ;
}
std::string RsUtil::BinToHex(const char *arr, const uint32_t len)

View File

@ -36,7 +36,10 @@ namespace RsUtil {
std::string BinToHex(const std::string &bin);
std::string BinToHex(const char *arr, const uint32_t len);
std::string BinToHex(const unsigned char *arr, const uint32_t len);
// proxy function. When max_len>0 and len>max_len, only the first "max_len" bytes are writen to the string and "..." is happened.
std::string BinToHex(const unsigned char *arr, const uint32_t len, uint32_t max_len=0);
std::string NumberToString(uint64_t n, bool hex=false);
std::string HashId(const std::string &id, bool reverse = false);
std::vector<uint8_t> BinToSha256(const std::vector<uint8_t> &in);

View File

@ -2480,7 +2480,7 @@ static int parse_secret_key(ops_region_t *region,ops_parse_info_t *pinfo)
{
case OPS_S2KS_SALTED:
hashes[n].add(&hashes[n],C.secret_key.salt,OPS_SALT_SIZE);
// flow through...
/* fallthrough */
case OPS_S2KS_SIMPLE:
hashes[n].add(&hashes[n],(unsigned char*)passphrase,l);
break;

View File

@ -110,9 +110,7 @@ void DetailsDialog::setFileHash(const RsFileHash & hash)
if(!rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, nfo))
return ;
RetroShareLink link ;
link.createFile(QString::fromUtf8(nfo.fname.c_str()),nfo.size,QString::fromStdString(nfo.hash.toStdString())) ;
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(nfo.fname.c_str()),nfo.size,QString::fromStdString(nfo.hash.toStdString()));
ui.Linktext->setText(link.toString()) ;
}

View File

@ -712,8 +712,8 @@ void SearchDialog::copySearchLink()
std::cerr << "SearchDialog::copySearchLink(): keywords: " << keywords.toStdString();
std::cerr << std::endl;
RetroShareLink link;
if (link.createSearch(keywords)) {
RetroShareLink link = RetroShareLink::createSearch(keywords);
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
@ -1443,8 +1443,8 @@ void SearchDialog::copyResultLink()
qulonglong fsize = item->text(SR_SIZE_COL).toULongLong();
QString fname = item->text(SR_NAME_COL);
RetroShareLink link;
if (link.createFile(fname, fsize, fhash)) {
RetroShareLink link = RetroShareLink::createFile(fname, fsize, fhash);
if (link.valid()) {
std::cerr << "new link added to clipboard: " << link.toString().toStdString() << std::endl ;
urls.push_back(link) ;
}

View File

@ -1464,8 +1464,8 @@ void TransfersDialog::copyLink ()
continue;
}
RetroShareLink link;
if (link.createFile(QString::fromUtf8(info.fname.c_str()), info.size, QString::fromStdString(info.hash.toStdString()))) {
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(info.fname.c_str()), info.size, QString::fromStdString(info.hash.toStdString()));
if (link.valid()) {
links.push_back(link) ;
}
}
@ -1487,8 +1487,8 @@ void TransfersDialog::ulCopyLink ()
continue;
}
RetroShareLink link;
if (link.createFile(QString::fromUtf8(info.fname.c_str()), info.size, QString::fromStdString(info.hash.toStdString()))) {
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(info.fname.c_str()), info.size, QString::fromStdString(info.hash.toStdString()));
if (link.valid()) {
links.push_back(link) ;
}
}

View File

@ -120,10 +120,10 @@ void GetStartedDialog::updateFromUserLevel()
case RSCONFIG_USER_LEVEL_POWER:
case RSCONFIG_USER_LEVEL_OVERRIDE:
ui.firewallCheckBox->setChecked(true);
/* fallthrough */
case RSCONFIG_USER_LEVEL_CASUAL:
ui.connectCheckBox->setChecked(true);
/* fallthrough */
case RSCONFIG_USER_LEVEL_BASIC:
ui.addCheckBox->setChecked(true);
ui.inviteCheckBox->setChecked(true);

View File

@ -467,8 +467,7 @@ void IdDetailsDialog::sendInvite()
composer->setTitleText(tr("You have a friend invite"));
RsPeerId ownId = rsPeers->getOwnId();
RetroShareLink link;
link.createCertificate(ownId);
RetroShareLink link = RetroShareLink::createCertificate(ownId);
RsGxsId keyId(ui->lineEdit_KeyId->text().toStdString());

View File

@ -1943,8 +1943,7 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const
case RsIdentityUsage::MESSAGE_AUTHOR_SIGNATURE_VALIDATION:
case RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE: // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
{
RetroShareLink l;
l.createGxsMessageLink(service_type,u.mGrpId,u.mMsgId,tr("Message/vote/comment"));
RetroShareLink l = RetroShareLink::createGxsMessageLink(service_type,u.mGrpId,u.mMsgId,tr("Message/vote/comment"));
return tr("%1 in %2 tab").arg(l.toHtml()).arg(service_name) ;
}
case RsIdentityUsage::CHAT_LOBBY_MSG_VALIDATION: // Chat lobby msgs are signed, so each time one comes, or a chat lobby event comes, a signature verificaiton happens.
@ -2207,8 +2206,7 @@ void IdDialog::handleSerializedGroupData(uint32_t token)
QList<RetroShareLink> urls ;
RetroShareLink link ;
link.createIdentity(gxs_id,QString::fromUtf8(details.mNickname.c_str()),QString::fromStdString(radix)) ;
RetroShareLink link = RetroShareLink::createIdentity(gxs_id,QString::fromUtf8(details.mNickname.c_str()),QString::fromStdString(radix)) ;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls) ;

View File

@ -1492,6 +1492,23 @@ void MainWindow::processLastArgs()
/* Now use files from the command line, because no RetroShare was running */
openRsCollection(Rshare::files()->takeFirst());
}
/* Handle the -opmode options. */
if (opModeStatus) {
QString opmode = Rshare::opmode().toLower();
if (opmode == "noturtle") {
opModeStatus->setCurrentIndex(RS_OPMODE_NOTURTLE - 1);
} else if (opmode == "gaming") {
opModeStatus->setCurrentIndex(RS_OPMODE_GAMING - 1);
} else if (opmode == "minimal") {
opModeStatus->setCurrentIndex(RS_OPMODE_MINIMAL - 1);
} else {
opModeStatus->setCurrentIndex(RS_OPMODE_FULL - 1);
}
opModeStatus->setOpMode();
} else {
std::cerr << "ERR: MainWindow::processLastArgs opModeStatus is not initialized.";
}
}
void MainWindow::switchVisibilityStatus(StatusElement e,bool b)

View File

@ -323,8 +323,8 @@ void NetworkDialog::copyLink()
RsPgpId peer_id ( wi->text(COLUMN_PEERID).toStdString() ) ;
QList<RetroShareLink> urls;
RetroShareLink link;
if (link.createPerson(peer_id)) {
RetroShareLink link = RetroShareLink::createPerson(peer_id);
if (link.valid()) {
urls.push_back(link);
}

View File

@ -67,7 +67,7 @@ const uint32_t NEWSFEED_PEERLIST = 0x0001;
const uint32_t NEWSFEED_FORUMNEWLIST = 0x0002;
const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003;
const uint32_t NEWSFEED_CHANNELNEWLIST = 0x0004;
const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
//const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
#if 0
const uint32_t NEWSFEED_BLOGNEWLIST = 0x0006;
const uint32_t NEWSFEED_BLOGMSGLIST = 0x0007;

View File

@ -352,211 +352,235 @@ RetroShareLink::RetroShareLink()
clear();
}
bool RetroShareLink::createIdentity(const RsGxsId& id, const QString& name, const QString& radix_data)
RetroShareLink RetroShareLink::createIdentity(const RsGxsId& id, const QString& name, const QString& radix_data)
{
clear();
RetroShareLink link;
link.clear();
_name = name;
_hash = QString::fromStdString(id.toStdString());
_radix_group_data = radix_data ;
link._name = name;
link._hash = QString::fromStdString(id.toStdString());
link._radix_group_data = radix_data ;
_type = TYPE_IDENTITY;
link._type = TYPE_IDENTITY;
check();
link.check();
return valid();
return link;
}
bool RetroShareLink::createExtraFile(const QString& name, uint64_t size, const QString& hash,const QString& ssl_id)
RetroShareLink RetroShareLink::createExtraFile(const QString& name, uint64_t size, const QString& hash,const QString& ssl_id)
{
clear();
RetroShareLink link;
link.clear();
_name = name;
_size = size;
_hash = hash;
_SSLid = ssl_id;
link._name = name;
link._size = size;
link._hash = hash;
link._SSLid = ssl_id;
_type = TYPE_EXTRAFILE;
link._type = TYPE_EXTRAFILE;
check();
link.check();
return valid();
}
bool RetroShareLink::createFile(const QString& name, uint64_t size, const QString& hash)
{
clear();
_name = name;
_size = size;
_hash = hash;
_type = TYPE_FILE;
check();
return valid();
return link;
}
bool RetroShareLink::createPublicMsgInvite(time_t time_stamp,const QString& issuer_pgp_id,const QString& hash)
RetroShareLink RetroShareLink::createFile(const QString& name, uint64_t size, const QString& hash)
{
clear() ;
RetroShareLink link;
link.clear();
_type = TYPE_PUBLIC_MSG ;
_time_stamp = time_stamp ;
_hash = hash ;
_GPGid = issuer_pgp_id ;
link._name = name;
link._size = size;
link._hash = hash;
check() ;
link._type = TYPE_FILE;
return valid() ;
link.check();
return link;
}
bool RetroShareLink::createPerson(const RsPgpId& id)
RetroShareLink RetroShareLink::createPublicMsgInvite(time_t time_stamp,const QString& issuer_pgp_id,const QString& hash)
{
clear();
RetroShareLink link;
link.clear() ;
link._type = TYPE_PUBLIC_MSG ;
link._time_stamp = time_stamp ;
link._hash = hash ;
link._GPGid = issuer_pgp_id ;
link.check() ;
return link;
}
RetroShareLink RetroShareLink::createPerson(const RsPgpId& id)
{
RetroShareLink link;
link.clear();
RsPeerDetails detail;
if (rsPeers->getGPGDetails(id, detail) == false) {
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << id << std::endl;
return false;
} else {
link._hash = QString::fromStdString(id.toStdString());
link._name = QString::fromUtf8(detail.name.c_str());
link._type = TYPE_PERSON;
}
_hash = QString::fromStdString(id.toStdString());
_name = QString::fromUtf8(detail.name.c_str());
link.check();
_type = TYPE_PERSON;
check();
return valid();
return link;
}
bool RetroShareLink::createCertificate(const RsPeerId& ssl_id)
RetroShareLink RetroShareLink::createCertificate(const RsPeerId& ssl_id)
{
// This is baaaaaad code:
RetroShareLink link;
link.clear();
#warning csoler 2012-08-14: This is baaaaaad code:
// - we should not need to parse and re-read a cert in old format.
//
RsPeerDetails detail;
if (rsPeers->getPeerDetails(ssl_id, detail) == false) {
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << ssl_id << std::endl;
return false;
} else {
link._type = TYPE_CERTIFICATE;
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id,false).c_str());
link._name = QString::fromUtf8(detail.name.c_str());
link._location = QString::fromUtf8(detail.location.c_str());
link._radix.replace("\n","");
std::cerr << "Found radix = " << link._radix.toStdString() << std::endl;
}
_type = TYPE_CERTIFICATE;
_radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id,false).c_str());
_name = QString::fromUtf8(detail.name.c_str());
_location = QString::fromUtf8(detail.location.c_str());
_radix.replace("\n","");
link.check();
std::cerr << "Found radix = " << _radix.toStdString() << std::endl;
return true;
return link;
}
bool RetroShareLink::createUnknwonSslCertificate(const RsPeerId& sslId, const RsPgpId& gpgId)
RetroShareLink RetroShareLink::createUnknwonSslCertificate(const RsPeerId& sslId, const RsPgpId& gpgId)
{
RetroShareLink link;
link.clear();
// first try ssl id
if (createCertificate(sslId)) {
if (gpgId.isNull() || _GPGid.toStdString() == gpgId.toStdString()) {
return true;
link = createCertificate(sslId);
if (link.valid()) {
if (gpgId.isNull() || link._GPGid.toStdString() == gpgId.toStdString()) {
return link;
}
// wrong gpg id
return false;
link.clear();
return link;
}
// then gpg id
if (createPerson(gpgId)) {
if (!_SSLid.isEmpty()) {
return false;
link = createPerson(gpgId);
if (link.valid()) {
if (!link._SSLid.isEmpty()) {
link.clear();
return link;
}
if (sslId.isNull()) {
return true;
link.check();
return link;
}
_SSLid = QString::fromStdString(sslId.toStdString());
if (_location.isEmpty()) {
_location = _name;
link._SSLid = QString::fromStdString(sslId.toStdString());
if (link._location.isEmpty()) {
link._location = link._name;
}
return true;
link.check();
return link;
}
return false;
link.clear();
return link;
}
bool RetroShareLink::createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName)
RetroShareLink RetroShareLink::createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName)
{
clear();
RetroShareLink link;
link.clear();
if (!groupId.isNull()) {
_hash = QString::fromStdString(groupId.toStdString());
_type = linkType;
_name = groupName;
link._hash = QString::fromStdString(groupId.toStdString());
link._type = linkType;
link._name = groupName;
}
check();
link.check();
return valid();
return link;
}
bool RetroShareLink::createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName)
RetroShareLink RetroShareLink::createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName)
{
clear();
RetroShareLink link;
link.clear();
if (!groupId.isNull() && !msgId.isNull()) {
_hash = QString::fromStdString(groupId.toStdString());
_msgId = QString::fromStdString(msgId.toStdString());
_type = linkType;
_name = msgName;
link._hash = QString::fromStdString(groupId.toStdString());
link._msgId = QString::fromStdString(msgId.toStdString());
link._type = linkType;
link._name = msgName;
}
check();
link.check();
return valid();
return link;
}
bool RetroShareLink::createSearch(const QString& keywords)
RetroShareLink RetroShareLink::createSearch(const QString& keywords)
{
clear();
RetroShareLink link;
link.clear();
_name = keywords;
link._name = keywords;
_type = TYPE_SEARCH;
link._type = TYPE_SEARCH;
check();
link.check();
return valid();
return link;
}
bool RetroShareLink::createMessage(const RsPeerId& peerId, const QString& subject)
RetroShareLink RetroShareLink::createMessage(const RsPeerId& peerId, const QString& subject)
{
clear();
RetroShareLink link;
link.clear();
_hash = QString::fromStdString(peerId.toStdString());
PeerDefs::rsidFromId(peerId, &_name);
_subject = subject;
link._hash = QString::fromStdString(peerId.toStdString());
PeerDefs::rsidFromId(peerId, &link._name);
link._subject = subject;
_type = TYPE_MESSAGE;
link._type = TYPE_MESSAGE;
check();
link.check();
return valid();
return link;
}
bool RetroShareLink::createMessage(const RsGxsId& peerId, const QString& subject)
RetroShareLink RetroShareLink::createMessage(const RsGxsId& peerId, const QString& subject)
{
clear();
RetroShareLink link;
link.clear();
_hash = QString::fromStdString(peerId.toStdString());
link._hash = QString::fromStdString(peerId.toStdString());
PeerDefs::rsidFromId(peerId, &link._name);
link._subject = subject;
PeerDefs::rsidFromId(peerId, &_name);
//_name = QString::fromStdString("GXS_id("+peerId.toStdString()+")") ;
// do something better here!!
_subject = subject;
link._type = TYPE_MESSAGE;
_type = TYPE_MESSAGE;
link.check();
check();
return valid();
return link;
}
void RetroShareLink::clear()
{
_valid = false;
@ -584,6 +608,7 @@ void RetroShareLink::check()
case TYPE_EXTRAFILE:
if(!checkSSLId(_SSLid))
_valid = false; // no break! We also test file stuff below.
/* fallthrough */
case TYPE_FILE:
if(_size > (((uint64_t)1)<<40)) // 1TB. Who has such large files?
_valid = false;
@ -1640,6 +1665,8 @@ static void processList(const QStringList &list, const QString &textSingular, co
return process(links, flag);
}
/**** RSLinkClipboard ********************************************/
void RSLinkClipboard::copyLinks(const QList<RetroShareLink>& links)
{
QString res ;

View File

@ -77,19 +77,18 @@ class RetroShareLink
RetroShareLink(const QUrl& url);
RetroShareLink(const QString& url);
#warning csoler 2017-01-04: These methods should be static and return a created link
bool createFile(const QString& name, uint64_t size, const QString& hash);
bool createExtraFile(const QString& name, uint64_t size, const QString& hash, const QString& ssl_id);
bool createPerson(const RsPgpId &id);
bool createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName);
bool createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName);
bool createSearch(const QString& keywords);
bool createMessage(const RsPeerId &peerId, const QString& subject);
bool createMessage(const RsGxsId &peerId, const QString& subject);
bool createIdentity(const RsGxsId& gxs_id,const QString& name,const QString& radix_data) ;
bool createCertificate(const RsPeerId &ssl_id) ;
bool createPublicMsgInvite(time_t time_stamp,const QString& pgp_id,const QString& hash) ;
bool createUnknwonSslCertificate(const RsPeerId &sslId, const RsPgpId &gpgId = RsPgpId()) ;
static RetroShareLink createIdentity(const RsGxsId& gxs_id,const QString& name,const QString& radix_data) ;
static RetroShareLink createExtraFile(const QString& name, uint64_t size, const QString& hash, const QString& ssl_id);
static RetroShareLink createFile(const QString& name, uint64_t size, const QString& hash);
static RetroShareLink createPublicMsgInvite(time_t time_stamp,const QString& pgp_id,const QString& hash) ;
static RetroShareLink createPerson(const RsPgpId &id);
static RetroShareLink createCertificate(const RsPeerId &ssl_id) ;
static RetroShareLink createUnknwonSslCertificate(const RsPeerId &sslId, const RsPgpId &gpgId = RsPgpId()) ;
static RetroShareLink createGxsGroupLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const QString &groupName);
static RetroShareLink createGxsMessageLink(const RetroShareLink::enumType &linkType, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &msgName);
static RetroShareLink createSearch(const QString& keywords);
static RetroShareLink createMessage(const RsPeerId &peerId, const QString& subject);
static RetroShareLink createMessage(const RsGxsId &peerId, const QString& subject);
enumType type() const {return _type; }
uint64_t size() const { return _size ; }

View File

@ -609,8 +609,8 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
continue;
}
RetroShareLink link;
if (link.createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.toStdString().c_str())) {
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.toStdString().c_str());
if (link.valid()) {
urls.push_back(link) ;
}
}
@ -622,8 +622,8 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
has_unhashed_files = true;
continue;
}
RetroShareLink link;
if (link.createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.toStdString().c_str())) {
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.toStdString().c_str());
if (link.valid()) {
urls.push_back(link) ;
}
}

View File

@ -691,7 +691,11 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
if (!anchors.isEmpty()){
if (anchors.at(0).startsWith(PERSONID)){
RsGxsId mId = RsGxsId(QString(anchors.at(0)).replace(PERSONID,"").toStdString());
QString strId = QString(anchors.at(0)).replace(PERSONID,"");
if (strId.contains(" "))
strId.truncate(strId.indexOf(" "));
RsGxsId mId = RsGxsId(strId.toStdString());
if(!mId.isNull()) {
RsIdentityDetails details;
if (rsIdentity->getIdDetails(mId, details)){
@ -1003,11 +1007,26 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
formatMsg.replace(QString("<a name=\"date\">"),QString("<a name=\"%1\">").arg(timeStamp));
formatMsg.replace(QString("<a name=\"time\">"),QString("<a name=\"%1\">").arg(timeStamp));
//replace Name anchors with GXS Id
QString strGxsId = "";
if (!gxsId.isNull()) {
strGxsId = QString::fromStdString(gxsId.toStdString());
RsIdentityDetails details;
QString strPreName = "";
QString strGxsId = QString::fromStdString(gxsId.toStdString());
rsIdentity->getIdDetails(gxsId, details);
bool isUnsigned = !(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED);
if(isUnsigned) {
QIcon icon = QIcon(":/icons/anonymous_blue_128.png");
int height = ui->textBrowser->fontMetrics().height()*0.8;
QImage image(icon.pixmap(height,height).toImage());
QByteArray byteArray;
QBuffer buffer(&byteArray);
image.save(&buffer, "PNG"); // writes the image in PNG format inside the buffer
QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
strPreName = QString("<img src=\"data:image/png;base64,%1\" alt=\"[unsigned]\" />").arg(iconBase64);
}
formatMsg.replace(QString("<a name=\"name\">")
,QString("<a name=\"").append(PERSONID).append("%1\">").arg(strGxsId) );
,QString(strPreName).append("<a name=\"").append(PERSONID).append("%1 %2\">").arg(strGxsId, isUnsigned ? tr(" Unsigned"):""));
} else {
formatMsg.replace(QString("<a name=\"name\">"),"");
}
@ -1556,14 +1575,14 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it;
QString ext = QFileInfo(hashedFile.filename).suffix();
//QString ext = QFileInfo(hashedFile.filename).suffix();
RetroShareLink link;
if(mDefaultExtraFileFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()));
link = RetroShareLink::createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()));
else
link.createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()),QString::fromStdString(rsPeers->getOwnId().toStdString()));
link = RetroShareLink::createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()),QString::fromStdString(rsPeers->getOwnId().toStdString()));
if (hashedFile.flag & HashedFile::Picture) {
message += QString("<img src=\"file:///%1\" width=\"100\" height=\"100\">").arg(hashedFile.filepath);
@ -1575,6 +1594,7 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
}
}
message += link.toHtmlSize();
if (it != hashedFiles.end()) {
message += "<BR>";
}

View File

@ -139,6 +139,12 @@ FriendList::FriendList(QWidget *parent) :
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
ui->filterLineEdit->showFilterIcon();
/* Add filter actions */
QTreeWidgetItem *headerItem = ui->peerTreeWidget->headerItem();
QString headerText = headerItem->text(COLUMN_NAME);
ui->filterLineEdit->addFilter(QIcon(), headerText, COLUMN_NAME, QString("%1 %2").arg(tr("Search"), headerText));
ui->filterLineEdit->addFilter(QIcon(), tr("ID"), COLUMN_ID, tr("Search ID"));
mActionSortByState = new QAction(tr("Sort by state"), this);
mActionSortByState->setCheckable(true);
connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(sortByState(bool)));
@ -167,6 +173,7 @@ FriendList::FriendList(QWidget *parent) :
ui->peerTreeWidget->setColumnWidth(COLUMN_NAME, 22 * fontWidth);
ui->peerTreeWidget->setColumnWidth(COLUMN_LAST_CONTACT, 12 * fontWidth);
ui->peerTreeWidget->setColumnWidth(COLUMN_IP, 15 * fontWidth);
ui->peerTreeWidget->setColumnWidth(COLUMN_ID, 32 * fontWidth);
int avatarHeight = fontMetrics.height() * 3;
ui->peerTreeWidget->setIconSize(QSize(avatarHeight, avatarHeight));
@ -706,7 +713,12 @@ void FriendList::insertPeers()
groupItem->setForeground(COLUMN_NAME, QBrush(textColorGroup()));
/* used to find back the item */
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id.toStdString()));
QString strID = QString::fromStdString(groupInfo->id.toStdString());
groupItem->setData(COLUMN_DATA, ROLE_ID, strID);
//No needs for group ???
//groupItem->setText(COLUMN_ID, strID);
//groupItem->setData(COLUMN_ID, ROLE_SORT_NAME, strID);
//groupItem->setData(COLUMN_ID, ROLE_FILTER, strID);
groupItem->setData(COLUMN_DATA, ROLE_STANDARD, (groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? true : false);
/* Sort data */
@ -808,7 +820,11 @@ void FriendList::insertPeers()
gpgItem->setTextAlignment(COLUMN_NAME, Qt::AlignLeft | Qt::AlignVCenter);
/* not displayed, used to find back the item */
gpgItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.gpg_id.toStdString()));
QString strID = QString::fromStdString(detail.gpg_id.toStdString());
gpgItem->setData(COLUMN_DATA, ROLE_ID, strID);
gpgItem->setText(COLUMN_ID, strID);
gpgItem->setData(COLUMN_ID, ROLE_SORT_NAME, strID);
gpgItem->setData(COLUMN_ID, ROLE_FILTER, strID);
/* Sort data */
for (int i = 0; i < columnCount; ++i) {
@ -893,7 +909,11 @@ void FriendList::insertPeers()
}
/* not displayed, used to find back the item */
sslItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id.toStdString()));
QString strID = QString::fromStdString(sslDetail.id.toStdString());
sslItem->setData(COLUMN_DATA, ROLE_ID, strID);
sslItem->setText(COLUMN_ID, strID);
sslItem->setData(COLUMN_ID, ROLE_SORT_NAME, strID);
sslItem->setData(COLUMN_ID, ROLE_FILTER, strID);
/* Custom state string */
QString customStateString;
@ -1394,14 +1414,12 @@ void FriendList::copyFullCertificate()
{
QTreeWidgetItem *c = getCurrentPeer();
QList<RetroShareLink> urls;
RetroShareLink link ;
link.createCertificate(RsPeerId(getRsId(c))) ;
RetroShareLink link = RetroShareLink::createCertificate(RsPeerId(getRsId(c)));
urls.push_back(link);
std::cerr << "link: " << std::endl;
std::cerr<< link.toString().toStdString() << std::endl;
RSLinkClipboard::copyLinks(urls);
}
@ -2264,8 +2282,9 @@ void FriendList::setShowGroups(bool show)
*/
void FriendList::filterItems(const QString &text)
{
int filterColumn = ui->filterLineEdit->currentFilter();
mFilterText = text;
ui->peerTreeWidget->filterItems(COLUMN_NAME, mFilterText, ROLE_FILTER);
ui->peerTreeWidget->filterItems(filterColumn, mFilterText, ROLE_FILTER);
}
/**

View File

@ -53,7 +53,8 @@ public:
{
COLUMN_NAME = 0,
COLUMN_LAST_CONTACT = 1,
COLUMN_IP = 2
COLUMN_IP = 2,
COLUMN_ID = 3
};
public:

View File

@ -71,7 +71,7 @@
<bool>false</bool>
</property>
<property name="columnCount">
<number>3</number>
<number>4</number>
</property>
<attribute name="headerDefaultSectionSize">
<number>120</number>
@ -97,6 +97,11 @@
<string>IP</string>
</property>
</column>
<column>
<property name="text">
<string>ID</string>
</property>
</column>
</widget>
</item>
</layout>

View File

@ -271,10 +271,10 @@ void MimeTextEdit::pasteLink()
void MimeTextEdit::pasteOwnCertificateLink()
{
RetroShareLink link;
RsPeerId ownId = rsPeers->getOwnId();
RetroShareLink link = RetroShareLink::createCertificate(ownId);
if (link.createCertificate(ownId)) {
if (link.valid()) {
insertHtml(link.toHtml() + " ");
}
}

View File

@ -362,21 +362,21 @@ void RSGraphWidget::paintEvent(QPaintEvent *)
_painter->end();
}
QSizeF RSGraphWidget::sizeHint(Qt::SizeHint which, const QSizeF& /* constraint */) const
{
float FS = QFontMetricsF(font()).height();
//float fact = FS/14.0 ;
switch(which)
{
default:
case Qt::MinimumSize:
case Qt::PreferredSize:
return QSizeF(70*FS,12*FS);
case Qt::MaximumSize:
return QSizeF(700*FS,120*FS);
}
}
//QSizeF RSGraphWidget::sizeHint(Qt::SizeHint which, const QSizeF& /* constraint */) const
//{
// float FS = QFontMetricsF(font()).height();
// //float fact = FS/14.0 ;
//
// switch(which)
// {
//default:
// case Qt::MinimumSize:
// case Qt::PreferredSize:
// return QSizeF(70*FS,12*FS);
// case Qt::MaximumSize:
// return QSizeF(700*FS,120*FS);
// }
//}
QColor RSGraphWidget::getColor(const std::string& name)
{
@ -437,7 +437,7 @@ void RSGraphWidget::paintData()
if(_maxValue > 0.0f)
{
if(_flags & RSGRAPH_FLAGS_LOG_SCALE_Y)
_y_scale = _rec.height()*0.8 / log(std::max(2.0,_maxValue)) ;
_y_scale = _rec.height()*0.8 / log(std::max((qreal)2.0,(qreal)_maxValue)) ;
else
_y_scale = _rec.height()*0.8/_maxValue ;
}

View File

@ -170,7 +170,8 @@ protected:
/** Overloaded QWidget::paintEvent() */
void paintEvent(QPaintEvent *event);
virtual QSizeF sizeHint( Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
//QSize QFrame::sizeHint() const;
// virtual QSizeF sizeHint( Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
protected slots:
void updateIfPossible() ;

View File

@ -142,9 +142,7 @@ void ConfCertDialog::load()
ui.headerFrame->setHeaderText(nameAndLocation);
RetroShareLink link;
link.createPerson(detail.gpg_id);
RetroShareLink link = RetroShareLink::createPerson(detail.gpg_id);
ui.pgpfingerprint->setText(link.toHtml());
ui.pgpfingerprint->setToolTip(link.title());

View File

@ -267,7 +267,7 @@ void PGPKeyDialog::load()
RetroShareLink link ;
for(std::list<RsPgpId>::const_iterator it(detail.gpgSigners.begin());it!=detail.gpgSigners.end();++it) {
link.createPerson(*it);
link = RetroShareLink::createPerson(*it);
if (link.valid()) {
text += link.toHtml() + "<BR>";
}

View File

@ -127,8 +127,7 @@ void GxsChannelGroupItem::fill()
std::cerr << std::endl;
#endif
RetroShareLink link;
link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
ui->nameLabel->setText(link.toHtml());
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));

View File

@ -49,9 +49,21 @@
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate)
{
init(messageId,older_versions) ;
}
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
{
init(post.mMeta.mMsgId,older_versions) ;
mPost = post ;
}
void GxsChannelPostItem::init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions)
{
QVector<RsGxsMessageId> v;
bool self = false;
//bool self = false;
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
v.push_back(*it) ;
@ -218,12 +230,12 @@ bool GxsChannelPostItem::setGroup(const RsGxsChannelGroup &group, bool doFill)
mGroup = group;
// if not publisher, hide the edit button. Without the publish key, there's no way to edit a message.
// If not publisher, hide the edit button. Without the publish key, there's no way to edit a message.
#ifdef DEBUG_ITEM
std::cerr << "Group subscribe flags = " << std::hex << mGroup.mMeta.mSubscribeFlags << std::dec << std::endl;
std::cerr << "Group subscribe flags = " << std::hex << mGroup.mMeta.mSubscribeFlags << std::dec << std::endl ;
#endif
if(!IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags))
ui->editButton->hide();
if( !IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags) )
ui->editButton->hide() ;
if (doFill) {
fill();
@ -398,13 +410,11 @@ void GxsChannelPostItem::fill()
}
title = tr("Channel Feed") + ": ";
RetroShareLink link;
link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, groupName());
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, groupName());
title += link.toHtml();
ui->titleLabel->setText(title);
RetroShareLink msgLink;
msgLink.createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
ui->subjectLabel->setText(msgLink.toHtml());
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags))

View File

@ -47,6 +47,11 @@ public:
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
// This method can be called when additional information is known about the post. In this case, the widget will be initialized with some
// minimap information from the post and completed when the use displays it, which shouldn't cost anything more.
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
virtual ~GxsChannelPostItem();
@ -63,6 +68,8 @@ public:
bool isUnread() const ;
protected:
void init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions);
/* FeedItem */
virtual void doExpand(bool open);
virtual void expandFill(bool first);

View File

@ -127,8 +127,7 @@ void GxsForumGroupItem::fill()
std::cerr << std::endl;
#endif
RetroShareLink link;
link.createGxsGroupLink(RetroShareLink::TYPE_FORUM, mGroup.mMeta.mGroupId, groupName());
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_FORUM, mGroup.mMeta.mGroupId, groupName());
ui->nameLabel->setText(link.toHtml());
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str()));

View File

@ -271,8 +271,7 @@ void GxsForumMsgItem::fill()
}
QString title = tr("Forum Feed") + ": ";
RetroShareLink link;
link.createGxsGroupLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, groupName());
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, groupName());
title += link.toHtml();
ui->titleLabel->setText(title);
@ -310,8 +309,7 @@ void GxsForumMsgItem::fill()
// nameLabel->setText(tr("Anonymous"));
// }
RetroShareLink msgLink;
msgLink.createGxsMessageLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, mMessage.mMeta.mMsgId, messageName());
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_FORUM, mMessage.mMeta.mGroupId, mMessage.mMeta.mMsgId, messageName());
ui->subLabel->setText(msgLink.toHtml());
if (wasExpanded() || ui->expandFrame->isVisible()) {
fillExpandFrame();
@ -324,8 +322,7 @@ void GxsForumMsgItem::fill()
} else {
// ui->parentAvatar->setId(msgParent.srcId, true);
RetroShareLink linkParent;
linkParent.createGxsMessageLink(RetroShareLink::TYPE_FORUM, mParentMessage.mMeta.mGroupId, mParentMessage.mMeta.mMsgId, QString::fromUtf8(mParentMessage.mMeta.mMsgName.c_str()));
RetroShareLink linkParent = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_FORUM, mParentMessage.mMeta.mGroupId, mParentMessage.mMeta.mMsgId, QString::fromUtf8(mParentMessage.mMeta.mMsgName.c_str()));
ui->parentSubLabel->setText(linkParent.toHtml());
ui->parentMsgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mParentMessage.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));

View File

@ -130,8 +130,7 @@ void PostedGroupItem::fill()
#endif
// No link type at this moment
RetroShareLink link;
link.createGxsGroupLink(RetroShareLink::TYPE_POSTED, mGroup.mMeta.mGroupId, groupName());
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_POSTED, mGroup.mMeta.mGroupId, groupName());
ui->nameLabel->setText(link.toHtml());
// ui->nameLabel->setText(groupName());

View File

@ -66,7 +66,7 @@
const uint32_t SFI_DEFAULT_PERIOD = (30 * 3600 * 24); /* 30 Days */
//const uint32_t SFI_DEFAULT_PERIOD = (30 * 3600 * 24); /* 30 Days */
/** Constructor */
SubFileItem::SubFileItem(const RsFileHash &hash, const std::string &name, const std::string &path, uint64_t size, uint32_t flags, const RsPeerId &srcId)
@ -727,8 +727,8 @@ void SubFileItem::copyLink()
return;
}
RetroShareLink link;
if (link.createFile(QString::fromUtf8(mFileName.c_str()), mFileSize, QString::fromStdString(mFileHash.toStdString()))) {
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(mFileName.c_str()), mFileSize, QString::fromStdString(mFileHash.toStdString()));
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);

View File

@ -81,8 +81,8 @@ void GxsFeedItem::copyMessageLink()
return;
}
RetroShareLink link;
if (link.createGxsMessageLink(getLinkType(), groupId(), mMessageId, messageName())) {
RetroShareLink link = RetroShareLink::createGxsMessageLink(getLinkType(), groupId(), mMessageId, messageName());
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
@ -158,8 +158,8 @@ void GxsFeedItem::requestComment()
std::vector<RsGxsGrpMsgIdPair> msgIds;
for(uint32_t i=0;i<mMessageVersions.size();++i)
msgIds.push_back(std::make_pair(groupId(),mMessageVersions[i]));
for(int i=0;i<mMessageVersions.size();++i)
msgIds.push_back(std::make_pair(groupId(),mMessageVersions[i])) ;
msgIds.push_back(std::make_pair(groupId(),messageId()));

View File

@ -652,6 +652,7 @@ uint32_t GxsGroupDialog::getGroupSignFlags()
{
case 0: break ;
case 2: signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN; // no break below, since we want *both* flags in this case.
/* fallthrough */
case 1: signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG;
break ;
}

View File

@ -155,8 +155,8 @@ void GxsGroupFeedItem::copyGroupLink()
return;
}
RetroShareLink link;
if (link.createGxsGroupLink(getLinkType(), mGroupId, groupName())) {
RetroShareLink link = RetroShareLink::createGxsGroupLink(getLinkType(), mGroupId, groupName());
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);

View File

@ -480,12 +480,12 @@ void GxsGroupFrameDialog::copyGroupLink()
return;
}
RetroShareLink link;
QString name;
if(!getCurrentGroupName(name)) return;
if (link.createGxsGroupLink(getLinkType(), mGroupId, name)) {
RetroShareLink link = RetroShareLink::createGxsGroupLink(getLinkType(), mGroupId, name);
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
@ -828,8 +828,8 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGroupMetaData> &gro
}
uint32_t i = 0;
uint32_t popLimit = 0;
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
//uint32_t popLimit = 0;
//for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); ++rit, ++i) ;
//if (rit != popMap.rend()) {
// popLimit = rit->first;

View File

@ -59,13 +59,13 @@
#define MAX_ATTEMPTS 10
#define MAX_PROCESS_COUNT_PER_TIMER 50
const int kRecognTagClass_DEVELOPMENT = 1;
const int kRecognTagType_Dev_Ambassador = 1;
const int kRecognTagType_Dev_Contributor = 2;
const int kRecognTagType_Dev_Translator = 3;
const int kRecognTagType_Dev_Patcher = 4;
const int kRecognTagType_Dev_Developer = 5;
//const int kRecognTagClass_DEVELOPMENT = 1;
//
//const int kRecognTagType_Dev_Ambassador = 1;
//const int kRecognTagType_Dev_Contributor = 2;
//const int kRecognTagType_Dev_Translator = 3;
//const int kRecognTagType_Dev_Patcher = 4;
//const int kRecognTagType_Dev_Developer = 5;
void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const

View File

@ -357,8 +357,8 @@ void CreateGxsChannelMsg::addAttachment(const RsFileHash &hash, const std::strin
uint32_t flags = SFI_TYPE_CHANNEL | SFI_FLAG_ALLOW_DELETE ;
if(assume_file_ready)
flags |= SFI_FLAG_ASSUME_FILE_READY;
if( assume_file_ready )
flags |= SFI_FLAG_ASSUME_FILE_READY ;
if (local)
flags |= SFI_STATE_LOCAL;

View File

@ -395,7 +395,7 @@ void GxsChannelPostsWidget::filterChanged(int filter)
return bVisible;
}
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool related)
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool related)
{
GxsChannelPostItem *item = NULL;
@ -407,12 +407,8 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re
if(item)
{
ui->feedWidget->removeFeedItem(item) ;
//RsGxsChannelGroup dummyGroup;
//dummyGroup.mMeta.mGroupId = groupId();
//dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
//GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, false,post.mOlderVersions);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
return ;
@ -428,14 +424,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re
item->setPost(post);
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
} else {
/* Group is not always available because of the TokenQueue */
//RsGxsChannelGroup dummyGroup;
//dummyGroup.mMeta.mGroupId = groupId();
//dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
//GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, false,post.mOlderVersions);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
}
@ -514,13 +503,15 @@ void GxsChannelPostsWidget::insertChannelPosts(std::vector<RsGxsChannelPost> &po
uint32_t current_index = new_versions[i] ;
uint32_t source_index = new_versions[i] ;
#ifdef DEBUG_CHANNEL
RsGxsMessageId source_msg_id = posts[source_index].mMeta.mMsgId ;
#endif
// What we do is everytime we find a replacement post, we climb up the replacement graph until we find the original post
// (or the most recent version of it). When we reach this post, we replace it with the data of the source post.
// In the mean time, all other posts have their MsgId cleared, so that the posts are removed from the list.
std::vector<uint32_t> versions ;
//std::vector<uint32_t> versions ;
std::map<RsGxsMessageId,uint32_t>::const_iterator vit ;
while(search_map.end() != (vit=search_map.find(posts[current_index].mMeta.mOrigMsgId)))
@ -532,7 +523,7 @@ void GxsChannelPostsWidget::insertChannelPosts(std::vector<RsGxsChannelPost> &po
// Now replace the post only if the new versionis more recent. It may happen indeed that the same post has been corrected multiple
// times. In this case, we only need to replace the post with the newest version
uint32_t prev_index = current_index ;
//uint32_t prev_index = current_index ;
current_index = vit->second ;
if(posts[current_index].mMeta.mMsgId.isNull()) // This handles the branching situation where this post has been already erased. No need to go down further.

View File

@ -498,9 +498,9 @@ void CreateGxsForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it;
RetroShareLink link;
if (link.createFile(hashedFile.filename, hashedFile.size,
QString::fromStdString(hashedFile.hash.toStdString()))) {
RetroShareLink link = RetroShareLink::createFile(hashedFile.filename, hashedFile.size,
QString::fromStdString(hashedFile.hash.toStdString()));
if (link.valid()) {
mesgString += link.toHtmlSize() + "<br>";
}
}

View File

@ -2018,12 +2018,13 @@ void GxsForumThreadWidget::copyMessageLink()
return;
}
RetroShareLink link;
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
QString thread_title = (item != NULL)?item->text(COLUMN_THREAD_TITLE):QString() ;
if (link.createGxsMessageLink(RetroShareLink::TYPE_FORUM, groupId(), mThreadId, thread_title)) {
RetroShareLink link = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_FORUM, groupId(), mThreadId, thread_title);
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
@ -2068,8 +2069,7 @@ void GxsForumThreadWidget::createthread()
static QString buildReplyHeader(const RsMsgMetaData &meta)
{
RetroShareLink link;
link.createMessage(meta.mAuthorId, "");
RetroShareLink link = RetroShareLink::createMessage(meta.mAuthorId, "");
QString from = link.toHtml();
QString header = QString("<span>-----%1-----").arg(QApplication::translate("GxsForumThreadWidget", "Original Message"));

View File

@ -283,7 +283,7 @@ void GxsForumsFillThread::run()
// Now make sure that message parents are consistent. Indeed, an old post may have the old version of a post as parent. So we need to change that parent
// to the newest version. So we create a map of which is the most recent version of each message, so that parent messages can be searched in it.
for(uint32_t i=1;i<(*it).size();++i)
for(int i=1;i<(*it).size();++i)
most_recent_versions[(*it)[i].second] = (*it)[0].second ;
}
mPostVersions = mTmp ;

View File

@ -521,8 +521,8 @@ static QString buildRecommendHtml(const std::set<RsPeerId> &sslIds, const RsPeer
if (*sslIt == excludeId) {
continue;
}
RetroShareLink link;
if (link.createCertificate(*sslIt)) {
RetroShareLink link = RetroShareLink::createCertificate(*sslIt);
if (link.valid()) {
text += link.toHtml() + "<br>";
}
}
@ -558,8 +558,7 @@ void MessageComposer::recommendFriend(const std::set <RsPeerId> &sslIds, const R
composer->addRecipient(TO, to);
}
RsPgpId ownPgpId = rsPeers->getGPGOwnId();
RetroShareLink link;
link.createPerson(ownPgpId);
RetroShareLink link = RetroShareLink::createPerson(ownPgpId);
QString sMsgText = msg.isEmpty() ? recommendMessage() : msg;
sMsgText += "<br><br>";
@ -595,8 +594,8 @@ void MessageComposer::sendConnectAttemptMsg(const RsPgpId &gpgId, const RsPeerId
return;
}
RetroShareLink link;
if (link.createUnknwonSslCertificate(sslId, gpgId) == false) {
RetroShareLink link = RetroShareLink::createUnknwonSslCertificate(sslId, gpgId);
if (link.valid() == false) {
return;
}
@ -1053,44 +1052,52 @@ MessageComposer *MessageComposer::newMsg(const std::string &msgId /* = ""*/)
QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
{
RetroShareLink link;
link.createMessage(msgInfo.rspeerid_srcId, "");
RetroShareLink link = RetroShareLink::createMessage(msgInfo.rspeerid_srcId, "");
QString from = link.toHtml();
QString to;
for ( std::set<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgto.begin(); it != msgInfo.rspeerid_msgto.end(); ++it)
if (link.createMessage(*it, ""))
{
link = RetroShareLink::createMessage(*it, "");
if (link.valid())
{
if (!to.isEmpty())
to += ", ";
to += link.toHtml();
}
}
for ( std::set<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgto.begin(); it != msgInfo.rsgxsid_msgto.end(); ++it)
if (link.createMessage(*it, ""))
{
link = RetroShareLink::createMessage(*it, "");
if (link.valid())
{
if (!to.isEmpty())
to += ", ";
to += link.toHtml();
}
}
QString cc;
for (std::set<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgcc.begin(); it != msgInfo.rspeerid_msgcc.end(); ++it)
if (link.createMessage(*it, "")) {
for (std::set<RsPeerId>::const_iterator it = msgInfo.rspeerid_msgcc.begin(); it != msgInfo.rspeerid_msgcc.end(); ++it) {
link = RetroShareLink::createMessage(*it, "");
if (link.valid()) {
if (!cc.isEmpty()) {
cc += ", ";
}
cc += link.toHtml();
}
for (std::set<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgcc.begin(); it != msgInfo.rsgxsid_msgcc.end(); ++it)
if (link.createMessage(*it, "")) {
}
for (std::set<RsGxsId>::const_iterator it = msgInfo.rsgxsid_msgcc.begin(); it != msgInfo.rsgxsid_msgcc.end(); ++it) {
link = RetroShareLink::createMessage(*it, "");
if (link.valid()) {
if (!cc.isEmpty()) {
cc += ", ";
}
cc += link.toHtml();
}
}
QString header = QString("<span>-----%1-----").arg(tr("Original Message"));
@ -2780,8 +2787,7 @@ void MessageComposer::sendInvite(const RsGxsId &to, const QString &/*msg*/, bool
RsPeerId ownId = rsPeers->getOwnId();
RetroShareLink link;
link.createCertificate(ownId);
RetroShareLink link = RetroShareLink::createCertificate(ownId);
QString sMsgText = inviteMessage();
sMsgText += "<br><br>";

View File

@ -515,8 +515,16 @@ void MessageWidget::fill(const std::string &msgId)
RetroShareLink link;
QString text;
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgto.begin(); pit != msgInfo.rspeerid_msgto.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
for(std::set<RsGxsId >::const_iterator pit = msgInfo.rsgxsid_msgto.begin(); pit != msgInfo.rsgxsid_msgto.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgto.begin(); pit != msgInfo.rspeerid_msgto.end(); ++pit) {
link = RetroShareLink::createMessage(*pit, "");
if (link.valid())
text += link.toHtml() + " ";
}
for(std::set<RsGxsId >::const_iterator pit = msgInfo.rsgxsid_msgto.begin(); pit != msgInfo.rsgxsid_msgto.end(); ++pit) {
link = RetroShareLink::createMessage(*pit, "");
if (link.valid())
text += link.toHtml() + " ";
}
ui.toText->setText(text);
@ -526,8 +534,16 @@ void MessageWidget::fill(const std::string &msgId)
ui.ccText->setVisible(true);
text.clear();
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgcc.begin(); pit != msgInfo.rspeerid_msgcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgcc.begin(); pit != msgInfo.rsgxsid_msgcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgcc.begin(); pit != msgInfo.rspeerid_msgcc.end(); ++pit) {
link = RetroShareLink::createMessage(*pit, "");
if (link.valid())
text += link.toHtml() + " ";
}
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgcc.begin(); pit != msgInfo.rsgxsid_msgcc.end(); ++pit) {
link = RetroShareLink::createMessage(*pit, "");
if (link.valid())
text += link.toHtml() + " ";
}
ui.ccText->setText(text);
} else {
@ -542,8 +558,16 @@ void MessageWidget::fill(const std::string &msgId)
ui.bccText->setVisible(true);
text.clear();
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgbcc.begin(); pit != msgInfo.rspeerid_msgbcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgbcc.begin(); pit != msgInfo.rsgxsid_msgbcc.end(); ++pit) if (link.createMessage(*pit, "")) text += link.toHtml() + " ";
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgbcc.begin(); pit != msgInfo.rspeerid_msgbcc.end(); ++pit) {
link = RetroShareLink::createMessage(*pit, "");
if (link.valid())
text += link.toHtml() + " ";
}
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgbcc.begin(); pit != msgInfo.rsgxsid_msgbcc.end(); ++pit) {
link = RetroShareLink::createMessage(*pit, "");
if (link.valid())
text += link.toHtml() + " ";
}
ui.bccText->setText(text);
} else {

View File

@ -102,10 +102,10 @@ CryptoPage::load()
void
CryptoPage::copyRSLink()
{
RetroShareLink link ;
RsPeerId ownId = rsPeers->getOwnId() ;
RetroShareLink link = RetroShareLink::createCertificate(ownId);
if( link.createCertificate(ownId) )
if( link.valid() )
{
QList<RetroShareLink> urls ;

View File

@ -80,7 +80,7 @@ void BWGraphSource::update()
{
std::list<std::pair<qint64,float> >& lst(_points[it->first]) ;
if(!lst.empty() && fabsf(lst.back().first - ms) > _update_period_msecs*1.2 )
if(!lst.empty() && fabsf((float)(lst.back().first - ms)) > _update_period_msecs*1.2 )
{
lst.push_back(std::make_pair(lst.back().first,0)) ;
lst.push_back(std::make_pair( ms,0)) ;
@ -243,6 +243,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list<RSTrafficClue>& l
break ;
case GRAPH_TYPE_ALL: std::cerr << "(WW) Impossible situation. Cannot draw graph in mode All/All. Reverting to sum." << std::endl;
/* fallthrough */
case GRAPH_TYPE_SUM: // all friends, sum of services => one curve per friend
{
RSTrafficClue total ;

View File

@ -55,7 +55,7 @@
#define COL_DUPLICATION_FACTOR 9
static const int PARTIAL_VIEW_SIZE = 9 ;
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
//static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
static QColor colorScale(float f)
{

View File

@ -20,18 +20,20 @@
****************************************************************/
#include <iostream>
#include <QTimer>
#include <QObject>
#include <QFontMetrics>
#include <QWheelEvent>
#include <QDateTime>
#include <time.h>
#include <QDateTime>
#include <QFontMetrics>
#include <QHeaderView>
#include <QLayout>
#include <QMenu>
#include <QObject>
#include <QPainter>
#include <QStylePainter>
#include <QLayout>
#include <QHeaderView>
#include <QTimer>
#include <QTreeWidget>
#include <QWheelEvent>
#include <retroshare/rsgxstrans.h>
#include <retroshare/rspeers.h>
@ -62,9 +64,9 @@
#define COL_GROUP_POPULARITY 4
#define COL_GROUP_UNIQUE_ID 5
static const int PARTIAL_VIEW_SIZE = 9 ;
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
static const int GXSTRANS_STATISTICS_DELAY_BETWEEN_GROUP_REQ = 30 ; // never request more than every 30 secs.
//static const int PARTIAL_VIEW_SIZE = 9 ;
//static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
//static const int GXSTRANS_STATISTICS_DELAY_BETWEEN_GROUP_REQ = 30 ; // never request more than every 30 secs.
#define GXSTRANS_GROUP_META 0x01
#define GXSTRANS_GROUP_DATA 0x02
@ -200,7 +202,7 @@ void GxsTransportStatistics::updateContent()
// clear
treeWidget->clear();
time_t now = time(NULL) ;
//time_t now = time(NULL) ;
// 1 - fill the table for pending packets
@ -239,9 +241,9 @@ void GxsTransportStatistics::updateContent()
std::set<RsGxsGroupId> openned_groups ;
for(uint32_t i=0;i<groupTreeWidget->topLevelItemCount();++i)
if(groupTreeWidget->isItemExpanded(groupTreeWidget->topLevelItem(i)))
openned_groups.insert(RsGxsGroupId(groupTreeWidget->topLevelItem(i)->data(COL_GROUP_GRP_ID,Qt::DisplayRole).toString().toStdString())) ;
for(int i=0; i<groupTreeWidget->topLevelItemCount(); ++i)
if( groupTreeWidget->isItemExpanded(groupTreeWidget->topLevelItem(i)) )
openned_groups.insert(RsGxsGroupId(groupTreeWidget->topLevelItem(i)->data(COL_GROUP_GRP_ID, Qt::DisplayRole).toString().toStdString()));
groupTreeWidget->clear();

View File

@ -33,7 +33,7 @@
#include "gui/settings/rsharesettings.h"
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
//static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
class TRHistogram
{

View File

@ -46,7 +46,7 @@ public:
QColor getOpMode_Minimal_Color() const;
void setOpMode_Minimal_Color( QColor c );
private slots:
public slots:
void setOpMode();
private:

View File

@ -189,6 +189,17 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
Q_INIT_RESOURCE(images);
Q_INIT_RESOURCE(icons);
// Loop through all command-line args/values to get help wanted before RsInit exit.
for (int i = 0; i < args.size(); ++i) {
QString arg;
/* Get the argument name and set a blank value */
arg = args.at(i);
if ((arg.toLower() == "-h") || (arg.toLower() == "--help")) {
QApplication dummyApp (argc, argv); // needed for QMessageBox
Rshare::showUsageMessageBox();
}
}
// This is needed to allocate rsNotify, so that it can be used to ask for PGP passphrase
//
RsControl::earlyInitNotificationSystem() ;

Some files were not shown because too many files have changed in this diff Show More