Make rs-nogui+SSH compile against the trunk.

* converted to new flags format for File Operations.
 * converted from PUBLIC to VISIBLE lobbies. NB: This required name changes to protobuf definitions.
 * converted DataRates to new function.
 * directory sharing shifted to using OTHERS flags (text menus) - No support for group Flags yet.
 * Added == operator to Flags Type.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6000 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-12-17 01:24:16 +00:00
parent f764a82408
commit d3787cb324
12 changed files with 147 additions and 122 deletions

View File

@ -30,6 +30,7 @@ template<int n> class t_RsFlags32
inline t_RsFlags32<n> operator^ (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits ^ f._bits) ; }
inline bool operator!=(const t_RsFlags32<n>& f) const { return _bits != f._bits ; }
inline bool operator==(const t_RsFlags32<n>& f) const { return _bits == f._bits ; }
inline bool operator& (const t_RsFlags32<n>& f) const { return (_bits & f._bits)>0 ; }
inline t_RsFlags32<n> operator|=(const t_RsFlags32<n>& f) { _bits |= f._bits ; return *this ;}

View File

@ -164,6 +164,7 @@ class ChatLobbyInvite
std::string lobby_topic ;
uint32_t lobby_privacy_level ;
};
class VisibleChatLobbyRecord
{
public:
@ -178,6 +179,8 @@ class VisibleChatLobbyRecord
time_t last_report_time ; // last time the lobby was reported.
uint32_t lobby_privacy_level ; // see RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC / RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE
};
class ChatLobbyInfo
{
public:

View File

@ -311,7 +311,7 @@ uint32_t MenuInterface::drawHeader(uint32_t drawFlags, std::string &buffer)
float downKb = 0;
float upKb = 0;
rsicontrol -> ConfigGetDataRates(downKb, upKb);
rsConfig->GetCurrentDataRates(downKb, upKb);
rs_sprintf_append(buffer, "Friends %d / %d Network: %s\r\n",
nConnected, nTotal, natState.c_str());

View File

@ -497,7 +497,7 @@ int MenuListSearchList::downloadSelected()
{
std::list<std::string> srcIds;
if (rsFiles -> FileRequest(it->name, it->hash, it->size,
"", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
"", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds))
{
std::cout << "MenuListSearchList::downloadSelected() Download Started";
std::cout << std::endl;
@ -654,21 +654,31 @@ int MenuListShared::getEntryDesc(int idx, std::string &desc)
std::string shareflag;
int i=0;
for (it = dirs.begin(); (i < idx) && (it != dirs.end()); it++, i++);
if (it != dirs.end())
{
if (it->shareflags == (RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE))
shareflag = "networkwide - browsable";
else if ((it->shareflags & RS_FILE_HINTS_BROWSABLE) == RS_FILE_HINTS_BROWSABLE)
shareflag = "private - browsable";
else if ((it->shareflags & RS_FILE_HINTS_NETWORK_WIDE) == RS_FILE_HINTS_NETWORK_WIDE)
shareflag = "networkwide - anonymous";
else
shareflag = "not shared";
if (it != dirs.end())
{
bool networkwide = (it->shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS);
bool browsable = (it->shareflags & DIR_FLAGS_BROWSABLE_OTHERS);
if (networkwide && browsable)
{
shareflag = "networkwide - browsable";
}
else if (browsable)
{
shareflag = "private - browsable";
}
else if (networkwide)
{
shareflag = "networkwide - anonymous";
}
else
{
shareflag = "not shared";
}
rs_sprintf(desc, "Path: %s Share Type:%s", it->filename.c_str(), shareflag.c_str());
return MENU_ENTRY_OKAY;
}
return MENU_ENTRY_NONE;
rs_sprintf(desc, "Path: %s Share Type:%s", it->filename.c_str(), shareflag.c_str());
return MENU_ENTRY_OKAY;
}
return MENU_ENTRY_NONE;
}
int MenuListShared::unshareSelected()
@ -684,15 +694,15 @@ int MenuListShared::unshareSelected()
std::list<SharedDirInfo>::iterator it;
int i=0;
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
if (it != dirs.end())
{
rsFiles->removeSharedDirectory(it->filename);
return MENU_ENTRY_OKAY;
}
if (it != dirs.end())
{
rsFiles->removeSharedDirectory(it->filename);
return MENU_ENTRY_OKAY;
}
return MENU_ENTRY_NONE;
}
int MenuListShared::toggleFlagSelected(uint32_t shareflags)
int MenuListShared::toggleFlagSelected(FileStorageFlags shareflags)
{
if (mSelectIdx < 0)
{
@ -705,20 +715,21 @@ int MenuListShared::toggleFlagSelected(uint32_t shareflags)
std::list<SharedDirInfo>::iterator it;
int i=0;
for (it = dirs.begin(); (i < mSelectIdx) && (it != dirs.end()); it++, i++);
if (it != dirs.end())
{
if((it->shareflags & shareflags) == shareflags)
{
it->shareflags = it->shareflags & ~shareflags; //disable shareflags
rsFiles->updateShareFlags(*it);
} else
{
it->shareflags = it->shareflags | shareflags; //anable shareflags
rsFiles->updateShareFlags(*it);
}
return MENU_ENTRY_OKAY;
}
return MENU_ENTRY_NONE;
if (it != dirs.end())
{
if(FileStorageFlags(it->shareflags & shareflags) == shareflags)
{
it->shareflags = FileStorageFlags(it->shareflags & ~shareflags); //disable shareflags
rsFiles->updateShareFlags(*it);
}
else
{
it->shareflags = FileStorageFlags(it->shareflags | shareflags); //anable shareflags
rsFiles->updateShareFlags(*it);
}
return MENU_ENTRY_OKAY;
}
return MENU_ENTRY_NONE;
}
uint32_t MenuListSharedUnshare::op_basic(std::string key)
@ -748,7 +759,7 @@ uint32_t MenuListSharedTogglePublic::op_basic(std::string key)
return MENU_OP_ERROR;
}
mls->toggleFlagSelected(RS_FILE_HINTS_NETWORK_WIDE);
mls->toggleFlagSelected(DIR_FLAGS_NETWORK_WIDE_OTHERS);
return MENU_OP_INSTANT;
}
@ -764,7 +775,7 @@ uint32_t MenuListSharedToggleBrowsable::op_basic(std::string key)
return MENU_OP_ERROR;
}
mls->toggleFlagSelected(RS_FILE_HINTS_BROWSABLE);
mls->toggleFlagSelected(DIR_FLAGS_BROWSABLE_OTHERS);
return MENU_OP_INSTANT;
}
@ -809,7 +820,7 @@ uint32_t MenuListSharedAddShare::process_lines(std::string input)
SharedDirInfo shareddir;
shareddir.filename = dir;
shareddir.virtualname = topdir;
shareddir.shareflags = 0x0;
shareddir.shareflags = FileStorageFlags(0x0);
if (!rsFiles->addSharedDirectory(shareddir))
{

View File

@ -306,7 +306,7 @@ class MenuListShared: public MenuList
virtual uint32_t op();
int getEntryDesc(int idx, std::string &desc);
int unshareSelected();
int toggleFlagSelected(uint32_t shareflags);
int toggleFlagSelected(FileStorageFlags shareflags);
};

View File

@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = retroshare-nogui
CONFIG += bitdht
#CONFIG += introserver
#CONFIG += sshserver
CONFIG += sshserver
# if you are linking against the libretroshare with gxs.
# this option links against the required sqlite library.

View File

@ -423,7 +423,7 @@ void protobuf_AddDesc_chat_2eproto() {
::rsctrl::core::protobuf_AddDesc_core_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\nchat.proto\022\013rsctrl.chat\032\ncore.proto\"\236\003"
"\n\nchat.proto\022\013rsctrl.chat\032\ncore.proto\"\237\003"
"\n\rChatLobbyInfo\022\020\n\010lobby_id\030\001 \002(\t\022\023\n\013lob"
"by_topic\030\002 \002(\t\022\022\n\nlobby_name\030\003 \002(\t\022\026\n\016lo"
"bby_nickname\030\004 \002(\t\0225\n\rprivacy_level\030\005 \002("
@ -432,57 +432,57 @@ void protobuf_AddDesc_chat_2eproto() {
"fo.LobbyState\022\020\n\010no_peers\030\007 \002(\r\022\030\n\020last_"
"report_time\030\010 \002(\r\022\025\n\rlast_activity\030\t \002(\r"
"\022\035\n\025participating_friends\030\n \003(\t\022\021\n\tnickn"
"ames\030\013 \003(\t\"R\n\nLobbyState\022\025\n\021LOBBYSTATE_J"
"OINED\020\001\022\026\n\022LOBBYSTATE_INVITED\020\002\022\025\n\021LOBBY"
"STATE_PUBLIC\020\003\"C\n\006ChatId\022(\n\tchat_type\030\001 "
"\002(\0162\025.rsctrl.chat.ChatType\022\017\n\007chat_id\030\002 "
"\002(\t\"\214\001\n\013ChatMessage\022\037\n\002id\030\001 \002(\0132\023.rsctrl"
".chat.ChatId\022\013\n\003msg\030\002 \002(\t\022\025\n\rpeer_nickna"
"me\030\003 \001(\t\022\022\n\nchat_flags\030\004 \001(\r\022\021\n\tsend_tim"
"e\030\005 \001(\r\022\021\n\trecv_time\030\006 \001(\r\"g\n\023ResponseCh"
"atLobbies\022#\n\006status\030\001 \002(\0132\023.rsctrl.core."
"Status\022+\n\007lobbies\030\002 \003(\0132\032.rsctrl.chat.Ch"
"atLobbyInfo\"\257\001\n\022RequestChatLobbies\022;\n\tlo"
"bby_set\030\001 \002(\0162(.rsctrl.chat.RequestChatL"
"obbies.LobbySet\"\\\n\010LobbySet\022\020\n\014LOBBYSET_"
"ALL\020\001\022\023\n\017LOBBYSET_JOINED\020\002\022\024\n\020LOBBYSET_I"
"NVITED\020\003\022\023\n\017LOBBYSET_PUBLIC\020\004\"\215\001\n\022Reques"
"tCreateLobby\022\022\n\nlobby_name\030\001 \002(\t\022\023\n\013lobb"
"y_topic\030\002 \002(\t\0225\n\rprivacy_level\030\004 \002(\0162\036.r"
"sctrl.chat.LobbyPrivacyLevel\022\027\n\017invited_"
"friends\030\003 \003(\t\"\243\001\n\027RequestJoinOrLeaveLobb"
"y\022\020\n\010lobby_id\030\001 \002(\t\022@\n\006action\030\002 \002(\01620.rs"
"ctrl.chat.RequestJoinOrLeaveLobby.LobbyA"
"ction\"4\n\013LobbyAction\022\022\n\016JOIN_OR_ACCEPT\020\001"
"\022\021\n\rLEAVE_OR_DENY\020\002\">\n\027RequestSetLobbyNi"
"ckname\022\020\n\010nickname\030\001 \002(\t\022\021\n\tlobby_ids\030\002 "
"\003(\t\"\?\n\030ResponseSetLobbyNickname\022#\n\006statu"
"s\030\001 \002(\0132\023.rsctrl.core.Status\"\212\001\n\025Request"
"RegisterEvents\022A\n\006action\030\001 \002(\01621.rsctrl."
"chat.RequestRegisterEvents.RegisterActio"
"n\".\n\016RegisterAction\022\014\n\010REGISTER\020\001\022\016\n\nDER"
"EGISTER\020\002\"=\n\026ResponseRegisterEvents\022#\n\006s"
"tatus\030\001 \002(\0132\023.rsctrl.core.Status\"=\n\020Even"
"tLobbyInvite\022)\n\005lobby\030\001 \002(\0132\032.rsctrl.cha"
"t.ChatLobbyInfo\"9\n\020EventChatMessage\022%\n\003m"
"sg\030\001 \002(\0132\030.rsctrl.chat.ChatMessage\";\n\022Re"
"questSendMessage\022%\n\003msg\030\001 \002(\0132\030.rsctrl.c"
"hat.ChatMessage\":\n\023ResponseSendMessage\022#"
"\n\006status\030\001 \002(\0132\023.rsctrl.core.Status*\320\001\n\r"
"RequestMsgIds\022\034\n\030MsgId_RequestChatLobbie"
"s\020\001\022\034\n\030MsgId_RequestCreateLobby\020\002\022!\n\035Msg"
"Id_RequestJoinOrLeaveLobby\020\003\022!\n\035MsgId_Re"
"questSetLobbyNickname\020\004\022\037\n\033MsgId_Request"
"RegisterEvents\020\005\022\034\n\030MsgId_RequestSendMes"
"sage\020\006*\314\001\n\016ResponseMsgIds\022\035\n\031MsgId_Respo"
"nseChatLobbies\020\001\022\"\n\036MsgId_ResponseSetLob"
"byNickname\020\004\022 \n\034MsgId_ResponseRegisterEv"
"ents\020\005\022\035\n\031MsgId_ResponseSendMessage\020\006\022\032\n"
"\026MsgId_EventLobbyInvite\020e\022\032\n\026MsgId_Event"
"ChatMessage\020f*<\n\021LobbyPrivacyLevel\022\023\n\017PR"
"IVACY_PRIVATE\020\001\022\022\n\016PRIVACY_PUBLIC\020\002*<\n\010C"
"hatType\022\020\n\014TYPE_PRIVATE\020\001\022\016\n\nTYPE_LOBBY\020"
"\002\022\016\n\nTYPE_GROUP\020\003", 2377);
"ames\030\013 \003(\t\"S\n\nLobbyState\022\025\n\021LOBBYSTATE_J"
"OINED\020\001\022\026\n\022LOBBYSTATE_INVITED\020\002\022\026\n\022LOBBY"
"STATE_VISIBLE\020\003\"C\n\006ChatId\022(\n\tchat_type\030\001"
" \002(\0162\025.rsctrl.chat.ChatType\022\017\n\007chat_id\030\002"
" \002(\t\"\214\001\n\013ChatMessage\022\037\n\002id\030\001 \002(\0132\023.rsctr"
"l.chat.ChatId\022\013\n\003msg\030\002 \002(\t\022\025\n\rpeer_nickn"
"ame\030\003 \001(\t\022\022\n\nchat_flags\030\004 \001(\r\022\021\n\tsend_ti"
"me\030\005 \001(\r\022\021\n\trecv_time\030\006 \001(\r\"g\n\023ResponseC"
"hatLobbies\022#\n\006status\030\001 \002(\0132\023.rsctrl.core"
".Status\022+\n\007lobbies\030\002 \003(\0132\032.rsctrl.chat.C"
"hatLobbyInfo\"\260\001\n\022RequestChatLobbies\022;\n\tl"
"obby_set\030\001 \002(\0162(.rsctrl.chat.RequestChat"
"Lobbies.LobbySet\"]\n\010LobbySet\022\020\n\014LOBBYSET"
"_ALL\020\001\022\023\n\017LOBBYSET_JOINED\020\002\022\024\n\020LOBBYSET_"
"INVITED\020\003\022\024\n\020LOBBYSET_VISIBLE\020\004\"\215\001\n\022Requ"
"estCreateLobby\022\022\n\nlobby_name\030\001 \002(\t\022\023\n\013lo"
"bby_topic\030\002 \002(\t\0225\n\rprivacy_level\030\004 \002(\0162\036"
".rsctrl.chat.LobbyPrivacyLevel\022\027\n\017invite"
"d_friends\030\003 \003(\t\"\243\001\n\027RequestJoinOrLeaveLo"
"bby\022\020\n\010lobby_id\030\001 \002(\t\022@\n\006action\030\002 \002(\01620."
"rsctrl.chat.RequestJoinOrLeaveLobby.Lobb"
"yAction\"4\n\013LobbyAction\022\022\n\016JOIN_OR_ACCEPT"
"\020\001\022\021\n\rLEAVE_OR_DENY\020\002\">\n\027RequestSetLobby"
"Nickname\022\020\n\010nickname\030\001 \002(\t\022\021\n\tlobby_ids\030"
"\002 \003(\t\"\?\n\030ResponseSetLobbyNickname\022#\n\006sta"
"tus\030\001 \002(\0132\023.rsctrl.core.Status\"\212\001\n\025Reque"
"stRegisterEvents\022A\n\006action\030\001 \002(\01621.rsctr"
"l.chat.RequestRegisterEvents.RegisterAct"
"ion\".\n\016RegisterAction\022\014\n\010REGISTER\020\001\022\016\n\nD"
"EREGISTER\020\002\"=\n\026ResponseRegisterEvents\022#\n"
"\006status\030\001 \002(\0132\023.rsctrl.core.Status\"=\n\020Ev"
"entLobbyInvite\022)\n\005lobby\030\001 \002(\0132\032.rsctrl.c"
"hat.ChatLobbyInfo\"9\n\020EventChatMessage\022%\n"
"\003msg\030\001 \002(\0132\030.rsctrl.chat.ChatMessage\";\n\022"
"RequestSendMessage\022%\n\003msg\030\001 \002(\0132\030.rsctrl"
".chat.ChatMessage\":\n\023ResponseSendMessage"
"\022#\n\006status\030\001 \002(\0132\023.rsctrl.core.Status*\320\001"
"\n\rRequestMsgIds\022\034\n\030MsgId_RequestChatLobb"
"ies\020\001\022\034\n\030MsgId_RequestCreateLobby\020\002\022!\n\035M"
"sgId_RequestJoinOrLeaveLobby\020\003\022!\n\035MsgId_"
"RequestSetLobbyNickname\020\004\022\037\n\033MsgId_Reque"
"stRegisterEvents\020\005\022\034\n\030MsgId_RequestSendM"
"essage\020\006*\314\001\n\016ResponseMsgIds\022\035\n\031MsgId_Res"
"ponseChatLobbies\020\001\022\"\n\036MsgId_ResponseSetL"
"obbyNickname\020\004\022 \n\034MsgId_ResponseRegister"
"Events\020\005\022\035\n\031MsgId_ResponseSendMessage\020\006\022"
"\032\n\026MsgId_EventLobbyInvite\020e\022\032\n\026MsgId_Eve"
"ntChatMessage\020f*<\n\021LobbyPrivacyLevel\022\023\n\017"
"PRIVACY_PRIVATE\020\001\022\022\n\016PRIVACY_PUBLIC\020\002*<\n"
"\010ChatType\022\020\n\014TYPE_PRIVATE\020\001\022\016\n\nTYPE_LOBB"
"Y\020\002\022\016\n\nTYPE_GROUP\020\003", 2379);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"chat.proto", &protobuf_RegisterTypes);
ChatLobbyInfo::default_instance_ = new ChatLobbyInfo();
@ -611,7 +611,7 @@ bool ChatLobbyInfo_LobbyState_IsValid(int value) {
#ifndef _MSC_VER
const ChatLobbyInfo_LobbyState ChatLobbyInfo::LOBBYSTATE_JOINED;
const ChatLobbyInfo_LobbyState ChatLobbyInfo::LOBBYSTATE_INVITED;
const ChatLobbyInfo_LobbyState ChatLobbyInfo::LOBBYSTATE_PUBLIC;
const ChatLobbyInfo_LobbyState ChatLobbyInfo::LOBBYSTATE_VISIBLE;
const ChatLobbyInfo_LobbyState ChatLobbyInfo::LobbyState_MIN;
const ChatLobbyInfo_LobbyState ChatLobbyInfo::LobbyState_MAX;
const int ChatLobbyInfo::LobbyState_ARRAYSIZE;
@ -2324,7 +2324,7 @@ bool RequestChatLobbies_LobbySet_IsValid(int value) {
const RequestChatLobbies_LobbySet RequestChatLobbies::LOBBYSET_ALL;
const RequestChatLobbies_LobbySet RequestChatLobbies::LOBBYSET_JOINED;
const RequestChatLobbies_LobbySet RequestChatLobbies::LOBBYSET_INVITED;
const RequestChatLobbies_LobbySet RequestChatLobbies::LOBBYSET_PUBLIC;
const RequestChatLobbies_LobbySet RequestChatLobbies::LOBBYSET_VISIBLE;
const RequestChatLobbies_LobbySet RequestChatLobbies::LobbySet_MIN;
const RequestChatLobbies_LobbySet RequestChatLobbies::LobbySet_MAX;
const int RequestChatLobbies::LobbySet_ARRAYSIZE;

View File

@ -53,11 +53,11 @@ class ResponseSendMessage;
enum ChatLobbyInfo_LobbyState {
ChatLobbyInfo_LobbyState_LOBBYSTATE_JOINED = 1,
ChatLobbyInfo_LobbyState_LOBBYSTATE_INVITED = 2,
ChatLobbyInfo_LobbyState_LOBBYSTATE_PUBLIC = 3
ChatLobbyInfo_LobbyState_LOBBYSTATE_VISIBLE = 3
};
bool ChatLobbyInfo_LobbyState_IsValid(int value);
const ChatLobbyInfo_LobbyState ChatLobbyInfo_LobbyState_LobbyState_MIN = ChatLobbyInfo_LobbyState_LOBBYSTATE_JOINED;
const ChatLobbyInfo_LobbyState ChatLobbyInfo_LobbyState_LobbyState_MAX = ChatLobbyInfo_LobbyState_LOBBYSTATE_PUBLIC;
const ChatLobbyInfo_LobbyState ChatLobbyInfo_LobbyState_LobbyState_MAX = ChatLobbyInfo_LobbyState_LOBBYSTATE_VISIBLE;
const int ChatLobbyInfo_LobbyState_LobbyState_ARRAYSIZE = ChatLobbyInfo_LobbyState_LobbyState_MAX + 1;
const ::google::protobuf::EnumDescriptor* ChatLobbyInfo_LobbyState_descriptor();
@ -74,11 +74,11 @@ enum RequestChatLobbies_LobbySet {
RequestChatLobbies_LobbySet_LOBBYSET_ALL = 1,
RequestChatLobbies_LobbySet_LOBBYSET_JOINED = 2,
RequestChatLobbies_LobbySet_LOBBYSET_INVITED = 3,
RequestChatLobbies_LobbySet_LOBBYSET_PUBLIC = 4
RequestChatLobbies_LobbySet_LOBBYSET_VISIBLE = 4
};
bool RequestChatLobbies_LobbySet_IsValid(int value);
const RequestChatLobbies_LobbySet RequestChatLobbies_LobbySet_LobbySet_MIN = RequestChatLobbies_LobbySet_LOBBYSET_ALL;
const RequestChatLobbies_LobbySet RequestChatLobbies_LobbySet_LobbySet_MAX = RequestChatLobbies_LobbySet_LOBBYSET_PUBLIC;
const RequestChatLobbies_LobbySet RequestChatLobbies_LobbySet_LobbySet_MAX = RequestChatLobbies_LobbySet_LOBBYSET_VISIBLE;
const int RequestChatLobbies_LobbySet_LobbySet_ARRAYSIZE = RequestChatLobbies_LobbySet_LobbySet_MAX + 1;
const ::google::protobuf::EnumDescriptor* RequestChatLobbies_LobbySet_descriptor();
@ -271,7 +271,7 @@ class ChatLobbyInfo : public ::google::protobuf::Message {
typedef ChatLobbyInfo_LobbyState LobbyState;
static const LobbyState LOBBYSTATE_JOINED = ChatLobbyInfo_LobbyState_LOBBYSTATE_JOINED;
static const LobbyState LOBBYSTATE_INVITED = ChatLobbyInfo_LobbyState_LOBBYSTATE_INVITED;
static const LobbyState LOBBYSTATE_PUBLIC = ChatLobbyInfo_LobbyState_LOBBYSTATE_PUBLIC;
static const LobbyState LOBBYSTATE_VISIBLE = ChatLobbyInfo_LobbyState_LOBBYSTATE_VISIBLE;
static inline bool LobbyState_IsValid(int value) {
return ChatLobbyInfo_LobbyState_IsValid(value);
}
@ -842,7 +842,7 @@ class RequestChatLobbies : public ::google::protobuf::Message {
static const LobbySet LOBBYSET_ALL = RequestChatLobbies_LobbySet_LOBBYSET_ALL;
static const LobbySet LOBBYSET_JOINED = RequestChatLobbies_LobbySet_LOBBYSET_JOINED;
static const LobbySet LOBBYSET_INVITED = RequestChatLobbies_LobbySet_LOBBYSET_INVITED;
static const LobbySet LOBBYSET_PUBLIC = RequestChatLobbies_LobbySet_LOBBYSET_PUBLIC;
static const LobbySet LOBBYSET_VISIBLE = RequestChatLobbies_LobbySet_LOBBYSET_VISIBLE;
static inline bool LobbySet_IsValid(int value) {
return RequestChatLobbies_LobbySet_IsValid(value);
}

View File

@ -45,7 +45,7 @@ bool convertStringToLobbyId(const std::string &chat_id, ChatLobbyId &lobby_id);
bool convertLobbyIdToString(const ChatLobbyId &lobby_id, std::string &chat_id);
bool fillLobbyInfoFromChatLobbyInfo(const ChatLobbyInfo &cfi, rsctrl::chat::ChatLobbyInfo *lobby);
bool fillLobbyInfoFromPublicChatLobbyRecord(const PublicChatLobbyRecord &pclr, rsctrl::chat::ChatLobbyInfo *lobby);
bool fillLobbyInfoFromVisibleChatLobbyRecord(const VisibleChatLobbyRecord &pclr, rsctrl::chat::ChatLobbyInfo *lobby);
bool fillLobbyInfoFromChatLobbyInvite(const ChatLobbyInvite &cli, rsctrl::chat::ChatLobbyInfo *lobby);
bool createQueuedEventSendMsg(const ChatInfo &chatinfo, rsctrl::chat::ChatType ctype,
@ -106,6 +106,7 @@ int RpcProtoChat::processMsg(uint32_t chan_id, uint32_t msg_id, uint32_t req_id,
case rsctrl::chat::MsgId_RequestChatLobbies:
processReqChatLobbies(chan_id, msg_id, req_id, msg);
break;
case rsctrl::chat::MsgId_RequestCreateLobby:
processReqCreateLobby(chan_id, msg_id, req_id, msg);
break;
@ -163,7 +164,7 @@ int RpcProtoChat::processReqChatLobbies(uint32_t chan_id, uint32_t /*msg_id*/, u
// set these flags from request.
bool fetch_chatlobbylist = true;
bool fetch_invites = true;
bool fetch_publiclobbies = true;
bool fetch_visiblelobbies = true;
switch(req.lobby_set())
{
@ -172,28 +173,28 @@ int RpcProtoChat::processReqChatLobbies(uint32_t chan_id, uint32_t /*msg_id*/, u
std::cerr << std::endl;
fetch_chatlobbylist = true;
fetch_invites = true;
fetch_publiclobbies = true;
fetch_visiblelobbies = true;
break;
case rsctrl::chat::RequestChatLobbies::LOBBYSET_JOINED:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_JOINED";
std::cerr << std::endl;
fetch_chatlobbylist = true;
fetch_invites = false;
fetch_publiclobbies = false;
fetch_visiblelobbies = false;
break;
case rsctrl::chat::RequestChatLobbies::LOBBYSET_INVITED:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_INVITED";
std::cerr << std::endl;
fetch_chatlobbylist = false;
fetch_invites = true;
fetch_publiclobbies = false;
fetch_visiblelobbies = false;
break;
case rsctrl::chat::RequestChatLobbies::LOBBYSET_PUBLIC:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_PUBLIC";
case rsctrl::chat::RequestChatLobbies::LOBBYSET_VISIBLE:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_VISIBLE";
std::cerr << std::endl;
fetch_chatlobbylist = false;
fetch_invites = false;
fetch_publiclobbies = true;
fetch_visiblelobbies = true;
break;
default:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET ERROR";
@ -260,13 +261,13 @@ int RpcProtoChat::processReqChatLobbies(uint32_t chan_id, uint32_t /*msg_id*/, u
}
}
if (fetch_publiclobbies)
if (fetch_visiblelobbies)
{
std::cerr << "RpcProtoChat::processReqChatLobbies() Fetching public lobbies";
std::cerr << std::endl;
std::vector<PublicChatLobbyRecord> public_lobbies;
std::vector<PublicChatLobbyRecord>::iterator it;
std::vector<VisibleChatLobbyRecord> public_lobbies;
std::vector<VisibleChatLobbyRecord>::iterator it;
rsMsgs->getListOfNearbyChatLobbies(public_lobbies);
@ -275,7 +276,7 @@ int RpcProtoChat::processReqChatLobbies(uint32_t chan_id, uint32_t /*msg_id*/, u
if (done_lobbies.find(it->lobby_id) == done_lobbies.end())
{
rsctrl::chat::ChatLobbyInfo *lobby = resp.add_lobbies();
fillLobbyInfoFromPublicChatLobbyRecord(*it, lobby);
fillLobbyInfoFromVisibleChatLobbyRecord(*it, lobby);
done_lobbies.insert(it->lobby_id);
@ -530,7 +531,7 @@ int RpcProtoChat::processReqJoinOrLeaveLobby(uint32_t chan_id, uint32_t /*msg_id
}
else
{
if (!rsMsgs->joinPublicChatLobby(lobby_id))
if (!rsMsgs->joinVisibleChatLobby(lobby_id))
{
std::cerr << "ERROR joinPublicChatLobby FAILED";
std::cerr << std::endl;
@ -1132,7 +1133,7 @@ bool fillLobbyInfoFromChatLobbyInfo(const ChatLobbyInfo &cli, rsctrl::chat::Chat
}
bool fillLobbyInfoFromPublicChatLobbyRecord(const PublicChatLobbyRecord &pclr, rsctrl::chat::ChatLobbyInfo *lobby)
bool fillLobbyInfoFromVisibleChatLobbyRecord(const VisibleChatLobbyRecord &pclr, rsctrl::chat::ChatLobbyInfo *lobby)
{
/* convert info into response */
std::string chat_id;
@ -1150,8 +1151,17 @@ bool fillLobbyInfoFromPublicChatLobbyRecord(const PublicChatLobbyRecord &pclr, r
lobby->set_lobby_nickname(nick);
lobby->set_privacy_level(rsctrl::chat::PRIVACY_PUBLIC);
lobby->set_lobby_state(rsctrl::chat::ChatLobbyInfo::LOBBYSTATE_PUBLIC);
// Could be Private or Public.
if (pclr.lobby_privacy_level & RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE)
{
lobby->set_privacy_level(rsctrl::chat::PRIVACY_PRIVATE);
}
else
{
lobby->set_privacy_level(rsctrl::chat::PRIVACY_PUBLIC);
}
// TODO.
lobby->set_lobby_state(rsctrl::chat::ChatLobbyInfo::LOBBYSTATE_VISIBLE);
lobby->set_no_peers(pclr.total_number_of_peers);

View File

@ -125,7 +125,7 @@ int RpcProtoFiles::processReqTransferList(uint32_t chan_id, uint32_t msg_id, uin
std::string errorMsg;
std::list<std::string> file_list;
int hints = 0;
FileSearchFlags hints(0);
/* convert msg parameters into local ones */
switch(req.direction())
@ -236,7 +236,7 @@ int RpcProtoFiles::processReqControlDownload(uint32_t chan_id, uint32_t msg_id,
// We Set NETWORK_WIDE flag here -> as files will be found via search.
// If this changes, we might be adjust flag (or pass it in!)
if (!rsFiles -> FileRequest(filename, filehash, filesize,
"", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
"", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds))
{
success = false;
errorMsg = "FileRequest ERROR";

View File

@ -127,7 +127,7 @@ int RpcProtoSystem::processSystemStatus(uint32_t chan_id, uint32_t msg_id, uint3
float downKb = 0;
float upKb = 0;
rsicontrol -> ConfigGetDataRates(downKb, upKb);
rsConfig->GetCurrentDataRates(downKb, upKb);
// set the data.
resp.set_no_peers(nTotal);

View File

@ -60,7 +60,7 @@ message ChatLobbyInfo {
enum LobbyState {
LOBBYSTATE_JOINED = 1;
LOBBYSTATE_INVITED = 2;
LOBBYSTATE_PUBLIC = 3;
LOBBYSTATE_VISIBLE = 3;
}
required LobbyPrivacyLevel privacy_level = 5;
@ -116,7 +116,7 @@ message RequestChatLobbies {
LOBBYSET_ALL = 1;
LOBBYSET_JOINED = 2;
LOBBYSET_INVITED = 3;
LOBBYSET_PUBLIC = 4;
LOBBYSET_VISIBLE = 4;
}
required LobbySet lobby_set = 1;