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 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 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 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 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) 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) if(list == NOTIFY_LIST_CHAT_LOBBY_INVITATION)
{ {
@ -968,7 +968,7 @@ void ChatHandler::handleInviteToLobby(Request& req, Response& resp)
resp.setOk(); resp.setOk();
} }
void ChatHandler::handleGetInvitationsToLobby(Request& req, Response& resp) void ChatHandler::handleGetInvitationsToLobby(Request& /*req*/, Response& resp)
{ {
std::list<ChatLobbyInvite> invites; std::list<ChatLobbyInvite> invites;
mRsMsgs->getPendingChatLobbyInvites(invites); mRsMsgs->getPendingChatLobbyInvites(invites);
@ -1243,7 +1243,7 @@ void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)
if(count && (mit2 != mChatInfo.end())) if(count && (mit2 != mChatInfo.end()))
{ {
resp.mDataStream.getStreamToMember() 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 languages like Qml @see chat_id instead
<< makeKeyValue("id", mit->first.toStdString()) << makeKeyValue("id", mit->first.toStdString())
<< makeKeyValue("chat_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 & bool pgp_linked = (grp.mMeta.mGroupFlags &
RSGXSID_GROUPFLAG_REALID_kept_for_compatibility); RSGXSID_GROUPFLAG_REALID_kept_for_compatibility);
resp.mDataStream.getStreamToMember() 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 languages like Qml @see gxs_id instead
<< makeKeyValueReference("id", grp.mMeta.mGroupId) << makeKeyValueReference("id", grp.mMeta.mGroupId)
<< makeKeyValueReference("gxs_id", grp.mMeta.mGroupId) << makeKeyValueReference("gxs_id", grp.mMeta.mGroupId)
@ -718,8 +718,8 @@ void IdentityHandler::handleImportKey(Request& req, Response& resp)
resp.setFail(); resp.setFail();
} }
ResponseTask* IdentityHandler::handleDeleteIdentity(Request& req, ResponseTask* IdentityHandler::handleDeleteIdentity(Request& /*req*/,
Response& resp) Response& /*resp*/)
{ return new DeleteIdentityTask(mRsIdentity); } { return new DeleteIdentityTask(mRsIdentity); }
} // namespace resource_api } // 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; RsPeerDetails detail;
if (!mRsPeers->getPeerDetails(mRsPeers->getOwnId(), detail)) if (!mRsPeers->getPeerDetails(mRsPeers->getOwnId(), detail))

View File

@ -50,11 +50,24 @@
//#define DEBUG_DISTANT_CHAT //#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 ; #include <sys/time.h>
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 ; 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 ; static const uint32_t DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID = 0xa0001 ;
@ -86,7 +99,7 @@ bool DistantChatService::handleOutgoingItem(RsChatItem *item)
} }
#ifdef CHAT_DEBUG #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 #endif
uint32_t size = RsChatSerialiser().size(item) ; uint32_t size = RsChatSerialiser().size(item) ;
@ -98,7 +111,9 @@ bool DistantChatService::handleOutgoingItem(RsChatItem *item)
return false; return false;
} }
#ifdef DEBUG_DISTANT_CHAT #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 #endif
mGxsTunnels->sendData( RsGxsTunnelId(item->PeerId()),DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID,mem,size); 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) if(cs->flags & RS_CHAT_FLAG_CONNEXION_REFUSED)
{ {
#ifdef DEBUG_DISTANT_CHAT #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 #endif
RsServer::notify()->notifyChatStatus(ChatId(DistantChatPeerId(cs->PeerId())),"Connexion refused by distant peer!") ; 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) if(!res)
{ {
#ifdef DEBUG_DISTANT_CHAT #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 #endif
RsChatStatusItem *item = new RsChatStatusItem ; RsChatStatusItem *item = new RsChatStatusItem ;
item->flags = RS_CHAT_FLAG_CONNEXION_REFUSED ; item->flags = RS_CHAT_FLAG_CONNEXION_REFUSED ;
@ -158,7 +173,11 @@ bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTun
return false; 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); 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) void DistantChatService::notifyTunnelStatus(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, uint32_t tunnel_status)
{ {
#ifdef DEBUG_DISTANT_CHAT #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 #endif
switch(tunnel_status) 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) void DistantChatService::receiveData(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, unsigned char *data, uint32_t data_size)
{ {
#ifdef DEBUG_DISTANT_CHAT #ifdef DEBUG_DISTANT_CHAT
std::cerr << "DistantChatService::receiveData(): got data of size " << data_size << " for tunnel " << tunnel_id << std::endl; DISTANT_CHAT_DEBUG() << "DistantChatService::receiveData(): got data of size " << std::dec << data_size << " for tunnel " << tunnel_id << std::endl;
std::cerr << " received: " << RsUtil::BinToHex(data,data_size) << std::endl; DISTANT_CHAT_DEBUG() << " received: " << RsUtil::BinToHex(data,data_size,100) << std::endl;
std::cerr << " deserialising..." << std::endl; DISTANT_CHAT_DEBUG() << " hash: " << RsDirUtil::sha1sum(data,data_size) << std::endl;
DISTANT_CHAT_DEBUG() << " deserialising..." << std::endl;
#endif #endif
// always make the contact up to date. This is useful for server side, which doesn't know about the chat until it // 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 ; mDistantChatPermissions = flags ;
#ifdef DEBUG_DISTANT_CHAT #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 #endif
triggerConfigSave() ; triggerConfigSave() ;
} }
@ -354,7 +374,7 @@ bool DistantChatService::processLoadListItem(const RsItem *item)
if(kit->key == "DISTANT_CHAT_PERMISSION_FLAGS") if(kit->key == "DISTANT_CHAT_PERMISSION_FLAGS")
{ {
#ifdef DEBUG_DISTANT_CHAT #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 #endif
if (!kit->value.empty()) 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 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_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. 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 ) #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 ; 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) while(msg->message.size() > MAX_STRING_SIZE)
{ {
// chop off the first 15000 wchars // 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) ; 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. // Indicate that the message is to be continued.
// //
item->chatFlags |= RS_CHAT_FLAG_PARTIAL_MESSAGE ; item->chatFlags |= RS_CHAT_FLAG_PARTIAL_MESSAGE ;
sendChatItem(item) ; sendChatItem(item) ;
} }
#ifdef CHAT_DEBUG
std::cerr << "Creating slice of size " << msg->message.size() << std::endl;
#endif
sendChatItem(msg) ; sendChatItem(msg) ;
} }
@ -386,7 +396,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
if(it->second->_own_is_new) if(it->second->_own_is_new)
{ {
#ifdef CHAT_DEBUG #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 #endif
ci->chatFlags |= RS_CHAT_FLAG_AVATAR_AVAILABLE ; ci->chatFlags |= RS_CHAT_FLAG_AVATAR_AVAILABLE ;
@ -395,7 +405,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
} }
#ifdef CHAT_DEBUG #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 << "p3ChatService::sendChat() Item:";
std::cerr << std::endl; std::cerr << std::endl;
ci->print(std::cerr); ci->print(std::cerr);
@ -435,7 +445,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
if(should_send_state_string) if(should_send_state_string)
{ {
#ifdef CHAT_DEBUG #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 #endif
RsChatStatusItem *cs = makeOwnCustomStateStringItem() ; RsChatStatusItem *cs = makeOwnCustomStateStringItem() ;
cs->PeerId(vpid) ; cs->PeerId(vpid) ;
@ -493,7 +503,7 @@ bool p3ChatService::locked_checkAndRebuildPartialMessage(RsChatMsgItem *& ci)
else else
{ {
#ifdef CHAT_DEBUG #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 #endif
return true ; return true ;
} }

View File

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

View File

@ -35,7 +35,7 @@
//#define CHAT_DEBUG 1 //#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 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") ; fprintf(stdout,"result: q=") ; uint256_32::print(q1) ; fprintf(stdout," r=") ; uint256_32::print(r1) ; fprintf(stdout,"\n") ;
#endif #endif
uint256_32 res(q1) ; //uint256_32 res(q1) ;
q1 *= p1 ; q1 *= p1 ;
q1 += r1 ; q1 += r1 ;

View File

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

View File

@ -188,6 +188,7 @@ void ChunkMap::updateTotalDownloaded()
switch(_map[i]) switch(_map[i])
{ {
case FileChunksInfo::CHUNK_CHECKING: _file_is_complete = false ; case FileChunksInfo::CHUNK_CHECKING: _file_is_complete = false ;
/* fallthrough */
case FileChunksInfo::CHUNK_DONE: _total_downloaded += sizeOfChunk(i) ; case FileChunksInfo::CHUNK_DONE: _total_downloaded += sizeOfChunk(i) ;
break ; break ;
default: 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 ) for( std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit )
{ {
bool bAllowDirectDL = false; bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) { switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break; case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); 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(); ) for(std::list<RsPeerId>::iterator it = srcIds.begin(); it != srcIds.end(); )
{ {
bool bAllowDirectDL = false; bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) { switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break; case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); 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) for(it = srcIds.begin(); it != srcIds.end(); ++it)
{ {
bool bAllowDirectDL = false; bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) { switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break; case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); 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. // Because this is auto-add, we only add sources that we allow to DL from using direct transfers.
bool bAllowDirectDL = false; bool bAllowDirectDL = false;
switch (rsFiles->filePermDirectDL()) { switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break; case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break; default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break;

View File

@ -31,7 +31,7 @@
#include "crypto/chacha20.h" #include "crypto/chacha20.h"
#include "retroshare/rstypes.h" #include "retroshare/rstypes.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
const int ftserverzone = 29539; //const int ftserverzone = 29539;
#include "file_sharing/p3filelists.h" #include "file_sharing/p3filelists.h"
#include "ft/ftturtlefiletransferitem.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_MINIMUM_CHUNK = 1024; /* ie 1Kb / sec */
const uint32_t FT_TM_RESTART_DOWNLOAD = 20; /* 20 seconds */ 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_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_MAX_INCREASE = 1.00;
// const double FT_TM_MIN_INCREASE = -0.10; // 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_AVERAGE = 0.3 ;
const double FT_TM_RATE_INCREASE_FASTER = 1.0 ; const double FT_TM_RATE_INCREASE_FASTER = 1.0 ;
const int32_t FT_TM_FAST_RTT = 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_STD_RTT = 5.0;
const int32_t FT_TM_SLOW_RTT = 20.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_NOCHECK = 0 ;
const uint32_t FT_TM_CRC_MAP_STATE_DONT_HAVE = 1 ; //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_HAVE = 2 ;
#define FT_TM_FLAG_DOWNLOADING 0 #define FT_TM_FLAG_DOWNLOADING 0
#define FT_TM_FLAG_CANCELED 1 #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::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() 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 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). // 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 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 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. 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 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 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_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 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 #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; 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) ; std::map<RsGxsGroupId,RsGxsServerMsgUpdate>::iterator it = mServerMsgUpdateMap.find(grpId) ;
#endif
RsGxsServerMsgUpdate& item(mServerMsgUpdateMap[grpId]) ; RsGxsServerMsgUpdate& item(mServerMsgUpdateMap[grpId]) ;
@ -2431,7 +2433,9 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
RsPeerId peerFrom = tr->mTransaction->PeerId(); RsPeerId peerFrom = tr->mTransaction->PeerId();
uint32_t updateTS = tr->mTransaction->updateTS; uint32_t updateTS = tr->mTransaction->updateTS;
#ifdef NXS_NET_DEBUG_0
ClientGrpMap::iterator it = mClientGrpUpdateMap.find(peerFrom); ClientGrpMap::iterator it = mClientGrpUpdateMap.find(peerFrom);
#endif
RsGxsGrpUpdate& item(mClientGrpUpdateMap[peerFrom]) ; RsGxsGrpUpdate& item(mClientGrpUpdateMap[peerFrom]) ;

View File

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

View File

@ -28,7 +28,7 @@
#include "util/rsthreads.h" #include "util/rsthreads.h"
#include "retroshare/rsgxstrans.h" #include "retroshare/rsgxstrans.h"
struct p3GxsTrans; class p3GxsTrans;
/// Services who want to make use of p3GxsTrans should inherit this struct /// Services who want to make use of p3GxsTrans should inherit this struct
struct GxsTransClient 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_HMAC_SIZE = SHA_DIGEST_LENGTH ;
static const uint32_t GXS_TUNNEL_ENCRYPTION_IV_SIZE = 8 ; static const uint32_t GXS_TUNNEL_ENCRYPTION_IV_SIZE = 8 ;
#ifdef DEBUG_GXS_TUNNEL
static const uint32_t INTERVAL_BETWEEN_DEBUG_DUMP = 10 ; static const uint32_t INTERVAL_BETWEEN_DEBUG_DUMP = 10 ;
#endif
static std::string GXS_TUNNEL_APP_NAME = "GxsTunnels" ; static std::string GXS_TUNNEL_APP_NAME = "GxsTunnels" ;
@ -74,6 +76,7 @@ p3GxsTunnelService::p3GxsTunnelService(RsGixs *pids)
: mGixs(pids), mGxsTunnelMtx("GXS tunnel") : mGixs(pids), mGxsTunnelMtx("GXS tunnel")
{ {
mTurtle = NULL ; mTurtle = NULL ;
mCurrentPacketCounter = 0 ;
} }
void p3GxsTunnelService::connectToTurtleRouter(p3turtle *tr) void p3GxsTunnelService::connectToTurtleRouter(p3turtle *tr)
@ -104,6 +107,7 @@ int p3GxsTunnelService::tick()
#ifdef DEBUG_GXS_TUNNEL #ifdef DEBUG_GXS_TUNNEL
time_t now = time(NULL); time_t now = time(NULL);
static time_t last_dump = 0;
if(now > last_dump + INTERVAL_BETWEEN_DEBUG_DUMP ) if(now > last_dump + INTERVAL_BETWEEN_DEBUG_DUMP )
{ {
@ -288,7 +292,7 @@ void p3GxsTunnelService::handleIncomingItem(const RsGxsTunnelId& tunnel_id,RsGxs
case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA: handleRecvTunnelDataItem(tunnel_id,dynamic_cast<RsGxsTunnelDataItem*>(item)) ; case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA: handleRecvTunnelDataItem(tunnel_id,dynamic_cast<RsGxsTunnelDataItem*>(item)) ;
break ; break ;
case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK: handleRecvTunnelDataAckItem(tunnel_id,dynamic_cast<RsGxsTunnelDataAckItem*>(item)) ; case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK: handleRecvTunnelDataAckItem(tunnel_id,dynamic_cast<RsGxsTunnelDataAckItem*>(item)) ;
break ; break ;
case RS_PKT_SUBTYPE_GXS_TUNNEL_STATUS: handleRecvStatusItem(tunnel_id,dynamic_cast<RsGxsTunnelStatusItem*>(item)) ; case RS_PKT_SUBTYPE_GXS_TUNNEL_STATUS: handleRecvStatusItem(tunnel_id,dynamic_cast<RsGxsTunnelStatusItem*>(item)) ;
@ -752,7 +756,7 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
std::cerr << " size = " << data_size << std::endl; std::cerr << " size = " << data_size << std::endl;
std::cerr << " data = " << (void*)data_bytes << 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 << " 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; std::cerr << std::endl;
#endif #endif
@ -793,9 +797,9 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
#ifdef DEBUG_GXS_TUNNEL #ifdef DEBUG_GXS_TUNNEL
std::cerr << " Using IV: " << std::hex << *(uint64_t*)data_bytes << std::dec << std::endl; 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 << " Decrypted buffer size: " << decrypted_size << std::endl;
std::cerr << " key : " << RsUtil::BinToHex((char*)aes_key,GXS_TUNNEL_AES_KEY_SIZE) << std::endl; std::cerr << " key : " << RsUtil::BinToHex((unsigned 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 << " hmac : " << RsUtil::BinToHex((unsigned 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 << " data : " << RsUtil::BinToHex((unsigned char*)data_bytes,data_size,100) << std::endl;
#endif #endif
// first, check the HMAC // first, check the HMAC
@ -1211,7 +1215,7 @@ bool p3GxsTunnelService::locked_sendClearTunnelData(RsGxsTunnelDHPublicKeyItem *
#ifdef DEBUG_GXS_TUNNEL #ifdef DEBUG_GXS_TUNNEL
std::cerr << " GxsTunnelService::sendClearTunnelData(): Sending clear data to virtual peer: " << item->PeerId() << std::endl; 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 << " 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; std::cerr << std::endl;
#endif #endif
mTurtle->sendTurtleData(item->PeerId(),gitem) ; mTurtle->sendTurtleData(item->PeerId(),gitem) ;
@ -1307,7 +1311,7 @@ bool p3GxsTunnelService::locked_sendEncryptedTunnelData(RsGxsTunnelItem *item)
#ifdef DEBUG_GXS_TUNNEL #ifdef DEBUG_GXS_TUNNEL
std::cerr << "GxsTunnelService::sendEncryptedTunnelData(): Sending encrypted data to virtual peer: " << virtual_peer_id << std::endl; 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 << " 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; std::cerr << std::endl;
#endif #endif
@ -1346,6 +1350,16 @@ bool p3GxsTunnelService::requestSecuredTunnel(const RsGxsId& to_gxs_id, const Rs
return true ; 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) 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. // 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 ; 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->flags = 0; // not used yet.
item->service_id = service_id; item->service_id = service_id;
item->data_size = size; // encrypted data size item->data_size = size; // encrypted data size

View File

@ -230,7 +230,8 @@ private:
void handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item) ; void handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item) ;
bool locked_sendDHPublicKey(const DH *dh, const RsGxsId& own_gxs_id, const RsPeerId& virtual_peer_id) ; bool locked_sendDHPublicKey(const DH *dh, const RsGxsId& own_gxs_id, const RsPeerId& virtual_peer_id) ;
bool locked_initDHSessionKey(DH *&dh); bool locked_initDHSessionKey(DH *&dh);
uint64_t locked_getPacketCounter();
TurtleVirtualPeerId virtualPeerIdFromHash(const TurtleFileHash& hash) ; // ... and to a hash for p3turtle TurtleVirtualPeerId virtualPeerIdFromHash(const TurtleFileHash& hash) ; // ... and to a hash for p3turtle
// item handling // item handling
@ -252,6 +253,8 @@ private:
RsGixs *mGixs ; RsGixs *mGixs ;
RsMutex mGxsTunnelMtx ; RsMutex mGxsTunnelMtx ;
uint64_t mCurrentPacketCounter ;
std::map<uint32_t,RsGxsTunnelClientService*> mRegisteredServices ; std::map<uint32_t,RsGxsTunnelClientService*> mRegisteredServices ;
void debug_dump(); 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) switch(content_->tag)
{ {
case OPS_PARSER_CMD_GET_SK_PASSPHRASE_PREV_WAS_BAD: prev_was_bad = true ; case OPS_PARSER_CMD_GET_SK_PASSPHRASE_PREV_WAS_BAD: prev_was_bad = true ;
/* fallthrough */
case OPS_PARSER_CMD_GET_SK_PASSPHRASE: case OPS_PARSER_CMD_GET_SK_PASSPHRASE:
{ {
std::string passwd; std::string passwd;

View File

@ -48,7 +48,7 @@
//#define DEBUG_AUTHGPG 1 //#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 ; 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 * Aimed at rs services that uses RsItem config data, provide a way for RS
* services to save and load particular configurations as items. * services to save and load particular configurations as items.
*/ */
struct p3Config : pqiConfig class p3Config : public pqiConfig
{ {
public:
p3Config(); p3Config();
virtual bool loadConfiguration(RsFileHash &loadHash); virtual bool loadConfiguration(RsFileHash &loadHash);

View File

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

View File

@ -129,7 +129,7 @@ virtual bool notifyPeer(const RsPeerId& id);
/* extract current peer status */ /* extract current peer status */
virtual bool getPeerStatus(const RsPeerId& id, 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); uint32_t &type, uint32_t &mode);
/* stun */ /* stun */

View File

@ -75,7 +75,7 @@ static struct RsLog::logInfo p3connectzoneInfo = {RsLog::Default, "p3connect"};
//#define P3CONNMGR_NO_TCP_CONNECTIONS 1 //#define P3CONNMGR_NO_TCP_CONNECTIONS 1
const uint32_t P3CONNMGR_TCP_DEFAULT_DELAY = 3; /* 2 Seconds? is it be enough! */ 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_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. 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_EXT_SETUP = 0x0004;
const uint32_t RS_NET_DONE = 0x0005; const uint32_t RS_NET_DONE = 0x0005;
const uint32_t RS_NET_LOOPBACK = 0x0006; const uint32_t RS_NET_LOOPBACK = 0x0006;
const uint32_t RS_NET_DOWN = 0x0007; //const uint32_t RS_NET_DOWN = 0x0007;
/* Stun modes (TODO) */ /* Stun modes (TODO) */
const uint32_t RS_STUN_DHT = 0x0001; //const uint32_t RS_STUN_DHT = 0x0001;
const uint32_t RS_STUN_DONE = 0x0002; //const uint32_t RS_STUN_DONE = 0x0002;
const uint32_t RS_STUN_LIST_MIN = 100; //const uint32_t RS_STUN_LIST_MIN = 100;
const uint32_t RS_STUN_FOUND_MIN = 10; //const uint32_t RS_STUN_FOUND_MIN = 10;
const uint32_t MAX_UPNP_INIT = 60; /* seconds UPnP timeout */ 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_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 * #define NETMGR_DEBUG 1

View File

@ -50,18 +50,19 @@
/* Network setup States */ /* Network setup States */
const uint32_t RS_NET_NEEDS_RESET = 0x0000; //Defined and used in /libretroshare/src/pqi/p3netmgr.cc
const uint32_t RS_NET_UNKNOWN = 0x0001; //const uint32_t RS_NET_NEEDS_RESET = 0x0000;
const uint32_t RS_NET_UPNP_INIT = 0x0002; //const uint32_t RS_NET_UNKNOWN = 0x0001;
const uint32_t RS_NET_UPNP_SETUP = 0x0003; //const uint32_t RS_NET_UPNP_INIT = 0x0002;
const uint32_t RS_NET_EXT_SETUP = 0x0004; //const uint32_t RS_NET_UPNP_SETUP = 0x0003;
const uint32_t RS_NET_DONE = 0x0005; //const uint32_t RS_NET_EXT_SETUP = 0x0004;
const uint32_t RS_NET_LOOPBACK = 0x0006; //const uint32_t RS_NET_DONE = 0x0005;
const uint32_t RS_NET_DOWN = 0x0007; //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"}; static struct RsLog::logInfo p3peermgrzoneInfo = {RsLog::Default, "p3peermgr"};
#define p3peermgrzone &p3peermgrzoneInfo #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) 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) if (assign)
{ {

View File

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

View File

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

View File

@ -452,7 +452,7 @@ int pqissl::ConnectAttempt()
rslog(RSL_DEBUG_BASIC, pqisslzone, rslog(RSL_DEBUG_BASIC, pqisslzone,
"pqissl::ConnectAttempt() STATE = Not Waiting, starting connection"); "pqissl::ConnectAttempt() STATE = Not Waiting, starting connection");
#endif #endif
/* fallthrough */
case WAITING_DELAY: case WAITING_DELAY:
#ifdef PQISSL_LOG_DEBUG #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 << " - mPeerMgr->isHiddenPeer(id): " << mPeerMgr->isHiddenPeer(id) << std::endl;
std::cerr << " - hidden types: peer=" << typePeer << " own=" << typeOwn << std::endl; std::cerr << " - hidden types: peer=" << typePeer << " own=" << typeOwn << std::endl;
std::cerr << " --> falling back to Tor" << std::endl; std::cerr << " --> falling back to Tor" << std::endl;
/* fallthrough */
case RS_HIDDEN_TYPE_TOR: case RS_HIDDEN_TYPE_TOR:
pqip -> addChildInterface(PQI_CONNECT_HIDDEN_TOR_TCP, pqicSOCKSProxy); pqip -> addChildInterface(PQI_CONNECT_HIDDEN_TOR_TCP, pqicSOCKSProxy);
break; break;

View File

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

View File

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

View File

@ -30,7 +30,7 @@
#include "util/rsdir.h" #include "util/rsdir.h"
#include "util/rsdebug.h" #include "util/rsdebug.h"
const int p3facemsgzone = 11453; //const int p3facemsgzone = 11453;
#include <sys/time.h> #include <sys/time.h>
#include <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_EXT_IP = "--EXT--";
const std::string CERT_DYNDNS = "--DYNDNS--"; 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" #include "pqi/authssl.h"

View File

@ -294,6 +294,7 @@ uint32_t p3ServerConfig::getUserLevel()
userLevel = RSCONFIG_USER_LEVEL_BASIC; userLevel = RSCONFIG_USER_LEVEL_BASIC;
} }
} }
/* fallthrough */
case RSCONFIG_USER_LEVEL_BASIC: case RSCONFIG_USER_LEVEL_BASIC:
{ {
/* check that we have some lastConnect > 0 */ /* check that we have some lastConnect > 0 */
@ -302,7 +303,7 @@ uint32_t p3ServerConfig::getUserLevel()
userLevel = RSCONFIG_USER_LEVEL_CASUAL; userLevel = RSCONFIG_USER_LEVEL_CASUAL;
} }
} }
/* fallthrough */
case RSCONFIG_USER_LEVEL_CASUAL: case RSCONFIG_USER_LEVEL_CASUAL:
case RSCONFIG_USER_LEVEL_POWER: case RSCONFIG_USER_LEVEL_POWER:
@ -379,7 +380,7 @@ uint32_t p3ServerConfig::getOperatingMode()
{ {
mode = RS_OPMODE_GAMING; mode = RS_OPMODE_GAMING;
} }
else if (modestr == "MINIMAL_TRANSFER") else if (modestr == "MINIMAL")
{ {
mode = RS_OPMODE_MINIMAL; mode = RS_OPMODE_MINIMAL;
} }
@ -409,7 +410,7 @@ bool p3ServerConfig::setOperatingMode(uint32_t opMode)
break; break;
case RS_OPMODE_MINIMAL: case RS_OPMODE_MINIMAL:
modestr = "MINIMAL_TRANSFER"; modestr = "MINIMAL";
break; break;
} }
mGeneralConfig->setSetting(RS_CONFIG_OPERATING_STRING, modestr); mGeneralConfig->setSetting(RS_CONFIG_OPERATING_STRING, modestr);
@ -422,6 +423,31 @@ bool p3ServerConfig::setOperatingMode(uint32_t opMode)
return switchToOperatingMode(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) bool p3ServerConfig::switchToOperatingMode(uint32_t opMode)
{ {

View File

@ -91,6 +91,7 @@ virtual bool setConfigurationOption(uint32_t key, const std::string &opt);
/* Operating Mode */ /* Operating Mode */
virtual uint32_t getOperatingMode(); virtual uint32_t getOperatingMode();
virtual bool setOperatingMode(uint32_t opMode); virtual bool setOperatingMode(uint32_t opMode);
virtual bool setOperatingMode(const std::string &opModeStr);
virtual int SetMaxDataRates( int downKb, int upKb ); virtual int SetMaxDataRates( int downKb, int upKb );
virtual int GetMaxDataRates( 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; std::cerr << "RsAccountsDetail::selectAccountByString(" << prefUserString << ")" << std::endl;
bool pgpNameFound = false; //bool pgpNameFound = false;
std::map<RsPeerId, AccountDetails>::const_iterator it; std::map<RsPeerId, AccountDetails>::const_iterator it;
for(it = mAccounts.begin() ; it!= mAccounts.end() ; ++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) if(prefUserString == it->second.mPgpName || pgp_id == it->second.mPgpId || ssl_id == it->second.mSslId)
{ {
mPreferredId = it->second.mSslId; mPreferredId = it->second.mSslId;
pgpNameFound = true; //pgpNameFound = true;
std::cerr << "Account selected: " << ssl_id << std::endl; std::cerr << "Account selected: " << ssl_id << std::endl;

View File

@ -138,11 +138,12 @@ class RsInitConfig
std::string load_trustedpeer_file; std::string load_trustedpeer_file;
bool udpListenerOnly; bool udpListenerOnly;
std::string opModeStr;
}; };
static RsInitConfig *rsInitConfig = NULL; static RsInitConfig *rsInitConfig = NULL;
const int p3facestartupzone = 47238; //const int p3facestartupzone = 47238;
// initial configuration bootstrapping... // initial configuration bootstrapping...
//static const std::string configInitFile = "default_cert.txt"; //static const std::string configInitFile = "default_cert.txt";
@ -189,6 +190,7 @@ void RsInit::InitRsConfig()
rsInitConfig->passwd = ""; rsInitConfig->passwd = "";
rsInitConfig->debugLevel = PQL_WARNING; rsInitConfig->debugLevel = PQL_WARNING;
rsInitConfig->udpListenerOnly = false; rsInitConfig->udpListenerOnly = false;
rsInitConfig->opModeStr = std::string("FULL");
/* setup the homePath (default save location) */ /* setup the homePath (default save location) */
// rsInitConfig->homePath = getHomePath(); // 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('l',"log-file" ,rsInitConfig->logfname ,"logfile" ,"Set Log filename." ,false)
>> parameter('d',"debug-level" ,rsInitConfig->debugLevel ,"level" ,"Set debug level." ,false) >> parameter('d',"debug-level" ,rsInitConfig->debugLevel ,"level" ,"Set debug level." ,false)
#ifdef TO_REMOVE #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) >> parameter('w',"password" ,rsInitConfig->passwd ,"password" ,"Set Login Password." ,false)
#endif #endif
>> parameter('i',"ip-address" ,rsInitConfig->inet ,"nnn.nnn.nnn.nnn", "Force IP address to use (if cannot be detected)." ,false) >> 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('p',"port" ,rsInitConfig->port ,"port", "Set listenning port to use." ,false)
>> parameter('c',"base-dir" ,opt_base_dir ,"directory", "Set base directory." ,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) >> 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(mDisc, mDisc->getServiceInfo().mServiceType);
serviceCtrl->registerServiceMonitor(mStatusSrv, mStatusSrv->getServiceInfo().mServiceType); serviceCtrl->registerServiceMonitor(mStatusSrv, mStatusSrv->getServiceInfo().mServiceType);
serviceCtrl->registerServiceMonitor(chatSrv, chatSrv->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(); mPeerMgr->forceHiddenNode();
} }
if (!rsInitConfig->opModeStr.empty())
{
rsConfig->setOperatingMode(rsInitConfig->opModeStr);
}
mNetMgr -> checkNetAddress(); mNetMgr -> checkNetAddress();
if (rsInitConfig->hiddenNodeSet) { if (rsInitConfig->hiddenNodeSet) {

View File

@ -36,7 +36,7 @@
#include <time.h> #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. 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; return true;
} }
template<> void RsTypeSerializer::print_data( const std::string& n, template<> void RsTypeSerializer::print_data( const std::string& /*n*/,
const RsItem& s ) const RsItem& s )
{ {
RsGenericSerializer::SerializeContext ctx( RsGenericSerializer::SerializeContext ctx(

View File

@ -127,16 +127,16 @@
* [X] Implement a system to allow not storing info when we don't have it * [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 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 kMaximumSetSize = 100; // max set of updates to send at once.
static const int CLEANUP_PERIOD = 600 ; // 10 minutes 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 kReputationRequestPeriod = 600; // 10 mins
static const int kReputationStoreWait = 180; // 3 minutes. 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 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 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 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 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.. 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; class p3IdService;
// Temp tweak to test grouter // Temp tweak to test grouter
struct p3MsgService : class p3MsgService :
p3Service, p3Config, pqiServiceMonitor, GRouterClientService, public p3Service, public p3Config, public pqiServiceMonitor, GRouterClientService,
GxsTransClient GxsTransClient
{ {
public:
p3MsgService(p3ServiceControl *sc, p3IdService *id_service, p3GxsTrans& gxsMS); p3MsgService(p3ServiceControl *sc, p3IdService *id_service, p3GxsTrans& gxsMS);
virtual RsServiceInfo getServiceInfo(); 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: case BIO_CTRL_RESET:
num=0; num=0;
/* fallthrough */
case BIO_C_FILE_SEEK: case BIO_C_FILE_SEEK:
ret=0; ret=0;
break; 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 * argstream is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -71,8 +71,8 @@ namespace
private: private:
std::string shortName_; std::string shortName_;
std::string longName_; std::string longName_;
std::string valueName_;
T* value_; T* value_;
std::string valueName_;
T initialValue_; T initialValue_;
std::string description_; std::string description_;
bool mandatory_; bool mandatory_;
@ -282,8 +282,8 @@ namespace
bool mandatory) bool mandatory)
: shortName_(1,s), : shortName_(1,s),
longName_(l), longName_(l),
valueName_(valueName),
value_(&v), value_(&v),
valueName_(valueName),
initialValue_(v), initialValue_(v),
description_(desc), description_(desc),
mandatory_(mandatory) mandatory_(mandatory)
@ -296,8 +296,8 @@ namespace
const char* desc, const char* desc,
bool mandatory) bool mandatory)
: longName_(l), : longName_(l),
valueName_(valueName),
value_(&v), value_(&v),
valueName_(valueName),
initialValue_(v), initialValue_(v),
description_(desc), description_(desc),
mandatory_(mandatory) mandatory_(mandatory)
@ -310,8 +310,8 @@ namespace
const char* desc, const char* desc,
bool mandatory) bool mandatory)
: shortName_(1,s), : shortName_(1,s),
valueName_(valueName),
value_(&v), value_(&v),
valueName_(valueName),
initialValue_(v), initialValue_(v),
description_(desc), description_(desc),
mandatory_(mandatory) 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) case DNSResolver::DNS_LOOKUP_ERROR: if(it->second.last_lookup_time + MAX_TIME_BEFORE_RETRY > now)
continue ; continue ;
/* fallthrough */ //Not really, but to suppress warning.
case DNSResolver::DNS_DONT_HAVE: next_call = it->first ; case DNSResolver::DNS_DONT_HAVE: next_call = it->first ;
it->second.state = DNSResolver::DNS_SEARCHING ; it->second.state = DNSResolver::DNS_SEARCHING ;
it->second.last_lookup_time = now ; 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) { switch (ret) {
case Z_NEED_DICT: case Z_NEED_DICT:
ret = Z_DATA_ERROR; /* and fall through */ ret = Z_DATA_ERROR; /* and fall through */
/* fallthrough */
case Z_DATA_ERROR: case Z_DATA_ERROR:
case Z_MEM_ERROR: case Z_MEM_ERROR:
(void)inflateEnd(&strm); (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; const struct sockaddr_in * addrv4p = (const struct sockaddr_in *) &addr;
success = inet_ntop( addr.ss_family, (const void *) &(addrv4p->sin_addr), ipStr, INET_ADDRSTRLEN ); success = inet_ntop( addr.ss_family, (const void *) &(addrv4p->sin_addr), ipStr, INET_ADDRSTRLEN );
} }
break;
case AF_INET6: case AF_INET6:
{ {
const struct sockaddr_in6 * addrv6p = (const struct sockaddr_in6 *) &addr; const struct sockaddr_in6 * addrv6p = (const struct sockaddr_in6 *) &addr;
success = inet_ntop( addr.ss_family, (const void *) &(addrv6p->sin6_addr), ipStr, INET6_ADDRSTRLEN ); success = inet_ntop( addr.ss_family, (const void *) &(addrv6p->sin6_addr), ipStr, INET6_ADDRSTRLEN );
} }
break;
} }
#endif // WINDOWS_SYS #endif // WINDOWS_SYS

View File

@ -54,9 +54,12 @@ std::string RsUtil::BinToHex(const std::string &bin)
return BinToHex(bin.c_str(), bin.length()); 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)
{ {
return BinToHex((char*)arr,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) 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 std::string &bin);
std::string BinToHex(const char *arr, const uint32_t len); 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 NumberToString(uint64_t n, bool hex=false);
std::string HashId(const std::string &id, bool reverse = false); std::string HashId(const std::string &id, bool reverse = false);
std::vector<uint8_t> BinToSha256(const std::vector<uint8_t> &in); 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: case OPS_S2KS_SALTED:
hashes[n].add(&hashes[n],C.secret_key.salt,OPS_SALT_SIZE); hashes[n].add(&hashes[n],C.secret_key.salt,OPS_SALT_SIZE);
// flow through... /* fallthrough */
case OPS_S2KS_SIMPLE: case OPS_S2KS_SIMPLE:
hashes[n].add(&hashes[n],(unsigned char*)passphrase,l); hashes[n].add(&hashes[n],(unsigned char*)passphrase,l);
break; break;

View File

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

View File

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

View File

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

View File

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

View File

@ -467,8 +467,7 @@ void IdDetailsDialog::sendInvite()
composer->setTitleText(tr("You have a friend invite")); composer->setTitleText(tr("You have a friend invite"));
RsPeerId ownId = rsPeers->getOwnId(); RsPeerId ownId = rsPeers->getOwnId();
RetroShareLink link; RetroShareLink link = RetroShareLink::createCertificate(ownId);
link.createCertificate(ownId);
RsGxsId keyId(ui->lineEdit_KeyId->text().toStdString()); 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_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. 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; RetroShareLink l = RetroShareLink::createGxsMessageLink(service_type,u.mGrpId,u.mMsgId,tr("Message/vote/comment"));
l.createGxsMessageLink(service_type,u.mGrpId,u.mMsgId,tr("Message/vote/comment"));
return tr("%1 in %2 tab").arg(l.toHtml()).arg(service_name) ; 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. 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,9 +2206,8 @@ void IdDialog::handleSerializedGroupData(uint32_t token)
QList<RetroShareLink> urls ; QList<RetroShareLink> urls ;
RetroShareLink link ; RetroShareLink link = RetroShareLink::createIdentity(gxs_id,QString::fromUtf8(details.mNickname.c_str()),QString::fromStdString(radix)) ;
link.createIdentity(gxs_id,QString::fromUtf8(details.mNickname.c_str()),QString::fromStdString(radix)) ; urls.push_back(link);
urls.push_back(link);
RSLinkClipboard::copyLinks(urls) ; RSLinkClipboard::copyLinks(urls) ;

View File

@ -1492,6 +1492,23 @@ void MainWindow::processLastArgs()
/* Now use files from the command line, because no RetroShare was running */ /* Now use files from the command line, because no RetroShare was running */
openRsCollection(Rshare::files()->takeFirst()); 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) void MainWindow::switchVisibilityStatus(StatusElement e,bool b)

View File

@ -323,8 +323,8 @@ void NetworkDialog::copyLink()
RsPgpId peer_id ( wi->text(COLUMN_PEERID).toStdString() ) ; RsPgpId peer_id ( wi->text(COLUMN_PEERID).toStdString() ) ;
QList<RetroShareLink> urls; QList<RetroShareLink> urls;
RetroShareLink link; RetroShareLink link = RetroShareLink::createPerson(peer_id);
if (link.createPerson(peer_id)) { if (link.valid()) {
urls.push_back(link); 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_FORUMNEWLIST = 0x0002;
const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003; const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003;
const uint32_t NEWSFEED_CHANNELNEWLIST = 0x0004; const uint32_t NEWSFEED_CHANNELNEWLIST = 0x0004;
const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005; //const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
#if 0 #if 0
const uint32_t NEWSFEED_BLOGNEWLIST = 0x0006; const uint32_t NEWSFEED_BLOGNEWLIST = 0x0006;
const uint32_t NEWSFEED_BLOGMSGLIST = 0x0007; const uint32_t NEWSFEED_BLOGMSGLIST = 0x0007;

View File

@ -352,211 +352,235 @@ RetroShareLink::RetroShareLink()
clear(); 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; link._name = name;
_hash = QString::fromStdString(id.toStdString()); link._hash = QString::fromStdString(id.toStdString());
_radix_group_data = radix_data ; 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; link._name = name;
_size = size; link._size = size;
_hash = hash; link._hash = hash;
_SSLid = ssl_id; link._SSLid = ssl_id;
_type = TYPE_EXTRAFILE; link._type = TYPE_EXTRAFILE;
check(); link.check();
return valid(); return link;
}
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();
} }
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 ; link._name = name;
_time_stamp = time_stamp ; link._size = size;
_hash = hash ; link._hash = hash;
_GPGid = issuer_pgp_id ;
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; RsPeerDetails detail;
if (rsPeers->getGPGDetails(id, detail) == false) { if (rsPeers->getGPGDetails(id, detail) == false) {
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << id << std::endl; 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()); link.check();
_name = QString::fromUtf8(detail.name.c_str());
_type = TYPE_PERSON; return link;
check();
return valid();
} }
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. // - we should not need to parse and re-read a cert in old format.
// //
RsPeerDetails detail; RsPeerDetails detail;
if (rsPeers->getPeerDetails(ssl_id, detail) == false) { if (rsPeers->getPeerDetails(ssl_id, detail) == false) {
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << ssl_id << std::endl; 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; link.check();
_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","");
std::cerr << "Found radix = " << _radix.toStdString() << std::endl; return link;
return true;
} }
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 // first try ssl id
if (createCertificate(sslId)) { link = createCertificate(sslId);
if (gpgId.isNull() || _GPGid.toStdString() == gpgId.toStdString()) { if (link.valid()) {
return true; if (gpgId.isNull() || link._GPGid.toStdString() == gpgId.toStdString()) {
return link;
} }
// wrong gpg id // wrong gpg id
return false; link.clear();
return link;
} }
// then gpg id // then gpg id
if (createPerson(gpgId)) { link = createPerson(gpgId);
if (!_SSLid.isEmpty()) { if (link.valid()) {
return false; if (!link._SSLid.isEmpty()) {
link.clear();
return link;
} }
if (sslId.isNull()) { if (sslId.isNull()) {
return true; link.check();
return link;
} }
_SSLid = QString::fromStdString(sslId.toStdString()); link._SSLid = QString::fromStdString(sslId.toStdString());
if (_location.isEmpty()) { if (link._location.isEmpty()) {
_location = _name; 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()) { if (!groupId.isNull()) {
_hash = QString::fromStdString(groupId.toStdString()); link._hash = QString::fromStdString(groupId.toStdString());
_type = linkType; link._type = linkType;
_name = groupName; 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()) { if (!groupId.isNull() && !msgId.isNull()) {
_hash = QString::fromStdString(groupId.toStdString()); link._hash = QString::fromStdString(groupId.toStdString());
_msgId = QString::fromStdString(msgId.toStdString()); link._msgId = QString::fromStdString(msgId.toStdString());
_type = linkType; link._type = linkType;
_name = msgName; 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()); link._hash = QString::fromStdString(peerId.toStdString());
PeerDefs::rsidFromId(peerId, &_name); PeerDefs::rsidFromId(peerId, &link._name);
_subject = subject; 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); link._type = TYPE_MESSAGE;
//_name = QString::fromStdString("GXS_id("+peerId.toStdString()+")") ;
// do something better here!!
_subject = subject;
_type = TYPE_MESSAGE; link.check();
check(); return link;
return valid();
} }
void RetroShareLink::clear() void RetroShareLink::clear()
{ {
_valid = false; _valid = false;
@ -584,6 +608,7 @@ void RetroShareLink::check()
case TYPE_EXTRAFILE: case TYPE_EXTRAFILE:
if(!checkSSLId(_SSLid)) if(!checkSSLId(_SSLid))
_valid = false; // no break! We also test file stuff below. _valid = false; // no break! We also test file stuff below.
/* fallthrough */
case TYPE_FILE: case TYPE_FILE:
if(_size > (((uint64_t)1)<<40)) // 1TB. Who has such large files? if(_size > (((uint64_t)1)<<40)) // 1TB. Who has such large files?
_valid = false; _valid = false;
@ -1640,6 +1665,8 @@ static void processList(const QStringList &list, const QString &textSingular, co
return process(links, flag); return process(links, flag);
} }
/**** RSLinkClipboard ********************************************/
void RSLinkClipboard::copyLinks(const QList<RetroShareLink>& links) void RSLinkClipboard::copyLinks(const QList<RetroShareLink>& links)
{ {
QString res ; QString res ;

View File

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

View File

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

View File

@ -691,7 +691,11 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
if (!anchors.isEmpty()){ if (!anchors.isEmpty()){
if (anchors.at(0).startsWith(PERSONID)){ 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()) { if(!mId.isNull()) {
RsIdentityDetails details; RsIdentityDetails details;
if (rsIdentity->getIdDetails(mId, 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=\"date\">"),QString("<a name=\"%1\">").arg(timeStamp));
formatMsg.replace(QString("<a name=\"time\">"),QString("<a name=\"%1\">").arg(timeStamp)); formatMsg.replace(QString("<a name=\"time\">"),QString("<a name=\"%1\">").arg(timeStamp));
//replace Name anchors with GXS Id //replace Name anchors with GXS Id
QString strGxsId = "";
if (!gxsId.isNull()) { 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\">") 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 { } else {
formatMsg.replace(QString("<a name=\"name\">"),""); formatMsg.replace(QString("<a name=\"name\">"),"");
} }
@ -1556,14 +1575,14 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
QList<HashedFile>::iterator it; QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) { for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it; HashedFile& hashedFile = *it;
QString ext = QFileInfo(hashedFile.filename).suffix(); //QString ext = QFileInfo(hashedFile.filename).suffix();
RetroShareLink link; RetroShareLink link;
if(mDefaultExtraFileFlags & RS_FILE_REQ_ANONYMOUS_ROUTING) 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 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) { if (hashedFile.flag & HashedFile::Picture) {
message += QString("<img src=\"file:///%1\" width=\"100\" height=\"100\">").arg(hashedFile.filepath); 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(); message += link.toHtmlSize();
if (it != hashedFiles.end()) { if (it != hashedFiles.end()) {
message += "<BR>"; message += "<BR>";
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -170,7 +170,8 @@ protected:
/** Overloaded QWidget::paintEvent() */ /** Overloaded QWidget::paintEvent() */
void paintEvent(QPaintEvent *event); 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: protected slots:
void updateIfPossible() ; void updateIfPossible() ;

View File

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

View File

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

View File

@ -127,8 +127,7 @@ void GxsChannelGroupItem::fill()
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
RetroShareLink link; RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mGroup.mMeta.mGroupId, groupName());
ui->nameLabel->setText(link.toHtml()); ui->nameLabel->setText(link.toHtml());
ui->descLabel->setText(QString::fromUtf8(mGroup.mDescription.c_str())); 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) : 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) 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; QVector<RsGxsMessageId> v;
bool self = false; //bool self = false;
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it) for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
v.push_back(*it) ; v.push_back(*it) ;
@ -218,12 +230,12 @@ bool GxsChannelPostItem::setGroup(const RsGxsChannelGroup &group, bool doFill)
mGroup = group; 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 #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 #endif
if(!IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags)) if( !IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags) )
ui->editButton->hide(); ui->editButton->hide() ;
if (doFill) { if (doFill) {
fill(); fill();
@ -398,13 +410,11 @@ void GxsChannelPostItem::fill()
} }
title = tr("Channel Feed") + ": "; title = tr("Channel Feed") + ": ";
RetroShareLink link; RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, groupName());
link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, groupName());
title += link.toHtml(); title += link.toHtml();
ui->titleLabel->setText(title); ui->titleLabel->setText(title);
RetroShareLink msgLink; RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
msgLink.createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
ui->subjectLabel->setText(msgLink.toHtml()); ui->subjectLabel->setText(msgLink.toHtml());
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags)) 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>()); 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 RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); //GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
virtual ~GxsChannelPostItem(); virtual ~GxsChannelPostItem();
@ -63,6 +68,8 @@ public:
bool isUnread() const ; bool isUnread() const ;
protected: protected:
void init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions);
/* FeedItem */ /* FeedItem */
virtual void doExpand(bool open); virtual void doExpand(bool open);
virtual void expandFill(bool first); virtual void expandFill(bool first);

View File

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

View File

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

View File

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

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 */ /** Constructor */
SubFileItem::SubFileItem(const RsFileHash &hash, const std::string &name, const std::string &path, uint64_t size, uint32_t flags, const RsPeerId &srcId) 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; return;
} }
RetroShareLink link; RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(mFileName.c_str()), mFileSize, QString::fromStdString(mFileHash.toStdString()));
if (link.createFile(QString::fromUtf8(mFileName.c_str()), mFileSize, QString::fromStdString(mFileHash.toStdString()))) { if (link.valid()) {
QList<RetroShareLink> urls; QList<RetroShareLink> urls;
urls.push_back(link); urls.push_back(link);
RSLinkClipboard::copyLinks(urls); RSLinkClipboard::copyLinks(urls);

View File

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

View File

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

View File

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

View File

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

View File

@ -59,13 +59,13 @@
#define MAX_ATTEMPTS 10 #define MAX_ATTEMPTS 10
#define MAX_PROCESS_COUNT_PER_TIMER 50 #define MAX_PROCESS_COUNT_PER_TIMER 50
const int kRecognTagClass_DEVELOPMENT = 1; //const int kRecognTagClass_DEVELOPMENT = 1;
//
const int kRecognTagType_Dev_Ambassador = 1; //const int kRecognTagType_Dev_Ambassador = 1;
const int kRecognTagType_Dev_Contributor = 2; //const int kRecognTagType_Dev_Contributor = 2;
const int kRecognTagType_Dev_Translator = 3; //const int kRecognTagType_Dev_Translator = 3;
const int kRecognTagType_Dev_Patcher = 4; //const int kRecognTagType_Dev_Patcher = 4;
const int kRecognTagType_Dev_Developer = 5; //const int kRecognTagType_Dev_Developer = 5;
void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const 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 ; uint32_t flags = SFI_TYPE_CHANNEL | SFI_FLAG_ALLOW_DELETE ;
if(assume_file_ready) if( assume_file_ready )
flags |= SFI_FLAG_ASSUME_FILE_READY; flags |= SFI_FLAG_ASSUME_FILE_READY ;
if (local) if (local)
flags |= SFI_STATE_LOCAL; flags |= SFI_STATE_LOCAL;

View File

@ -395,7 +395,7 @@ void GxsChannelPostsWidget::filterChanged(int filter)
return bVisible; return bVisible;
} }
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool related) void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool related)
{ {
GxsChannelPostItem *item = NULL; GxsChannelPostItem *item = NULL;
@ -407,12 +407,8 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re
if(item) if(item)
{ {
ui->feedWidget->removeFeedItem(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)); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
return ; return ;
@ -428,14 +424,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re
item->setPost(post); item->setPost(post);
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
} else { } else {
/* Group is not always available because of the TokenQueue */ GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
//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);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); 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 current_index = new_versions[i] ;
uint32_t source_index = new_versions[i] ; uint32_t source_index = new_versions[i] ;
#ifdef DEBUG_CHANNEL
RsGxsMessageId source_msg_id = posts[source_index].mMeta.mMsgId ; 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 // 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. // (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. // 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 ; std::map<RsGxsMessageId,uint32_t>::const_iterator vit ;
while(search_map.end() != (vit=search_map.find(posts[current_index].mMeta.mOrigMsgId))) 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 // 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 // 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 ; 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. 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; QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) { for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it; HashedFile& hashedFile = *it;
RetroShareLink link; RetroShareLink link = RetroShareLink::createFile(hashedFile.filename, hashedFile.size,
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()));
QString::fromStdString(hashedFile.hash.toStdString()))) { if (link.valid()) {
mesgString += link.toHtmlSize() + "<br>"; mesgString += link.toHtmlSize() + "<br>";
} }
} }

View File

@ -2018,12 +2018,13 @@ void GxsForumThreadWidget::copyMessageLink()
return; return;
} }
RetroShareLink link; QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
QString thread_title = (item != NULL)?item->text(COLUMN_THREAD_TITLE):QString() ; 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; QList<RetroShareLink> urls;
urls.push_back(link); urls.push_back(link);
RSLinkClipboard::copyLinks(urls); RSLinkClipboard::copyLinks(urls);
@ -2068,8 +2069,7 @@ void GxsForumThreadWidget::createthread()
static QString buildReplyHeader(const RsMsgMetaData &meta) static QString buildReplyHeader(const RsMsgMetaData &meta)
{ {
RetroShareLink link; RetroShareLink link = RetroShareLink::createMessage(meta.mAuthorId, "");
link.createMessage(meta.mAuthorId, "");
QString from = link.toHtml(); QString from = link.toHtml();
QString header = QString("<span>-----%1-----").arg(QApplication::translate("GxsForumThreadWidget", "Original Message")); 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 // 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. // 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 ; most_recent_versions[(*it)[i].second] = (*it)[0].second ;
} }
mPostVersions = mTmp ; mPostVersions = mTmp ;

View File

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

View File

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

View File

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

View File

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

View File

@ -55,7 +55,7 @@
#define COL_DUPLICATION_FACTOR 9 #define COL_DUPLICATION_FACTOR 9
static const int PARTIAL_VIEW_SIZE = 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) static QColor colorScale(float f)
{ {

View File

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

View File

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

View File

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

View File

@ -189,6 +189,17 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
Q_INIT_RESOURCE(images); Q_INIT_RESOURCE(images);
Q_INIT_RESOURCE(icons); 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 // This is needed to allocate rsNotify, so that it can be used to ask for PGP passphrase
// //
RsControl::earlyInitNotificationSystem() ; RsControl::earlyInitNotificationSystem() ;

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