mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
- added/fixed patch from defnax to allow setting up a topic for each chat lobby. The topic is displayed to friends.
- handled backward compatibility by keeping/sending old LobbyList item. Should be remove in the near future. - removed constraint to have at least one friends invited when creating a new lobby. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5024 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
42372c4223
commit
65cde95fba
@ -157,6 +157,7 @@ class ChatLobbyInvite
|
||||
ChatLobbyId lobby_id ;
|
||||
std::string peer_id ;
|
||||
std::string lobby_name ;
|
||||
std::string lobby_topic ;
|
||||
uint32_t lobby_privacy_level ;
|
||||
};
|
||||
class PublicChatLobbyRecord
|
||||
@ -166,6 +167,7 @@ class PublicChatLobbyRecord
|
||||
|
||||
ChatLobbyId lobby_id ; // unique id of the lobby
|
||||
std::string lobby_name ; // name to use for this lobby
|
||||
std::string lobby_topic ; // topic to use for this lobby
|
||||
std::set<std::string> participating_friends ; // list of direct friend who participate.
|
||||
|
||||
uint32_t total_number_of_peers ; // total number of particpating peers. Might not be
|
||||
@ -176,6 +178,7 @@ class ChatLobbyInfo
|
||||
public:
|
||||
ChatLobbyId lobby_id ; // unique id of the lobby
|
||||
std::string lobby_name ; // name to use for this lobby
|
||||
std::string lobby_topic ; // topic to use for this lobby
|
||||
std::set<std::string> participating_friends ; // list of direct friend who participate. Used to broadcast sent messages.
|
||||
std::string nick_name ; // nickname to use for this lobby
|
||||
|
||||
@ -206,7 +209,7 @@ virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList) = 0;
|
||||
virtual bool getMessage(const std::string &mId, MessageInfo &msg) = 0;
|
||||
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox) = 0;
|
||||
|
||||
virtual bool MessageSend(MessageInfo &info) = 0;
|
||||
virtual bool MessageSend(MessageInfo &info) = 0;
|
||||
virtual bool MessageToDraft(MessageInfo &info, const std::string &msgParentId) = 0;
|
||||
virtual bool MessageToTrash(const std::string &mid, bool bTrash) = 0;
|
||||
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId) = 0;
|
||||
@ -267,7 +270,7 @@ virtual bool setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::stri
|
||||
virtual bool getNickNameForChatLobby(const ChatLobbyId& lobby_id,std::string& nick) = 0 ;
|
||||
virtual bool setDefaultNickNameForChatLobby(const std::string& nick) = 0;
|
||||
virtual bool getDefaultNickNameForChatLobby(std::string& nick) = 0 ;
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends,uint32_t lobby_privacy_type) = 0 ;
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::string& lobby_topic,const std::list<std::string>& invited_friends,uint32_t lobby_privacy_type) = 0 ;
|
||||
|
||||
/****************************************/
|
||||
|
||||
|
@ -309,9 +309,9 @@ void p3Msgs::getListOfNearbyChatLobbies(std::vector<PublicChatLobbyRecord>& publ
|
||||
mChatSrv->getListOfNearbyChatLobbies(public_lobbies) ;
|
||||
}
|
||||
|
||||
ChatLobbyId p3Msgs::createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends,uint32_t privacy_type)
|
||||
ChatLobbyId p3Msgs::createChatLobby(const std::string& lobby_name,const std::string& lobby_topic,const std::list<std::string>& invited_friends,uint32_t privacy_type)
|
||||
{
|
||||
return mChatSrv->createChatLobby(lobby_name,invited_friends,privacy_type) ;
|
||||
return mChatSrv->createChatLobby(lobby_name,lobby_topic,invited_friends,privacy_type) ;
|
||||
}
|
||||
|
||||
bool p3Msgs::acceptLobbyInvite(const ChatLobbyId& id)
|
||||
|
@ -182,7 +182,7 @@ class p3Msgs: public RsMsgs
|
||||
virtual bool getNickNameForChatLobby(const ChatLobbyId&,std::string& nick) ;
|
||||
virtual bool setDefaultNickNameForChatLobby(const std::string&) ;
|
||||
virtual bool getDefaultNickNameForChatLobby(std::string& nick) ;
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends,uint32_t privacy_type) ;
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::string& lobby_topic,const std::list<std::string>& invited_friends,uint32_t privacy_type) ;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -56,6 +56,19 @@ std::ostream& RsChatMsgItem::print(std::ostream &out, uint16_t indent)
|
||||
printRsItemEnd(out, "RsChatMsgItem", indent);
|
||||
return out;
|
||||
}
|
||||
std::ostream& RsChatLobbyListItem_deprecated::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsChatLobbyListItem_deprecated", indent);
|
||||
|
||||
for(uint32_t i=0;i<lobby_ids.size();++i)
|
||||
{
|
||||
printIndent(out, indent+2);
|
||||
out << "lobby 0x" << std::hex << lobby_ids[i] << std::dec << " (name=\"" << lobby_names[i] << "\", count=" << lobby_counts[i] << std::endl ;
|
||||
}
|
||||
|
||||
printRsItemEnd(out, "RsChatLobbyListItem_deprecated", indent);
|
||||
return out;
|
||||
}
|
||||
std::ostream& RsChatLobbyListItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsChatLobbyListItem", indent);
|
||||
@ -63,7 +76,7 @@ std::ostream& RsChatLobbyListItem::print(std::ostream &out, uint16_t indent)
|
||||
for(uint32_t i=0;i<lobby_ids.size();++i)
|
||||
{
|
||||
printIndent(out, indent+2);
|
||||
out << "lobby 0x" << std::hex << lobby_ids[i] << std::dec << " (name=\"" << lobby_names[i] << "\", count=" << lobby_counts[i] << std::endl ;
|
||||
out << "lobby 0x" << std::hex << lobby_ids[i] << std::dec << " (name=\"" << lobby_names[i] << "\", topic="<< lobby_topics[i] << "\", count=" << lobby_counts[i] << std::endl ;
|
||||
}
|
||||
|
||||
printRsItemEnd(out, "RsChatLobbyListItem", indent);
|
||||
@ -131,6 +144,9 @@ std::ostream& RsChatLobbyInviteItem::print(std::ostream &out, uint16_t indent)
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "lobby name: " << lobby_name << std::endl;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "lobby topic: " << lobby_topic << std::endl;
|
||||
|
||||
printRsItemEnd(out, "RsChatLobbyInviteItem", indent);
|
||||
return out;
|
||||
@ -225,6 +241,7 @@ RsItem *RsChatSerialiser::deserialise(void *data, uint32_t *pktsize)
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT: return new RsChatLobbyEventItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem(data,*pktsize) ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated: return new RsChatLobbyListItem_deprecated(data,*pktsize) ;
|
||||
default:
|
||||
std::cerr << "Unknown packet type in chat!" << std::endl ;
|
||||
return NULL ;
|
||||
@ -282,6 +299,18 @@ uint32_t RsChatLobbyListRequestItem::serial_size()
|
||||
uint32_t s = 8 ; // header
|
||||
return s ;
|
||||
}
|
||||
uint32_t RsChatLobbyListItem_deprecated::serial_size()
|
||||
{
|
||||
uint32_t s = 8 ; // header
|
||||
s += 4 ; // number of elements in the vectors
|
||||
s += lobby_ids.size() * 8 ; // lobby_ids
|
||||
|
||||
for(uint32_t i=0;i<lobby_names.size();++i)
|
||||
s += GetTlvStringSize(lobby_names[i]) ; // lobby_names
|
||||
|
||||
s += lobby_counts.size() * 4 ; // lobby_counts
|
||||
return s ;
|
||||
}
|
||||
uint32_t RsChatLobbyListItem::serial_size()
|
||||
{
|
||||
uint32_t s = 8 ; // header
|
||||
@ -290,11 +319,13 @@ uint32_t RsChatLobbyListItem::serial_size()
|
||||
|
||||
for(uint32_t i=0;i<lobby_names.size();++i)
|
||||
s += GetTlvStringSize(lobby_names[i]) ; // lobby_names
|
||||
|
||||
for(uint32_t i=0;i<lobby_topics.size();++i)
|
||||
s += GetTlvStringSize(lobby_topics[i]) ; // lobby_topics
|
||||
|
||||
s += lobby_counts.size() * 4 ; // lobby_counts
|
||||
return s ;
|
||||
}
|
||||
|
||||
uint32_t RsChatLobbyMsgItem::serial_size()
|
||||
{
|
||||
uint32_t s = RsChatMsgItem::serial_size() ; // parent
|
||||
@ -459,7 +490,40 @@ bool RsChatLobbyListRequestItem::serialise(void *data, uint32_t& pktsize)
|
||||
pktsize = tlvsize ;
|
||||
return ok ;
|
||||
}
|
||||
bool RsChatLobbyListItem_deprecated::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = serial_size() ;
|
||||
bool ok = true ;
|
||||
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); // correct header!
|
||||
|
||||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
if(lobby_ids.size() != lobby_counts.size() || lobby_ids.size() != lobby_names.size())
|
||||
{
|
||||
std::cerr << "Consistency error in RsChatLobbyListItem!! Sizes don't match!" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
pktsize = tlvsize ;
|
||||
|
||||
uint32_t offset = 8 ;
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobby_ids.size());
|
||||
|
||||
for(uint32_t i=0;i<lobby_ids.size();++i)
|
||||
{
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_ids[i]);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobby_names[i]);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobby_counts[i]);
|
||||
}
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||
#endif
|
||||
}
|
||||
return ok ;
|
||||
}
|
||||
bool RsChatLobbyListItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
uint32_t tlvsize = serial_size() ;
|
||||
@ -483,6 +547,7 @@ bool RsChatLobbyListItem::serialise(void *data, uint32_t& pktsize)
|
||||
{
|
||||
ok &= setRawUInt64(data, tlvsize, &offset, lobby_ids[i]);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobby_names[i]);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobby_topics[i]);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, lobby_counts[i]);
|
||||
}
|
||||
if (offset != tlvsize)
|
||||
@ -793,9 +858,8 @@ RsChatLobbyListRequestItem::RsChatLobbyListRequestItem(void *data,uint32_t)
|
||||
if (!ok)
|
||||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
|
||||
RsChatLobbyListItem::RsChatLobbyListItem(void *data,uint32_t)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_LIST)
|
||||
RsChatLobbyListItem_deprecated::RsChatLobbyListItem_deprecated(void *data,uint32_t)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated)
|
||||
{
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
bool ok = true ;
|
||||
@ -820,6 +884,34 @@ RsChatLobbyListItem::RsChatLobbyListItem(void *data,uint32_t)
|
||||
if (!ok)
|
||||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
RsChatLobbyListItem::RsChatLobbyListItem(void *data,uint32_t)
|
||||
: RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_LIST)
|
||||
{
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
bool ok = true ;
|
||||
uint32_t offset = 8; // skip the header
|
||||
|
||||
uint32_t n=0 ;
|
||||
ok &= getRawUInt32(data, rssize, &offset, &n);
|
||||
|
||||
lobby_ids.resize(n) ;
|
||||
lobby_names.resize(n) ;
|
||||
lobby_topics.resize(n) ;
|
||||
lobby_counts.resize(n) ;
|
||||
|
||||
for(uint32_t i=0;i<n;++i)
|
||||
{
|
||||
ok &= getRawUInt64(data, rssize, &offset, &lobby_ids[i]);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobby_names[i]);
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobby_topics[i]);
|
||||
ok &= getRawUInt32(data, rssize, &offset, &lobby_counts[i]);
|
||||
}
|
||||
|
||||
if (offset != rssize)
|
||||
std::cerr << "Size error while deserializing." << std::endl ;
|
||||
if (!ok)
|
||||
std::cerr << "Unknown error while deserializing." << std::endl ;
|
||||
}
|
||||
|
||||
bool RsChatLobbyBouncingObject::deserialise(void *data,uint32_t rssize,uint32_t& offset)
|
||||
{
|
||||
|
@ -59,9 +59,10 @@ const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE = 0x0A ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT_DEPREC = 0x0B ; // don't use ! Deprecated
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG = 0x0C ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST = 0x0D ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST = 0x0E ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated = 0x0E ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x0F ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT = 0x10 ;
|
||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST = 0x11 ;
|
||||
|
||||
// for defining tags themselves and msg tags
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_TAG_TYPE = 0x03;
|
||||
@ -183,6 +184,22 @@ class RsChatLobbyListRequestItem: public RsChatItem
|
||||
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
};
|
||||
class RsChatLobbyListItem_deprecated: public RsChatItem
|
||||
{
|
||||
public:
|
||||
RsChatLobbyListItem_deprecated() : RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated) {}
|
||||
RsChatLobbyListItem_deprecated(void *data,uint32_t size) ;
|
||||
virtual ~RsChatLobbyListItem_deprecated() {}
|
||||
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) ;
|
||||
virtual uint32_t serial_size() ;
|
||||
|
||||
std::vector<ChatLobbyId> lobby_ids ;
|
||||
std::vector<std::string> lobby_names ;
|
||||
std::vector<uint32_t> lobby_counts ;
|
||||
};
|
||||
class RsChatLobbyListItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
@ -197,9 +214,9 @@ class RsChatLobbyListItem: public RsChatItem
|
||||
|
||||
std::vector<ChatLobbyId> lobby_ids ;
|
||||
std::vector<std::string> lobby_names ;
|
||||
std::vector<std::string> lobby_topics ;
|
||||
std::vector<uint32_t> lobby_counts ;
|
||||
};
|
||||
|
||||
class RsChatLobbyUnsubscribeItem: public RsChatItem
|
||||
{
|
||||
public:
|
||||
@ -242,6 +259,7 @@ class RsChatLobbyInviteItem: public RsChatItem
|
||||
|
||||
ChatLobbyId lobby_id ;
|
||||
std::string lobby_name ;
|
||||
std::string lobby_topic ;
|
||||
uint32_t lobby_privacy_level ;
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
|
||||
|
@ -317,6 +317,7 @@ void p3ChatService::locked_printDebugInfo() const
|
||||
{
|
||||
std::cerr << " Lobby id\t\t: " << std::hex << it->first << std::dec << std::endl;
|
||||
std::cerr << " Lobby name\t\t: " << it->second.lobby_name << std::endl;
|
||||
std::cerr << " Lobby topic\t\t: " << it->second.lobby_topic << std::endl;
|
||||
std::cerr << " nick name\t\t: " << it->second.nick_name << std::endl;
|
||||
std::cerr << " Lobby type\t\t: " << ((it->second.lobby_privacy_level==RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC)?"Public":"private") << std::endl;
|
||||
std::cerr << " Lobby peer id\t: " << it->second.virtual_peer_id << std::endl;
|
||||
@ -348,7 +349,7 @@ void p3ChatService::locked_printDebugInfo() const
|
||||
|
||||
for( std::map<ChatLobbyId,PublicChatLobbyRecord>::const_iterator it(_public_lobbies.begin()) ;it!=_public_lobbies.end();++it)
|
||||
{
|
||||
std::cerr << " " << std::hex << it->first << " name = " << std::dec << it->second.lobby_name << std::endl;
|
||||
std::cerr << " " << std::hex << it->first << " name = " << std::dec << it->second.lobby_name << it->second.lobby_topic << std::endl;
|
||||
for(std::set<std::string>::const_iterator it2(it->second.participating_friends.begin());it2!=it->second.participating_friends.end();++it2)
|
||||
std::cerr << " With friend: " << *it2 << std::endl;
|
||||
}
|
||||
@ -628,6 +629,7 @@ void p3ChatService::receiveChatQueue()
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: handleFriendUnsubscribeLobby (dynamic_cast<RsChatLobbyUnsubscribeItem *>(item)) ; break ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: handleRecvChatLobbyListRequest(dynamic_cast<RsChatLobbyListRequestItem *>(item)) ; break ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: handleRecvChatLobbyList (dynamic_cast<RsChatLobbyListItem *>(item)) ; break ;
|
||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_deprecated: handleRecvChatLobbyList (dynamic_cast<RsChatLobbyListItem_deprecated *>(item)) ; break ;
|
||||
|
||||
default:
|
||||
std::cerr << "Unhandled item subtype " << item->PacketSubType() << " in p3ChatService: " << std::endl;
|
||||
@ -653,11 +655,12 @@ void p3ChatService::handleRecvChatLobbyListRequest(RsChatLobbyListRequestItem *c
|
||||
if(it->second.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC)
|
||||
{
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << " Adding lobby " << std::hex << it->first << std::dec << " \"" << it->second.lobby_name << "\" count=" << it->second.nick_names.size() << std::endl;
|
||||
std::cerr << " Adding lobby " << std::hex << it->first << std::dec << " \"" << it->second.lobby_name << it->second.lobby_topic << "\" count=" << it->second.nick_names.size() << std::endl;
|
||||
#endif
|
||||
|
||||
item->lobby_ids.push_back(it->first) ;
|
||||
item->lobby_names.push_back(it->second.lobby_name) ;
|
||||
item->lobby_topics.push_back(it->second.lobby_topic) ;
|
||||
item->lobby_counts.push_back(it->second.nick_names.size()) ;
|
||||
}
|
||||
#ifdef CHAT_DEBUG
|
||||
@ -672,8 +675,47 @@ void p3ChatService::handleRecvChatLobbyListRequest(RsChatLobbyListRequestItem *c
|
||||
std::cerr << " Sending list to " << clr->PeerId() << std::endl;
|
||||
#endif
|
||||
sendItem(item);
|
||||
}
|
||||
|
||||
// *********** Also send an item in old format. To be removed.
|
||||
|
||||
RsChatLobbyListItem_deprecated *itemd = new RsChatLobbyListItem_deprecated;
|
||||
itemd->lobby_ids = item->lobby_ids ;
|
||||
itemd->lobby_names = item->lobby_names ;
|
||||
itemd->lobby_counts = item->lobby_counts ;
|
||||
itemd->PeerId(clr->PeerId()) ;
|
||||
|
||||
sendItem(itemd) ;
|
||||
|
||||
// End of part to remove in future versions. *************
|
||||
}
|
||||
void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem_deprecated *item)
|
||||
{
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
for(uint32_t i=0;i<item->lobby_ids.size();++i)
|
||||
{
|
||||
PublicChatLobbyRecord& rec(_public_lobbies[item->lobby_ids[i]]) ;
|
||||
|
||||
rec.lobby_id = item->lobby_ids[i] ;
|
||||
rec.lobby_name = item->lobby_names[i] ;
|
||||
rec.lobby_topic = "[Old format: no topic provided]" ;
|
||||
rec.participating_friends.insert(item->PeerId()) ;
|
||||
|
||||
if(_should_reset_lobby_counts)
|
||||
rec.total_number_of_peers = item->lobby_counts[i] ;
|
||||
else
|
||||
rec.total_number_of_peers = std::max(rec.total_number_of_peers,item->lobby_counts[i]) ;
|
||||
|
||||
rec.last_report_time = now ;
|
||||
}
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
_should_reset_lobby_counts = false ;
|
||||
}
|
||||
void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
|
||||
{
|
||||
{
|
||||
@ -687,6 +729,7 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
|
||||
|
||||
rec.lobby_id = item->lobby_ids[i] ;
|
||||
rec.lobby_name = item->lobby_names[i] ;
|
||||
rec.lobby_topic = item->lobby_topics[i] ;
|
||||
rec.participating_friends.insert(item->PeerId()) ;
|
||||
|
||||
if(_should_reset_lobby_counts)
|
||||
@ -1973,6 +2016,7 @@ void p3ChatService::invitePeerToLobby(const ChatLobbyId& lobby_id, const std::st
|
||||
}
|
||||
item->lobby_id = lobby_id ;
|
||||
item->lobby_name = it->second.lobby_name ;
|
||||
item->lobby_topic = it->second.lobby_topic ;
|
||||
item->lobby_privacy_level = connexion_challenge?RS_CHAT_LOBBY_PRIVACY_LEVEL_CHALLENGE:(it->second.lobby_privacy_level) ;
|
||||
item->PeerId(peer_id) ;
|
||||
|
||||
@ -1981,7 +2025,7 @@ void p3ChatService::invitePeerToLobby(const ChatLobbyId& lobby_id, const std::st
|
||||
void p3ChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
|
||||
{
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Received invite to lobby from " << item->PeerId() << " to lobby " << std::hex << item->lobby_id << std::dec << ", named " << item->lobby_name << std::endl;
|
||||
std::cerr << "Received invite to lobby from " << item->PeerId() << " to lobby " << std::hex << item->lobby_id << std::dec << ", named " << item->lobby_name << item->lobby_topic << std::endl;
|
||||
#endif
|
||||
|
||||
// 1 - store invite in a cache
|
||||
@ -2026,6 +2070,7 @@ void p3ChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
|
||||
invite.lobby_id = item->lobby_id ;
|
||||
invite.peer_id = item->PeerId() ;
|
||||
invite.lobby_name = item->lobby_name ;
|
||||
invite.lobby_topic = item->lobby_topic ;
|
||||
invite.lobby_privacy_level = item->lobby_privacy_level ;
|
||||
|
||||
_lobby_invites_queue[item->lobby_id] = invite ;
|
||||
@ -2078,6 +2123,7 @@ bool p3ChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id)
|
||||
entry.nick_name = _default_nick_name ;
|
||||
entry.lobby_id = lobby_id ;
|
||||
entry.lobby_name = it->second.lobby_name ;
|
||||
entry.lobby_topic = it->second.lobby_topic ;
|
||||
entry.virtual_peer_id = makeVirtualPeerId(lobby_id) ;
|
||||
entry.connexion_challenge_count = 0 ;
|
||||
entry.last_activity = now ;
|
||||
@ -2187,6 +2233,7 @@ bool p3ChatService::joinPublicChatLobby(const ChatLobbyId& lobby_id)
|
||||
entry.nick_name = _default_nick_name ;
|
||||
entry.lobby_id = lobby_id ;
|
||||
entry.lobby_name = it->second.lobby_name ;
|
||||
entry.lobby_topic = it->second.lobby_topic ;
|
||||
entry.virtual_peer_id = makeVirtualPeerId(lobby_id) ;
|
||||
entry.connexion_challenge_count = 0 ;
|
||||
entry.last_activity = now ;
|
||||
@ -2212,7 +2259,7 @@ bool p3ChatService::joinPublicChatLobby(const ChatLobbyId& lobby_id)
|
||||
return true ;
|
||||
}
|
||||
|
||||
ChatLobbyId p3ChatService::createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends,uint32_t privacy_level)
|
||||
ChatLobbyId p3ChatService::createChatLobby(const std::string& lobby_name,const std::string& lobby_topic,const std::list<std::string>& invited_friends,uint32_t privacy_level)
|
||||
{
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Creating a new Chat lobby !!" << std::endl;
|
||||
@ -2236,6 +2283,7 @@ ChatLobbyId p3ChatService::createChatLobby(const std::string& lobby_name,const s
|
||||
entry.nick_name = _default_nick_name ; // to be changed. For debug only!!
|
||||
entry.lobby_id = lobby_id ;
|
||||
entry.lobby_name = lobby_name ;
|
||||
entry.lobby_topic = lobby_topic ;
|
||||
entry.virtual_peer_id = makeVirtualPeerId(lobby_id) ;
|
||||
entry.connexion_challenge_count = 0 ;
|
||||
entry.last_activity = now ;
|
||||
|
@ -167,7 +167,7 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
|
||||
bool setDefaultNickNameForChatLobby(const std::string& nick) ;
|
||||
bool getDefaultNickNameForChatLobby(std::string& nick) ;
|
||||
void sendLobbyStatusString(const ChatLobbyId& id,const std::string& status_string) ;
|
||||
ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends,uint32_t privacy_type) ;
|
||||
ChatLobbyId createChatLobby(const std::string& lobby_name,const std::string& lobby_topic, const std::list<std::string>& invited_friends,uint32_t privacy_type) ;
|
||||
|
||||
void getListOfNearbyChatLobbies(std::vector<PublicChatLobbyRecord>& public_lobbies) ;
|
||||
bool joinPublicChatLobby(const ChatLobbyId& id) ;
|
||||
@ -211,6 +211,7 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
|
||||
void handleRecvChatAvatarItem(RsChatAvatarItem *item) ;
|
||||
void handleRecvChatLobbyListRequest(RsChatLobbyListRequestItem *item) ;
|
||||
void handleRecvChatLobbyList(RsChatLobbyListItem *item) ;
|
||||
void handleRecvChatLobbyList(RsChatLobbyListItem_deprecated *item) ;
|
||||
void handleRecvChatLobbyEventItem(RsChatLobbyEventItem *item) ;
|
||||
|
||||
/// Sends a request for an avatar to the peer of given id
|
||||
|
@ -13,7 +13,8 @@
|
||||
|
||||
#define COLUMN_NAME 0
|
||||
#define COLUMN_USER_COUNT 1
|
||||
#define COLUMN_COUNT 2
|
||||
#define COLUMN_TOPIC 2
|
||||
#define COLUMN_COUNT 3
|
||||
|
||||
#define COLUMN_DATA 0
|
||||
#define ROLE_SORT Qt::UserRole
|
||||
@ -53,12 +54,15 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
|
||||
QTreeWidgetItem *headerItem = lobbyTreeWidget->headerItem();
|
||||
headerItem->setText(COLUMN_NAME, tr("Name"));
|
||||
headerItem->setText(COLUMN_USER_COUNT, tr("Count"));
|
||||
headerItem->setText(COLUMN_TOPIC, tr("Topic"));
|
||||
headerItem->setTextAlignment(COLUMN_NAME, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
headerItem->setTextAlignment(COLUMN_TOPIC, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
headerItem->setTextAlignment(COLUMN_USER_COUNT, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
QHeaderView *header = lobbyTreeWidget->header();
|
||||
header->setResizeMode(COLUMN_NAME, QHeaderView::Interactive);
|
||||
header->setResizeMode(COLUMN_USER_COUNT, QHeaderView::Stretch);
|
||||
header->setResizeMode(COLUMN_USER_COUNT, QHeaderView::Interactive);
|
||||
header->setResizeMode(COLUMN_TOPIC, QHeaderView::Stretch);
|
||||
|
||||
lobbyTreeWidget->setColumnWidth(COLUMN_NAME, 200);
|
||||
lobbyTreeWidget->setColumnWidth(COLUMN_USER_COUNT, 50);
|
||||
@ -115,11 +119,14 @@ void ChatLobbyWidget::lobbyChanged()
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
static void updateItem(QTreeWidgetItem *item, ChatLobbyId id, const std::string &name, int count, bool subscribed)
|
||||
static void updateItem(QTreeWidgetItem *item, ChatLobbyId id, const std::string &name, const std::string &topic, int count, bool subscribed)
|
||||
{
|
||||
item->setText(COLUMN_NAME, QString::fromUtf8(name.c_str()));
|
||||
item->setData(COLUMN_NAME, ROLE_SORT, QString::fromUtf8(name.c_str()));
|
||||
|
||||
item->setText(COLUMN_TOPIC, QString::fromUtf8(topic.c_str()));
|
||||
item->setData(COLUMN_TOPIC, ROLE_SORT, QString::fromUtf8(topic.c_str()));
|
||||
|
||||
item->setText(COLUMN_USER_COUNT, QString::number(count));
|
||||
|
||||
item->setData(COLUMN_DATA, ROLE_ID, (qulonglong)id);
|
||||
@ -188,7 +195,7 @@ void ChatLobbyWidget::updateDisplay()
|
||||
const PublicChatLobbyRecord &lobby = publicLobbies[i];
|
||||
|
||||
#ifdef CHAT_LOBBY_GUI_DEBUG
|
||||
std::cerr << "adding " << lobby.lobby_name << " #" << std::hex << lobby.lobby_id << std::dec << " public " << lobby.total_number_of_peers << " peers." << std::endl;
|
||||
std::cerr << "adding " << lobby.lobby_name << "topic " << lobby.lobby_topic << " #" << std::hex << lobby.lobby_id << std::dec << " public " << lobby.total_number_of_peers << " peers." << std::endl;
|
||||
#endif
|
||||
|
||||
QTreeWidgetItem *item = NULL;
|
||||
@ -215,7 +222,7 @@ void ChatLobbyWidget::updateDisplay()
|
||||
subscribed = true;
|
||||
}
|
||||
|
||||
updateItem(item, lobby.lobby_id, lobby.lobby_name, lobby.total_number_of_peers, subscribed);
|
||||
updateItem(item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.total_number_of_peers, subscribed);
|
||||
}
|
||||
|
||||
// remove not existing private lobbies
|
||||
@ -244,7 +251,7 @@ void ChatLobbyWidget::updateDisplay()
|
||||
const ChatLobbyInfo &lobby = *lobbyIt;
|
||||
|
||||
#ifdef CHAT_LOBBY_GUI_DEBUG
|
||||
std::cerr << "adding " << lobby.lobby_name << " #" << std::hex << lobby.lobby_id << std::dec << " private " << lobby.nick_names.size() << " peers." << std::endl;
|
||||
std::cerr << "adding " << lobby.lobby_name << "topic " << lobby.lobby_topic << " #" << std::hex << lobby.lobby_id << std::dec << " private " << lobby.nick_names.size() << " peers." << std::endl;
|
||||
#endif
|
||||
|
||||
QTreeWidgetItem *itemParent;
|
||||
@ -277,7 +284,7 @@ void ChatLobbyWidget::updateDisplay()
|
||||
item->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE));
|
||||
}
|
||||
|
||||
updateItem(item, lobby.lobby_id, lobby.lobby_name, lobby.nick_names.size(), true);
|
||||
updateItem(item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.nick_names.size(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,89 +10,87 @@
|
||||
<height>397</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>256</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"> QFrame#frame_2{
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"> QFrame#frame_2{
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #FEFEFE, stop:1 #E8E8E8);
|
||||
|
||||
border: 1px solid #CCCCCC;}
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="images.qrc">:/images/user/agt_forum24.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="friendslabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<property name="pixmap">
|
||||
<pixmap resource="images.qrc">:/images/user/agt_forum24.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="friendslabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Chat lobbies</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="newlobbypushButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create new chat lobby</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton::menu-indicator {
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="newlobbypushButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create new chat lobby</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton::menu-indicator {
|
||||
subcontrol-origin: padding;
|
||||
subcontrol-position: bottom right;
|
||||
}
|
||||
@ -105,79 +103,74 @@ p, li { white-space: pre-wrap; }
|
||||
QPushButton:hover {
|
||||
border: 1px solid #CCCCCC;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>123</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeWidget" name="lobbyTreeWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="expandsOnDoubleClick">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>123</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QWidget" name="lobbyInfo" native="true"/>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeWidget" name="lobbyTreeWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="expandsOnDoubleClick">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -48,6 +48,7 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list, in
|
||||
connect( ui->shareButton, SIGNAL( clicked ( bool ) ), this, SLOT( createLobby( ) ) );
|
||||
connect( ui->cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancel( ) ) );
|
||||
connect( ui->lobbyName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
||||
connect( ui->lobbyTopic_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
||||
connect( ui->nickName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
||||
|
||||
/* initialize key share list */
|
||||
@ -93,19 +94,20 @@ void CreateLobbyDialog::createLobby()
|
||||
std::list<std::string> shareList;
|
||||
ui->keyShareList->selectedSslIds(shareList, false);
|
||||
|
||||
if (shareList.empty()) {
|
||||
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
// if (shareList.empty()) {
|
||||
// QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// create chat lobby !!
|
||||
std::string lobby_name = ui->lobbyName_LE->text().toUtf8().constData() ;
|
||||
std::string lobby_topic = ui->lobbyTopic_LE->text().toUtf8().constData() ;
|
||||
|
||||
// add to group
|
||||
|
||||
int lobby_privacy_type = (ui->security_CB->currentIndex() == 0)?RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC:RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE ;
|
||||
|
||||
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name, shareList, lobby_privacy_type);
|
||||
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name, lobby_topic, shareList, lobby_privacy_type);
|
||||
|
||||
std::cerr << "gui: Created chat lobby " << std::hex << id << std::endl ;
|
||||
|
||||
|
@ -123,6 +123,16 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Lobby topic:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
@ -150,6 +160,9 @@ p, li { white-space: pre-wrap; }
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lobbyName_LE"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lobbyTopic_LE"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="nickName_LE"/>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user