mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
fixed a few gui issues with acceptance of unknown peer
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-GenericTunneling@6345 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ca279ec0c2
commit
34e6fb6fa2
@ -253,10 +253,18 @@ void p3MsgService::checkSizeAndSendMessage(RsMsgItem *msg)
|
|||||||
// Indicate that the message is to be continued.
|
// Indicate that the message is to be continued.
|
||||||
//
|
//
|
||||||
item->msgFlags |= RS_MSG_FLAGS_PARTIAL ;
|
item->msgFlags |= RS_MSG_FLAGS_PARTIAL ;
|
||||||
sendItem(item) ;
|
|
||||||
|
if(msg->msgFlags & RS_MSG_FLAGS_DISTANT)
|
||||||
|
sendPrivateMsgItem(msg) ;
|
||||||
|
else
|
||||||
|
sendItem(item) ;
|
||||||
}
|
}
|
||||||
std::cerr << " Chopped off msg of size " << msg->message.size() << std::endl;
|
std::cerr << " Chopped off msg of size " << msg->message.size() << std::endl;
|
||||||
sendItem(msg) ;
|
|
||||||
|
if(msg->msgFlags & RS_MSG_FLAGS_DISTANT)
|
||||||
|
sendPrivateMsgItem(msg) ;
|
||||||
|
else
|
||||||
|
sendItem(msg) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int p3MsgService::checkOutgoingMessages()
|
int p3MsgService::checkOutgoingMessages()
|
||||||
@ -286,7 +294,7 @@ int p3MsgService::checkOutgoingMessages()
|
|||||||
std::string pid = mit->second->PeerId();
|
std::string pid = mit->second->PeerId();
|
||||||
bool toSend = false;
|
bool toSend = false;
|
||||||
|
|
||||||
if (mLinkMgr->isOnline(pid))
|
if(mit->second.msgFlags & RS_MSG_FLAGS_DISTANT || mLinkMgr->isOnline(pid))
|
||||||
{
|
{
|
||||||
toSend = true;
|
toSend = true;
|
||||||
}
|
}
|
||||||
@ -1558,6 +1566,10 @@ RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, const std::string &to)
|
|||||||
msg -> attachment.title = info.attach_title;
|
msg -> attachment.title = info.attach_title;
|
||||||
msg -> attachment.comment = info.attach_comment;
|
msg -> attachment.comment = info.attach_comment;
|
||||||
|
|
||||||
|
RsPeerDetails details ;
|
||||||
|
if(!rsPeers->getPeerDetails(to,details))
|
||||||
|
msg->msgFlags |= RS_MSG_FLAGS_DISTANT;
|
||||||
|
|
||||||
std::list<FileInfo>::iterator it;
|
std::list<FileInfo>::iterator it;
|
||||||
for(it = info.files.begin(); it != info.files.end(); it++)
|
for(it = info.files.begin(); it != info.files.end(); it++)
|
||||||
{
|
{
|
||||||
@ -1570,13 +1582,10 @@ RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, const std::string &to)
|
|||||||
|
|
||||||
/* translate flags from outside */
|
/* translate flags from outside */
|
||||||
if (info.msgflags & RS_MSG_USER_REQUEST)
|
if (info.msgflags & RS_MSG_USER_REQUEST)
|
||||||
{
|
|
||||||
msg->msgFlags |= RS_MSG_FLAGS_USER_REQUEST;
|
msg->msgFlags |= RS_MSG_FLAGS_USER_REQUEST;
|
||||||
}
|
|
||||||
if (info.msgflags & RS_MSG_FRIEND_RECOMMENDATION)
|
if (info.msgflags & RS_MSG_FRIEND_RECOMMENDATION)
|
||||||
{
|
|
||||||
msg->msgFlags |= RS_MSG_FLAGS_FRIEND_RECOMMENDATION;
|
msg->msgFlags |= RS_MSG_FLAGS_FRIEND_RECOMMENDATION;
|
||||||
}
|
|
||||||
|
|
||||||
//std::cerr << "p3MsgService::initMIRsMsg()" << std::endl;
|
//std::cerr << "p3MsgService::initMIRsMsg()" << std::endl;
|
||||||
//msg->print(std::cerr);
|
//msg->print(std::cerr);
|
||||||
@ -1596,7 +1605,7 @@ bool p3MsgService::createDistantOfflineMessengingInvite(time_t time_of_validity,
|
|||||||
hash = t_RsGenericIdType<DISTANT_MSG_HASH_SIZE>(hash_bytes).toStdString(false) ;
|
hash = t_RsGenericIdType<DISTANT_MSG_HASH_SIZE>(hash_bytes).toStdString(false) ;
|
||||||
|
|
||||||
DistantMessengingInvite invite ;
|
DistantMessengingInvite invite ;
|
||||||
invite.time_of_validity = time_of_validity ;
|
invite.time_of_validity = time_of_validity + time(NULL);
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||||
@ -1614,6 +1623,10 @@ bool p3MsgService::getDistantOfflineMessengingInvites(std::vector<DistantOffline
|
|||||||
invite.hash = it->first ;
|
invite.hash = it->first ;
|
||||||
invite.issuer_pgp_id = AuthGPG::getAuthGPG()->getGPGOwnId() ;
|
invite.issuer_pgp_id = AuthGPG::getAuthGPG()->getGPGOwnId() ;
|
||||||
invite.time_of_validity = it->second.time_of_validity ;
|
invite.time_of_validity = it->second.time_of_validity ;
|
||||||
|
|
||||||
|
invites.push_back(invite) ;
|
||||||
|
|
||||||
|
std::cerr << " adding invite with hash " << invite.hash << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
|
@ -1200,7 +1200,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageComposer::msgFriend(link._hash.toStdString(), false);
|
MessageComposer::msgDistantPeer(link._hash.toStdString(),link._GPGid.toStdString()) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case TYPE_PRIVATE_CHAT:
|
case TYPE_PRIVATE_CHAT:
|
||||||
|
@ -352,6 +352,22 @@ void MessageComposer::processSettings(bool bLoad)
|
|||||||
|
|
||||||
Settings->endGroup();
|
Settings->endGroup();
|
||||||
}
|
}
|
||||||
|
/*static*/ void MessageComposer::msgDistantPeer(const std::string& hash,const std::string& pgp_id)
|
||||||
|
{
|
||||||
|
// std::cerr << "MessageComposer::msgfriend()" << std::endl;
|
||||||
|
|
||||||
|
/* create a message */
|
||||||
|
|
||||||
|
MessageComposer *pMsgDialog = MessageComposer::newMsg();
|
||||||
|
if (pMsgDialog == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pMsgDialog->addRecipient(TO, hash,pgp_id) ;
|
||||||
|
pMsgDialog->show();
|
||||||
|
|
||||||
|
/* window will destroy itself! */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*static*/ void MessageComposer::msgFriend(const std::string &id, bool group)
|
/*static*/ void MessageComposer::msgFriend(const std::string &id, bool group)
|
||||||
{
|
{
|
||||||
@ -1402,7 +1418,13 @@ void MessageComposer::setRecipientToRow(int row, enumType type, std::string id,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RsPeerDetails details;
|
RsPeerDetails details;
|
||||||
if (rsPeers->getPeerDetails(id, details)) {
|
if(_distant_peers.find(id) != _distant_peers.end())
|
||||||
|
{
|
||||||
|
name = tr("Distant peer (PGP key: %1)").arg(QString::fromStdString(_distant_peers[id])) ;
|
||||||
|
icon = QIcon(StatusDefs::imageUser(RS_STATUS_ONLINE));
|
||||||
|
}
|
||||||
|
else if (rsPeers->getPeerDetails(id, details))
|
||||||
|
{
|
||||||
name = PeerDefs::nameWithLocation(details);
|
name = PeerDefs::nameWithLocation(details);
|
||||||
|
|
||||||
StatusInfo peerStatusInfo;
|
StatusInfo peerStatusInfo;
|
||||||
@ -1546,6 +1568,32 @@ void MessageComposer::editingRecipientFinished()
|
|||||||
lineEdit->setText(text);
|
lineEdit->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessageComposer::addRecipient(enumType type, const std::string& hash,const std::string& pgp_id)
|
||||||
|
{
|
||||||
|
_distant_peers[hash] = pgp_id ;
|
||||||
|
|
||||||
|
int rowCount = ui.recipientWidget->rowCount();
|
||||||
|
int row;
|
||||||
|
for (row = 0; row < rowCount; row++)
|
||||||
|
{
|
||||||
|
enumType rowType;
|
||||||
|
std::string rowId;
|
||||||
|
bool rowGroup;
|
||||||
|
|
||||||
|
if (getRecipientFromRow(row, rowType, rowId, rowGroup) == true)
|
||||||
|
{
|
||||||
|
if (rowId.empty()) // use row
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (rowId == hash && rowType == type) // existing row
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else // use row
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRecipientToRow(row, type, hash, false);
|
||||||
|
}
|
||||||
void MessageComposer::addRecipient(enumType type, const std::string &id, bool group)
|
void MessageComposer::addRecipient(enumType type, const std::string &id, bool group)
|
||||||
{
|
{
|
||||||
std::list<std::string> sslIds;
|
std::list<std::string> sslIds;
|
||||||
|
@ -49,6 +49,8 @@ public:
|
|||||||
~MessageComposer();
|
~MessageComposer();
|
||||||
|
|
||||||
static void msgFriend(const std::string &id, bool group);
|
static void msgFriend(const std::string &id, bool group);
|
||||||
|
static void msgDistantPeer(const std::string& hash,const std::string& pgp_id) ;
|
||||||
|
|
||||||
static QString recommendMessage();
|
static QString recommendMessage();
|
||||||
static void recommendFriend(const std::list <std::string> &sslIds, const std::string &to = "", const QString &msg = "", bool autoSend = false);
|
static void recommendFriend(const std::list <std::string> &sslIds, const std::string &to = "", const QString &msg = "", bool autoSend = false);
|
||||||
static void sendConnectAttemptMsg(const std::string &gpgId, const std::string &sslId, const QString &sslName);
|
static void sendConnectAttemptMsg(const std::string &gpgId, const std::string &sslId, const QString &sslName);
|
||||||
@ -65,6 +67,7 @@ public:
|
|||||||
void setQuotedMsg(const QString &msg, const QString &header);
|
void setQuotedMsg(const QString &msg, const QString &header);
|
||||||
void setMsgText(const QString &msg, bool asHtml = false);
|
void setMsgText(const QString &msg, bool asHtml = false);
|
||||||
void addRecipient(enumType type, const std::string &id, bool group);
|
void addRecipient(enumType type, const std::string &id, bool group);
|
||||||
|
void addRecipient(enumType type, const std::string &hash, const std::string& pgp_id) ;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/* actions to take.... */
|
/* actions to take.... */
|
||||||
@ -217,6 +220,7 @@ private:
|
|||||||
Ui::MessageComposer ui;
|
Ui::MessageComposer ui;
|
||||||
|
|
||||||
std::list<FileInfo> _recList ;
|
std::list<FileInfo> _recList ;
|
||||||
|
std::map<std::string,std::string> _distant_peers ; // pairs (hash,pgp_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user