#include <znc/Utils.h>
#include <znc/Buffer.h>
#include <znc/Nick.h>
+#include <znc/Translation.h>
#include <set>
#include <vector>
class CUserTimer;
class CServer;
-class CUser {
+class CUser : private CCoreTranslationMixin {
public:
CUser(const CString& sUserName);
~CUser();
class CConfig;
class CFile;
-class CZNC {
+class CZNC : private CCoreTranslationMixin {
public:
CZNC();
~CZNC();
static void DumpConfig(const CConfig* Config);
private:
+ static CString FormatBindError();
+
CFile* InitPidFile();
bool ReadConfig(CConfig& config, CString& sError);
CIRCNetwork* CUser::AddNetwork(const CString& sNetwork, CString& sErrorRet) {
if (!CIRCNetwork::IsValidNetwork(sNetwork)) {
sErrorRet =
- "Invalid network name. It should be alphanumeric. Not to be "
- "confused with server name";
+ t_s("Invalid network name. It should be alphanumeric. Not to be "
+ "confused with server name");
return nullptr;
} else if (FindNetwork(sNetwork)) {
- sErrorRet = "Network [" + sNetwork.Token(0) + "] already exists";
+ sErrorRet = t_f("Network {1} already exists")(sNetwork);
return nullptr;
}
BounceAllClients();
}
- pClient->PutClient(":irc.znc.in 001 " + pClient->GetNick() +
- " :- Welcome to ZNC -");
+ pClient->PutClient(":irc.znc.in 001 " + pClient->GetNick() + " :" +
+ t_s("Welcome to ZNC"));
m_vClients.push_back(pClient);
}
for (CClient* pSock : m_vClients) {
if (!IsHostAllowed(pSock->GetRemoteIP())) {
pSock->PutStatusNotice(
- "You are being disconnected because your IP is no longer "
- "allowed to connect to this user");
+ t_s("You are being disconnected because your IP is no longer "
+ "allowed to connect to this user"));
pSock->Close();
}
}
sErrMsg.clear();
if (!bSkipPass && m_sPass.empty()) {
- sErrMsg = "Pass is empty";
+ sErrMsg = t_s("Password is empty");
return false;
}
if (m_sUserName.empty()) {
- sErrMsg = "Username is empty";
+ sErrMsg = t_s("Username is empty");
return false;
}
if (!CUser::IsValidUserName(m_sUserName)) {
- sErrMsg = "Username is invalid";
+ sErrMsg = t_s("Username is invalid");
return false;
}
CModInfo ModInfo;
if (!CZNC::Get().GetModules().GetModInfo(ModInfo, sModName, sModRet)) {
- sError = "Unable to find modinfo [" + sModName + "] [" + sModRet + "]";
+ sError = t_f("Unable to find modinfo {1}: {2}")(sModName, sModRet);
return false;
}
using std::tuple;
using std::make_tuple;
-static inline CString FormatBindError() {
- CString sError = (errno == 0 ? CString("unknown error, check the host name")
- : CString(strerror(errno)));
- return "Unable to bind [" + sError + "]";
-}
-
CZNC::CZNC()
: m_TimeStarted(time(nullptr)),
m_eConfigState(ECONFIG_NOTHING),
bool CZNC::AddUser(CUser* pUser, CString& sErrorRet, bool bStartup) {
if (FindUser(pUser->GetUserName()) != nullptr) {
- sErrorRet = "User already exists";
+ sErrorRet = t_s("User already exists");
DEBUG("User [" << pUser->GetUserName() << "] - already exists");
return false;
}
#ifndef HAVE_IPV6
if (ADDR_IPV6ONLY == eAddr) {
- sError = "IPV6 is not enabled";
+ sError = t_s("IPv6 is not enabled");
CUtils::PrintStatus(false, sError);
return false;
}
#ifndef HAVE_LIBSSL
if (bSSL) {
- sError = "SSL is not enabled";
+ sError = t_s("SSL is not enabled");
CUtils::PrintStatus(false, sError);
return false;
}
CString sPemFile = GetPemLocation();
if (bSSL && !CFile::Exists(sPemFile)) {
- sError = "Unable to locate pem file: [" + sPemFile + "]";
+ sError = t_f("Unable to locate pem file: {1}")(sPemFile);
CUtils::PrintStatus(false, sError);
// If stdin is e.g. /dev/null and we call GetBoolInput(),
}
#endif
if (!uPort) {
- sError = "Invalid port";
+ sError = t_s("Invalid port");
CUtils::PrintStatus(false, sError);
return false;
}
return false;
}
+CString CZNC::FormatBindError() {
+ CString sError = (errno == 0 ? t_s(("unknown error, check the host name"))
+ : CString(strerror(errno)));
+ return t_f("Unable to bind: {1}")(sError);
+}
+
static CZNC* s_pZNC = nullptr;
void CZNC::CreateInstance() {