mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 17:13:58 -05:00
Merge pull request #188 from csoler/v0.6-SecuredTunnelService
V0.6 secured tunnel service. Please reports bugs to me (I have tested with valgrind and as many configurations as possible, but the multi-service gathering into GXS tunnels shared for each GXS id pair is not a totally simple thing, so I expect to have missed a few issues).
This commit is contained in:
commit
0ac76d621e
40 changed files with 3394 additions and 1458 deletions
|
|
@ -124,8 +124,6 @@ void AvatarWidget::setFrameType(FrameType type)
|
|||
void AvatarWidget::setId(const ChatId &id)
|
||||
{
|
||||
mId = id;
|
||||
// mPgpId = rsPeers->getGPGId(id) ;
|
||||
// mFlag.isGpg = false ;
|
||||
|
||||
setPixmap(QPixmap());
|
||||
|
||||
|
|
@ -133,15 +131,12 @@ void AvatarWidget::setId(const ChatId &id)
|
|||
setEnabled(false);
|
||||
}
|
||||
|
||||
if(mId.isGxsId())
|
||||
std::cerr << "(EE) AvatarWidget should not be set to a GXS id." << std::endl;
|
||||
|
||||
refreshAvatarImage();
|
||||
refreshStatus();
|
||||
}
|
||||
void AvatarWidget::setOwnId(const RsGxsId& own_gxs_id)
|
||||
{
|
||||
mFlag.isOwnId = true;
|
||||
|
||||
setId(ChatId(own_gxs_id));
|
||||
}
|
||||
void AvatarWidget::setOwnId()
|
||||
{
|
||||
mFlag.isOwnId = true;
|
||||
|
|
@ -181,7 +176,7 @@ void AvatarWidget::refreshStatus()
|
|||
rsStatus->getOwnStatus(statusInfo);
|
||||
status = statusInfo.status ;
|
||||
}
|
||||
else if(mId.isGxsId())
|
||||
else if(mId.isDistantChatId())
|
||||
status = RS_STATUS_ONLINE ;
|
||||
else
|
||||
{
|
||||
|
|
@ -198,11 +193,15 @@ void AvatarWidget::refreshStatus()
|
|||
rsStatus->getStatus(mId.toPeerId(), statusInfo);
|
||||
status = statusInfo.status ;
|
||||
}
|
||||
else if(mId.isGxsId())
|
||||
{
|
||||
if(!rsMsgs->getDistantChatStatus(mId.toGxsId(),status))
|
||||
status = RS_STATUS_OFFLINE ;
|
||||
}
|
||||
else if(mId.isDistantChatId())
|
||||
{
|
||||
DistantChatPeerInfo dcpinfo ;
|
||||
|
||||
if(rsMsgs->getDistantChatStatus(mId.toDistantChatId(),dcpinfo))
|
||||
status = dcpinfo.status ;
|
||||
else
|
||||
std::cerr << "(EE) cannot get distant chat status for ID=" << mId.toDistantChatId() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Unhandled chat id type in AvatarWidget::refreshStatus()" << std::endl;
|
||||
|
|
@ -235,10 +234,11 @@ void AvatarWidget::updateStatus(int status)
|
|||
void AvatarWidget::updateAvatar(const QString &peerId)
|
||||
{
|
||||
if(mId.isPeerId() && mId.toPeerId() == RsPeerId(peerId.toStdString()))
|
||||
refreshAvatarImage() ;
|
||||
|
||||
if(mId.isGxsId() && mId.toGxsId() == RsGxsId(peerId.toStdString()))
|
||||
refreshAvatarImage() ;
|
||||
refreshAvatarImage() ;
|
||||
else if(mId.isDistantChatId() && mId.toDistantChatId() == DistantChatPeerId(peerId.toStdString()))
|
||||
refreshAvatarImage() ;
|
||||
else
|
||||
std::cerr << "(EE) cannot update avatar. mId has unhandled type." << std::endl;
|
||||
}
|
||||
void AvatarWidget::refreshAvatarImage()
|
||||
{
|
||||
|
|
@ -262,12 +262,29 @@ void AvatarWidget::refreshAvatarImage()
|
|||
setPixmap(avatar);
|
||||
return;
|
||||
}
|
||||
else if (mId.isGxsId())
|
||||
// else if (mId.isGxsId())
|
||||
// {
|
||||
// QPixmap avatar;
|
||||
//
|
||||
// AvatarDefs::getAvatarFromGxsId(mId.toGxsId(), avatar, defaultAvatar);
|
||||
// setPixmap(avatar);
|
||||
// return;
|
||||
// }
|
||||
else if (mId.isDistantChatId())
|
||||
{
|
||||
QPixmap avatar;
|
||||
AvatarDefs::getAvatarFromGxsId(mId.toGxsId(), avatar, defaultAvatar);
|
||||
setPixmap(avatar);
|
||||
return;
|
||||
QPixmap avatar;
|
||||
|
||||
DistantChatPeerInfo dcpinfo ;
|
||||
|
||||
if(rsMsgs->getDistantChatStatus(mId.toDistantChatId(),dcpinfo))
|
||||
{
|
||||
if(mFlag.isOwnId)
|
||||
AvatarDefs::getAvatarFromGxsId(dcpinfo.own_id, avatar, defaultAvatar);
|
||||
else
|
||||
AvatarDefs::getAvatarFromGxsId(dcpinfo.to_id, avatar, defaultAvatar);
|
||||
setPixmap(avatar);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
std::cerr << "WARNING: unhandled situation in AvatarWidget::refreshAvatarImage()" << std::endl;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ public:
|
|||
void setFrameType(FrameType type);
|
||||
void setId(const ChatId& id) ;
|
||||
void setOwnId();
|
||||
void setOwnId(const RsGxsId&);
|
||||
void setDefaultAvatar(const QString &avatar_file_name);
|
||||
|
||||
protected:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue