mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added code to create/paste/read private chat and msg links
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-GenericTunneling@6305 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9e8b9b6c05
commit
e7871b598b
@ -2957,7 +2957,7 @@ bool p3ChatService::createDistantChatInvite(const std::string& pgp_id,time_t tim
|
||||
unsigned char hash_bytes[16] ;
|
||||
RAND_bytes( hash_bytes, 16) ;
|
||||
|
||||
std::string hash = SSLIdType(hash_bytes).toStdString() ;
|
||||
std::string hash = SSLIdType(hash_bytes).toStdString(false) ;
|
||||
|
||||
std::cerr << "Created new distant chat invite: " << std::endl;
|
||||
std::cerr << " creation time stamp = " << invite.time_of_creation << std::endl;
|
||||
@ -3009,6 +3009,7 @@ bool p3ChatService::createDistantChatInvite(const std::string& pgp_id,time_t tim
|
||||
_distant_chat_invites[hash] = invite ;
|
||||
}
|
||||
|
||||
encrypted_radix64_string = invite.encrypted_radix64_string ;
|
||||
std::cerr << "Encrypted radix64 string: " << invite.encrypted_radix64_string << std::endl;
|
||||
|
||||
return true ;
|
||||
|
@ -19,8 +19,11 @@
|
||||
****************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <QMessageBox>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include "CreateMsgLinkDialog.h"
|
||||
#include <gui/common/FriendSelectionWidget.h>
|
||||
#include <gui/RetroShareLink.h>
|
||||
|
||||
CreateMsgLinkDialog::CreateMsgLinkDialog(QWidget *parent)
|
||||
:QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)
|
||||
@ -28,39 +31,104 @@ CreateMsgLinkDialog::CreateMsgLinkDialog(QWidget *parent)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
|
||||
_info_GB->layout()->addWidget( _gpg_selection = new FriendSelectionWidget(this) ) ;
|
||||
|
||||
QObject::connect(_link_type_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(update())) ;
|
||||
QObject::connect(_create_link_PB,SIGNAL(clicked()),this,SLOT(create())) ;
|
||||
QObject::connect(_create_link_PB,SIGNAL(clicked()),this,SLOT(createLink())) ;
|
||||
QObject::connect(_create_new_PB,SIGNAL(toggled(bool)),this,SLOT(toggleCreateLink(bool))) ;
|
||||
|
||||
_gpg_selection->setModus(FriendSelectionWidget::MODUS_SINGLE) ;
|
||||
_gpg_selection->setShowType(FriendSelectionWidget::SHOW_NON_FRIEND_GPG | FriendSelectionWidget::SHOW_GPG) ;
|
||||
_gpg_selection->setHeaderText(QObject::tr("Select who can contact you:")) ;
|
||||
_gpg_selection->start() ;
|
||||
|
||||
toggleCreateLink(false) ;
|
||||
update() ;
|
||||
}
|
||||
|
||||
void CreateMsgLinkDialog::toggleCreateLink(bool b)
|
||||
{
|
||||
_new_link_F->setHidden(!b) ;
|
||||
}
|
||||
void CreateMsgLinkDialog::update()
|
||||
{
|
||||
if(_link_type_CB->currentIndex() == 0)
|
||||
{
|
||||
QString s ;
|
||||
|
||||
s += "A private chat invite allows a specific peer to contact you\nusing encrypted private chat. You need to select a destination peer from your PGP keyring\nbefore creating the link. The link contains the encryption code and your PGP signature, so that the peer can authenticate you." ;
|
||||
s += "A private chat invite allows a specific peer to contact you using encrypted private chat. You need to select a destination peer from your PGP keyring before creating the link. The link contains the encryption code and your PGP signature, so that the peer can authenticate you." ;
|
||||
|
||||
_info_LB->setText(s) ;
|
||||
_info_TB->setHtml(s) ;
|
||||
_gpg_selection->setHidden(false) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
QString s ;
|
||||
|
||||
s += "A private chat invite allows a specific peer to contact you\nusing encrypted private chat. You need to select a destination peer from your PGP keyring\nbefore creating the link. The link contains the encryption code and your PGP signature, so that the peer can authenticate you." ;
|
||||
s += "A public message link allows any peer in the nearby network to send a private message to you. The message is encrypted and only you can read it." ;
|
||||
|
||||
_info_LB->setText(s) ;
|
||||
_info_TB->setHtml(s) ;
|
||||
_gpg_selection->setHidden(true) ;
|
||||
}
|
||||
}
|
||||
|
||||
time_t CreateMsgLinkDialog::computeValidityDuration() const
|
||||
{
|
||||
time_t unit ;
|
||||
|
||||
switch(_validity_time_CB->currentIndex())
|
||||
{
|
||||
default:
|
||||
case 0: unit = 3600 ;
|
||||
break ;
|
||||
case 1: unit = 3600*24 ;
|
||||
break ;
|
||||
case 2: unit = 3600*24*7 ;
|
||||
break ;
|
||||
case 3: unit = 3600*24*30 ;
|
||||
break ;
|
||||
case 4: unit = 3600*24*365 ;
|
||||
break ;
|
||||
}
|
||||
|
||||
return unit * _validity_time_SB->value() ;
|
||||
}
|
||||
|
||||
void CreateMsgLinkDialog::createLink()
|
||||
{
|
||||
std::cerr << "Creating link!" << std::endl;
|
||||
|
||||
if(_link_type_CB->currentIndex() == 0)
|
||||
{
|
||||
time_t validity_duration = computeValidityDuration() ;
|
||||
FriendSelectionWidget::IdType type ;
|
||||
std::string current_pgp_id = _gpg_selection->selectedId(type) ;
|
||||
|
||||
std::string encrypted_string ;
|
||||
|
||||
bool res = rsMsgs->createDistantChatInvite(current_pgp_id,validity_duration,encrypted_string) ;
|
||||
|
||||
RetroShareLink link ;
|
||||
|
||||
if(!link.createPrivateChatInvite(validity_duration + time(NULL),QString::fromStdString(current_pgp_id),QString::fromStdString(encrypted_string)) )
|
||||
std::cerr << "Cannot create link." << std::endl;
|
||||
|
||||
QList<RetroShareLink> links ;
|
||||
links.push_back(link) ;
|
||||
|
||||
RSLinkClipboard::copyLinks(links) ;
|
||||
|
||||
if(!res)
|
||||
QMessageBox::critical(NULL,tr("Private chat invite creation failed"),tr("The creation of the chat invite failed")) ;
|
||||
else
|
||||
QMessageBox::information(NULL,tr("Private chat invite created"),tr("Your new chat invite has been copied to clipboard. You can now paste it as a Retroshare link.")) ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Private msg links not yet implemented." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,11 @@ class CreateMsgLinkDialog : public QDialog, public Ui::CreateMsgLinkDialog
|
||||
/* actions to take.... */
|
||||
void createLink();
|
||||
void update() ;
|
||||
void toggleCreateLink(bool) ;
|
||||
|
||||
private:
|
||||
time_t computeValidityDuration() const ;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
FriendSelectionWidget *_gpg_selection ;
|
||||
};
|
||||
|
@ -6,131 +6,253 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>497</width>
|
||||
<height>174</height>
|
||||
<width>565</width>
|
||||
<height>465</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Invite type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListView" name="_existing_links_LV"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="_link_type_CB">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Private chat</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Valid until:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Hash:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Usable by:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QDateTimeEdit" name="_current_link_date_DE"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="_current_link_type_LE"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="_current_link_hash_LE"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="_current_link_dst_LE"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Public message</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Copy to clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="_create_new_PB">
|
||||
<property name="text">
|
||||
<string>Create new</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Valid until:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateTimeEdit" name="dateTimeEdit"/>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="_info_GB">
|
||||
<property name="title">
|
||||
<string>Information</string>
|
||||
<widget class="QFrame" name="_new_link_F">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="_info_LB">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Invite type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="_link_type_CB">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Private chat</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Public message</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Validity time :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="_validity_time_SB">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="_validity_time_CB">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hour</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>day</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>week</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>month</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>year</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="_info_GB">
|
||||
<property name="title">
|
||||
<string>Information</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="_info_TB"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="_create_link_PB">
|
||||
<property name="text">
|
||||
<string>Create!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Link:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="_create_link_PB">
|
||||
<property name="text">
|
||||
<string>Create!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Link:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>_link_type_CB</zorder>
|
||||
<zorder>label</zorder>
|
||||
<zorder>dateTimeEdit</zorder>
|
||||
<zorder>label_2</zorder>
|
||||
<zorder>label_4</zorder>
|
||||
<zorder>lineEdit</zorder>
|
||||
<zorder>_create_link_PB</zorder>
|
||||
<zorder>label_2</zorder>
|
||||
<zorder>_existing_links_LV</zorder>
|
||||
<zorder>_current_link_date_DE</zorder>
|
||||
<zorder>label_3</zorder>
|
||||
<zorder>label_5</zorder>
|
||||
<zorder>label_6</zorder>
|
||||
<zorder>label_7</zorder>
|
||||
<zorder>pushButton</zorder>
|
||||
<zorder>_current_link_type_LE</zorder>
|
||||
<zorder>_current_link_dst_LE</zorder>
|
||||
<zorder>_current_link_hash_LE</zorder>
|
||||
<zorder>verticalSpacer</zorder>
|
||||
<zorder>_create_new_PB</zorder>
|
||||
<zorder>_new_link_F</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CreateMsgLinkDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>CreateMsgLinkDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -91,6 +91,7 @@
|
||||
|
||||
#define PRIVATE_CHAT_TIME_STAMP "time_stamp"
|
||||
#define PRIVATE_CHAT_STRING "encrypted_data"
|
||||
#define PRIVATE_CHAT_GPG_ID "gpgid"
|
||||
|
||||
#define PUBLIC_MSG_TIME_STAMP "time_stamp"
|
||||
#define PUBLIC_MSG_SRC_PGP_ID "gpgid"
|
||||
@ -116,7 +117,8 @@ void RetroShareLink::fromString(const QString& url)
|
||||
#endif
|
||||
|
||||
if ((url.startsWith(QString(RSLINK_SCHEME) + "://" + QString(HOST_FILE)) && url.count("|") == 3) ||
|
||||
(url.startsWith(QString(RSLINK_SCHEME) + "://" + QString(HOST_PERSON)) && url.count("|") == 2)) {
|
||||
(url.startsWith(QString(RSLINK_SCHEME) + "://" + QString(HOST_PERSON)) && url.count("|") == 2))
|
||||
{
|
||||
/* Old link, we try it */
|
||||
QStringList list = url.split ("|");
|
||||
|
||||
@ -196,6 +198,7 @@ void RetroShareLink::fromUrl(const QUrl& url)
|
||||
_type = TYPE_PRIVATE_CHAT ;
|
||||
_time_stamp = url.queryItemValue(PRIVATE_CHAT_TIME_STAMP).toUInt(&ok) ;
|
||||
_encrypted_chat_info = url.queryItemValue(PRIVATE_CHAT_STRING) ;
|
||||
_GPGid = url.queryItemValue(PRIVATE_CHAT_GPG_ID) ;
|
||||
|
||||
check() ;
|
||||
return;
|
||||
@ -334,8 +337,10 @@ bool RetroShareLink::createPrivateChatInvite(time_t time_stamp,const QString& gp
|
||||
{
|
||||
clear() ;
|
||||
|
||||
_type = TYPE_PRIVATE_CHAT ;
|
||||
_time_stamp = time_stamp ;
|
||||
_encrypted_chat_info = encrypted_chat_info ;
|
||||
_GPGid = gpg_id ;
|
||||
|
||||
check() ;
|
||||
|
||||
@ -345,6 +350,7 @@ bool RetroShareLink::createPublicMsgInvite(time_t time_stamp,const QString& pgp_
|
||||
{
|
||||
clear() ;
|
||||
|
||||
_type = TYPE_PUBLIC_MSG ;
|
||||
_time_stamp = time_stamp ;
|
||||
_hash = hash ;
|
||||
_GPGid = pgp_id ;
|
||||
@ -575,6 +581,7 @@ void RetroShareLink::check()
|
||||
|
||||
case TYPE_PRIVATE_CHAT:
|
||||
if(!checkRadix64(_encrypted_chat_info)) _valid = false ;
|
||||
if(!checkPGPId(_GPGid)) _valid = false ;
|
||||
break ;
|
||||
|
||||
case TYPE_PUBLIC_MSG:
|
||||
@ -709,6 +716,7 @@ QString RetroShareLink::toString() const
|
||||
url.setScheme(RSLINK_SCHEME) ;
|
||||
url.setHost(HOST_PRIVATE_CHAT) ;
|
||||
url.addQueryItem(PRIVATE_CHAT_TIME_STAMP,QString::number(_time_stamp)) ;
|
||||
url.addQueryItem(PRIVATE_CHAT_GPG_ID,_GPGid) ;
|
||||
url.addQueryItem(PRIVATE_CHAT_STRING,_encrypted_chat_info) ;
|
||||
|
||||
return url.toString() ;
|
||||
@ -830,6 +838,12 @@ QString RetroShareLink::niceName() const
|
||||
return PeerDefs::rsid(name().toUtf8().constData(), hash().toStdString());
|
||||
}
|
||||
|
||||
if(type() == TYPE_PRIVATE_CHAT) {
|
||||
return QString("Private chat invite (Valid only for key %1)").arg(_GPGid);
|
||||
}
|
||||
if(type() == TYPE_PUBLIC_MSG) {
|
||||
return QString("Click this line to contact %1 (%2)").arg(_GPGid) ;
|
||||
}
|
||||
if(type() == TYPE_CERTIFICATE) {
|
||||
if (_location.isEmpty()) {
|
||||
return QString("RetroShare Certificate (%1)").arg(_name);
|
||||
@ -945,9 +959,13 @@ bool RetroShareLink::checkRadix64(const QString& s)
|
||||
{
|
||||
unsigned char b(qb[i]) ;
|
||||
|
||||
if(!( (b > 46 && b < 58) || (b > 64 && b < 91) || (b > 96 && b < 123) || b=='+'))
|
||||
if(!( (b > 46 && b < 58) || (b > 64 && b < 91) || (b > 96 && b < 123) || b=='+' || b=='='))
|
||||
{
|
||||
std::cerr << "Character not allowed in radix: " << b << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
std::cerr << "Radix check: passed" << std::endl;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@ -1178,6 +1196,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
std::cerr << "Opening a private chat window " << std::endl;
|
||||
std::cerr << " time_stamp = " << link._time_stamp << std::endl;
|
||||
std::cerr << " enc-string = " << link._encrypted_chat_info.toStdString() << std::endl;
|
||||
std::cerr << " PGP Id = " << link._GPGid.toStdString() << std::endl;
|
||||
}
|
||||
break ;
|
||||
|
||||
|
@ -221,7 +221,7 @@ void FriendSelectionWidget::fillList()
|
||||
}
|
||||
|
||||
std::list<std::string> gpgIdsSelected;
|
||||
if (mShowTypes & SHOW_GPG) {
|
||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||
selectedGpgIds(gpgIdsSelected, true);
|
||||
}
|
||||
|
||||
@ -235,10 +235,15 @@ void FriendSelectionWidget::fillList()
|
||||
|
||||
std::list<std::string> gpgIds;
|
||||
std::list<std::string>::iterator gpgIt;
|
||||
rsPeers->getGPGAcceptedList(gpgIds);
|
||||
|
||||
if(mShowTypes & SHOW_NON_FRIEND_GPG)
|
||||
rsPeers->getGPGAllList(gpgIds);
|
||||
else
|
||||
rsPeers->getGPGAcceptedList(gpgIds);
|
||||
|
||||
std::list<std::string> sslIds;
|
||||
std::list<std::string>::iterator sslIt;
|
||||
|
||||
if ((mShowTypes & (SHOW_SSL | SHOW_GPG)) == SHOW_SSL) {
|
||||
rsPeers->getFriendList(sslIds);
|
||||
}
|
||||
@ -295,7 +300,7 @@ void FriendSelectionWidget::fillList()
|
||||
}
|
||||
}
|
||||
|
||||
if (mShowTypes & SHOW_GPG) {
|
||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||
// iterate through gpg ids
|
||||
for (gpgIt = gpgIds.begin(); gpgIt != gpgIds.end(); gpgIt++) {
|
||||
if (groupInfo) {
|
||||
@ -466,7 +471,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||
QString gpgId;
|
||||
int gpgStatus = RS_STATUS_OFFLINE;
|
||||
|
||||
if (mShowTypes & SHOW_GPG) {
|
||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||
/* need gpg id and online state */
|
||||
RsPeerDetails detail;
|
||||
if (rsPeers->getPeerDetails(peerId.toStdString(), detail)) {
|
||||
|
@ -56,9 +56,10 @@ public:
|
||||
};
|
||||
|
||||
enum ShowType {
|
||||
SHOW_GROUP = 1,
|
||||
SHOW_GPG = 2,
|
||||
SHOW_SSL = 4
|
||||
SHOW_GROUP = 1,
|
||||
SHOW_GPG = 2,
|
||||
SHOW_SSL = 4,
|
||||
SHOW_NON_FRIEND_GPG = 8,
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(ShowTypes, ShowType)
|
||||
|
Loading…
Reference in New Issue
Block a user