mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-20 23:10:39 -04:00
Added new message flag for system messages like friend request.
Show "RetroShare" as sender of system messages to myself. Added new quick view in MessagesDialog to filter system messages. Changed RetroShare link in friend request message to certificate. Added new subject image for the system messages (defnax). Removed not used notify in message service. Recompile needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5129 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
32ac7efb42
commit
c331098203
20 changed files with 271 additions and 172 deletions
|
@ -44,6 +44,7 @@
|
|||
#define IMAGE_MESSAGEREMOVE ":/images/message-mail-imapdelete.png"
|
||||
#define IMAGE_STAR_ON ":/images/star-on-16.png"
|
||||
#define IMAGE_STAR_OFF ":/images/star-off-16.png"
|
||||
#define IMAGE_SYSTEM ":/images/user/user_request6.png"
|
||||
|
||||
#define COLUMN_COUNT 8
|
||||
#define COLUMN_STAR 0
|
||||
|
@ -72,6 +73,7 @@
|
|||
#define QUICKVIEW_TYPE_TAG 2
|
||||
|
||||
#define QUICKVIEW_STATIC_ID_STARRED 1
|
||||
#define QUICKVIEW_STATIC_ID_SYSTEM 2
|
||||
|
||||
#define ROW_INBOX 0
|
||||
#define ROW_OUTBOX 1
|
||||
|
@ -85,15 +87,15 @@ MessagesDialog::LockUpdate::LockUpdate (MessagesDialog *pDialog, bool bUpdate)
|
|||
m_pDialog = pDialog;
|
||||
m_bUpdate = bUpdate;
|
||||
|
||||
m_pDialog->m_nLockUpdate++;
|
||||
m_pDialog->lockUpdate++;
|
||||
}
|
||||
|
||||
MessagesDialog::LockUpdate::~LockUpdate ()
|
||||
{
|
||||
if(--m_pDialog->m_nLockUpdate < 0)
|
||||
m_pDialog->m_nLockUpdate = 0;
|
||||
if(--m_pDialog->lockUpdate < 0)
|
||||
m_pDialog->lockUpdate = 0;
|
||||
|
||||
if (m_bUpdate && m_pDialog->m_nLockUpdate == 0) {
|
||||
if (m_bUpdate && m_pDialog->lockUpdate == 0) {
|
||||
m_pDialog->insertMessages();
|
||||
}
|
||||
}
|
||||
|
@ -150,9 +152,9 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
m_bProcessSettings = false;
|
||||
inProcessSettings = false;
|
||||
inChange = false;
|
||||
m_nLockUpdate = 0;
|
||||
lockUpdate = 0;
|
||||
|
||||
connect(ui.messagestreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(messageslistWidgetCostumPopupMenu(QPoint)));
|
||||
connect(ui.listWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(folderlistWidgetCostumPopupMenu(QPoint)));
|
||||
|
@ -181,7 +183,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||
|
||||
connectActions();
|
||||
|
||||
m_eListMode = LIST_NOTHING;
|
||||
listMode = LIST_NOTHING;
|
||||
|
||||
mCurrMsgId = "";
|
||||
|
||||
|
@ -317,7 +319,7 @@ void MessagesDialog::processSettings(bool load)
|
|||
{
|
||||
int messageTreeVersion = 2; // version number for the settings to solve problems when modifying the column count
|
||||
|
||||
m_bProcessSettings = true;
|
||||
inProcessSettings = true;
|
||||
|
||||
QHeaderView *msgwheader = ui.messagestreeView->header () ;
|
||||
|
||||
|
@ -372,7 +374,7 @@ void MessagesDialog::processSettings(bool load)
|
|||
msgWidget->processSettings("MessageDialog", load);
|
||||
}
|
||||
|
||||
m_bProcessSettings = false;
|
||||
inProcessSettings = false;
|
||||
}
|
||||
|
||||
bool MessagesDialog::eventFilter(QObject *obj, QEvent *event)
|
||||
|
@ -404,11 +406,11 @@ void MessagesDialog::fillQuickView()
|
|||
|
||||
// save current selection
|
||||
QListWidgetItem *item = ui.quickViewWidget->currentItem();
|
||||
int nSelectedType = 0;
|
||||
uint32_t nSelectedId = 0;
|
||||
int selectedType = 0;
|
||||
uint32_t selectedId = 0;
|
||||
if (item) {
|
||||
nSelectedType = item->data(ROLE_QUICKVIEW_TYPE).toInt();
|
||||
nSelectedId = item->data(ROLE_QUICKVIEW_ID).toInt();
|
||||
selectedType = item->data(ROLE_QUICKVIEW_TYPE).toInt();
|
||||
selectedId = item->data(ROLE_QUICKVIEW_ID).toInt();
|
||||
}
|
||||
|
||||
QListWidgetItem *itemToSelect = NULL;
|
||||
|
@ -423,7 +425,17 @@ void MessagesDialog::fillQuickView()
|
|||
item->setData(ROLE_QUICKVIEW_ID, QUICKVIEW_STATIC_ID_STARRED);
|
||||
item->setData(ROLE_QUICKVIEW_TEXT, item->text()); // for updateMessageSummaryList
|
||||
|
||||
if (nSelectedType == QUICKVIEW_TYPE_STATIC && nSelectedId == QUICKVIEW_STATIC_ID_STARRED) {
|
||||
if (selectedType == QUICKVIEW_TYPE_STATIC && selectedId == QUICKVIEW_STATIC_ID_STARRED) {
|
||||
itemToSelect = item;
|
||||
}
|
||||
|
||||
item = new QListWidgetItem(tr("System"), ui.quickViewWidget);
|
||||
item->setIcon(QIcon(IMAGE_SYSTEM));
|
||||
item->setData(ROLE_QUICKVIEW_TYPE, QUICKVIEW_TYPE_STATIC);
|
||||
item->setData(ROLE_QUICKVIEW_ID, QUICKVIEW_STATIC_ID_SYSTEM);
|
||||
item->setData(ROLE_QUICKVIEW_TEXT, item->text()); // for updateMessageSummaryList
|
||||
|
||||
if (selectedType == QUICKVIEW_TYPE_STATIC && selectedId == QUICKVIEW_STATIC_ID_SYSTEM) {
|
||||
itemToSelect = item;
|
||||
}
|
||||
|
||||
|
@ -437,7 +449,7 @@ void MessagesDialog::fillQuickView()
|
|||
item->setData(ROLE_QUICKVIEW_ID, tag->first);
|
||||
item->setData(ROLE_QUICKVIEW_TEXT, text); // for updateMessageSummaryList
|
||||
|
||||
if (nSelectedType == QUICKVIEW_TYPE_TAG && tag->first == nSelectedId) {
|
||||
if (selectedType == QUICKVIEW_TYPE_TAG && tag->first == selectedId) {
|
||||
itemToSelect = item;
|
||||
}
|
||||
}
|
||||
|
@ -707,7 +719,7 @@ void MessagesDialog::changeBox(int)
|
|||
MessagesModel->removeRows (0, MessagesModel->rowCount());
|
||||
|
||||
ui.quickViewWidget->setCurrentItem(NULL);
|
||||
m_eListMode = LIST_BOX;
|
||||
listMode = LIST_BOX;
|
||||
|
||||
insertMessages();
|
||||
insertMsgTxtAndFiles();
|
||||
|
@ -729,7 +741,7 @@ void MessagesDialog::changeQuickView(int newrow)
|
|||
MessagesModel->removeRows (0, MessagesModel->rowCount());
|
||||
|
||||
ui.listWidget->setCurrentItem(NULL);
|
||||
m_eListMode = LIST_QUICKVIEW;
|
||||
listMode = LIST_QUICKVIEW;
|
||||
|
||||
insertMessages();
|
||||
insertMsgTxtAndFiles();
|
||||
|
@ -739,7 +751,7 @@ void MessagesDialog::changeQuickView(int newrow)
|
|||
|
||||
void MessagesDialog::messagesTagsChanged()
|
||||
{
|
||||
if (m_nLockUpdate) {
|
||||
if (lockUpdate) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -755,7 +767,9 @@ static void InitIconAndFont(QStandardItem *item[COLUMN_COUNT])
|
|||
if (msgFlags & RS_MSG_NEW) {
|
||||
item[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-state-new.png"));
|
||||
} else {
|
||||
if (msgFlags & RS_MSG_UNREAD_BY_USER) {
|
||||
if (msgFlags & RS_MSG_USER_REQUEST) {
|
||||
item[COLUMN_SUBJECT]->setIcon(QIcon(":/images/user/user_request6.png"));
|
||||
} else if (msgFlags & RS_MSG_UNREAD_BY_USER) {
|
||||
if ((msgFlags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_REPLIED) {
|
||||
item[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail-replied.png"));
|
||||
} else if ((msgFlags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_FORWARDED) {
|
||||
|
@ -813,7 +827,7 @@ static void InitIconAndFont(QStandardItem *item[COLUMN_COUNT])
|
|||
|
||||
void MessagesDialog::insertMessages()
|
||||
{
|
||||
if (m_nLockUpdate) {
|
||||
if (lockUpdate) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -822,14 +836,16 @@ void MessagesDialog::insertMessages()
|
|||
std::list<MsgInfoSummary> msgList;
|
||||
std::list<MsgInfoSummary>::const_iterator it;
|
||||
MessageInfo msgInfo;
|
||||
bool bGotInfo;
|
||||
bool gotInfo;
|
||||
QString text;
|
||||
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
||||
rsMsgs -> getMessageSummaries(msgList);
|
||||
|
||||
std::cerr << "MessagesDialog::insertMessages()" << std::endl;
|
||||
|
||||
int nFilterColumn = FilterColumnFromComboBox(ui.filterColumnComboBox->currentIndex());
|
||||
int filterColumn = FilterColumnFromComboBox(ui.filterColumnComboBox->currentIndex());
|
||||
|
||||
/* check the mode we are in */
|
||||
unsigned int msgbox = 0;
|
||||
|
@ -841,7 +857,7 @@ void MessagesDialog::insertMessages()
|
|||
QIcon boxIcon;
|
||||
QString placeholderText;
|
||||
|
||||
switch (m_eListMode) {
|
||||
switch (listMode) {
|
||||
case LIST_NOTHING:
|
||||
doFill = false;
|
||||
break;
|
||||
|
@ -901,6 +917,9 @@ void MessagesDialog::insertMessages()
|
|||
case QUICKVIEW_STATIC_ID_STARRED:
|
||||
placeholderText = tr("No starred messages available. Stars let you give messages a special status to make them easier to find. To star a message, click on the light grey star beside any message.");
|
||||
break;
|
||||
case QUICKVIEW_STATIC_ID_SYSTEM:
|
||||
placeholderText = tr("No system messages available.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case QUICKVIEW_TYPE_TAG:
|
||||
|
@ -935,7 +954,7 @@ void MessagesDialog::insertMessages()
|
|||
/* search messages */
|
||||
std::list<MsgInfoSummary> msgToShow;
|
||||
for(it = msgList.begin(); it != msgList.end(); it++) {
|
||||
if (m_eListMode == LIST_BOX) {
|
||||
if (listMode == LIST_BOX) {
|
||||
if (isTrash) {
|
||||
if ((it->msgflags & RS_MSG_TRASH) == 0) {
|
||||
continue;
|
||||
|
@ -948,14 +967,17 @@ void MessagesDialog::insertMessages()
|
|||
continue;
|
||||
}
|
||||
}
|
||||
} else if (m_eListMode == LIST_QUICKVIEW && quickViewType == QUICKVIEW_TYPE_TAG) {
|
||||
} else if (listMode == LIST_QUICKVIEW && quickViewType == QUICKVIEW_TYPE_TAG) {
|
||||
MsgTagInfo tagInfo;
|
||||
rsMsgs->getMessageTag(it->msgId, tagInfo);
|
||||
if (std::find(tagInfo.tagIds.begin(), tagInfo.tagIds.end(), quickViewId) == tagInfo.tagIds.end()) {
|
||||
continue;
|
||||
}
|
||||
} else if (m_eListMode == LIST_QUICKVIEW && quickViewType == QUICKVIEW_TYPE_STATIC) {
|
||||
if ((it->msgflags & RS_MSG_STAR) == 0) {
|
||||
} else if (listMode == LIST_QUICKVIEW && quickViewType == QUICKVIEW_TYPE_STATIC) {
|
||||
if (quickViewId == QUICKVIEW_STATIC_ID_STARRED && (it->msgflags & RS_MSG_STAR) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (quickViewId == QUICKVIEW_STATIC_ID_SYSTEM && (it->msgflags & RS_MSG_SYSTEM) == 0) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
@ -1004,7 +1026,7 @@ void MessagesDialog::insertMessages()
|
|||
*
|
||||
*/
|
||||
|
||||
bGotInfo = false;
|
||||
gotInfo = false;
|
||||
msgInfo = MessageInfo(); // clear
|
||||
|
||||
// search exisisting items
|
||||
|
@ -1076,10 +1098,14 @@ void MessagesDialog::insertMessages()
|
|||
// From ....
|
||||
{
|
||||
if (msgbox == RS_MSG_INBOX || msgbox == RS_MSG_OUTBOX) {
|
||||
text = QString::fromUtf8(rsPeers->getPeerName(it->srcId).c_str());
|
||||
if ((it->msgflags & RS_MSG_SYSTEM) && it->srcId == ownId) {
|
||||
text = "RetroShare";
|
||||
} else {
|
||||
text = QString::fromUtf8(rsPeers->getPeerName(it->srcId).c_str());
|
||||
}
|
||||
} else {
|
||||
if (bGotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
||||
bGotInfo = true;
|
||||
if (gotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
||||
gotInfo = true;
|
||||
|
||||
text.clear();
|
||||
|
||||
|
@ -1164,10 +1190,10 @@ void MessagesDialog::insertMessages()
|
|||
item[COLUMN_ATTACHEMENTS] -> setTextAlignment(Qt::AlignHCenter);
|
||||
}
|
||||
|
||||
if (nFilterColumn == COLUMN_CONTENT) {
|
||||
if (filterColumn == COLUMN_CONTENT) {
|
||||
// need content for filter
|
||||
if (bGotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
||||
bGotInfo = true;
|
||||
if (gotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
||||
gotInfo = true;
|
||||
QTextDocument doc;
|
||||
doc.setHtml(QString::fromStdWString(msgInfo.msg));
|
||||
item[COLUMN_CONTENT]->setText(doc.toPlainText().replace(QString("\n"), QString(" ")));
|
||||
|
@ -1571,7 +1597,7 @@ void MessagesDialog::filterChanged(const QString& text)
|
|||
|
||||
void MessagesDialog::filterColumnChanged()
|
||||
{
|
||||
if (m_bProcessSettings) {
|
||||
if (inProcessSettings) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1595,6 +1621,7 @@ void MessagesDialog::updateMessageSummaryList()
|
|||
unsigned int inboxCount = 0;
|
||||
unsigned int trashboxCount = 0;
|
||||
unsigned int starredCount = 0;
|
||||
unsigned int systemCount = 0;
|
||||
|
||||
/* calculating the new messages */
|
||||
// rsMsgs->getMessageCount (&inboxCount, &newInboxCount, &newOutboxCount, &newDraftCount, &newSentboxCount);
|
||||
|
@ -1621,6 +1648,10 @@ void MessagesDialog::updateMessageSummaryList()
|
|||
starredCount++;
|
||||
}
|
||||
|
||||
if (it->msgflags & RS_MSG_SYSTEM) {
|
||||
systemCount++;
|
||||
}
|
||||
|
||||
/* calculate box */
|
||||
if (it->msgflags & RS_MSG_TRASH) {
|
||||
trashboxCount++;
|
||||
|
@ -1777,6 +1808,9 @@ void MessagesDialog::updateMessageSummaryList()
|
|||
case QUICKVIEW_STATIC_ID_STARRED:
|
||||
text += " (" + QString::number(starredCount) + ")";
|
||||
break;
|
||||
case QUICKVIEW_STATIC_ID_SYSTEM:
|
||||
text += " (" + QString::number(systemCount) + ")";
|
||||
break;
|
||||
}
|
||||
|
||||
item->setText(text);
|
||||
|
|
|
@ -126,11 +126,11 @@ private:
|
|||
|
||||
void closeTab(const std::string &msgId);
|
||||
|
||||
bool m_bProcessSettings;
|
||||
bool inProcessSettings;
|
||||
bool inChange;
|
||||
int m_nLockUpdate; // use with LockUpdate
|
||||
int lockUpdate; // use with LockUpdate
|
||||
|
||||
enum { LIST_NOTHING, LIST_BOX, LIST_QUICKVIEW } m_eListMode;
|
||||
enum { LIST_NOTHING, LIST_BOX, LIST_QUICKVIEW } listMode;
|
||||
|
||||
std::string mCurrMsgId;
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void NewsFeed::updateFeed()
|
|||
|
||||
case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
|
||||
if (Settings->getMessageFlags() & RS_MESSAGE_CONNECT_ATTEMPT) {
|
||||
MessageComposer::sendConnectAttemptMsg(fi.mId1, QString::fromUtf8(fi.mId3.c_str()));
|
||||
MessageComposer::sendConnectAttemptMsg(fi.mId1, fi.mId2, QString::fromUtf8(fi.mId3.c_str()));
|
||||
}
|
||||
if (flags & RS_FEED_TYPE_SECURITY)
|
||||
addFeedItemSecurityConnectAttempt(fi);
|
||||
|
|
|
@ -281,19 +281,19 @@ bool RetroShareLink::createPerson(const std::string& id)
|
|||
return valid();
|
||||
}
|
||||
|
||||
bool RetroShareLink::createCertificate(const std::string& ssl_id)
|
||||
bool RetroShareLink::createCertificate(const std::string& ssl_or_gpg_id)
|
||||
{
|
||||
std::string invite = rsPeers->GetRetroshareInvite(ssl_id,false) ;
|
||||
std::string invite = rsPeers->GetRetroshareInvite(ssl_or_gpg_id, false) ;
|
||||
|
||||
if(invite == "")
|
||||
{
|
||||
std::cerr << "RetroShareLink::createPerson() Couldn't get retroshare invite for ssl id: " << ssl_id << std::endl;
|
||||
std::cerr << "RetroShareLink::createPerson() Couldn't get retroshare invite for ssl id: " << ssl_or_gpg_id << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (rsPeers->getPeerDetails(ssl_id, detail) == false) {
|
||||
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << ssl_id << std::endl;
|
||||
if (rsPeers->getPeerDetails(ssl_or_gpg_id, detail) == false) {
|
||||
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << ssl_or_gpg_id << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -306,15 +306,21 @@ bool RetroShareLink::createCertificate(const std::string& ssl_id)
|
|||
_type = TYPE_CERTIFICATE;
|
||||
|
||||
_GPGid = QString::fromStdString(detail.gpg_id).right(8);
|
||||
_SSLid = QString::fromStdString(ssl_id) ;
|
||||
if (detail.isOnlyGPGdetail) {
|
||||
_SSLid.clear();
|
||||
_location.clear();
|
||||
_ext_ip_port.clear();
|
||||
_loc_ip_port.clear();
|
||||
} else {
|
||||
_SSLid = QString::fromStdString(ssl_or_gpg_id) ;
|
||||
_location = QString::fromUtf8(detail.location.c_str()) ;
|
||||
_ext_ip_port = QString::fromStdString(invite).section("--EXT--",1,1) ;
|
||||
QString lst = QString::fromStdString(invite).section("--EXT--",0,0) ;
|
||||
_loc_ip_port = lst.section("--LOCAL--",1,1) ;
|
||||
}
|
||||
_GPGBase64String = gpg_base_64.replace("\n","") ;
|
||||
_location = QString::fromUtf8(detail.location.c_str()) ;
|
||||
_name = QString::fromUtf8(detail.name.c_str()) ;
|
||||
|
||||
_ext_ip_port = QString::fromStdString(invite).section("--EXT--",1,1) ;
|
||||
QString lst = QString::fromStdString(invite).section("--EXT--",0,0) ;
|
||||
_loc_ip_port = lst.section("--LOCAL--",1,1) ;
|
||||
|
||||
std::cerr << "Found gpg base 64 string = " << _GPGBase64String.toStdString() << std::endl;
|
||||
std::cerr << "Found gpg base 64 checksum = " << _GPGBase64CheckSum.toStdString() << std::endl;
|
||||
std::cerr << "Found SSLId = " << _SSLid.toStdString() << std::endl;
|
||||
|
@ -326,6 +332,35 @@ bool RetroShareLink::createCertificate(const std::string& ssl_id)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createUnknwonSslCertificate(const std::string& sslId, const std::string& gpgId)
|
||||
{
|
||||
// first try ssl id
|
||||
if (createCertificate(sslId)) {
|
||||
if (gpgId.empty() || _GPGid.toStdString() == gpgId) {
|
||||
return true;
|
||||
}
|
||||
// wrong gpg id
|
||||
return false;
|
||||
}
|
||||
|
||||
// then gpg id
|
||||
if (createCertificate(gpgId)) {
|
||||
if (!_SSLid.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (sslId.empty()) {
|
||||
return true;
|
||||
}
|
||||
_SSLid = QString::fromStdString(sslId);
|
||||
if (_location.isEmpty()) {
|
||||
_location = _name;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RetroShareLink::createForum(const std::string& id, const std::string& msgId)
|
||||
{
|
||||
clear();
|
||||
|
@ -602,14 +637,22 @@ QString RetroShareLink::toString() const
|
|||
QUrl url ;
|
||||
url.setScheme(RSLINK_SCHEME);
|
||||
url.setHost(HOST_CERTIFICATE) ;
|
||||
url.addQueryItem(CERTIFICATE_SSLID, _SSLid);
|
||||
if (!_SSLid.isEmpty()) {
|
||||
url.addQueryItem(CERTIFICATE_SSLID, _SSLid);
|
||||
}
|
||||
url.addQueryItem(CERTIFICATE_GPG_ID, _GPGid);
|
||||
url.addQueryItem(CERTIFICATE_GPG_BASE64, _GPGBase64String);
|
||||
url.addQueryItem(CERTIFICATE_GPG_CHECKSUM, _GPGBase64CheckSum);
|
||||
url.addQueryItem(CERTIFICATE_LOCATION, encodeItem(_location));
|
||||
if (!_location.isEmpty()) {
|
||||
url.addQueryItem(CERTIFICATE_LOCATION, encodeItem(_location));
|
||||
}
|
||||
url.addQueryItem(CERTIFICATE_NAME, encodeItem(_name));
|
||||
url.addQueryItem(CERTIFICATE_LOC_IPPORT, encodeItem(_loc_ip_port));
|
||||
url.addQueryItem(CERTIFICATE_EXT_IPPORT, encodeItem(_ext_ip_port));
|
||||
if (!_loc_ip_port.isEmpty()) {
|
||||
url.addQueryItem(CERTIFICATE_LOC_IPPORT, encodeItem(_loc_ip_port));
|
||||
}
|
||||
if (!_ext_ip_port.isEmpty()) {
|
||||
url.addQueryItem(CERTIFICATE_EXT_IPPORT, encodeItem(_ext_ip_port));
|
||||
}
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
|
@ -624,8 +667,12 @@ QString RetroShareLink::niceName() const
|
|||
return PeerDefs::rsid(name().toUtf8().constData(), hash().toStdString());
|
||||
}
|
||||
|
||||
if(type() == TYPE_CERTIFICATE)
|
||||
return QString("RetroShare Certificate (%1, @%2)").arg(_name, _location); // should add SSL id there
|
||||
if(type() == TYPE_CERTIFICATE) {
|
||||
if (_location.isEmpty()) {
|
||||
return QString("RetroShare Certificate (%1)").arg(_name);
|
||||
}
|
||||
return QString("RetroShare Certificate (%1, @%2)").arg(_name, _location); // should add SSL id there
|
||||
}
|
||||
|
||||
return name();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,8 @@ class RetroShareLink
|
|||
bool createChannel(const std::string& id, const std::string& msgId);
|
||||
bool createSearch(const QString& keywords);
|
||||
bool createMessage(const std::string& peerId, const QString& subject);
|
||||
bool createCertificate(const std::string& peerId) ;
|
||||
bool createCertificate(const std::string& ssl_or_gpg_id) ;
|
||||
bool createUnknwonSslCertificate(const std::string& sslId, const std::string& gpgId = "") ;
|
||||
|
||||
enumType type() const {return _type; }
|
||||
uint64_t size() const { return _size ; }
|
||||
|
|
|
@ -84,7 +84,12 @@ void MsgItem::updateItemStatic()
|
|||
avatar->setId(mPeerId, false);
|
||||
|
||||
QString title;
|
||||
QString srcName = QString::fromUtf8(rsPeers->getPeerName(mi.srcId).c_str());
|
||||
QString srcName;
|
||||
if ((mi.msgflags & RS_MSG_SYSTEM) && mi.srcId == rsPeers->getOwnId()) {
|
||||
srcName = "RetroShare";
|
||||
} else {
|
||||
srcName = QString::fromUtf8(rsPeers->getPeerName(mi.srcId).c_str());
|
||||
}
|
||||
|
||||
{
|
||||
QDateTime qtime;
|
||||
|
|
|
@ -468,6 +468,7 @@
|
|||
<file>images/user/agt_forum128.png</file>
|
||||
<file>images/user/group16.png</file>
|
||||
<file>images/user/group24.png</file>
|
||||
<file>images/user/user_request6.png</file>
|
||||
<file>images/user/user_request48.png</file>
|
||||
<file>images/user/user_request_unknown48.png</file>
|
||||
<file>images/up.png</file>
|
||||
|
|
BIN
retroshare-gui/src/gui/images/user/user_request6.png
Normal file
BIN
retroshare-gui/src/gui/images/user/user_request6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 832 B |
|
@ -114,6 +114,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
|||
ui.setupUi(this);
|
||||
|
||||
m_msgType = NORMAL;
|
||||
// needed to send system flags with reply
|
||||
//systemFlags = 0;
|
||||
|
||||
setupFileActions();
|
||||
setupEditActions();
|
||||
|
@ -453,12 +455,17 @@ void MessageComposer::recommendFriend(const std::list <std::string> &sslIds, con
|
|||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void MessageComposer::sendConnectAttemptMsg(const std::string &gpgId, const QString &sslName)
|
||||
void MessageComposer::sendConnectAttemptMsg(const std::string &gpgId, const std::string &sslId, const QString &sslName)
|
||||
{
|
||||
if (gpgId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RetroShareLink link;
|
||||
if (link.createUnknwonSslCertificate(sslId, gpgId) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString title = QString("%1 %2").arg(sslName, tr("wants to be friend with you on RetroShare"));
|
||||
|
||||
/* search for an exisiting message in the inbox */
|
||||
|
@ -473,28 +480,17 @@ void MessageComposer::sendConnectAttemptMsg(const std::string &gpgId, const QStr
|
|||
if ((it->msgflags & RS_MSG_BOXMASK) != RS_MSG_INBOX) {
|
||||
continue;
|
||||
}
|
||||
if ((it->msgflags & RS_MSG_USER_REQUEST) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (it->title == title.toStdWString()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* create a message */
|
||||
MessageComposer *msgDialog = MessageComposer::newMsg();
|
||||
msgDialog->insertTitleText(title);
|
||||
msgDialog->addRecipient(TO, rsPeers->getOwnId(), false);
|
||||
|
||||
RetroShareLink link;
|
||||
link.createPerson(gpgId);
|
||||
QString msgText = tr("Hi %1,<br>%2 wants to be friend with you on RetroShare.<br><br>Respond now<br>%3<br><br>Thanks.<br>The RetroShare Team").arg(QString::fromUtf8(rsPeers->getGPGName(rsPeers->getGPGOwnId()).c_str()), sslName, link.toHtml());
|
||||
msgDialog->insertMsgText(msgText, true);
|
||||
|
||||
if (msgDialog->sendMessage_internal(false)) {
|
||||
msgDialog->close();
|
||||
return;
|
||||
}
|
||||
|
||||
msgDialog->ui.msgText->document()->setModified(false);
|
||||
msgDialog->close();
|
||||
rsMsgs->SystemMessage(title.toStdWString(), msgText.toStdWString(), RS_MSG_USER_REQUEST);
|
||||
}
|
||||
|
||||
void MessageComposer::closeEvent (QCloseEvent * event)
|
||||
|
@ -861,6 +857,9 @@ MessageComposer *MessageComposer::newMsg(const std::string &msgId /* = ""*/)
|
|||
}
|
||||
}
|
||||
|
||||
// needed to send system flags with reply
|
||||
//msgComposer->systemFlags = (msgInfo.msgflags & RS_MSG_SYSTEM);
|
||||
|
||||
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title));
|
||||
|
||||
msgComposer->insertMsgText(QString::fromStdWString(msgInfo.msg));
|
||||
|
@ -950,6 +949,9 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
|
|||
}
|
||||
}
|
||||
|
||||
// needed to send system flags with reply
|
||||
//msgComposer->systemFlags = (msgInfo.msgflags & RS_MSG_SYSTEM);
|
||||
|
||||
msgComposer->calculateTitle();
|
||||
|
||||
/* window will destroy itself! */
|
||||
|
@ -981,6 +983,9 @@ MessageComposer *MessageComposer::forwardMsg(const std::string &msgId)
|
|||
|
||||
msgComposer->insertFileList(files_info);
|
||||
|
||||
// needed to send system flags with reply
|
||||
//msgComposer->systemFlags = (msgInfo.msgflags & RS_MSG_SYSTEM);
|
||||
|
||||
msgComposer->calculateTitle();
|
||||
|
||||
/* window will destroy itself! */
|
||||
|
@ -1083,6 +1088,9 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||
|
||||
mi.title = misc::removeNewLine(ui.titleEdit->text()).toStdWString();
|
||||
mi.msg = ui.msgText->toHtml().toStdWString();
|
||||
// needed to send system flags with reply
|
||||
//mi.msgflags = systemFlags;
|
||||
mi.msgflags = 0;
|
||||
|
||||
QString text;
|
||||
RsHtml::optimizeHtml(ui.msgText, text);
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
static void msgFriend(const std::string &id, bool group);
|
||||
static QString recommendMessage();
|
||||
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 QString &sslName);
|
||||
static void sendConnectAttemptMsg(const std::string &gpgId, const std::string &sslId, const QString &sslName);
|
||||
|
||||
static MessageComposer *newMsg(const std::string &msgId = "");
|
||||
static MessageComposer *replyMsg(const std::string &msgId, bool all);
|
||||
|
@ -207,6 +207,9 @@ private:
|
|||
std::list<uint32_t> m_tagIds;
|
||||
QList<QLabel*> tagLabels;
|
||||
|
||||
// needed to send system flags with reply
|
||||
//unsigned systemFlags;
|
||||
|
||||
RSTreeWidgetItemCompareRole *m_compareRole;
|
||||
QCompleter *m_completer;
|
||||
|
||||
|
|
|
@ -503,17 +503,23 @@ void MessageWidget::fill(const std::string &msgId)
|
|||
ui.dateText->setText(timestamp);
|
||||
}
|
||||
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
||||
std::string srcId;
|
||||
if ((msgInfo.msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX) {
|
||||
// outgoing message are from me
|
||||
srcId = rsPeers->getOwnId();
|
||||
srcId = ownId;
|
||||
} else {
|
||||
srcId = msgInfo.srcId;
|
||||
}
|
||||
link.createMessage(srcId, "");
|
||||
|
||||
ui.fromText->setText(link.toHtml());
|
||||
ui.fromText->setToolTip(PeerDefs::rsidFromId(srcId));
|
||||
if ((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.srcId == ownId) {
|
||||
ui.fromText->setText("RetroShare");
|
||||
} else {
|
||||
ui.fromText->setText(link.toHtml());
|
||||
ui.fromText->setToolTip(PeerDefs::rsidFromId(srcId));
|
||||
}
|
||||
|
||||
ui.subjectText->setText(QString::fromStdWString(msgInfo.title));
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ p, li { white-space: pre-wrap; }
|
|||
<rect>
|
||||
<x>80</x>
|
||||
<y>30</y>
|
||||
<width>201</width>
|
||||
<width>211</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue