mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1583 from csoler/v0.6-DistantChat
automaticall save/restore subscribed chat rooms. The advantage is tha…
This commit is contained in:
commit
10eeb818c8
@ -933,7 +933,7 @@ void DistributedChatService::sendLobbyStatusPeerChangedNickname(const ChatLobbyI
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DistributedChatService::sendLobbyStatusPeerLiving(const ChatLobbyId& lobby_id)
|
void DistributedChatService::sendLobbyStatusPeerLeaving(const ChatLobbyId& lobby_id)
|
||||||
{
|
{
|
||||||
sendLobbyStatusItem(lobby_id,RS_CHAT_LOBBY_EVENT_PEER_LEFT,std::string()) ;
|
sendLobbyStatusItem(lobby_id,RS_CHAT_LOBBY_EVENT_PEER_LEFT,std::string()) ;
|
||||||
}
|
}
|
||||||
@ -990,7 +990,7 @@ bool DistributedChatService::locked_initLobbyBouncableObject(const ChatLobbyId&
|
|||||||
while( lobby.msg_cache.find(item.msg_id) != lobby.msg_cache.end() ) ;
|
while( lobby.msg_cache.find(item.msg_id) != lobby.msg_cache.end() ) ;
|
||||||
|
|
||||||
RsIdentityDetails details ;
|
RsIdentityDetails details ;
|
||||||
if(!rsIdentity->getIdDetails(lobby.gxs_id,details))
|
if(!rsIdentity || !rsIdentity->getIdDetails(lobby.gxs_id,details))
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) Cannot send chat lobby object. Signign identity " << lobby.gxs_id << " is unknown." << std::endl;
|
std::cerr << "(EE) Cannot send chat lobby object. Signign identity " << lobby.gxs_id << " is unknown." << std::endl;
|
||||||
return false ;
|
return false ;
|
||||||
@ -1580,6 +1580,9 @@ bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,co
|
|||||||
}
|
}
|
||||||
_chat_lobbys[lobby_id] = entry ;
|
_chat_lobbys[lobby_id] = entry ;
|
||||||
}
|
}
|
||||||
|
setLobbyAutoSubscribe(lobby_id,true);
|
||||||
|
|
||||||
|
triggerConfigSave(); // so that we save the subscribed lobbies
|
||||||
|
|
||||||
for(std::list<RsPeerId>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
|
for(std::list<RsPeerId>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
|
||||||
invitePeerToLobby(lobby_id,*it) ;
|
invitePeerToLobby(lobby_id,*it) ;
|
||||||
@ -1629,6 +1632,8 @@ ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_nam
|
|||||||
|
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||||
|
|
||||||
|
triggerConfigSave();
|
||||||
|
|
||||||
return lobby_id ;
|
return lobby_id ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1666,10 +1671,11 @@ void DistributedChatService::handleFriendUnsubscribeLobby(RsChatLobbyUnsubscribe
|
|||||||
void DistributedChatService::unsubscribeChatLobby(const ChatLobbyId& id)
|
void DistributedChatService::unsubscribeChatLobby(const ChatLobbyId& id)
|
||||||
{
|
{
|
||||||
// send AKN item
|
// send AKN item
|
||||||
sendLobbyStatusPeerLiving(id) ;
|
sendLobbyStatusPeerLeaving(id) ;
|
||||||
|
setLobbyAutoSubscribe(id, false);
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
RS_STACK_MUTEX(mDistributedChatMtx);
|
||||||
|
|
||||||
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.find(id) ;
|
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.find(id) ;
|
||||||
|
|
||||||
@ -1704,6 +1710,7 @@ void DistributedChatService::unsubscribeChatLobby(const ChatLobbyId& id)
|
|||||||
_chat_lobbys.erase(it) ;
|
_chat_lobbys.erase(it) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
triggerConfigSave(); // so that we save the subscribed lobbies
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_DEL) ;
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_DEL) ;
|
||||||
|
|
||||||
// done!
|
// done!
|
||||||
@ -1826,12 +1833,24 @@ bool DistributedChatService::setIdentityForChatLobby(const ChatLobbyId& lobby_id
|
|||||||
|
|
||||||
void DistributedChatService::setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe)
|
void DistributedChatService::setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe)
|
||||||
{
|
{
|
||||||
if(autoSubscribe){
|
|
||||||
|
if(autoSubscribe)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mDistributedChatMtx);
|
||||||
_known_lobbies_flags[lobby_id] |= RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
|
_known_lobbies_flags[lobby_id] |= RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
|
||||||
|
}
|
||||||
RsGxsId gxsId;
|
RsGxsId gxsId;
|
||||||
|
|
||||||
if (getIdentityForChatLobby(lobby_id, gxsId))
|
if (getIdentityForChatLobby(lobby_id, gxsId))
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mDistributedChatMtx);
|
||||||
_lobby_default_identity[lobby_id] = gxsId;
|
_lobby_default_identity[lobby_id] = gxsId;
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mDistributedChatMtx);
|
||||||
_known_lobbies_flags[lobby_id] &= ~RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE ;
|
_known_lobbies_flags[lobby_id] &= ~RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE ;
|
||||||
_lobby_default_identity.erase(lobby_id);
|
_lobby_default_identity.erase(lobby_id);
|
||||||
}
|
}
|
||||||
@ -1966,6 +1985,15 @@ void DistributedChatService::addToSaveList(std::list<RsItem*>& list) const
|
|||||||
list.push_back(clci) ;
|
list.push_back(clci) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(auto it(_chat_lobbys.begin());it!=_chat_lobbys.end();++it)
|
||||||
|
{
|
||||||
|
RsSubscribedChatLobbyConfigItem *scli = new RsSubscribedChatLobbyConfigItem;
|
||||||
|
|
||||||
|
scli->info = it->second; // copies the ChatLobbyInfo part only
|
||||||
|
|
||||||
|
list.push_back(scli);
|
||||||
|
}
|
||||||
|
|
||||||
/* Save Default Nick Name */
|
/* Save Default Nick Name */
|
||||||
{
|
{
|
||||||
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
|
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
|
||||||
@ -2061,6 +2089,59 @@ bool DistributedChatService::processLoadListItem(const RsItem *item)
|
|||||||
if(!own_ids.empty())
|
if(!own_ids.empty())
|
||||||
_default_identity = own_ids.front() ;
|
_default_identity = own_ids.front() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const RsSubscribedChatLobbyConfigItem *scli = dynamic_cast<const RsSubscribedChatLobbyConfigItem*>(item);
|
||||||
|
|
||||||
|
if(scli != NULL)
|
||||||
|
{
|
||||||
|
if(_chat_lobbys.find(scli->info.lobby_id) != _chat_lobbys.end()) // do nothing if the lobby is already subscribed
|
||||||
|
return true;
|
||||||
|
|
||||||
|
std::cerr << "Re-subscribing to chat lobby " << (void*)scli->info.lobby_id << ", flags = " << scli->info.lobby_flags << std::endl;
|
||||||
|
|
||||||
|
rstime_t now = time(NULL);
|
||||||
|
|
||||||
|
// Add the chat room into visible chat rooms
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
|
VisibleChatLobbyRecord& rec(_visible_lobbies[scli->info.lobby_id]) ;
|
||||||
|
|
||||||
|
rec.lobby_id = scli->info.lobby_id ;
|
||||||
|
rec.lobby_name = scli->info.lobby_name ;
|
||||||
|
rec.lobby_topic = scli->info.lobby_topic ;
|
||||||
|
rec.participating_friends = scli->info.participating_friends;
|
||||||
|
rec.total_number_of_peers = 0;
|
||||||
|
rec.last_report_time = now ;
|
||||||
|
rec.lobby_flags = EXTRACT_PRIVACY_FLAGS(scli->info.lobby_flags) ;
|
||||||
|
|
||||||
|
_known_lobbies_flags[scli->info.lobby_id] |= RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the chat room into subscribed chat rooms
|
||||||
|
|
||||||
|
ChatLobbyEntry entry ;
|
||||||
|
(ChatLobbyInfo&)entry = scli->info;
|
||||||
|
|
||||||
|
entry.virtual_peer_id = makeVirtualPeerId(entry.lobby_id) ; // not random, so we keep the same id at restart
|
||||||
|
entry.connexion_challenge_count = 0 ;
|
||||||
|
entry.last_activity = now ;
|
||||||
|
entry.last_connexion_challenge_time = now ;
|
||||||
|
entry.last_keep_alive_packet_time = now ;
|
||||||
|
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
_chat_lobbys[entry.lobby_id] = entry ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the UI aware of the existing chat room
|
||||||
|
|
||||||
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ class DistributedChatService
|
|||||||
void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe);
|
void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe);
|
||||||
bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
||||||
void sendLobbyStatusString(const ChatLobbyId& id,const std::string& status_string) ;
|
void sendLobbyStatusString(const ChatLobbyId& id,const std::string& status_string) ;
|
||||||
|
void sendLobbyStatusPeerLeaving(const ChatLobbyId& lobby_id) ;
|
||||||
|
|
||||||
ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic, const std::set<RsPeerId>& invited_friends,ChatLobbyFlags flags) ;
|
ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic, const std::set<RsPeerId>& invited_friends,ChatLobbyFlags flags) ;
|
||||||
|
|
||||||
@ -119,7 +120,6 @@ class DistributedChatService
|
|||||||
bool bounceLobbyObject(RsChatLobbyBouncingObject *obj, const RsPeerId& peer_id) ;
|
bool bounceLobbyObject(RsChatLobbyBouncingObject *obj, const RsPeerId& peer_id) ;
|
||||||
|
|
||||||
void sendLobbyStatusItem(const ChatLobbyId&, int type, const std::string& status_string) ;
|
void sendLobbyStatusItem(const ChatLobbyId&, int type, const std::string& status_string) ;
|
||||||
void sendLobbyStatusPeerLiving(const ChatLobbyId& lobby_id) ;
|
|
||||||
void sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id, const std::string& newnick) ;
|
void sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id, const std::string& newnick) ;
|
||||||
|
|
||||||
void sendLobbyStatusNewPeer(const ChatLobbyId& lobby_id) ;
|
void sendLobbyStatusNewPeer(const ChatLobbyId& lobby_id) ;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include "retroshare/rsmsgs.h"
|
||||||
#include "util/rstime.h"
|
#include "util/rstime.h"
|
||||||
#include "serialiser/rsbaseserial.h"
|
#include "serialiser/rsbaseserial.h"
|
||||||
#include "serialiser/rstlvbase.h"
|
#include "serialiser/rstlvbase.h"
|
||||||
@ -52,6 +53,7 @@ RsItem *RsChatSerialiser::create_item(uint16_t service_id,uint8_t item_sub_id) c
|
|||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem();
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem();
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem();
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem();
|
||||||
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem();
|
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem();
|
||||||
|
case RS_PKT_SUBTYPE_SUBSCRIBED_CHAT_LOBBY_CONFIG: return new RsSubscribedChatLobbyConfigItem();
|
||||||
case RS_PKT_SUBTYPE_OUTGOING_MAP: return new PrivateOugoingMapItem();
|
case RS_PKT_SUBTYPE_OUTGOING_MAP: return new PrivateOugoingMapItem();
|
||||||
default:
|
default:
|
||||||
std::cerr << "Unknown packet type in chat!" << std::endl;
|
std::cerr << "Unknown packet type in chat!" << std::endl;
|
||||||
@ -172,6 +174,11 @@ void RsChatAvatarItem::serial_process(RsGenericSerializer::SerializeJob j,RsGene
|
|||||||
RsTypeSerializer::serial_process(j,ctx,b,"image data") ;
|
RsTypeSerializer::serial_process(j,ctx,b,"image data") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RsSubscribedChatLobbyConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||||
|
{
|
||||||
|
info.serial_process(j,ctx);
|
||||||
|
}
|
||||||
|
|
||||||
void RsChatLobbyConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
void RsChatLobbyConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||||
{
|
{
|
||||||
RsTypeSerializer::serial_process<uint64_t>(j,ctx,lobby_Id,"lobby_Id") ;
|
RsTypeSerializer::serial_process<uint64_t>(j,ctx,lobby_Id,"lobby_Id") ;
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "serialiser/rstlvidset.h"
|
#include "serialiser/rstlvidset.h"
|
||||||
#include "serialiser/rstlvfileitem.h"
|
#include "serialiser/rstlvfileitem.h"
|
||||||
|
#include "retroshare/rsmsgs.h"
|
||||||
|
|
||||||
/* chat Flags */
|
/* chat Flags */
|
||||||
const uint32_t RS_CHAT_FLAG_PRIVATE = 0x0001;
|
const uint32_t RS_CHAT_FLAG_PRIVATE = 0x0001;
|
||||||
@ -82,6 +83,8 @@ const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED = 0x1A ; // to be remo
|
|||||||
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x1B ;
|
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x1B ;
|
||||||
const uint8_t RS_PKT_SUBTYPE_OUTGOING_MAP = 0x1C ;
|
const uint8_t RS_PKT_SUBTYPE_OUTGOING_MAP = 0x1C ;
|
||||||
|
|
||||||
|
const uint8_t RS_PKT_SUBTYPE_SUBSCRIBED_CHAT_LOBBY_CONFIG = 0x1D ;
|
||||||
|
|
||||||
typedef uint64_t ChatLobbyId ;
|
typedef uint64_t ChatLobbyId ;
|
||||||
typedef uint64_t ChatLobbyMsgId ;
|
typedef uint64_t ChatLobbyMsgId ;
|
||||||
typedef std::string ChatLobbyNickName ;
|
typedef std::string ChatLobbyNickName ;
|
||||||
@ -298,6 +301,19 @@ struct RsPrivateChatMsgConfigItem : RsChatItem
|
|||||||
uint32_t recvTime;
|
uint32_t recvTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RsSubscribedChatLobbyConfigItem: public RsChatItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RsSubscribedChatLobbyConfigItem() :RsChatItem(RS_PKT_SUBTYPE_SUBSCRIBED_CHAT_LOBBY_CONFIG) {}
|
||||||
|
virtual ~RsSubscribedChatLobbyConfigItem() {}
|
||||||
|
|
||||||
|
virtual void clear() { RsChatItem::clear(); info.clear(); }
|
||||||
|
|
||||||
|
void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
||||||
|
|
||||||
|
ChatLobbyInfo info;
|
||||||
|
};
|
||||||
|
|
||||||
class RsChatLobbyConfigItem: public RsChatItem
|
class RsChatLobbyConfigItem: public RsChatItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -470,6 +470,8 @@ public:
|
|||||||
std::map<RsGxsId, rstime_t> gxs_ids ; // list of non direct friend who participate. Used to display only.
|
std::map<RsGxsId, rstime_t> gxs_ids ; // list of non direct friend who participate. Used to display only.
|
||||||
rstime_t last_activity ; // last recorded activity. Useful for removing dead lobbies.
|
rstime_t last_activity ; // last recorded activity. Useful for removing dead lobbies.
|
||||||
|
|
||||||
|
virtual void clear() { gxs_ids.clear(); lobby_id = 0; lobby_name.clear(); lobby_topic.clear(); participating_friends.clear(); }
|
||||||
|
|
||||||
// RsSerializable interface
|
// RsSerializable interface
|
||||||
public:
|
public:
|
||||||
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||||
@ -831,6 +833,13 @@ virtual void getOwnAvatarData(unsigned char *& data,int& size) = 0 ;
|
|||||||
*/
|
*/
|
||||||
virtual void unsubscribeChatLobby(const ChatLobbyId &lobby_id) = 0;
|
virtual void unsubscribeChatLobby(const ChatLobbyId &lobby_id) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief sendLobbyStatusPeerLeaving notify friend nodes that we're leaving a subscribed lobby
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] lobby_id lobby to leave
|
||||||
|
*/
|
||||||
|
virtual void sendLobbyStatusPeerLeaving(const ChatLobbyId& lobby_id) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setIdentityForChatLobby set the chat identit
|
* @brief setIdentityForChatLobby set the chat identit
|
||||||
* @jsonapi{development}
|
* @jsonapi{development}
|
||||||
|
@ -453,6 +453,10 @@ void p3Msgs::invitePeerToLobby(const ChatLobbyId& lobby_id, const RsPeerId& peer
|
|||||||
{
|
{
|
||||||
mChatSrv->invitePeerToLobby(lobby_id,peer_id) ;
|
mChatSrv->invitePeerToLobby(lobby_id,peer_id) ;
|
||||||
}
|
}
|
||||||
|
void p3Msgs::sendLobbyStatusPeerLeaving(const ChatLobbyId& lobby_id)
|
||||||
|
{
|
||||||
|
mChatSrv->sendLobbyStatusPeerLeaving(lobby_id) ;
|
||||||
|
}
|
||||||
void p3Msgs::unsubscribeChatLobby(const ChatLobbyId& lobby_id)
|
void p3Msgs::unsubscribeChatLobby(const ChatLobbyId& lobby_id)
|
||||||
{
|
{
|
||||||
mChatSrv->unsubscribeChatLobby(lobby_id) ;
|
mChatSrv->unsubscribeChatLobby(lobby_id) ;
|
||||||
|
@ -147,6 +147,7 @@ class p3Msgs: public RsMsgs
|
|||||||
virtual void denyLobbyInvite(const ChatLobbyId& id) ;
|
virtual void denyLobbyInvite(const ChatLobbyId& id) ;
|
||||||
virtual void getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) ;
|
virtual void getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) ;
|
||||||
virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ;
|
virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ;
|
||||||
|
virtual void sendLobbyStatusPeerLeaving(const ChatLobbyId& lobby_id);
|
||||||
virtual bool setIdentityForChatLobby(const ChatLobbyId& lobby_id,const RsGxsId&) ;
|
virtual bool setIdentityForChatLobby(const ChatLobbyId& lobby_id,const RsGxsId&) ;
|
||||||
virtual bool getIdentityForChatLobby(const ChatLobbyId&,RsGxsId& nick) ;
|
virtual bool getIdentityForChatLobby(const ChatLobbyId&,RsGxsId& nick) ;
|
||||||
virtual bool setDefaultIdentityForChatLobby(const RsGxsId&) ;
|
virtual bool setDefaultIdentityForChatLobby(const RsGxsId&) ;
|
||||||
|
@ -331,10 +331,14 @@ void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TO_BE_REMOVED
|
||||||
|
// This code is not needed anymore because AutoSubscribe is now automatically handled with chat room subscription.
|
||||||
|
|
||||||
if (item->data(COLUMN_DATA, ROLE_AUTOSUBSCRIBE).toBool())
|
if (item->data(COLUMN_DATA, ROLE_AUTOSUBSCRIBE).toBool())
|
||||||
contextMnu.addAction(QIcon(IMAGE_AUTOSUBSCRIBE), tr("Remove Auto Subscribe"), this, SLOT(autoSubscribeItem()));
|
contextMnu.addAction(QIcon(IMAGE_AUTOSUBSCRIBE), tr("Remove Auto Subscribe"), this, SLOT(autoSubscribeItem()));
|
||||||
else if(!own_identities.empty())
|
else if(!own_identities.empty())
|
||||||
contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Add Auto Subscribe"), this, SLOT(autoSubscribeItem()));
|
contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Add Auto Subscribe"), this, SLOT(autoSubscribeItem()));
|
||||||
|
#endif
|
||||||
|
|
||||||
contextMnu.addAction(QIcon(IMAGE_COPYRSLINK), tr("Copy RetroShare Link"), this, SLOT(copyItemLink()));
|
contextMnu.addAction(QIcon(IMAGE_COPYRSLINK), tr("Copy RetroShare Link"), this, SLOT(copyItemLink()));
|
||||||
}
|
}
|
||||||
@ -603,19 +607,16 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
item->setIcon(COLUMN_NAME, subscribed ? icon : icon.pixmap(ui.lobbyTreeWidget->iconSize(), QIcon::Disabled));
|
item->setIcon(COLUMN_NAME, subscribed ? icon : icon.pixmap(ui.lobbyTreeWidget->iconSize(), QIcon::Disabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In the new model (after lobby save to disk) the auto-subscribe flag is used to automatically join lobbies that where
|
||||||
|
// previously being used when the t software quits.
|
||||||
|
|
||||||
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
|
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
|
||||||
|
|
||||||
if (autoSubscribe && subscribed)
|
if (autoSubscribe && subscribed && _lobby_infos.find(lobby.lobby_id) == _lobby_infos.end())
|
||||||
{
|
{
|
||||||
if(_lobby_infos.find(lobby.lobby_id) == _lobby_infos.end())
|
ChatDialog *cd = ChatDialog::getChat(ChatId(lobby.lobby_id), RS_CHAT_OPEN);
|
||||||
{
|
|
||||||
if (item == ui.lobbyTreeWidget->currentItem())
|
addChatPage(dynamic_cast<ChatLobbyDialog*>(cd));
|
||||||
{
|
|
||||||
ChatDialog::chatFriend(ChatId(lobby.lobby_id)) ;
|
|
||||||
}else{
|
|
||||||
ChatDialog::chatFriend(ChatId(lobby.lobby_id),false) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateItem(ui.lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.total_number_of_peers, subscribed, autoSubscribe,lobby_flags);
|
updateItem(ui.lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.total_number_of_peers, subscribed, autoSubscribe,lobby_flags);
|
||||||
@ -674,6 +675,16 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
|
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
|
||||||
|
|
||||||
updateItem(ui.lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.gxs_ids.size(), true, autoSubscribe,lobby_flags);
|
updateItem(ui.lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.gxs_ids.size(), true, autoSubscribe,lobby_flags);
|
||||||
|
|
||||||
|
std::map<ChatLobbyId,ChatLobbyInfoStruct>::iterator it = _lobby_infos.find(lobby.lobby_id) ;
|
||||||
|
|
||||||
|
// look for chat rooms that are subscribed but not displayed as such
|
||||||
|
|
||||||
|
if(it == _lobby_infos.end() && rsMsgs->joinVisibleChatLobby(lobby.lobby_id,lobby.gxs_id))
|
||||||
|
{
|
||||||
|
std::cerr << "Adding back ChatLobbyDialog for subscribed lobby " << std::hex << lobby.lobby_id << std::dec << std::endl;
|
||||||
|
ChatDialog::chatFriend(ChatId(lobby.lobby_id),true) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
publicSubLobbyItem->setHidden(publicSubLobbyItem->childCount()==0);
|
publicSubLobbyItem->setHidden(publicSubLobbyItem->childCount()==0);
|
||||||
publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed chat rooms")+ QString(" (") + QString::number(publicSubLobbyItem->childCount())+QString(")"));
|
publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed chat rooms")+ QString(" (") + QString::number(publicSubLobbyItem->childCount())+QString(")"));
|
||||||
|
@ -172,6 +172,16 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
|||||||
ui = new Ui::MainWindow;
|
ui = new Ui::MainWindow;
|
||||||
trayIcon = NULL;
|
trayIcon = NULL;
|
||||||
|
|
||||||
|
friendsDialog=NULL;
|
||||||
|
idDialog=NULL;
|
||||||
|
chatLobbyDialog=NULL;
|
||||||
|
settingsDialog=NULL;
|
||||||
|
transfersDialog=NULL;
|
||||||
|
messagesDialog=NULL;
|
||||||
|
gxschannelDialog=NULL;
|
||||||
|
gxsforumDialog=NULL;
|
||||||
|
postedDialog=NULL;
|
||||||
|
|
||||||
/* Invoke the Qt Designer generated QObject setup routine */
|
/* Invoke the Qt Designer generated QObject setup routine */
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -424,9 +424,8 @@ ChatLobbyDialog::~ChatLobbyDialog()
|
|||||||
// announce leaving of lobby
|
// announce leaving of lobby
|
||||||
|
|
||||||
// check that the lobby still exists.
|
// check that the lobby still exists.
|
||||||
if (mChatId.isLobbyId()) {
|
if (mChatId.isLobbyId())
|
||||||
rsMsgs->unsubscribeChatLobby(mChatId.toLobbyId());
|
rsMsgs->sendLobbyStatusPeerLeaving(mChatId.toLobbyId());
|
||||||
}
|
|
||||||
|
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
@ -912,7 +911,10 @@ void ChatLobbyDialog::showDialog(uint chatflags)
|
|||||||
if (chatflags & RS_CHAT_FOCUS)
|
if (chatflags & RS_CHAT_FOCUS)
|
||||||
{
|
{
|
||||||
MainWindow::showWindow(MainWindow::ChatLobby);
|
MainWindow::showWindow(MainWindow::ChatLobby);
|
||||||
dynamic_cast<ChatLobbyWidget*>(MainWindow::getPage(MainWindow::ChatLobby))->setCurrentChatPage(this) ;
|
MainPage *p = MainWindow::getPage(MainWindow::ChatLobby);
|
||||||
|
|
||||||
|
if(p != NULL)
|
||||||
|
dynamic_cast<ChatLobbyWidget*>(p)->setCurrentChatPage(this) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user