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 */ /* mit valid */
initRsMI(mit->second, msg); 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; return true;
} }

View File

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

View File

@ -236,6 +236,29 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
setupFormatActions(); 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("Standard");
ui.comboStyle->addItem("Bullet List (Disc)"); ui.comboStyle->addItem("Bullet List (Disc)");
ui.comboStyle->addItem("Bullet List (Circle)"); ui.comboStyle->addItem("Bullet List (Circle)");
@ -331,6 +354,13 @@ MessageComposer::~MessageComposer()
{ {
delete(m_compareRole); 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) void MessageComposer::processSettings(bool bLoad)
{ {
@ -1146,6 +1176,12 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
/* construct a message */ /* construct a message */
MessageInfo mi; 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(); mi.title = misc::removeNewLine(ui.titleEdit->text()).toUtf8().constData();
// needed to send system flags with reply // needed to send system flags with reply
mi.msgflags = msgFlags; mi.msgflags = msgFlags;

View File

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

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>796</width> <width>892</width>
<height>682</height> <height>682</height>
</rect> </rect>
</property> </property>
@ -641,23 +641,6 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
</layout> </layout>
@ -728,7 +711,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="5"> <item row="0" column="1" colspan="7">
<widget class="QLineEdit" name="titleEdit"/> <widget class="QLineEdit" name="titleEdit"/>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
@ -762,6 +745,16 @@
</widget> </widget>
</item> </item>
<item row="1" column="3"> <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"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -774,8 +767,25 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="2"> <item row="1" column="5">
<layout class="QHBoxLayout" name="tagLayout"/> <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> </item>
</layout> </layout>
</item> </item>
@ -859,7 +869,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>796</width> <width>892</width>
<height>25</height> <height>25</height>
</rect> </rect>
</property> </property>