mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 00:55:46 -04:00
ID cleaning
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7127 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fc163ff866
commit
80b73d2bc5
13 changed files with 151 additions and 179 deletions
|
@ -364,12 +364,12 @@ void NetworkDialog::sendDistantMessage()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sha1CheckSum hash ;
|
DistantMsgPeerId pid ;
|
||||||
RsPgpId mGpgId(wi->text(COLUMN_PEERID).toStdString()) ;
|
RsPgpId mGpgId(wi->text(COLUMN_PEERID).toStdString()) ;
|
||||||
|
|
||||||
if(rsMsgs->getDistantMessageHash(mGpgId,hash))
|
if(rsMsgs->getDistantMessagePeerId(mGpgId,pid))
|
||||||
{
|
{
|
||||||
nMsgDialog->addRecipient(MessageComposer::TO, hash, mGpgId);
|
nMsgDialog->addRecipient(MessageComposer::TO, pid, mGpgId);
|
||||||
nMsgDialog->show();
|
nMsgDialog->show();
|
||||||
nMsgDialog->activateWindow();
|
nMsgDialog->activateWindow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1495,7 +1495,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||||
std::cerr << " RetroShareLink::process MessageRequest : id : " << link.hash().toStdString() << ", subject : " << link.name().toStdString() << std::endl;
|
std::cerr << " RetroShareLink::process MessageRequest : id : " << link.hash().toStdString() << ", subject : " << link.name().toStdString() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
RsFileHash dm_hash ;
|
DistantMsgPeerId dm_pid ;
|
||||||
|
|
||||||
// This is awful, but apparently the hash can be multiple different types. Let's check!
|
// This is awful, but apparently the hash can be multiple different types. Let's check!
|
||||||
|
|
||||||
|
@ -1514,10 +1514,10 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||||
msg->show();
|
msg->show();
|
||||||
messageStarted.append(PeerDefs::nameWithLocation(detail));
|
messageStarted.append(PeerDefs::nameWithLocation(detail));
|
||||||
}
|
}
|
||||||
else if(rsMsgs->getDistantMessageHash(detail.gpg_id,dm_hash))
|
else if(rsMsgs->getDistantMessagePeerId(detail.gpg_id,dm_pid))
|
||||||
{
|
{
|
||||||
MessageComposer *msg = MessageComposer::newMsg();
|
MessageComposer *msg = MessageComposer::newMsg();
|
||||||
msg->addRecipient(MessageComposer::TO, dm_hash,detail.gpg_id) ;
|
msg->addRecipient(MessageComposer::TO, dm_pid,detail.gpg_id) ;
|
||||||
|
|
||||||
if (link.subject().isEmpty() == false) {
|
if (link.subject().isEmpty() == false) {
|
||||||
msg->setTitleText(link.subject());
|
msg->setTitleText(link.subject());
|
||||||
|
|
|
@ -51,7 +51,7 @@ void AvatarDefs::getAvatarFromSslId(const std::string& sslId, QPixmap &avatar, c
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
/* get avatar */
|
/* get avatar */
|
||||||
rsMsgs->getAvatarData(sslId, data, size);
|
rsMsgs->getAvatarData(RsPeerId(sslId), data, size);
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
avatar = QPixmap(defaultImage);
|
avatar = QPixmap(defaultImage);
|
||||||
return;
|
return;
|
||||||
|
@ -68,14 +68,14 @@ void AvatarDefs::getAvatarFromGpgId(const std::string& gpgId, QPixmap &avatar, c
|
||||||
unsigned char *data = NULL;
|
unsigned char *data = NULL;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
if (gpgId == rsPeers->getGPGOwnId()) {
|
if (RsPgpId(gpgId) == rsPeers->getGPGOwnId()) {
|
||||||
/* Its me */
|
/* Its me */
|
||||||
rsMsgs->getOwnAvatarData(data,size);
|
rsMsgs->getOwnAvatarData(data,size);
|
||||||
} else {
|
} else {
|
||||||
/* get the first available avatar of one of the ssl ids */
|
/* get the first available avatar of one of the ssl ids */
|
||||||
std::list<std::string> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
if (rsPeers->getAssociatedSSLIds(gpgId, sslIds)) {
|
if (rsPeers->getAssociatedSSLIds(RsPgpId(gpgId), sslIds)) {
|
||||||
std::list<std::string>::iterator sslId;
|
std::list<RsPeerId>::iterator sslId;
|
||||||
for (sslId = sslIds.begin(); sslId != sslIds.end(); sslId++) {
|
for (sslId = sslIds.begin(); sslId != sslIds.end(); sslId++) {
|
||||||
rsMsgs->getAvatarData(*sslId, data, size);
|
rsMsgs->getAvatarData(*sslId, data, size);
|
||||||
if (size) {
|
if (size) {
|
||||||
|
|
|
@ -107,13 +107,13 @@ void AvatarWidget::setFrameType(FrameType type)
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshStatus();
|
refreshStatus();
|
||||||
updateAvatar(QString::fromStdString(mId));
|
updateAvatar(QString::fromStdString(mId.toStdString()));
|
||||||
Rshare::refreshStyleSheet(this, false);
|
Rshare::refreshStyleSheet(this, false);
|
||||||
}
|
}
|
||||||
void AvatarWidget::setId(const RsPeerId &id)
|
void AvatarWidget::setId(const RsPeerId &id)
|
||||||
{
|
{
|
||||||
mId = id;
|
mId = id;
|
||||||
mPgpId = rsPeers->getGPGId(id) ;
|
// mPgpId = rsPeers->getGPGId(id) ;
|
||||||
// mFlag.isGpg = false ;
|
// mFlag.isGpg = false ;
|
||||||
|
|
||||||
if (mId == rsPeers->getOwnId()) {
|
if (mId == rsPeers->getOwnId()) {
|
||||||
|
@ -133,13 +133,13 @@ void AvatarWidget::setId(const RsPeerId &id)
|
||||||
|
|
||||||
void AvatarWidget::setOwnId()
|
void AvatarWidget::setOwnId()
|
||||||
{
|
{
|
||||||
setId(rsPeers->getOwnId(), false);
|
setId(rsPeers->getOwnId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarWidget::setDefaultAvatar(const QString &avatar)
|
void AvatarWidget::setDefaultAvatar(const QString &avatar)
|
||||||
{
|
{
|
||||||
defaultAvatar = avatar;
|
defaultAvatar = avatar;
|
||||||
updateAvatar(QString::fromStdString(mId));
|
updateAvatar(QString::fromStdString(mId.toStdString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarWidget::refreshStatus()
|
void AvatarWidget::refreshStatus()
|
||||||
|
@ -161,7 +161,7 @@ void AvatarWidget::refreshStatus()
|
||||||
// No check of return value. Non existing status info is handled as offline.
|
// No check of return value. Non existing status info is handled as offline.
|
||||||
rsStatus->getStatus(mId, statusInfo);
|
rsStatus->getStatus(mId, statusInfo);
|
||||||
}
|
}
|
||||||
updateStatus(QString::fromStdString(statusInfo.id), statusInfo.status);
|
updateStatus(QString::fromStdString(statusInfo.id.toStdString()), statusInfo.status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,12 +173,12 @@ void AvatarWidget::updateStatus(const QString peerId, int status)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mId.empty()) {
|
if (mId.isNull()) {
|
||||||
mPeerState = status;
|
mPeerState = status;
|
||||||
Rshare::refreshStyleSheet(this, false);
|
Rshare::refreshStyleSheet(this, false);
|
||||||
} else {
|
} else {
|
||||||
/* set style for status */
|
/* set style for status */
|
||||||
if (mId == peerId.toStdString()) {
|
if (mId.toStdString() == peerId.toStdString()) {
|
||||||
// the peers status has changed
|
// the peers status has changed
|
||||||
mPeerState = status;
|
mPeerState = status;
|
||||||
setEnabled(((uint32_t) status == RS_STATUS_OFFLINE) ? false : true);
|
setEnabled(((uint32_t) status == RS_STATUS_OFFLINE) ? false : true);
|
||||||
|
@ -189,7 +189,7 @@ void AvatarWidget::updateStatus(const QString peerId, int status)
|
||||||
|
|
||||||
void AvatarWidget::updateAvatar(const QString &peerId)
|
void AvatarWidget::updateAvatar(const QString &peerId)
|
||||||
{
|
{
|
||||||
if (mId.empty()) {
|
if (mId.isNull()) {
|
||||||
QPixmap avatar(defaultAvatar);
|
QPixmap avatar(defaultAvatar);
|
||||||
setPixmap(avatar);
|
setPixmap(avatar);
|
||||||
return;
|
return;
|
||||||
|
@ -227,9 +227,9 @@ void AvatarWidget::updateAvatar(const QString &peerId)
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (mId == peerId.toStdString()) {
|
if (mId.toStdString() == peerId.toStdString()) {
|
||||||
QPixmap avatar;
|
QPixmap avatar;
|
||||||
AvatarDefs::getAvatarFromSslId(mId, avatar, defaultAvatar);
|
AvatarDefs::getAvatarFromSslId(mId.toStdString(), avatar, defaultAvatar);
|
||||||
setPixmap(avatar);
|
setPixmap(avatar);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,6 @@ void AvatarWidget::updateAvatar(const QString &peerId)
|
||||||
void AvatarWidget::updateOwnAvatar()
|
void AvatarWidget::updateOwnAvatar()
|
||||||
{
|
{
|
||||||
if (mFlag.isOwnId) {
|
if (mFlag.isOwnId) {
|
||||||
updateAvatar(QString::fromStdString(mId));
|
updateAvatar(QString::fromStdString(mId.toStdString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,7 +429,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
|
||||||
|
|
||||||
GroupDefs::sortByName(groupInfoList);
|
GroupDefs::sortByName(groupInfoList);
|
||||||
|
|
||||||
std::string gpgId = getRsId(c);
|
RsPgpId gpgId ( getRsId(c));
|
||||||
|
|
||||||
QTreeWidgetItem *parent = c->parent();
|
QTreeWidgetItem *parent = c->parent();
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ void FriendList::insertPeers()
|
||||||
case TYPE_GPG:
|
case TYPE_GPG:
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *parent = item->parent();
|
QTreeWidgetItem *parent = item->parent();
|
||||||
std::string gpg_widget_id = getRsId(item);
|
RsPgpId gpg_widget_id ( getRsId(item));
|
||||||
|
|
||||||
// remove items that are not friends anymore
|
// remove items that are not friends anymore
|
||||||
if (std::find(gpgFriends.begin(), gpgFriends.end(), gpg_widget_id) == gpgFriends.end()) {
|
if (std::find(gpgFriends.begin(), gpgFriends.end(), gpg_widget_id) == gpgFriends.end()) {
|
||||||
|
@ -752,7 +752,7 @@ void FriendList::insertPeers()
|
||||||
while (childIndex < childCount) {
|
while (childIndex < childCount) {
|
||||||
QTreeWidgetItem *gpgItemLoop = groupItem->child(childIndex);
|
QTreeWidgetItem *gpgItemLoop = groupItem->child(childIndex);
|
||||||
if (gpgItemLoop->type() == TYPE_GPG) {
|
if (gpgItemLoop->type() == TYPE_GPG) {
|
||||||
if (std::find(groupInfo->peerIds.begin(), groupInfo->peerIds.end(), getRsId(gpgItemLoop)) == groupInfo->peerIds.end()) {
|
if (std::find(groupInfo->peerIds.begin(), groupInfo->peerIds.end(), RsPgpId(getRsId(gpgItemLoop))) == groupInfo->peerIds.end()) {
|
||||||
delete(groupItem->takeChild(groupItem->indexOfChild(gpgItemLoop)));
|
delete(groupItem->takeChild(groupItem->indexOfChild(gpgItemLoop)));
|
||||||
childCount = groupItem->childCount();
|
childCount = groupItem->childCount();
|
||||||
continue;
|
continue;
|
||||||
|
@ -803,14 +803,14 @@ void FriendList::insertPeers()
|
||||||
int itemCount = groupItem ? groupItem->childCount() : peerTreeWidget->topLevelItemCount();
|
int itemCount = groupItem ? groupItem->childCount() : peerTreeWidget->topLevelItemCount();
|
||||||
for (int index = 0; index < itemCount; index++) {
|
for (int index = 0; index < itemCount; index++) {
|
||||||
gpgItemLoop = groupItem ? groupItem->child(index) : peerTreeWidget->topLevelItem(index);
|
gpgItemLoop = groupItem ? groupItem->child(index) : peerTreeWidget->topLevelItem(index);
|
||||||
if (gpgItemLoop->type() == TYPE_GPG && getRsId(gpgItemLoop) == gpgId) {
|
if (gpgItemLoop->type() == TYPE_GPG && getRsId(gpgItemLoop) == gpgId.toStdString()) {
|
||||||
gpgItem = gpgItemLoop;
|
gpgItem = gpgItemLoop;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
if ((!rsPeers->getPeerDetails(gpgId, detail) || !detail.accept_connection) && detail.gpg_id != ownId) {
|
if ((!rsPeers->getGPGDetails(gpgId, detail) || !detail.accept_connection) && detail.gpg_id != ownId) {
|
||||||
// don't accept anymore connection, remove from the view
|
// don't accept anymore connection, remove from the view
|
||||||
if (gpgItem) {
|
if (gpgItem) {
|
||||||
if (groupItem) {
|
if (groupItem) {
|
||||||
|
@ -837,7 +837,7 @@ void FriendList::insertPeers()
|
||||||
gpgItem->setTextAlignment(COLUMN_NAME, Qt::AlignLeft | Qt::AlignVCenter);
|
gpgItem->setTextAlignment(COLUMN_NAME, Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
||||||
/* not displayed, used to find back the item */
|
/* not displayed, used to find back the item */
|
||||||
gpgItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id));
|
gpgItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id.toStdString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBigName && !mHideState && isStatusColumnHidden) {
|
if (mBigName && !mHideState && isStatusColumnHidden) {
|
||||||
|
@ -855,7 +855,7 @@ void FriendList::insertPeers()
|
||||||
int childIndex = 0;
|
int childIndex = 0;
|
||||||
while (childIndex < childCount) {
|
while (childIndex < childCount) {
|
||||||
std::string ssl_id = getRsId(gpgItem->child(childIndex));
|
std::string ssl_id = getRsId(gpgItem->child(childIndex));
|
||||||
if (!rsPeers->isFriend(ssl_id)) {
|
if (!rsPeers->isFriend(RsPeerId(ssl_id))) {
|
||||||
delete (gpgItem->takeChild(childIndex));
|
delete (gpgItem->takeChild(childIndex));
|
||||||
// count again
|
// count again
|
||||||
childCount = gpgItem->childCount();
|
childCount = gpgItem->childCount();
|
||||||
|
@ -870,23 +870,23 @@ void FriendList::insertPeers()
|
||||||
bool gpg_hasPrivateChat = false;
|
bool gpg_hasPrivateChat = false;
|
||||||
int bestPeerState = 0; // for gpg item
|
int bestPeerState = 0; // for gpg item
|
||||||
unsigned int bestRSState = 0; // for gpg item
|
unsigned int bestRSState = 0; // for gpg item
|
||||||
std::string bestSslId; // for gpg item
|
RsPeerId bestSslId; // for gpg item
|
||||||
QString bestCustomStateString;// for gpg item
|
QString bestCustomStateString;// for gpg item
|
||||||
std::list<std::string> sslContacts;
|
std::list<RsPeerId> sslContacts;
|
||||||
QDateTime lastContact;
|
QDateTime lastContact;
|
||||||
QString itemIP;
|
QString itemIP;
|
||||||
|
|
||||||
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslContacts);
|
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslContacts);
|
||||||
for (std::list<std::string>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) {
|
for (std::list<RsPeerId>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) {
|
||||||
QTreeWidgetItem *sslItem = NULL;
|
QTreeWidgetItem *sslItem = NULL;
|
||||||
std::string sslId = *sslIt;
|
RsPeerId sslId = *sslIt;
|
||||||
|
|
||||||
//find the corresponding sslItem child item of the gpg item
|
//find the corresponding sslItem child item of the gpg item
|
||||||
bool newChild = true;
|
bool newChild = true;
|
||||||
childCount = gpgItem->childCount();
|
childCount = gpgItem->childCount();
|
||||||
for (int childIndex = 0; childIndex < childCount; childIndex++) {
|
for (int childIndex = 0; childIndex < childCount; childIndex++) {
|
||||||
// we assume, that only ssl items are child of the gpg item, so we don't need to test the type
|
// we assume, that only ssl items are child of the gpg item, so we don't need to test the type
|
||||||
if (getRsId(gpgItem->child(childIndex)) == sslId) {
|
if (getRsId(gpgItem->child(childIndex)) == sslId.toStdString()) {
|
||||||
sslItem = gpgItem->child(childIndex);
|
sslItem = gpgItem->child(childIndex);
|
||||||
newChild = false;
|
newChild = false;
|
||||||
break;
|
break;
|
||||||
|
@ -917,7 +917,7 @@ void FriendList::insertPeers()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not displayed, used to find back the item */
|
/* not displayed, used to find back the item */
|
||||||
sslItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id));
|
sslItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id.toStdString()));
|
||||||
|
|
||||||
QString sText;
|
QString sText;
|
||||||
QString customStateString;
|
QString customStateString;
|
||||||
|
@ -1146,7 +1146,7 @@ void FriendList::insertPeers()
|
||||||
// only set the avatar image the first time, or when it changed
|
// only set the avatar image the first time, or when it changed
|
||||||
// otherwise getAvatarFromSslId sends request packages to peers.
|
// otherwise getAvatarFromSslId sends request packages to peers.
|
||||||
QPixmap avatar;
|
QPixmap avatar;
|
||||||
AvatarDefs::getAvatarFromSslId(bestSslId, avatar);
|
AvatarDefs::getAvatarFromSslId(bestSslId.toStdString(), avatar);
|
||||||
QIcon avatar_icon(avatar);
|
QIcon avatar_icon(avatar);
|
||||||
gpgItem->setIcon(COLUMN_AVATAR, avatar_icon);
|
gpgItem->setIcon(COLUMN_AVATAR, avatar_icon);
|
||||||
}
|
}
|
||||||
|
@ -1160,7 +1160,7 @@ void FriendList::insertPeers()
|
||||||
gpgItem->setData(COLUMN_IP, Qt::DisplayRole, QVariant());
|
gpgItem->setData(COLUMN_IP, Qt::DisplayRole, QVariant());
|
||||||
gpgItem->setData(COLUMN_IP, ROLE_SORT, "2 " + itemIP);
|
gpgItem->setData(COLUMN_IP, ROLE_SORT, "2 " + itemIP);
|
||||||
|
|
||||||
if (openPeers != NULL && openPeers->find(gpgId) != openPeers->end()) {
|
if (openPeers != NULL && openPeers->find(gpgId.toStdString()) != openPeers->end()) {
|
||||||
gpgItem->setExpanded(true);
|
gpgItem->setExpanded(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1287,7 +1287,7 @@ void FriendList::chatfriend(QTreeWidgetItem *pPeer)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string id = getRsId(pPeer);
|
std::string id = getRsId(pPeer);
|
||||||
ChatDialog::chatFriend(id);
|
ChatDialog::chatFriend(RsPeerId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendList::addFriend()
|
void FriendList::addFriend()
|
||||||
|
@ -1311,7 +1311,8 @@ void FriendList::msgfriend()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string id = getRsId(peer);
|
std::string id = getRsId(peer);
|
||||||
MessageComposer::msgFriend(id, (peer->type() == TYPE_GROUP));
|
|
||||||
|
MessageComposer::msgFriend(RsPeerId(id), (peer->type() == TYPE_GROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendList::recommendfriend()
|
void FriendList::recommendfriend()
|
||||||
|
@ -1322,14 +1323,15 @@ void FriendList::recommendfriend()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string peerId = getRsId(peer);
|
std::string peerId = getRsId(peer);
|
||||||
std::list<std::string> ids;
|
std::list<RsPeerId> ids;
|
||||||
|
|
||||||
switch (peer->type()) {
|
switch (peer->type())
|
||||||
|
{
|
||||||
case TYPE_SSL:
|
case TYPE_SSL:
|
||||||
ids.push_back(peerId);
|
ids.push_back(RsPeerId(peerId));
|
||||||
break;
|
break;
|
||||||
case TYPE_GPG:
|
case TYPE_GPG:
|
||||||
rsPeers->getAssociatedSSLIds(peerId, ids);
|
rsPeers->getAssociatedSSLIds(RsPgpId(peerId), ids);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
@ -1348,8 +1350,9 @@ void FriendList::copyFullCertificate()
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *c = getCurrentPeer();
|
QTreeWidgetItem *c = getCurrentPeer();
|
||||||
QList<RetroShareLink> urls;
|
QList<RetroShareLink> urls;
|
||||||
RetroShareLink link ;
|
RetroShareLink link ;
|
||||||
link.createCertificate(getRsId(c)) ;
|
|
||||||
|
link.createCertificate(RsPeerId(getRsId(c))) ;
|
||||||
urls.push_back(link);
|
urls.push_back(link);
|
||||||
|
|
||||||
std::cerr << "link: " << std::endl;
|
std::cerr << "link: " << std::endl;
|
||||||
|
@ -1464,9 +1467,12 @@ void FriendList::removefriend()
|
||||||
|
|
||||||
if (rsPeers)
|
if (rsPeers)
|
||||||
{
|
{
|
||||||
|
if(RsPgpId(getRsId(c)).isNull())
|
||||||
|
return ;
|
||||||
|
|
||||||
if ((QMessageBox::question(this, "RetroShare", tr("Do you want to remove this Friend?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)) == QMessageBox::Yes)
|
if ((QMessageBox::question(this, "RetroShare", tr("Do you want to remove this Friend?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)) == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
rsPeers->removeFriend(getRsId(c));
|
rsPeers->removeFriend(RsPgpId(getRsId(c)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1492,22 +1498,22 @@ void FriendList::connectfriend()
|
||||||
for (int childIndex = 0; childIndex < childCount; childIndex++) {
|
for (int childIndex = 0; childIndex < childCount; childIndex++) {
|
||||||
QTreeWidgetItem *item = c->child(childIndex);
|
QTreeWidgetItem *item = c->child(childIndex);
|
||||||
if (item->type() == TYPE_SSL) {
|
if (item->type() == TYPE_SSL) {
|
||||||
rsPeers->connectAttempt(getRsId(item));
|
rsPeers->connectAttempt(RsPeerId(getRsId(item)));
|
||||||
item->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2)));
|
item->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2)));
|
||||||
|
|
||||||
// Launch ProgressDialog, only if single SSL child.
|
// Launch ProgressDialog, only if single SSL child.
|
||||||
if (childCount == 1)
|
if (childCount == 1)
|
||||||
{
|
{
|
||||||
ConnectProgressDialog::showProgress(getRsId(item));
|
ConnectProgressDialog::showProgress(RsPeerId(getRsId(item)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//this is a SSL key
|
//this is a SSL key
|
||||||
rsPeers->connectAttempt(getRsId(c));
|
rsPeers->connectAttempt(RsPeerId(getRsId(c)));
|
||||||
c->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2)));
|
c->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2)));
|
||||||
// Launch ProgressDialog.
|
// Launch ProgressDialog.
|
||||||
ConnectProgressDialog::showProgress(getRsId(c));
|
ConnectProgressDialog::showProgress(RsPeerId(getRsId(c)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1515,7 +1521,12 @@ void FriendList::connectfriend()
|
||||||
/* GUI stuff -> don't do anything directly with Control */
|
/* GUI stuff -> don't do anything directly with Control */
|
||||||
void FriendList::configurefriend()
|
void FriendList::configurefriend()
|
||||||
{
|
{
|
||||||
ConfCertDialog::showIt(getRsId(getCurrentPeer()), ConfCertDialog::PageDetails);
|
if(!RsPeerId(getRsId(getCurrentPeer())).isNull())
|
||||||
|
ConfCertDialog::showIt(RsPeerId(getRsId(getCurrentPeer())), ConfCertDialog::PageDetails);
|
||||||
|
else if(!RsPgpId(getRsId(getCurrentPeer())).isNull())
|
||||||
|
ConfCertDialog::showIt(RsPgpId(getRsId(getCurrentPeer())), ConfCertDialog::PageDetails);
|
||||||
|
else
|
||||||
|
std::cerr << "FriendList::configurefriend: id is not an SSL nor a PGP id." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void FriendList::showLobby()
|
// void FriendList::showLobby()
|
||||||
|
@ -1548,7 +1559,7 @@ void FriendList::configurefriend()
|
||||||
// ChatDialog::closeChat(vpeer_id);
|
// ChatDialog::closeChat(vpeer_id);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<std::string> &sslIds)
|
void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &sslIds)
|
||||||
{
|
{
|
||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -1558,16 +1569,16 @@ void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<std::string>
|
||||||
|
|
||||||
switch (item->type()) {
|
switch (item->type()) {
|
||||||
case TYPE_SSL:
|
case TYPE_SSL:
|
||||||
sslIds.push_back(peerId);
|
sslIds.push_back(RsPeerId(peerId));
|
||||||
break;
|
break;
|
||||||
case TYPE_GPG:
|
case TYPE_GPG:
|
||||||
rsPeers->getAssociatedSSLIds(peerId, sslIds);
|
rsPeers->getAssociatedSSLIds(RsPgpId(peerId), sslIds);
|
||||||
break;
|
break;
|
||||||
case TYPE_GROUP:
|
case TYPE_GROUP:
|
||||||
{
|
{
|
||||||
RsGroupInfo groupInfo;
|
RsGroupInfo groupInfo;
|
||||||
if (rsPeers->getGroupInfo(peerId, groupInfo)) {
|
if (rsPeers->getGroupInfo(peerId, groupInfo)) {
|
||||||
std::list<std::string>::iterator gpgIt;
|
std::list<RsPgpId>::iterator gpgIt;
|
||||||
for (gpgIt = groupInfo.peerIds.begin(); gpgIt != groupInfo.peerIds.end(); ++gpgIt) {
|
for (gpgIt = groupInfo.peerIds.begin(); gpgIt != groupInfo.peerIds.end(); ++gpgIt) {
|
||||||
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
||||||
}
|
}
|
||||||
|
@ -1577,42 +1588,6 @@ void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<std::string>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
|
||||||
void FriendList::inviteToLobby()
|
|
||||||
{
|
|
||||||
QTreeWidgetItem *c = getCurrentPeer();
|
|
||||||
|
|
||||||
std::list<std::string> sslIds;
|
|
||||||
getSslIdsFromItem(c, sslIds);
|
|
||||||
|
|
||||||
std::string lobby_id = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
|
||||||
if (lobby_id.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
ChatLobbyId lobbyId = QString::fromStdString(lobby_id).toULongLong();
|
|
||||||
|
|
||||||
// add to group
|
|
||||||
std::list<std::string>::iterator it;
|
|
||||||
for (it = sslIds.begin(); it != sslIds.end(); ++it) {
|
|
||||||
rsMsgs->invitePeerToLobby(lobbyId, *it);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string vpeer_id;
|
|
||||||
if (rsMsgs->getVirtualPeerId(lobbyId, vpeer_id))
|
|
||||||
ChatDialog::chatFriend(vpeer_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FriendList::createchatlobby()
|
|
||||||
{
|
|
||||||
QTreeWidgetItem *c = getCurrentPeer();
|
|
||||||
|
|
||||||
std::list<std::string> sslIds;
|
|
||||||
getSslIdsFromItem(c, sslIds);
|
|
||||||
|
|
||||||
CreateLobbyDialog(sslIds).exec();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void FriendList::addToGroup()
|
void FriendList::addToGroup()
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *c = getCurrentPeer();
|
QTreeWidgetItem *c = getCurrentPeer();
|
||||||
|
@ -1626,9 +1601,9 @@ void FriendList::addToGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
||||||
std::string gpgId = getRsId(c);
|
RsPgpId gpgId ( getRsId(c));
|
||||||
|
|
||||||
if (gpgId.empty() || groupId.empty()) {
|
if (gpgId.isNull() || groupId.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1652,9 +1627,9 @@ void FriendList::moveToGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
||||||
std::string gpgId = getRsId(c);
|
RsPgpId gpgId ( getRsId(c));
|
||||||
|
|
||||||
if (gpgId.empty() || groupId.empty()) {
|
if (gpgId.isNull() || groupId.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1681,9 +1656,9 @@ void FriendList::removeFromGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
||||||
std::string gpgId = getRsId(c);
|
RsPgpId gpgId ( getRsId(c));
|
||||||
|
|
||||||
if (gpgId.empty()) {
|
if (gpgId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ private:
|
||||||
static bool filterItem(QTreeWidgetItem *item, const QString &text);
|
static bool filterItem(QTreeWidgetItem *item, const QString &text);
|
||||||
void updateHeader();
|
void updateHeader();
|
||||||
void initializeHeader(bool afterLoadSettings);
|
void initializeHeader(bool afterLoadSettings);
|
||||||
void getSslIdsFromItem(QTreeWidgetItem *item, std::list<std::string> &sslIds);
|
void getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &sslIds);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void groupsChanged();
|
void groupsChanged();
|
||||||
|
|
|
@ -211,7 +211,7 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
||||||
item->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id));
|
item->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id.toStdString()));
|
||||||
item->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
item->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,19 +233,19 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
mInFillList = true;
|
mInFillList = true;
|
||||||
|
|
||||||
// get selected items
|
// get selected items
|
||||||
std::list<std::string> sslIdsSelected;
|
std::list<RsPeerId> sslIdsSelected;
|
||||||
if (mShowTypes & SHOW_SSL) {
|
if (mShowTypes & SHOW_SSL) {
|
||||||
selectedSslIds(sslIdsSelected, true);
|
selectedIds<RsPeerId,IDTYPE_SSL>(sslIdsSelected,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> groupIdsSelected;
|
std::list<std::string> groupIdsSelected;
|
||||||
if (mShowTypes & SHOW_GROUP) {
|
if (mShowTypes & SHOW_GROUP) {
|
||||||
selectedGroupIds(groupIdsSelected);
|
selectedIds<std::string,IDTYPE_GROUP>(groupIdsSelected,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> gpgIdsSelected;
|
std::list<RsPgpId> gpgIdsSelected;
|
||||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||||
selectedGpgIds(gpgIdsSelected, true);
|
selectedIds<RsPgpId,IDTYPE_GPG>(gpgIdsSelected,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove old items
|
// remove old items
|
||||||
|
@ -256,16 +256,16 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
std::list<RsGroupInfo>::iterator groupIt;
|
std::list<RsGroupInfo>::iterator groupIt;
|
||||||
rsPeers->getGroupInfoList(groupInfoList);
|
rsPeers->getGroupInfoList(groupInfoList);
|
||||||
|
|
||||||
std::list<std::string> gpgIds;
|
std::list<RsPgpId> gpgIds;
|
||||||
std::list<std::string>::iterator gpgIt;
|
std::list<RsPgpId>::iterator gpgIt;
|
||||||
|
|
||||||
if(mShowTypes & SHOW_NON_FRIEND_GPG)
|
if(mShowTypes & SHOW_NON_FRIEND_GPG)
|
||||||
rsPeers->getGPGAllList(gpgIds);
|
rsPeers->getGPGAllList(gpgIds);
|
||||||
else
|
else
|
||||||
rsPeers->getGPGAcceptedList(gpgIds);
|
rsPeers->getGPGAcceptedList(gpgIds);
|
||||||
|
|
||||||
std::list<std::string> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
std::list<std::string>::iterator sslIt;
|
std::list<RsPeerId>::iterator sslIt;
|
||||||
|
|
||||||
if ((mShowTypes & (SHOW_SSL | SHOW_GPG)) == SHOW_SSL) {
|
if ((mShowTypes & (SHOW_SSL | SHOW_GPG)) == SHOW_SSL) {
|
||||||
rsPeers->getFriendList(sslIds);
|
rsPeers->getFriendList(sslIds);
|
||||||
|
|
|
@ -61,7 +61,7 @@ const QString PeerDefs::rsidFromId(const RsPeerId &id, QString *name /* = NULL*/
|
||||||
QString rsid;
|
QString rsid;
|
||||||
|
|
||||||
std::string peerName = rsPeers->getPeerName(id);
|
std::string peerName = rsPeers->getPeerName(id);
|
||||||
std::string hash ;
|
DistantMsgPeerId pid ;
|
||||||
|
|
||||||
if(!peerName.empty())
|
if(!peerName.empty())
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ const QString PeerDefs::rsidFromId(const RsPeerId &id, QString *name /* = NULL*/
|
||||||
*name = QString::fromUtf8(peerName.c_str());
|
*name = QString::fromUtf8(peerName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(rsMsgs->getDistantMessageHash(rsPeers->getGPGOwnId(),hash) && hash == id)
|
else if(rsMsgs->getDistantMessagePeerId(rsPeers->getGPGOwnId(),pid) && pid == id)
|
||||||
{
|
{
|
||||||
// not a real peer. Try from hash for distant messages
|
// not a real peer. Try from hash for distant messages
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
|
|
||||||
template<class ID_CLASS> static void showIt(const ID_CLASS& id, enumPage page)
|
template<class ID_CLASS> static void showIt(const ID_CLASS& id, enumPage page)
|
||||||
{
|
{
|
||||||
ConfCertDialog *confdialog = instance(id);
|
ConfCertDialog *confdialog = confdialog = instance(id);
|
||||||
|
|
||||||
switch (page) {
|
switch (page) {
|
||||||
case PageDetails:
|
case PageDetails:
|
||||||
|
|
|
@ -365,14 +365,14 @@ void MessageComposer::processSettings(bool bLoad)
|
||||||
|
|
||||||
/* create a message */
|
/* create a message */
|
||||||
|
|
||||||
Sha1CheckSum hash ;
|
DistantMsgPeerId pid ;
|
||||||
rsMsgs->getDistantMessageHash(pgp_id,hash) ;
|
rsMsgs->getDistantMessagePeerId(pgp_id,pid) ;
|
||||||
|
|
||||||
MessageComposer *pMsgDialog = MessageComposer::newMsg();
|
MessageComposer *pMsgDialog = MessageComposer::newMsg();
|
||||||
if (pMsgDialog == NULL)
|
if (pMsgDialog == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pMsgDialog->addRecipient(TO, hash,pgp_id) ;
|
pMsgDialog->addRecipient(TO,pid,pgp_id) ;
|
||||||
pMsgDialog->show();
|
pMsgDialog->show();
|
||||||
|
|
||||||
/* window will destroy itself! */
|
/* window will destroy itself! */
|
||||||
|
@ -683,11 +683,11 @@ void MessageComposer::peerStatusChanged(const QString& peer_id, int status)
|
||||||
|
|
||||||
for (row = 0; row < rowCount; row++) {
|
for (row = 0; row < rowCount; row++) {
|
||||||
enumType type;
|
enumType type;
|
||||||
RsPeerId id;
|
std::string id;
|
||||||
bool group;
|
bool group;
|
||||||
|
|
||||||
if (getRecipientFromRow(row, type, id, group) && !id.isNull() ) {
|
if (getRecipientFromRow(row, type, id, group) && !id.empty() ) {
|
||||||
if (group == false && QString::fromStdString(id.toStdString()) == peer_id) {
|
if (group == false && QString::fromStdString(id) == peer_id) {
|
||||||
QTableWidgetItem *item = ui.recipientWidget->item(row, COLUMN_RECIPIENT_ICON);
|
QTableWidgetItem *item = ui.recipientWidget->item(row, COLUMN_RECIPIENT_ICON);
|
||||||
if (item) {
|
if (item) {
|
||||||
item->setIcon(QIcon(StatusDefs::imageUser(status)));
|
item->setIcon(QIcon(StatusDefs::imageUser(status)));
|
||||||
|
@ -1352,10 +1352,10 @@ void MessageComposer::addEmptyRecipient()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setRecipientToRow(lastRow, TO, RsPeerId(), false);
|
setRecipientToRow(lastRow, TO,"", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessageComposer::getRecipientFromRow(int row, enumType &type, RsPeerId &id, bool &group)
|
bool MessageComposer::getRecipientFromRow(int row, enumType &type, std::string &id, bool &group)
|
||||||
{
|
{
|
||||||
if (row >= ui.recipientWidget->rowCount()) {
|
if (row >= ui.recipientWidget->rowCount()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1367,13 +1367,13 @@ bool MessageComposer::getRecipientFromRow(int row, enumType &type, RsPeerId &id,
|
||||||
}
|
}
|
||||||
|
|
||||||
type = (enumType) cb->itemData(cb->currentIndex(), Qt::UserRole).toInt();
|
type = (enumType) cb->itemData(cb->currentIndex(), Qt::UserRole).toInt();
|
||||||
id = RsPeerId(ui.recipientWidget->item(row, COLUMN_RECIPIENT_DATA)->data(ROLE_RECIPIENT_ID).toString().toStdString());
|
id = ui.recipientWidget->item(row, COLUMN_RECIPIENT_DATA)->data(ROLE_RECIPIENT_ID).toString().toStdString();
|
||||||
group = ui.recipientWidget->item(row, COLUMN_RECIPIENT_DATA)->data(ROLE_RECIPIENT_GROUP).toBool();
|
group = ui.recipientWidget->item(row, COLUMN_RECIPIENT_DATA)->data(ROLE_RECIPIENT_GROUP).toBool();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::setRecipientToRow(int row, enumType type, const RsPeerId &id, bool group)
|
void MessageComposer::setRecipientToRow(int row, enumType type, const std::string& id, bool group)
|
||||||
{
|
{
|
||||||
if (row + 1 > ui.recipientWidget->rowCount()) {
|
if (row + 1 > ui.recipientWidget->rowCount()) {
|
||||||
ui.recipientWidget->setRowCount(row + 1);
|
ui.recipientWidget->setRowCount(row + 1);
|
||||||
|
@ -1408,7 +1408,7 @@ void MessageComposer::setRecipientToRow(int row, enumType type, const RsPeerId &
|
||||||
|
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
QString name;
|
QString name;
|
||||||
if (!id.isNull())
|
if (!id.empty())
|
||||||
{
|
{
|
||||||
if (group)
|
if (group)
|
||||||
{
|
{
|
||||||
|
@ -1419,31 +1419,30 @@ void MessageComposer::setRecipientToRow(int row, enumType type, const RsPeerId &
|
||||||
name = GroupDefs::name(groupInfo);
|
name = GroupDefs::name(groupInfo);
|
||||||
} else {
|
} else {
|
||||||
name = tr("Unknown");
|
name = tr("Unknown");
|
||||||
id.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RsPeerDetails details;
|
RsPeerDetails details;
|
||||||
|
|
||||||
if(_distant_peers.find(id) != _distant_peers.end())
|
if(_distant_peers.find(RsPeerId(id)) != _distant_peers.end())
|
||||||
{
|
{
|
||||||
if(!rsPeers->getPeerDetails(_distant_peers[id], details))
|
if(!rsPeers->getGPGDetails(_distant_peers[RsPeerId(id)], details))
|
||||||
{
|
{
|
||||||
std::cerr << "Can't get peer details from " << _distant_peers[id] << std::endl;
|
std::cerr << "Can't get peer details from " << _distant_peers[RsPeerId(id)] << std::endl;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = tr("Distant peer (name: %2, PGP key: %1)").arg(QString::fromStdString(_distant_peers[id])).arg(QString::fromStdString(details.name)) ;
|
name = tr("Distant peer (name: %2, PGP key: %1)").arg(QString::fromStdString(_distant_peers[RsPeerId(id)].toStdString())).arg(QString::fromStdString(details.name)) ;
|
||||||
icon = QIcon(StatusDefs::imageUser(RS_STATUS_ONLINE));
|
icon = QIcon(StatusDefs::imageUser(RS_STATUS_ONLINE));
|
||||||
}
|
}
|
||||||
else if(rsPeers->getPeerDetails(id, details) && (!details.isOnlyGPGdetail))
|
else if(rsPeers->getPeerDetails(RsPeerId(id), details) && (!details.isOnlyGPGdetail))
|
||||||
{
|
{
|
||||||
name = PeerDefs::nameWithLocation(details);
|
name = PeerDefs::nameWithLocation(details);
|
||||||
|
|
||||||
StatusInfo peerStatusInfo;
|
StatusInfo peerStatusInfo;
|
||||||
// No check of return value. Non existing status info is handled as offline.
|
// No check of return value. Non existing status info is handled as offline.
|
||||||
rsStatus->getStatus(id, peerStatusInfo);
|
rsStatus->getStatus(RsPeerId(id), peerStatusInfo);
|
||||||
|
|
||||||
icon = QIcon(StatusDefs::imageUser(peerStatusInfo.status));
|
icon = QIcon(StatusDefs::imageUser(peerStatusInfo.status));
|
||||||
}
|
}
|
||||||
|
@ -1451,7 +1450,6 @@ void MessageComposer::setRecipientToRow(int row, enumType type, const RsPeerId &
|
||||||
{
|
{
|
||||||
icon = QIcon(StatusDefs::imageUser(RS_STATUS_OFFLINE));
|
icon = QIcon(StatusDefs::imageUser(RS_STATUS_OFFLINE));
|
||||||
name = tr("Unknown friend");
|
name = tr("Unknown friend");
|
||||||
id.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1560,7 +1558,7 @@ void MessageComposer::editingRecipientFinished()
|
||||||
QString name = PeerDefs::nameWithLocation(details);
|
QString name = PeerDefs::nameWithLocation(details);
|
||||||
if (text.compare(name, Qt::CaseSensitive) == 0) {
|
if (text.compare(name, Qt::CaseSensitive) == 0) {
|
||||||
// found it
|
// found it
|
||||||
setRecipientToRow(row, type, details.id, false);
|
setRecipientToRow(row, type, details.id.toStdString(), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1579,14 +1577,14 @@ void MessageComposer::editingRecipientFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setRecipientToRow(row, type, RsPeerId(), false);
|
setRecipientToRow(row, type, "", false);
|
||||||
lineEdit->setStyleSheet(QString(STYLE_FAIL).arg(lineEdit->objectName()));
|
lineEdit->setStyleSheet(QString(STYLE_FAIL).arg(lineEdit->objectName()));
|
||||||
lineEdit->setText(text);
|
lineEdit->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::addRecipient(enumType type, const Sha1CheckSum& hash,const RsPgpId& pgp_id)
|
void MessageComposer::addRecipient(enumType type, const DistantMsgPeerId& pid,const RsPgpId& pgp_id)
|
||||||
{
|
{
|
||||||
_distant_peers[hash] = pgp_id ;
|
_distant_peers[pid] = pgp_id ;
|
||||||
|
|
||||||
int rowCount = ui.recipientWidget->rowCount();
|
int rowCount = ui.recipientWidget->rowCount();
|
||||||
int row;
|
int row;
|
||||||
|
@ -1601,17 +1599,14 @@ void MessageComposer::addRecipient(enumType type, const Sha1CheckSum& hash,const
|
||||||
if (rowId.empty()) // use row
|
if (rowId.empty()) // use row
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (rowId == hash && rowType == type) // existing row
|
if (rowId == pid.toStdString() && rowType == type) // existing row
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else // use row
|
else // use row
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
setRecipientToRow(row, type, hash, false);
|
setRecipientToRow(row, type, pid.toStdString(), false);
|
||||||
}
|
|
||||||
void MessageComposer::addRecipient(enumType type, const RsPgpId &id, bool group)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
void MessageComposer::addRecipient(enumType type, const RsPeerId &id, bool group)
|
void MessageComposer::addRecipient(enumType type, const RsPeerId &id, bool group)
|
||||||
{
|
{
|
||||||
|
@ -1643,7 +1638,7 @@ void MessageComposer::addRecipient(enumType type, const RsPeerId &id, bool group
|
||||||
sslIds.push_back(id);
|
sslIds.push_back(id);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
std::list<std::string>::const_iterator sslIt;
|
std::list<RsPeerId>::const_iterator sslIt;
|
||||||
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) {
|
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) {
|
||||||
// search existing or empty row
|
// search existing or empty row
|
||||||
int rowCount = ui.recipientWidget->rowCount();
|
int rowCount = ui.recipientWidget->rowCount();
|
||||||
|
@ -1659,7 +1654,7 @@ void MessageComposer::addRecipient(enumType type, const RsPeerId &id, bool group
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rowId == *sslIt && rowType == type && group == rowGroup) {
|
if (rowId == (*sslIt).toStdString() && rowType == type && group == rowGroup) {
|
||||||
// existing row
|
// existing row
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1669,7 +1664,7 @@ void MessageComposer::addRecipient(enumType type, const RsPeerId &id, bool group
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setRecipientToRow(row, type, *sslIt, group);
|
setRecipientToRow(row, type, (*sslIt).toStdString(), group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2306,28 +2301,28 @@ void MessageComposer::fileHashingFinished(QList<HashedFile> hashedFiles)
|
||||||
|
|
||||||
void MessageComposer::addContact(enumType type)
|
void MessageComposer::addContact(enumType type)
|
||||||
{
|
{
|
||||||
std::list<std::string> ids;
|
// std::list<std::string> ids;
|
||||||
ui.friendSelectionWidget->selectedGroupIds(ids);
|
// ui.friendSelectionWidget->selectedIds<std::string,FriendSelectionWidget::IDTYPE_GROUP>(ids,false);
|
||||||
|
//
|
||||||
|
// std::list<std::string>::iterator idIt;
|
||||||
|
// for (idIt = ids.begin(); idIt != ids.end(); idIt++) {
|
||||||
|
// addRecipient(type, *idIt, true);
|
||||||
|
// }
|
||||||
|
|
||||||
std::list<std::string>::iterator idIt;
|
std::list<RsPeerId> ids ;
|
||||||
for (idIt = ids.begin(); idIt != ids.end(); idIt++) {
|
ui.friendSelectionWidget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(ids, true);
|
||||||
addRecipient(type, *idIt, true);
|
for (std::list<RsPeerId>::const_iterator idIt = ids.begin(); idIt != ids.end(); idIt++) {
|
||||||
}
|
|
||||||
|
|
||||||
ids.empty();
|
|
||||||
ui.friendSelectionWidget->selectedSslIds(ids, true);
|
|
||||||
for (idIt = ids.begin(); idIt != ids.end(); idIt++) {
|
|
||||||
addRecipient(type, *idIt, false);
|
addRecipient(type, *idIt, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ids.empty();
|
std::list<RsPgpId> id2 ;
|
||||||
ui.friendSelectionWidget->selectedGpgIds(ids, true);
|
ui.friendSelectionWidget->selectedIds<RsPgpId,FriendSelectionWidget::IDTYPE_GPG>(id2, true);
|
||||||
for (idIt = ids.begin(); idIt != ids.end(); idIt++)
|
for (std::list<RsPgpId>::const_iterator idIt = id2.begin(); idIt != id2.end(); idIt++)
|
||||||
{
|
{
|
||||||
std::string hash ;
|
DistantMsgPeerId pid ;
|
||||||
|
|
||||||
if(rsMsgs->getDistantMessageHash(*idIt,hash))
|
if(rsMsgs->getDistantMessagePeerId(*idIt,pid))
|
||||||
addRecipient(type, hash, *idIt);
|
addRecipient(type, pid, *idIt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2356,14 +2351,14 @@ void MessageComposer::addBcc()
|
||||||
|
|
||||||
void MessageComposer::addRecommend()
|
void MessageComposer::addRecommend()
|
||||||
{
|
{
|
||||||
std::list<std::string> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
ui.friendSelectionWidget->selectedSslIds(sslIds, false);
|
ui.friendSelectionWidget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(sslIds, false);
|
||||||
|
|
||||||
if (sslIds.empty()) {
|
if (sslIds.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list <std::string>::iterator it;
|
std::list <RsPeerId>::iterator it;
|
||||||
for (it = sslIds.begin(); it != sslIds.end(); it++) {
|
for (it = sslIds.begin(); it != sslIds.end(); it++) {
|
||||||
addRecipient(CC, *it, false);
|
addRecipient(CC, *it, false);
|
||||||
}
|
}
|
||||||
|
@ -2382,7 +2377,7 @@ void MessageComposer::friendDetails()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfCertDialog::showIt(id, ConfCertDialog::PageDetails);
|
ConfCertDialog::showIt(RsPeerId(id), ConfCertDialog::PageDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::tagAboutToShow()
|
void MessageComposer::tagAboutToShow()
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <retroshare/rstypes.h>
|
#include <retroshare/rstypes.h>
|
||||||
|
#include <retroshare/rsmsgs.h>
|
||||||
#include "ui_MessageComposer.h"
|
#include "ui_MessageComposer.h"
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
|
@ -68,7 +69,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 RsPeerId &id, bool group);
|
void addRecipient(enumType type, const RsPeerId &id, bool group);
|
||||||
void addRecipient(enumType type, const Sha1CheckSum &hash, const RsPgpId &pgp_id) ;
|
void addRecipient(enumType type, const DistantMsgPeerId &pid, const RsPgpId &pgp_id) ;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/* actions to take.... */
|
/* actions to take.... */
|
||||||
|
@ -173,8 +174,8 @@ private:
|
||||||
void calculateTitle();
|
void calculateTitle();
|
||||||
void addEmptyRecipient();
|
void addEmptyRecipient();
|
||||||
|
|
||||||
bool getRecipientFromRow(int row, enumType &type, RsPeerId &id, bool &group);
|
bool getRecipientFromRow(int row, enumType &type, std::string &id, bool &group);
|
||||||
void setRecipientToRow(int row, enumType type, const RsPeerId& id, bool group);
|
void setRecipientToRow(int row, enumType type, const std::string &id, bool group);
|
||||||
|
|
||||||
void clearTagLabels();
|
void clearTagLabels();
|
||||||
void showTagLabels();
|
void showTagLabels();
|
||||||
|
@ -220,7 +221,7 @@ private:
|
||||||
Ui::MessageComposer ui;
|
Ui::MessageComposer ui;
|
||||||
|
|
||||||
std::list<FileInfo> _recList ;
|
std::list<FileInfo> _recList ;
|
||||||
std::map<RsFileHash,RsPgpId> _distant_peers ; // pairs (hash,pgp_id)
|
std::map<DistantMsgPeerId,RsPgpId> _distant_peers ; // pairs (hash,pgp_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -303,7 +303,7 @@ void MessageWidget::getcurrentrecommended()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> srcIds;
|
std::list<RsPeerId> srcIds;
|
||||||
srcIds.push_back(msgInfo.srcId);
|
srcIds.push_back(msgInfo.srcId);
|
||||||
|
|
||||||
QModelIndexList list = ui.msgList->selectionModel()->selectedIndexes();
|
QModelIndexList list = ui.msgList->selectionModel()->selectedIndexes();
|
||||||
|
@ -352,7 +352,7 @@ void MessageWidget::getallrecommended()
|
||||||
/* do the requests */
|
/* do the requests */
|
||||||
for(it = recList.begin(); it != recList.end(); it++) {
|
for(it = recList.begin(); it != recList.end(); it++) {
|
||||||
std::cerr << "MessageWidget::getallrecommended() Calling File Request" << std::endl;
|
std::cerr << "MessageWidget::getallrecommended() Calling File Request" << std::endl;
|
||||||
std::list<std::string> srcIds;
|
std::list<RsPeerId> srcIds;
|
||||||
srcIds.push_back(msgInfo.srcId);
|
srcIds.push_back(msgInfo.srcId);
|
||||||
rsFiles->FileRequest(it->fname, it->hash, it->size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
rsFiles->FileRequest(it->fname, it->hash, it->size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ void MessageWidget::fill(const std::string &msgId)
|
||||||
ui.msgList->insertTopLevelItems(0, items);
|
ui.msgList->insertTopLevelItems(0, items);
|
||||||
|
|
||||||
/* iterate through the sources */
|
/* iterate through the sources */
|
||||||
std::list<std::string>::const_iterator pit;
|
std::list<RsPeerId>::const_iterator pit;
|
||||||
|
|
||||||
RetroShareLink link;
|
RetroShareLink link;
|
||||||
QString text;
|
QString text;
|
||||||
|
@ -545,9 +545,9 @@ void MessageWidget::fill(const std::string &msgId)
|
||||||
|
|
||||||
ui.dateText->setText(DateTime::formatDateTime(msgInfo.ts));
|
ui.dateText->setText(DateTime::formatDateTime(msgInfo.ts));
|
||||||
|
|
||||||
std::string ownId = rsPeers->getOwnId();
|
RsPeerId ownId = rsPeers->getOwnId();
|
||||||
|
|
||||||
std::string srcId;
|
RsPeerId srcId;
|
||||||
if ((msgInfo.msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX) {
|
if ((msgInfo.msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX) {
|
||||||
// outgoing message are from me
|
// outgoing message are from me
|
||||||
srcId = ownId;
|
srcId = ownId;
|
||||||
|
|
|
@ -817,7 +817,7 @@ void NotifyQt::UpdateGUI()
|
||||||
// do not show when active
|
// do not show when active
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toaster = new Toaster(new ChatToaster(id, QString::fromUtf8(msg.c_str())));
|
toaster = new Toaster(new ChatToaster(RsPeerId(id), QString::fromUtf8(msg.c_str())));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_GROUPCHAT:
|
case RS_POPUP_GROUPCHAT:
|
||||||
|
@ -832,7 +832,7 @@ void NotifyQt::UpdateGUI()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toaster = new Toaster(new GroupChatToaster(id, QString::fromUtf8(msg.c_str())));
|
toaster = new Toaster(new GroupChatToaster(RsPeerId(id), QString::fromUtf8(msg.c_str())));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_CHATLOBBY:
|
case RS_POPUP_CHATLOBBY:
|
||||||
|
@ -849,7 +849,7 @@ void NotifyQt::UpdateGUI()
|
||||||
// participant is muted
|
// participant is muted
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toaster = new Toaster(new ChatLobbyToaster(id, QString::fromUtf8(title.c_str()), QString::fromUtf8(msg.c_str())));
|
toaster = new Toaster(new ChatLobbyToaster(RsPeerId(id), QString::fromUtf8(title.c_str()), QString::fromUtf8(msg.c_str())));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_CONNECT_ATTEMPT:
|
case RS_POPUP_CONNECT_ATTEMPT:
|
||||||
|
@ -858,7 +858,7 @@ void NotifyQt::UpdateGUI()
|
||||||
// id = gpgid
|
// id = gpgid
|
||||||
// title = ssl name
|
// title = ssl name
|
||||||
// msg = peer id
|
// msg = peer id
|
||||||
toaster = new Toaster(new FriendRequestToaster(id, QString::fromUtf8(title.c_str()), msg));
|
toaster = new Toaster(new FriendRequestToaster(RsPgpId(id), QString::fromUtf8(title.c_str()), RsPeerId(msg)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -921,6 +921,7 @@ void NotifyQt::testToaster(uint notifyFlags, /*RshareSettings::enumToasterPositi
|
||||||
QString message = tr("This is a test.");
|
QString message = tr("This is a test.");
|
||||||
|
|
||||||
RsPeerId id = rsPeers->getOwnId();
|
RsPeerId id = rsPeers->getOwnId();
|
||||||
|
RsPgpId pgpid = rsPeers->getGPGOwnId();
|
||||||
|
|
||||||
uint pos = 0;
|
uint pos = 0;
|
||||||
|
|
||||||
|
@ -946,16 +947,16 @@ void NotifyQt::testToaster(uint notifyFlags, /*RshareSettings::enumToasterPositi
|
||||||
toaster = new Toaster(new DownloadToaster(id.toStdString(), title));
|
toaster = new Toaster(new DownloadToaster(id.toStdString(), title));
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_CHAT:
|
case RS_POPUP_CHAT:
|
||||||
toaster = new Toaster(new ChatToaster(id.toStdString(), message));
|
toaster = new Toaster(new ChatToaster(id, message));
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_GROUPCHAT:
|
case RS_POPUP_GROUPCHAT:
|
||||||
toaster = new Toaster(new GroupChatToaster(id.toStdString(), message));
|
toaster = new Toaster(new GroupChatToaster(id, message));
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_CHATLOBBY:
|
case RS_POPUP_CHATLOBBY:
|
||||||
toaster = new Toaster(new ChatLobbyToaster(id.toStdString(), title, message));
|
toaster = new Toaster(new ChatLobbyToaster(id, title, message));
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_CONNECT_ATTEMPT:
|
case RS_POPUP_CONNECT_ATTEMPT:
|
||||||
toaster = new Toaster(new FriendRequestToaster(id.toStdString(), title, id.toStdString()));
|
toaster = new Toaster(new FriendRequestToaster(pgpid, title, id));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue