added code to transmit the sender GXS id in the message widget. Still need to make distant message links work

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7347 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-05-07 20:53:16 +00:00
parent 3de7357923
commit a5d88d967e
5 changed files with 76 additions and 22 deletions

View File

@ -748,6 +748,11 @@ bool p3MsgService::getMessage(const std::string &mId, MessageInfo &msg)
/* mit valid */
initRsMI(mit->second, msg);
std::map<uint32_t, RsMsgSrcId*>::const_iterator it = mSrcIds.find(msgId) ;
if(it != mSrcIds.end())
msg.rsgxsid_srcId = RsGxsId(it->second->srcId) ;
return true;
}

View File

@ -99,6 +99,8 @@ const QString PeerDefs::rsidFromId(const RsPeerId &id, QString *name /* = NULL*/
rsid = PeerDefs::rsid(peerName, *it);
if(name)
*name = QString::fromUtf8(peerName.c_str());
return rsid ;
}
rsid = PeerDefs::rsid("", id);

View File

@ -236,6 +236,29 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
setupFormatActions();
std::list<RsGxsId> own_ids ;
rsIdentity->getOwnIds(own_ids) ;
ui.respond_to_CB->addItem(tr("[no identity]"), QVariant(QString::fromStdString(RsGxsId().toStdString()))) ;
for(std::list<RsGxsId>::const_iterator it(own_ids.begin());it!=own_ids.end();++it)
{
RsIdentityDetails details ;
rsIdentity->getIdDetails(*it,details) ;
std::cerr << "Adding identity: id=" << (*it) << ", name=" << details.mNickname << std::endl;
if(details.mNickname.empty()) // I don't know why, but that happens
ui.respond_to_CB->addItem(QString::fromStdString((*it).toStdString()), QString::fromStdString((*it).toStdString())) ;
else
ui.respond_to_CB->addItem(QString::fromUtf8(details.mNickname.c_str()), QString::fromStdString((*it).toStdString())) ;
}
QObject::connect(ui.respond_to_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSigningButton(int))) ;
if(!own_ids.empty())
ui.respond_to_CB->setCurrentIndex(1) ;
/*ui.comboStyle->addItem("Standard");
ui.comboStyle->addItem("Bullet List (Disc)");
ui.comboStyle->addItem("Bullet List (Circle)");
@ -331,6 +354,13 @@ MessageComposer::~MessageComposer()
{
delete(m_compareRole);
}
void MessageComposer::updateSigningButton(int n)
{
if(n == 0)
ui.signMessage_CB->setEnabled(false) ;
else
ui.signMessage_CB->setEnabled(true) ;
}
void MessageComposer::processSettings(bool bLoad)
{
@ -1146,6 +1176,12 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
/* construct a message */
MessageInfo mi;
// add a GXS signer/from in case the message is to be sent to a distant peer
mi.rsgxsid_srcId = RsGxsId(ui.respond_to_CB->itemData(ui.respond_to_CB->currentIndex()).toString().toStdString()) ;
std::cerr << "MessageSend: setting 'from' field to GXS id = " << mi.rsgxsid_srcId << std::endl;
mi.title = misc::removeNewLine(ui.titleEdit->text()).toUtf8().constData();
// needed to send system flags with reply
mi.msgflags = msgFlags;

View File

@ -80,6 +80,7 @@ public slots:
void addImage();
void changeFormatType(int styleIndex );
void updateSigningButton(int) ;
protected:
void closeEvent (QCloseEvent * event);

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>796</width>
<width>892</width>
<height>682</height>
</rect>
</property>
@ -641,23 +641,6 @@
</property>
</widget>
</item>
<item row="0" column="15">
<widget class="QPushButton" name="signMessage_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Cryptographically sign message to distant peers. This is prevents intermediate peers to spoof your identity.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/stock_signature_ok.png</normaloff>:/images/stock_signature_ok.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -728,7 +711,7 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="5">
<item row="0" column="1" colspan="7">
<widget class="QLineEdit" name="titleEdit"/>
</item>
<item row="1" column="0">
@ -762,6 +745,16 @@
</widget>
</item>
<item row="1" column="3">
<layout class="QHBoxLayout" name="tagLayout"/>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Respond to:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -774,8 +767,25 @@
</property>
</spacer>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="tagLayout"/>
<item row="1" column="5">
<widget class="QComboBox" name="respond_to_CB"/>
</item>
<item row="1" column="6">
<widget class="QPushButton" name="signMessage_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Cryptographically sign message to distant peers. This is prevents intermediate peers to spoof your identity.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/stock_signature_ok.png</normaloff>:/images/stock_signature_ok.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
@ -859,7 +869,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>796</width>
<width>892</width>
<height>25</height>
</rect>
</property>