fixed GUI update of avatars and status for distant chat. Updated backend for new model. Fixed a few bugs in serialisation

This commit is contained in:
csoler 2015-11-30 00:02:44 -05:00
parent 6951d730a5
commit 81ab43beb9
27 changed files with 515 additions and 289 deletions

View file

@ -72,7 +72,7 @@ StreamBase& operator << (StreamBase& left, ChatHandler::Lobby& l)
<< makeKeyValueReference("subscribed", l.subscribed)
<< makeKeyValueReference("auto_subscribe", l.auto_subscribe)
<< makeKeyValueReference("is_private", l.is_private)
<< makeKeyValueReference("gxs_id", l.gxs_id);
<< makeKeyValueReference("distant_chat_id", l.distant_chat_id);
return left;
}
@ -81,7 +81,7 @@ StreamBase& operator << (StreamBase& left, ChatHandler::ChatInfo& info)
left << makeKeyValueReference("remote_author_id", info.remote_author_id)
<< makeKeyValueReference("remote_author_name", info.remote_author_name)
<< makeKeyValueReference("is_broadcast", info.is_broadcast)
<< makeKeyValueReference("is_gxs_id", info.is_gxs_id)
<< makeKeyValueReference("is_distant_chat_id", info.is_distant_chat_id)
<< makeKeyValueReference("is_lobby", info.is_lobby)
<< makeKeyValueReference("is_peer", info.is_peer);
return left;
@ -157,7 +157,7 @@ void ChatHandler::tick()
l.subscribed = true;
l.auto_subscribe = info.lobby_flags & RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
l.is_private = !(info.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC);
l.gxs_id = info.gxs_id;
l.distant_chat_id.clear() ;
lobbies.push_back(l);
}
}
@ -176,7 +176,7 @@ void ChatHandler::tick()
l.subscribed = false;
l.auto_subscribe = info.lobby_flags & RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
l.is_private = !(info.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC);
l.gxs_id = RsGxsId();
l.distant_chat_id.clear();
lobbies.push_back(l);
}
}
@ -199,11 +199,19 @@ void ChatHandler::tick()
author_id = msg.broadcast_peer_id.toStdString();
author_name = mRsPeers->getPeerName(msg.broadcast_peer_id);
}
else if(msg.chat_id.isGxsId())
else if(msg.chat_id.isDistantChatId())
{
author_id = msg.chat_id.toGxsId().toStdString();
DistantChatPeerInfo dcpinfo ;
if(!rsMsgs->getDistantChatStatus(msg.chat_id.toDistantChatId(),dcpinfo))
{
std::cerr << "(EE) cannot get info for distant chat peer " << msg.chat_id.toDistantChatId() << std::endl;
continue ;
}
author_id = dcpinfo.to_id.toStdString();
RsIdentityDetails details;
if(!gxs_id_failed && mRsIdentity->getIdDetails(msg.chat_id.toGxsId(), details))
if(!gxs_id_failed && mRsIdentity->getIdDetails(dcpinfo.to_id, details))
{
author_name = details.mNickname;
}
@ -252,7 +260,7 @@ void ChatHandler::tick()
{
ChatInfo info;
info.is_broadcast = msg.chat_id.isBroadcast();
info.is_gxs_id = msg.chat_id.isGxsId();
info.is_distant_chat_id = msg.chat_id.isDistantChatId();
info.is_lobby = msg.chat_id.isLobbyId();
info.is_peer = msg.chat_id.isPeerId();
if(msg.chat_id.isLobbyId())
@ -263,10 +271,13 @@ void ChatHandler::tick()
info.remote_author_name = vit->name;
}
}
else if(msg.chat_id.isGxsId())
else if(msg.chat_id.isDistantChatId())
{
RsIdentityDetails details;
if(!gxs_id_failed && mRsIdentity->getIdDetails(msg.chat_id.toGxsId(), details))
DistantChatPeerInfo dcpinfo ;
if(!gxs_id_failed && rsMsgs->getDistantChatStatus(msg.chat_id.toDistantChatId(),dcpinfo)
&& mRsIdentity->getIdDetails(dcpinfo.to_id, details))
{
info.remote_author_id = msg.chat_id.toGxsId().toStdString();
info.remote_author_name = details.mNickname;

View file

@ -65,7 +65,7 @@ public:
bool auto_subscribe;
bool is_private;
RsGxsId gxs_id;// for subscribed lobbies: the id we use to write messages
DistantChatPeerId distant_chat_id;// for subscribed lobbies: the id we use to write messages
bool operator==(const Lobby& l) const
{
@ -75,14 +75,14 @@ public:
&& subscribed == l.subscribed
&& auto_subscribe == l.auto_subscribe
&& is_private == l.is_private
&& gxs_id == l.gxs_id;
&& distant_chat_id == l.distant_chat_id;
}
};
class ChatInfo{
public:
bool is_broadcast;
bool is_gxs_id;
bool is_distant_chat_id;
bool is_lobby;
bool is_peer;
std::string remote_author_id;