From ad9912f5695eb1390f51402d41cc28cd6a05ebc9 Mon Sep 17 00:00:00 2001 From: imaginos Date: Sun, 15 May 2005 04:03:04 +0000 Subject: [PATCH] don't unwittingly insert the value if its not there git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@300 726aef4b-f618-498e-8847-2d620e286838 --- Modules.cpp | 5 ++++- Modules.h | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Modules.cpp b/Modules.cpp index aa28b31e..6346ee1b 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -73,7 +73,10 @@ bool CModule::SetNV( const CString & sName, const CString & sValue, bool bWriteT CString CModule::GetNV( const CString & sName ) { - return( m_mssRegistry[sName] ); + MCString::iterator it = m_mssRegistry.find( sName ); + if ( it != m_mssRegistry.end() ) + return( it->second ); + return( "" ); } bool CModule::DelNV( const CString & sName, bool bWriteToDisk ) diff --git a/Modules.h b/Modules.h index 44872d60..93cf6a86 100644 --- a/Modules.h +++ b/Modules.h @@ -166,6 +166,10 @@ public: bool SetNV( const CString & sName, const CString & sValue, bool bWriteToDisk = true ); CString GetNV( const CString & sName ); bool DelNV( const CString & sName, bool bWriteToDisk = true ); + MCString::iterator FindNV( const CString & sName ) { return( m_mssRegistry.find( sName ) ); } + MCString::iterator EndNV() { return( m_mssRegistry.end() ); } + MCString::iterator BeginNV() { return( m_mssRegistry.begin() ); } + void DelNV( MCString::iterator it ) { m_mssRegistry.erase( it ); } protected: vector m_vTimers; @@ -173,6 +177,7 @@ protected: TSocketManager* m_pManager; CUser* m_pUser; CString m_sModName; +private: MCString m_mssRegistry; //!< way to save name/value pairs. Note there is no encryption involved in this };