mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
using new notification system for connection attempts
This commit is contained in:
parent
d8569d813c
commit
65fa54c206
13 changed files with 127 additions and 131 deletions
|
@ -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 */) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue