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 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 ; }
inline bool operator& (const t_RsFlags32<n>& f) const { return (_bits & f._bits)>0 ; } 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 ;} 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 ; std::string lobby_topic ;
uint32_t lobby_privacy_level ; uint32_t lobby_privacy_level ;
}; };
class VisibleChatLobbyRecord class VisibleChatLobbyRecord
{ {
public: public:
@ -178,6 +179,8 @@ class VisibleChatLobbyRecord
time_t last_report_time ; // last time the lobby was reported. 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 uint32_t lobby_privacy_level ; // see RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC / RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE
}; };
class ChatLobbyInfo class ChatLobbyInfo
{ {
public: public:

View File

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

View File

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

View File

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

View File

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

View File

@ -53,11 +53,11 @@ class ResponseSendMessage;
enum ChatLobbyInfo_LobbyState { enum ChatLobbyInfo_LobbyState {
ChatLobbyInfo_LobbyState_LOBBYSTATE_JOINED = 1, ChatLobbyInfo_LobbyState_LOBBYSTATE_JOINED = 1,
ChatLobbyInfo_LobbyState_LOBBYSTATE_INVITED = 2, ChatLobbyInfo_LobbyState_LOBBYSTATE_INVITED = 2,
ChatLobbyInfo_LobbyState_LOBBYSTATE_PUBLIC = 3 ChatLobbyInfo_LobbyState_LOBBYSTATE_VISIBLE = 3
}; };
bool ChatLobbyInfo_LobbyState_IsValid(int value); bool ChatLobbyInfo_LobbyState_IsValid(int value);
const ChatLobbyInfo_LobbyState ChatLobbyInfo_LobbyState_LobbyState_MIN = ChatLobbyInfo_LobbyState_LOBBYSTATE_JOINED; 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 int ChatLobbyInfo_LobbyState_LobbyState_ARRAYSIZE = ChatLobbyInfo_LobbyState_LobbyState_MAX + 1;
const ::google::protobuf::EnumDescriptor* ChatLobbyInfo_LobbyState_descriptor(); const ::google::protobuf::EnumDescriptor* ChatLobbyInfo_LobbyState_descriptor();
@ -74,11 +74,11 @@ enum RequestChatLobbies_LobbySet {
RequestChatLobbies_LobbySet_LOBBYSET_ALL = 1, RequestChatLobbies_LobbySet_LOBBYSET_ALL = 1,
RequestChatLobbies_LobbySet_LOBBYSET_JOINED = 2, RequestChatLobbies_LobbySet_LOBBYSET_JOINED = 2,
RequestChatLobbies_LobbySet_LOBBYSET_INVITED = 3, RequestChatLobbies_LobbySet_LOBBYSET_INVITED = 3,
RequestChatLobbies_LobbySet_LOBBYSET_PUBLIC = 4 RequestChatLobbies_LobbySet_LOBBYSET_VISIBLE = 4
}; };
bool RequestChatLobbies_LobbySet_IsValid(int value); bool RequestChatLobbies_LobbySet_IsValid(int value);
const RequestChatLobbies_LobbySet RequestChatLobbies_LobbySet_LobbySet_MIN = RequestChatLobbies_LobbySet_LOBBYSET_ALL; 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 int RequestChatLobbies_LobbySet_LobbySet_ARRAYSIZE = RequestChatLobbies_LobbySet_LobbySet_MAX + 1;
const ::google::protobuf::EnumDescriptor* RequestChatLobbies_LobbySet_descriptor(); const ::google::protobuf::EnumDescriptor* RequestChatLobbies_LobbySet_descriptor();
@ -271,7 +271,7 @@ class ChatLobbyInfo : public ::google::protobuf::Message {
typedef ChatLobbyInfo_LobbyState LobbyState; typedef ChatLobbyInfo_LobbyState LobbyState;
static const LobbyState LOBBYSTATE_JOINED = ChatLobbyInfo_LobbyState_LOBBYSTATE_JOINED; static const LobbyState LOBBYSTATE_JOINED = ChatLobbyInfo_LobbyState_LOBBYSTATE_JOINED;
static const LobbyState LOBBYSTATE_INVITED = ChatLobbyInfo_LobbyState_LOBBYSTATE_INVITED; 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) { static inline bool LobbyState_IsValid(int value) {
return ChatLobbyInfo_LobbyState_IsValid(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_ALL = RequestChatLobbies_LobbySet_LOBBYSET_ALL;
static const LobbySet LOBBYSET_JOINED = RequestChatLobbies_LobbySet_LOBBYSET_JOINED; static const LobbySet LOBBYSET_JOINED = RequestChatLobbies_LobbySet_LOBBYSET_JOINED;
static const LobbySet LOBBYSET_INVITED = RequestChatLobbies_LobbySet_LOBBYSET_INVITED; 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) { static inline bool LobbySet_IsValid(int value) {
return RequestChatLobbies_LobbySet_IsValid(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 convertLobbyIdToString(const ChatLobbyId &lobby_id, std::string &chat_id);
bool fillLobbyInfoFromChatLobbyInfo(const ChatLobbyInfo &cfi, rsctrl::chat::ChatLobbyInfo *lobby); 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 fillLobbyInfoFromChatLobbyInvite(const ChatLobbyInvite &cli, rsctrl::chat::ChatLobbyInfo *lobby);
bool createQueuedEventSendMsg(const ChatInfo &chatinfo, rsctrl::chat::ChatType ctype, 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: case rsctrl::chat::MsgId_RequestChatLobbies:
processReqChatLobbies(chan_id, msg_id, req_id, msg); processReqChatLobbies(chan_id, msg_id, req_id, msg);
break; break;
case rsctrl::chat::MsgId_RequestCreateLobby: case rsctrl::chat::MsgId_RequestCreateLobby:
processReqCreateLobby(chan_id, msg_id, req_id, msg); processReqCreateLobby(chan_id, msg_id, req_id, msg);
break; break;
@ -163,7 +164,7 @@ int RpcProtoChat::processReqChatLobbies(uint32_t chan_id, uint32_t /*msg_id*/, u
// set these flags from request. // set these flags from request.
bool fetch_chatlobbylist = true; bool fetch_chatlobbylist = true;
bool fetch_invites = true; bool fetch_invites = true;
bool fetch_publiclobbies = true; bool fetch_visiblelobbies = true;
switch(req.lobby_set()) switch(req.lobby_set())
{ {
@ -172,28 +173,28 @@ int RpcProtoChat::processReqChatLobbies(uint32_t chan_id, uint32_t /*msg_id*/, u
std::cerr << std::endl; std::cerr << std::endl;
fetch_chatlobbylist = true; fetch_chatlobbylist = true;
fetch_invites = true; fetch_invites = true;
fetch_publiclobbies = true; fetch_visiblelobbies = true;
break; break;
case rsctrl::chat::RequestChatLobbies::LOBBYSET_JOINED: case rsctrl::chat::RequestChatLobbies::LOBBYSET_JOINED:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_JOINED"; std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_JOINED";
std::cerr << std::endl; std::cerr << std::endl;
fetch_chatlobbylist = true; fetch_chatlobbylist = true;
fetch_invites = false; fetch_invites = false;
fetch_publiclobbies = false; fetch_visiblelobbies = false;
break; break;
case rsctrl::chat::RequestChatLobbies::LOBBYSET_INVITED: case rsctrl::chat::RequestChatLobbies::LOBBYSET_INVITED:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_INVITED"; std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_INVITED";
std::cerr << std::endl; std::cerr << std::endl;
fetch_chatlobbylist = false; fetch_chatlobbylist = false;
fetch_invites = true; fetch_invites = true;
fetch_publiclobbies = false; fetch_visiblelobbies = false;
break; break;
case rsctrl::chat::RequestChatLobbies::LOBBYSET_PUBLIC: case rsctrl::chat::RequestChatLobbies::LOBBYSET_VISIBLE:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_PUBLIC"; std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET_VISIBLE";
std::cerr << std::endl; std::cerr << std::endl;
fetch_chatlobbylist = false; fetch_chatlobbylist = false;
fetch_invites = false; fetch_invites = false;
fetch_publiclobbies = true; fetch_visiblelobbies = true;
break; break;
default: default:
std::cerr << "RpcProtoChat::processReqChatLobbies() LOBBYSET ERROR"; 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 << "RpcProtoChat::processReqChatLobbies() Fetching public lobbies";
std::cerr << std::endl; std::cerr << std::endl;
std::vector<PublicChatLobbyRecord> public_lobbies; std::vector<VisibleChatLobbyRecord> public_lobbies;
std::vector<PublicChatLobbyRecord>::iterator it; std::vector<VisibleChatLobbyRecord>::iterator it;
rsMsgs->getListOfNearbyChatLobbies(public_lobbies); 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()) if (done_lobbies.find(it->lobby_id) == done_lobbies.end())
{ {
rsctrl::chat::ChatLobbyInfo *lobby = resp.add_lobbies(); rsctrl::chat::ChatLobbyInfo *lobby = resp.add_lobbies();
fillLobbyInfoFromPublicChatLobbyRecord(*it, lobby); fillLobbyInfoFromVisibleChatLobbyRecord(*it, lobby);
done_lobbies.insert(it->lobby_id); done_lobbies.insert(it->lobby_id);
@ -530,7 +531,7 @@ int RpcProtoChat::processReqJoinOrLeaveLobby(uint32_t chan_id, uint32_t /*msg_id
} }
else else
{ {
if (!rsMsgs->joinPublicChatLobby(lobby_id)) if (!rsMsgs->joinVisibleChatLobby(lobby_id))
{ {
std::cerr << "ERROR joinPublicChatLobby FAILED"; std::cerr << "ERROR joinPublicChatLobby FAILED";
std::cerr << std::endl; 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 */ /* convert info into response */
std::string chat_id; std::string chat_id;
@ -1150,8 +1151,17 @@ bool fillLobbyInfoFromPublicChatLobbyRecord(const PublicChatLobbyRecord &pclr, r
lobby->set_lobby_nickname(nick); lobby->set_lobby_nickname(nick);
// 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); lobby->set_privacy_level(rsctrl::chat::PRIVACY_PUBLIC);
lobby->set_lobby_state(rsctrl::chat::ChatLobbyInfo::LOBBYSTATE_PUBLIC); }
// TODO.
lobby->set_lobby_state(rsctrl::chat::ChatLobbyInfo::LOBBYSTATE_VISIBLE);
lobby->set_no_peers(pclr.total_number_of_peers); 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::string errorMsg;
std::list<std::string> file_list; std::list<std::string> file_list;
int hints = 0; FileSearchFlags hints(0);
/* convert msg parameters into local ones */ /* convert msg parameters into local ones */
switch(req.direction()) 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. // 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 this changes, we might be adjust flag (or pass it in!)
if (!rsFiles -> FileRequest(filename, filehash, filesize, if (!rsFiles -> FileRequest(filename, filehash, filesize,
"", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds))
{ {
success = false; success = false;
errorMsg = "FileRequest ERROR"; 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 downKb = 0;
float upKb = 0; float upKb = 0;
rsicontrol -> ConfigGetDataRates(downKb, upKb); rsConfig->GetCurrentDataRates(downKb, upKb);
// set the data. // set the data.
resp.set_no_peers(nTotal); resp.set_no_peers(nTotal);

View File

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