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:
thunder2 2012-05-01 09:18:55 +00:00
parent 32ac7efb42
commit c331098203
20 changed files with 271 additions and 172 deletions

View file

@ -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);