Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/chat/distributedchat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,6 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
entry.last_connexion_challenge_time = now ;
entry.joined_lobby_packet_sent = false;
entry.last_keep_alive_packet_time = now ;

_chat_lobbys[lobby_id] = entry ;

_lobby_invites_queue.erase(it) ; // remove the invite from cache.
Expand All @@ -1517,14 +1516,18 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
RsChatLobbyMsgItem *item = new RsChatLobbyMsgItem;
item->lobby_id = entry.lobby_id ;
item->msg_id = 0 ;
item->parent_msg_id = 0 ;
item->nick = "Chat room management" ;
item->parent_msg_id = 0 ;
item->nick = "Chat room management" ;
item->message = std::string("Welcome to chat lobby") ;
item->PeerId(entry.virtual_peer_id) ;
item->chatFlags = RS_CHAT_FLAG_PRIVATE | RS_CHAT_FLAG_LOBBY ;

locked_storeIncomingMsg(item) ;
}

setLobbyAutoSubscribe(lobby_id, true);
triggerConfigSave(); // so that we save the subscribed lobbies

#ifdef DEBUG_CHAT_LOBBIES
std::cerr << " Notifying of new recvd msg." << std::endl ;
#endif
Expand Down Expand Up @@ -1706,6 +1709,7 @@ ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_nam
ev->mEventCode = RsChatLobbyEventCode::CHAT_LOBBY_LIST_CHANGED;
rsEvents->postEvent(ev);

setLobbyAutoSubscribe(lobby_id, true);
triggerConfigSave();

return lobby_id ;
Expand Down Expand Up @@ -1910,6 +1914,8 @@ bool DistributedChatService::setIdentityForChatLobby(const ChatLobbyId& lobby_id
it->second.gxs_id = nick ;
}

triggerConfigSave() ;

return true ;
}

Expand Down
5 changes: 5 additions & 0 deletions src/retroshare/rswire.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ virtual bool getPulseFocus(const RsGxsGroupId &groupId, const RsGxsMessageId &ms
std::vector<RsMsgMetaData>& summaries ) = 0;

virtual bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& groupId, bool subscribe) = 0;

// Simple subscribe/unsubscribe API without token management (for UI use)
// Tokens are handled internally by libretroshare
virtual bool subscribe(const RsGxsGroupId& groupId, bool subscribe) = 0;

virtual uint32_t getFollowingCount() = 0;
virtual bool getSubscribedGroups(std::list<RsGxsGroupId>& groupIds) = 0;

Expand Down
12 changes: 12 additions & 0 deletions src/services/p3wire.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,18 @@ bool p3Wire::subscribeToGroup(uint32_t& token, const RsGxsGroupId& groupId, bool
return response;
}

bool p3Wire::subscribe(const RsGxsGroupId& groupId, bool subscribe)
{
#ifdef WIRE_DEBUG
std::cerr << "p3Wire::subscribe() id: " << groupId << " subscribe: " << subscribe;
std::cerr << std::endl;
#endif

// Token is managed internally - UI doesn't need to handle it
uint32_t token;
return subscribeToGroup(token, groupId, subscribe);
}

void p3Wire::refreshSubscribedGroups()
{
uint32_t token;
Expand Down
4 changes: 4 additions & 0 deletions src/services/p3wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class p3Wire: public RsGenExchange, public RsWire, public p3Config
void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) override;

bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& groupId, bool subscribe) override;

// Simple subscribe/unsubscribe API without token management (for UI use)
bool subscribe(const RsGxsGroupId& groupId, bool subscribe) override;

uint32_t getFollowingCount() override;
bool getSubscribedGroups(std::list<RsGxsGroupId>& groupIds) override;

Expand Down
Loading