mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
More translateable strings (#1354)
This commit is contained in:
@@ -72,7 +72,8 @@ class CZNCSock : public Csock, public CCoreTranslationMixin {
|
||||
|
||||
enum EAddrType { ADDR_IPV4ONLY, ADDR_IPV6ONLY, ADDR_ALL };
|
||||
|
||||
class CSockManager : public TSocketManager<CZNCSock> {
|
||||
class CSockManager : public TSocketManager<CZNCSock>,
|
||||
private CCoreTranslationMixin {
|
||||
public:
|
||||
CSockManager();
|
||||
virtual ~CSockManager();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include <znc/SSLVerifyHost.h>
|
||||
#include <znc/Translation.h>
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
#if defined(OPENSSL_VERSION_NUMBER) && !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100007
|
||||
@@ -432,6 +433,9 @@ static HostnameValidationResult validate_hostname(const char* hostname,
|
||||
|
||||
bool ZNC_SSLVerifyHost(const CString& sHost, const X509* pCert,
|
||||
CString& sError) {
|
||||
struct Tr : CCoreTranslationMixin {
|
||||
using CCoreTranslationMixin::t_s;
|
||||
};
|
||||
DEBUG("SSLVerifyHost: checking " << sHost);
|
||||
ZNC_iSECPartners::HostnameValidationResult eResult =
|
||||
ZNC_iSECPartners::validate_hostname(sHost.c_str(), pCert);
|
||||
@@ -441,15 +445,15 @@ bool ZNC_SSLVerifyHost(const CString& sHost, const X509* pCert,
|
||||
return true;
|
||||
case ZNC_iSECPartners::MatchNotFound:
|
||||
DEBUG("SSLVerifyHost: host doesn't match");
|
||||
sError = "hostname doesn't match";
|
||||
sError = Tr::t_s("hostname doesn't match");
|
||||
return false;
|
||||
case ZNC_iSECPartners::MalformedCertificate:
|
||||
DEBUG("SSLVerifyHost: malformed cert");
|
||||
sError = "malformed hostname in certificate";
|
||||
sError = Tr::t_s("malformed hostname in certificate");
|
||||
return false;
|
||||
default:
|
||||
DEBUG("SSLVerifyHost: error");
|
||||
sError = "hostname verification error";
|
||||
sError = Tr::t_s("hostname verification error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,16 +333,19 @@ void CSockManager::SetTDNSThreadFinished(TDNSTask* task, bool bBind,
|
||||
|
||||
try {
|
||||
if (ssTargets4.empty() && ssTargets6.empty()) {
|
||||
throw "Can't resolve server hostname";
|
||||
throw t_s("Can't resolve server hostname");
|
||||
} else if (task->sBindhost.empty()) {
|
||||
// Choose random target
|
||||
std::tie(sTargetHost, std::ignore) =
|
||||
RandomFrom2SetsWithBias(ssTargets4, ssTargets6, gen);
|
||||
} else if (ssBinds4.empty() && ssBinds6.empty()) {
|
||||
throw "Can't resolve bind hostname. Try /znc ClearBindHost and /znc ClearUserBindHost";
|
||||
throw t_s(
|
||||
"Can't resolve bind hostname. Try /znc ClearBindHost and /znc "
|
||||
"ClearUserBindHost");
|
||||
} else if (ssBinds4.empty()) {
|
||||
if (ssTargets6.empty()) {
|
||||
throw "Server address is IPv4-only, but bindhost is IPv6-only";
|
||||
throw t_s(
|
||||
"Server address is IPv4-only, but bindhost is IPv6-only");
|
||||
} else {
|
||||
// Choose random target and bindhost from IPv6-only sets
|
||||
sTargetHost = RandomFromSet(ssTargets6, gen);
|
||||
@@ -350,7 +353,8 @@ void CSockManager::SetTDNSThreadFinished(TDNSTask* task, bool bBind,
|
||||
}
|
||||
} else if (ssBinds6.empty()) {
|
||||
if (ssTargets4.empty()) {
|
||||
throw "Server address is IPv6-only, but bindhost is IPv4-only";
|
||||
throw t_s(
|
||||
"Server address is IPv6-only, but bindhost is IPv4-only");
|
||||
} else {
|
||||
// Choose random target and bindhost from IPv4-only sets
|
||||
sTargetHost = RandomFromSet(ssTargets4, gen);
|
||||
@@ -370,7 +374,7 @@ void CSockManager::SetTDNSThreadFinished(TDNSTask* task, bool bBind,
|
||||
<< "] using bindhost [" << sBindhost << "]");
|
||||
FinishConnect(sTargetHost, task->iPort, task->sSockName, task->iTimeout,
|
||||
task->bSSL, sBindhost, task->pcSock);
|
||||
} catch (const char* s) {
|
||||
} catch (const CString& s) {
|
||||
DEBUG(task->sSockName << ", dns resolving error: " << s);
|
||||
task->pcSock->SetSockName(task->sSockName);
|
||||
task->pcSock->SockError(-1, s);
|
||||
@@ -508,7 +512,7 @@ void CSocket::ReachedMaxBuffer() {
|
||||
DEBUG(GetSockName() << " == ReachedMaxBuffer()");
|
||||
if (m_pModule)
|
||||
m_pModule->PutModule(
|
||||
"Some socket reached its max buffer limit and was closed!");
|
||||
t_s("Some socket reached its max buffer limit and was closed!"));
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user