mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
using new notification system for connection attempts
This commit is contained in:
parent
d8569d813c
commit
65fa54c206
@ -1220,6 +1220,7 @@ int AuthSSLimpl::VerifyX509Callback(int /*preverify_ok*/, X509_STORE_CTX* ctx)
|
||||
{
|
||||
ev->mSslCn = sslCn;
|
||||
ev->mPgpId = pgpId;
|
||||
ev->mErrorMsg = errMsg;
|
||||
ev->mErrorCode = RsAuthSslConnectionAutenticationEvent::MISSING_AUTHENTICATION_INFO;
|
||||
|
||||
rsEvents->postEvent(std::move(ev));
|
||||
@ -1332,17 +1333,6 @@ int AuthSSLimpl::VerifyX509Callback(int /*preverify_ok*/, X509_STORE_CTX* ctx)
|
||||
<< "sslId: " << sslId << " isSslOnlyFriend: " << isSslOnlyFriend
|
||||
<< std::endl;
|
||||
|
||||
if(rsEvents)
|
||||
{
|
||||
ev->mSuccess = true;
|
||||
ev->mSslId = sslId;
|
||||
ev->mSslCn = sslCn;
|
||||
ev->mPgpId = pgpId;
|
||||
ev->mErrorCode = RsAuthSslConnectionAutenticationEvent::NO_ERROR;
|
||||
|
||||
rsEvents->postEvent(std::move(ev));
|
||||
}
|
||||
|
||||
return verificationSuccess;
|
||||
}
|
||||
|
||||
@ -1795,9 +1785,6 @@ bool AuthSSLimpl::loadList(std::list<RsItem*>& load)
|
||||
return true;
|
||||
}
|
||||
|
||||
RsAuthSslConnectionAutenticationEvent::RsAuthSslConnectionAutenticationEvent() :
|
||||
RsEvent(RsEventType::AUTHSSL_CONNECTION_AUTENTICATION), mSuccess(false) {}
|
||||
|
||||
const EVP_PKEY*RsX509Cert::getPubKey(const X509& x509)
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||
|
@ -479,20 +479,29 @@ void p3LinkMgrIMPL::tickMonitors()
|
||||
|
||||
if (notify)
|
||||
{
|
||||
// normally these two below should disappear: there's no notion of popup in libretroshare.
|
||||
// all GUI-type display features should be chosen in NotifyQt.
|
||||
notify->AddPopupMessage(RS_POPUP_CONNECT, peer.id.toStdString(),"", "Online: ");
|
||||
notify->AddFeedItem(RS_FEED_ITEM_PEER_CONNECT, peer.id.toStdString());
|
||||
auto e = std::make_shared<RsConnectionEvent>() ;
|
||||
|
||||
notify->notifyPeerConnected(peer.id.toStdString());
|
||||
e->mType = RsConnectionEvent::PEER_CONNECTED;
|
||||
e->mSslId = peer.id;
|
||||
|
||||
rsEvents->postEvent(e);
|
||||
|
||||
// normally these this below should disappear: there's no notion of popup in libretroshare.
|
||||
// all GUI-type display features should be chosen in NotifyQt.
|
||||
|
||||
notify->AddPopupMessage(RS_POPUP_CONNECT, peer.id.toStdString(),"", "Online: ");
|
||||
}
|
||||
}
|
||||
if (peer.actions & RS_PEER_DISCONNECTED)
|
||||
{
|
||||
p3Notify *notify = RsServer::notify();
|
||||
|
||||
if (notify)
|
||||
notify->notifyPeerDisconnected(peer.id.toStdString());
|
||||
auto e = std::make_shared<RsConnectionEvent>() ;
|
||||
|
||||
e->mType = RsConnectionEvent::PEER_DISCONNECTED;
|
||||
e->mSslId = peer.id;
|
||||
|
||||
rsEvents->postEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,8 +217,6 @@ void p3Notify::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type,const
|
||||
void p3Notify::notifyListPreChange(int list, int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyListPreChange(list,type) ; }
|
||||
void p3Notify::notifyListChange (int list, int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyListChange (list,type) ; }
|
||||
|
||||
void p3Notify::notifyPeerConnected (const std::string& peer_id) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerConnected(peer_id); }
|
||||
void p3Notify::notifyPeerDisconnected (const std::string& peer_id) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerDisconnected(peer_id); }
|
||||
void p3Notify::notifyErrorMsg (int list, int sev, std::string msg) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyErrorMsg(list,sev,msg) ; }
|
||||
void p3Notify::notifyChatMessage (const ChatMessage &msg) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatMessage(msg) ; }
|
||||
void p3Notify::notifyChatStatus (const ChatId& chat_id, const std::string& status_string) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatStatus(chat_id,status_string) ; }
|
||||
|
@ -91,8 +91,6 @@ class p3Notify: public RsNotify
|
||||
|
||||
// Notifications of clients. Can be called from anywhere inside libretroshare.
|
||||
//
|
||||
void notifyPeerConnected (const std::string& /* peer_id */);
|
||||
void notifyPeerDisconnected (const std::string& /* peer_id */);
|
||||
void notifyListPreChange (int /* list */, int /* type */) ;
|
||||
void notifyListChange (int /* list */, int /* type */) ;
|
||||
void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) ;
|
||||
|
@ -493,8 +493,7 @@ int pqissllistenbase::continueSSL(IncomingSSLInfo& incoming_connexion_info, bool
|
||||
ev->mSslId = incoming_connexion_info.sslid;
|
||||
ev->mPgpId = incoming_connexion_info.gpgid;
|
||||
ev->mSslCn = incoming_connexion_info.sslcn;
|
||||
ev->mLocator = RsUrl(sockaddr_storage_iptostring(incoming_connexion_info.addr));
|
||||
ev->mSuccess = false;
|
||||
ev->mLocator = RsUrl(incoming_connexion_info.addr);
|
||||
ev->mErrorCode = RsAuthSslConnectionAutenticationEvent::MISSING_AUTHENTICATION_INFO;
|
||||
|
||||
rsEvents->postEvent(std::move(ev));
|
||||
|
@ -59,7 +59,7 @@ enum class RsEventType : uint32_t
|
||||
AUTHSSL_CONNECTION_AUTENTICATION = 3,
|
||||
|
||||
/// @see pqissl
|
||||
REMOTE_PEER_REFUSED_CONNECTION = 4,
|
||||
PEER_CONNECTION = 4,
|
||||
|
||||
/// @see RsGxsChanges
|
||||
GXS_CHANGES = 5,
|
||||
@ -173,7 +173,7 @@ public:
|
||||
};
|
||||
|
||||
//===================================================================================================//
|
||||
// Connexion events //
|
||||
// Connexion and security events //
|
||||
//===================================================================================================//
|
||||
|
||||
/**
|
||||
@ -182,10 +182,10 @@ public:
|
||||
*/
|
||||
struct RsAuthSslConnectionAutenticationEvent : RsEvent
|
||||
{
|
||||
RsAuthSslConnectionAutenticationEvent();
|
||||
RsAuthSslConnectionAutenticationEvent() : RsEvent(RsEventType::AUTHSSL_CONNECTION_AUTENTICATION) {}
|
||||
|
||||
enum ConnextionErrorCode: uint8_t {
|
||||
UNKNOWN_ERROR = 0x00,
|
||||
enum ConnectionErrorCode: uint8_t {
|
||||
NO_ERROR = 0x00,
|
||||
MISSING_AUTHENTICATION_INFO = 0x01,
|
||||
PGP_SIGNATURE_VALIDATION_FAILED = 0x02,
|
||||
MISMATCHED_PGP_ID = 0x03,
|
||||
@ -193,23 +193,21 @@ struct RsAuthSslConnectionAutenticationEvent : RsEvent
|
||||
NOT_A_FRIEND = 0x05,
|
||||
MISSING_CERTIFICATE = 0x06,
|
||||
IP_IS_BLACKLISTED = 0x07,
|
||||
NO_ERROR = 0x08,
|
||||
UNKNOWN_ERROR = 0x08,
|
||||
};
|
||||
|
||||
bool mSuccess;
|
||||
RsPeerId mSslId;
|
||||
std::string mSslCn;
|
||||
RsPgpId mPgpId;
|
||||
RsUrl mLocator;
|
||||
std::string mErrorMsg;
|
||||
ConnextionErrorCode mErrorCode;
|
||||
ConnectionErrorCode mErrorCode;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
RS_SERIAL_PROCESS(mSuccess);
|
||||
RS_SERIAL_PROCESS(mSslId);
|
||||
RS_SERIAL_PROCESS(mSslCn);
|
||||
RS_SERIAL_PROCESS(mPgpId);
|
||||
@ -219,3 +217,28 @@ struct RsAuthSslConnectionAutenticationEvent : RsEvent
|
||||
}
|
||||
};
|
||||
|
||||
struct RsConnectionEvent : RsEvent
|
||||
{
|
||||
RsConnectionEvent()
|
||||
: RsEvent(RsEventType::PEER_CONNECTION),
|
||||
mType(UNKNOWN) {}
|
||||
|
||||
enum ConnectionType: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
PEER_CONNECTED = 0x01,
|
||||
PEER_DISCONNECTED = 0x02,
|
||||
PEER_REFUSED_CONNECTION = 0x03,
|
||||
};
|
||||
|
||||
ConnectionType mType;
|
||||
RsPeerId mSslId;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
RS_SERIAL_PROCESS(mType);
|
||||
RS_SERIAL_PROCESS(mSslId);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -212,8 +212,6 @@ public:
|
||||
NotifyClient() {}
|
||||
virtual ~NotifyClient() {}
|
||||
|
||||
virtual void notifyPeerConnected (const std::string& /* peer_id */) {}
|
||||
virtual void notifyPeerDisconnected (const std::string& /* peer_id */) {}
|
||||
virtual void notifyListPreChange (int /* list */, int /* type */) {}
|
||||
virtual void notifyListChange (int /* list */, int /* type */) {}
|
||||
virtual void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) {}
|
||||
|
@ -189,57 +189,83 @@ void NewsFeed::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
|
||||
const RsAuthSslConnectionAutenticationEvent *pssl_e = dynamic_cast<const RsAuthSslConnectionAutenticationEvent*>(event.get());
|
||||
|
||||
if(pssl_e != nullptr && (flags & (RS_FEED_TYPE_SECURITY | RS_FEED_TYPE_PEER)))
|
||||
if(pssl_e != nullptr && (flags & RS_FEED_TYPE_SECURITY))
|
||||
{
|
||||
RsAuthSslConnectionAutenticationEvent e = *pssl_e; // make a copy because we lose memory ownership here
|
||||
auto e = *pssl_e; // make a copy because we lose memory ownership here
|
||||
|
||||
RsQThreadUtils::postToObject( [=]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete, note that
|
||||
* Qt::QueuedConnection is important!
|
||||
*/
|
||||
handleSecurityEvent(e);
|
||||
RsQThreadUtils::postToObject( [=]() { handleSecurityEvent(e); }, this );
|
||||
return;
|
||||
}
|
||||
|
||||
}, this );
|
||||
const RsConnectionEvent *conn_e = dynamic_cast<const RsConnectionEvent*>(event.get());
|
||||
|
||||
if(conn_e != nullptr && (flags & RS_FEED_TYPE_PEER))
|
||||
{
|
||||
auto e = *conn_e;
|
||||
|
||||
RsQThreadUtils::postToObject( [=]() { handleConnectionEvent(e); }, this );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void NewsFeed::handleConnectionEvent(const RsConnectionEvent& e)
|
||||
{
|
||||
std::cerr << "NotifyQt: handling connection event from peer " << e.mSslId << std::endl;
|
||||
|
||||
switch(e.mType)
|
||||
{
|
||||
case RsConnectionEvent::PEER_CONNECTED:
|
||||
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_CONNECT, false),
|
||||
PEER_TYPE_CONNECT,
|
||||
e.mSslId.toStdString(),
|
||||
std::string(),
|
||||
std::string(),
|
||||
std::string(),
|
||||
true);
|
||||
break;
|
||||
|
||||
case RsConnectionEvent::PEER_DISCONNECTED: break;// not handled yet
|
||||
case RsConnectionEvent::PEER_REFUSED_CONNECTION:
|
||||
{
|
||||
RsPeerDetails det;
|
||||
if(!rsPeers->getPeerDetails(e.mSslId,det))
|
||||
return;
|
||||
|
||||
addFeedItemIfUnique(new SecurityItem(this,
|
||||
NEWSFEED_SECLIST,
|
||||
det.gpg_id, det.id,
|
||||
det.location,
|
||||
std::string(),
|
||||
RS_FEED_ITEM_SEC_AUTH_DENIED,
|
||||
false),
|
||||
RS_FEED_ITEM_SEC_AUTH_DENIED,
|
||||
det.gpg_id.toStdString(),
|
||||
std::string(),
|
||||
std::string(),
|
||||
std::string(),
|
||||
true );
|
||||
} break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void NewsFeed::handleSecurityEvent(const RsAuthSslConnectionAutenticationEvent& e)
|
||||
{
|
||||
std::cerr << "NotifyQt: handling connection security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << e.mErrorCode << std::endl;
|
||||
std::cerr << "NotifyQt: handling security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << e.mErrorCode << std::endl;
|
||||
uint flags = Settings->getNewsFeedFlags();
|
||||
|
||||
if(e.mSuccess)
|
||||
if(flags & RS_FEED_TYPE_PEER)
|
||||
{
|
||||
addFeedItem(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_CONNECT, false));
|
||||
return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
uint32_t FeedItemType=0;
|
||||
|
||||
switch(e.mErrorCode)
|
||||
{
|
||||
case RsAuthSslConnectionAutenticationEvent::NO_CERTIFICATE_SUPPLIED:
|
||||
case RsAuthSslConnectionAutenticationEvent::MISMATCHED_PGP_ID: // fallthrough
|
||||
case RsAuthSslConnectionAutenticationEvent::MISSING_AUTHENTICATION_INFO: FeedItemType = RS_FEED_ITEM_SEC_BAD_CERTIFICATE;
|
||||
break;
|
||||
|
||||
case RsAuthSslConnectionAutenticationEvent::PGP_SIGNATURE_VALIDATION_FAILED: FeedItemType = RS_FEED_ITEM_SEC_WRONG_SIGNATURE;
|
||||
break;
|
||||
|
||||
case RsAuthSslConnectionAutenticationEvent::NOT_A_FRIEND: FeedItemType = RS_FEED_ITEM_SEC_AUTH_DENIED;
|
||||
break;
|
||||
|
||||
case RsAuthSslConnectionAutenticationEvent::IP_IS_BLACKLISTED: FeedItemType = RS_FEED_ITEM_SEC_IP_BLACKLISTED;
|
||||
break;
|
||||
|
||||
case RsAuthSslConnectionAutenticationEvent::MISSING_CERTIFICATE: FeedItemType = RS_FEED_ITEM_SEC_MISSING_CERTIFICATE;
|
||||
break;
|
||||
case RsAuthSslConnectionAutenticationEvent::MISSING_AUTHENTICATION_INFO: FeedItemType = RS_FEED_ITEM_SEC_BAD_CERTIFICATE; break;
|
||||
case RsAuthSslConnectionAutenticationEvent::PGP_SIGNATURE_VALIDATION_FAILED: FeedItemType = RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break;
|
||||
case RsAuthSslConnectionAutenticationEvent::NOT_A_FRIEND: FeedItemType = RS_FEED_ITEM_SEC_AUTH_DENIED; break;
|
||||
case RsAuthSslConnectionAutenticationEvent::IP_IS_BLACKLISTED: FeedItemType = RS_FEED_ITEM_SEC_IP_BLACKLISTED; break;
|
||||
case RsAuthSslConnectionAutenticationEvent::MISSING_CERTIFICATE: FeedItemType = RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break;
|
||||
|
||||
default:
|
||||
return; // display nothing
|
||||
@ -255,12 +281,15 @@ void NewsFeed::handleSecurityEvent(const RsAuthSslConnectionAutenticationEvent&
|
||||
e.mLocator.toString(),
|
||||
FeedItemType,
|
||||
false),
|
||||
RS_FEED_ITEM_SEC_BAD_CERTIFICATE,
|
||||
FeedItemType,
|
||||
det.gpg_id.toStdString(),
|
||||
std::string(),
|
||||
std::string(),
|
||||
std::string(),
|
||||
true );
|
||||
|
||||
if (Settings->getMessageFlags() & RS_MESSAGE_CONNECT_ATTEMPT)
|
||||
MessageComposer::sendConnectAttemptMsg(e.mPgpId, e.mSslId, QString::fromStdString(det.name + "(" + det.location + ")"));
|
||||
}
|
||||
|
||||
void NewsFeed::updateDisplay()
|
||||
@ -276,14 +305,6 @@ void NewsFeed::updateDisplay()
|
||||
{
|
||||
switch(fi.mType)
|
||||
{
|
||||
case RS_FEED_ITEM_PEER_CONNECT:
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerConnect(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_PEER_DISCONNECT:
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerDisconnect(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_PEER_HELLO:
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerHello(fi);
|
||||
@ -297,21 +318,9 @@ void NewsFeed::updateDisplay()
|
||||
addFeedItemPeerOffset(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
|
||||
case RS_FEED_ITEM_SEC_WRONG_SIGNATURE:
|
||||
case RS_FEED_ITEM_SEC_BAD_CERTIFICATE:
|
||||
case RS_FEED_ITEM_SEC_MISSING_CERTIFICATE:
|
||||
case RS_FEED_ITEM_SEC_INTERNAL_ERROR:
|
||||
if (Settings->getMessageFlags() & RS_MESSAGE_CONNECT_ATTEMPT) {
|
||||
MessageComposer::sendConnectAttemptMsg(RsPgpId(fi.mId1), RsPeerId(fi.mId2), QString::fromUtf8(fi.mId3.c_str()));
|
||||
}
|
||||
if (flags & RS_FEED_TYPE_SECURITY)
|
||||
addFeedItemSecurityConnectAttempt(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_SEC_AUTH_DENIED:
|
||||
if (flags & RS_FEED_TYPE_SECURITY)
|
||||
addFeedItemSecurityAuthDenied(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_SEC_UNKNOWN_IN:
|
||||
if (flags & RS_FEED_TYPE_SECURITY)
|
||||
addFeedItemSecurityUnknownIn(fi);
|
||||
@ -321,11 +330,6 @@ void NewsFeed::updateDisplay()
|
||||
addFeedItemSecurityUnknownOut(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_SEC_IP_BLACKLISTED:
|
||||
if (flags & RS_FEED_TYPE_SECURITY_IP)
|
||||
addFeedItemSecurityIpBlacklisted(fi, false);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED:
|
||||
if (flags & RS_FEED_TYPE_SECURITY_IP)
|
||||
addFeedItemSecurityWrongExternalIpReported(fi, false);
|
||||
|
@ -103,6 +103,7 @@ private slots:
|
||||
|
||||
private:
|
||||
void handleSecurityEvent(const RsAuthSslConnectionAutenticationEvent& e);
|
||||
void handleConnectionEvent(const RsConnectionEvent& e);
|
||||
|
||||
void addFeedItem(FeedItem *item);
|
||||
void addFeedItemIfUnique(FeedItem *item, int itemType, const std::string& id1, const std::string& id2, const std::string& id3, const std::string& id4, bool replace);
|
||||
|
@ -176,6 +176,8 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent)
|
||||
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
|
||||
ui->filterLineEdit->showFilterIcon();
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId );
|
||||
|
||||
mModel = new RsFriendListModel();
|
||||
mProxyModel = new FriendListSortFilterProxyModel(ui->peerTreeWidget->header(),this);
|
||||
|
||||
@ -236,8 +238,6 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent)
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()) , this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)) , this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerConnected(const QString&)) , this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerDisconnected(const QString&)), this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
|
||||
|
||||
connect(ui->actionShowOfflineFriends, SIGNAL(triggered(bool)), this, SLOT(setShowUnconnected(bool)));
|
||||
connect(ui->actionShowState, SIGNAL(triggered(bool)), this, SLOT(setShowState(bool)) );
|
||||
@ -254,6 +254,12 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent)
|
||||
|
||||
}
|
||||
|
||||
void NewFriendList::handleEvent(std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
if(dynamic_cast<const RsConnectionEvent*>(e.get()) != nullptr)
|
||||
forceUpdateDisplay();
|
||||
}
|
||||
|
||||
NewFriendList::~NewFriendList()
|
||||
{
|
||||
delete ui;
|
||||
|
@ -95,6 +95,7 @@ private slots:
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void handleEvent(std::shared_ptr<const RsEvent> e);
|
||||
|
||||
private:
|
||||
Ui::NewFriendList *ui;
|
||||
@ -117,6 +118,7 @@ private:
|
||||
|
||||
// Settings for peer list display
|
||||
bool mShowState;
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
|
||||
std::set<RsNodeGroupId> openGroups;
|
||||
std::set<RsPgpId> openPeers;
|
||||
|
@ -89,10 +89,6 @@ void NotifyQt::SetDisableAll(bool bValue)
|
||||
}
|
||||
}
|
||||
|
||||
NotifyQt::~NotifyQt()
|
||||
{
|
||||
}
|
||||
|
||||
NotifyQt::NotifyQt() : cDialog(NULL)
|
||||
{
|
||||
runningToasterTimer = new QTimer(this);
|
||||
@ -740,27 +736,6 @@ void NotifyQt::notifyListChange(int list, int type)
|
||||
return;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyPeerConnected(const std::string& peer_id)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
emit peerConnected(QString::fromStdString(peer_id));
|
||||
}
|
||||
void NotifyQt::notifyPeerDisconnected(const std::string& peer_id)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
emit peerDisconnected(QString::fromStdString(peer_id));
|
||||
}
|
||||
|
||||
void NotifyQt::notifyListPreChange(int list, int /*type*/)
|
||||
{
|
||||
{
|
||||
|
@ -56,12 +56,10 @@ class NotifyQt: public QObject, public NotifyClient
|
||||
static bool isAllDisable();
|
||||
void enable() ;
|
||||
|
||||
virtual ~NotifyQt() ;
|
||||
virtual ~NotifyQt() = default;
|
||||
|
||||
void setNetworkDialog(NetworkDialog *c) { cDialog = c; }
|
||||
|
||||
virtual void notifyPeerConnected(const std::string& /* peer_id */);
|
||||
virtual void notifyPeerDisconnected(const std::string& /* peer_id */);
|
||||
virtual void notifyListPreChange(int list, int type);
|
||||
virtual void notifyListChange(int list, int type);
|
||||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
||||
@ -122,8 +120,6 @@ class NotifyQt: public QObject, public NotifyClient
|
||||
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
||||
// as they get queued by Qt.
|
||||
//
|
||||
void peerConnected(const QString&) const ;
|
||||
void peerDisconnected(const QString&) const ;
|
||||
void hashingInfoChanged(const QString&) const ;
|
||||
void filesPreModChanged(bool) const ;
|
||||
void filesPostModChanged(bool) const ;
|
||||
|
Loading…
Reference in New Issue
Block a user