mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Ask for custom string in MessengerWindow and PeersDialog only when ssl contact is connected, like the avatar.
There are too much unnecessary internal SendItem's for the offline ssl contacts. Maybe this should be handled in libretroshare. For every call to p3ChatService::sendAvatarRequest and p3ChatService::sendCustomStateRequest with currently no data available, a RsItem as created and sent. This is unnecessary, when the contact is offline. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3347 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bbd3902bbe
commit
eccdba153e
@ -574,7 +574,7 @@ void p3ChatService::sendAvatarRequest(const std::string& peer_id)
|
||||
ci->PeerId(peer_id);
|
||||
ci->chatFlags = RS_CHAT_FLAG_PRIVATE | RS_CHAT_FLAG_REQUESTS_AVATAR ;
|
||||
ci->sendTime = time(NULL);
|
||||
ci->message = std::wstring() ;
|
||||
ci->message.erase();
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "p3ChatService::sending request for avatar, to peer " << peer_id << std::endl ;
|
||||
@ -590,7 +590,7 @@ void p3ChatService::sendCustomStateRequest(const std::string& peer_id){
|
||||
|
||||
cs->PeerId(peer_id);
|
||||
cs->flags = RS_CHAT_FLAG_PRIVATE | RS_CHAT_FLAG_REQUEST_CUSTOM_STATE ;
|
||||
cs->status_string = std::string();
|
||||
cs->status_string.erase();
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "p3ChatService::sending request for status, to peer " << peer_id << std::endl ;
|
||||
|
@ -544,15 +544,18 @@ void MessengerWindow::insertPeers()
|
||||
/* not displayed, used to find back the item */
|
||||
sslItem -> setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id));
|
||||
|
||||
QString sCustomString = QString::fromStdString(rsMsgs->getCustomStateString(sslDetail.id));
|
||||
if (sCustomString != "") {
|
||||
sslItem -> setText( COLUMN_NAME, tr("location : ") + QString::fromStdString(sslDetail.location) + " " + QString::fromStdString(sslDetail.autoconnect) );
|
||||
sslItem -> setToolTip( COLUMN_NAME, tr("location : ") + QString::fromStdString(sslDetail.location) + tr(" - ") + sCustomString);
|
||||
gpg_item -> setText(COLUMN_NAME, QString::fromStdString(detail.name) + tr("\n") + sCustomString);
|
||||
} else {
|
||||
QString sCustomString;
|
||||
if (sslDetail.state & RS_PEER_STATE_CONNECTED) {
|
||||
sCustomString = QString::fromStdString(rsMsgs->getCustomStateString(sslDetail.id));
|
||||
}
|
||||
if (sCustomString.isEmpty()) {
|
||||
sslItem -> setText( COLUMN_NAME, tr("location : ") + QString::fromStdString(sslDetail.location) + " " + QString::fromStdString(sslDetail.autoconnect));
|
||||
sslItem -> setToolTip( COLUMN_NAME, tr("location : ") + QString::fromStdString(sslDetail.location));
|
||||
gpg_item -> setText(COLUMN_NAME, QString::fromStdString(detail.name) + tr("\n") + QString::fromStdString(sslDetail.location));
|
||||
} else {
|
||||
sslItem -> setText( COLUMN_NAME, tr("location : ") + QString::fromStdString(sslDetail.location) + " " + QString::fromStdString(sslDetail.autoconnect) );
|
||||
sslItem -> setToolTip( COLUMN_NAME, tr("location : ") + QString::fromStdString(sslDetail.location) + tr(" - ") + sCustomString);
|
||||
gpg_item -> setText(COLUMN_NAME, QString::fromStdString(detail.name) + tr("\n") + sCustomString);
|
||||
}
|
||||
|
||||
/* not displayed, used to find back the item */
|
||||
|
@ -608,7 +608,10 @@ void PeersDialog::insertPeers()
|
||||
sslItem -> setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(sslDetail.id));
|
||||
|
||||
QString sText;
|
||||
std::string customStateString = rsMsgs->getCustomStateString(sslDetail.id);
|
||||
std::string customStateString;
|
||||
if (sslDetail.state & RS_PEER_STATE_CONNECTED) {
|
||||
customStateString = rsMsgs->getCustomStateString(sslDetail.id);
|
||||
}
|
||||
sText = tr("location : ") + QString::fromStdString(sslDetail.location);
|
||||
if (customStateString.empty() == false) {
|
||||
sText += tr(" - ") + QString::fromStdString(customStateString);
|
||||
|
Loading…
Reference in New Issue
Block a user