Use fmt library for type safe formatting when calling eventlog()
This commit is contained in:
parent
34d5d3e4fb
commit
b245f6c6c9
126 changed files with 2229 additions and 2201 deletions
src
bnetd
account.cppaccount_wrap.cppadbanner.cppalias_command.cppanongame.cppanongame_infos.cppanongame_maplists.cppanongame_wol.cppattrgroup.cppattrlayer.cppautoupdate.cppchannel.cppcharacter.cppclan.cppcmdline.cppcommand.cppcommand_groups.cppconnection.cppfile.cppfile_cdb.cppfile_plain.cppgame.cppgame_conv.cpphandle_anongame.cpphandle_apireg.cpphandle_bnet.cpphandle_bot.cpphandle_d2cs.cpphandle_file.cpphandle_init.cpphandle_irc.cpphandle_irc_common.cpphandle_telnet.cpphandle_udp.cpphandle_wol.cpphandle_wol_gameres.cpphelpfile.cppi18n.cppicons.cppipban.cppirc.cppladder.cppladder_calc.cppluafunctions.cppluainterface.cppmail.cppmain.cppmessage.cppnews.cppoutput.cppprefs.cpprealm.cpprunprog.cppserver.cppsql_common.cppsql_dbcreator.cppsql_mysql.cppsql_odbc.cppsql_pgsql.cppsql_sqlite3.cppstorage.cppstorage_file.cppstorage_sql.cppsupport.cppteam.cpptick.cpptopic.cpptournament.cpptracker.cppudptest_send.cppuserlog.cppversioncheck.cppwatch.cpp
bntrackd
common
addr.cppbnethash.cppbnettime.cppconf.cppeventlog.cppeventlog.hfdwatch.cppfdwatch_epoll.cppfdwatch_kqueue.cppfdwatch_poll.cppfdwatch_select.cppformat.ccgive_up_root_privileges.cppgui_printf.cppgui_printf.hhashtable.cpplist.cppnetwork.cpppacket.cppqueue.cpprlimit.cppsetup_before.htag.cpptrans.cppxalloc.cpp
d2cs
|
@ -136,7 +136,7 @@ namespace pvpgn
|
|||
* indexed storage types check themselves if the username exists already
|
||||
* in the storage (see storage_sql.c) */
|
||||
if (accountlist_find_account(username)) {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "user \"%s\" already has an account", username);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "user \"{}\" already has an account", username);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ namespace pvpgn
|
|||
extern unsigned int account_get_uid_real(t_account const * account, char const * fn, unsigned int ln)
|
||||
{
|
||||
if (!account) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from {}:{})", fn, ln);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -269,12 +269,12 @@ namespace pvpgn
|
|||
extern char const * account_get_strattr_real(t_account * account, char const * key, char const * fn, unsigned int ln)
|
||||
{
|
||||
if (!account) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from {}:{})", fn, ln);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL key (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL key (from {}:{})", fn, ln);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ namespace pvpgn
|
|||
break;
|
||||
case 0:
|
||||
loaded = 1;
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "loaded %u user accounts in %ld seconds", count, std::time(NULL) - starttime);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "loaded {} user accounts in {} seconds", count, std::time(nullptr) - starttime);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -613,13 +613,13 @@ namespace pvpgn
|
|||
return NULL;
|
||||
}
|
||||
if (uid < 1) {
|
||||
ERROR2("got bad account (bad uid: %u) for \"%s\", fix it!", uid, username);
|
||||
ERROR2("got bad account (bad uid: {}) for \"{}\", fix it!", uid, username);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check whether the account limit was reached */
|
||||
if (!accountlist_allow_add()) {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "account limit reached (current is %u, storing %u)", prefs_get_max_accounts(), hashtable_get_length(accountlist_head));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "account limit reached (current is {}, storing {})", prefs_get_max_accounts(), hashtable_get_length(accountlist_head));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ namespace pvpgn
|
|||
curraccount = (t_account*)entry_get_data(curr);
|
||||
if (curraccount->uid == uid)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "BUG: user \"%s\":" UID_FORMAT " already has an account (\"%s\":" UID_FORMAT ")", username, uid, account_get_name(curraccount), curraccount->uid);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "BUG: user \"{}\":" UID_FORMAT " already has an account (\"{}\":" UID_FORMAT ")", username, uid, account_get_name(curraccount), curraccount->uid);
|
||||
hashtable_entry_release(curr);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ namespace pvpgn
|
|||
{
|
||||
if (strcasecmp(tname, username) == 0)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "BUG: user \"%s\":" UID_FORMAT " already has an account (\"%s\":" UID_FORMAT ")", username, uid, tname, curraccount->uid);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "BUG: user \"{}\":" UID_FORMAT " already has an account (\"{}\":" UID_FORMAT ")", username, uid, tname, curraccount->uid);
|
||||
hashtable_entry_release(curr);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ namespace pvpgn
|
|||
|
||||
if (!account)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from {}:{})", fn, ln);
|
||||
return NULL; /* FIXME: places assume this can't fail */
|
||||
}
|
||||
|
||||
|
|
|
@ -58,12 +58,12 @@ namespace pvpgn
|
|||
{
|
||||
if (account == nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from {}:{})", fn, ln);
|
||||
return 0;
|
||||
}
|
||||
if (key == nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL key (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL key (from {}:{})", fn, ln);
|
||||
return 0;
|
||||
}
|
||||
char const * temp = account_get_strattr(account, key);
|
||||
|
@ -73,7 +73,7 @@ namespace pvpgn
|
|||
unsigned int val;
|
||||
if (str_to_uint(temp, &val) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "not a numeric string \"%s\" for key \"%s\"", temp, key);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "not a numeric string \"{}\" for key \"{}\"", temp, key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -102,12 +102,12 @@ namespace pvpgn
|
|||
{
|
||||
if (account == nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from {}:{})", fn, ln);
|
||||
return -1;
|
||||
}
|
||||
if (key == nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL key (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL key (from {}:{})", fn, ln);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace pvpgn
|
|||
case 0:
|
||||
return 0;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad boolean value \"%s\" for key \"%s\"", temp, key);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad boolean value \"{}\" for key \"{}\"", temp, key);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -148,12 +148,12 @@ namespace pvpgn
|
|||
{
|
||||
if (account == nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from {}:{})", fn, ln);
|
||||
return nullptr;
|
||||
}
|
||||
if (key == nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL key (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL key (from {}:{})", fn, ln);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1671,11 +1671,11 @@ namespace pvpgn
|
|||
char const * charlist = account_get_closed_characterlist(account, clienttag, realmname);
|
||||
if (charlist == nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "no characters in Realm %s", realmname);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "no characters in Realm {}", realmname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "got characterlist \"%s\" for Realm %s", charlist, realmname);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "got characterlist \"{}\" for Realm {}", charlist, realmname);
|
||||
|
||||
size_t list_len = std::strlen(charlist);
|
||||
char const * start = charlist;
|
||||
|
@ -1694,7 +1694,7 @@ namespace pvpgn
|
|||
std::strncpy(tempname, start, name_len);
|
||||
tempname[name_len] = '\0';
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "found character \"%s\"", tempname);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "found character \"{}\"", tempname);
|
||||
|
||||
if (std::strcmp(tempname, charname) == 0)
|
||||
return 1;
|
||||
|
@ -1708,7 +1708,7 @@ namespace pvpgn
|
|||
std::strncpy(tempname, start, name_len);
|
||||
tempname[name_len] = '\0';
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "found tail character \"%s\"", tempname);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "found tail character \"{}\"", tempname);
|
||||
|
||||
if (std::strcmp(tempname, charname) == 0)
|
||||
return 1;
|
||||
|
@ -1739,7 +1739,7 @@ namespace pvpgn
|
|||
|
||||
std::string realmkey("BNET\\CharacterList\\" + tag_uint_to_str2(clienttag) + "\\" + std::string(realmname) + "\\0");
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "looking for '%s'", realmkey.c_str());
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "looking for '{}'", realmkey.c_str());
|
||||
|
||||
return account_get_strattr(account, realmkey.c_str());
|
||||
}
|
||||
|
@ -1765,7 +1765,7 @@ namespace pvpgn
|
|||
|
||||
std::string realmkey("BNET\\CharacterList\\" + tag_uint_to_str2(clienttag) + "\\" + realmname + "\\0");
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "looking for '%s'", realmkey.c_str());
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "looking for '{}'", realmkey.c_str());
|
||||
|
||||
return account_get_strattr(account, realmkey.c_str());
|
||||
}
|
||||
|
@ -1779,7 +1779,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "clienttag='%s', charlist='%s'", tag_uint_to_str2(clienttag).c_str(), charlist);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "clienttag='{}', charlist='{}'", tag_uint_to_str2(clienttag).c_str(), charlist);
|
||||
std::string key("BNET\\Characters\\" + tag_uint_to_str2(clienttag) + "\\0");
|
||||
|
||||
return account_set_strattr(account, key.c_str(), charlist);
|
||||
|
@ -1792,7 +1792,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "clienttag='%s', charlist='%s'", tag_uint_to_str2(clienttag).c_str(), charlist.c_str());
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "clienttag='{}', charlist='{}'", tag_uint_to_str2(clienttag).c_str(), charlist.c_str());
|
||||
std::string key("BNET\\Characters\\" + tag_uint_to_str2(clienttag) + "\\0");
|
||||
|
||||
return account_set_strattr(account, key.c_str(), charlist.c_str());
|
||||
|
@ -1812,7 +1812,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "clienttag=\"%s\", realm=\"%s\", name=\"%s\"", tag_uint_to_str2(clienttag).c_str(), ch->realmname, ch->name);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "clienttag=\"{}\", realm=\"{}\", name=\"{}\"", tag_uint_to_str2(clienttag).c_str(), ch->realmname, ch->name);
|
||||
std::string key("BNET\\CharacterList\\" + tag_uint_to_str2(clienttag) + "\\" + std::string(ch->realmname) + "\\0");
|
||||
|
||||
std::string chars_in_realm;
|
||||
|
@ -1822,7 +1822,7 @@ namespace pvpgn
|
|||
else
|
||||
chars_in_realm = std::string(ch->name);
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "new character list for realm \"%s\" is \"%s\"", ch->realmname, chars_in_realm.c_str());
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "new character list for realm \"{}\" is \"{}\"", ch->realmname, chars_in_realm.c_str());
|
||||
account_set_strattr(account, key.c_str(), chars_in_realm.c_str());
|
||||
|
||||
key = "BNET\\Characters\\" + tag_uint_to_str2(clienttag) + "\\" + std::string(ch->realmname) + "\\" + std::string(ch->name) + "\\0";
|
||||
|
@ -1853,7 +1853,7 @@ namespace pvpgn
|
|||
if (friendnum < 0 || friendnum >= prefs_get_max_friends())
|
||||
{
|
||||
// bogus name (user himself) instead of NULL, otherwise clients might crash
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid friendnum %d (max: %d)", friendnum, prefs_get_max_friends());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid friendnum {} (max: {})", friendnum, prefs_get_max_friends());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1868,7 +1868,7 @@ namespace pvpgn
|
|||
char const * name = account_get_strattr(account, key.c_str());
|
||||
if (!name)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not find friend (friendno: %d of '%s')", friendnum, account_get_name(account));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not find friend (friendno: {} of '{}')", friendnum, account_get_name(account));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1882,7 +1882,7 @@ namespace pvpgn
|
|||
return tmp;
|
||||
}
|
||||
account_set_strattr(account, key.c_str(), nullptr); //remove old username-based friend now
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "unexistant friend name ('%s') in old storage format", name);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "unexistant friend name ('{}') in old storage format", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1948,7 +1948,7 @@ namespace pvpgn
|
|||
int n = account_get_friendcount(account);
|
||||
if (friendnum < 0 || friendnum >= n)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid friendnum (friendnum: %d max: %d)", friendnum, n);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid friendnum (friendnum: {} max: {})", friendnum, n);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2046,7 +2046,7 @@ namespace pvpgn
|
|||
case W3_ICON_DEMONS:
|
||||
return "demons";
|
||||
default:
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "unknown race: %x", race);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "unknown race: {}", race);
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
@ -2112,7 +2112,7 @@ namespace pvpgn
|
|||
int mylevel = account_get_ladder_level(account, clienttag, id); //get accounts level
|
||||
if (mylevel > W3_XPCALC_MAXLEVEL)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid level: %d", mylevel);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid level: {}", mylevel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2130,7 +2130,7 @@ namespace pvpgn
|
|||
case game_result_loss:
|
||||
ladder_war3_xpdiff(opponlevel, mylevel, &placeholder, &xpdiff); break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid game result: %d", gameresult);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid game result: {}", gameresult);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2180,7 +2180,7 @@ namespace pvpgn
|
|||
|
||||
if (mylevel > W3_XPCALC_MAXLEVEL)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid level: %d", mylevel);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid level: {}", mylevel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2265,7 +2265,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
//added for better tracking down of problems with gameresults
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "parsing game result for player: %s result: %s", account_get_name(account), (result == game_result_win) ? "WIN" : "LOSS");
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "parsing game result for player: {} result: {}", account_get_name(account), (result == game_result_win) ? "WIN" : "LOSS");
|
||||
|
||||
unsigned int intrace = account_get_w3pgrace(account, clienttag);
|
||||
unsigned int uid = account_get_uid(account);
|
||||
|
@ -2299,7 +2299,7 @@ namespace pvpgn
|
|||
break;
|
||||
}
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Invalid Gametype? %u", gametype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Invalid Gametype? {}", gametype);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2382,7 +2382,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Checking for highest level in Solo,Team,FFA,AT Ladder Stats");
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Solo Level: %d, Team Level %d, FFA Level %d, Highest AT Team Level: %d", sololevel, teamlevel, ffalevel, atlevel);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Solo Level: {}, Team Level {}, FFA Level {}, Highest AT Team Level: {}", sololevel, teamlevel, ffalevel, atlevel);
|
||||
|
||||
if (sololevel >= teamlevel && sololevel >= atlevel && sololevel >= ffalevel)
|
||||
return sololevel;
|
||||
|
@ -2525,7 +2525,7 @@ namespace pvpgn
|
|||
if (clienttag == CLIENTTAG_WAR3XP_UINT)
|
||||
number_ctag = 6;
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "race -> %u; level -> %u; wins -> %u; profileicon -> %s", race, level, wins, profile_code[race + number_ctag][level]);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "race -> {}; level -> {}; wins -> {}; profileicon -> {}", race, level, wins, profile_code[race + number_ctag][level]);
|
||||
|
||||
return char_icon_to_uint(profile_code[race + number_ctag][level]);
|
||||
}
|
||||
|
@ -2563,19 +2563,19 @@ namespace pvpgn
|
|||
result = profile_code[5 + number_ctag][tmp_icon[0] - 1];
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got unrecognized race on [%s] icon ", icon);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got unrecognized race on [{}] icon ", icon);
|
||||
result = profile_code[2][0];
|
||||
} /* "opeo" */
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got race_level<1 on [%s] icon ", icon);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got race_level<1 on [{}] icon ", icon);
|
||||
result = nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid icon length [%s] icon ", icon);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid icon length [{}] icon ", icon);
|
||||
result = nullptr;
|
||||
}
|
||||
|
||||
|
@ -2693,7 +2693,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] WOL\\auth\\apgar = %s", apgar);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] WOL\\auth\\apgar = {}", apgar);
|
||||
return account_set_strattr(account, "WOL\\auth\\apgar", apgar);
|
||||
}
|
||||
extern int account_set_wol_apgar(t_account * account, std::string apgar)
|
||||
|
@ -2709,7 +2709,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] WOL\\auth\\apgar = %s", apgar.c_str());
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] WOL\\auth\\apgar = {}", apgar.c_str());
|
||||
return account_set_strattr(account, "WOL\\auth\\apgar", apgar.c_str());
|
||||
}
|
||||
|
||||
|
@ -2732,7 +2732,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] WOL\\acct\\locale = %u", locale);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] WOL\\acct\\locale = {}", locale);
|
||||
return account_set_numattr(account, "WOL\\acct\\locale", locale);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Could not load ad: %s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Could not load ad: {}", e.what());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ namespace pvpgn
|
|||
m_language(language)
|
||||
{
|
||||
char lang[5] = {};
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Created ad id=0x%08zu filename=\"%s\" link=\"%s\" client=\"%s\" lang=\"%s\"",
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Created ad id=0x{:08} filename=\"{}\" link=\"{}\" client=\"{}\" lang=\"{}\"",
|
||||
id, filename.c_str(), url.c_str(), clienttag ? clienttag_uint_to_str(clienttag) : "NULL",
|
||||
language ? tag_uint_to_str(lang, language) : "NULL");
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ namespace pvpgn
|
|||
}
|
||||
if (!(afp = std::fopen(filename, "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open alias file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open alias file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ namespace pvpgn
|
|||
case 0:
|
||||
if (buff[pos] != '@') /* not start of alias */
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected start of alias stanza on line %u of alias file \"%s\" but found \"%s\"", line, filename, &buff[pos]);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected start of alias stanza on line {} of alias file \"{}\" but found \"{}\"", line, filename, &buff[pos]);
|
||||
break;
|
||||
}
|
||||
inalias = 1;
|
||||
|
@ -404,7 +404,7 @@ namespace pvpgn
|
|||
min = max = 0;
|
||||
if (buff[pos] != '[')
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected output entry on line %u of alias file \"%s\" but found \"%s\"", line, filename, &buff[pos]);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected output entry on line {} of alias file \"{}\" but found \"{}\"", line, filename, &buff[pos]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ namespace pvpgn
|
|||
}
|
||||
}
|
||||
else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected output entry or next alias stanza on line %u of file \"%s\"i but found \"%s\"", line, filename, &buff[pos]);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected output entry or next alias stanza on line {} of file \"{}\"i but found \"{}\"", line, filename, &buff[pos]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace pvpgn
|
|||
case ANONGAME_TYPE_AT_2V2V2:
|
||||
return "AT 2v2v2";
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue number %d", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue number {}", queue);
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ namespace pvpgn
|
|||
case 11:
|
||||
return ANONGAME_TYPE_3V3V3V3;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid PG game type: %d", gametype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid PG game type: {}", gametype);
|
||||
return -1;
|
||||
}
|
||||
case 1: /* AT */
|
||||
|
@ -191,13 +191,13 @@ namespace pvpgn
|
|||
case 4:
|
||||
return ANONGAME_TYPE_AT_2V2V2;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid AT game type: %d", gametype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid AT game type: {}", gametype);
|
||||
return -1;
|
||||
}
|
||||
case 2: /* TY */
|
||||
return ANONGAME_TYPE_TY;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid type: %d", type);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid type: {}", type);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ namespace pvpgn
|
|||
case ANONGAME_TYPE_TY: /* set to ((wins * 3) + ties - losses) ie. prelim score */
|
||||
return tournament_get_player_score(conn_get_account(c));
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: %d", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: {}", queue);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ namespace pvpgn
|
|||
default_map = "Maps\\(8)PlainsOfSnow.w3m";
|
||||
break;
|
||||
default:
|
||||
ERROR1("invalid clienttag: %s", tag_uint_to_str(clienttag_str, clienttag));
|
||||
ERROR1("invalid clienttag: {}", tag_uint_to_str(clienttag_str, clienttag));
|
||||
return "Maps\\(8)PlainsOfSnow.w3m";
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ namespace pvpgn
|
|||
else
|
||||
selected = default_map;
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "got map %s from prefs", selected);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "got map {} from prefs", selected);
|
||||
return selected;
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ namespace pvpgn
|
|||
case ANONGAME_TYPE_TY:
|
||||
return SERVER_ANONGAME_TY_STR;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue (%d)", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue ({})", queue);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ namespace pvpgn
|
|||
case ANONGAME_TYPE_TY:
|
||||
return tournament_get_totalplayers();
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: %d", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: {}", queue);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ namespace pvpgn
|
|||
case ANONGAME_TYPE_TY:
|
||||
return 2; /* fixme: does not support 2v2v2 - tournament_get_totalteams() */
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: %d", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: {}", queue);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ namespace pvpgn
|
|||
|
||||
if (!(a = conn_get_anongame(c))) {
|
||||
if (!(a = conn_create_anongame(c))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] conn_create_anongame failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] conn_create_anongame failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -426,13 +426,13 @@ namespace pvpgn
|
|||
a->gametype = bn_byte_get(packet->u.client_findanongame.gametype);
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid search option (%d)", option);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid search option ({})", option);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (option != CLIENT_FINDANONGAME_AT_SEARCH)
|
||||
if ((a->queue = _anongame_gametype_to_queue(a->type, a->gametype)) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue: %d", a->queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue: {}", a->queue);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -456,14 +456,14 @@ namespace pvpgn
|
|||
case CLIENT_FINDANONGAME_AT_INVITER_SEARCH:
|
||||
for (i = 0; i < teamsize; i++) { /* assign player conns to tc[] array */
|
||||
if (!(tc[i] = _connlist_find_connection_by_uid(bn_int_get(packet->u.client_findanongame_at_inv.info[i])))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(tc[i]));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL connection", conn_get_socket(tc[i]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < teamsize; i++) { /* assign info from inviter to other team players */
|
||||
if (!(ta = conn_get_anongame(tc[i]))) {
|
||||
if (!(ta = conn_create_anongame(tc[i]))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] conn_create_anongame failed", conn_get_socket(tc[i]));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] conn_create_anongame failed", conn_get_socket(tc[i]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ namespace pvpgn
|
|||
case CLIENT_FINDANONGAME_AT_SEARCH:
|
||||
for (i = 0; i < teamsize; i++) { /* assign player conns to tc[] array */
|
||||
if (!(tc[i] = _connlist_find_connection_by_uid(bn_int_get(packet->u.client_findanongame_at.info[i])))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(tc[i]));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL connection", conn_get_socket(tc[i]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ namespace pvpgn
|
|||
a->tc[0] = c;
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid search option (%d)", option);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid search option ({})", option);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -529,7 +529,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (queue >= ANONGAME_TYPES) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: %d", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: {}", queue);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -822,7 +822,7 @@ namespace pvpgn
|
|||
int teams = 0;
|
||||
players[queue] = 0;
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] matching started for level %d player in queue %d", conn_get_socket(c), level, queue);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] matching started for level {} player in queue {}", conn_get_socket(c), level, queue);
|
||||
|
||||
diff = war3_get_maxleveldiff();
|
||||
maxlevel = level + diff;
|
||||
|
@ -830,7 +830,7 @@ namespace pvpgn
|
|||
|
||||
while (abs(delta) < (diff + 1)) {
|
||||
if ((level + delta <= maxlevel) && (level + delta >= minlevel)) {
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "Traversing level %d players", level + delta);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "Traversing level {} players", level + delta);
|
||||
|
||||
LIST_TRAVERSE(matchlists[queue][level + delta], curr) {
|
||||
md = (t_matchdata*)elem_get_data(curr);
|
||||
|
@ -903,7 +903,7 @@ namespace pvpgn
|
|||
break; /* cant really happen */
|
||||
|
||||
}
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] Matching finished, not enough players (found %d)", conn_get_socket(c), players[queue]);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] Matching finished, not enough players (found {})", conn_get_socket(c), players[queue]);
|
||||
mapname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1056,12 +1056,12 @@ namespace pvpgn
|
|||
t_matchdata *md;
|
||||
|
||||
if (queue < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got negative queue id (%d)", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got negative queue id ({})", queue);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (queue >= ANONGAME_TYPES) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: %d", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown queue: {}", queue);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1082,7 +1082,7 @@ namespace pvpgn
|
|||
LIST_TRAVERSE(matchlists[queue][i], curr) {
|
||||
md = (t_matchdata*)elem_get_data(curr);
|
||||
if (md->c == c) {
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "unqueued player [%d] level %d", conn_get_socket(c), i);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "unqueued player [{}] level {}", conn_get_socket(c), i);
|
||||
list_remove_elem(matchlists[queue][i], &curr);
|
||||
xfree(md);
|
||||
return 0;
|
||||
|
@ -1096,7 +1096,7 @@ namespace pvpgn
|
|||
* [Omega]
|
||||
*/
|
||||
if (anongame_arranged(queue) == 0) {
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] player not found in \"%s\" queue", conn_get_socket(c), _anongame_queue_to_string(queue));
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] player not found in \"{}\" queue", conn_get_socket(c), _anongame_queue_to_string(queue));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1150,13 +1150,13 @@ namespace pvpgn
|
|||
for (i = 0; i < anongame_get_totalplayers(anongame); i++) {
|
||||
if ((wins[i] > losses[i])) {
|
||||
if ((anoninfo->result[i] != W3_GAMERESULT_WIN)) {
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "player %d reported DISC/LOSS for self, but others agree on WIN", i + 1);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "player {} reported DISC/LOSS for self, but others agree on WIN", i + 1);
|
||||
anoninfo->result[i] = W3_GAMERESULT_WIN;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((anoninfo->result[i] != W3_GAMERESULT_LOSS)) {
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "player %d reported DISC/WIN for self, but others agree on LOSS", i + 1);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "player {} reported DISC/WIN for self, but others agree on LOSS", i + 1);
|
||||
anoninfo->result[i] = W3_GAMERESULT_LOSS;
|
||||
}
|
||||
}
|
||||
|
@ -1425,7 +1425,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (plnum < 0 || plnum > 7 || plnum >= a->info->totalplayers) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid plnum: %d", plnum);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid plnum: {}", plnum);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1535,7 +1535,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (a->playernum < 1 || a->playernum > ANONGAME_MAX_GAMECOUNT) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid playernum: %d", a->playernum);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid playernum: {}", a->playernum);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1554,7 +1554,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (a->playernum < 1 || a->playernum > ANONGAME_MAX_GAMECOUNT) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid playernum: %d", a->playernum);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid playernum: {}", a->playernum);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1622,19 +1622,19 @@ namespace pvpgn
|
|||
int tp, i;
|
||||
|
||||
if (!c) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL connection", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (!packet) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL packet", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (packet_get_class(packet) != packet_class_w3route) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad packet (class %d)", conn_get_socket(c), packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad packet (class {})", conn_get_socket(c), packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
if (conn_get_state(c) != conn_state_connected) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] not connected", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] not connected", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1642,25 +1642,25 @@ namespace pvpgn
|
|||
if (packet_get_type(packet) == CLIENT_W3ROUTE_REQ) {
|
||||
t_connection *oldc;
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] sizeof t_client_w3route_req %lu", conn_get_socket(c), sizeof(t_client_w3route_req));
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] sizeof t_client_w3route_req {}", conn_get_socket(c), sizeof(t_client_w3route_req));
|
||||
username = packet_get_str_const(packet, sizeof(t_client_w3route_req), MAX_USERNAME_LEN);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] got username '%s'", conn_get_socket(c), username);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] got username '{}'", conn_get_socket(c), username);
|
||||
gamec = connlist_find_connection_by_accountname(username);
|
||||
|
||||
if (!gamec) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] no game connection found for this w3route connection; closing", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] no game connection found for this w3route connection; closing", conn_get_socket(c));
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(a = conn_get_anongame(gamec))) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] no anongame struct for game connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] no anongame struct for game connection", conn_get_socket(c));
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bn_int_get((unsigned char const *)packet->u.data + sizeof(t_client_w3route_req)+std::strlen(username) + 2) != anongame_get_id(a)) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] client sent wrong id for user '%s', closing connection", conn_get_socket(c), username);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] client sent wrong id for user '{}', closing connection", conn_get_socket(c), username);
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1672,7 +1672,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (conn_set_routeconn(c, gamec) < 0 || conn_set_routeconn(gamec, c) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] conn_set_routeconn failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] conn_set_routeconn failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1688,7 +1688,7 @@ namespace pvpgn
|
|||
anongame_set_handle(a, bn_int_get(packet->u.client_w3route_req.handle));
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_w3route))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet_create failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet_create failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1717,12 +1717,12 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (!gamec) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] no game connection found for this w3route connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] no game connection found for this w3route connection", conn_get_socket(c));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] no anongame struct found for this w3route connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] no anongame struct found for this w3route connection", conn_get_socket(c));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1756,10 +1756,10 @@ namespace pvpgn
|
|||
else /* own result is always stored as first result */
|
||||
result = gameresult_get_player_result(gameresult, 0);
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] got W3ROUTE_GAMERESULT: %08x", conn_get_socket(c), result);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] got W3ROUTE_GAMERESULT: {:08}", conn_get_socket(c), result);
|
||||
|
||||
if (!inf) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] NULL anongameinfo", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] NULL anongameinfo", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1776,7 +1776,7 @@ namespace pvpgn
|
|||
if (ac) {
|
||||
/* 300 seconds or 5 minute timer */
|
||||
timerlist_add_timer(ac, now + (std::time_t) 300, conn_shutdown, data);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] started timer to close w3route", conn_get_socket(ac));
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] started timer to close w3route", conn_get_socket(ac));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1789,14 +1789,14 @@ namespace pvpgn
|
|||
for (i = 0; i < tp; i++)
|
||||
if (i + 1 != plnum && anongame_get_player(a, i))
|
||||
if (!conn_get_routeconn(anongame_get_player(a, i)) || !conn_get_anongame(anongame_get_player(a, i))) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] not all players have w3route connections up yet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] not all players have w3route connections up yet", conn_get_socket(c));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* handle these packets _after_ checking for routeconns of other players */
|
||||
switch (packet_get_type(packet)) {
|
||||
case CLIENT_W3ROUTE_LOADINGDONE:
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] got LOADINGDONE, playernum: %d", conn_get_socket(c), plnum);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] got LOADINGDONE, playernum: {}", conn_get_socket(c), plnum);
|
||||
|
||||
anongame_set_loaded(a, 1);
|
||||
|
||||
|
@ -1804,7 +1804,7 @@ namespace pvpgn
|
|||
if (!anongame_get_player(a, i)) /* ignore disconnected players */
|
||||
continue;
|
||||
if (!(rpacket = packet_create(packet_class_w3route))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet_create failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet_create failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
packet_set_size(rpacket, sizeof(t_server_w3route_loadingack));
|
||||
|
@ -1824,7 +1824,7 @@ namespace pvpgn
|
|||
continue;
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_w3route))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet_create failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet_create failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1838,11 +1838,11 @@ namespace pvpgn
|
|||
break;
|
||||
|
||||
case CLIENT_W3ROUTE_ABORT:
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] got W3ROUTE_ABORT", conn_get_socket(c));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] got W3ROUTE_ABORT", conn_get_socket(c));
|
||||
break;
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] default: got packet type: %04x", conn_get_socket(c), packet_get_type(packet));
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] default: got packet type: {:04}", conn_get_socket(c), packet_get_type(packet));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1865,15 +1865,15 @@ namespace pvpgn
|
|||
int i, j;
|
||||
|
||||
if (!c) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL connection", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (!(conn_get_routeconn(c))) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] no route connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] no route connection", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (!(a = conn_get_anongame(c))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] no anongame struct", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] no anongame struct", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1884,7 +1884,7 @@ namespace pvpgn
|
|||
/* wait till all players have w3route conns */
|
||||
for (i = 0; i < tp; i++)
|
||||
if (anongame_get_player(a, i) && (!conn_get_routeconn(anongame_get_player(a, i)) || !conn_get_anongame(anongame_get_player(a, i)) || !anongame_get_joined(conn_get_anongame(anongame_get_player(a, i))))) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] not all players have joined game BNet yet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] not all players have joined game BNet yet", conn_get_socket(c));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1898,15 +1898,15 @@ namespace pvpgn
|
|||
/* send a playerinfo packet for this player to each other player */
|
||||
for (i = 0; i < tp; i++) {
|
||||
if (i + 1 != anongame_get_playernum(ja)) {
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "i = %d", i);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "i = {}", i);
|
||||
|
||||
if (!(o = anongame_get_player(ja, i))) {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] player %d disconnected, ignoring", conn_get_socket(c), i);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] player {} disconnected, ignoring", conn_get_socket(c), i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_w3route))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet_create failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet_create failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1915,7 +1915,7 @@ namespace pvpgn
|
|||
|
||||
|
||||
if (!(oa = conn_get_anongame(o))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] no anongame struct of player %d", conn_get_socket(c), i);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] no anongame struct of player {}", conn_get_socket(c), i);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1960,7 +1960,7 @@ namespace pvpgn
|
|||
|
||||
/* levelinfo */
|
||||
if (!(rpacket = packet_create(packet_class_w3route))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet_create failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet_create failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2010,7 +2010,7 @@ namespace pvpgn
|
|||
|
||||
/* startgame1 */
|
||||
if (!(rpacket = packet_create(packet_class_w3route))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet_create failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet_create failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
packet_set_size(rpacket, sizeof(t_server_w3route_startgame1));
|
||||
|
@ -2020,7 +2020,7 @@ namespace pvpgn
|
|||
|
||||
/* startgame2 */
|
||||
if (!(rpacket = packet_create(packet_class_w3route))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet_create failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet_create failed", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
packet_set_size(rpacket, sizeof(t_server_w3route_startgame2));
|
||||
|
@ -2046,7 +2046,7 @@ namespace pvpgn
|
|||
default_map = "xgrinder.map";
|
||||
break;
|
||||
default:
|
||||
ERROR1("invalid clienttag: %s", tag_uint_to_str(clienttag_str, clienttag));
|
||||
ERROR1("invalid clienttag: {}", tag_uint_to_str(clienttag_str, clienttag));
|
||||
return "eb2.map";
|
||||
}
|
||||
|
||||
|
@ -2063,7 +2063,7 @@ namespace pvpgn
|
|||
else
|
||||
selected = default_map;
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "got map %s from prefs", selected);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "got map {} from prefs", selected);
|
||||
return selected;
|
||||
|
||||
}
|
||||
|
|
|
@ -413,7 +413,7 @@ namespace pvpgn
|
|||
|
||||
if (!(src))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL %s", errstr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL {}", errstr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ namespace pvpgn
|
|||
case ANONGAME_TYPE_TY:
|
||||
return tournament_get_format();
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue (%d)", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue ({})", queue);
|
||||
return NULL;
|
||||
}
|
||||
return anongame_infos_DESC_get_DESC(langID, member);
|
||||
|
@ -645,7 +645,7 @@ namespace pvpgn
|
|||
case ANONGAME_TYPE_TY:
|
||||
return tournament_get_sponsor();;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue (%d)", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue ({})", queue);
|
||||
return NULL;
|
||||
}
|
||||
return anongame_infos_DESC_get_DESC(langID, member);
|
||||
|
@ -725,7 +725,7 @@ namespace pvpgn
|
|||
case ANONGAME_TYPE_TY:
|
||||
return tournament_get_thumbs_down();
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue (%d)", queue);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid queue ({})", queue);
|
||||
return 1;
|
||||
}
|
||||
return anongame_infos->anongame_infos_THUMBSDOWN[member];
|
||||
|
@ -1281,7 +1281,7 @@ namespace pvpgn
|
|||
return parse_DESC;
|
||||
}
|
||||
else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid section name: %s", text);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid section name: {}", text);
|
||||
return parse_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp = std::fopen(filename, "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, "anongameinfo_load", "could not open file \"%s\" for reading (std::fopen: %s), using default values", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, "anongameinfo_load", "could not open file \"{}\" for reading (std::fopen: {}), using default values", filename, std::strerror(errno));
|
||||
goto anongame_infos_loading_failure;
|
||||
}
|
||||
|
||||
|
@ -1374,7 +1374,7 @@ namespace pvpgn
|
|||
{
|
||||
if ((buff[0] != '[') || (buff[std::strlen(buff) - 1] != ']'))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected [] section start, but found %s on line %u", buff, line);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected [] section start, but found {} on line {}", buff, line);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1413,7 +1413,7 @@ namespace pvpgn
|
|||
{
|
||||
anongame_infos_DESC = anongame_infos_DESC_init();
|
||||
parse_state = unchanged;
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "got langID: [%s]", langID);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "got langID: [{}]", langID);
|
||||
if (langID[0] != '\0')
|
||||
anongame_infos_DESC->langID = xstrdup(langID);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace pvpgn
|
|||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__,
|
||||
"cannot add map \"%s\" for gametype: %s (maxmaps per qametype: %d)",
|
||||
"cannot add map \"{}\" for gametype: {} (maxmaps per qametype: {})",
|
||||
mapname, _maplists_queue_get_type(queue), MAXMAPS_PER_QUEUE);
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ namespace pvpgn
|
|||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__,
|
||||
"cannot add map \"%s\" for gametype: %s (maxmaps per qametype: %d)",
|
||||
"cannot add map \"{}\" for gametype: {} (maxmaps per qametype: {})",
|
||||
mapname, _maplists_queue_get_type(queue), MAXMAPS_PER_QUEUE);
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ namespace pvpgn
|
|||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__,
|
||||
"cannot add map \"%s\" for gametype: %s (maxmaps per qametype: %d)",
|
||||
"cannot add map \"{}\" for gametype: {} (maxmaps per qametype: {})",
|
||||
mapname, _maplists_queue_get_type(queue), MAXMAPS_PER_QUEUE);
|
||||
}
|
||||
}
|
||||
|
@ -181,12 +181,12 @@ namespace pvpgn
|
|||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__,
|
||||
"cannot add map \"%s\" for gametype: %s (maxmaps per qametype: %d)",
|
||||
"cannot add map \"{}\" for gametype: {} (maxmaps per qametype: {})",
|
||||
mapname, _maplists_queue_get_type(queue), MAXMAPS_PER_QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
else eventlog(eventlog_level_error, __FUNCTION__, "invalid clienttag: %s", tag_uint_to_str(clienttag_str, clienttag));
|
||||
else eventlog(eventlog_level_error, __FUNCTION__, "invalid clienttag: {}", tag_uint_to_str(clienttag_str, clienttag));
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
||||
|
@ -203,7 +203,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if ((mapfd = std::fopen(prefs_get_mapsfile(), "rt")) == NULL) {
|
||||
eventlog(eventlog_level_error, "anongame_maplists_create", "could not open mapsfile : \"%s\"", prefs_get_mapsfile());
|
||||
eventlog(eventlog_level_error, "anongame_maplists_create", "could not open mapsfile : \"{}\"", prefs_get_mapsfile());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace pvpgn
|
|||
|
||||
list_append_data(anongame_wol_matchlist_head, player);
|
||||
|
||||
DEBUG1("[** WOL **] annongame player created: %s", conn_get_chatname(conn));
|
||||
DEBUG1("[** WOL **] annongame player created: {}", conn_get_chatname(conn));
|
||||
|
||||
return player;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ namespace pvpgn
|
|||
std::string data(":matchbot!u@h " + std::string(command) + " " + std::string(nick) + " " + std::string(text));
|
||||
data.erase(MAX_IRC_MESSAGE_LEN, std::string::npos);
|
||||
|
||||
DEBUG2("[%d] sent \"%s\"", conn_get_socket(conn), data.c_str());
|
||||
DEBUG2("[{}] sent \"{}\"", conn_get_socket(conn), data.c_str());
|
||||
data.append("\r\n");
|
||||
packet_set_size(p, 0);
|
||||
packet_append_data(p, data.c_str(), data.length());
|
||||
|
@ -424,7 +424,7 @@ namespace pvpgn
|
|||
_send_msg(conn_pl2, "PRIVMSG", temp);
|
||||
}
|
||||
else
|
||||
ERROR1("undefined channel type for %s channel", channelname);
|
||||
ERROR1("undefined channel type for {} channel", channelname);
|
||||
}
|
||||
return 0;
|
||||
case CLIENTTAG_YURISREV_UINT: {
|
||||
|
@ -488,7 +488,7 @@ namespace pvpgn
|
|||
_send_msg(conn_pl2, "PRIVMSG", temp);
|
||||
}
|
||||
else
|
||||
ERROR1("undefined channel type for %s channel", channelname);
|
||||
ERROR1("undefined channel type for {} channel", channelname);
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
|
@ -562,7 +562,7 @@ namespace pvpgn
|
|||
if (param)
|
||||
*param++ = '\0';
|
||||
if (anongame_wol_set_playersetting(player, tag, param) == -1)
|
||||
WARN2("[** WOL **] got unknown tag %s param %s", tag, param);
|
||||
WARN2("[** WOL **] got unknown tag {} param {}", tag, param);
|
||||
temp = p;
|
||||
}
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ namespace pvpgn
|
|||
anongame_wol_trystart(player);
|
||||
}
|
||||
else {
|
||||
DEBUG1("[** WOL **] got line /%s/", text);
|
||||
DEBUG1("[** WOL **] got line /{}/", text);
|
||||
}
|
||||
|
||||
if (line)
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace pvpgn
|
|||
|
||||
stmp = storage->create_account(name);
|
||||
if (!stmp) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "failed to add user '%s' to storage", name);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "failed to add user '{}' to storage", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace pvpgn
|
|||
|
||||
loopout:
|
||||
if (fcount > 0)
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "flushed %u user accounts", fcount);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "flushed {} user accounts", fcount);
|
||||
|
||||
if (!FLAG_ISSET(flags, FS_ALL) && curr != &loadedlist) return 1;
|
||||
|
||||
|
@ -162,7 +162,7 @@ namespace pvpgn
|
|||
|
||||
loopout:
|
||||
if (scount > 0)
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "saved %u user accounts", scount);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "saved {} user accounts", scount);
|
||||
|
||||
if (!FLAG_ISSET(flags, FS_ALL) && curr != &dirtylist) return 1;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (!(fp = std::fopen(filename, "r"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -99,23 +99,23 @@ namespace pvpgn
|
|||
|
||||
/* FIXME: use next_token instead of std::strtok */
|
||||
if (!(archtag = std::strtok(buff, " \t"))) { /* std::strtok modifies the string it is passed */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing archtag on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing archtag on line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(clienttag = std::strtok(NULL, " \t"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing clienttag on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing clienttag on line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(versiontag = std::strtok(NULL, " \t"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing versiontag on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing versiontag on line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(updatefile = std::strtok(NULL, " \t"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing updatefile on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing updatefile on line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if ((!(path = std::strtok(NULL, " \t"))) && tag_check_wolv1(tag_str_to_uint(clienttag)) && tag_check_wolv2(tag_str_to_uint(clienttag))) { /* Only in WOL is needed to have path */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing path on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing path on line {} of file \"{}\"", line, filename);
|
||||
}
|
||||
|
||||
entry = (t_autoupdate*)xmalloc(sizeof(t_autoupdate));
|
||||
|
@ -137,7 +137,7 @@ namespace pvpgn
|
|||
else
|
||||
entry->path = NULL;
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "update '%s' version '%s' with file %s", clienttag, versiontag, updatefile);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "update '{}' version '{}' with file {}", clienttag, versiontag, updatefile);
|
||||
|
||||
list_append_data(autoupdate_head, entry);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace pvpgn
|
|||
{
|
||||
if ((channel_get_clienttag(channel)) && (clienttag) && (channel_get_clienttag(channel) == clienttag))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create duplicate permanent channel (fullname \"%s\")", fullname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create duplicate permanent channel (fullname \"{}\")", fullname);
|
||||
return NULL;
|
||||
}
|
||||
else if (((channel->flags & channel_flags_allowbots) != (botflag ? channel_flags_allowbots : 0)) ||
|
||||
|
@ -101,7 +101,7 @@ namespace pvpgn
|
|||
((channel->flags & channel_flags_moderated) != (moderated ? channel_flags_moderated : 0)) ||
|
||||
(channel->logname && logflag == 0) || (!(channel->logname) && logflag == 1))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "channel parameters do not match for \"%s\" and \"%s\"", fullname, channel->name);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "channel parameters do not match for \"{}\" and \"{}\"", fullname, channel->name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ namespace pvpgn
|
|||
|| !strcasecmp(shortname, CHANNEL_NAME_BANNED)))
|
||||
channel->flags |= channel_flags_thevoid;
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "creating new channel \"%s\" shortname=%s%s%s clienttag=%s%s%s country=%s%s%s realm=%s%s%s", fullname,
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "creating new channel \"{}\" shortname={}{}{} clienttag={}{}{} country={}{}{} realm={}{}{}", fullname,
|
||||
shortname ? "\"" : "(", /* all this is doing is printing the name in quotes else "none" in parens */
|
||||
shortname ? shortname : "none",
|
||||
shortname ? "\"" : ")",
|
||||
|
@ -199,7 +199,7 @@ namespace pvpgn
|
|||
std::sprintf(channel->logname, "%s/chanlog-%s-%06u", prefs_get_chanlogdir(), dstr, channel->id);
|
||||
|
||||
if (!(channel->log = std::fopen(channel->logname, "w")))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open channel log \"%s\" for writing (std::fopen: %s)", channel->logname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open channel log \"{}\" for writing (std::fopen: {})", channel->logname, std::strerror(errno));
|
||||
else
|
||||
{
|
||||
std::fprintf(channel->log, "name=\"%s\"\n", channel->name);
|
||||
|
@ -270,7 +270,7 @@ namespace pvpgn
|
|||
// return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "destroying channel \"%s\"", channel->name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "destroying channel \"{}\"", channel->name);
|
||||
|
||||
if (channel->gameExtension)
|
||||
xfree(channel->gameExtension);
|
||||
|
@ -302,7 +302,7 @@ namespace pvpgn
|
|||
std::fprintf(channel->log, "\ndestroyed=\"%s\"\n", timetemp);
|
||||
|
||||
if (std::fclose(channel->log) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close channel log \"%s\" after writing (std::fclose: %s)", channel->logname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close channel log \"{}\" after writing (std::fclose: {})", channel->logname, std::strerror(errno));
|
||||
}
|
||||
|
||||
if (channel->logname)
|
||||
|
@ -539,7 +539,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] connection not in channel member list", conn_get_socket(connection));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] connection not in channel member list", conn_get_socket(connection));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp = std::fopen(filename, "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open channel file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open channel file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -980,52 +980,52 @@ namespace pvpgn
|
|||
pos = 0;
|
||||
if (!(name = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing name in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing name in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(sname = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing sname in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing sname in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(tag = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing tag in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing tag in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(bot = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing bot in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing bot in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(oper = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing oper in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing oper in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(log = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing log in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing log in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(country = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing country in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing country in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(realmname = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing realmname in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing realmname in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(max = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing max in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing max in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(moderated = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing mod in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing mod in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1038,7 +1038,7 @@ namespace pvpgn
|
|||
botflag = 0;
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value \"%s\" for field 4 on line %u in file \"%s\"", bot, line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value \"{}\" for field 4 on line {} in file \"{}\"", bot, line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ namespace pvpgn
|
|||
operflag = 0;
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value \"%s\" for field 5 on line %u in file \"%s\"", oper, line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value \"{}\" for field 5 on line {} in file \"{}\"", oper, line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ namespace pvpgn
|
|||
logflag = 0;
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value \"%s\" for field 5 on line %u in file \"%s\"", log, line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value \"{}\" for field 5 on line {} in file \"{}\"", log, line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ namespace pvpgn
|
|||
modflag = 0;
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value \"%s\" for field 10 on line %u in file \"%s\"", moderated, line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value \"{}\" for field 10 on line {} in file \"{}\"", moderated, line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1120,7 +1120,7 @@ namespace pvpgn
|
|||
|
||||
file_get_line(NULL); // clear file_get_line buffer
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close channel file \"%s\" after reading (std::fclose: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close channel file \"{}\" after reading (std::fclose: {})", filename, std::strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1488,7 +1488,7 @@ namespace pvpgn
|
|||
{
|
||||
if (channel->maxmembers == -1 || channel->currmembers < channel->maxmembers)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "found permanent channel \"%s\" for \"%s\"", channel->name, name);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "found permanent channel \"{}\" for \"{}\"", channel->name, name);
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
@ -1552,12 +1552,12 @@ namespace pvpgn
|
|||
channel = channel_create(channelname, saveshortname, savetag, 1, savebotflag, saveoperflag, savelogflag, savecountry, saverealmname, savemaxmembers, savemoderated, 0, 1);
|
||||
xfree(channelname);
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "created copy \"%s\" of channel \"%s\"", (channel) ? (channel->name) : ("<failed>"), name);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "created copy \"{}\" of channel \"{}\"", (channel) ? (channel->name) : ("<failed>"), name);
|
||||
return channel;
|
||||
}
|
||||
|
||||
/* no match */
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "could not find channel \"%s\"", name);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "could not find channel \"{}\"", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ namespace pvpgn
|
|||
{
|
||||
char const * data_in_hex;
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Initial Data for %s, %s %s",
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Initial Data for {}, {} {}",
|
||||
character->name,
|
||||
character_expansion_to_expansionname(expansion),
|
||||
character_class_to_classname(chclass));
|
||||
|
@ -287,7 +287,7 @@ namespace pvpgn
|
|||
|
||||
if (account_check_closed_character(account, clienttag, realmname, name))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "a character with the name \"%s\" does already exist in realm \"%s\"", name, realmname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "a character with the name \"{}\" does already exist in realm \"{}\"", name, realmname);
|
||||
xfree((void *)ch->realmname); /* avoid warning */
|
||||
xfree((void *)ch->name); /* avoid warning */
|
||||
xfree(ch);
|
||||
|
@ -432,7 +432,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!tok2)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad character list \"%s\"", temp);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad character list \"{}\"", temp);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
offset = sizeof(packet->u.client_clan_motdchg);
|
||||
motd = packet_get_str_const(packet, offset, CLAN_MOTD_MAX);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] got W3XP_CLAN_MOTDCHG packet : %s", conn_get_socket(c), motd);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] got W3XP_CLAN_MOTDCHG packet : {}", conn_get_socket(c), motd);
|
||||
if (clan_set_motd(clan, motd) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Failed to set clan motd.");
|
||||
|
@ -831,7 +831,7 @@ namespace pvpgn
|
|||
eventlog(eventlog_level_error, __FUNCTION__, "found NULL entry in list");
|
||||
continue;
|
||||
}
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "trace %d", clan->clanid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "trace {}", clan->clanid);
|
||||
if (clan->created && (clan->clanid == cid))
|
||||
return clan;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#endif
|
||||
#ifdef WIN32_GUI
|
||||
# include "common/gui_printf.h"
|
||||
# define printf gui_printf
|
||||
# define printf gui_lvprintf
|
||||
#endif
|
||||
#include "compat/strcasecmp.h"
|
||||
#include "common/eventlog.h"
|
||||
|
@ -255,7 +255,7 @@ namespace pvpgn
|
|||
|
||||
conf_set_bool(&tmp, valstr, 0);
|
||||
if (tmp) {
|
||||
printf(PVPGN_SOFTWARE" version " PVPGN_VERSION "\n");
|
||||
printf(eventlog_level_info, PVPGN_SOFTWARE" version " PVPGN_VERSION "\n");
|
||||
exitflag = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -619,7 +619,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
message_send_text(c, message_type_error, c, localize(c, "Unknown command."));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "got unknown command \"%s\"", text);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "got unknown command \"{}\"", text);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -774,7 +774,7 @@ namespace pvpgn
|
|||
msgtemp = localize(c, "You are now a clan member of {}", clan_get_name(clan));
|
||||
message_send_text(c, message_type_info, c, msgtemp);
|
||||
if (created > 0) {
|
||||
DEBUG1("clan %s has already been created", clan_get_name(clan));
|
||||
DEBUG1("clan {} has already been created", clan_get_name(clan));
|
||||
return -1;
|
||||
}
|
||||
created++;
|
||||
|
@ -3158,13 +3158,13 @@ namespace pvpgn
|
|||
temp = accountlist_create_account(username, hash_get_str(passhash));
|
||||
if (!temp) {
|
||||
message_send_text(c, message_type_error, c, localize(c, "Failed to create account!"));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] account \"%s\" not created (failed)", conn_get_socket(c), username);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] account \"{}\" not created (failed)", conn_get_socket(c), username);
|
||||
return -1;
|
||||
}
|
||||
|
||||
msgtemp = localize(c, "Account {} created.", account_get_uid(temp));
|
||||
message_send_text(c, message_type_info, c, msgtemp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] account \"%s\" created", conn_get_socket(c), username);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] account \"{}\" created", conn_get_socket(c), username);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3204,7 +3204,7 @@ namespace pvpgn
|
|||
if ((temp == account && account_get_auth_changepass(account) == 0) || /* default to true */
|
||||
(temp != account && !(account_get_command_groups(conn_get_account(c)) & command_get_group("/admin-chpass")))) /* default to false */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] password change for \"%s\" refused (no change access)", conn_get_socket(c), username);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] password change for \"{}\" refused (no change access)", conn_get_socket(c), username);
|
||||
message_send_text(c, message_type_error, c, localize(c, "Only admins may change passwords for other accounts."));
|
||||
return -1;
|
||||
}
|
||||
|
@ -3547,7 +3547,7 @@ namespace pvpgn
|
|||
static int _handle_quit_command(t_connection * c, char const *text)
|
||||
{
|
||||
if (conn_get_game(c))
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] user '%s' tried to disconnect while in game, cheat attempt ?", conn_get_socket(c), conn_get_loggeduser(c));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] user '{}' tried to disconnect while in game, cheat attempt ?", conn_get_socket(c), conn_get_loggeduser(c));
|
||||
else {
|
||||
message_send_text(c, message_type_info, c, localize(c, "Connection closed."));
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
|
@ -4660,7 +4660,7 @@ namespace pvpgn
|
|||
msgtemp = localize(c, "Key set successfully for");
|
||||
msgtemp += msgtemp0;
|
||||
message_send_text(c, message_type_error, c, msgtemp);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "Key set by \"%s\" for%s", account_get_name(conn_get_account(c)),msgtemp0);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "Key set by \"{}\" for {}", account_get_name(conn_get_account(c)),msgtemp0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -4676,11 +4676,11 @@ namespace pvpgn
|
|||
{
|
||||
message_send_file(c, fp);
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close motd file \"%s\" after reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close motd file \"{}\" after reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open motd file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open motd file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
message_send_text(c, message_type_error, c, localize(c, "Unable to open motd."));
|
||||
}
|
||||
return 0;
|
||||
|
@ -4737,11 +4737,11 @@ namespace pvpgn
|
|||
|
||||
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close tos file \"%s\" after reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close tos file \"{}\" after reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open tos file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open tos file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
message_send_text(c, message_type_error, c, localize(c, "Unable to send TOS (Terms of Service)."));
|
||||
}
|
||||
return 0;
|
||||
|
@ -4936,7 +4936,7 @@ namespace pvpgn
|
|||
oldflags = channel_get_flags(channel);
|
||||
|
||||
if (channel_set_flags(channel, oldflags ^ channel_flags_moderated)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set channel %s flags", channel_get_name(channel));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set channel {} flags", channel_get_name(channel));
|
||||
message_send_text(c, message_type_error, c, localize(c, "Unable to change channel flags."));
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
if (!(fp = std::fopen(filename, "r"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -75,15 +75,15 @@ namespace pvpgn
|
|||
buff[endpos + 1] = '\0';
|
||||
}
|
||||
if (!(temp = std::strtok(buff, " \t"))) { /* std::strtok modifies the string it is passed */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing group on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing group on line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (str_to_uint(temp, &group)<0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "group '%s' not a valid group (1-8)", temp);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "group '{}' not a valid group (1-8)", temp);
|
||||
continue;
|
||||
}
|
||||
if (group == 0 || group > 8) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "group '%u' not within groups limits (1-8)", group);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "group '{}' not within groups limits (1-8)", group);
|
||||
continue;
|
||||
}
|
||||
while ((command = std::strtok(NULL, " \t"))) {
|
||||
|
@ -92,7 +92,7 @@ namespace pvpgn
|
|||
entry->command = xstrdup(command);
|
||||
list_append_data(command_groups_head, entry);
|
||||
#ifdef COMMANDGROUPSDEBUG
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Added command: %s - with group %u", entry->command, entry->group);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Added command: {} - with group {}", entry->command, entry->group);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,11 +133,11 @@ namespace pvpgn
|
|||
if (fp = std::fopen(lang_filename, "r")) {
|
||||
message_send_file(c, fp);
|
||||
if (std::fclose(fp) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close MOTD file \"%s\" after reading (std::fopen: %s)", lang_filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close MOTD file \"{}\" after reading (std::fopen: {})", lang_filename, std::strerror(errno));
|
||||
}
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open MOTD file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open MOTD file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
}
|
||||
|
||||
xfree((void*)lang_filename);
|
||||
|
@ -162,10 +162,10 @@ namespace pvpgn
|
|||
{
|
||||
message_send_file(c, fp);
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close issue file \"%s\" after reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close issue file \"{}\" after reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
}
|
||||
else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open issue file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open issue file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
else
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "no issue file");
|
||||
}
|
||||
|
@ -181,11 +181,11 @@ namespace pvpgn
|
|||
|
||||
if (now == (std::time_t)0) /* zero means user logged out before expiration */
|
||||
{
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] connection already closed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] connection already closed", conn_get_socket(c));
|
||||
return;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] closing connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] closing connection", conn_get_socket(c));
|
||||
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ namespace pvpgn
|
|||
* connection. In other words we just don't care :)
|
||||
*/
|
||||
if (conn_get_ircping(c) != 0) {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] ping timeout (closing connection)", conn_get_socket(c));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] ping timeout (closing connection)", conn_get_socket(c));
|
||||
conn_set_latency(c, 0);
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ namespace pvpgn
|
|||
}
|
||||
else if (conn_get_class(c) == conn_class_w3route) {
|
||||
if (!(packet = packet_create(packet_class_w3route))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet_create failed", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet_create failed", conn_get_socket(c));
|
||||
}
|
||||
else {
|
||||
packet_set_size(packet, sizeof(t_server_w3route_echoreq));
|
||||
|
@ -351,12 +351,12 @@ namespace pvpgn
|
|||
|
||||
if (tsock < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad TCP socket %d", tsock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad TCP socket {}", tsock);
|
||||
return NULL;
|
||||
}
|
||||
if (usock < -1) /* -1 is allowed for some connection classes like bot, irc, and telnet */
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad UDP socket %d", usock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad UDP socket {}", usock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,7 @@ namespace pvpgn
|
|||
|
||||
list_prepend_data(conn_head, temp);
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d][%d] sessionkey=0x%08x sessionnum=0x%08x", temp->socket.tcp_sock, temp->socket.udp_sock, temp->protocol.sessionkey, temp->protocol.sessionnum);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}][{}] sessionkey=0x{:08} sessionnum=0x{:08}", temp->socket.tcp_sock, temp->socket.udp_sock, temp->protocol.sessionkey, temp->protocol.sessionnum);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!c->protocol.chat.ignore_list)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found NULL ignore_list with ignore_count=%u", c->protocol.chat.ignore_count);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found NULL ignore_list with ignore_count={}", c->protocol.chat.ignore_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -685,7 +685,7 @@ namespace pvpgn
|
|||
|
||||
if (c->protocol.account)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] \"%s\" logged out", c->socket.tcp_sock, conn_get_loggeduser(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] \"{}\" logged out", c->socket.tcp_sock, conn_get_loggeduser(c));
|
||||
//amadeo
|
||||
#ifdef WIN32_GUI
|
||||
guiOnUpdateUserList();
|
||||
|
@ -732,7 +732,7 @@ namespace pvpgn
|
|||
if (conn_dead) list_remove_data(conn_dead, c, (conn_or_dead_list) ? elem : &curr);
|
||||
connarray_del_conn(c->protocol.sessionnum);
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] closed %s connection", c->socket.tcp_sock, classstr);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] closed {} connection", c->socket.tcp_sock, classstr);
|
||||
|
||||
xfree(c);
|
||||
}
|
||||
|
@ -1232,7 +1232,7 @@ namespace pvpgn
|
|||
return;
|
||||
}
|
||||
if (c->protocol.client.archtag != archtag)
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] setting client arch to \"%s\"", conn_get_socket(c), tag_uint_to_str(archtag_str, archtag));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] setting client arch to \"{}\"", conn_get_socket(c), tag_uint_to_str(archtag_str, archtag));
|
||||
|
||||
c->protocol.client.archtag = archtag;
|
||||
}
|
||||
|
@ -1266,7 +1266,7 @@ namespace pvpgn
|
|||
return;
|
||||
}
|
||||
if (c->protocol.client.gamelang != gamelang)
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] setting client gamelang to \"%s\"", conn_get_socket(c), tag_uint_to_str(gamelang_str, gamelang));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] setting client gamelang to \"{}\"", conn_get_socket(c), tag_uint_to_str(gamelang_str, gamelang));
|
||||
|
||||
c->protocol.client.gamelang = gamelang;
|
||||
}
|
||||
|
@ -1314,11 +1314,11 @@ namespace pvpgn
|
|||
return;
|
||||
}
|
||||
if (!tag_check_client(clienttag)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got UNKNOWN clienttag \"%s\"", tag_uint_to_str(clienttag_str, clienttag));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got UNKNOWN clienttag \"{}\"", tag_uint_to_str(clienttag_str, clienttag));
|
||||
return;
|
||||
}
|
||||
if (c->protocol.client.clienttag != clienttag) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] setting client type to \"%s\"", conn_get_socket(c), tag_uint_to_str(clienttag_str, clienttag));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] setting client type to \"{}\"", conn_get_socket(c), tag_uint_to_str(clienttag_str, clienttag));
|
||||
c->protocol.client.clienttag = clienttag;
|
||||
if (c->protocol.chat.channel)
|
||||
channel_update_userflags(c);
|
||||
|
@ -1444,7 +1444,7 @@ namespace pvpgn
|
|||
|
||||
if ((other = connlist_find_connection_by_accountname((tname = account_get_name(account)))))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] forcing logout of previous login for \"%s\"", conn_get_socket(c), tname);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] forcing logout of previous login for \"{}\"", conn_get_socket(c), tname);
|
||||
conn_set_state(other, conn_state_destroy);
|
||||
}
|
||||
|
||||
|
@ -1547,7 +1547,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{ //theoretically this should never happen...
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid numeric uid \"%s\"", username);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid numeric uid \"{}\"", username);
|
||||
// set value that would have been set prior to this bugfix...
|
||||
temp = xstrdup(username);
|
||||
}
|
||||
|
@ -2004,7 +2004,7 @@ namespace pvpgn
|
|||
channel = channel_create(channelname, channelname, 0, 0, 1, 1, prefs_get_chanlog(), NULL, NULL, (prefs_get_maxusers_per_channel() > 0) ? prefs_get_maxusers_per_channel() : -1, 0, 0, 0);
|
||||
if (!channel)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create channel on join \"%s\"", conn_get_socket(c), channelname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create channel on join \"{}\"", conn_get_socket(c), channelname);
|
||||
return -1;
|
||||
}
|
||||
created = 1;
|
||||
|
@ -2020,7 +2020,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] joined channel \"%s\"", conn_get_socket(c), channel_get_name(c->protocol.chat.channel));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] joined channel \"{}\"", conn_get_socket(c), channel_get_name(c->protocol.chat.channel));
|
||||
conn_send_welcome(c);
|
||||
|
||||
if (c->protocol.chat.channel && (channel_get_flags(c->protocol.chat.channel) & channel_flags_thevoid))
|
||||
|
@ -2134,7 +2134,7 @@ namespace pvpgn
|
|||
if (c->protocol.game) {
|
||||
if (gamename) {
|
||||
if (strcasecmp(gamename, game_get_name(c->protocol.game)))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] tried to join a new game \"%s\" while already in a game \"%s\"!", conn_get_socket(c), gamename, game_get_name(c->protocol.game));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] tried to join a new game \"{}\" while already in a game \"{}\"!", conn_get_socket(c), gamename, game_get_name(c->protocol.game));
|
||||
else return 0;
|
||||
}
|
||||
game_del_player(conn_get_game(c), c);
|
||||
|
@ -2333,18 +2333,18 @@ namespace pvpgn
|
|||
|
||||
if (!c)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection (from {}:{})", fn, ln);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!c->protocol.account)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL account (from {}:{})", fn, ln);
|
||||
return NULL;
|
||||
}
|
||||
result = account_get_name(c->protocol.account);
|
||||
if (result == NULL)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "returned previous error after being called by %s:%u", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "returned previous error after being called by {}:{}", fn, ln);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -2364,7 +2364,7 @@ namespace pvpgn
|
|||
return character_get_name(c->protocol.d2.character);
|
||||
if (c->protocol.bound->protocol.d2.character)
|
||||
return character_get_name(c->protocol.bound->protocol.d2.character);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got connection class %s bound to class %d without a character", conn_get_socket(c), conn_class_get_str(c->protocol.cclass), c->protocol.bound->protocol.cclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got connection class {} bound to class {} without a character", conn_get_socket(c), conn_class_get_str(c->protocol.cclass), c->protocol.bound->protocol.cclass);
|
||||
}
|
||||
if (!c->protocol.account)
|
||||
return NULL; /* no name yet */
|
||||
|
@ -2740,16 +2740,16 @@ namespace pvpgn
|
|||
else if (clienttag == CLIENTTAG_DIABLO2DV_UINT)
|
||||
{
|
||||
/* not much to do */ /* FIXME: get char name here? */
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] playerinfo request for client \"%s\" playerinfo=\"%s\"", conn_get_socket(c), tag_uint_to_str(clienttag_str, clienttag), playerinfo);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] playerinfo request for client \"{}\" playerinfo=\"{}\"", conn_get_socket(c), tag_uint_to_str(clienttag_str, clienttag), playerinfo);
|
||||
}
|
||||
else if (clienttag == CLIENTTAG_DIABLO2XP_UINT)
|
||||
{
|
||||
/* in playerinfo we get strings of the form "Realmname,charname" */
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[%d] playerinfo request for client \"%s\" playerinfo=\"%s\"", conn_get_socket(c), tag_uint_to_str(clienttag_str, clienttag), playerinfo);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "[{}] playerinfo request for client \"{}\" playerinfo=\"{}\"", conn_get_socket(c), tag_uint_to_str(clienttag_str, clienttag), playerinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "setting playerinfo for client \"%s\" not supported (playerinfo=\"%s\")", tag_uint_to_str(clienttag_str, clienttag), playerinfo);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "setting playerinfo for client \"{}\" not supported (playerinfo=\"{}\")", tag_uint_to_str(clienttag_str, clienttag), playerinfo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2876,7 +2876,7 @@ namespace pvpgn
|
|||
else
|
||||
{
|
||||
c->protocol.d2.realm = realm_get(realm, &c->protocol.d2.realm_regref);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] set to \"%s\"", conn_get_socket(c), realm_get_name(realm));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] set to \"{}\"", conn_get_socket(c), realm_get_name(realm));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3130,7 +3130,7 @@ namespace pvpgn
|
|||
/* these lines are at least quota_time old */
|
||||
list_remove_elem(con->protocol.chat.quota.list, &curr);
|
||||
if (qline->count > con->protocol.chat.quota.totcount)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "qline->count=%u but con->protocol.chat.quota.totcount=%u", qline->count, con->protocol.chat.quota.totcount);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "qline->count={} but con->protocol.chat.quota.totcount={}", qline->count, con->protocol.chat.quota.totcount);
|
||||
con->protocol.chat.quota.totcount -= qline->count;
|
||||
xfree(qline);
|
||||
}
|
||||
|
@ -3561,7 +3561,7 @@ namespace pvpgn
|
|||
n = temp - name;
|
||||
if (n >= MAX_CHARNAME_LEN)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "character name too long in \"%s\" (charname@otherrealm format)", name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "character name too long in \"{}\" (charname@otherrealm format)", name);
|
||||
return NULL;
|
||||
}
|
||||
std::strncpy(charname, name, n);
|
||||
|
@ -3577,7 +3577,7 @@ namespace pvpgn
|
|||
n = temp - name;
|
||||
if (n >= MAX_CHARNAME_LEN)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "character name too long in \"%s\" (charname*username format)", name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "character name too long in \"{}\" (charname*username format)", name);
|
||||
return NULL;
|
||||
}
|
||||
name = temp + 1;
|
||||
|
@ -3756,7 +3756,7 @@ namespace pvpgn
|
|||
std::sprintf(tempplayerinfo, "%s %s 0 %s", revtag, revtag, clantag_str);
|
||||
else
|
||||
std::strcpy(tempplayerinfo, revtag);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] %s", conn_get_socket(c), revtag);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] {}", conn_get_socket(c), revtag);
|
||||
}
|
||||
// display race icon with a level number
|
||||
else
|
||||
|
@ -3766,14 +3766,14 @@ namespace pvpgn
|
|||
std::sprintf(tempplayerinfo, "%s %1u%c3W %u %s", revtag, raceiconnumber, raceicon, acctlevel, clantag_str);
|
||||
else
|
||||
std::sprintf(tempplayerinfo, "%s %1u%c3W %u", revtag, raceiconnumber, raceicon, acctlevel);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] %s using generated icon [%1u%c3W]", conn_get_socket(c), revtag, raceiconnumber, raceicon);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] {} using generated icon [{}{}3W]", conn_get_socket(c), revtag, raceiconnumber, raceicon);
|
||||
}
|
||||
else {
|
||||
if (clantag)
|
||||
std::sprintf(tempplayerinfo, "%s %s %u %s", revtag, usericon, acctlevel, clantag_str);
|
||||
else
|
||||
std::sprintf(tempplayerinfo, "%s %s %u", revtag, usericon, acctlevel);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] %s using user-selected icon [%s]", conn_get_socket(c), revtag, usericon);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] {} using user-selected icon [{}]", conn_get_socket(c), revtag, usericon);
|
||||
}
|
||||
}
|
||||
#ifdef WITH_LUA
|
||||
|
@ -3822,7 +3822,7 @@ namespace pvpgn
|
|||
if (count == prefs_get_passfail_count())
|
||||
{
|
||||
ipbanlist_add(NULL, addr_num_to_ip_str(conn_get_addr(c)), now + (std::time_t)prefs_get_passfail_bantime());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] failed password tries: %d (banned ip)", conn_get_socket(c), count);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] failed password tries: {} (banned ip)", conn_get_socket(c), count);
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (std::strchr(rawname, '/') || std::strchr(rawname, '\\')) {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got rawname containing '/' or '\\' \"%s\"", rawname);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got rawname containing '/' or '\\' \"{}\"", rawname);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ namespace pvpgn
|
|||
if (!(fp = std::fopen(filenamestk, "rb")))
|
||||
{
|
||||
/* FIXME: check for lower-case version of filename */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "stat() succeeded yet could not open file \"%s\" for reading (std::fopen: %s)", filenamestk, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "stat() succeeded yet could not open file \"{}\" for reading (std::fopen: {})", filenamestk, std::strerror(errno));
|
||||
filelen = 0;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ namespace pvpgn
|
|||
std::fseek(fp, startoffset, SEEK_SET);
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] startoffset is beyond end of file (%u>%u)", conn_get_socket(c), startoffset, filelen);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] startoffset is beyond end of file ({}>{})", conn_get_socket(c), startoffset, filelen);
|
||||
/* Keep the real filesize. Battle.net does it the same way ... */
|
||||
std::fclose(fp);
|
||||
fp = NULL;
|
||||
|
@ -259,18 +259,18 @@ namespace pvpgn
|
|||
*/
|
||||
if (!fp)
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] sending no data for file \"%s\" (\"%s\")", conn_get_socket(c), rawname, filenamestk);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] sending no data for file \"{}\" (\"{}\")", conn_get_socket(c), rawname, filenamestk);
|
||||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] sending file \"%s\" (\"%s\") of length %d", conn_get_socket(c), rawname, filenamestk, filelen);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] sending file \"{}\" (\"{}\") of length {}", conn_get_socket(c), rawname, filenamestk, filelen);
|
||||
for (;;)
|
||||
{
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create raw packet");
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close file \"%s\" after reading (std::fclose: %s)", filenamestk, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close file \"{}\" after reading (std::fclose: {})", filenamestk, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if ((nbytes = std::fread(packet_get_raw_data_build(rpacket, 0), 1, MAX_PACKET_SIZE, fp))<(int)MAX_PACKET_SIZE)
|
||||
|
@ -282,7 +282,7 @@ namespace pvpgn
|
|||
}
|
||||
packet_del_ref(rpacket);
|
||||
if (std::ferror(fp))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "read failed before EOF on file \"%s\" (std::fread: %s)", rawname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "read failed before EOF on file \"{}\" (std::fread: {})", rawname, std::strerror(errno));
|
||||
break;
|
||||
}
|
||||
packet_set_size(rpacket, nbytes);
|
||||
|
@ -291,7 +291,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close file \"%s\" after reading (std::fclose: %s)", rawname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close file \"{}\" after reading (std::fclose: {})", rawname, std::strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace pvpgn
|
|||
struct cdb_make cdbm;
|
||||
|
||||
if ((cdbfile = std::fopen(filename, "w+b")) == NULL) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open file \"%s\" for writing ", filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open file \"{}\" for writing ", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -69,20 +69,20 @@ namespace pvpgn
|
|||
|
||||
if (attr_get_key(attr) && attr_get_val(attr)) {
|
||||
if (std::strncmp("BNET\\CharacterDefault\\", attr_get_key(attr), 20) == 0) {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "skipping attribute key=\"%s\"", attr_get_key(attr));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "skipping attribute key=\"{}\"", attr_get_key(attr));
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "saving attribute key=\"%s\" val=\"%s\"", attr_get_key(attr), attr_get_val(attr));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "saving attribute key=\"{}\" val=\"{}\"", attr_get_key(attr), attr_get_val(attr));
|
||||
if (cdb_make_add(&cdbm, attr_get_key(attr), std::strlen(attr_get_key(attr)), attr_get_val(attr), std::strlen(attr_get_val(attr))) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error on cdb_make_add ('%s' = '%s')", attr_get_key(attr), attr_get_val(attr));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error on cdb_make_add ('{}' = '{}')", attr_get_key(attr), attr_get_val(attr));
|
||||
cdb_make_finish(&cdbm); /* try to bail out nicely */
|
||||
std::fclose(cdbfile);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else eventlog(eventlog_level_error, __FUNCTION__, "could not save attribute key=\"%s\"", attr_get_key(attr));
|
||||
else eventlog(eventlog_level_error, __FUNCTION__, "could not save attribute key=\"{}\"", attr_get_key(attr));
|
||||
|
||||
attr_clear_dirty(attr);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ namespace pvpgn
|
|||
std::FILE *f;
|
||||
|
||||
if ((f = std::fopen(filename, "rb")) == NULL) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error opening file '%s'", filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error opening file '{}'", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ namespace pvpgn
|
|||
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read atribute : '%s' -> '%s'", key, val);
|
||||
if (cb(key, val, data))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from callback on account file '%s'", filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from callback on account file '{}'", filename);
|
||||
xfree((void *)key);
|
||||
}
|
||||
|
||||
|
@ -220,14 +220,14 @@ namespace pvpgn
|
|||
char *val;
|
||||
unsigned vlen = 1;
|
||||
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "reading key '%s'", key);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "reading key '{}'", key);
|
||||
if ((cdbfile = std::fopen(filename, "rb")) == NULL) {
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "unable to open file \"%s\" for reading ",filename);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "unable to open file \"{}\" for reading ",filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cdb_seek(cdbfile, key, std::strlen(key), &vlen) <= 0) {
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "could not find key '%s'", key);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "could not find key '{}'", key);
|
||||
std:; std::fclose(cdbfile);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ namespace pvpgn
|
|||
|
||||
attr->val = val;
|
||||
attr->dirty = 0;
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read key '%s' value '%s'", attr->key, attr->val);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read key '{}' value '{}'", attr->key, attr->val);
|
||||
return attr;
|
||||
#else
|
||||
return NULL;
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace pvpgn
|
|||
char const * val;
|
||||
|
||||
if (!(accountfile = std::fopen(filename, "w"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open file \"%s\" for writing (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open file \"{}\" for writing (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -81,14 +81,14 @@ namespace pvpgn
|
|||
|
||||
if (key && val) {
|
||||
if (std::strncmp("BNET\\CharacterDefault\\", key, 20) == 0) {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "skipping attribute key=\"%s\"", attr->key);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "skipping attribute key=\"{}\"", attr->key);
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "saving attribute key=\"%s\" val=\"%s\"", attr->key, attr->val);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "saving attribute key=\"{}\" val=\"{}\"", attr->key, attr->val);
|
||||
std::fprintf(accountfile, "\"%s\"=\"%s\"\n", key, val);
|
||||
}
|
||||
}
|
||||
else eventlog(eventlog_level_error, __FUNCTION__, "could not save attribute key=\"%s\"", attr->key);
|
||||
else eventlog(eventlog_level_error, __FUNCTION__, "could not save attribute key=\"{}\"", attr->key);
|
||||
|
||||
if (key) xfree((void *)key); /* avoid warning */
|
||||
if (val) xfree((void *)val); /* avoid warning */
|
||||
|
@ -97,7 +97,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (std::fclose(accountfile) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close account file \"%s\" after writing (std::fclose: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close account file \"{}\" after writing (std::fclose: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ namespace pvpgn
|
|||
char * val;
|
||||
|
||||
if (!(accountfile = std::fopen(filename, "r"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open account file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open account file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (std::strlen(buff) < 6) /* "?"="" */ {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed line %d of account file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed line {} of account file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ namespace pvpgn
|
|||
|
||||
if (std::sscanf(buff, "\"%[^\"]\" = \"%[^\"]\"", esckey, escval) != 2) {
|
||||
if (std::sscanf(buff, "\"%[^\"]\" = \"\"", esckey) != 1) /* hack for an empty value field */ {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed entry on line %d of account file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed entry on line {} of account file \"{}\"", line, filename);
|
||||
xfree(escval);
|
||||
xfree(esckey);
|
||||
continue;
|
||||
|
@ -152,7 +152,7 @@ namespace pvpgn
|
|||
xfree(escval);
|
||||
|
||||
if (cb(key, val, data))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from callback (key: '%s' val:'%s')", key, val);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from callback (key: '{}' val:'{}')", key, val);
|
||||
|
||||
if (key) xfree((void *)key); /* avoid warning */
|
||||
if (val) xfree((void *)val); /* avoid warning */
|
||||
|
@ -161,7 +161,7 @@ namespace pvpgn
|
|||
file_get_line(NULL); // clear file_get_line buffer
|
||||
|
||||
if (std::fclose(accountfile) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close account file \"%s\" after reading (std::fclose: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close account file \"{}\" after reading (std::fclose: {})", filename, std::strerror(errno));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -402,7 +402,7 @@ namespace pvpgn
|
|||
|
||||
if (gamelist_find_game_available(name, clienttag, game_type_all))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "game \"%s\" not created because it already exists", name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "game \"{}\" not created because it already exists", name);
|
||||
return NULL; /* already have a game by that name */
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ namespace pvpgn
|
|||
elist_add(&gamelist_head, &game->glist_link);
|
||||
glist_length++;
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "game \"%s\" (pass \"%s\") type %hu(%s) startver %d created", name, pass, (unsigned short)type, game_type_get_str(game->type), startver);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "game \"{}\" (pass \"{}\") type {}({}) startver {} created", name, pass, (unsigned short)type, game_type_get_str(game->type), startver);
|
||||
|
||||
return game;
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ namespace pvpgn
|
|||
realm_add_game_number(realmlist_find_realm(game->realmname), -1);
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "game \"%s\" (count=%u ref=%u) removed from list...", game_get_name(game), game->count, game->ref);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "game \"{}\" (count={} ref={}) removed from list...", game_get_name(game), game->count, game->ref);
|
||||
|
||||
for (i = 0; i < game->count; i++)
|
||||
{
|
||||
|
@ -582,41 +582,41 @@ namespace pvpgn
|
|||
}
|
||||
}
|
||||
}
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "wins: %u losses: %u draws: %u disconnects: %u", wins, losses, draws, disconnects);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "wins: {} losses: {} draws: {} disconnects: {}", wins, losses, draws, disconnects);
|
||||
|
||||
//now decide what result we give
|
||||
if (!(reports)) // no results at all - game canceled before starting
|
||||
{
|
||||
game->results[i] = game_result_none;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"none\" to player %d", i);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"none\" to player {}", i);
|
||||
}
|
||||
else if ((disconnects >= draws) && (disconnects >= losses) && (disconnects >= wins))
|
||||
{
|
||||
if (discisloss)
|
||||
{
|
||||
game->results[i] = game_result_loss; //losses are also bad...
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"loss\" to player %d (due to discisloss)", i);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"loss\" to player {} (due to discisloss)", i);
|
||||
}
|
||||
else
|
||||
{
|
||||
game->results[i] = game_result_disconnect; //consider disconnects the worst case...
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"disconnect\" to player %d", i);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"disconnect\" to player {}", i);
|
||||
}
|
||||
}
|
||||
else if ((losses >= wins) && (losses >= draws))
|
||||
{
|
||||
game->results[i] = game_result_loss; //losses are also bad...
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"loss\" to player %d", i);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"loss\" to player {}", i);
|
||||
}
|
||||
else if ((draws >= wins))
|
||||
{
|
||||
game->results[i] = game_result_draw;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"draw\" to player %d", i);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"draw\" to player {}", i);
|
||||
}
|
||||
else if (wins)
|
||||
{
|
||||
game->results[i] = game_result_win;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"win\" to player %d", i);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "deciding to give \"win\" to player {}", i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -664,7 +664,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!players[curr])
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL player[%u] (of %u)", curr, count);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL player[{}] (of {})", curr, count);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -683,7 +683,7 @@ namespace pvpgn
|
|||
discs++;
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad results[%u]=%u", curr, (unsigned int)results[curr]);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad results[{}]={}", curr, (unsigned int)results[curr]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ namespace pvpgn
|
|||
{
|
||||
if (draws != count)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "some, but not all players had a draw count=%u (winners=%u losers=%u draws=%u)", count, winners, losers, draws);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "some, but not all players had a draw count={} (winners={} losers={} draws={})", count, winners, losers, draws);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -700,7 +700,7 @@ namespace pvpgn
|
|||
|
||||
if ((discisloss) && ((losers < 1) || (winners<1) || (winners>1 && (winners != losers))))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "missing winner or loser for count=%u (winners=%u losers=%u)", count, winners, losers);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "missing winner or loser for count={} (winners={} losers={})", count, winners, losers);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -783,7 +783,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!game->players[i])
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player slot %u has NULL account", i);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player slot {} has NULL account", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -826,7 +826,7 @@ namespace pvpgn
|
|||
}
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "realcount=%d count=%u", realcount, game->count);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "realcount={} count={}", realcount, game->count);
|
||||
|
||||
if (realcount >= 1 && !game->bad)
|
||||
{
|
||||
|
@ -841,7 +841,7 @@ namespace pvpgn
|
|||
|
||||
for (i = 0; i < realcount; i++)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "realplayer %u result=%u", i + 1, (unsigned int)game->results[i]);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "realplayer {} result={}", i + 1, (unsigned int)game->results[i]);
|
||||
|
||||
if ((tag_check_wolv1(game->clienttag)) || (tag_check_wolv2(game->clienttag))) {
|
||||
id = ladder_id_solo;
|
||||
|
@ -858,7 +858,7 @@ namespace pvpgn
|
|||
account_inc_ladder_disconnects(game->players[i], game->clienttag, id);
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad ladder game realplayer results[%u] = %u", i, game->results[i]);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad ladder game realplayer results[{}] = {}", i, game->results[i]);
|
||||
account_inc_ladder_disconnects(game->players[i], game->clienttag, id);
|
||||
}
|
||||
}
|
||||
|
@ -883,7 +883,7 @@ namespace pvpgn
|
|||
account_set_ladder_last_result(game->players[i], game->clienttag, id, game_result_get_str(game_result_disconnect));
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad ladder game realplayer results[%u] = %u", i, game->results[i]);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad ladder game realplayer results[{}] = {}", i, game->results[i]);
|
||||
account_inc_ladder_disconnects(game->players[i], game->clienttag, id);
|
||||
account_set_ladder_last_result(game->players[i], game->clienttag, id, game_result_get_str(game_result_disconnect));
|
||||
}
|
||||
|
@ -930,7 +930,7 @@ namespace pvpgn
|
|||
account_set_normal_last_result(game->players[i], game->clienttag, game_result_get_str(game_result_disconnect));
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad normal game realplayer results[%u] = %u", i, game->results[i]);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad normal game realplayer results[{}] = {}", i, game->results[i]);
|
||||
account_inc_normal_disconnects(game->players[i], game->clienttag);
|
||||
account_set_normal_last_result(game->players[i], game->clienttag, game_result_get_str(game_result_disconnect));
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp = std::fopen(tempname, "w")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open report file \"%s\" for writing (std::fopen: %s)", tempname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open report file \"{}\" for writing (std::fopen: {})", tempname, std::strerror(errno));
|
||||
if (ladder_info)
|
||||
xfree(ladder_info);
|
||||
xfree(realname);
|
||||
|
@ -1116,7 +1116,7 @@ namespace pvpgn
|
|||
|
||||
if (std::fclose(fp) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close report file \"%s\" after writing (std::fclose: %s)", tempname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close report file \"{}\" after writing (std::fclose: {})", tempname, std::strerror(errno));
|
||||
xfree(realname);
|
||||
xfree(tempname);
|
||||
return -1;
|
||||
|
@ -1124,13 +1124,13 @@ namespace pvpgn
|
|||
|
||||
if (p_rename(tempname, realname) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not std::rename report file to \"%s\" (std::rename: %s)", realname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not std::rename report file to \"{}\" (std::rename: {})", realname, std::strerror(errno));
|
||||
xfree(realname);
|
||||
xfree(tempname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "game report saved as \"%s\"", realname);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "game report saved as \"{}\"", realname);
|
||||
xfree(realname);
|
||||
xfree(tempname);
|
||||
return 0;
|
||||
|
@ -1439,13 +1439,13 @@ namespace pvpgn
|
|||
if (game->status == game_status_started &&
|
||||
(status == game_status_open || status == game_status_full || status == game_status_loaded)) {
|
||||
eventlog(eventlog_level_error, "game_set_status",
|
||||
"attempting to set status '%s' (%d) to started game", game_status_get_str(status), status);
|
||||
"attempting to set status '{}' ({}) to started game", game_status_get_str(status), status);
|
||||
return;
|
||||
}
|
||||
|
||||
if (game->status == game_status_done && status != game_status_done) {
|
||||
eventlog(eventlog_level_error, "game_set_status",
|
||||
"attempting to set status '%s' (%d) to done game", game_status_get_str(status), status);
|
||||
"attempting to set status '{}' ({}) to done game", game_status_get_str(status), status);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1503,17 +1503,17 @@ namespace pvpgn
|
|||
}
|
||||
if (game->ref < 1)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"%s\" has no players", game_get_name(game));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"{}\" has no players", game_get_name(game));
|
||||
return 0;
|
||||
}
|
||||
if (!game->players)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"%s\" has NULL players array (ref=%u)", game_get_name(game), game->ref);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"{}\" has NULL players array (ref={})", game_get_name(game), game->ref);
|
||||
return 0;
|
||||
}
|
||||
if (!game->players[0])
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"%s\" has NULL players[0] entry (ref=%u)", game_get_name(game), game->ref);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"{}\" has NULL players[0] entry (ref={})", game_get_name(game), game->ref);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1529,17 +1529,17 @@ namespace pvpgn
|
|||
}
|
||||
if (game->ref < 1)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"%s\" has no players", game_get_name(game));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"{}\" has no players", game_get_name(game));
|
||||
return NULL;
|
||||
}
|
||||
if (!game->players)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"%s\" has NULL player array (ref=%u)", game_get_name(game), game->ref);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"{}\" has NULL player array (ref={})", game_get_name(game), game->ref);
|
||||
return NULL;
|
||||
}
|
||||
if (!game->players[i])
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"%s\" has NULL players[i] entry (ref=%u)", game_get_name(game), game->ref);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "game \"{}\" has NULL players[i] entry (ref={})", game_get_name(game), game->ref);
|
||||
return NULL;
|
||||
}
|
||||
return game->connections[i];
|
||||
|
@ -1578,7 +1578,7 @@ namespace pvpgn
|
|||
}
|
||||
if (startver != STARTVER_UNKNOWN && startver != STARTVER_GW1 && startver != STARTVER_GW3 && startver != STARTVER_GW4 && startver != STARTVER_REALM1)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad game startver %d", startver);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad game startver {}", startver);
|
||||
return -1;
|
||||
}
|
||||
if (!c)
|
||||
|
@ -1605,7 +1605,7 @@ namespace pvpgn
|
|||
|
||||
if (game->pass[0] != '\0' && strcasecmp(game->pass, pass) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "game \"%s\" password mismatch \"%s\"!=\"%s\"", game_get_name(game), game->pass, pass);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "game \"{}\" password mismatch \"{}\"!=\"{}\"", game_get_name(game), game->pass, pass);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1683,7 +1683,7 @@ namespace pvpgn
|
|||
} // end of "if ((i == game->count) || (game->count == 0))"
|
||||
|
||||
if (game->startver != startver && startver != STARTVER_UNKNOWN) /* with join startver ALWAYS unknown [KWS] */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player \"%s\" client \"%s\" startver %u joining game startver %u (count=%u ref=%u)", account_get_name(conn_get_account(c)), clienttag_uint_to_str(conn_get_clienttag(c)), startver, game->startver, game->count, game->ref);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player \"{}\" client \"{}\" startver {} joining game startver {} (count={} ref={})", account_get_name(conn_get_account(c)), clienttag_uint_to_str(conn_get_clienttag(c)), startver, game->startver, game->count, game->ref);
|
||||
|
||||
game_choose_host(game);
|
||||
|
||||
|
@ -1724,17 +1724,17 @@ namespace pvpgn
|
|||
conn_set_leavegamewhisper_ack(c, 1); //1 = already whispered. We reset this each std::time user joins a channel
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "game \"%s\" has ref=%u, count=%u; trying to remove player \"%s\"", game_get_name(game), game->ref, game->count, account_get_name(account));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "game \"{}\" has ref={}, count={}; trying to remove player \"{}\"", game_get_name(game), game->ref, game->count, account_get_name(account));
|
||||
|
||||
for (i = 0; i < game->count; i++)
|
||||
if (game->players[i] == account && game->connections[i])
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "removing player #%u \"%s\" from \"%s\", %u players left", i, (tname = account_get_name(account)), game_get_name(game), game->ref - 1);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "removing player #{} \"{}\" from \"{}\", {} players left", i, (tname = account_get_name(account)), game_get_name(game), game->ref - 1);
|
||||
game->connections[i] = NULL;
|
||||
if (!(game->reported_results[i]))
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "player \"%s\" left without reporting (valid) results", tname);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "player \"{}\" left without reporting (valid) results", tname);
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "player deleted... (ref=%u)", game->ref);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "player deleted... (ref={})", game->ref);
|
||||
|
||||
if (game->ref < 2)
|
||||
{
|
||||
|
@ -1756,7 +1756,7 @@ namespace pvpgn
|
|||
return 0;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player \"%s\" was not in the game", account_get_name(account));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player \"{}\" was not in the game", account_get_name(account));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1770,7 +1770,7 @@ namespace pvpgn
|
|||
|
||||
if (!(i < game->count))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "requested illegal player id %u", i);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "requested illegal player id {}", i);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1827,7 +1827,7 @@ namespace pvpgn
|
|||
}
|
||||
if (pos == game->count)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not find player \"%s\" to set result", account_get_name(account));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not find player \"{}\" to set result", account_get_name(account));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1879,13 +1879,13 @@ namespace pvpgn
|
|||
|
||||
if (i == game->count)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not find player \"%s\" to set reported results", account_get_name(account));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not find player \"{}\" to set reported results", account_get_name(account));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (game->reported_results[i])
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player \"%s\" already reported results - skipping this report", account_get_name(account));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player \"{}\" already reported results - skipping this report", account_get_name(account));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1906,11 +1906,11 @@ namespace pvpgn
|
|||
default: /* result is invalid */
|
||||
if (i != j)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "ignoring bad reported result %u for player \"%s\"", (unsigned int)result, account_get_name(game->players[j]));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "ignoring bad reported result {} for player \"{}\"", (unsigned int)result, account_get_name(game->players[j]));
|
||||
results[i] = game_result_none;
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad reported result %u for self - skipping results", (unsigned int)result);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad reported result {} for self - skipping results", (unsigned int)result);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -2001,13 +2001,13 @@ namespace pvpgn
|
|||
|
||||
if (i == game->count)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not find player \"%s\" to set reported results", account_get_name(account));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not find player \"{}\" to set reported results", account_get_name(account));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(game->reported_results[i]))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player \"%s\" has not reported any results", account_get_name(account));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "player \"{}\" has not reported any results", account_get_name(account));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace pvpgn
|
|||
case CLIENT_GAMELISTREQ_MAPSET:
|
||||
return game_type_mapset;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft bnet game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft bnet game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace pvpgn
|
|||
case CLIENT_GAMELISTREQ_ALL:
|
||||
return game_type_diablo2open;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II bnet game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II bnet game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ namespace pvpgn
|
|||
case CLIENT_GAMETYPE_DIABLO_d:
|
||||
return game_type_diablo;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo bnet game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo bnet game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ namespace pvpgn
|
|||
case CLIENT_GAMELISTREQ_TOPVBOT:
|
||||
return game_type_topvbot;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown game clienttag \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown game clienttag \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ namespace pvpgn
|
|||
case CLIENT_GAMELISTREQ_MAPSET:
|
||||
return game_type_mapset;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft bnet game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft bnet game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ namespace pvpgn
|
|||
case CLIENT_GAMETYPE_DIABLO2_CLOSE:
|
||||
return game_type_diablo2closed;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II bnet game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II bnet game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ namespace pvpgn
|
|||
case CLIENT_GAMETYPE_DIABLO_c:
|
||||
return game_type_diablo;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo bnet game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo bnet game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ namespace pvpgn
|
|||
case CLIENT_GAMELISTREQ_TOPVBOT:
|
||||
return game_type_topvbot;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown game clienttag \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown game clienttag \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), bngtype);
|
||||
return game_type_none;
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ namespace pvpgn
|
|||
return 0;
|
||||
case game_type_none:
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown game type %u", (unsigned int)gtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown game type {}", (unsigned int)gtype);
|
||||
return 0xffff;
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_TOPVBOT_7:
|
||||
return game_option_topvbot_7;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_melee:
|
||||
|
@ -384,7 +384,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_MELEE_NORMAL:
|
||||
return game_option_melee_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_ffa:
|
||||
|
@ -393,7 +393,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_FFA_NORMAL:
|
||||
return game_option_ffa_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_oneonone:
|
||||
|
@ -402,7 +402,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_ONEONONE_NORMAL:
|
||||
return game_option_oneonone_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_ladder:
|
||||
|
@ -413,14 +413,14 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_LADDER_NOPENALTY:
|
||||
return game_option_ladder_nopenalty;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_ironman:
|
||||
switch (bngoption)
|
||||
{
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_mapset:
|
||||
|
@ -429,11 +429,11 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_MAPSET_NORMAL:
|
||||
return game_option_mapset_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II game type \"%s\" %u", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Warcraft II game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype);
|
||||
return game_option_none;
|
||||
}
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_NONE: /* FIXME: really? */
|
||||
return game_option_none;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_diablo2closed:
|
||||
|
@ -457,11 +457,11 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_NONE: /* FIXME: really? */
|
||||
return game_option_none;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo II game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype);
|
||||
return game_option_none;
|
||||
}
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ namespace pvpgn
|
|||
return game_option_none;
|
||||
}
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo game type \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Diablo game type \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype);
|
||||
return game_option_none;
|
||||
}
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_MELEE_NORMAL:
|
||||
return game_option_melee_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_ffa:
|
||||
|
@ -503,7 +503,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_FFA_NORMAL:
|
||||
return game_option_ffa_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_oneonone:
|
||||
|
@ -512,7 +512,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_ONEONONE_NORMAL:
|
||||
return game_option_oneonone_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_ctf:
|
||||
|
@ -521,7 +521,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_CTF_NORMAL:
|
||||
return game_option_ctf_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_greed:
|
||||
|
@ -536,7 +536,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_GREED_2500:
|
||||
return game_option_greed_2500;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_slaughter:
|
||||
|
@ -551,7 +551,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_SLAUGHTER_15:
|
||||
return game_option_slaughter_15;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_sdeath:
|
||||
|
@ -560,7 +560,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_SDEATH_NORMAL:
|
||||
return game_option_sdeath_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_ladder:
|
||||
|
@ -571,7 +571,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_LADDER_NOPENALTY:
|
||||
return game_option_ladder_nopenalty;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_mapset:
|
||||
|
@ -580,7 +580,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_MAPSET_NORMAL:
|
||||
return game_option_mapset_normal;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_teammelee:
|
||||
|
@ -593,7 +593,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_TEAMMELEE_2:
|
||||
return game_option_teammelee_2;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_teamffa:
|
||||
|
@ -606,7 +606,7 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_TEAMFFA_2:
|
||||
return game_option_teamffa_2;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_teamctf:
|
||||
|
@ -619,14 +619,14 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_TEAMCTF_2:
|
||||
return game_option_teamctf_2;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_pgl:
|
||||
switch (bngoption)
|
||||
{
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_topvbot:
|
||||
|
@ -647,12 +647,12 @@ namespace pvpgn
|
|||
case CLIENT_STARTGAME4_OPTION_TOPVBOT_7:
|
||||
return game_option_topvbot_7;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"%s\" game \"%s\" %hu", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft bnet game option for \"{}\" game \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), game_type_get_str(gtype), bngoption);
|
||||
return game_option_none;
|
||||
}
|
||||
case game_type_none:
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft game type \"%s\" %u(%s)", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype, game_type_get_str(gtype));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown Starcraft game type \"{}\" {}({})", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype, game_type_get_str(gtype));
|
||||
return game_option_none;
|
||||
}
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown game clienttag \"%s\" %u", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown game clienttag \"{}\" {}", tag_uint_to_str(clienttag_str, clienttag), (unsigned int)gtype);
|
||||
return game_option_none;
|
||||
}
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ namespace pvpgn
|
|||
case CLIENT_GAME_REPORT_RESULT_OBSERVER:
|
||||
return game_result_observer;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown bnet game result %u", bngresult);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown bnet game result {}", bngresult);
|
||||
return game_result_disconnect; /* bad packet? */
|
||||
}
|
||||
}
|
||||
|
@ -981,7 +981,7 @@ namespace pvpgn
|
|||
difficulty[1] = '\0';
|
||||
if (str_to_uint(difficulty, &bngdifficulty) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad gameinfo format (missing difficulty) \"%s\"", gameinfo);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad gameinfo format (missing difficulty) \"{}\"", gameinfo);
|
||||
return -1;
|
||||
}
|
||||
game_set_difficulty(game, bngdifficulty);
|
||||
|
@ -1053,13 +1053,13 @@ namespace pvpgn
|
|||
|
||||
if (!(line1 = std::strtok(save, "\r"))) /* actual game info fields */
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad gameinfo format (missing line1) \"%s\"", gameinfo);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad gameinfo format (missing line1) \"{}\"", gameinfo);
|
||||
xfree(save);
|
||||
return -1;
|
||||
}
|
||||
if (!(line2 = std::strtok(NULL, "\r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad gameinfo format (missing player) \"%s\"", gameinfo);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad gameinfo format (missing player) \"{}\"", gameinfo);
|
||||
xfree(save);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1136,7 +1136,7 @@ namespace pvpgn
|
|||
|
||||
mapname = line2; /* only one item on this line */
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "got info \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"", mapsize, maxplayers, speed, maptype, gametype, option, checksum, tileset, player, mapname);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "got info \"{}\" \"{}\" \"{}\" \"{}\" \"{}\" \"{}\" \"{}\" \"{}\" \"{}\" \"{}\"", mapsize, maxplayers, speed, maptype, gametype, option, checksum, tileset, player, mapname);
|
||||
|
||||
/* The map size is determined by breaking the number into two pieces and
|
||||
* multiplying each piece by 32.
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace pvpgn
|
|||
|
||||
if (packet_get_size(packet) < sizeof(t_client_findanongame_profile_clan))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad ANONGAME_PROFILE_CLAN packet (expected %lu bytes, got %u)", conn_get_socket(c), sizeof(t_client_findanongame_profile_clan), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad ANONGAME_PROFILE_CLAN packet (expected {} bytes, got {})", conn_get_socket(c), sizeof(t_client_findanongame_profile_clan), packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -155,11 +155,11 @@ namespace pvpgn
|
|||
|
||||
|
||||
Count = bn_int_get(packet->u.client_findanongame.count);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] got a FINDANONGAME PROFILE packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] got a FINDANONGAME PROFILE packet", conn_get_socket(c));
|
||||
|
||||
if (!(username = packet_get_str_const(packet, sizeof(t_client_findanongame_profile), MAX_USERNAME_LEN)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad FINDANONGAME_PROFILE (missing or too long username)", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad FINDANONGAME_PROFILE (missing or too long username)", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -177,14 +177,14 @@ namespace pvpgn
|
|||
else
|
||||
ctag = conn_get_clienttag(dest_c);
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Looking up %s's %s Stats.", username, tag_uint_to_str(clienttag_str, ctag));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Looking up {}'s {} Stats.", username, tag_uint_to_str(clienttag_str, ctag));
|
||||
|
||||
if (account_get_ladder_level(account, ctag, ladder_id_solo) <= 0 &&
|
||||
account_get_ladder_level(account, ctag, ladder_id_team) <= 0 &&
|
||||
account_get_ladder_level(account, ctag, ladder_id_ffa) <= 0 &&
|
||||
account_get_teams(account) == NULL)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "%s does not have WAR3 Stats.", username);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "{} does not have WAR3 Stats.", username);
|
||||
if (!(rpacket = packet_create(packet_class_bnet)))
|
||||
return -1;
|
||||
packet_set_size(rpacket, sizeof(t_server_findanongame_profile2));
|
||||
|
@ -398,7 +398,7 @@ namespace pvpgn
|
|||
conn_push_outqueue(c, rpacket);
|
||||
packet_del_ref(rpacket);
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Sent %s's WAR3 Stats (including %d teams) to requestor.", username, teamcount);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Sent {}'s WAR3 Stats (including {} teams) to requestor.", username, teamcount);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ namespace pvpgn
|
|||
t_anongame *a = conn_get_anongame(c);
|
||||
int a_count, i;
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] got FINDANONGAME CANCEL packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] got FINDANONGAME CANCEL packet", conn_get_socket(c));
|
||||
|
||||
if (!a)
|
||||
return -1;
|
||||
|
@ -485,7 +485,7 @@ namespace pvpgn
|
|||
table_height = 4;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] got FINDANONGAME Get Icons packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] got FINDANONGAME Get Icons packet", conn_get_socket(c));
|
||||
|
||||
if ((rpacket = packet_create(packet_class_bnet)) == NULL) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new packet");
|
||||
|
@ -586,11 +586,11 @@ namespace pvpgn
|
|||
//user_icon[4]=0;
|
||||
if (desired_icon == 0){
|
||||
std::strcpy(user_icon, "1O3W"); // 103W is equal to Default Icon
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] Set icon packet to DEFAULT ICON [%4.4s]", conn_get_socket(c), user_icon);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] Set icon packet to DEFAULT ICON [{}]", conn_get_socket(c), user_icon);
|
||||
}
|
||||
else{
|
||||
std::memcpy(user_icon, &desired_icon, 4);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] Set icon packet to ICON [%s]", conn_get_socket(c), user_icon);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] Set icon packet to ICON [{}]", conn_get_socket(c), user_icon);
|
||||
}
|
||||
|
||||
account = conn_get_account(c);
|
||||
|
@ -599,7 +599,7 @@ namespace pvpgn
|
|||
if (check_user_icon(account, user_icon) == 0)
|
||||
{
|
||||
std::strcpy(user_icon, "1O3W"); // set icon to default
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%s] \"%s\" ICON SWITCH hack attempt, icon set to default ", conn_get_username(c), user_icon);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] \"{}\" ICON SWITCH hack attempt, icon set to default ", conn_get_username(c), user_icon);
|
||||
//conn_set_state(c,conn_state_destroy); // dont kill user session
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ namespace pvpgn
|
|||
|
||||
len = std::strlen(user_icon);
|
||||
if (len != 4)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid user icon '%s'", user_icon);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid user icon '{}'", user_icon);
|
||||
|
||||
for (i = 0; i < len && i < 2; i++)
|
||||
temp_str[i] = user_icon[i];
|
||||
|
@ -754,7 +754,7 @@ namespace pvpgn
|
|||
packet_append_data(rpacket, tmpdata, tmplen);
|
||||
noitems++;
|
||||
server_tag_count++;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x%01x) tag=(%s) tag_unk=(0x%04x)", i, "CLIENT_FINDANONGAME_INFOTAG_URL", client_tag_unk);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x{:01x}) tag=({}) tag_unk=(0x{:04x})", i, "CLIENT_FINDANONGAME_INFOTAG_URL", client_tag_unk);
|
||||
break;
|
||||
case CLIENT_FINDANONGAME_INFOTAG_MAP:
|
||||
bn_int_set((bn_int*)&server_tag_unk, 0x70E2E0D5);
|
||||
|
@ -764,7 +764,7 @@ namespace pvpgn
|
|||
packet_append_data(rpacket, tmpdata, tmplen);
|
||||
noitems++;
|
||||
server_tag_count++;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x%01x) tag=(%s) tag_unk=(0x%04x)", i, "CLIENT_FINDANONGAME_INFOTAG_MAP", client_tag_unk);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x{:01x}) tag=({}) tag_unk=(0x{:04x})", i, "CLIENT_FINDANONGAME_INFOTAG_MAP", client_tag_unk);
|
||||
break;
|
||||
case CLIENT_FINDANONGAME_INFOTAG_TYPE:
|
||||
bn_int_set((bn_int*)&server_tag_unk, 0x7C87DEEE);
|
||||
|
@ -774,7 +774,7 @@ namespace pvpgn
|
|||
packet_append_data(rpacket, tmpdata, tmplen);
|
||||
noitems++;
|
||||
server_tag_count++;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x%01x) tag=(%s) tag_unk=(0x%04x)", i, "CLIENT_FINDANONGAME_INFOTAG_TYPE", client_tag_unk);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x{:01x}) tag=({}) tag_unk=(0x{:04x})", i, "CLIENT_FINDANONGAME_INFOTAG_TYPE", client_tag_unk);
|
||||
break;
|
||||
case CLIENT_FINDANONGAME_INFOTAG_DESC:
|
||||
bn_int_set((bn_int*)&server_tag_unk, 0xA4F0A22F);
|
||||
|
@ -782,7 +782,7 @@ namespace pvpgn
|
|||
packet_append_data(rpacket, &server_tag_unk, 4);
|
||||
tmpdata = anongame_infos_data_get_desc(langstr, clienttag, conn_get_versionid(c), &tmplen);
|
||||
packet_append_data(rpacket, tmpdata, tmplen);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x%01x) tag=(%s) tag_unk=(0x%04x)", i, "CLIENT_FINDANONGAME_INFOTAG_DESC", client_tag_unk);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x{:01x}) tag=({}) tag_unk=(0x{:04x})", i, "CLIENT_FINDANONGAME_INFOTAG_DESC", client_tag_unk);
|
||||
noitems++;
|
||||
server_tag_count++;
|
||||
break;
|
||||
|
@ -794,10 +794,10 @@ namespace pvpgn
|
|||
packet_append_data(rpacket, tmpdata, tmplen);
|
||||
noitems++;
|
||||
server_tag_count++;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x%01x) tag=(%s) tag_unk=(0x%04x)", i, "CLIENT_FINDANONGAME_INFOTAG_LADR", client_tag_unk);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "client_tag request tagid=(0x{:01x}) tag=({}) tag_unk=(0x{:04x})", i, "CLIENT_FINDANONGAME_INFOTAG_LADR", client_tag_unk);
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "unrec client_tag request tagid=(0x%01x) tag=(0x%04x)", i, client_tag);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "unrec client_tag request tagid=(0x{:01x}) tag=(0x{:04x})", i, client_tag);
|
||||
|
||||
}
|
||||
//Adding a last padding null-byte
|
||||
|
@ -1028,7 +1028,7 @@ namespace pvpgn
|
|||
return _client_anongame_profile_clan(c, packet);
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unhandled option %d", bn_byte_get(packet->u.client_findanongame.option));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unhandled option {}", bn_byte_get(packet->u.client_findanongame.option));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ namespace pvpgn
|
|||
*param++ = '\0';
|
||||
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] got \"%s\" [%s]", conn_get_socket(conn), tag, ((param) ? (param) : ("")));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] got \"{}\" [{}]", conn_get_socket(conn), tag, ((param) ? (param) : ("")));
|
||||
|
||||
if (handle_apireg_tag(apiregmember, tag, param) != -1) {}
|
||||
xfree(line);
|
||||
|
@ -440,10 +440,10 @@ namespace pvpgn
|
|||
apiregline[apiregpos++] = data[i];
|
||||
else {
|
||||
apiregpos++; /* for the statistic :) */
|
||||
WARN2("[%d] client exceeded maximum allowed message length by %d characters", conn_get_socket(conn), apiregpos - MAX_IRC_MESSAGE_LEN);
|
||||
WARN2("[{}] client exceeded maximum allowed message length by {} characters", conn_get_socket(conn), apiregpos - MAX_IRC_MESSAGE_LEN);
|
||||
if (apiregpos > 100 + MAX_IRC_MESSAGE_LEN) {
|
||||
/* automatic flood protection */
|
||||
ERROR1("[%d] excess flood", conn_get_socket(conn));
|
||||
ERROR1("[{}] excess flood", conn_get_socket(conn));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ namespace pvpgn
|
|||
len = (std::strlen(command));
|
||||
|
||||
if (len > MAX_IRC_MESSAGE_LEN) {
|
||||
ERROR1("message to send is too large (%u bytes)", len);
|
||||
ERROR1("message to send is too large ({} bytes)", len);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
|
@ -475,7 +475,7 @@ namespace pvpgn
|
|||
|
||||
packet_set_size(p, 0);
|
||||
packet_append_data(p, data, len);
|
||||
DEBUG2("[%d] sent \"%s\"", conn_get_socket(conn), data);
|
||||
DEBUG2("[{}] sent \"{}\"", conn_get_socket(conn), data);
|
||||
conn_push_outqueue(conn, p);
|
||||
packet_del_ref(p);
|
||||
|
||||
|
@ -823,7 +823,7 @@ namespace pvpgn
|
|||
// if (!email)
|
||||
// snprintf(email,sizeof(email),"((Email))");
|
||||
|
||||
DEBUG3("APIREG:/%s/%s/%s/", apiregmember_get_request(apiregmember), apiregmember_get_newnick(apiregmember), apiregmember_get_newpass(apiregmember));
|
||||
DEBUG3("APIREG:/{}/{}/{}/", apiregmember_get_request(apiregmember), apiregmember_get_newnick(apiregmember), apiregmember_get_newpass(apiregmember));
|
||||
|
||||
if ((request) && (std::strcmp(apiregmember_get_request(apiregmember), REQUEST_AGEVERIFY) == 0)) {
|
||||
std::snprintf(data, sizeof(data), "HRESULT=%s\nMessage=%s\nNewNick=((NewNick))\nNewPass=((NewPass))\n", hresult, message);
|
||||
|
@ -869,7 +869,7 @@ namespace pvpgn
|
|||
return 0;
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "WOLHASH: %s", wol_pass_hash);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "WOLHASH: {}", wol_pass_hash);
|
||||
account_set_wol_apgar(tempacct, wol_pass_hash);
|
||||
if (apiregmember_get_email(apiregmember))
|
||||
account_set_email(tempacct, apiregmember_get_email(apiregmember));
|
||||
|
@ -884,7 +884,7 @@ namespace pvpgn
|
|||
}
|
||||
else {
|
||||
/* Error: Unknown request - closing connection */
|
||||
ERROR1("got UNKNOWN request /%s/ closing connection", apiregmember->request);
|
||||
ERROR1("got UNKNOWN request /{}/ closing connection", apiregmember->request);
|
||||
LIST_TRAVERSE(apireglist(), curr) {
|
||||
t_apiregmember * apiregmemberlist = (t_apiregmember*)elem_get_data(curr);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -52,17 +52,17 @@ namespace pvpgn
|
|||
|
||||
if (!c)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL connection", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (!packet)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL packet", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (packet_get_class(packet) != packet_class_raw)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad packet (class %d)", conn_get_socket(c), (int)packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad packet (class {})", conn_get_socket(c), (int)packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace pvpgn
|
|||
return 0;
|
||||
if (!linestr)
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] line too long", conn_get_socket(c));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] line too long", conn_get_socket(c));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -98,14 +98,14 @@ namespace pvpgn
|
|||
conn_set_state(c, conn_state_bot_password);
|
||||
|
||||
if (conn_set_loggeduser(c, temp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not set username to \"%s\"", conn_get_socket(c), temp);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not set username to \"{}\"", conn_get_socket(c), temp);
|
||||
|
||||
{
|
||||
char const * const msg = "\r\nPassword: ";
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
#if 1 /* don't echo */
|
||||
|
@ -122,14 +122,14 @@ namespace pvpgn
|
|||
conn_set_state(c, conn_state_bot_password);
|
||||
|
||||
if (conn_set_loggeduser(c, linestr) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not set username to \"%s\"", conn_get_socket(c), linestr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not set username to \"{}\"", conn_get_socket(c), linestr);
|
||||
|
||||
{
|
||||
char const * const temp = "\r\nPassword: ";
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
#if 1 /* don't echo */
|
||||
|
@ -159,7 +159,7 @@ namespace pvpgn
|
|||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -170,12 +170,12 @@ namespace pvpgn
|
|||
}
|
||||
if (connlist_find_connection_by_accountname(loggeduser))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (already logged in)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (already logged in)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -186,12 +186,12 @@ namespace pvpgn
|
|||
}
|
||||
if (!(account = accountlist_find_account(loggeduser)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (bad account)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (bad account)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -204,12 +204,12 @@ namespace pvpgn
|
|||
{
|
||||
if (hash_set_str(&oldpasshash1, oldstrhash1) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (corrupted passhash1?)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (corrupted passhash1?)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -225,14 +225,14 @@ namespace pvpgn
|
|||
}
|
||||
if (bnet_hash(&trypasshash1, std::strlen(testpass), testpass) < 0) /* FIXME: force to lowercase */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (unable to hash password)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (unable to hash password)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
xfree((void *)testpass);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -244,12 +244,12 @@ namespace pvpgn
|
|||
xfree((void *)testpass);
|
||||
if (hash_eq(trypasshash1, oldpasshash1) != 1)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (wrong password)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (wrong password)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -262,12 +262,12 @@ namespace pvpgn
|
|||
|
||||
if (account_get_auth_botlogin(account) != 1) /* default to false */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (no bot access)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (no bot access)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -278,12 +278,12 @@ namespace pvpgn
|
|||
}
|
||||
else if (account_get_auth_lock(account) == 1) /* default to false */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (this account is locked)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (this account is locked)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ namespace pvpgn
|
|||
break;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] \"%s\" bot logged in (correct password)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] \"{}\" bot logged in (correct password)", conn_get_socket(c), loggeduser);
|
||||
#ifdef WITH_LUA
|
||||
if (lua_handle_user(c, NULL, NULL, luaevent_user_login) == 1)
|
||||
{
|
||||
|
@ -305,10 +305,10 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] \"%s\" bot logged in (no password)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] \"{}\" bot logged in (no password)", conn_get_socket(c), loggeduser);
|
||||
}
|
||||
if (!(rpacket = packet_create(packet_class_raw))) /* if we got this far, let them std::log in even if this fails */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
else
|
||||
{
|
||||
packet_append_ntstring(rpacket, "\r\n");
|
||||
|
@ -345,7 +345,7 @@ namespace pvpgn
|
|||
break;
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unknown bot connection state %d", conn_get_socket(c), (int)conn_get_state(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unknown bot connection state {}", conn_get_socket(c), (int)conn_get_state(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
if (packet_get_class(packet) != packet_class_d2cs_bnetd) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad packet class %d",
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad packet class {}",
|
||||
packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ namespace pvpgn
|
|||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__,
|
||||
"got unknown packet type %d", packet_get_type(packet));
|
||||
"got unknown packet type {}", packet_get_type(packet));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -87,13 +87,13 @@ namespace pvpgn
|
|||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__,
|
||||
"got unknown packet type %d", packet_get_type(packet));
|
||||
"got unknown packet type {}", packet_get_type(packet));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__,
|
||||
"got unknown connection state %d", conn_get_state(c));
|
||||
"got unknown connection state {}", conn_get_state(c));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -118,13 +118,13 @@ namespace pvpgn
|
|||
}
|
||||
if (!(realm = realmlist_find_realm(realmname))) {
|
||||
realm = realmlist_find_realm_by_ip(conn_get_addr(c)); /* should not fail - checked in handle_init_packet() handle_init.c */
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "warn: realm name mismatch %s %s", realm_get_name(realm), realmname);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "warn: realm name mismatch {} {}", realm_get_name(realm), realmname);
|
||||
if (!(prefs_allow_d2cs_setname())) { /* fail if allow_d2cs_setname = false */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs not allowed to set realm name");
|
||||
return -1;
|
||||
}
|
||||
if (realm_get_active(realm)) { /* fail if realm already active */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "cannot set realm name to %s (realm already active)", realmname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "cannot set realm name to {} (realm already active)", realmname);
|
||||
return -1;
|
||||
}
|
||||
realm_set_name(realm, realmname);
|
||||
|
@ -132,7 +132,7 @@ namespace pvpgn
|
|||
version = prefs_get_d2cs_version();
|
||||
try_version = bn_int_get(packet->u.d2cs_bnetd_authreply.version);
|
||||
if (version && version != try_version) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs version mismatch 0x%X - 0x%X",
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs version mismatch 0x{:X} - 0x{:X}",
|
||||
try_version, version);
|
||||
reply = BNETD_D2CS_AUTHREPLY_BAD_VERSION;
|
||||
}
|
||||
|
@ -141,13 +141,13 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (reply == BNETD_D2CS_AUTHREPLY_SUCCEED) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "d2cs %s authed",
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "d2cs {} authed",
|
||||
addr_num_to_ip_str(conn_get_addr(c)));
|
||||
conn_set_state(c, conn_state_loggedin);
|
||||
realm_active(realm, c);
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "failed to auth d2cs %s",
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "failed to auth d2cs {}",
|
||||
addr_num_to_ip_str(conn_get_addr(c)));
|
||||
}
|
||||
if ((rpacket = packet_create(packet_class_d2cs_bnetd))) {
|
||||
|
@ -196,11 +196,11 @@ namespace pvpgn
|
|||
sessionnum = bn_int_get(packet->u.d2cs_bnetd_accountloginreq.sessionnum);
|
||||
salt = bn_int_get(packet->u.d2cs_bnetd_accountloginreq.seqno);
|
||||
if (!(client = connlist_find_connection_by_sessionnum(sessionnum))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "sessionnum %d not found", sessionnum);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "sessionnum {} not found", sessionnum);
|
||||
reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILED;
|
||||
}
|
||||
else if (sessionkey != conn_get_sessionkey(client)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "sessionkey %d not match", sessionkey);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "sessionkey {} not match", sessionkey);
|
||||
reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILED;
|
||||
}
|
||||
else if (!(tname = conn_get_username(client))) {
|
||||
|
@ -208,7 +208,7 @@ namespace pvpgn
|
|||
reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILED;
|
||||
}
|
||||
else if (strcasecmp(account, tname)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "username %s not match", account);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "username {} not match", account);
|
||||
reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILED;
|
||||
}
|
||||
else {
|
||||
|
@ -225,12 +225,12 @@ namespace pvpgn
|
|||
bnet_hash(&secret_hash, sizeof(temp), &temp);
|
||||
bnhash_to_hash(packet->u.d2cs_bnetd_accountloginreq.secret_hash, &try_hash);
|
||||
if (hash_eq(try_hash, secret_hash) == 1) {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "user %s loggedin on d2cs",
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "user {} loggedin on d2cs",
|
||||
account);
|
||||
reply = BNETD_D2CS_ACCOUNTLOGINREPLY_SUCCEED;
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user %s hash not match",
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user {} hash not match",
|
||||
account);
|
||||
reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILED;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
if (!(client = connlist_find_connection_by_sessionnum(sessionnum))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user %d not found", sessionnum);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user {} not found", sessionnum);
|
||||
reply = BNETD_D2CS_CHARLOGINREPLY_FAILED;
|
||||
}
|
||||
else if (!(clienttag = clienttag_uint_to_str(conn_get_clienttag(client)))) {
|
||||
|
@ -303,7 +303,7 @@ namespace pvpgn
|
|||
conn_set_realminfo(client, temp);
|
||||
xfree(temp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__,
|
||||
"loaded portrait for character %s", charname);
|
||||
"loaded portrait for character {}", charname);
|
||||
}
|
||||
if ((rpacket = packet_create(packet_class_d2cs_bnetd))) {
|
||||
packet_set_size(rpacket, sizeof(t_bnetd_d2cs_charloginreply));
|
||||
|
@ -329,7 +329,7 @@ namespace pvpgn
|
|||
conn_push_outqueue(c, packet);
|
||||
packet_del_ref(packet);
|
||||
}
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sent init packet to d2cs (sessionnum=%d)",
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sent init packet to d2cs (sessionnum={})",
|
||||
conn_get_sessionnum(c));
|
||||
return 0;
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ namespace pvpgn
|
|||
if (!(game = gamelist_find_game(gamename, CLIENTTAG_DIABLO2DV_UINT, game_type_diablo2closed))
|
||||
&& !(game = gamelist_find_game(gamename, CLIENTTAG_DIABLO2XP_UINT, game_type_diablo2closed)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "reply for unknown game \"%s\"", gamename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "reply for unknown game \"{}\"", gamename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,12 @@ namespace pvpgn
|
|||
{
|
||||
if (!c)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL connection", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (!packet)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL packet", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
/* REMOVED BY UNDYING SOULZZ 4/3/02 */
|
||||
|
@ -66,7 +66,7 @@ namespace pvpgn
|
|||
|
||||
if (!(rawname = packet_get_str_const(packet, sizeof(t_client_file_req), MAX_FILENAME_STR)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad FILE_REQ (missing or too long filename)", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad FILE_REQ (missing or too long filename)", conn_get_socket(c));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unknown file packet type 0x%04x, len %u", conn_get_socket(c), packet_get_type(packet), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unknown file packet type 0x{:04x}, len {}", conn_get_socket(c), packet_get_type(packet), packet_get_size(packet));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -112,14 +112,14 @@ namespace pvpgn
|
|||
break;
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unknown file packet type 0x%04x, len %u", conn_get_socket(c), packet_get_type(packet), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unknown file packet type 0x{:04x}, len {}", conn_get_socket(c), packet_get_type(packet), packet_get_size(packet));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unknown file connection state %d", conn_get_socket(c), (int)conn_get_state(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unknown file connection state {}", conn_get_socket(c), (int)conn_get_state(c));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -41,24 +41,24 @@ namespace pvpgn
|
|||
{
|
||||
if (!c)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL connection", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (!packet)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL packet", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (packet_get_class(packet) != packet_class_init)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad packet (class %d)", conn_get_socket(c), (int)packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad packet (class {})", conn_get_socket(c), (int)packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
if ((prefs_get_max_conns_per_IP() != 0) &&
|
||||
bn_byte_get(packet->u.client_initconn.cclass) != CLIENT_INITCONN_CLASS_D2CS_BNETD &&
|
||||
(connlist_count_connections(conn_get_addr(c)) > prefs_get_max_conns_per_IP()))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] too many connections from address %s (closing connection)", conn_get_socket(c), addr_num_to_addr_str(conn_get_addr(c), conn_get_port(c)));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] too many connections from address {} (closing connection)", conn_get_socket(c), addr_num_to_addr_str(conn_get_addr(c), conn_get_port(c)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -68,28 +68,28 @@ namespace pvpgn
|
|||
switch (bn_byte_get(packet->u.client_initconn.cclass))
|
||||
{
|
||||
case CLIENT_INITCONN_CLASS_BNET:
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] client initiated bnet connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] client initiated bnet connection", conn_get_socket(c));
|
||||
conn_set_state(c, conn_state_connected);
|
||||
conn_set_class(c, conn_class_bnet);
|
||||
|
||||
break;
|
||||
|
||||
case CLIENT_INITCONN_CLASS_FILE:
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] client initiated file download connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] client initiated file download connection", conn_get_socket(c));
|
||||
conn_set_state(c, conn_state_connected);
|
||||
conn_set_class(c, conn_class_file);
|
||||
|
||||
break;
|
||||
|
||||
case CLIENT_INITCONN_CLASS_BOT:
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] client initiated chat bot connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] client initiated chat bot connection", conn_get_socket(c));
|
||||
conn_set_state(c, conn_state_connected);
|
||||
conn_set_class(c, conn_class_bot);
|
||||
|
||||
break;
|
||||
|
||||
case CLIENT_INITCONN_CLASS_TELNET:
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] client initiated telnet connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] client initiated telnet connection", conn_get_socket(c));
|
||||
conn_set_state(c, conn_state_connected);
|
||||
conn_set_class(c, conn_class_telnet);
|
||||
|
||||
|
@ -97,11 +97,11 @@ namespace pvpgn
|
|||
|
||||
case CLIENT_INITCONN_CLASS_D2CS_BNETD:
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] client initiated d2cs_bnetd connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] client initiated d2cs_bnetd connection", conn_get_socket(c));
|
||||
|
||||
if (!(realmlist_find_realm_by_ip(conn_get_addr(c))))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] d2cs connection from unknown ip address %s", conn_get_socket(c), addr_num_to_addr_str(conn_get_addr(c), conn_get_port(c)));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] d2cs connection from unknown ip address {}", conn_get_socket(c), addr_num_to_addr_str(conn_get_addr(c), conn_get_port(c)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -116,12 +116,12 @@ namespace pvpgn
|
|||
break;
|
||||
|
||||
case CLIENT_INITCONN_CLASS_ENC:
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] client initiated encrypted connection (not supported)", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] client initiated encrypted connection (not supported)", conn_get_socket(c));
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case CLIENT_INITCONN_CLASS_LOCALMACHINE:
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] client initiated connection from local computer to 127.0.0.1", conn_get_socket(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] client initiated connection from local computer to 127.0.0.1", conn_get_socket(c));
|
||||
/*
|
||||
conn_set_state(c, conn_state_connected);
|
||||
conn_set_class(c, conn_class_localmachine;
|
||||
|
@ -130,12 +130,12 @@ namespace pvpgn
|
|||
break;
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] client requested unknown class 0x%02x (length %d) (closing connection)", conn_get_socket(c), (unsigned int)bn_byte_get(packet->u.client_initconn.cclass), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] client requested unknown class 0x{:02x} (length {}) (closing connection)", conn_get_socket(c), (unsigned int)bn_byte_get(packet->u.client_initconn.cclass), packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unknown init packet type 0x%04x, len %u", conn_get_socket(c), packet_get_type(packet), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unknown init packet type 0x{:04x}, len {}", conn_get_socket(c), packet_get_type(packet), packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ namespace pvpgn
|
|||
irc_send(conn, ERR_ALREADYREGISTRED, ":You are already registred");
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] got USER: user=\"%s\" realname=\"%s\"", conn_get_socket(conn), user, realname);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] got USER: user=\"{}\" realname=\"{}\"", conn_get_socket(conn), user, realname);
|
||||
conn_set_user(conn, user);
|
||||
conn_set_owner(conn, realname);
|
||||
if (conn_get_loggeduser(conn))
|
||||
|
@ -297,7 +297,7 @@ namespace pvpgn
|
|||
break;
|
||||
}
|
||||
default:;
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "got /msg in unexpected connection state (%s)", conn_state_get_str(conn_get_state(conn)));
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "got /msg in unexpected connection state ({})", conn_state_get_str(conn_get_state(conn)));
|
||||
}
|
||||
}
|
||||
else if (strcasecmp(text, "register") == 0) {
|
||||
|
@ -329,13 +329,13 @@ namespace pvpgn
|
|||
temp = accountlist_create_account(username, hash_get_str(passhash));
|
||||
if (!temp) {
|
||||
message_send_text(conn, message_type_error, conn, "Failed to create account!");
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] account \"%s\" not created (failed)", conn_get_socket(conn), username);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] account \"{}\" not created (failed)", conn_get_socket(conn), username);
|
||||
conn_unget_chatname(conn, username);
|
||||
break;
|
||||
}
|
||||
|
||||
message_send_text(conn, message_type_info, conn, std::string("Account #" + std::to_string(account_get_uid(temp)) + " created."));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] account \"%s\" created", conn_get_socket(conn), username);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] account \"{}\" created", conn_get_socket(conn), username);
|
||||
conn_unget_chatname(conn, username);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace pvpgn
|
|||
first = 0;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] got \"%s\" \"%s\" [%s] \"%s\"", conn_get_socket(conn), ((prefix) ? (prefix) : ("")), command, paramtemp, ((text) ? (text) : ("")));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] got \"{}\" \"{}\" [{}] \"{}\"", conn_get_socket(conn), ((prefix) ? (prefix) : ("")), command, paramtemp, ((text) ? (text) : ("")));
|
||||
|
||||
if (conn_get_class(conn) == conn_class_ircinit) {
|
||||
handle_irc_common_set_class(conn, command, numparams, params, text);
|
||||
|
@ -331,10 +331,10 @@ namespace pvpgn
|
|||
ircline[ircpos++] = data[i];
|
||||
else {
|
||||
ircpos++; /* for the statistic :) */
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] client exceeded maximum allowed message length by %d characters", conn_get_socket(conn), ircpos - MAX_IRC_MESSAGE_LEN);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] client exceeded maximum allowed message length by {} characters", conn_get_socket(conn), ircpos - MAX_IRC_MESSAGE_LEN);
|
||||
if (ircpos > 100 + MAX_IRC_MESSAGE_LEN) {
|
||||
/* automatic flood protection */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] excess flood", conn_get_socket(conn));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] excess flood", conn_get_socket(conn));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,17 +52,17 @@ namespace pvpgn
|
|||
|
||||
if (!c)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL connection", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (!packet)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL packet", conn_get_socket(c));
|
||||
return -1;
|
||||
}
|
||||
if (packet_get_class(packet) != packet_class_raw)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad packet (class %d)", conn_get_socket(c), (int)packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad packet (class {})", conn_get_socket(c), (int)packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace pvpgn
|
|||
return 0;
|
||||
if (!linestr)
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] line too long", conn_get_socket(c));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] line too long", conn_get_socket(c));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -98,14 +98,14 @@ namespace pvpgn
|
|||
conn_set_state(c, conn_state_bot_password);
|
||||
|
||||
if (conn_set_loggeduser(c, temp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not set username to \"%s\"", conn_get_socket(c), temp);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not set username to \"{}\"", conn_get_socket(c), temp);
|
||||
|
||||
{
|
||||
char const * const msg = "\r\nPassword: ";
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
#if 0 /* don't echo */
|
||||
|
@ -122,14 +122,14 @@ namespace pvpgn
|
|||
conn_set_state(c, conn_state_bot_password);
|
||||
|
||||
if (conn_set_loggeduser(c, linestr) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not set username to \"%s\"", conn_get_socket(c), linestr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not set username to \"{}\"", conn_get_socket(c), linestr);
|
||||
|
||||
{
|
||||
char const * const temp = "\r\nPassword: ";
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
#if 0 /* don't echo */
|
||||
|
@ -159,7 +159,7 @@ namespace pvpgn
|
|||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -170,12 +170,12 @@ namespace pvpgn
|
|||
}
|
||||
if (connlist_find_connection_by_accountname(loggeduser))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (already logged in)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (already logged in)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -186,12 +186,12 @@ namespace pvpgn
|
|||
}
|
||||
if (!(account = accountlist_find_account(loggeduser)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (bad account)", conn_get_socket(c), loggeduser);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (bad account)", conn_get_socket(c), loggeduser);
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -204,12 +204,12 @@ namespace pvpgn
|
|||
{
|
||||
if (hash_set_str(&oldpasshash1, oldstrhash1) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (corrupted passhash1?)", conn_get_socket(c), account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (corrupted passhash1?)", conn_get_socket(c), account_get_name(account));
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -225,14 +225,14 @@ namespace pvpgn
|
|||
}
|
||||
if (bnet_hash(&trypasshash1, std::strlen(testpass), testpass) < 0) /* FIXME: force to lowercase */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (unable to hash password)", conn_get_socket(c), account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (unable to hash password)", conn_get_socket(c), account_get_name(account));
|
||||
xfree(testpass);
|
||||
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -244,12 +244,12 @@ namespace pvpgn
|
|||
xfree(testpass);
|
||||
if (hash_eq(trypasshash1, oldpasshash1) != 1)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (wrong password)", conn_get_socket(c), account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (wrong password)", conn_get_socket(c), account_get_name(account));
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -262,12 +262,12 @@ namespace pvpgn
|
|||
|
||||
if (account_get_auth_botlogin(account) != 1) /* default to false */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (no bot access)", conn_get_socket(c), account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (no bot access)", conn_get_socket(c), account_get_name(account));
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -278,12 +278,12 @@ namespace pvpgn
|
|||
}
|
||||
else if (account_get_auth_lock(account) == 1) /* default to false */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] bot login for \"%s\" refused (this account is locked)", conn_get_socket(c), account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] bot login for \"{}\" refused (this account is locked)", conn_get_socket(c), account_get_name(account));
|
||||
conn_set_state(c, conn_state_bot_username);
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ namespace pvpgn
|
|||
break;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] \"%s\" bot logged in (correct password)", conn_get_socket(c), account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] \"{}\" bot logged in (correct password)", conn_get_socket(c), account_get_name(account));
|
||||
#ifdef WITH_LUA
|
||||
if (lua_handle_user(c, NULL, NULL, luaevent_user_login) == 1)
|
||||
{
|
||||
|
@ -304,10 +304,10 @@ namespace pvpgn
|
|||
#endif
|
||||
}
|
||||
else
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] \"%s\" bot logged in (no password)", conn_get_socket(c), account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] \"{}\" bot logged in (no password)", conn_get_socket(c), account_get_name(account));
|
||||
|
||||
if (!(rpacket = packet_create(packet_class_raw))) /* if we got this far, let them std::log in even if this fails */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not create rpacket", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not create rpacket", conn_get_socket(c));
|
||||
else
|
||||
{
|
||||
packet_append_ntstring(rpacket, "\r\n");
|
||||
|
@ -343,7 +343,7 @@ namespace pvpgn
|
|||
break;
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unknown telnet connection state %d", conn_get_socket(c), (int)conn_get_state(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unknown telnet connection state {}", conn_get_socket(c), (int)conn_get_state(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,12 +37,12 @@ namespace pvpgn
|
|||
{
|
||||
if (!packet)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL packet", usock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL packet", usock);
|
||||
return -1;
|
||||
}
|
||||
if (packet_get_class(packet) != packet_class_udp)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad packet (class %d)", usock, (int)packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad packet (class {})", usock, (int)packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -51,25 +51,25 @@ namespace pvpgn
|
|||
case SERVER_UDPTEST: /* we might get these if a client is running on the same machine as us */
|
||||
if (packet_get_size(packet) < sizeof(t_server_udptest))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad UDPTEST packet (expected %lu bytes, got %u)", usock, sizeof(t_server_udptest), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad UDPTEST packet (expected {} bytes, got {})", usock, sizeof(t_server_udptest), packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] got UDPTEST packet from %s (myself?)", usock, addr_num_to_addr_str(src_addr, src_port));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] got UDPTEST packet from {} (myself?)", usock, addr_num_to_addr_str(src_addr, src_port));
|
||||
return 0;
|
||||
|
||||
case CLIENT_UDPPING:
|
||||
if (packet_get_size(packet) < sizeof(t_client_udpping))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad UDPPING packet (expected %lu bytes, got %u)", usock, sizeof(t_client_udpping), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad UDPPING packet (expected {} bytes, got {})", usock, sizeof(t_client_udpping), packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] got udpping unknown1=%u", usock, bn_int_get(packet->u.client_udpping.unknown1));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] got udpping unknown1={}", usock, bn_int_get(packet->u.client_udpping.unknown1));
|
||||
return 0;
|
||||
|
||||
case CLIENT_SESSIONADDR1:
|
||||
if (packet_get_size(packet) < sizeof(t_client_sessionaddr1))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad SESSIONADDR1 packet (expected %lu bytes, got %u)", usock, sizeof(t_client_sessionaddr1), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad SESSIONADDR1 packet (expected {} bytes, got {})", usock, sizeof(t_client_sessionaddr1), packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -78,12 +78,12 @@ namespace pvpgn
|
|||
|
||||
if (!(c = connlist_find_connection_by_sessionkey(bn_int_get(packet->u.client_sessionaddr1.sessionkey))))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] address not set (no connection with session key 0x%08x)", usock, bn_int_get(packet->u.client_sessionaddr1.sessionkey));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] address not set (no connection with session key 0x{:08x})", usock, bn_int_get(packet->u.client_sessionaddr1.sessionkey));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (conn_get_game_addr(c) != src_addr || conn_get_game_port(c) != src_port)
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d][%d] SESSIONADDR1 set new UDP address to %s", conn_get_socket(c), usock, addr_num_to_addr_str(src_addr, src_port));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}][{}] SESSIONADDR1 set new UDP address to {}", conn_get_socket(c), usock, addr_num_to_addr_str(src_addr, src_port));
|
||||
|
||||
conn_set_game_socket(c, usock);
|
||||
conn_set_game_addr(c, src_addr);
|
||||
|
@ -96,7 +96,7 @@ namespace pvpgn
|
|||
case CLIENT_SESSIONADDR2:
|
||||
if (packet_get_size(packet) < sizeof(t_client_sessionaddr2))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad SESSIONADDR2 packet (expected %lu bytes, got %u)", usock, sizeof(t_client_sessionaddr2), packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got bad SESSIONADDR2 packet (expected {} bytes, got {})", usock, sizeof(t_client_sessionaddr2), packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -105,17 +105,17 @@ namespace pvpgn
|
|||
|
||||
if (!(c = connlist_find_connection_by_sessionnum(bn_int_get(packet->u.client_sessionaddr2.sessionnum))))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] address not set (no connection with session number %u)", usock, bn_int_get(packet->u.client_sessionaddr2.sessionnum));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] address not set (no connection with session number {})", usock, bn_int_get(packet->u.client_sessionaddr2.sessionnum));
|
||||
return -1;
|
||||
}
|
||||
if (conn_get_sessionkey(c) != bn_int_get(packet->u.client_sessionaddr2.sessionkey))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d][%d] address not set (expected session key 0x%08x, got 0x%08x)", conn_get_socket(c), usock, conn_get_sessionkey(c), bn_int_get(packet->u.client_sessionaddr2.sessionkey));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}][{}] address not set (expected session key 0x{:08x}, got 0x{:08x})", conn_get_socket(c), usock, conn_get_sessionkey(c), bn_int_get(packet->u.client_sessionaddr2.sessionkey));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (conn_get_game_addr(c) != src_addr || conn_get_game_port(c) != src_port)
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d][%d] SESSIONADDR2 set new UDP address to %s", conn_get_socket(c), usock, addr_num_to_addr_str(src_addr, src_port));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}][{}] SESSIONADDR2 set new UDP address to {}", conn_get_socket(c), usock, addr_num_to_addr_str(src_addr, src_port));
|
||||
|
||||
conn_set_game_socket(c, usock);
|
||||
conn_set_game_addr(c, src_addr);
|
||||
|
@ -127,12 +127,12 @@ namespace pvpgn
|
|||
|
||||
case CLIENT_SEARCH_LAN_GAMES: //added by Spider
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] got SEARCH_LAN_GAMES packet from %s", usock, addr_num_to_addr_str(src_addr, src_port));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] got SEARCH_LAN_GAMES packet from {}", usock, addr_num_to_addr_str(src_addr, src_port));
|
||||
return 0;
|
||||
}
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] got unknown udp packet type 0x%04x, len %u from %s", usock, (unsigned int)packet_get_type(packet), packet_get_size(packet), addr_num_to_addr_str(src_addr, src_port));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] got unknown udp packet type 0x{:04x}, len {} from {}", usock, packet_get_type(packet), packet_get_size(packet), addr_num_to_addr_str(src_addr, src_port));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -330,7 +330,7 @@ namespace pvpgn
|
|||
irc_send(conn, ERR_ALREADYREGISTRED, ":You are already registred");
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d][** WOL **] got USER: user=\"%s\"", conn_get_socket(conn), user);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}][** WOL **] got USER: user=\"{}\"", conn_get_socket(conn), user);
|
||||
|
||||
a = accountlist_find_account(user);
|
||||
if (!a) {
|
||||
|
@ -466,11 +466,11 @@ namespace pvpgn
|
|||
data->tcount++;
|
||||
|
||||
if (game_get_status(game) != game_status_open) {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] not listing because game is not open", conn_get_socket(data->conn));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] not listing because game is not open", conn_get_socket(data->conn));
|
||||
return 0;
|
||||
}
|
||||
if (game_get_clienttag(game) != conn_get_clienttag(data->conn)) {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] not listing because game is for a different client", conn_get_socket(data->conn));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] not listing because game is for a different client", conn_get_socket(data->conn));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ namespace pvpgn
|
|||
data.counter = 0;
|
||||
data.conn = conn;
|
||||
gamelist_traverse(&append_game_info, &data, gamelist_source_none);
|
||||
DEBUG3("[%d] LIST sent %u of %u games", conn_get_socket(conn), data.counter, data.tcount);
|
||||
DEBUG3("[{}] LIST sent {} of {} games", conn_get_socket(conn), data.counter, data.tcount);
|
||||
}
|
||||
irc_send(conn, RPL_LISTEND, ":End of LIST command");
|
||||
return 0;
|
||||
|
@ -722,7 +722,7 @@ namespace pvpgn
|
|||
conn_set_clienttag(conn, clienttag);
|
||||
|
||||
std::string tmp(":none none none 1 " + std::string(params[0]) + " NONREQ");
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] VERCHK %s", tmp.c_str());
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] VERCHK {}", tmp.c_str());
|
||||
irc_send(conn, RPL_VERCHK_NONREQ, tmp.c_str());
|
||||
}
|
||||
else
|
||||
|
@ -1058,7 +1058,7 @@ namespace pvpgn
|
|||
else if ((numparams >= 7)) {
|
||||
char ** e;
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] JOINGAME: * Create * (%s, %s)",
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] JOINGAME: * Create * ({}, {})",
|
||||
params[0], params[1]);
|
||||
|
||||
if ((numparams == 7)) {
|
||||
|
@ -1074,7 +1074,7 @@ namespace pvpgn
|
|||
clanid = clan_get_clanid(clan);
|
||||
std::snprintf(_temp, sizeof(_temp), "%s %s %s %s %u %u %s :%s", params[1], params[2], params[3], params[4], clanid, conn_get_addr(conn), params[6], params[0]);
|
||||
}
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] JOINGAME [Game Options] (%s)", _temp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[** WOL **] JOINGAME [Game Options] ({})", _temp);
|
||||
|
||||
e = irc_get_listelems(params[0]);
|
||||
if ((e) && (e[0])) {
|
||||
|
@ -1626,7 +1626,7 @@ namespace pvpgn
|
|||
len = (std::strlen(command) + 6);
|
||||
|
||||
if (len > MAX_IRC_MESSAGE_LEN) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "message to send is too large (%u bytes)", len);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "message to send is too large ({} bytes)", len);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
|
@ -1636,7 +1636,7 @@ namespace pvpgn
|
|||
|
||||
packet_set_size(p, 0);
|
||||
packet_append_data(p, data, len);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] sent \"%s\"", conn_get_socket(conn), data);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] sent \"{}\"", conn_get_socket(conn), data);
|
||||
conn_push_outqueue(conn, p);
|
||||
packet_del_ref(p);
|
||||
|
||||
|
@ -1743,7 +1743,7 @@ namespace pvpgn
|
|||
// PELISH: We are not supporting ladders for all WOL clients yet
|
||||
std::strcat(data, "\r\n");
|
||||
_ladder_send(conn, data);
|
||||
DEBUG1("Wants rung search for SKU %s", params[3]);
|
||||
DEBUG1("Wants rung search for SKU {}", params[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1767,7 +1767,7 @@ namespace pvpgn
|
|||
unsigned start = std::atoi(params[0]);
|
||||
unsigned count = std::atoi(params[1]);
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Start(%u) Count(%u)", start, count);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Start({}) Count({})", start, count);
|
||||
|
||||
LadderList* ladderList = NULL;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -76,7 +76,7 @@ namespace pvpgn
|
|||
_filename = i18n_filename(filename, languages[i]);
|
||||
if (!(hfd_list[languages[i]] = std::fopen(_filename, "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open help file \"%s\" for reading (std::fopen: %s)", _filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open help file \"{}\" for reading (std::fopen: {})", _filename, std::strerror(errno));
|
||||
xfree((void*)_filename);
|
||||
return -1;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ namespace pvpgn
|
|||
if (it->second != NULL)
|
||||
{
|
||||
if (std::fclose(it->second) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close help file after reading (std::fclose: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close help file after reading (std::fclose: {})", std::strerror(errno));
|
||||
it->second = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace pvpgn
|
|||
|
||||
if (!doc.load_file(lang_filename))
|
||||
{
|
||||
ERROR1("could not parse localization file \"%s\"", lang_filename);
|
||||
ERROR1("could not parse localization file \"{}\"", lang_filename);
|
||||
xfree((void*)lang_filename);
|
||||
continue;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ namespace pvpgn
|
|||
else
|
||||
{
|
||||
translate = original;
|
||||
//WARN2("could not find translate reference refid=\"%s\", use original string (%s)", attr.value(), lang_filename.c_str());
|
||||
//WARN2("could not find translate reference refid=\"{}\", use original string ({})", attr.value(), lang_filename.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -251,7 +251,7 @@ namespace pvpgn
|
|||
if (translate[0] == '\0')
|
||||
{
|
||||
translate = original;
|
||||
//WARN2("empty translate for \"%s\", use original string (%s)", original.c_str(), lang_filename.c_str());
|
||||
//WARN2("empty translate for \"{}\", use original string ({})", original.c_str(), lang_filename.c_str());
|
||||
}
|
||||
}
|
||||
translations[original][languages[i]] = translate;
|
||||
|
@ -290,7 +290,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
WARN2("Can't format translation string \"%s\" (%s)", fmt, e.what());
|
||||
WARN2("Can't format translation string \"{}\" ({})", fmt, e.what());
|
||||
}
|
||||
|
||||
return output;
|
||||
|
|
|
@ -634,7 +634,7 @@ namespace pvpgn
|
|||
// get attribute field name from a storage
|
||||
if (!(attr_key = _find_attr_key((char*)clienttag_str)))
|
||||
{
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "could not find attr_key in iconset for tag %s", clienttag_str);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "could not find attr_key in iconset for tag {}", clienttag_str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -702,7 +702,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (!(fp = std::fopen(filename, "r"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -815,17 +815,17 @@ namespace pvpgn
|
|||
pos = 0;
|
||||
if (!(rating = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing value in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing value in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(rank = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing rank in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing rank in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(icon = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing icon in line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing icon in line {} in file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
counter++;
|
||||
|
@ -891,12 +891,12 @@ namespace pvpgn
|
|||
|
||||
if (!icon_set->attr_key)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "attr_key is null for iconset %s", icon_set->clienttag);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "attr_key is null for iconset {}", icon_set->clienttag);
|
||||
continue;
|
||||
}
|
||||
list_append_data(icon_head, icon_set);
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "loaded %u custom icons for %s", counter, icon_set->clienttag);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "loaded {} custom icons for {}", counter, icon_set->clienttag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -944,7 +944,7 @@ namespace pvpgn
|
|||
|
||||
str = str_skip_space(str + 1);
|
||||
if (!*str) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing value at line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing value at line {}", lineno);
|
||||
xfree((void*)icon_var);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -968,7 +968,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (*cp != '"') {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing end quota at line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing end quota at line {}", lineno);
|
||||
xfree((void*)icon_var);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -976,7 +976,7 @@ namespace pvpgn
|
|||
*cp = '\0';
|
||||
cp = str_skip_space(cp + 1);
|
||||
if (*cp) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "extra characters in value after ending quote at line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "extra characters in value after ending quote at line {}", lineno);
|
||||
xfree((void*)icon_var);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -987,7 +987,7 @@ namespace pvpgn
|
|||
*cp = '\0';
|
||||
cp = str_skip_space(cp + 1);
|
||||
if (*cp) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "extra characters after the value at line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "extra characters after the value at line {}", lineno);
|
||||
xfree((void*)icon_var);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp = std::fopen(filename, "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open banlist file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open banlist file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ namespace pvpgn
|
|||
|
||||
if (ipbanlist_add(NULL, ip, endtime) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "error in %.64s at line %u", filename, currline);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "error in {} at line {}", filename, currline);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ namespace pvpgn
|
|||
|
||||
file_get_line(NULL); // clear file_get_line buffer
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close banlist file \"%s\" after reading (std::fclose: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close banlist file \"{}\" after reading (std::fclose: {})", filename, std::strerror(errno));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -194,12 +194,12 @@ namespace pvpgn
|
|||
|
||||
if (!(fp = std::fopen(filename, "w")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open banlist file \"%s\" for writing (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open banlist file \"{}\" for writing (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
/* if (ftruncate(fp,0)<0)
|
||||
{
|
||||
eventlog(eventlog_level_error,__FUNCTION__,"could not truncate banlist file \"%s\" (ftruncate: %s)",filename,std::strerror(errno));
|
||||
eventlog(eventlog_level_error,__FUNCTION__,"could not truncate banlist file \"{}\" (ftruncate: {})",filename,std::strerror(errno));
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
|
@ -222,13 +222,13 @@ namespace pvpgn
|
|||
std::sprintf(line, "%s %" PRId64 "\n", ipstr, static_cast<std::int64_t>(entry->endtime));
|
||||
|
||||
if (!(std::fwrite(line, std::strlen(line), 1, fp)))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not write to banlist file (write: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not write to banlist file (write: {})", std::strerror(errno));
|
||||
xfree(ipstr);
|
||||
}
|
||||
|
||||
if (std::fclose(fp) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close banlist file \"%s\" after writing (std::fclose: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close banlist file \"{}\" after writing (std::fclose: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ namespace pvpgn
|
|||
|
||||
whole = xstrdup(ipaddr);
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "lastcheck: %u, now: %u, now-lc: %u.", (unsigned)lastchecktime, (unsigned)now, (unsigned)(now - lastchecktime));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "lastcheck: {}, now: {}, now-lc: {}.", (unsigned)lastchecktime, (unsigned)now, (unsigned)(now - lastchecktime));
|
||||
|
||||
if (now - lastchecktime >= (signed)prefs_get_ipban_check_int()) /* unsigned; no need to check prefs < 0 */
|
||||
{
|
||||
|
@ -270,12 +270,12 @@ namespace pvpgn
|
|||
|
||||
if (!ip1 || !ip2 || !ip3 || !ip4)
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got bad IP address \"%s\"", ipaddr);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got bad IP address \"{}\"", ipaddr);
|
||||
xfree(whole);
|
||||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "checking %s.%s.%s.%s", ip1, ip2, ip3, ip4);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "checking {}.{}.{}.{}", ip1, ip2, ip3, ip4);
|
||||
|
||||
counter = 0;
|
||||
LIST_TRAVERSE_CONST(ipbanlist_head, curr)
|
||||
|
@ -292,36 +292,36 @@ namespace pvpgn
|
|||
case ipban_type_exact:
|
||||
if (std::strcmp(entry->info1, ipaddr) == 0)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s matched exact %s", ipaddr, entry->info1);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} matched exact {}", ipaddr, entry->info1);
|
||||
xfree(whole);
|
||||
return counter;
|
||||
}
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s does not match exact %s", ipaddr, entry->info1);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} does not match exact {}", ipaddr, entry->info1);
|
||||
continue;
|
||||
|
||||
case ipban_type_wildcard:
|
||||
if (std::strcmp(entry->info1, "*") != 0 && std::strcmp(ip1, entry->info1) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s does not match part 1 of wildcard %s.%s.%s.%s", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} does not match part 1 of wildcard {}.{}.{}.{}", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
continue;
|
||||
}
|
||||
if (std::strcmp(entry->info2, "*") != 0 && std::strcmp(ip2, entry->info2) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s does not match part 2 of wildcard %s.%s.%s.%s", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} does not match part 2 of wildcard {}.{}.{}.{}", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
continue;
|
||||
}
|
||||
if (std::strcmp(entry->info3, "*") != 0 && std::strcmp(ip3, entry->info3) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s does not match part 3 of wildcard %s.%s.%s.%s", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} does not match part 3 of wildcard {}.{}.{}.{}", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
continue;
|
||||
}
|
||||
if (std::strcmp(entry->info4, "*") != 0 && std::strcmp(ip4, entry->info4) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s does not match part 4 of wildcard %s.%s.%s.%s", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} does not match part 4 of wildcard {}.{}.{}.{}", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
continue;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s matched wildcard %s.%s.%s.%s", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} matched wildcard {}.{}.{}.{}", ipaddr, entry->info1, entry->info2, entry->info3, entry->info4);
|
||||
xfree(whole);
|
||||
return counter;
|
||||
|
||||
|
@ -329,11 +329,11 @@ namespace pvpgn
|
|||
if ((ipban_str_to_ulong(ipaddr) >= ipban_str_to_ulong(entry->info1)) &&
|
||||
(ipban_str_to_ulong(ipaddr) <= ipban_str_to_ulong(entry->info2)))
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s matched range %s-%s", ipaddr, entry->info1, entry->info2);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} matched range {}-{}", ipaddr, entry->info1, entry->info2);
|
||||
xfree(whole);
|
||||
return counter;
|
||||
}
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s does not match range %s-%s", ipaddr, entry->info1, entry->info2);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} does not match range {}-{}", ipaddr, entry->info1, entry->info2);
|
||||
continue;
|
||||
|
||||
case ipban_type_netmask:
|
||||
|
@ -353,11 +353,11 @@ namespace pvpgn
|
|||
lip2 = lip2 & netmask;
|
||||
if (lip1 == lip2)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s matched netmask %s/%s", ipaddr, entry->info1, entry->info2);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} matched netmask {}/{}", ipaddr, entry->info1, entry->info2);
|
||||
xfree(whole);
|
||||
return counter;
|
||||
}
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s does not match netmask %s/%s", ipaddr, entry->info1, entry->info2);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} does not match netmask {}/{}", ipaddr, entry->info1, entry->info2);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -377,15 +377,15 @@ namespace pvpgn
|
|||
lip2 = lip2 >> (32 - prefix);
|
||||
if (lip1 == lip2)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s matched prefix %s/%s", ipaddr, entry->info1, entry->info2);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} matched prefix {}/{}", ipaddr, entry->info1, entry->info2);
|
||||
xfree(whole);
|
||||
return counter;
|
||||
}
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address %s does not match prefix %s/%s", ipaddr, entry->info1, entry->info2);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "address {} does not match prefix {}/{}", ipaddr, entry->info1, entry->info2);
|
||||
continue;
|
||||
}
|
||||
default: /* unknown type */
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "found bad ban type %d", (int)entry->type);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "found bad ban type {}", (int)entry->type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ namespace pvpgn
|
|||
{
|
||||
if (c)
|
||||
message_send_text(c, message_type_error, c, localize(c, "Bad IP."));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not convert to t_ipban_entry: \"%s\"", cp);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not convert to t_ipban_entry: \"{}\"", cp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ namespace pvpgn
|
|||
if (endtime == 0)
|
||||
{
|
||||
msgtemp = localize(c, "{} banned permamently by {}.", cp, conn_get_username(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "%s", msgtemp.c_str());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "{}", msgtemp.c_str());
|
||||
message_send_admins(c, message_type_info, msgtemp.c_str());
|
||||
msgtemp = localize(c, "{} banned permamently.", cp);
|
||||
message_send_text(c, message_type_info, c, msgtemp);
|
||||
|
@ -425,7 +425,7 @@ namespace pvpgn
|
|||
else
|
||||
{
|
||||
msgtemp = localize(c, "{} banned for {} by {}.", cp, seconds_to_timestr(entry->endtime - now), conn_get_username(c));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "%s", msgtemp.c_str());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "{}", msgtemp.c_str());
|
||||
message_send_admins(c, message_type_info, msgtemp.c_str());
|
||||
msgtemp = localize(c, "{} banned for {}.", cp, seconds_to_timestr(entry->endtime - now));
|
||||
message_send_text(c, message_type_info, c, msgtemp);
|
||||
|
@ -453,7 +453,7 @@ namespace pvpgn
|
|||
}
|
||||
if ((entry->endtime - now <= 0) && (entry->endtime != 0))
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "removing item: %s", entry->info1);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "removing item: {}", entry->info1);
|
||||
removed = 1;
|
||||
if (list_remove_elem(ipbanlist_head, &curr) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not remove item");
|
||||
|
@ -495,7 +495,7 @@ namespace pvpgn
|
|||
|
||||
if (clockstr_to_seconds(minstr, &bmin) < 0) /* it thinks these are seconds but we treat them as minutes */
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not convert to minutes: \"%s\"", timestr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not convert to minutes: \"{}\"", timestr);
|
||||
return -1;
|
||||
}
|
||||
if (bmin == 0)
|
||||
|
@ -748,7 +748,7 @@ namespace pvpgn
|
|||
return 1;
|
||||
break;
|
||||
default: /* unknown type */
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "found bad ban type %d", (int)e2->type);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "found bad ban type {}", (int)e2->type);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -773,7 +773,7 @@ namespace pvpgn
|
|||
xfree(e->info2);
|
||||
break;
|
||||
default: /* unknown type */
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "found bad ban type %d", (int)e->type);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "found bad ban type {}", (int)e->type);
|
||||
return -1;
|
||||
}
|
||||
xfree(e);
|
||||
|
@ -805,14 +805,14 @@ namespace pvpgn
|
|||
|
||||
if (ipban_could_be_ip_str(cp) == 0)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "string: \"%.32s\" can not be valid IP", cp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "string: \"{}\" can not be valid IP", cp);
|
||||
xfree(entry);
|
||||
return NULL;
|
||||
}
|
||||
if ((matched = std::strchr(cp, '-'))) /* range */
|
||||
{
|
||||
entry->type = ipban_type_range;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: %s matched as ipban_type_range", cp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: {} matched as ipban_type_range", cp);
|
||||
matched[0] = '\0';
|
||||
entry->info1 = xstrdup(cp); /* start of range */
|
||||
entry->info2 = xstrdup(&matched[1]); /* end of range */
|
||||
|
@ -823,7 +823,7 @@ namespace pvpgn
|
|||
if (std::strchr(cp, '*')) /* wildcard */
|
||||
{
|
||||
entry->type = ipban_type_wildcard;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: %s matched as ipban_type_wildcard", cp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: {} matched as ipban_type_wildcard", cp);
|
||||
|
||||
/* only xfree() info1! */
|
||||
whole = xstrdup(cp);
|
||||
|
@ -833,7 +833,7 @@ namespace pvpgn
|
|||
entry->info4 = std::strtok(NULL, ".");
|
||||
if (!entry->info4) /* not enough dots */
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "wildcard entry \"%s\" does not contain all four octets", cp);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "wildcard entry \"{}\" does not contain all four octets", cp);
|
||||
xfree(entry->info1);
|
||||
xfree(entry);
|
||||
xfree(cp);
|
||||
|
@ -846,12 +846,12 @@ namespace pvpgn
|
|||
if (std::strchr(&matched[1], '.'))
|
||||
{
|
||||
entry->type = ipban_type_netmask;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: %s matched as ipban_type_netmask", cp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: {} matched as ipban_type_netmask", cp);
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->type = ipban_type_prefix;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: %s matched as ipban_type_prefix", cp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: {} matched as ipban_type_prefix", cp);
|
||||
}
|
||||
|
||||
matched[0] = '\0';
|
||||
|
@ -863,7 +863,7 @@ namespace pvpgn
|
|||
else /* exact */
|
||||
{
|
||||
entry->type = ipban_type_exact;
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: %s matched as ipban_type_exact", cp);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "entry: {} matched as ipban_type_exact", cp);
|
||||
|
||||
entry->info1 = xstrdup(cp);
|
||||
entry->info2 = NULL; /* clear unused elements so debugging is nicer */
|
||||
|
@ -898,7 +898,7 @@ namespace pvpgn
|
|||
break;
|
||||
|
||||
default: /* unknown type */
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "found bad ban type %d", (int)entry->type);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "found bad ban type {}", (int)entry->type);
|
||||
return NULL;
|
||||
}
|
||||
str = xstrdup(tstr);
|
||||
|
@ -968,7 +968,7 @@ namespace pvpgn
|
|||
for (i = 0; i < strlen; i++)
|
||||
if (!std::isdigit((int)str[i]) && str[i] != '.' && str[i] != '*' && str[i] != '/' && str[i] != '-')
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "illegal character on position %i", i);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "illegal character on position {}", i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace pvpgn
|
|||
else
|
||||
std::snprintf(data, sizeof(data), ":%s %s %s", ircname, command, nick);
|
||||
|
||||
DEBUG2("[%d] sent \"%s\"", conn_get_socket(conn), data);
|
||||
DEBUG2("[{}] sent \"{}\"", conn_get_socket(conn), data);
|
||||
std::strcat(data, "\r\n");
|
||||
packet_set_size(p, 0);
|
||||
packet_append_data(p, data, std::strlen(data));
|
||||
|
@ -123,7 +123,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
if ((code > 999) || (code < 0)) { /* more than 3 digits or negative */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid message code (%d)", code);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid message code ({})", code);
|
||||
return -1;
|
||||
}
|
||||
std::sprintf(temp, "%03u", code);
|
||||
|
@ -157,7 +157,7 @@ namespace pvpgn
|
|||
std::sprintf(data, "PING :%s", server_get_hostname());
|
||||
else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "maximum message length exceeded");
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] sent \"%s\"", conn_get_socket(conn), data);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] sent \"{}\"", conn_get_socket(conn), data);
|
||||
std::strcat(data, "\r\n");
|
||||
packet_set_size(p, 0);
|
||||
packet_append_data(p, data, std::strlen(data));
|
||||
|
@ -188,7 +188,7 @@ namespace pvpgn
|
|||
std::sprintf(data, ":%s PONG %s :%s", server_get_hostname(), server_get_hostname(), params);
|
||||
else
|
||||
std::sprintf(data, ":%s PONG %s", server_get_hostname(), server_get_hostname());
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] sent \"%s\"", conn_get_socket(conn), data);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] sent \"{}\"", conn_get_socket(conn), data);
|
||||
std::strcat(data, "\r\n");
|
||||
packet_set_size(p, 0);
|
||||
packet_append_data(p, data, std::strlen(data));
|
||||
|
@ -608,7 +608,7 @@ namespace pvpgn
|
|||
else
|
||||
std::sprintf(msg, "%s %s %s%s%s", e1, e2, toname, temp, e4);
|
||||
|
||||
DEBUG2("[%d] sent \"%s\"", conn_get_socket(dest), msg);
|
||||
DEBUG2("[{}] sent \"{}\"", conn_get_socket(dest), msg);
|
||||
std::strcat(msg, "\r\n");
|
||||
|
||||
packet_set_size(packet, 0);
|
||||
|
@ -947,7 +947,7 @@ namespace pvpgn
|
|||
conn_unget_chatname(me, from.nick);
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "%d not yet implemented", type);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "{} not yet implemented", type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1300,7 +1300,7 @@ namespace pvpgn
|
|||
{
|
||||
/* NOTE: RFC2812 doesn't seem to be very expressive about this ... */
|
||||
if (conn_get_ircping(conn) == 0) {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] PONG without PING", conn_get_socket(conn));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] PONG without PING", conn_get_socket(conn));
|
||||
}
|
||||
else {
|
||||
unsigned int val = 0;
|
||||
|
@ -1322,12 +1322,12 @@ namespace pvpgn
|
|||
if (conn_get_ircping(conn) != val) {
|
||||
if ((!(sname)) || (std::strcmp(sname, server_get_hostname()) != 0)) {
|
||||
/* Actually the servername should not be always accepted but we aren't that pedantic :) */
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] got bad PONG (%u!=%u && %s!=%s)", conn_get_socket(conn), val, conn_get_ircping(conn), sname, server_get_hostname());
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] got bad PONG ({}!={} && {}!={})", conn_get_socket(conn), val, conn_get_ircping(conn), sname, server_get_hostname());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
conn_set_latency(conn, get_ticks() - conn_get_ircping(conn));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] latency is now %d (%u-%u)", conn_get_socket(conn), get_ticks() - conn_get_ircping(conn), get_ticks(), conn_get_ircping(conn));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] latency is now {} ({}-{})", conn_get_socket(conn), get_ticks() - conn_get_ircping(conn), get_ticks(), conn_get_ircping(conn));
|
||||
conn_set_ircping(conn, 0);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace pvpgn
|
|||
if (account_get_ladder_wins(account, clienttag, id) +
|
||||
account_get_ladder_losses(account, clienttag, id) > 0) /* no ladder games so far... */
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "account for \"%s\" (%s) has %u wins and %u losses but has zero rating", account_get_name(account), clienttag_uint_to_str(clienttag), account_get_ladder_wins(account, clienttag, id), account_get_ladder_losses(account, clienttag, id));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "account for \"{}\" ({}) has {} wins and {} losses but has zero rating", account_get_name(account), clienttag_uint_to_str(clienttag), account_get_ladder_wins(account, clienttag, id), account_get_ladder_losses(account, clienttag, id));
|
||||
return -1;
|
||||
}
|
||||
account_adjust_ladder_rating(account, clienttag, id, prefs_get_ladder_init_rating());
|
||||
|
@ -115,7 +115,7 @@ namespace pvpgn
|
|||
ladderlist_cg->updateEntry(uid, 0, rating, 0, reference);
|
||||
ladderlist_cw->updateEntry(uid, 0, rating, 0, reference);
|
||||
|
||||
INFO2("initialized account for \"%s\" for \"%s\" ladder", account_get_name(account), clienttag_uint_to_str(clienttag));
|
||||
INFO2("initialized account for \"{}\" for \"{}\" ladder", account_get_name(account), clienttag_uint_to_str(clienttag));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -147,7 +147,7 @@ namespace pvpgn
|
|||
|
||||
ladderlist->updateEntry(uid, 0, 0, 0, reference);
|
||||
|
||||
INFO2("initialized WOL account for \"%s\" for \"%s\" ladder", account_get_name(account), clienttag_uint_to_str(clienttag));
|
||||
INFO2("initialized WOL account for \"{}\" for \"{}\" ladder", account_get_name(account), clienttag_uint_to_str(clienttag));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -164,7 +164,7 @@ namespace pvpgn
|
|||
|
||||
if (count<1 || count>8)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid player count %u", count);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid player count {}", count);
|
||||
return -1;
|
||||
}
|
||||
if (!players)
|
||||
|
@ -275,12 +275,12 @@ namespace pvpgn
|
|||
if (results[curr] == game_result_win) {
|
||||
_cb_count_points(&points_win, &points_loss, mypoints, (mypoints == pl1_points ? pl2_points : pl1_points));
|
||||
account_set_ladder_points(players[curr], clienttag, id, mypoints + points_win);
|
||||
DEBUG3("Player %s WIN, had %u points and now have %u points", account_get_name(account), mypoints, mypoints + points_win);
|
||||
DEBUG3("Player {} WIN, had {} points and now have {} points", account_get_name(account), mypoints, mypoints + points_win);
|
||||
}
|
||||
else {
|
||||
_cb_count_points(&points_win, &points_loss, mypoints, (mypoints == pl1_points ? pl2_points : pl1_points));
|
||||
account_set_ladder_points(players[curr], clienttag, id, mypoints - points_loss);
|
||||
DEBUG3("Player %s LOSS, had %u points and now have %u points", account_get_name(account), mypoints, mypoints - points_loss);
|
||||
DEBUG3("Player {} LOSS, had {} points and now have {} points", account_get_name(account), mypoints, mypoints - points_loss);
|
||||
}
|
||||
|
||||
LadderReferencedObject reference(account);
|
||||
|
@ -309,7 +309,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "checking mapname \"%s\" maptype=%d", mapname, (int)maptype);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "checking mapname \"{}\" maptype={}", mapname, (int)maptype);
|
||||
if (maptype == game_maptype_ladder) /* FIXME: what about Ironman? */
|
||||
return 1;
|
||||
|
||||
|
@ -338,12 +338,12 @@ namespace pvpgn
|
|||
|
||||
/* first lets open files */
|
||||
if ((fd1 = std::fopen(xplevelfile, "rt")) == NULL) {
|
||||
eventlog(eventlog_level_error, "ladder_createxptable", "could not open XP level file : \"%s\"", xplevelfile);
|
||||
eventlog(eventlog_level_error, "ladder_createxptable", "could not open XP level file : \"{}\"", xplevelfile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((fd2 = std::fopen(xpcalcfile, "rt")) == NULL) {
|
||||
eventlog(eventlog_level_error, "ladder_createxptable", "could not open XP calc file : \"%s\"", xpcalcfile);
|
||||
eventlog(eventlog_level_error, "ladder_createxptable", "could not open XP calc file : \"{}\"", xpcalcfile);
|
||||
std::fclose(fd1);
|
||||
return -1;
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ namespace pvpgn
|
|||
continue;
|
||||
|
||||
if (level < 1 || level > W3_XPCALC_MAXLEVEL) { /* invalid level */
|
||||
eventlog(eventlog_level_error, "ladder_createxptable", "read INVALID player level : %d", level);
|
||||
eventlog(eventlog_level_error, "ladder_createxptable", "read INVALID player level : {}", level);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ namespace pvpgn
|
|||
xplevels[level].neededxp = neededxp;
|
||||
xplevels[level].lossfactor = (int)(lossfactor * 100); /* we store the loss factor as % */
|
||||
xplevels[level].mingames = mingames;
|
||||
eventlog(eventlog_level_trace, "ladder_createxptable", "inserting level XP info (level: %d, startxp: %d neededxp: %d lossfactor: %d mingames: %d)", level + 1, xplevels[level].startxp, xplevels[level].neededxp, xplevels[level].lossfactor, xplevels[level].mingames);
|
||||
eventlog(eventlog_level_trace, "ladder_createxptable", "inserting level XP info (level: {}, startxp: {} neededxp: {} lossfactor: {} mingames: {})", level + 1, xplevels[level].startxp, xplevels[level].neededxp, xplevels[level].lossfactor, xplevels[level].mingames);
|
||||
}
|
||||
std::fclose(fd1);
|
||||
|
||||
|
@ -396,15 +396,15 @@ namespace pvpgn
|
|||
if (std::sscanf(buffer, " %d %d %d %d %d %d ", &minlevel, &leveldiff, &higher_xpgained, &higher_xplost, &lower_xpgained, &lower_xplost) != 6)
|
||||
continue;
|
||||
|
||||
eventlog(eventlog_level_trace, "ladder_createxptable", "parsed xpcalc leveldiff : %d", leveldiff);
|
||||
eventlog(eventlog_level_trace, "ladder_createxptable", "parsed xpcalc leveldiff : {}", leveldiff);
|
||||
|
||||
if (leveldiff <0) {
|
||||
eventlog(eventlog_level_error, "ladder_createxptable", "got invalid level diff : %d", leveldiff);
|
||||
eventlog(eventlog_level_error, "ladder_createxptable", "got invalid level diff : {}", leveldiff);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (leveldiff>(w3_xpcalc_maxleveldiff + 1)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected entry for leveldiff=%u but found %u", w3_xpcalc_maxleveldiff + 1, leveldiff);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "expected entry for leveldiff={} but found {}", w3_xpcalc_maxleveldiff + 1, leveldiff);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "set war3 xpcalc maxleveldiff to %u", w3_xpcalc_maxleveldiff);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "set war3 xpcalc maxleveldiff to {}", w3_xpcalc_maxleveldiff);
|
||||
|
||||
for (j = 0; j <= w3_xpcalc_maxleveldiff; j++)
|
||||
if (xpcalc[j].higher_winxp == 0 || xpcalc[j].higher_lossxp == 0 ||
|
||||
|
@ -444,7 +444,7 @@ namespace pvpgn
|
|||
for (i = 0; i<W3_XPCALC_MAXLEVEL; i++)
|
||||
if ((i > 0 && xplevels[i].neededxp == 0) || xplevels[i].lossfactor == 0
|
||||
|| (i > 0 && (xplevels[i].startxp <= xplevels[i - 1].startxp || xplevels[i].neededxp < xplevels[i - 1].neededxp))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "I found 0 for a level XP, please check your config file (level: %d neededxp: %d lossfactor: %d)", i + 1, xplevels[i].neededxp, xplevels[i].lossfactor);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "I found 0 for a level XP, please check your config file (level: {} neededxp: {} lossfactor: {})", i + 1, xplevels[i].neededxp, xplevels[i].lossfactor);
|
||||
ladder_destroyxptable();
|
||||
return -1;
|
||||
}
|
||||
|
@ -472,12 +472,12 @@ namespace pvpgn
|
|||
absdiff = (diff < 0) ? (-diff) : diff;
|
||||
|
||||
if (absdiff > w3_xpcalc_maxleveldiff) {
|
||||
eventlog(eventlog_level_error, "ladder_war3_xpdiff", "got invalid level difference : %d", absdiff);
|
||||
eventlog(eventlog_level_error, "ladder_war3_xpdiff", "got invalid level difference : {}", absdiff);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (winnerlevel > W3_XPCALC_MAXLEVEL || looserlevel > W3_XPCALC_MAXLEVEL || winnerlevel < 1 || looserlevel < 1) {
|
||||
eventlog(eventlog_level_error, "ladder_war3_xpdiff", "got invalid account levels (win: %d loss: %d)", winnerlevel, looserlevel);
|
||||
eventlog(eventlog_level_error, "ladder_war3_xpdiff", "got invalid account levels (win: {} loss: {})", winnerlevel, looserlevel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ namespace pvpgn
|
|||
int i, mylevel;
|
||||
|
||||
if (oldlevel < 1 || oldlevel > W3_XPCALC_MAXLEVEL) {
|
||||
eventlog(eventlog_level_error, "ladder_war3_updatelevel", "got invalid level: %d", oldlevel);
|
||||
eventlog(eventlog_level_error, "ladder_war3_updatelevel", "got invalid level: {}", oldlevel);
|
||||
return oldlevel;
|
||||
}
|
||||
|
||||
|
@ -529,7 +529,7 @@ namespace pvpgn
|
|||
{
|
||||
if (Level < 1 || Level > W3_XPCALC_MAXLEVEL)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid Level %d", Level);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid Level {}", Level);
|
||||
return -1;
|
||||
}
|
||||
return xplevels[Level - 1].startxp;
|
||||
|
@ -1017,7 +1017,7 @@ namespace pvpgn
|
|||
ladder.erase(endMarker, ladder.end());
|
||||
|
||||
if ((changed))
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "adjusted rank for %u accounts", changed);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "adjusted rank for {} accounts", changed);
|
||||
saved = false;
|
||||
dirty = false;
|
||||
}
|
||||
|
@ -1051,7 +1051,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "could not open ladder file \"%s\" - maybe ladder still empty (std::ifstream: %s)", filename.c_str(), std::strerror(errno));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "could not open ladder file \"{}\" - maybe ladder still empty (std::ifstream: {})", filename.c_str(), std::strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1060,21 +1060,21 @@ namespace pvpgn
|
|||
|
||||
if (checksum != magick)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s not starting with magick", ladderFilename.c_str());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{} not starting with magick", ladderFilename.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
struct stat sfile;
|
||||
if (stat(filename.c_str(), &sfile) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "failed to retrieve size of %s", ladderFilename.c_str());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "failed to retrieve size of {}", ladderFilename.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int filesize = sfile.st_size;
|
||||
if (filesize%sizeof(unsigned int) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s has unexpected size of %u bytes (not multiple of sizeof(unsigned int)", ladderFilename.c_str(), filesize);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{} has unexpected size of {} bytes (not multiple of sizeof(unsigned int)", ladderFilename.c_str(), filesize);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1082,7 +1082,7 @@ namespace pvpgn
|
|||
|
||||
if (noe % 4 != 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s has unexpected count of entries (%u) ", ladderFilename.c_str(), noe);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{} has unexpected count of entries ({}) ", ladderFilename.c_str(), noe);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1106,7 +1106,7 @@ namespace pvpgn
|
|||
addEntry(uid, primary, secondary, tertiary, reference);
|
||||
}
|
||||
else{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "no known entry for uid %u", values[0]);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "no known entry for uid {}", values[0]);
|
||||
}
|
||||
for (int count = 0; count < 4; count++) checksum += values[count];
|
||||
}
|
||||
|
@ -1116,12 +1116,12 @@ namespace pvpgn
|
|||
|
||||
if (filechecksum != checksum)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s has invalid checksum... fall back to old loading mode", ladderFilename.c_str());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{} has invalid checksum... fall back to old loading mode", ladderFilename.c_str());
|
||||
ladder.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "successfully loaded %s", filename.c_str());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "successfully loaded {}", filename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1162,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for writing (std::ofstream: %s)", filename.c_str(), std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for writing (std::ofstream: {})", filename.c_str(), std::strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1186,7 +1186,7 @@ namespace pvpgn
|
|||
writedata(fp, checksum); // add checksum at the en
|
||||
|
||||
saved = true;
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "successfully saved %s", filename.c_str());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "successfully saved {}", filename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1314,7 +1314,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for writing (std::ofstream: %s)", filename.c_str(), std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for writing (std::ofstream: {})", filename.c_str(), std::strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ namespace pvpgn
|
|||
prob = eight_player(sorted);
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "sorry, unsupported number of ladder opponents (%u)", opponent_count);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "sorry, unsupported number of ladder opponents ({})", opponent_count);
|
||||
xfree((void *)rating);
|
||||
xfree((void *)sorted);
|
||||
return -1;
|
||||
|
@ -617,7 +617,7 @@ namespace pvpgn
|
|||
else
|
||||
delta = -std::fabs(k * prob); /* better the chance of winning -> more points subtracted */
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "computed probability=%g, k=%g, deltar=%+g", prob, k, delta);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "computed probability={}, k={}, deltar={:+g}", prob, k, delta);
|
||||
|
||||
info[curr].prob = prob;
|
||||
info[curr].k = (unsigned int)k;
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -126,11 +126,11 @@ namespace pvpgn
|
|||
st.at(1, loglevel);
|
||||
st.at(2, function);
|
||||
st.at(3, text);
|
||||
eventlog(t_eventlog_level(loglevel), function, "%s", text);
|
||||
eventlog(t_eventlog_level(loglevel), function, "{}", text);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -299,7 +299,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -382,7 +382,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -422,7 +422,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -447,7 +447,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -476,7 +476,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -503,7 +503,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -550,7 +550,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -577,7 +577,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -606,7 +606,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -633,7 +633,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -658,7 +658,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -686,7 +686,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -717,7 +717,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -748,7 +748,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -777,7 +777,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -804,7 +804,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -840,7 +840,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
|
@ -94,17 +94,17 @@ namespace pvpgn
|
|||
vm.load_file(files[i].c_str());
|
||||
|
||||
std::snprintf(_msgtemp, sizeof(_msgtemp), "%s", files[i].c_str());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "%s", _msgtemp);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "{}", _msgtemp);
|
||||
}
|
||||
|
||||
_register_functions();
|
||||
|
||||
std::snprintf(_msgtemp, sizeof(_msgtemp), "Lua sripts were successfully loaded (%zu files)", files.size());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "%s", _msgtemp);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "{}", _msgtemp);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -340,7 +340,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -401,7 +401,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -447,7 +447,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -493,7 +493,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -567,7 +567,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -601,7 +601,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -623,7 +623,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -645,7 +645,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace pvpgn
|
|||
createOpenDir();
|
||||
}
|
||||
catch (const Directory::OpenError&) {
|
||||
ERROR1("could not (re)open directory: '%s'", path.c_str());
|
||||
ERROR1("could not (re)open directory: '{}'", path.c_str());
|
||||
throw DeliverError("could not (re)open directory: " + path);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace pvpgn
|
|||
|
||||
std::ofstream fd(ostr.str().c_str());
|
||||
if (!fd) {
|
||||
ERROR1("error opening mail file. check permissions: '%s'", path.c_str());
|
||||
ERROR1("error opening mail file. check permissions: '{}'", path.c_str());
|
||||
throw DeliverError("error opening mail file. check permissions: " + path);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ namespace pvpgn
|
|||
{
|
||||
std::ifstream fd(fname.c_str());
|
||||
if (!fd) {
|
||||
ERROR1("error opening mail file: %s", fname.c_str());
|
||||
ERROR1("error opening mail file: {}", fname.c_str());
|
||||
throw ReadError("error opening mail file: " + fname);
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ namespace pvpgn
|
|||
fname += dentry;
|
||||
|
||||
if (std::remove(fname.c_str()) < 0)
|
||||
INFO2("could not remove file \"%s\" (std::remove: %s)", fname.c_str(), std::strerror(errno));
|
||||
INFO2("could not remove file \"{}\" (std::remove: {})", fname.c_str(), std::strerror(errno));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#endif
|
||||
#ifdef WIN32_GUI
|
||||
# include "common/gui_printf.h"
|
||||
# define printf gui_printf
|
||||
# define printf gui_lvprintf
|
||||
#endif
|
||||
|
||||
#include "compat/stdfileno.h"
|
||||
|
@ -195,7 +195,7 @@ int eventlog_startup(void)
|
|||
tok = std::strtok(temp, ","); /* std::strtok modifies the string it is passed */
|
||||
while (tok) {
|
||||
if (eventlog_add_level(tok) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::log level \"%s\"", tok);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::log level \"{}\"", tok);
|
||||
tok = std::strtok(NULL, ",");
|
||||
}
|
||||
xfree(temp);
|
||||
|
@ -209,14 +209,14 @@ int eventlog_startup(void)
|
|||
|
||||
if (eventlog_open(prefs_get_logfile()) < 0) {
|
||||
if (prefs_get_logfile()) {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "could not use file \"%s\" for the eventlog (exiting)", prefs_get_logfile());
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "could not use file \"{}\" for the eventlog (exiting)", prefs_get_logfile());
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "no logfile specified in configuration file \"%s\" (exiting)", cmdline_get_preffile());
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "no logfile specified in configuration file \"{}\" (exiting)", cmdline_get_preffile());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "logging event levels: %s", prefs_get_loglevels());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "logging event levels: {}", prefs_get_loglevels());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -227,13 +227,13 @@ int fork_bnetd(int foreground)
|
|||
|
||||
if (!foreground) {
|
||||
if (chdir("/") < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not change working directory to / (chdir: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not change working directory to / (chdir: {})", std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch ((pid = fork())) {
|
||||
case -1:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not fork (fork: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not fork (fork: {})", std::strerror(errno));
|
||||
return -1;
|
||||
case 0: /* child */
|
||||
break;
|
||||
|
@ -247,26 +247,26 @@ int fork_bnetd(int foreground)
|
|||
#endif
|
||||
# ifdef HAVE_SETPGID
|
||||
if (setpgid(0, 0) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgid: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgid: {})", std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# else
|
||||
# ifdef HAVE_SETPGRP
|
||||
# ifdef SETPGRP_VOID
|
||||
if (setpgrp() < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgrp: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgrp: {})", std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# else
|
||||
if (setpgrp(0, 0) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgrp: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgrp: {})", std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# endif
|
||||
# else
|
||||
# ifdef HAVE_SETSID
|
||||
if (setsid() < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setsid: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setsid: {})", std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# else
|
||||
|
@ -295,14 +295,14 @@ char * write_to_pidfile(void)
|
|||
std::FILE * fp;
|
||||
|
||||
if (!(fp = std::fopen(pidfile, "w"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open pid file \"%s\" for writing (std::fopen: %s)", pidfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open pid file \"{}\" for writing (std::fopen: {})", pidfile, std::strerror(errno));
|
||||
xfree((void *)pidfile); /* avoid warning */
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
std::fprintf(fp, "%u", (unsigned int)getpid());
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close pid file \"%s\" after writing (std::fclose: %s)", pidfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close pid file \"{}\" after writing (std::fclose: {})", pidfile, std::strerror(errno));
|
||||
}
|
||||
#else
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "no getpid() std::system call, disable pid file in bnetd.conf");
|
||||
|
@ -335,7 +335,7 @@ int pre_server_startup(void)
|
|||
}
|
||||
if (support_check_files(prefs_get_supportfile()) < 0) {
|
||||
eventlog(eventlog_level_error, "pre_server_startup", "some needed files are missing");
|
||||
eventlog(eventlog_level_error, "pre_server_startup", "please make sure you installed the supportfiles in %s", prefs_get_filedir());
|
||||
eventlog(eventlog_level_error, "pre_server_startup", "please make sure you installed the supportfiles in {}", prefs_get_filedir());
|
||||
return STATUS_SUPPORT_FAILURE;
|
||||
}
|
||||
if (anongame_maplists_create() < 0) {
|
||||
|
@ -376,7 +376,7 @@ int pre_server_startup(void)
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
|
||||
if (autoupdate_load(prefs_get_mpqfile()) < 0)
|
||||
|
@ -480,7 +480,7 @@ void post_server_shutdown(int status)
|
|||
case -1:
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad status \"%d\" during shutdown", status);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad status \"{}\" during shutdown", status);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ void post_server_shutdown(int status)
|
|||
void pvpgn_greeting()
|
||||
{
|
||||
#ifdef HAVE_GETPID
|
||||
eventlog(eventlog_level_info, __FUNCTION__, PVPGN_SOFTWARE " " PVPGN_VERSION " process %d", static_cast<int>(getpid()));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, PVPGN_SOFTWARE " " PVPGN_VERSION " process {}", getpid());
|
||||
#else
|
||||
eventlog(eventlog_level_info, __FUNCTION__, PVPGN_SOFTWARE" version "PVPGN_VERSION);
|
||||
#endif
|
||||
|
@ -496,19 +496,19 @@ void pvpgn_greeting()
|
|||
struct utsname utsbuf = {};
|
||||
if (uname(&utsbuf) == 0)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "running on %s (%s %s, %s)", utsbuf.sysname, utsbuf.version, utsbuf.release, utsbuf.machine);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "running on {} ({} {}, {})", utsbuf.sysname, utsbuf.version, utsbuf.release, utsbuf.machine);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "uname() failed");
|
||||
}
|
||||
|
||||
printf("You are currently running " PVPGN_SOFTWARE " " PVPGN_VERSION "\n");
|
||||
printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
|
||||
printf("If you need support:\n");
|
||||
printf(" * Create an issue at https://github.com/pvpgn/pvpgn-server\n");
|
||||
printf("\nServer is now running.\n");
|
||||
printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
|
||||
printf(eventlog_level_info, "You are currently running " PVPGN_SOFTWARE " " PVPGN_VERSION "\n");
|
||||
printf(eventlog_level_info, "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
|
||||
printf(eventlog_level_info, "If you need support:\n");
|
||||
printf(eventlog_level_info, " * Create an issue at https://github.com/pvpgn/pvpgn-server\n");
|
||||
printf(eventlog_level_info, "\nServer is now running.\n");
|
||||
printf(eventlog_level_info, "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ extern int main(int argc, char ** argv)
|
|||
|
||||
if (cmdline_get_hexfile()) {
|
||||
if (!(hexstrm = std::fopen(cmdline_get_hexfile(), "w")))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for writing the hexdump (std::fopen: %s)", cmdline_get_hexfile(), std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for writing the hexdump (std::fopen: {})", cmdline_get_hexfile(), std::strerror(errno));
|
||||
else
|
||||
std::fprintf(hexstrm, "# dump generated by " PVPGN_SOFTWARE " version " PVPGN_VERSION "\n");
|
||||
}
|
||||
|
@ -577,13 +577,13 @@ extern int main(int argc, char ** argv)
|
|||
if (hexstrm) {
|
||||
std::fprintf(hexstrm, "# end of dump\n");
|
||||
if (std::fclose(hexstrm) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close hexdump file \"%s\" after writing (std::fclose: %s)", cmdline_get_hexfile(), std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close hexdump file \"{}\" after writing (std::fclose: {})", cmdline_get_hexfile(), std::strerror(errno));
|
||||
}
|
||||
|
||||
// Delete pidfile
|
||||
if (pidfile) {
|
||||
if (std::remove(pidfile) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not remove pid file \"%s\" (std::remove: %s)", pidfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not remove pid file \"{}\" (std::remove: {})", pidfile, std::strerror(errno));
|
||||
xfree((void *)pidfile); /* avoid warning */
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ namespace pvpgn
|
|||
case 'h':
|
||||
if (gethostname(&out[outpos], MAX_INC) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not get hostname (gethostname: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not get hostname (gethostname: {})", std::strerror(errno));
|
||||
std::strcpy(&out[outpos], "localhost"); /* not much else you can do */
|
||||
}
|
||||
outpos += std::strlen(&out[outpos]);
|
||||
|
@ -295,7 +295,7 @@ namespace pvpgn
|
|||
break;
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "bad formatter \"%%%c\"", in[inpos - 1]);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "bad formatter \"%{}\"", in[inpos - 1]);
|
||||
}
|
||||
|
||||
if ((outpos + MAX_INC) >= outlen)
|
||||
|
@ -328,7 +328,7 @@ namespace pvpgn
|
|||
case message_type_uniqueid:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
msgtemp = (char*)xmalloc(std::strlen(text) + 32);
|
||||
|
@ -337,7 +337,7 @@ namespace pvpgn
|
|||
case message_type_adduser:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ namespace pvpgn
|
|||
case message_type_join:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (me == dst)
|
||||
|
@ -370,7 +370,7 @@ namespace pvpgn
|
|||
case message_type_part:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ namespace pvpgn
|
|||
case message_type_kick:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -400,7 +400,7 @@ namespace pvpgn
|
|||
case message_type_quit:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -417,7 +417,7 @@ namespace pvpgn
|
|||
case message_type_page:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -449,7 +449,7 @@ namespace pvpgn
|
|||
case message_type_talk:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -481,7 +481,7 @@ namespace pvpgn
|
|||
case message_type_broadcast:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -505,7 +505,7 @@ namespace pvpgn
|
|||
case message_type_channel:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
msgtemp = (char*)xmalloc(std::strlen(text) + 32);
|
||||
|
@ -514,7 +514,7 @@ namespace pvpgn
|
|||
case message_type_userflags:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
msgtemp = xstrdup("");
|
||||
|
@ -522,12 +522,12 @@ namespace pvpgn
|
|||
case message_type_whisperack:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -552,12 +552,12 @@ namespace pvpgn
|
|||
case message_type_friendwhisperack: // [zap-zero] 20020518
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -592,7 +592,7 @@ namespace pvpgn
|
|||
case message_type_info:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -614,7 +614,7 @@ namespace pvpgn
|
|||
case message_type_error:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -636,12 +636,12 @@ namespace pvpgn
|
|||
case message_type_emote:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -668,7 +668,7 @@ namespace pvpgn
|
|||
case message_type_mode:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -680,7 +680,7 @@ namespace pvpgn
|
|||
conn_unget_chatcharname(me, tname);
|
||||
}
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad message type %d", (int)type);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad message type {}", (int)type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -736,7 +736,7 @@ namespace pvpgn
|
|||
case message_type_uniqueid: /* FIXME: need to send this for some bots, also needed to support guest accounts */
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
msgtemp = (char*)xmalloc(std::strlen(text) + 32);
|
||||
|
@ -745,7 +745,7 @@ namespace pvpgn
|
|||
case message_type_adduser:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -760,7 +760,7 @@ namespace pvpgn
|
|||
case message_type_join:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (me == dst)
|
||||
|
@ -780,7 +780,7 @@ namespace pvpgn
|
|||
case message_type_quit:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -797,7 +797,7 @@ namespace pvpgn
|
|||
case message_type_page:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -819,12 +819,12 @@ namespace pvpgn
|
|||
case message_type_talk:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -841,7 +841,7 @@ namespace pvpgn
|
|||
case message_type_broadcast:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -852,7 +852,7 @@ namespace pvpgn
|
|||
case message_type_channel:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
msgtemp = (char*)xmalloc(32 + std::strlen(text));
|
||||
|
@ -861,7 +861,7 @@ namespace pvpgn
|
|||
case message_type_userflags:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -876,12 +876,12 @@ namespace pvpgn
|
|||
case message_type_whisperack:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -896,12 +896,12 @@ namespace pvpgn
|
|||
case message_type_friendwhisperack: // [zap-zero] 20020518
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
@ -925,7 +925,7 @@ namespace pvpgn
|
|||
case message_type_info:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
msgtemp = (char*)xmalloc(32 + 16 + std::strlen(text));
|
||||
|
@ -934,7 +934,7 @@ namespace pvpgn
|
|||
case message_type_error:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
msgtemp = (char*)xmalloc(32 + 16 + std::strlen(text));
|
||||
|
@ -943,12 +943,12 @@ namespace pvpgn
|
|||
case message_type_emote:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -963,7 +963,7 @@ namespace pvpgn
|
|||
}
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad message type %d", (int)type);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad message type {}", (int)type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ namespace pvpgn
|
|||
case message_type_adduser:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_ADDUSER);
|
||||
|
@ -1035,7 +1035,7 @@ namespace pvpgn
|
|||
case message_type_join:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_JOIN);
|
||||
|
@ -1065,7 +1065,7 @@ namespace pvpgn
|
|||
case message_type_quit:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_PART);
|
||||
|
@ -1085,7 +1085,7 @@ namespace pvpgn
|
|||
case message_type_page:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -1111,12 +1111,12 @@ namespace pvpgn
|
|||
case message_type_talk:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -1136,7 +1136,7 @@ namespace pvpgn
|
|||
case message_type_broadcast:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -1156,12 +1156,12 @@ namespace pvpgn
|
|||
case message_type_channel:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_CHANNEL);
|
||||
|
@ -1186,7 +1186,7 @@ namespace pvpgn
|
|||
case message_type_userflags:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_USERFLAGS);
|
||||
|
@ -1211,12 +1211,12 @@ namespace pvpgn
|
|||
case message_type_whisperack:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_WHISPERACK);
|
||||
|
@ -1234,12 +1234,12 @@ namespace pvpgn
|
|||
case message_type_friendwhisperack: // [zap-zero] 20020518
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_WHISPERACK);
|
||||
|
@ -1262,12 +1262,12 @@ namespace pvpgn
|
|||
case message_type_channeldoesnotexist:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_CHANNELDOESNOTEXIST);
|
||||
|
@ -1292,7 +1292,7 @@ namespace pvpgn
|
|||
case message_type_info:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_INFO);
|
||||
|
@ -1304,7 +1304,7 @@ namespace pvpgn
|
|||
case message_type_error:
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.server_message.type, SERVER_MESSAGE_TYPE_ERROR);
|
||||
|
@ -1316,12 +1316,12 @@ namespace pvpgn
|
|||
case message_type_emote:
|
||||
if (!me)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL connection for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (!text)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for %s", message_type_get_str(type));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL text for {}", message_type_get_str(type));
|
||||
return -1;
|
||||
}
|
||||
if (dstflags&MF_X)
|
||||
|
@ -1339,7 +1339,7 @@ namespace pvpgn
|
|||
}
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad message type %d", (int)type);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad message type {}", (int)type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1515,7 +1515,7 @@ namespace pvpgn
|
|||
break; /* cache the NULL but dont send any error,
|
||||
* this are normal connections */
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unsupported connection class %d", (int)cclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unsupported connection class {}", (int)cclass);
|
||||
packet = NULL; /* we can cache the NULL too */
|
||||
}
|
||||
|
||||
|
@ -1664,7 +1664,7 @@ namespace pvpgn
|
|||
|
||||
if (!(line = message_format_line(dst, text)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not format input text \"%s\"", text);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not format input text \"{}\"", text);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1697,7 +1697,7 @@ namespace pvpgn
|
|||
message_send_text(dst, message_type_info, dst, &line[1]);
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown message type '%c'", line[0]);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown message type '{}'", line[0]);
|
||||
xfree(line);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace pvpgn
|
|||
|
||||
date->tm_mon = std::atoi(buff) - 1;
|
||||
if ((date->tm_mon<0) || (date->tm_mon>11)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found invalid month (%i) in news date. (format: {MM/DD/YYYY}) on line %u", date->tm_mon, line);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found invalid month ({}) in news date. (format: {MM/DD/YYYY}) on line {}", date->tm_mon, line);
|
||||
}
|
||||
|
||||
buff = p + 1;
|
||||
|
@ -63,7 +63,7 @@ namespace pvpgn
|
|||
|
||||
date->tm_mday = std::atoi(buff);
|
||||
if ((date->tm_mday<1) || (date->tm_mday>31)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found invalid month day (%i) in news date. (format: {MM/DD/YYYY}) on line %u", date->tm_mday, line);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found invalid month day ({}) in news date. (format: {MM/DD/YYYY}) on line {}", date->tm_mday, line);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace pvpgn
|
|||
date->tm_year = std::atoi(buff) - 1900;
|
||||
if (date->tm_year > 137) //limited due to 32bit t_time
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found invalid year (%i) (>2037) in news date. on line %u", date->tm_year + 1900, line);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found invalid year ({}) (>2037) in news date. on line {}", date->tm_year + 1900, line);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ namespace pvpgn
|
|||
|
||||
if (buff[0] == '{') {
|
||||
if (_news_parsetime(buff + 1, &date, line)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error parsing news date on line %u", line);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error parsing news date on line {}", line);
|
||||
xfree((void*)ENfilename);
|
||||
return -1;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ namespace pvpgn
|
|||
ni->date = std::mktime(&date);
|
||||
else {
|
||||
ni->date = std::time(NULL);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "(first) news entry seems to be missing a timestamp, please check your news file on line %u", line);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "(first) news entry seems to be missing a timestamp, please check your news file on line {}", line);
|
||||
}
|
||||
_news_insert_index(ni, buff, len, date_set);
|
||||
date_set = 2;
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp = std::fopen(status_filename, "w")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for writing (std::fopen: %s)", status_filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for writing (std::fopen: {})", status_filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -880,12 +880,12 @@ namespace pvpgn
|
|||
|
||||
fd = std::fopen(filename, "rt");
|
||||
if (!fd) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file '%s'", filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file '{}'", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (conf_load_file(fd, conf_table)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading config file '%s'", filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading config file '{}'", filename);
|
||||
std::fclose(fd);
|
||||
return -1;
|
||||
}
|
||||
|
@ -3232,11 +3232,11 @@ namespace pvpgn
|
|||
|
||||
if (!rez && valstr) {
|
||||
if (prefs_runtime_config.clan_max_members < CLAN_MIN_MEMBERS) {
|
||||
WARN1("Cannot set clan max members to %u lower than 10, setting to 10.", prefs_runtime_config.clan_max_members);
|
||||
WARN1("Cannot set clan max members to {} lower than 10, setting to 10.", prefs_runtime_config.clan_max_members);
|
||||
prefs_runtime_config.clan_max_members = CLAN_MIN_MEMBERS;
|
||||
}
|
||||
else if (prefs_runtime_config.clan_max_members > CLAN_MAX_MEMBERS) {
|
||||
WARN1("Cannot set clan max members to %u higher than 100, setting to 100.", prefs_runtime_config.clan_max_members);
|
||||
WARN1("Cannot set clan max members to {} higher than 100, setting to 100.", prefs_runtime_config.clan_max_members);
|
||||
prefs_runtime_config.clan_max_members = CLAN_MAX_MEMBERS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace pvpgn
|
|||
realm->tcp_sock = 0;
|
||||
rcm_init(&realm->rcm);
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "created realm \"%s\"", name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "created realm \"{}\"", name);
|
||||
return realm;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ namespace pvpgn
|
|||
return 0;
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "realm %s does already exist in list", name);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "realm {} does already exist in list", name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ namespace pvpgn
|
|||
}
|
||||
if (realm->active)
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "realm %s is already actived,destroy previous one", realm->name);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "realm {} is already actived,destroy previous one", realm->name);
|
||||
realm_deactive(realm);
|
||||
}
|
||||
realm->active = 1;
|
||||
|
@ -272,7 +272,7 @@ namespace pvpgn
|
|||
conn_set_realm(c, realm);
|
||||
realm->sessionnum = conn_get_sessionnum(c);
|
||||
realm->tcp_sock = conn_get_socket(c);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "realm %s actived", realm->name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "realm {} actived", realm->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ namespace pvpgn
|
|||
}
|
||||
if (!realm->active)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "realm %s is not actived", realm->name);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "realm {} is not actived", realm->name);
|
||||
return -1;
|
||||
}
|
||||
if ((c = realm_get_conn(realm)))
|
||||
|
@ -300,7 +300,7 @@ namespace pvpgn
|
|||
realm->player_number=0;
|
||||
realm->game_number=0;
|
||||
*/
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "realm %s deactived", realm->name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "realm {} deactived", realm->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp = std::fopen(filename, "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open realm file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open realm file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ namespace pvpgn
|
|||
/* skip any separators */
|
||||
for (temp = buff; *temp && (*temp == ' ' || *temp == '\t'); temp++);
|
||||
if (*temp != '"') {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed line %u in file \"%s\" (no realmname)", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed line {} in file \"{}\" (no realmname)", line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ namespace pvpgn
|
|||
/* find the next " */
|
||||
for (temp = temp2; *temp && *temp != '"'; temp++);
|
||||
if (*temp != '"' || temp == temp2) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed line %u in file \"%s\" (no realmname)", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed line {} in file \"{}\" (no realmname)", line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ namespace pvpgn
|
|||
*temp = '\0';
|
||||
name = xstrdup(temp2);
|
||||
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__,"found realmname: %s",name); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__,"found realmname: {}",name); */
|
||||
|
||||
/* skip any separators */
|
||||
for (temp = temp + 1; *temp && (*temp == '\t' || *temp == ' '); temp++);
|
||||
|
@ -379,7 +379,7 @@ namespace pvpgn
|
|||
/* find the next " */
|
||||
for (temp = temp2; *temp && *temp != '"'; temp++);
|
||||
if (*temp != '"' || temp == temp2) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed line %u in file \"%s\" (no valid description)", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed line {} in file \"{}\" (no valid description)", line, filename);
|
||||
xfree(name);
|
||||
continue;
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ namespace pvpgn
|
|||
*temp = '\0';
|
||||
desc = xstrdup(temp2);
|
||||
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__,"found realm desc: %s",desc); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__,"found realm desc: {}",desc); */
|
||||
|
||||
/* skip any separators */
|
||||
for (temp = temp + 1; *temp && (*temp == ' ' || *temp == '\t'); temp++);
|
||||
|
@ -401,10 +401,10 @@ namespace pvpgn
|
|||
|
||||
if (*temp) *temp++ = '\0'; /* if is not the end of the file, end addr and move forward */
|
||||
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__,"found realm ip: %s",temp2); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__,"found realm ip: {}",temp2); */
|
||||
|
||||
if (!(raddr = addr_create_str(temp2, 0, BNETD_REALM_PORT))) /* 0 means "this computer" */ {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid address value for field 3 on line %u in file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid address value for field 3 on line {} in file \"{}\"", line, filename);
|
||||
xfree(name);
|
||||
xfree(desc);
|
||||
continue;
|
||||
|
@ -427,7 +427,7 @@ namespace pvpgn
|
|||
}
|
||||
file_get_line(NULL); // clear file_get_line buffer
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close realm file \"%s\" after reading (std::fclose: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close realm file \"{}\" after reading (std::fclose: {})", filename, std::strerror(errno));
|
||||
return list_head;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace pvpgn
|
|||
|
||||
if (pipe(fds) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create pipe (pipe: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create pipe (pipe: {})", std::strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -89,12 +89,12 @@ namespace pvpgn
|
|||
close(fds[1]);
|
||||
|
||||
if (execlp(command, command, (char *)NULL) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not execute \"%s\" (execlp: %s)", command, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not execute \"{}\" (execlp: {})", command, std::strerror(errno));
|
||||
|
||||
std::exit(127); /* popen exec failure code */
|
||||
|
||||
case -1:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not fork (fork: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not fork (fork: {})", std::strerror(errno));
|
||||
close(fds[0]);
|
||||
close(fds[1]);
|
||||
return NULL;
|
||||
|
@ -104,7 +104,7 @@ namespace pvpgn
|
|||
|
||||
if (!(pp = fdopen(fds[0], "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not streamify output (fdopen: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not streamify output (fdopen: {})", std::strerror(errno));
|
||||
close(fds[0]);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ namespace pvpgn
|
|||
|
||||
if (std::fclose(pp) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close process (std::fclose: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close process (std::fclose: {})", std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -265,14 +265,14 @@ namespace pvpgn
|
|||
psock_errno() == PSOCK_EPROTO ||
|
||||
#endif
|
||||
0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "client aborted connection on %s (psock_accept: %s)", tempa, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "client aborted connection on {} (psock_accept: {})", tempa, pstrerror(psock_errno()));
|
||||
else /* EAGAIN can mean out of resources _or_ connection aborted :( */
|
||||
if (
|
||||
#ifdef PSOCK_EINTR
|
||||
psock_errno() != PSOCK_EINTR &&
|
||||
#endif
|
||||
1)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not accept new connection on %s (psock_accept: %s)", tempa, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not accept new connection on {} (psock_accept: {})", tempa, pstrerror(psock_errno()));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -286,19 +286,19 @@ namespace pvpgn
|
|||
char addrstr[INET_ADDRSTRLEN] = { 0 };
|
||||
if (ipbanlist_check(inet_ntop(AF_INET, &(caddr.sin_addr), addrstr, sizeof(addrstr))) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] connection from banned address %s denied (closing connection)", csocket, addrstr);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] connection from banned address {} denied (closing connection)", csocket, addrstr);
|
||||
psock_close(csocket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] accepted connection from %s on %s", csocket, addr_num_to_addr_str(ntohl(caddr.sin_addr.s_addr), ntohs(caddr.sin_port)), tempa);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] accepted connection from {} on {}", csocket, addr_num_to_addr_str(ntohl(caddr.sin_addr.s_addr), ntohs(caddr.sin_port)), tempa);
|
||||
|
||||
if (prefs_get_use_keepalive())
|
||||
{
|
||||
int val = 1;
|
||||
|
||||
if (psock_setsockopt(csocket, PSOCK_SOL_SOCKET, PSOCK_SO_KEEPALIVE, &val, (psock_t_socklen)sizeof(val)) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not set socket option SO_KEEPALIVE (psock_setsockopt: %s)", csocket, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not set socket option SO_KEEPALIVE (psock_setsockopt: {})", csocket, pstrerror(psock_errno()));
|
||||
/* not a fatal error */
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ namespace pvpgn
|
|||
rlen = sizeof(rsaddr);
|
||||
if (psock_getsockname(csocket, (struct sockaddr *)&rsaddr, &rlen) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unable to determine real local port (psock_getsockname: %s)", csocket, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unable to determine real local port (psock_getsockname: {})", csocket, pstrerror(psock_errno()));
|
||||
/* not a fatal error */
|
||||
raddr = addr_get_ip(curr_laddr);
|
||||
rport = addr_get_port(curr_laddr);
|
||||
|
@ -319,7 +319,7 @@ namespace pvpgn
|
|||
{
|
||||
if (rsaddr.sin_family != PSOCK_AF_INET)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "local address returned with bad address family %d", (int)rsaddr.sin_family);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "local address returned with bad address family {}", (int)rsaddr.sin_family);
|
||||
/* not a fatal error */
|
||||
raddr = addr_get_ip(curr_laddr);
|
||||
rport = addr_get_port(curr_laddr);
|
||||
|
@ -334,7 +334,7 @@ namespace pvpgn
|
|||
|
||||
if (psock_ctl(csocket, PSOCK_NONBLOCK) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not set TCP socket to non-blocking mode (closing connection) (psock_ctl: %s)", csocket, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not set TCP socket to non-blocking mode (closing connection) (psock_ctl: {})", csocket, pstrerror(psock_errno()));
|
||||
psock_close(csocket);
|
||||
return -1;
|
||||
}
|
||||
|
@ -344,18 +344,18 @@ namespace pvpgn
|
|||
|
||||
if (!(c = conn_create(csocket, usocket, raddr, rport, addr_get_ip(curr_laddr), addr_get_port(curr_laddr), ntohl(caddr.sin_addr.s_addr), ntohs(caddr.sin_port))))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unable to create new connection (closing connection)", csocket);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unable to create new connection (closing connection)", csocket);
|
||||
psock_close(csocket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (conn_add_fdwatch(c, handle_tcp) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unable to add socket to fdwatch pool (max connections?)", csocket);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unable to add socket to fdwatch pool (max connections?)", csocket);
|
||||
conn_set_state(c, conn_state_destroy);
|
||||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] client connected to a %s listening address", csocket, laddr_type_get_str(laddr_info->type));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] client connected to a {} listening address", csocket, laddr_type_get_str(laddr_info->type));
|
||||
switch (laddr_info->type)
|
||||
{
|
||||
case laddr_type_irc:
|
||||
|
@ -411,12 +411,12 @@ namespace pvpgn
|
|||
errlen = sizeof(err);
|
||||
if (psock_getsockopt(usocket, PSOCK_SOL_SOCKET, PSOCK_SO_ERROR, &err, &errlen) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] unable to read socket error (psock_getsockopt: %s)", usocket, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] unable to read socket error (psock_getsockopt: {})", usocket, pstrerror(psock_errno()));
|
||||
return -1;
|
||||
}
|
||||
if (errlen && err) /* if it was an error, there is no packet to read */
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] async UDP socket error notification (psock_getsockopt: %s)", usocket, pstrerror(err));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] async UDP socket error notification (psock_getsockopt: {})", usocket, pstrerror(err));
|
||||
return -1;
|
||||
}
|
||||
if (!(upacket = packet_create(packet_class_udp)))
|
||||
|
@ -450,14 +450,14 @@ namespace pvpgn
|
|||
*/
|
||||
#endif
|
||||
1)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not recv UDP datagram (psock_recvfrom: %s)", pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not recv UDP datagram (psock_recvfrom: {})", pstrerror(psock_errno()));
|
||||
packet_del_ref(upacket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fromaddr.sin_family != PSOCK_AF_INET)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got UDP datagram with bad address family %d", (int)fromaddr.sin_family);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got UDP datagram with bad address family {}", (int)fromaddr.sin_family);
|
||||
packet_del_ref(upacket);
|
||||
return -1;
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ namespace pvpgn
|
|||
}
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] connection has bad class (closing connection)", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] connection has bad class (closing connection)", conn_get_socket(c));
|
||||
conn_close_read(c);
|
||||
return -2;
|
||||
}
|
||||
|
@ -583,12 +583,12 @@ namespace pvpgn
|
|||
switch (net_recv_packet(csocket, packet, &currsize))
|
||||
{
|
||||
case -1:
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] read returned -1 (closing connection)", conn_get_socket(c));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] read returned -1 (closing connection)", conn_get_socket(c));
|
||||
conn_close_read(c);
|
||||
return -2;
|
||||
|
||||
case 0: /* still working on it */
|
||||
/* eventlog(eventlog_level_debug,__FUNCTION__,"[%d] still reading \"%s\" packet (%u of %u bytes so far)",conn_get_socket(c),packet_get_class_str(packet),conn_get_in_size(c),packet_get_size(packet)); */
|
||||
/* eventlog(eventlog_level_debug,__FUNCTION__,"[{}] still reading \"{}\" packet ({} of {} bytes so far)",conn_get_socket(c),packet_get_class_str(packet),conn_get_in_size(c),packet_get_size(packet)); */
|
||||
conn_set_in_size(c, currsize);
|
||||
break;
|
||||
|
||||
|
@ -718,7 +718,7 @@ namespace pvpgn
|
|||
ret = handle_wol_gameres_packet(c, packet);
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] bad packet class %d (closing connection)", conn_get_socket(c), (int)packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] bad packet class {} (closing connection)", conn_get_socket(c), (int)packet_get_class(packet));
|
||||
ret = -1;
|
||||
}
|
||||
packet_del_ref(packet);
|
||||
|
@ -839,7 +839,7 @@ namespace pvpgn
|
|||
#ifdef WIN32
|
||||
std::sprintf(temp, "localhost");
|
||||
#else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not get hostname: %s", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not get hostname: {}", pstrerror(errno));
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
@ -872,7 +872,7 @@ namespace pvpgn
|
|||
server_hostname = xstrdup(hn);
|
||||
}
|
||||
server_check_and_fix_hostname(server_hostname);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "set hostname to \"%s\"", server_hostname);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "set hostname to \"{}\"", server_hostname);
|
||||
}
|
||||
|
||||
extern char const * server_get_hostname(void)
|
||||
|
@ -1005,61 +1005,61 @@ namespace pvpgn
|
|||
laddr_info->ssocket = psock_socket(PSOCK_PF_INET, PSOCK_SOCK_STREAM, PSOCK_IPPROTO_TCP);
|
||||
if (laddr_info->ssocket < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create a %s listening socket (psock_socket: %s)", laddr_type_get_str(laddr_info->type), pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create a {} listening socket (psock_socket: {})", laddr_type_get_str(laddr_info->type), pstrerror(psock_errno()));
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (_set_reuseaddr(laddr_info->ssocket) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set option SO_REUSEADDR on %s socket %d (psock_setsockopt: %s)", laddr_type_get_str(laddr_info->type), laddr_info->ssocket, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set option SO_REUSEADDR on {} socket {} (psock_setsockopt: {})", laddr_type_get_str(laddr_info->type), laddr_info->ssocket, pstrerror(psock_errno()));
|
||||
/* not a fatal error... */
|
||||
|
||||
if (_bind_socket(laddr_info->ssocket, addr_get_ip(curr_laddr), addr_get_port(curr_laddr)) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not bind %s socket to address %s TCP (psock_bind: %s)", laddr_type_get_str(laddr_info->type), tempa, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not bind {} socket to address {} TCP (psock_bind: {})", laddr_type_get_str(laddr_info->type), tempa, pstrerror(psock_errno()));
|
||||
goto errsock;
|
||||
}
|
||||
|
||||
/* tell socket to listen for connections */
|
||||
if (psock_listen(laddr_info->ssocket, LISTEN_QUEUE) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set %s socket %d to listen (psock_listen: %s)", laddr_type_get_str(laddr_info->type), laddr_info->ssocket, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set {} socket {} to listen (psock_listen: {})", laddr_type_get_str(laddr_info->type), laddr_info->ssocket, pstrerror(psock_errno()));
|
||||
goto errsock;
|
||||
}
|
||||
|
||||
if (psock_ctl(laddr_info->ssocket, PSOCK_NONBLOCK) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set %s TCP listen socket to non-blocking mode (psock_ctl: %s)", laddr_type_get_str(laddr_info->type), pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set {} TCP listen socket to non-blocking mode (psock_ctl: {})", laddr_type_get_str(laddr_info->type), pstrerror(psock_errno()));
|
||||
|
||||
/* index not stored persisently because we dont need to refer to it later */
|
||||
fidx = fdwatch_add_fd(laddr_info->ssocket, fdwatch_type_read, handle_accept, curr_laddr);
|
||||
if (fidx < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add listening socket %d to fdwatch pool (max sockets?)", laddr_info->ssocket);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add listening socket {} to fdwatch pool (max sockets?)", laddr_info->ssocket);
|
||||
goto errsock;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "listening for %s connections on %s TCP", laddr_type_get_str(laddr_info->type), tempa);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "listening for {} connections on {} TCP", laddr_type_get_str(laddr_info->type), tempa);
|
||||
|
||||
if (laddr_info->type == laddr_type_bnet)
|
||||
{
|
||||
laddr_info->usocket = psock_socket(PSOCK_PF_INET, PSOCK_SOCK_DGRAM, PSOCK_IPPROTO_UDP);
|
||||
if (laddr_info->usocket < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create UDP socket (psock_socket: %s)", pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create UDP socket (psock_socket: {})", pstrerror(psock_errno()));
|
||||
goto errfdw;
|
||||
}
|
||||
|
||||
if (_set_reuseaddr(laddr_info->usocket) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set option SO_REUSEADDR on %s socket %d (psock_setsockopt: %s)", laddr_type_get_str(laddr_info->type), laddr_info->usocket, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set option SO_REUSEADDR on {} socket {} (psock_setsockopt: {})", laddr_type_get_str(laddr_info->type), laddr_info->usocket, pstrerror(psock_errno()));
|
||||
/* not a fatal error... */
|
||||
|
||||
if (_bind_socket(laddr_info->usocket, addr_get_ip(curr_laddr), addr_get_port(curr_laddr)) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not bind %s socket to address %s UDP (psock_bind: %s)", laddr_type_get_str(laddr_info->type), tempa, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not bind {} socket to address {} UDP (psock_bind: {})", laddr_type_get_str(laddr_info->type), tempa, pstrerror(psock_errno()));
|
||||
goto errusock;
|
||||
}
|
||||
|
||||
if (psock_ctl(laddr_info->usocket, PSOCK_NONBLOCK) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set %s UDP socket to non-blocking mode (psock_ctl: %s)", laddr_type_get_str(laddr_info->type), pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set {} UDP socket to non-blocking mode (psock_ctl: {})", laddr_type_get_str(laddr_info->type), pstrerror(psock_errno()));
|
||||
|
||||
/* index ignored because we never need it after this */
|
||||
if (fdwatch_add_fd(laddr_info->usocket, fdwatch_type_read, handle_udp, curr_laddr) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add listening socket %d to fdwatch pool (max sockets?)", laddr_info->usocket);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add listening socket {} to fdwatch pool (max sockets?)", laddr_info->usocket);
|
||||
goto errusock;
|
||||
}
|
||||
}
|
||||
|
@ -1090,42 +1090,42 @@ namespace pvpgn
|
|||
{
|
||||
if (sigemptyset(&save_set) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (sigemptyset(&block_set) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (sigaddset(&block_set, SIGINT) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (sigaddset(&block_set, SIGHUP) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (sigaddset(&block_set, SIGTERM) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (sigaddset(&block_set, SIGUSR1) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (sigaddset(&block_set, SIGUSR2) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (sigaddset(&block_set, SIGALRM) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not add std::signal to set (sigemptyset: {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1141,48 +1141,48 @@ namespace pvpgn
|
|||
|
||||
quit_action.sa_handler = quit_sig_handle;
|
||||
if (sigemptyset(&quit_action.sa_mask) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: {})", pstrerror(errno));
|
||||
quit_action.sa_flags = SA_RESTART;
|
||||
|
||||
restart_action.sa_handler = restart_sig_handle;
|
||||
if (sigemptyset(&restart_action.sa_mask) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: {})", pstrerror(errno));
|
||||
restart_action.sa_flags = SA_RESTART;
|
||||
|
||||
save_action.sa_handler = save_sig_handle;
|
||||
if (sigemptyset(&save_action.sa_mask) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: {})", pstrerror(errno));
|
||||
save_action.sa_flags = SA_RESTART;
|
||||
|
||||
pipe_action.sa_handler = pipe_sig_handle;
|
||||
if (sigemptyset(&pipe_action.sa_mask) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: {})", pstrerror(errno));
|
||||
pipe_action.sa_flags = SA_RESTART;
|
||||
#ifdef HAVE_SETITIMER
|
||||
timer_action.sa_handler = timer_sig_handle;
|
||||
if (sigemptyset(&timer_action.sa_mask) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: {})", pstrerror(errno));
|
||||
timer_action.sa_flags = SA_RESTART;
|
||||
#endif /* HAVE_SETITIMER */
|
||||
forced_quit_action.sa_handler = forced_quit_sig_handle;
|
||||
if (sigemptyset(&forced_quit_action.sa_mask) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not initialize std::signal set (sigemptyset: {})", pstrerror(errno));
|
||||
forced_quit_action.sa_flags = SA_RESTART;
|
||||
|
||||
if (sigaction(SIGINT, &quit_action, NULL) < 0) /* control-c */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGINT std::signal handler (sigaction: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGINT std::signal handler (sigaction: {})", pstrerror(errno));
|
||||
if (sigaction(SIGHUP, &restart_action, NULL) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGHUP std::signal handler (sigaction: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGHUP std::signal handler (sigaction: {})", pstrerror(errno));
|
||||
if (sigaction(SIGTERM, &quit_action, NULL) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGTERM std::signal handler (sigaction: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGTERM std::signal handler (sigaction: {})", pstrerror(errno));
|
||||
if (sigaction(SIGUSR1, &save_action, NULL) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGUSR1 std::signal handler (sigaction: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGUSR1 std::signal handler (sigaction: {})", pstrerror(errno));
|
||||
if (sigaction(SIGPIPE, &pipe_action, NULL) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGPIPE std::signal handler (sigaction: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGPIPE std::signal handler (sigaction: {})", pstrerror(errno));
|
||||
#ifdef HAVE_SETITIMER
|
||||
/* setup asynchronus timestamp update timer */
|
||||
if (sigaction(SIGALRM, &timer_action, NULL) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGALRM std::signal handler (sigaction: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGALRM std::signal handler (sigaction: {})", pstrerror(errno));
|
||||
|
||||
{
|
||||
struct itimerval it;
|
||||
|
@ -1193,13 +1193,13 @@ namespace pvpgn
|
|||
it.it_value.tv_usec = BNETD_JIFFIES % 1000;
|
||||
|
||||
if (setitimer(ITIMER_REAL, &it, NULL)) {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "failed to set timers (setitimer(): %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "failed to set timers (setitimer(): {})", pstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (sigaction(SIGQUIT, &forced_quit_action, NULL) < 0) /* immediate shutdown */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGQUIT std::signal handler (sigaction: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not set SIGQUIT std::signal handler (sigaction: {})", pstrerror(errno));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1284,7 +1284,7 @@ namespace pvpgn
|
|||
curr_exittime = sigexittime;
|
||||
if (curr_exittime && (curr_exittime <= now || connlist_login_get_length() < 1))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "the server is shutting down (%d connections left)", connlist_get_length());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "the server is shutting down ({} connections left)", connlist_get_length());
|
||||
clanlist_save();
|
||||
/* no need for accountlist_save() when using "force" */
|
||||
accountlist_save(FS_FORCE | FS_ALL);
|
||||
|
@ -1307,7 +1307,7 @@ namespace pvpgn
|
|||
message_send_all(message);
|
||||
message_destroy(message);
|
||||
}
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "the server will shut down in %s (%d connections remaining)", tstr, connlist_get_length());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "the server will shut down in {} ({} connections remaining)", tstr, connlist_get_length());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1373,7 +1373,7 @@ namespace pvpgn
|
|||
eventlog(eventlog_level_error, __FUNCTION__, "using default configuration");
|
||||
|
||||
if (eventlog_open(prefs_get_logfile()) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not use the file \"%s\" for the eventlog", prefs_get_logfile());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not use the file \"{}\" for the eventlog", prefs_get_logfile());
|
||||
|
||||
/* FIXME: load new network settings */
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ namespace pvpgn
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "%s", e.what());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "{}", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1531,7 +1531,7 @@ namespace pvpgn
|
|||
psock_errno() != PSOCK_EINTR &&
|
||||
#endif
|
||||
1)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "fdwatch() failed (errno: %s)", pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "fdwatch() failed (errno: {})", pstrerror(psock_errno()));
|
||||
case 0: /* timeout... no sockets need checking */
|
||||
continue;
|
||||
}
|
||||
|
@ -1588,14 +1588,14 @@ namespace pvpgn
|
|||
/* Start with the Battle.net address list */
|
||||
if (_setup_add_addrs(&laddrs, prefs_get_bnetdserv_addrs(), INADDR_ANY, BNETD_SERV_PORT, laddr_type_bnet))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create %s server address list from \"%s\"", laddr_type_get_str(laddr_type_bnet), prefs_get_bnetdserv_addrs());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create {} server address list from \"{}\"", laddr_type_get_str(laddr_type_bnet), prefs_get_bnetdserv_addrs());
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Append list of addresses to listen for IRC connections */
|
||||
if (_setup_add_addrs(&laddrs, prefs_get_irc_addrs(), INADDR_ANY, BNETD_IRC_PORT, laddr_type_irc))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create %s server address list from \"%s\"", laddr_type_get_str(laddr_type_irc), prefs_get_irc_addrs());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create {} server address list from \"{}\"", laddr_type_get_str(laddr_type_irc), prefs_get_irc_addrs());
|
||||
_shutdown_addrs(laddrs);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1603,7 +1603,7 @@ namespace pvpgn
|
|||
/* Append list of addresses to listen for WOLv1 connections */
|
||||
if (_setup_add_addrs(&laddrs, prefs_get_wolv1_addrs(), INADDR_ANY, BNETD_WOLV1_PORT, laddr_type_wolv1))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create %s server address list from \"%s\"", laddr_type_get_str(laddr_type_wolv1), prefs_get_wolv1_addrs());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create {} server address list from \"{}\"", laddr_type_get_str(laddr_type_wolv1), prefs_get_wolv1_addrs());
|
||||
_shutdown_addrs(laddrs);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1611,7 +1611,7 @@ namespace pvpgn
|
|||
/* Append list of addresses to listen for WOLv2 connections */
|
||||
if (_setup_add_addrs(&laddrs, prefs_get_wolv2_addrs(), INADDR_ANY, BNETD_WOLV2_PORT, laddr_type_wolv2))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create %s server address list from \"%s\"", laddr_type_get_str(laddr_type_wolv2), prefs_get_wolv2_addrs());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create {} server address list from \"{}\"", laddr_type_get_str(laddr_type_wolv2), prefs_get_wolv2_addrs());
|
||||
_shutdown_addrs(laddrs);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1619,7 +1619,7 @@ namespace pvpgn
|
|||
/* Append list of addresses to listen for APIREGISER connections */
|
||||
if (_setup_add_addrs(&laddrs, prefs_get_apireg_addrs(), INADDR_ANY, BNETD_APIREG_PORT, laddr_type_apireg))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create %s server address list from \"%s\"", laddr_type_get_str(laddr_type_apireg), prefs_get_apireg_addrs());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create {} server address list from \"{}\"", laddr_type_get_str(laddr_type_apireg), prefs_get_apireg_addrs());
|
||||
_shutdown_addrs(laddrs);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1627,7 +1627,7 @@ namespace pvpgn
|
|||
/* Append list of addresses to listen for WGAMERES connections */
|
||||
if (_setup_add_addrs(&laddrs, prefs_get_wgameres_addrs(), INADDR_ANY, BNETD_WGAMERES_PORT, laddr_type_wgameres))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create %s server address list from \"%s\"", laddr_type_get_str(laddr_type_wgameres), prefs_get_wgameres_addrs());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create {} server address list from \"{}\"", laddr_type_get_str(laddr_type_wgameres), prefs_get_wgameres_addrs());
|
||||
_shutdown_addrs(laddrs);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1635,7 +1635,7 @@ namespace pvpgn
|
|||
/* Append list of addresses to listen for W3ROUTE connections */
|
||||
if (_setup_add_addrs(&laddrs, prefs_get_w3route_addr(), INADDR_ANY, BNETD_W3ROUTE_PORT, laddr_type_w3route))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create %s server address list from \"%s\"", laddr_type_get_str(laddr_type_w3route), prefs_get_w3route_addr());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create {} server address list from \"{}\"", laddr_type_get_str(laddr_type_w3route), prefs_get_w3route_addr());
|
||||
_shutdown_addrs(laddrs);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1643,7 +1643,7 @@ namespace pvpgn
|
|||
/* Append list of addresses to listen for telnet connections */
|
||||
if (_setup_add_addrs(&laddrs, prefs_get_telnet_addrs(), INADDR_ANY, BNETD_TELNET_PORT, laddr_type_telnet))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create %s server address list from \"%s\"", laddr_type_get_str(laddr_type_telnet), prefs_get_telnet_addrs());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create {} server address list from \"{}\"", laddr_type_get_str(laddr_type_telnet), prefs_get_telnet_addrs());
|
||||
_shutdown_addrs(laddrs);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace pvpgn
|
|||
else if (strcasecmp(tok, "prefix") == 0)
|
||||
pref = p + 1;
|
||||
else
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "unknown token in storage_path : '%s'", tok);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "unknown token in storage_path : '{}'", tok);
|
||||
}
|
||||
|
||||
if (driver == NULL)
|
||||
|
@ -196,7 +196,7 @@ namespace pvpgn
|
|||
break;
|
||||
}
|
||||
#endif /* WITH_SQL_ODBC */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "no driver found for '%s'", driver);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "no driver found for '{}'", driver);
|
||||
xfree((void *)path);
|
||||
return -1;
|
||||
} while (0);
|
||||
|
@ -239,9 +239,9 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT max(" SQL_UID_FIELD ") FROM %sBNET", tab_prefix);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if ((result = sql->query_res(query)) == NULL) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"SELECT max(" SQL_UID_FIELD ") FROM %sBNET\"", tab_prefix);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"SELECT max(" SQL_UID_FIELD ") FROM {}BNET\"", tab_prefix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ namespace pvpgn
|
|||
if (!FLAG_ISSET(flag, ST_FORCE)) return 1;
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT DISTINCT(" SQL_UID_FIELD ") FROM %sBNET", tab_prefix);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if ((result = sql->query_res(query)) != NULL)
|
||||
{
|
||||
if (sql->num_rows(result) <= 1)
|
||||
|
@ -314,7 +314,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"%s\")", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"{}\")", query);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT cid, short, name, motd, creation_time FROM %sclan WHERE cid > 0", tab_prefix);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if ((result = sql->query_res(query)) != NULL)
|
||||
{
|
||||
if (sql->num_rows(result) < 1)
|
||||
|
@ -404,7 +404,7 @@ namespace pvpgn
|
|||
clan->members = list_create();
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT " SQL_UID_FIELD ", status, join_time FROM %sclanmember WHERE cid='%u'", tab_prefix, clan->clanid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if ((result2 = sql->query_res(query)) != NULL)
|
||||
{
|
||||
if (sql->num_rows(result2) >= 1)
|
||||
|
@ -420,7 +420,7 @@ namespace pvpgn
|
|||
continue;
|
||||
if (!(member->memberacc = accountlist_find_account_by_uid(member_uid)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "cannot find uid %u", member_uid);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "cannot find uid {}", member_uid);
|
||||
xfree((void *)member);
|
||||
continue;
|
||||
}
|
||||
|
@ -439,20 +439,20 @@ namespace pvpgn
|
|||
list_append_data(clan->members, member);
|
||||
|
||||
account_set_clanmember(member->memberacc, member);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "added member: uid: %i status: %c join_time: %u", member_uid, member->status + '0', (unsigned)member->join_time);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "added member: uid: {} status: {} join_time: {}", member_uid, member->status + '0', (unsigned)member->join_time);
|
||||
}
|
||||
sql->free_result(result2);
|
||||
cb(clan);
|
||||
}
|
||||
else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"%s\")", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"{}\")", query);
|
||||
}
|
||||
|
||||
sql->free_result(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"%s\")", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"{}\")", query);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -475,7 +475,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT count(*) FROM %sclan WHERE cid='%u'", tab_prefix, clan->clanid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if ((result = sql->query_res(query)) != NULL)
|
||||
{
|
||||
row = sql->fetch_row(result);
|
||||
|
@ -492,11 +492,11 @@ namespace pvpgn
|
|||
std::snprintf(query, sizeof(query), "INSERT INTO %sclan (cid, short, name, motd, creation_time) VALUES('%u', '%d', '%s', '%s', '%u')", tab_prefix, clan->clanid, clan->tag, clan->clanname, esc_motd, (unsigned)clan->creation_time);
|
||||
else
|
||||
std::snprintf(query, sizeof(query), "UPDATE %sclan SET short='%d', name='%s', motd='%s', creation_time='%u' WHERE cid='%u'", tab_prefix, clan->tag, clan->clanname, esc_motd, (unsigned)clan->creation_time, clan->clanid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
|
||||
if (sql->query(query) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"%s\"", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"{}\"", query);
|
||||
return -1;
|
||||
}
|
||||
LIST_TRAVERSE(clan->members, curr)
|
||||
|
@ -519,7 +519,7 @@ namespace pvpgn
|
|||
{
|
||||
uid = account_get_uid(member->memberacc);
|
||||
std::snprintf(query, sizeof(query), "SELECT count(*) FROM %sclanmember WHERE " SQL_UID_FIELD "='%u'", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if ((result = sql->query_res(query)) != NULL)
|
||||
{
|
||||
row = sql->fetch_row(result);
|
||||
|
@ -535,16 +535,16 @@ namespace pvpgn
|
|||
std::snprintf(query, sizeof(query), "INSERT INTO %sclanmember (cid, " SQL_UID_FIELD ", status, join_time) VALUES('%u', '%u', '%d', '%u')", tab_prefix, clan->clanid, uid, member->status, (unsigned)member->join_time);
|
||||
else
|
||||
std::snprintf(query, sizeof(query), "UPDATE %sclanmember SET cid='%u', status='%d', join_time='%u' WHERE " SQL_UID_FIELD "='%u'", tab_prefix, clan->clanid, member->status, (unsigned)member->join_time, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"%s\"", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"{}\"", query);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"%s\"", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"{}\"", query);
|
||||
return -1;
|
||||
}
|
||||
member->modified = 0;
|
||||
|
@ -553,7 +553,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"%s\"", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"{}\"", query);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -572,11 +572,11 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT cid FROM %sclan WHERE short = '%d'", tab_prefix, clantag);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
|
||||
if (!(result = sql->query_res(query)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"%s\")", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"{}\")", query);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -590,11 +590,11 @@ namespace pvpgn
|
|||
{
|
||||
unsigned int cid = std::atoi(row[0]);
|
||||
std::snprintf(query, sizeof(query), "DELETE FROM %sclanmember WHERE cid='%u'", tab_prefix, cid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query) != 0)
|
||||
return -1;
|
||||
std::snprintf(query, sizeof(query), "DELETE FROM %sclan WHERE cid='%u'", tab_prefix, cid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
@ -613,10 +613,10 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "DELETE FROM %sclanmember WHERE " SQL_UID_FIELD "='%u'", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"%s\"", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"{}\"", query);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT teamid, size, clienttag, lastgame, member1, member2, member3, member4, wins,losses, xp, level, rank FROM %sarrangedteam WHERE teamid > 0", tab_prefix);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if ((result = sql->query_res(query)) != NULL)
|
||||
{
|
||||
if (sql->num_rows(result) < 1)
|
||||
|
@ -707,7 +707,7 @@ namespace pvpgn
|
|||
team->level = std::atoi(row[11]);
|
||||
team->rank = std::atoi(row[12]);
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "succesfully loaded team %u", team->teamid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "succesfully loaded team {}", team->teamid);
|
||||
cb(team);
|
||||
load_team_failure:
|
||||
;
|
||||
|
@ -717,7 +717,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"%s\")", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"{}\")", query);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -737,7 +737,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT count(*) FROM %sarrangedteam WHERE teamid='%u'", tab_prefix, team->teamid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if ((result = sql->query_res(query)) != NULL)
|
||||
{
|
||||
row = sql->fetch_row(result);
|
||||
|
@ -753,16 +753,16 @@ namespace pvpgn
|
|||
std::snprintf(query, sizeof(query), "INSERT INTO %sarrangedteam (teamid, size, clienttag, lastgame, member1, member2, member3, member4, wins,losses, xp, level, rank) VALUES('%u', '%c', '%s', '%u', '%u', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d')", tab_prefix, team->teamid, team->size + '0', clienttag_uint_to_str(team->clienttag), (unsigned int)team->lastgame, team->teammembers[0], team->teammembers[1], team->teammembers[2], team->teammembers[3], team->wins, team->losses, team->xp, team->level, team->rank);
|
||||
else
|
||||
std::snprintf(query, sizeof(query), "UPDATE %sarrangedteam SET size='%c', clienttag='%s', lastgame='%u', member1='%u', member2='%u', member3='%u', member4='%u', wins='%d', losses='%d', xp='%d', level='%d', rank='%d' WHERE teamid='%u'", tab_prefix, team->size + '0', clienttag_uint_to_str(team->clienttag), (unsigned int)team->lastgame, team->teammembers[0], team->teammembers[1], team->teammembers[2], team->teammembers[3], team->wins, team->losses, team->xp, team->level, team->rank, team->teamid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"%s\"", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"{}\"", query);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"%s\"", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"{}\"", query);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -778,7 +778,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "DELETE FROM %sarrangedteam WHERE teamid='%u'", tab_prefix, teamid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query) != 0)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ namespace pvpgn
|
|||
table = &line[1];
|
||||
if (!(tmp = std::strchr(table, ']')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing ']' in line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing ']' in line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
tmp[0] = '\0';
|
||||
|
@ -496,26 +496,26 @@ namespace pvpgn
|
|||
case '"':
|
||||
if (!(_table))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found a column without previous table in line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found a column without previous table in line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
column = &line[1];
|
||||
if (!(tmp = std::strchr(column, '"')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing '\"' at the end of column definition in line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing '\"' at the end of column definition in line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
tmp[0] = '\0';
|
||||
tmp++;
|
||||
if (!(tmp = std::strchr(tmp, '"')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing default value in line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing default value in line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
value = ++tmp;
|
||||
if (!(tmp = std::strchr(value, '"')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing '\"' at the end of default value in line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing '\"' at the end of default value in line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
tmp[0] = '\0';
|
||||
|
@ -531,20 +531,20 @@ namespace pvpgn
|
|||
tmp = mode + 3;
|
||||
if (!(tmp = std::strchr(tmp, '"')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing starting '\"' in extra sql_command on line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing starting '\"' in extra sql_command on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
extra_cmd = ++tmp;
|
||||
if (!(tmp = std::strchr(extra_cmd, '"')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing ending '\"' in extra sql_command on line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing ending '\"' in extra sql_command on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
tmp[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing or non-matching secondary character in combination logic on line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing or non-matching secondary character in combination logic on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -561,18 +561,18 @@ namespace pvpgn
|
|||
case ':':
|
||||
if (!(_table))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found a sql_command without previous table in line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found a sql_command without previous table in line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
if (line[1] != '"')
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing starting '\"' in sql_command definition on line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing starting '\"' in sql_command definition on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
sqlcmd = &line[2];
|
||||
if (!(tmp = std::strchr(sqlcmd, '"')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing ending '\"' in sql_command definition on line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing ending '\"' in sql_command definition on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
tmp[0] = '\0';
|
||||
|
@ -588,20 +588,20 @@ namespace pvpgn
|
|||
tmp = mode + 3;
|
||||
if (!(tmp = std::strchr(tmp, '"')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing starting '\"' in extra sql_command on line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing starting '\"' in extra sql_command on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
extra_cmd = ++tmp;
|
||||
if (!(tmp = std::strchr(extra_cmd, '"')))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing ending '\"' in extra sql_command on line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing ending '\"' in extra sql_command on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
tmp[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing or non-matching secondary character in combination logic on line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing or non-matching secondary character in combination logic on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ namespace pvpgn
|
|||
case '#':
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "illegal starting symbol at line %i", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "illegal starting symbol at line {}", lineno);
|
||||
}
|
||||
}
|
||||
if (_table) db_layout_add_table(db_layout, _table);
|
||||
|
@ -652,8 +652,8 @@ namespace pvpgn
|
|||
//create table if missing
|
||||
if (!(sql->query(query)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added missing table %s to DB", table->name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added missing column %s to table %s", column->name, table->name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added missing table {} to DB", table->name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added missing column {} to table {}", column->name, table->name);
|
||||
}
|
||||
|
||||
for (; column; column = table_get_next_column(table))
|
||||
|
@ -661,12 +661,12 @@ namespace pvpgn
|
|||
std::sprintf(query, "ALTER TABLE %s ADD %s DEFAULT %s", table->name, column->name, column->value);
|
||||
if (!(sql->query(query)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added missing column %s to table %s", column->name, table->name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added missing column {} to table {}", column->name, table->name);
|
||||
if ((column->mode != NULL) && (std::strcmp(column->mode, "&&") == 0))
|
||||
{
|
||||
if (!(sql->query(column->extra_cmd)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: %s %s", column->mode, column->extra_cmd);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: {} {}", column->mode, column->extra_cmd);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -687,7 +687,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!(sql->query(column->extra_cmd)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: %s %s", column->mode, column->extra_cmd);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: {} {}", column->mode, column->extra_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,12 +698,12 @@ namespace pvpgn
|
|||
{
|
||||
if (!(sql->query(sqlcmd->sql_command)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: %s", sqlcmd->sql_command);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: {}", sqlcmd->sql_command);
|
||||
if ((sqlcmd->mode != NULL) && (std::strcmp(sqlcmd->mode, "&&") == 0))
|
||||
{
|
||||
if (!(sql->query(sqlcmd->extra_cmd)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: %s %s", sqlcmd->mode, sqlcmd->extra_cmd);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: {} {}", sqlcmd->mode, sqlcmd->extra_cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!(sql->query(sqlcmd->extra_cmd)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: %s %s", sqlcmd->mode, sqlcmd->extra_cmd);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "sucessfully issued: {} {}", sqlcmd->mode, sqlcmd->extra_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -725,7 +725,7 @@ namespace pvpgn
|
|||
std::sprintf(query, "INSERT INTO %s (%s) VALUES (%s)", table->name, _column, column->value);
|
||||
if (!(sql->query(query)))
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added missing default account to table %s", table->name);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added missing default account to table {}", table->name);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ namespace pvpgn
|
|||
char * tmp4 = (char *)xmalloc(std::strlen(tmp1) * 2); /* escaped string */
|
||||
unsigned int i, j;
|
||||
|
||||
/* eventlog(eventlog_level_trace,__FUNCTION__,"COMMAND: %s",tmp1); */
|
||||
/* eventlog(eventlog_level_trace,__FUNCTION__,"COMMAND: {}",tmp1); */
|
||||
|
||||
for (i = 0; tmp1[i] && i < len; i++, tmp2++)
|
||||
{
|
||||
|
@ -759,10 +759,10 @@ namespace pvpgn
|
|||
for (; tmp1[i] && tmp1[i] != '\'' && i < len; i++); /* find the end of the string to be escaped */
|
||||
|
||||
tmp1[i] = '\0'; /* set end of string with null terminator */
|
||||
/* eventlog(eventlog_level_trace,__FUNCTION__,"STRING: %s",tmp3); */
|
||||
/* eventlog(eventlog_level_trace,__FUNCTION__,"STRING: {}",tmp3); */
|
||||
|
||||
sql->escape_string(tmp4, tmp3, std::strlen(tmp3)); /* escape the string */
|
||||
/* eventlog(eventlog_level_trace,__FUNCTION__,"ESCAPE STRING: %s",tmp4); */
|
||||
/* eventlog(eventlog_level_trace,__FUNCTION__,"ESCAPE STRING: {}",tmp4); */
|
||||
|
||||
for (j = 0, tmp2++; tmp4[j]; j++, tmp2++) *tmp2 = tmp4[j]; /* add 'escaped string' to 'escape' */
|
||||
|
||||
|
@ -770,7 +770,7 @@ namespace pvpgn
|
|||
}
|
||||
}
|
||||
*tmp2 = '\0';
|
||||
/* eventlog(eventlog_level_trace,__FUNCTION__,"ESCAPED COMMAND: %s",escape); */
|
||||
/* eventlog(eventlog_level_trace,__FUNCTION__,"ESCAPED COMMAND: {}",escape); */
|
||||
|
||||
xfree(tmp1);
|
||||
xfree(tmp4);
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace pvpgn
|
|||
}
|
||||
#ifdef RUNTIME_LIBS
|
||||
if (mysql_load_dll()) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading library file \"%s\"", MYSQL_LIB);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading library file \"{}\"", MYSQL_LIB);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
@ -183,7 +183,7 @@ namespace pvpgn
|
|||
#endif
|
||||
|
||||
if (p_mysql_real_connect(mysql, host, user, pass, name, port ? atoi(port) : 0, socket, CLIENT_FOUND_ROWS) == NULL) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error connecting to database (db said: '%s')", p_mysql_error(mysql));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error connecting to database (db said: '{}')", p_mysql_error(mysql));
|
||||
p_mysql_close(mysql);
|
||||
return -1;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (p_mysql_query(mysql, query)) {
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "got error from query (%s)", query);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "got error from query ({})", query);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace pvpgn
|
|||
{
|
||||
#ifdef RUNTIME_LIBS
|
||||
if (odbc_load_dll()) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading library file \"%s\"", ODBC_LIB);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading library file \"{}\"", ODBC_LIB);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
@ -186,10 +186,10 @@ namespace pvpgn
|
|||
return odbc_Fail();
|
||||
}
|
||||
if (odbc_Result(p_SQLConnect(con, (SQLCHAR*)name, SQL_NTS, (SQLCHAR*)user, SQL_NTS, (SQLCHAR*)pass, SQL_NTS))) {
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Connected to ODBC datasource \"%s\".", name);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "Connected to ODBC datasource \"{}\".", name);
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Unable to connect to ODBC datasource \"%s\".", name);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Unable to connect to ODBC datasource \"{}\".", name);
|
||||
odbc_Error(SQL_HANDLE_DBC, con, eventlog_level_error, __FUNCTION__);
|
||||
return odbc_Fail();
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ namespace pvpgn
|
|||
eventlog(eventlog_level_error, __FUNCTION__, "Got a NULL query!");
|
||||
return NULL;
|
||||
}
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
|
||||
/* Run query and check for success. */
|
||||
p_SQLAllocStmt(con, &stmt);
|
||||
|
@ -274,7 +274,7 @@ namespace pvpgn
|
|||
return res;
|
||||
}
|
||||
else if (!odbc_Result(result)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Unable to fetch row - ODBC error %i.", result);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Unable to fetch row - ODBC error {}.", result);
|
||||
odbc_Error(SQL_HANDLE_STMT, stmt, eventlog_level_error, __FUNCTION__);
|
||||
sql_odbc_free_result(res);
|
||||
return NULL;
|
||||
|
@ -292,7 +292,7 @@ namespace pvpgn
|
|||
eventlog(eventlog_level_error, __FUNCTION__, "Got a NULL query!");
|
||||
return -1;
|
||||
}
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
|
||||
p_SQLAllocStmt(con, &stmt);
|
||||
result = odbc_Result(p_SQLExecDirect(stmt, (SQLCHAR*)query, SQL_NTS));
|
||||
|
@ -487,7 +487,7 @@ namespace pvpgn
|
|||
while (p_SQLGetDiagRec(type, obj, ++i, NULL, NULL, NULL, 0, &mTextLen) != SQL_NO_DATA) {
|
||||
SQLCHAR *mText = (SQLCHAR *)xcalloc(sizeof *mText, ++mTextLen);
|
||||
p_SQLGetDiagRec(type, obj, i, mState, &native, mText, mTextLen, NULL);
|
||||
eventlog(level, function, "ODBC Error: State %s, Native %i: %s", mState, native, mText);
|
||||
eventlog(level, function, "ODBC Error: State {}, Native {}: {}", mState, native, mText);
|
||||
xfree(mText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace pvpgn
|
|||
tmphost = host != NULL ? host : socket;
|
||||
#ifdef RUNTIME_LIBS
|
||||
if (pgsql_load_dll()) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading library file \"%s\"", PGSQL_LIB);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading library file \"{}\"", PGSQL_LIB);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
@ -168,7 +168,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (p_PQstatus(pgsql) != CONNECTION_OK) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error connecting to database (db said: '%s')", p_PQerrorMessage(pgsql));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error connecting to database (db said: '{}')", p_PQerrorMessage(pgsql));
|
||||
p_PQfinish(pgsql);
|
||||
pgsql = NULL;
|
||||
return -1;
|
||||
|
@ -208,12 +208,12 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if ((pgres = p_PQexec(pgsql, query)) == NULL) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "not enough memory for query (%s)", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "not enough memory for query ({})", query);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p_PQresultStatus(pgres) != PGRES_TUPLES_OK) {
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "got error from query (%s)", query); */
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "got error from query ({})", query); */
|
||||
p_PQclear(pgres);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ namespace pvpgn
|
|||
res->pgres = pgres;
|
||||
res->crow = 0;
|
||||
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "res: %p res->rowbuf: %p res->crow: %d res->pgres: %p", res, res->rowbuf, res->crow, res->pgres); */
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "res: {:p} res->rowbuf: {:p} res->crow: {} res->pgres: {:p}", res, res->rowbuf, res->crow, res->pgres); */
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ namespace pvpgn
|
|||
|
||||
res->crow++;
|
||||
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "res: %p res->rowbuf: %p res->crow: %d res->pgres: %p", res, res->rowbuf, res->crow, res->pgres); */
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "res: {:p} res->rowbuf: {:p} res->crow: {} res->pgres: {:p}", res, res->rowbuf, res->crow, res->pgres); */
|
||||
return res->rowbuf;
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ namespace pvpgn
|
|||
t_pgsql_res *res = (t_pgsql_res *)result;
|
||||
|
||||
if (res == NULL) return;
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "res: %p res->rowbuf: %p res->crow: %d res->pgres: %p", res, res->rowbuf, res->crow, res->pgres); */
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "res: {:p} res->rowbuf: {:p} res->crow: {} res->pgres: {:p}", res, res->rowbuf, res->crow, res->pgres); */
|
||||
|
||||
if (res->pgres) p_PQclear(res->pgres);
|
||||
if (res->rowbuf) xfree((void*)res->rowbuf);
|
||||
|
|
|
@ -130,13 +130,13 @@ namespace pvpgn
|
|||
{
|
||||
#ifdef RUNTIME_LIBS
|
||||
if (sqlite_load_library()) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading library file \"%s\"", SQLITE3_LIB);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error loading library file \"{}\"", SQLITE3_LIB);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
/* SQLite3 has no host, port, socket, user or password and the database name is the path to the db file */
|
||||
if (p_sqlite3_open(name, &db) != SQLITE_OK) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from sqlite3_open (%s)", p_sqlite3_errmsg(db));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from sqlite3_open ({})", p_sqlite3_errmsg(db));
|
||||
p_sqlite3_close(db);
|
||||
return -1;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ namespace pvpgn
|
|||
{
|
||||
if (db) {
|
||||
if (p_sqlite3_close(db) != SQLITE_OK) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from sqlite3_close (%s)", p_sqlite3_errmsg(db));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from sqlite3_close ({})", p_sqlite3_errmsg(db));
|
||||
return -1;
|
||||
}
|
||||
db = NULL;
|
||||
|
@ -179,7 +179,7 @@ namespace pvpgn
|
|||
res = (t_sqlite3_res *)xmalloc(sizeof(t_sqlite3_res));
|
||||
|
||||
if (p_sqlite3_get_table(db, query, &res->results, &res->rows, &res->columns, NULL) != SQLITE_OK) {
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "got error (%s) from query (%s)", p_sqlite3_errmsg(db), query); */
|
||||
/* eventlog(eventlog_level_debug, __FUNCTION__, "got error ({}) from query ({})", p_sqlite3_errmsg(db), query); */
|
||||
xfree((void*)res);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace pvpgn
|
|||
#ifdef WITH_SQL
|
||||
std::strcat(dstr, ", sql");
|
||||
#endif
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "initializing storage layer (available drivers: %s)", dstr);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "initializing storage layer (available drivers: {})", dstr);
|
||||
|
||||
*p = '\0';
|
||||
if (strcasecmp(spath, "file") == 0) {
|
||||
|
@ -78,7 +78,7 @@ namespace pvpgn
|
|||
}
|
||||
#endif
|
||||
else {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "no known driver specified (%s)", spath);
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "no known driver specified ({})", spath);
|
||||
res = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace pvpgn
|
|||
else if (strcasecmp(tok, "mode") == 0)
|
||||
driver = p + 1;
|
||||
else
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "unknown token in storage_path : '%s'", tok);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "unknown token in storage_path : '{}'", tok);
|
||||
}
|
||||
|
||||
if (def == NULL || clan == NULL || team == NULL || dir == NULL || driver == NULL)
|
||||
|
@ -172,7 +172,7 @@ namespace pvpgn
|
|||
file = &file_cdb;
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown mode '%s' must be either plain or cdb", driver);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown mode '{}' must be either plain or cdb", driver);
|
||||
xfree((void *)copy);
|
||||
return -1;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ namespace pvpgn
|
|||
|
||||
if (p_rename(tempname, (const char *)info) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not std::rename account file to \"%s\" (std::rename: %s)", (char *)info, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not std::rename account file to \"{}\" (std::rename: {})", (char *)info, std::strerror(errno));
|
||||
xfree(tempname);
|
||||
return -1;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "loading \"%s\"", reinterpret_cast<const char*>(info));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "loading \"{}\"", reinterpret_cast<const char*>(info));
|
||||
|
||||
if (file->read_attrs((const char *)info, cb, data))
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ namespace pvpgn
|
|||
}
|
||||
}
|
||||
catch (const Directory::OpenError& ex) {
|
||||
ERROR2("unable to open user directory \"%s\" for reading (error: %s)", accountsdir, ex.what());
|
||||
ERROR2("unable to open user directory \"{}\" for reading (error: {})", accountsdir, ex.what());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ namespace pvpgn
|
|||
{
|
||||
if (std::strlen(dentry) > 4)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found too long clan filename in clandir \"%s\"", dentry);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found too long clan filename in clandir \"{}\"", dentry);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -479,7 +479,7 @@ namespace pvpgn
|
|||
|
||||
if ((fp = std::fopen(pathname, "r")) == NULL)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't open clanfile \"%s\"", pathname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't open clanfile \"{}\"", pathname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -554,7 +554,7 @@ namespace pvpgn
|
|||
clan->modified = 0;
|
||||
clan->channel_type = prefs_get_clan_channel_default_private();
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "name: %s motd: %s clanid: %i time: %i", clanname, motd, cid, creation_time);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "name: {} motd: {} clanid: {} time: {}", clanname, motd, cid, creation_time);
|
||||
|
||||
clan->members = list_create();
|
||||
|
||||
|
@ -563,7 +563,7 @@ namespace pvpgn
|
|||
member = (t_clanmember*)xmalloc(sizeof(t_clanmember));
|
||||
if (!(member->memberacc = accountlist_find_account_by_uid(member_uid)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "cannot find uid %u", member_uid);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "cannot find uid {}", member_uid);
|
||||
xfree((void *)member);
|
||||
continue;
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ namespace pvpgn
|
|||
list_append_data(clan->members, member);
|
||||
|
||||
account_set_clanmember((t_account*)member->memberacc, member);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "added member: uid: %i status: %c join_time: %i", member_uid, member_status + '0', member_join_time);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "added member: uid: {} status: {} join_time: {}", member_uid, member_status + '0', member_join_time);
|
||||
}
|
||||
|
||||
std::fclose(fp);
|
||||
|
@ -594,7 +594,7 @@ namespace pvpgn
|
|||
|
||||
}
|
||||
catch (const Directory::OpenError& ex) {
|
||||
ERROR2("unable to open clan directory \"%s\" for reading (error: %s)", clansdir, ex.what());
|
||||
ERROR2("unable to open clan directory \"{}\" for reading (error: {})", clansdir, ex.what());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ namespace pvpgn
|
|||
|
||||
if ((fp = std::fopen(clanfile, "w")) == NULL)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't open clanfile \"%s\"", clanfile);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't open clanfile \"{}\"", clanfile);
|
||||
xfree((void *)clanfile);
|
||||
return -1;
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ namespace pvpgn
|
|||
std::sprintf(tempname, "%s/%s", clansdir, clantag_to_str(clantag));
|
||||
if (std::remove((const char *)tempname) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not delete clan file \"%s\" (std::remove: %s)", (char *)tempname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not delete clan file \"{}\" (std::remove: {})", (char *)tempname, std::strerror(errno));
|
||||
xfree(tempname);
|
||||
return -1;
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ namespace pvpgn
|
|||
{
|
||||
if (std::strlen(dentry) != 8)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found invalid team filename in teamdir \"%s\"", dentry);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found invalid team filename in teamdir \"{}\"", dentry);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ namespace pvpgn
|
|||
|
||||
if ((fp = std::fopen(pathname, "r")) == NULL)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't open teamfile \"%s\"", pathname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't open teamfile \"{}\"", pathname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -787,13 +787,13 @@ namespace pvpgn
|
|||
goto load_team_failure;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "succesfully loaded team %s", dentry);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "succesfully loaded team {}", dentry);
|
||||
cb(team);
|
||||
|
||||
goto load_team_success;
|
||||
load_team_failure:
|
||||
xfree((void*)team);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error while reading file \"%s\"", dentry);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error while reading file \"{}\"", dentry);
|
||||
|
||||
load_team_success:
|
||||
|
||||
|
@ -807,7 +807,7 @@ namespace pvpgn
|
|||
|
||||
}
|
||||
catch (const Directory::OpenError& ex) {
|
||||
ERROR2("unable to open team directory \"%s\" for reading (error: %s)", teamsdir, ex.what());
|
||||
ERROR2("unable to open team directory \"{}\" for reading (error: {})", teamsdir, ex.what());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -827,7 +827,7 @@ namespace pvpgn
|
|||
|
||||
if ((fp = std::fopen(teamfile, "w")) == NULL)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't open teamfile \"%s\"", teamfile);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't open teamfile \"{}\"", teamfile);
|
||||
xfree((void *)teamfile);
|
||||
return -1;
|
||||
}
|
||||
|
@ -851,7 +851,7 @@ namespace pvpgn
|
|||
std::sprintf(tempname, "%s/%08x", clansdir, teamid);
|
||||
if (std::remove((const char *)tempname) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not delete team file \"%s\" (std::remove: %s)", (char *)tempname, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not delete team file \"{}\" (std::remove: {})", (char *)tempname, std::strerror(errno));
|
||||
xfree(tempname);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace pvpgn
|
|||
user = xstrdup(username);
|
||||
strtolower(user);
|
||||
std::snprintf(query, sizeof(query), "SELECT count(*) FROM %sBNET WHERE username='%s'", tab_prefix, user);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
|
||||
if ((result = sql->query_res(query)) != NULL)
|
||||
{
|
||||
|
@ -158,53 +158,53 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"%s\"", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error trying query: \"{}\"", query);
|
||||
goto err_dup;
|
||||
}
|
||||
|
||||
info = xmalloc(sizeof(t_sql_info));
|
||||
*((unsigned int *)info) = uid;
|
||||
std::snprintf(query, sizeof(query), "DELETE FROM %sBNET WHERE " SQL_UID_FIELD " = '%u'", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
sql->query(query);
|
||||
std::snprintf(query, sizeof(query), "INSERT INTO %sBNET (" SQL_UID_FIELD ",username) VALUES('%u','%s')", tab_prefix, uid, user);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user insert failed (query: '%s')", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user insert failed (query: '{}')", query);
|
||||
goto err_info;
|
||||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "DELETE FROM %sprofile WHERE " SQL_UID_FIELD " = '%u'", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
sql->query(query);
|
||||
std::snprintf(query, sizeof(query), "INSERT INTO %sprofile (" SQL_UID_FIELD ") VALUES('%u')", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user insert failed (query: '%s')", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user insert failed (query: '{}')", query);
|
||||
goto err_info;
|
||||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "DELETE FROM %sRecord WHERE " SQL_UID_FIELD " = '%u'", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
sql->query(query);
|
||||
std::snprintf(query, sizeof(query), "INSERT INTO %sRecord (" SQL_UID_FIELD ") VALUES('%u')", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user insert failed (query: '%s')", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user insert failed (query: '{}')", query);
|
||||
goto err_info;
|
||||
}
|
||||
|
||||
std::snprintf(query, sizeof(query), "DELETE FROM %sfriend WHERE " SQL_UID_FIELD " = '%u'", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
sql->query(query);
|
||||
std::snprintf(query, sizeof(query), "INSERT INTO %sfriend (" SQL_UID_FIELD ") VALUES('%u')", tab_prefix, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
if (sql->query(query))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user insert failed (query: '%s')", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "user insert failed (query: '{}')", query);
|
||||
goto err_info;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ namespace pvpgn
|
|||
continue;
|
||||
|
||||
std::snprintf(query, sizeof(query), "SELECT * FROM %s%s WHERE " SQL_UID_FIELD "='%u'", tab_prefix, *tab, uid);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
|
||||
if ((result = sql->query_res(query)) != NULL && sql->num_rows(result) == 1 && sql->num_fields(result) > 1)
|
||||
{
|
||||
|
@ -284,16 +284,16 @@ namespace pvpgn
|
|||
if (std::strcmp(*fentry, SQL_UID_FIELD) == 0)
|
||||
continue;
|
||||
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read key (step1): '%s' val: '%s'", _db_add_tab(*tab, *fentry), unescape_chars(row[i]));
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read key (step1): '{}' val: '{}'", _db_add_tab(*tab, *fentry), unescape_chars(row[i]));
|
||||
if (row[i] == NULL)
|
||||
continue; /* its an NULL value sql field */
|
||||
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read key (step2): '%s' val: '%s'", _db_add_tab(*tab, *fentry), unescape_chars(row[i]));
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read key (step2): '{}' val: '{}'", _db_add_tab(*tab, *fentry), unescape_chars(row[i]));
|
||||
if (cb(_db_add_tab(*tab, *fentry), (output = unescape_chars(row[i])), data))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from callback on UID: %u", uid);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got error from callback on UID: {}", uid);
|
||||
if (output)
|
||||
xfree((void *)output);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read key (final): '%s' val: '%s'", _db_add_tab(*tab, *fentry), unescape_chars(row[i]));
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "read key (final): '{}' val: '{}'", _db_add_tab(*tab, *fentry), unescape_chars(row[i]));
|
||||
}
|
||||
|
||||
sql->free_fields(fields);
|
||||
|
@ -347,7 +347,7 @@ namespace pvpgn
|
|||
|
||||
if (sql->num_rows(result) != 1)
|
||||
{
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "wrong numer of rows from query (%s)", query);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "wrong numer of rows from query ({})", query);
|
||||
sql->free_result(result);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ namespace pvpgn
|
|||
|
||||
if (row[0] == NULL)
|
||||
{
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "NULL value from query (%s)", query);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "NULL value from query ({})", query);
|
||||
sql->free_result(result);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (attr_get_val(attr) == NULL) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found NULL value in attributes list (%s)", attr_get_key(attr));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "found NULL value in attributes list ({})", attr_get_key(attr));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -460,27 +460,27 @@ namespace pvpgn
|
|||
|
||||
/* FIRST TIME UPDATE EACH ATTRIBUTE IN A SINGLE QUERY AND SAVE ATTRIBUTE NAME IN `knownattributes` */
|
||||
std::snprintf(query, sizeof(query), "UPDATE %s%s SET `%s` = '%s' WHERE " SQL_UID_FIELD " = '%u'", tab_prefix, tab, col, escape, uid);
|
||||
eventlog(eventlog_level_trace, "db_set", "%s", query);
|
||||
eventlog(eventlog_level_trace, "db_set", "{}", query);
|
||||
|
||||
if (sql->query(query) || !sql->affected_rows()) {
|
||||
char query2[512];
|
||||
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "trying to insert new column %s", col);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "trying to insert new column {}", col);
|
||||
std::snprintf(query2, sizeof(query2), "ALTER TABLE %s%s ADD COLUMN `%s` VARCHAR(128)", tab_prefix, tab, col);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query2);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query2);
|
||||
|
||||
sql->query(query2);
|
||||
|
||||
/* try query again */
|
||||
// eventlog(eventlog_level_trace, "db_set", "retry insert query: %s", query);
|
||||
// eventlog(eventlog_level_trace, "db_set", "retry insert query: {}", query);
|
||||
if (sql->query(query) || !sql->affected_rows()) {
|
||||
// Tried everything, now trying to insert that user to the table for the first time
|
||||
std::snprintf(query2, sizeof(query2), "INSERT INTO %s%s (" SQL_UID_FIELD ",`%s`) VALUES ('%u','%s')", tab_prefix, tab, col, uid, escape);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query2);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query2);
|
||||
// eventlog(eventlog_level_error, __FUNCTION__, "update failed so tried INSERT for the last chance");
|
||||
if (sql->query(query2))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not INSERT attribute '%s'->'%s'", attr_get_key(attr), attr_get_val(attr));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not INSERT attribute '{}'->'{}'", attr_get_key(attr), attr_get_val(attr));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
@ -505,11 +505,11 @@ namespace pvpgn
|
|||
|
||||
if (!sql->query(query_s.c_str()))
|
||||
{
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "multi-update query: %s", query_s.c_str());
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "multi-update query: {}", query_s.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "sql error (%s)", query_s.c_str());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "sql error ({})", query_s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -541,11 +541,11 @@ namespace pvpgn
|
|||
else
|
||||
std::snprintf(query, sizeof(query), "SELECT " SQL_UID_FIELD " FROM %sBNET WHERE " SQL_UID_FIELD " = '%u'", tab_prefix, uid);
|
||||
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "%s", query);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "{}", query);
|
||||
|
||||
result = sql->query_res(query);
|
||||
if (!result) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"%s\")", query);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error query db (query:\"{}\")", query);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace pvpgn
|
|||
|
||||
if (!(fp = std::fopen(supportfile, "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for reading (std::fopen: %s)", supportfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", supportfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "can't guarantee that everything will run smooth");
|
||||
return 0;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace pvpgn
|
|||
|
||||
if (access(namebuff, F_OK) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "necessary file \"%s\" missing", namebuff);
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "necessary file \"{}\" missing", namebuff);
|
||||
xfree((void *)namebuff);
|
||||
std::fclose(fp);
|
||||
return -1;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!(team->members[i] = accountlist_find_account_by_uid(team->teammembers[i])))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "at least one non-existant member (id %d) in team %u - discarding team", team->teammembers[i], team->teamid);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "at least one non-existant member (id {}) in team {} - discarding team", team->teammembers[i], team->teamid);
|
||||
//FIXME: delete team file now???
|
||||
return team->teamid; //we return teamid even though we have an error, we don't want unintentional overwriting
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ namespace pvpgn
|
|||
|
||||
mylevel = team->level; //get teams level
|
||||
if (mylevel > W3_XPCALC_MAXLEVEL) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid level: %d", mylevel);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid level: {}", mylevel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ namespace pvpgn
|
|||
case W3_GAMERESULT_LOSS:
|
||||
ladder_war3_xpdiff(opponlevel, mylevel, &placeholder, &xpdiff); break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid game result: %d", gameresult);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid game result: {}", gameresult);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,7 @@ namespace pvpgn
|
|||
if (mylevel < 1) mylevel = 1;
|
||||
|
||||
if (mylevel > W3_XPCALC_MAXLEVEL) {
|
||||
eventlog(eventlog_level_error, "account_set_sololevel", "got invalid level: %d", mylevel);
|
||||
eventlog(eventlog_level_error, "account_set_sololevel", "got invalid level: {}", mylevel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
//added for better tracking down of problems with gameresults
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "parsing game result for team: %u result: %s", team_get_teamid(team), (result == W3_GAMERESULT_WIN) ? "WIN" : "LOSS");
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "parsing game result for team: {} result: {}", team_get_teamid(team), (result == W3_GAMERESULT_WIN) ? "WIN" : "LOSS");
|
||||
|
||||
|
||||
if (result == W3_GAMERESULT_WIN)
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace pvpgn
|
|||
|
||||
if (gettimeofday(&tv, NULL) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not get std::time (gettimeofday: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not get std::time (gettimeofday: {})", std::strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
if (first)
|
||||
|
|
|
@ -70,14 +70,14 @@ namespace pvpgn
|
|||
|
||||
if (!std::regex_search(strLine, match, rgx))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Invalid line in topic file (%s)", strLine.c_str());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Invalid line in topic file ({})", strLine.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
//check if current line in file already exists in Head
|
||||
if (this->topiclist.get(match[1].str()) != nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Duplicate line for channel %s in topic file", match[1].str().c_str());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Duplicate line for channel {} in topic file", match[1].str().c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -123,12 +123,12 @@ namespace pvpgn
|
|||
|
||||
if (topic != nullptr)
|
||||
{
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "Setting <%s>'s topic to <%s>", channel_name.c_str(), topic_text.c_str());
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "Setting <{}>'s topic to <{}>", channel_name.c_str(), topic_text.c_str());
|
||||
topic->topicstr = topic_text;
|
||||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "Adding <%s:%s> to topiclist", channel_name.c_str(), topic_text.c_str());
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "Adding <{}:{}> to topiclist", channel_name.c_str(), topic_text.c_str());
|
||||
this->topiclist.add(channel_name, topic_text, do_save);
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!std::regex_search(strLine, match, rgx))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Invalid line in topic file (%s)", strLine.c_str());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "Invalid line in topic file ({})", strLine.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
|
||||
if ((user = tournament_get_user(account))) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "user \"%s\" already signed up in tournament", account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "user \"{}\" already signed up in tournament", account_get_name(account));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace pvpgn
|
|||
|
||||
list_prepend_data(tournament_head, user);
|
||||
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added user \"%s\" to tournament", account_get_name(account));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "added user \"{}\" to tournament", account_get_name(account));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -263,27 +263,27 @@ namespace pvpgn
|
|||
{
|
||||
if (*mon > 12)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid month (%u) in %s", *mon, caller);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid month ({}) in {}", *mon, caller);
|
||||
*mon = 12;
|
||||
}
|
||||
if (*mday > 31)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid mday (%u) in %s", *mday, caller);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid mday ({}) in {}", *mday, caller);
|
||||
*mday = 31;
|
||||
}
|
||||
if (*hour > 23)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid hour (%u) from %s", *hour, caller);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid hour ({}) from {}", *hour, caller);
|
||||
*hour = 23;
|
||||
}
|
||||
if (*min > 59)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid min (%u) from %s", *min, caller);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid min ({}) from {}", *min, caller);
|
||||
*min = 59;
|
||||
}
|
||||
if (*sec > 59)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid sec (%u) from %s", *sec, caller);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got invalid sec ({}) from {}", *sec, caller);
|
||||
*sec = 59;
|
||||
}
|
||||
return;
|
||||
|
@ -330,7 +330,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (!(fp = std::fopen(filename, "r"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
xfree((void *)timestamp);
|
||||
return -1;
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ namespace pvpgn
|
|||
mname = xstrdup(mapname);
|
||||
|
||||
anongame_add_tournament_map(ctag, mname);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "added tournament map \"%s\" for %s", mname, clienttag);
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "added tournament map \"{}\" for {}", mname, clienttag);
|
||||
xfree(mname);
|
||||
}
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ namespace pvpgn
|
|||
tournament_info->thumbs_down = std::atoi(pointer);
|
||||
}
|
||||
else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad option \"%s\" in \"%s\"", variable, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bad option \"{}\" in \"{}\"", variable, filename);
|
||||
|
||||
if (have_sponsor && have_icon) {
|
||||
sponsor = (char*)xmalloc(std::strlen(have_sponsor) + 6);
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace pvpgn
|
|||
addr = (t_addr*)elem_get_data(curr);
|
||||
if (!addr_get_addr_str(addr, temp, sizeof(temp)))
|
||||
std::strcpy(temp, "x.x.x.x:x");
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "tracking packets will be sent to %s", temp);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "tracking packets will be sent to {}", temp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -140,7 +140,7 @@ namespace pvpgn
|
|||
{
|
||||
if (uname(&utsbuf) != 0)
|
||||
{
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "could not get platform info (uname: %s)", pstrerror(errno));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "could not get platform info (uname: {})", pstrerror(errno));
|
||||
std::snprintf(reinterpret_cast<char*>(packet.platform), sizeof packet.platform, "");
|
||||
}
|
||||
}
|
||||
|
@ -173,10 +173,10 @@ namespace pvpgn
|
|||
std::strcpy(tempa, "x.x.x.x:x");
|
||||
if (!addr_get_addr_str(addrt, tempb, sizeof(tempb)))
|
||||
std::strcpy(tempa, "x.x.x.x:x");
|
||||
/* eventlog(eventlog_level_debug,__FUNCTION__,"sending tracking info from %s to %s",tempa,tempb); */
|
||||
/* eventlog(eventlog_level_debug,__FUNCTION__,"sending tracking info from {} to {}",tempa,tempb); */
|
||||
|
||||
if (psock_sendto(laddr_info->usocket, &packet, sizeof(packet), 0, (struct sockaddr *)&tempaddr, (psock_t_socklen)sizeof(tempaddr)) < 0)
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "could not send tracking information from %s to %s (psock_sendto: %s)", tempa, tempb, pstrerror(errno));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "could not send tracking information from {} to {} (psock_sendto: {})", tempa, tempb, pstrerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!(upacket = packet_create(packet_class_udp)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not allocate memory for packet", conn_get_socket(c));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not allocate memory for packet", conn_get_socket(c));
|
||||
continue;
|
||||
}
|
||||
packet_set_size(upacket, sizeof(t_server_udptest));
|
||||
|
@ -80,7 +80,7 @@ namespace pvpgn
|
|||
if (psock_sendto(conn_get_game_socket(c),
|
||||
packet_get_raw_data_const(upacket, 0), packet_get_size(upacket),
|
||||
0, (struct sockaddr *)&caddr, (psock_t_socklen)sizeof(caddr)) != (int)packet_get_size(upacket))
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] failed to send UDPTEST to %s (attempt %u) (psock_sendto: %s)", conn_get_socket(c), addr_num_to_addr_str(ntohl(caddr.sin_addr.s_addr), conn_get_game_port(c)), tries + 1, pstrerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] failed to send UDPTEST to {} (attempt {}) (psock_sendto: {})", conn_get_socket(c), addr_num_to_addr_str(ntohl(caddr.sin_addr.s_addr), conn_get_game_port(c)), tries + 1, pstrerror(psock_errno()));
|
||||
else
|
||||
successes++;
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
ERROR1("could not write into user log file \"%s\"", filename);
|
||||
ERROR1("could not write into user log file \"{}\"", filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ namespace pvpgn
|
|||
// create inside user dir
|
||||
if (stat(filepath, &statbuf) == -1) {
|
||||
p_mkdir(filepath, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "created user directory: %s", filepath);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "created user directory: {}", filepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace pvpgn
|
|||
continue;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "version check entry archtag=%s, clienttag=%s",
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "version check entry archtag={}, clienttag={}",
|
||||
tag_uint_to_str(archtag_str, vi->archtag),
|
||||
tag_uint_to_str(clienttag_str, vi->clienttag));
|
||||
|
||||
|
@ -242,7 +242,7 @@ namespace pvpgn
|
|||
if (std::sscanf(exeinfo, "%*s %*s %u", &size) != 1)
|
||||
{
|
||||
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "parser error while parsing pattern \"%s\"", exeinfo);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "parser error while parsing pattern \"{}\"", exeinfo);
|
||||
xfree((void *)parsed_exeinfo->exe);
|
||||
xfree((void *)parsed_exeinfo);
|
||||
return NULL; /* neq */
|
||||
|
@ -313,13 +313,13 @@ namespace pvpgn
|
|||
}
|
||||
if ((pattern->time != -1) && prefs_get_version_exeinfo_maxdiff() && (abs(pattern->time - match->time) > (signed)prefs_get_version_exeinfo_maxdiff()))
|
||||
{
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "time differs by %i", abs(pattern->time - match->time));
|
||||
eventlog(eventlog_level_trace, __FUNCTION__, "time differs by {}", abs(pattern->time - match->time));
|
||||
return 1;
|
||||
}
|
||||
return 0; /* ok */
|
||||
}
|
||||
else {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown version exeinfo match method \"%s\"", prefs_get_version_exeinfo_match());
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unknown version exeinfo match method \"{}\"", prefs_get_version_exeinfo_match());
|
||||
return -1; /* neq/fail */
|
||||
}
|
||||
}
|
||||
|
@ -406,26 +406,26 @@ namespace pvpgn
|
|||
|
||||
/* Ok, version and checksum matches or exeinfo/checksum are disabled
|
||||
* anyway we have found a complete match */
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "got a matching entry: %s", vc->versiontag);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "got a matching entry: {}", vc->versiontag);
|
||||
free_parsed_exeinfo(parsed_exeinfo);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (badcs) /* A match was found but the checksum was different */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "bad checksum, closest match is: %s", vc->versiontag);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "bad checksum, closest match is: {}", vc->versiontag);
|
||||
free_parsed_exeinfo(parsed_exeinfo);
|
||||
return -1;
|
||||
}
|
||||
if (badexe) /* A match was found but the exeinfo string was different */
|
||||
{
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "bad exeinfo, closest match is: %s", vc->versiontag);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "bad exeinfo, closest match is: {}", vc->versiontag);
|
||||
free_parsed_exeinfo(parsed_exeinfo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* No match in list */
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "no match in list, setting to: %s", vc->versiontag);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "no match in list, setting to: {}", vc->versiontag);
|
||||
free_parsed_exeinfo(parsed_exeinfo);
|
||||
return 0;
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ namespace pvpgn
|
|||
}
|
||||
if (!(fp = std::fopen(filename, "r")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
list_destroy(versioninfo_head);
|
||||
versioninfo_head = NULL;
|
||||
return -1;
|
||||
|
@ -488,49 +488,49 @@ namespace pvpgn
|
|||
|
||||
if (!(eqn = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing eqn near line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing eqn near line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
line++;
|
||||
if (!(mpqfile = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing mpqfile near line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing mpqfile near line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
line++;
|
||||
if (!(archtag = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing archtag near line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing archtag near line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
line++;
|
||||
if (!(clienttag = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing clienttag near line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing clienttag near line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
line++;
|
||||
if (!(exeinfo = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing exeinfo near line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing exeinfo near line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
line++;
|
||||
if (!(versionid = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing versionid near line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing versionid near line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
line++;
|
||||
if (!(gameversion = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing gameversion near line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing gameversion near line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
line++;
|
||||
if (!(checksum = next_token(buff, &pos)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing checksum near line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing checksum near line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
line++;
|
||||
|
@ -544,7 +544,7 @@ namespace pvpgn
|
|||
vi->mpqfile = xstrdup(mpqfile);
|
||||
if (std::strlen(archtag) != 4)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid arch tag on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid arch tag on line {} of file \"{}\"", line, filename);
|
||||
xfree((void *)vi->mpqfile); /* avoid warning */
|
||||
xfree((void *)vi->eqn); /* avoid warning */
|
||||
xfree(vi);
|
||||
|
@ -552,7 +552,7 @@ namespace pvpgn
|
|||
}
|
||||
if (!tag_check_arch((vi->archtag = tag_str_to_uint(archtag))))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unknown archtag \"%s\"", archtag);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unknown archtag \"{}\"", archtag);
|
||||
xfree((void *)vi->mpqfile); /* avoid warning */
|
||||
xfree((void *)vi->eqn); /* avoid warning */
|
||||
xfree(vi);
|
||||
|
@ -560,7 +560,7 @@ namespace pvpgn
|
|||
}
|
||||
if (std::strlen(clienttag) != 4)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid client tag on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid client tag on line {} of file \"{}\"", line, filename);
|
||||
xfree((void *)vi->mpqfile); /* avoid warning */
|
||||
xfree((void *)vi->eqn); /* avoid warning */
|
||||
xfree(vi);
|
||||
|
@ -568,7 +568,7 @@ namespace pvpgn
|
|||
}
|
||||
if (!tag_check_client((vi->clienttag = tag_str_to_uint(clienttag))))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unknown clienttag\"%s\"", clienttag);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unknown clienttag\"{}\"", clienttag);
|
||||
xfree((void *)vi->mpqfile); /* avoid warning */
|
||||
xfree((void *)vi->eqn); /* avoid warning */
|
||||
xfree(vi);
|
||||
|
@ -591,7 +591,7 @@ namespace pvpgn
|
|||
vi->versionid = std::strtoul(versionid, NULL, 0);
|
||||
if (verstr_to_vernum(gameversion, &vi->gameversion) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed version on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "malformed version on line {} of file \"{}\"", line, filename);
|
||||
xfree((void *)vi->parsed_exeinfo); /* avoid warning */
|
||||
xfree((void *)vi->mpqfile); /* avoid warning */
|
||||
xfree((void *)vi->eqn); /* avoid warning */
|
||||
|
@ -611,7 +611,7 @@ namespace pvpgn
|
|||
|
||||
file_get_line(NULL); // clear file_get_line buffer
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close versioncheck file \"%s\" after reading (std::fclose: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close versioncheck file \"{}\" after reading (std::fclose: {})", filename, std::strerror(errno));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ namespace pvpgn
|
|||
}
|
||||
}
|
||||
|
||||
if (cnt) DEBUG2("notified %d friends about %s", cnt, myusername);
|
||||
if (cnt) DEBUG2("notified {} friends about {}", cnt, myusername);
|
||||
|
||||
/* watchlist handling */
|
||||
switch (event)
|
||||
|
@ -230,7 +230,7 @@ namespace pvpgn
|
|||
case Watch::ET_leavegame:
|
||||
return dispatch_whisper(who, gamename, clienttag, event);
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unknown event %u", (unsigned int)event);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unknown event {}", (unsigned int)event);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -115,7 +115,7 @@ extern int main(int argc, char * argv[])
|
|||
eventlog_set(stderr);
|
||||
if (eventlog_open(prefs.logfile) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "could not use file \"%s\" for the eventlog (exiting)", prefs.logfile);
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "could not use file \"{}\" for the eventlog (exiting)", prefs.logfile);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ extern int main(int argc, char * argv[])
|
|||
switch (fork())
|
||||
{
|
||||
case -1:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not fork (fork: %s)\n", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not fork (fork: {})", std::strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
case 0: /* child */
|
||||
break;
|
||||
|
@ -141,7 +141,7 @@ extern int main(int argc, char * argv[])
|
|||
# ifdef HAVE_SETPGID
|
||||
if (setpgid(0, 0) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgid: %s)\n", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgid: {})\n", std::strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
# else
|
||||
|
@ -149,13 +149,13 @@ extern int main(int argc, char * argv[])
|
|||
# ifdef SETPGRP_VOID
|
||||
if (setpgrp() < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgrp: %s)\n", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgrp: {})\n", std::strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
# else
|
||||
if (setpgrp(0, 0) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgrp: %s)\n", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setpgrp: {})\n", std::strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
# endif
|
||||
|
@ -163,7 +163,7 @@ extern int main(int argc, char * argv[])
|
|||
# ifdef HAVE_SETSID
|
||||
if (setsid() < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setsid: %s)\n", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create new process group (setsid: {})\n", std::strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
# else
|
||||
|
@ -181,14 +181,14 @@ extern int main(int argc, char * argv[])
|
|||
|
||||
if (!(fp = std::fopen(prefs.pidfile, "w")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open pid file \"%s\" for writing (std::fopen: %s)", prefs.pidfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open pid file \"{}\" for writing (std::fopen: {})", prefs.pidfile, std::strerror(errno));
|
||||
prefs.pidfile = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::fprintf(fp, "%u", (unsigned int)getpid());
|
||||
if (std::fclose(fp) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close pid file \"%s\" after writing (std::fclose: %s)", prefs.pidfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close pid file \"{}\" after writing (std::fclose: {})", prefs.pidfile, std::strerror(errno));
|
||||
}
|
||||
#else
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "no getpid() system call, do not use the -P or the --pidfile option");
|
||||
|
@ -197,9 +197,9 @@ extern int main(int argc, char * argv[])
|
|||
}
|
||||
|
||||
#ifdef HAVE_GETPID
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "bntrackd version " PVPGN_VERSION " process %u", (unsigned int)getpid());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "bntrackd version " PVPGN_VERSION " process {}", getpid());
|
||||
#else
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "bntrackd version "PVPGN_VERSION);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "bntrackd version " PVPGN_VERSION);
|
||||
#endif
|
||||
|
||||
if (psock_init() < 0)
|
||||
|
@ -211,7 +211,7 @@ extern int main(int argc, char * argv[])
|
|||
/* create the socket */
|
||||
if ((sockfd = psock_socket(PSOCK_PF_INET, PSOCK_SOCK_DGRAM, PSOCK_IPPROTO_UDP)) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create UDP listen socket (psock_socket: %s)\n", std::strerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not create UDP listen socket (psock_socket: {})\n", std::strerror(psock_errno()));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ extern int main(int argc, char * argv[])
|
|||
servaddr.sin_port = htons(prefs.port);
|
||||
if (psock_bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not bind to UDP port %hu (psock_bind: %s)\n", prefs.port, std::strerror(psock_errno()));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not bind to UDP port {} (psock_bind: {})\n", prefs.port, std::strerror(psock_errno()));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ namespace {
|
|||
|
||||
if (!(outfile = std::fopen(prefs.outfile, "w")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open file \"%s\" for writing (std::fopen: %s)", prefs.outfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "unable to open file \"{}\" for writing (std::fopen: {})", prefs.outfile, std::strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
if (std::fclose(outfile) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close output file \"%s\" after writing (std::fclose: %s)", prefs.outfile, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close output file \"{}\" after writing (std::fclose: {})", prefs.outfile, std::strerror(errno));
|
||||
|
||||
if (prefs.process[0] != '\0')
|
||||
std::system(prefs.process);
|
||||
|
@ -355,7 +355,7 @@ namespace {
|
|||
errno != PSOCK_EINTR &&
|
||||
#endif
|
||||
1)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "select failed (select: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "select failed (select: {})", std::strerror(errno));
|
||||
case 0: /* timeout and no sockets ready */
|
||||
continue;
|
||||
}
|
||||
|
@ -424,21 +424,21 @@ namespace {
|
|||
inet_ntop(AF_INET, &(cliaddr.sin_addr), addrstr2, sizeof(addrstr2));
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__,
|
||||
"Packet received from %s:"
|
||||
" packet_version=%" PRIu16
|
||||
" flags=0x%08" PRIu32 "x"
|
||||
" port=%" PRIu16
|
||||
" software=\"%s\""
|
||||
" version=\"%s\""
|
||||
" platform=\"%s\""
|
||||
" server_desc=\"%s\""
|
||||
" server_location=\"%s\""
|
||||
" server_url=\"%s\""
|
||||
" contact_name=\"%s\""
|
||||
" contact_email=\"%s\""
|
||||
" uptime=%" PRIu32
|
||||
" total_games=%" PRIu32
|
||||
" total_logins=%" PRIu32,
|
||||
"Packet received from {}:"
|
||||
" packet_version={}"
|
||||
" flags=0x{:08}"
|
||||
" port={}"
|
||||
" software=\"{}\""
|
||||
" version=\"{}\""
|
||||
" platform=\"{}\""
|
||||
" server_desc=\"{}\""
|
||||
" server_location=\"{}\""
|
||||
" server_url=\"{}\""
|
||||
" contact_name=\"{}\""
|
||||
" contact_email=\"{}\""
|
||||
" uptime={}"
|
||||
" total_games={}"
|
||||
" total_logins={}",
|
||||
addrstr2,
|
||||
bn_short_nget(packet.packet_version),
|
||||
bn_int_nget(packet.flags),
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace pvpgn
|
|||
it when sending a dotted-quad to gethostbyname(). This is
|
||||
good enough when that fails. */
|
||||
}
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not lookup host \"%s\"", hoststr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not lookup host \"{}\"", hoststr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ namespace pvpgn
|
|||
if (!(sp = getservbyname(portstr, protstr ? protstr : "tcp")))
|
||||
#endif
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not convert \"%s\" to a port number", portstr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not convert \"{}\" to a port number", portstr);
|
||||
xfree(tstr);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ namespace pvpgn
|
|||
|
||||
if (!(hostname = host_lookup(hoststr, &ipaddr)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not lookup host \"%s\"", hoststr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not lookup host \"{}\"", hoststr);
|
||||
xfree(tstr);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ namespace pvpgn
|
|||
{
|
||||
if (netmask > 32)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "network bits must be less than or equal to 32 (%u)", netmask);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "network bits must be less than or equal to 32 ({})", netmask);
|
||||
xfree(netaddr);
|
||||
xfree(temp);
|
||||
return NULL;
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace pvpgn
|
|||
}
|
||||
if (size > 0 && !datain)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL datain with size=%u", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL datain with size={}", size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ namespace pvpgn
|
|||
}
|
||||
if (size > 0 && !datain)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL datain with size=%u", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL datain with size={}", size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ namespace pvpgn
|
|||
}
|
||||
if (std::strlen(str) != 5 * 8)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got string with length %lu (should be %u)", std::strlen(str), 5 * 8);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got string with length {} (should be {})", std::strlen(str), 5 * 8);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace pvpgn
|
|||
|
||||
if (gettimeofday(&tv, NULL) < 0)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not get time (gettimeofday: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not get time (gettimeofday: {})", std::strerror(errno));
|
||||
return time_to_bnettime(std::time(NULL), 0);
|
||||
}
|
||||
return time_to_bnettime((std::time_t)tv.tv_sec, tv.tv_usec);
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace pvpgn
|
|||
unsigned temp;
|
||||
|
||||
if (str_to_uint(valstr, &temp) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid integer value '%s'", valstr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid integer value '{}'", valstr);
|
||||
return -1;
|
||||
}
|
||||
else *pint = temp;
|
||||
|
@ -59,7 +59,7 @@ namespace pvpgn
|
|||
*pbool = 0;
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value '%s'", valstr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid boolean value '{}'", valstr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!valstr) *ptime = def;
|
||||
else if (timestr_to_time(valstr, ptime) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid timestr value '%s'", valstr);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid timestr value '{}'", valstr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -129,14 +129,14 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
if (*cp != '"') {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing end quota at line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing end quota at line {}", lineno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*cp = '\0';
|
||||
cp = str_skip_space(cp + 1);
|
||||
if (*cp) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "extra characters in value after ending quote at line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "extra characters in value after ending quote at line {}", lineno);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ namespace pvpgn
|
|||
*cp = '\0';
|
||||
cp = str_skip_space(cp + 1);
|
||||
if (*cp) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "extra characters after the value at line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "extra characters after the value at line {}", lineno);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ namespace pvpgn
|
|||
return;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "option '%s' unknown", key);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "option '{}' unknown", key);
|
||||
}
|
||||
|
||||
extern int conf_load_file(std::FILE *fd, t_conf_entry *conftab)
|
||||
|
@ -216,13 +216,13 @@ namespace pvpgn
|
|||
|
||||
cp = str_skip_space(cp);
|
||||
if (*cp != '=') {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing = on line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing = on line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
|
||||
cp = str_skip_space(cp + 1);
|
||||
if (!*cp) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing value at line %u", lineno);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing value at line {}", lineno);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,11 +18,17 @@
|
|||
*/
|
||||
#include "common/setup_before.h"
|
||||
#include "common/eventlog.h"
|
||||
#include <cstdio>
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <cstdarg>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <common/format.h>
|
||||
|
||||
#include "compat/strcasecmp.h"
|
||||
#include "common/hexdump.h"
|
||||
|
@ -80,7 +86,7 @@ namespace pvpgn
|
|||
|
||||
if (!(temp = std::fopen(filename, "a")))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for appending (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for appending (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -88,7 +94,7 @@ namespace pvpgn
|
|||
if (std::fclose(eventstrm) < 0)
|
||||
{
|
||||
eventstrm = temp;
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close previous logfile after writing (std::fclose: %s)", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not close previous logfile after writing (std::fclose: {})", std::strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
eventstrm = temp;
|
||||
|
@ -149,7 +155,7 @@ namespace pvpgn
|
|||
}
|
||||
#endif
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad levelname \"%s\"", levelname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad levelname \"{}\"", levelname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -200,7 +206,7 @@ namespace pvpgn
|
|||
}
|
||||
#endif
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad levelname \"%s\"", levelname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad levelname \"{}\"", levelname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -246,7 +252,7 @@ namespace pvpgn
|
|||
std::fprintf(eventstrm, "%s\n", dst);
|
||||
#ifdef WIN32_GUI
|
||||
if (eventlog_level_gui&currlevel)
|
||||
gui_lprintf(eventlog_level_info, "%s\n", dst);
|
||||
gui_lvprintf(eventlog_level_info, "{}\n", dst);
|
||||
#endif
|
||||
if (eventlog_debugmode)
|
||||
{
|
||||
|
@ -258,79 +264,100 @@ namespace pvpgn
|
|||
std::fflush(eventstrm);
|
||||
}
|
||||
|
||||
extern void eventlog(t_eventlog_level level, char const * module, char const * fmt, ...)
|
||||
//template <typename... Args>
|
||||
//extern void eventlog2(t_eventlog_level level, const char* module, const char* format, const Args& ... args)
|
||||
void eventlog(t_eventlog_level level, const char* module, const char* format, fmt::ArgList args)
|
||||
{
|
||||
std::va_list args;
|
||||
char time_string[EVENT_TIME_MAXLEN];
|
||||
struct std::tm * tmnow;
|
||||
std::time_t now;
|
||||
|
||||
if (!(level&currlevel))
|
||||
if (!(level & currlevel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!eventstrm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* get the time before parsing args */
|
||||
std::time(&now);
|
||||
if (!(tmnow = std::localtime(&now)))
|
||||
std::strcpy(time_string, "?");
|
||||
std::time_t now = std::time(nullptr);
|
||||
std::tm* tmnow = std::localtime(&now);
|
||||
std::string time;
|
||||
if (!tmnow)
|
||||
{
|
||||
time = "?";
|
||||
}
|
||||
else
|
||||
std::strftime(time_string, EVENT_TIME_MAXLEN, EVENT_TIME_FORMAT, tmnow);
|
||||
{
|
||||
std::stringstream temp;
|
||||
temp << std::put_time(tmnow, EVENT_TIME_FORMAT);
|
||||
time = fmt::format("{}", temp.str());
|
||||
}
|
||||
|
||||
if (!module)
|
||||
{
|
||||
std::fprintf(eventstrm, "%s [error] eventlog: got NULL module\n", time_string);
|
||||
fmt::print(eventstrm, "{} [error] eventlog: got NULL module\n", time);
|
||||
#ifdef WIN32_GUI
|
||||
if (eventlog_level_gui&currlevel)
|
||||
gui_lprintf(eventlog_level_error, "%s [error] eventlog: got NULL module\n", time_string);
|
||||
if (eventlog_level_gui & currlevel)
|
||||
gui_lvprintf(eventlog_level_error, "{} [error] eventlog: got NULL module\n", time);
|
||||
#endif
|
||||
std::fflush(eventstrm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fmt)
|
||||
if (!format)
|
||||
{
|
||||
std::fprintf(eventstrm, "%s [error] eventlog: got NULL fmt\n", time_string);
|
||||
fmt::print(eventstrm, "{} [error] eventlog: got NULL fmt\n", time);
|
||||
#ifdef WIN32_GUI
|
||||
if (eventlog_level_gui&currlevel)
|
||||
gui_lprintf(eventlog_level_error, "%s [error] eventlog: got NULL fmt\n", time_string);
|
||||
gui_lvprintf(eventlog_level_error, "{} [error] eventlog: got NULL fmt\n", time);
|
||||
#endif
|
||||
std::fflush(eventstrm);
|
||||
return;
|
||||
}
|
||||
|
||||
std::fprintf(eventstrm, "%s [%s] %s: ", time_string, eventlog_get_levelname_str(level), module);
|
||||
/****************************************************************/
|
||||
|
||||
try
|
||||
{
|
||||
fmt::print(eventstrm, "{} [{}] {}: ", time, eventlog_get_levelname_str(level), module);
|
||||
#ifdef WIN32_GUI
|
||||
if (eventlog_level_gui&currlevel)
|
||||
gui_lprintf(level, "%s [%s] %s: ", time_string, eventlog_get_levelname_str(level), module);
|
||||
if (eventlog_level_gui&currlevel)
|
||||
{
|
||||
gui_lvprintf(level, "{} [{}] {}: ", time, eventlog_get_levelname_str(level), module);
|
||||
}
|
||||
#endif
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
std::vfprintf(eventstrm, fmt, args);
|
||||
fmt::print(eventstrm, format, args);
|
||||
#ifdef WIN32_GUI
|
||||
if (eventlog_level_gui&currlevel)
|
||||
gui_lvprintf(level, fmt, args);
|
||||
#endif
|
||||
va_end(args);
|
||||
std::fprintf(eventstrm, "\n");
|
||||
#ifdef WIN32_GUI
|
||||
if (eventlog_level_gui&currlevel)
|
||||
gui_lprintf(level, "\n");
|
||||
if (eventlog_level_gui & currlevel)
|
||||
{
|
||||
gui_lvprintf(level, format, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (eventlog_debugmode) {
|
||||
std::printf("%s [%s] %s: ", time_string, eventlog_get_levelname_str(level), module);
|
||||
va_start(args, fmt);
|
||||
std::vprintf(fmt, args);
|
||||
va_end(args);
|
||||
std::printf("\n");
|
||||
std::fflush(stdout);
|
||||
fmt::print(eventstrm, "\n");
|
||||
#ifdef WIN32_GUI
|
||||
if (eventlog_level_gui & currlevel)
|
||||
{
|
||||
gui_lvprintf(level, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (eventlog_debugmode)
|
||||
{
|
||||
fmt::print("{} [{}] {}: {}\n", time, eventlog_get_levelname_str(level), module, fmt::format(format, args));
|
||||
std::fflush(stdout);
|
||||
}
|
||||
}
|
||||
catch (fmt::FormatError& e)
|
||||
{
|
||||
fmt::print(eventstrm, "Failed to format string\n");
|
||||
gui_lvprintf(eventlog_level_error, "Failed to format string\n");
|
||||
|
||||
}
|
||||
|
||||
std::fflush(eventstrm);
|
||||
}
|
||||
|
||||
|
||||
extern void eventlog_step(char const * filename, t_eventlog_level level, char const * module, char const * fmt, ...)
|
||||
{
|
||||
std::va_list args;
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace pvpgn
|
|||
#define INCLUDED_EVENTLOG_PROTOS
|
||||
|
||||
#include <cstdio>
|
||||
#include <common/format.h>
|
||||
|
||||
namespace pvpgn
|
||||
{
|
||||
|
@ -61,13 +62,13 @@ namespace pvpgn
|
|||
extern int eventlog_del_level(char const * levelname);
|
||||
extern char const * eventlog_get_levelname_str(t_eventlog_level level);
|
||||
extern void eventlog_hexdump_data(void const * data, unsigned int len);
|
||||
extern void eventlog(t_eventlog_level level, char const * module, char const * fmt, ...) PRINTF_ATTR(3, 4);
|
||||
extern void eventlog_step(char const * filename, t_eventlog_level level, char const * module, char const * fmt, ...) PRINTF_ATTR(4, 5);
|
||||
|
||||
#define FATAL0(fmt) eventlog(eventlog_level_fatal,__FUNCTION__,fmt)
|
||||
#define FATAL1(fmt,arg1) eventlog(eventlog_level_fatal,__FUNCTION__,fmt,arg1)
|
||||
#define FATAL2(fmt,arg1,arg2) eventlog(eventlog_level_fatal,__FUNCTION__,fmt,arg1,arg2)
|
||||
#define FATAL3(fmt,arg1,arg2,arg3) eventlog(eventlog_level_fatal,__FUNCTION__,fmt,arg1,arg2,arg3)
|
||||
void eventlog(t_eventlog_level level, const char* module, const char* format, fmt::ArgList args);
|
||||
FMT_VARIADIC(void, eventlog, t_eventlog_level, const char*, const char*)
|
||||
//template <typename... Args>
|
||||
// extern void eventlog2(t_eventlog_level level, const char* module, const char* format, const Args& ... args);
|
||||
|
||||
extern void eventlog_step(char const * filename, t_eventlog_level level, char const * module, char const * fmt, ...) PRINTF_ATTR(4, 5);
|
||||
|
||||
#define ERROR0(fmt) eventlog(eventlog_level_error,__FUNCTION__,fmt)
|
||||
#define ERROR1(fmt,arg1) eventlog(eventlog_level_error,__FUNCTION__,fmt,arg1)
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace pvpgn
|
|||
maxsys = get_socket_limit();
|
||||
if (maxsys > 0) maxcons = (maxcons < maxsys) ? maxcons : maxsys;
|
||||
if (maxcons < 32) {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "too few sockets available (%d)", maxcons);
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "too few sockets available ({})", maxcons);
|
||||
return -1;
|
||||
}
|
||||
fdw_maxcons = maxcons;
|
||||
|
@ -100,7 +100,7 @@ namespace pvpgn
|
|||
}
|
||||
#endif
|
||||
|
||||
FATAL0("Found no working fdwatch layer");
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "Found no working fdwatch layer");
|
||||
fdw = NULL;
|
||||
fdwatch_close();
|
||||
return -1;
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace pvpgn
|
|||
int
|
||||
FDWEpollBackend::add(int idx, unsigned rw)
|
||||
{
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d rw: %d", fd, rw);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: {} rw: {}", fd, rw);
|
||||
|
||||
struct epoll_event tmpev;
|
||||
std::memset(&tmpev, 0, sizeof(tmpev));
|
||||
|
@ -76,7 +76,7 @@ namespace pvpgn
|
|||
int
|
||||
FDWEpollBackend::del(int idx)
|
||||
{
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d", fd);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: {}", fd);
|
||||
if (sr > 0)
|
||||
ERROR0("BUG: called while still handling sockets");
|
||||
|
||||
|
@ -106,7 +106,7 @@ namespace pvpgn
|
|||
// eventlog(eventlog_level_trace, __FUNCTION__, "called");
|
||||
for (struct epoll_event *ev = epevents.get(); sr; sr--, ev++)
|
||||
{
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "checking %d ident: %d read: %d write: %d", i, kqevents[i].ident, kqevents[i].filter & EVFILT_READ, kqevents[i].filter & EVFILT_WRITE);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "checking {} ident: {} read: {} write: {}", i, kqevents[i].ident, kqevents[i].filter & EVFILT_READ, kqevents[i].filter & EVFILT_WRITE);
|
||||
t_fdwatch_fd *cfd = fdw_fds + ev->data.fd;
|
||||
|
||||
if (fdw_rw(cfd) & fdwatch_type_read && ev->events & (EPOLLIN | EPOLLERR | EPOLLHUP))
|
||||
|
|
|
@ -65,19 +65,19 @@ namespace pvpgn
|
|||
int idxr;
|
||||
t_fdwatch_fd *cfd = fdw_fds + idx;
|
||||
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d rw: %d", fd, rw); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "called fd: {} rw: {}", fd, rw); */
|
||||
/* adding read event filter */
|
||||
if (!(fdw_rw(cfd) & fdwatch_type_read) && rw & fdwatch_type_read)
|
||||
{
|
||||
if (rridx[idx] >= 0 && rridx[idx] < nochanges && kqchanges[rridx[idx]].ident == fdw_fd(cfd))
|
||||
{
|
||||
idxr = rridx[idx];
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "updating change event (read) fd on %d", ridx); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "updating change event (read) fd on {}", ridx); */
|
||||
}
|
||||
else {
|
||||
idxr = nochanges++;
|
||||
rridx[idx] = idxr;
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "adding new change event (read) fd on %d", ridx); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "adding new change event (read) fd on {}", ridx); */
|
||||
}
|
||||
EV_SET(kqchanges.get() + idxr, fdw_fd(cfd), EVFILT_READ, EV_ADD, 0, 0, (void*)idx);
|
||||
}
|
||||
|
@ -86,12 +86,12 @@ namespace pvpgn
|
|||
if (rridx[idx] >= 0 && rridx[idx] < nochanges && kqchanges[rridx[idx]].ident == fdw_fd(cfd))
|
||||
{
|
||||
idxr = rridx[idx];
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "updating change event (read) fd on %d", ridx); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "updating change event (read) fd on {}", ridx); */
|
||||
}
|
||||
else {
|
||||
idxr = nochanges++;
|
||||
rridx[idx] = idxr;
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "adding new change event (read) fd on %d", ridx); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "adding new change event (read) fd on {}", ridx); */
|
||||
}
|
||||
EV_SET(kqchanges.get() + idxr, fdw_fd(cfd), EVFILT_READ, EV_DELETE, 0, 0, (void*)idx);
|
||||
}
|
||||
|
@ -102,12 +102,12 @@ namespace pvpgn
|
|||
if (wridx[idx] >= 0 && wridx[idx] < nochanges && kqchanges[wridx[idx]].ident == fdw_fd(cfd))
|
||||
{
|
||||
idxr = wridx[idx];
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "updating change event (write) fd on %d", ridx); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "updating change event (write) fd on {}", ridx); */
|
||||
}
|
||||
else {
|
||||
idxr = nochanges++;
|
||||
wridx[idx] = idxr;
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "adding new change event (write) fd on %d", ridx); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "adding new change event (write) fd on {}", ridx); */
|
||||
}
|
||||
EV_SET(kqchanges.get() + idxr, fdw_fd(cfd), EVFILT_WRITE, EV_ADD, 0, 0, (void*)idx);
|
||||
}
|
||||
|
@ -116,12 +116,12 @@ namespace pvpgn
|
|||
if (wridx[idx] >= 0 && wridx[idx] < nochanges && kqchanges[wridx[idx]].ident == fdw_fd(cfd))
|
||||
{
|
||||
idxr = wridx[idx];
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "updating change event (write) fd on %d", ridx); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "updating change event (write) fd on {}", ridx); */
|
||||
}
|
||||
else {
|
||||
idxr = nochanges++;
|
||||
wridx[idx] = idxr;
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "adding new change event (write) fd on %d", ridx); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "adding new change event (write) fd on {}", ridx); */
|
||||
}
|
||||
EV_SET(kqchanges.get() + idxr, fdw_fd(cfd), EVFILT_WRITE, EV_DELETE, 0, 0, (void*)idx);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ namespace pvpgn
|
|||
int
|
||||
FDWKqueueBackend::del(int idx)
|
||||
{
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d", fd); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "called fd: {}", fd); */
|
||||
if (sr > 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "BUG: called while still handling sockets");
|
||||
|
||||
|
@ -151,7 +151,7 @@ namespace pvpgn
|
|||
if (kqchanges[nochanges].filter == EVFILT_READ &&
|
||||
rridx[oidx] == nochanges)
|
||||
{
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving %d", kqchanges[rnfds].ident); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving {}", kqchanges[rnfds].ident); */
|
||||
rridx[oidx] = rridx[idx];
|
||||
std::memcpy(kqchanges.get() + rridx[idx], kqchanges.get() + nochanges, sizeof(struct kevent));
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ namespace pvpgn
|
|||
if (kqchanges[nochanges].filter == EVFILT_WRITE &&
|
||||
wridx[oidx] == nochanges)
|
||||
{
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving %d", kqchanges[rnfds].ident); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving {}", kqchanges[rnfds].ident); */
|
||||
wridx[oidx] = rridx[idx];
|
||||
std::memcpy(kqchanges.get() + rridx[idx], kqchanges.get() + nochanges, sizeof(struct kevent));
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ namespace pvpgn
|
|||
if (kqchanges[nochanges].filter == EVFILT_READ &&
|
||||
rridx[oidx] == nochanges)
|
||||
{
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving %d", kqchanges[rnfds].ident); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving {}", kqchanges[rnfds].ident); */
|
||||
rridx[oidx] = wridx[idx];
|
||||
std::memcpy(kqchanges.get() + wridx[idx], kqchanges.get() + nochanges, sizeof(struct kevent));
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ namespace pvpgn
|
|||
if (kqchanges[nochanges].filter == EVFILT_WRITE &&
|
||||
wridx[oidx] == nochanges)
|
||||
{
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving %d", kqchanges[rnfds].ident); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving {}, kqchanges[rnfds].ident); */
|
||||
wridx[oidx] = wridx[idx];
|
||||
std::memcpy(kqchanges.get() + wridx[idx], kqchanges.get() + nochanges, sizeof(struct kevent));
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ namespace pvpgn
|
|||
/* eventlog(eventlog_level_trace, __FUNCTION__, "called"); */
|
||||
for (unsigned i = 0; i < sr; i++)
|
||||
{
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "checking %d ident: %d read: %d write: %d", i, kqevents[i].ident, kqevents[i].filter & EVFILT_READ, kqevents[i].filter & EVFILT_WRITE); */
|
||||
/* eventlog(eventlog_level_trace, __FUNCTION__, "checking {} ident: {} read: {} write: {}", i, kqevents[i].ident, kqevents[i].filter & EVFILT_READ, kqevents[i].filter & EVFILT_WRITE); */
|
||||
t_fdwatch_fd *cfd = fdw_fds + (intptr_t)kqevents[i].udata;
|
||||
if (fdw_rw(cfd) & fdwatch_type_read && kqevents[i].filter == EVFILT_READ)
|
||||
if (fdw_hnd(cfd) (fdw_data(cfd), fdwatch_type_read) == -2)
|
||||
|
|
|
@ -53,13 +53,13 @@ namespace pvpgn
|
|||
{
|
||||
int idxr;
|
||||
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d rw: %d", fd, rw);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: {} rw: {}", fd, rw);
|
||||
if (ridx[idx] < 0) {
|
||||
idxr = nofds++;
|
||||
fds[idxr].fd = fdw_fd(fdw_fds + idx);
|
||||
ridx[idx] = idxr;
|
||||
rridx[idxr] = idx;
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "adding new fd on %d", ridx);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "adding new fd on {}", ridx);
|
||||
}
|
||||
else {
|
||||
if (fds[ridx[idx]].fd != fdw_fd(fdw_fds + idx)) {
|
||||
|
@ -67,7 +67,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
idxr = ridx[idx];
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "updating fd on %d", ridx);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "updating fd on {}", ridx);
|
||||
}
|
||||
|
||||
fds[idxr].events = 0;
|
||||
|
@ -80,7 +80,7 @@ namespace pvpgn
|
|||
int
|
||||
FDWPollBackend::del(int idx)
|
||||
{
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d", fd);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: {}", fd);
|
||||
if (ridx[idx] < 0 || !nofds) return -1;
|
||||
if (sr > 0)
|
||||
ERROR0("BUG: called while still handling sockets");
|
||||
|
@ -88,7 +88,7 @@ namespace pvpgn
|
|||
/* move the last entry to the deleted one and decrement nofds count */
|
||||
nofds--;
|
||||
if (ridx[idx] < nofds) {
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving %d", tfds[nofds].fd);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "not last, moving {}", tfds[nofds].fd);
|
||||
ridx[rridx[nofds]] = ridx[idx];
|
||||
rridx[ridx[idx]] = rridx[nofds];
|
||||
std::memcpy(fds.get() + ridx[idx], fds.get() + nofds, sizeof(struct pollfd));
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace pvpgn
|
|||
int
|
||||
FDWSelectBackend::add(int idx, unsigned rw)
|
||||
{
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d rw: %d", fd, rw);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: {} rw: {}", fd, rw);
|
||||
int fd = fdw_fd(fdw_fds + idx);
|
||||
|
||||
/* select() interface is limited by FD_SETSIZE max socket value */
|
||||
|
@ -77,7 +77,7 @@ namespace pvpgn
|
|||
FDWSelectBackend::del(int idx)
|
||||
{
|
||||
int fd = fdw_fd(fdw_fds + idx);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d", fd);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: {}", fd);
|
||||
if (sr > 0)
|
||||
ERROR0("BUG: called while still handling sockets");
|
||||
PSOCK_FD_CLR(fd, trfds.get());
|
||||
|
@ -116,7 +116,7 @@ namespace pvpgn
|
|||
int
|
||||
FDWSelectBackend::cb(t_fdwatch_fd* cfd)
|
||||
{
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "idx: %d fd: %d", idx, fdw_fd->fd);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "idx: {} fd: {}", idx, fdw_fd->fd);
|
||||
if (fdw_rw(cfd) & fdwatch_type_read && PSOCK_FD_ISSET(fdw_fd(cfd), rfds.get())
|
||||
&& fdw_hnd(cfd)(fdw_data(cfd), fdwatch_type_read) == -2) return 0;
|
||||
if (fdw_rw(cfd) & fdwatch_type_write && PSOCK_FD_ISSET(fdw_fd(cfd), wfds.get()))
|
||||
|
@ -128,7 +128,7 @@ namespace pvpgn
|
|||
void
|
||||
FDWSelectBackend::handle()
|
||||
{
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called nofds: %d", fdw_nofds);
|
||||
// eventlog(eventlog_level_trace, __FUNCTION__, "called nofds: {}", fdw_nofds);
|
||||
fdwatch_traverse(fdw_select_cb, this);
|
||||
sr = 0;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "should change to user = '%s' (%d)", user_name, user_id);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "should change to user = '{}' ({})", user_name, user_id);
|
||||
}
|
||||
}
|
||||
if (group_name)
|
||||
|
@ -75,7 +75,7 @@ namespace pvpgn
|
|||
}
|
||||
else
|
||||
{
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "should change to group = '%s' (%d)", group_name, group_id);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "should change to group = '{}' ({})", group_name, group_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,11 +89,11 @@ namespace pvpgn
|
|||
{
|
||||
if (-1 == setgid(group_id))
|
||||
{
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "could not set gid to %d (setgid: %s)", group_id, std::strerror(errno));
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "could not set gid to {} (setgid: {})", group_id, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# ifdef HAVE_GETUID
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Changed privileges to gid = %d", getgid());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Changed privileges to gid = {}", getgid());
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
@ -103,11 +103,11 @@ namespace pvpgn
|
|||
{
|
||||
if (-1 == setuid(user_id))
|
||||
{
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "could not set uid to %d (setuid: %s)", user_id, std::strerror(errno));
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "could not set uid to {} (setuid: {})", user_id, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# ifdef HAVE_GETGID
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Changed privileges to uid = %d", getuid());
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "Changed privileges to uid = {}", getuid());
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
@ -131,11 +131,11 @@ namespace pvpgn
|
|||
#ifdef HAVE_GETPWNAME
|
||||
struct passwd * ent;
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "about to getpwnam(%s)", name);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "about to getpwnam({})", name);
|
||||
|
||||
if (!(ent = getpwnam(name)))
|
||||
{
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "cannot get password file entry for '%s' (getpwnam: %s)", name, std::strerror(errno));
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "cannot get password file entry for '{}' (getpwnam: {})", name, std::strerror(errno));
|
||||
return id;
|
||||
}
|
||||
id = ent->pw_uid;
|
||||
|
@ -164,11 +164,11 @@ namespace pvpgn
|
|||
#ifdef HAVE_GETGRNAM
|
||||
struct group * ent;
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "about to getgrnam(%s)", name);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "about to getgrnam({})", name);
|
||||
|
||||
if (!(ent = getgrnam(name)))
|
||||
{
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "cannot get group file entry for '%s' (getgrnam: %s)", name, std::strerror(errno));
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "cannot get group file entry for '{}' (getgrnam: {})", name, std::strerror(errno));
|
||||
return id;
|
||||
}
|
||||
id = ent->gr_gid;
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
#include <richedit.h>
|
||||
|
||||
#include "common/eventlog.h"
|
||||
#include <common/format.h>
|
||||
#include "common/setup_after.h"
|
||||
|
||||
namespace pvpgn
|
||||
{
|
||||
|
||||
HWND ghwndConsole;
|
||||
HWND ghwndConsole;
|
||||
|
||||
static void guiAddText(const char *str, COLORREF clr)
|
||||
{
|
||||
|
@ -65,14 +66,12 @@ namespace pvpgn
|
|||
SendMessageA(ghwndConsole, EM_REPLACESEL, FALSE, (LPARAM)str);
|
||||
}
|
||||
|
||||
extern int gui_lvprintf(t_eventlog_level l, const char *format, va_list arglist)
|
||||
//template <typename... Args>
|
||||
//void gui_lvprintf(t_eventlog_level l, const char* format, const Args& ... args)
|
||||
void gui_lvprintf(t_eventlog_level l, const char* format, fmt::ArgList args)
|
||||
{
|
||||
char buff[8192];
|
||||
int result;
|
||||
COLORREF clr;
|
||||
|
||||
result = vsprintf(buff, format, arglist);
|
||||
|
||||
switch (l)
|
||||
{
|
||||
case eventlog_level_none:
|
||||
|
@ -99,24 +98,8 @@ namespace pvpgn
|
|||
default:
|
||||
clr = RGB(0, 0, 0);
|
||||
}
|
||||
guiAddText(buff, clr);
|
||||
return result;
|
||||
|
||||
guiAddText(fmt::format(format, args).c_str(), clr);
|
||||
}
|
||||
|
||||
extern int gui_lprintf(t_eventlog_level l, const char *format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
va_start(arglist, format);
|
||||
|
||||
return gui_lvprintf(l, format, arglist);
|
||||
}
|
||||
|
||||
extern int gui_printf(const char *format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
va_start(arglist, format);
|
||||
return gui_lvprintf(eventlog_level_error, format, arglist);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -16,21 +16,20 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GUI_PRINTF_H__
|
||||
#define __GUI_PRINTF_H__
|
||||
#ifndef INCLUDED_GUI_PRINTF_H
|
||||
#define INCLUDED_GUI_PRINTF_H
|
||||
|
||||
#ifdef WIN32_GUI
|
||||
|
||||
#include <cstdarg>
|
||||
#include "common/eventlog.h"
|
||||
#include <common/format.h>
|
||||
|
||||
namespace pvpgn
|
||||
{
|
||||
|
||||
extern int gui_lvprintf(t_eventlog_level l, const char *format, va_list arglist);
|
||||
extern int gui_lprintf(t_eventlog_level l, const char *format, ...);
|
||||
extern int gui_printf(const char *format, ...);
|
||||
|
||||
//template <typename... Args>
|
||||
//void gui_lvprintf(t_eventlog_level l, const char* format, const Args& ... args);
|
||||
void gui_lvprintf(t_eventlog_level l, const char* format, fmt::ArgList args);
|
||||
FMT_VARIADIC(void, gui_lvprintf, t_eventlog_level, const char*);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace pvpgn
|
|||
}
|
||||
if (row >= hashtable->num_rows)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad row %u (max %u)", row, hashtable->num_rows - 1);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad row {} (max {})", row, hashtable->num_rows - 1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ namespace pvpgn
|
|||
curr = curr->next;
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "requested position %u but len=%u", pos, len);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "requested position {} but len={}", pos, len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ namespace pvpgn
|
|||
if (!hashtable)
|
||||
{
|
||||
#ifdef HASHTABLE_DEBUG
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL hashtable from %s:%u", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL hashtable from {}:{}", fn, ln);
|
||||
#else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL hashtable");
|
||||
#endif
|
||||
|
@ -404,7 +404,7 @@ namespace pvpgn
|
|||
if (!hashtable)
|
||||
{
|
||||
#ifdef HASHTABLE_DEBUG
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL hashtable from %s:%u", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL hashtable from {}:{}", fn, ln);
|
||||
#else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL hashtable");
|
||||
#endif
|
||||
|
@ -461,7 +461,7 @@ namespace pvpgn
|
|||
}
|
||||
if (entry->row >= entry->hashtable->num_rows)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "entry has bad row %u (max %u)", entry->row, entry->hashtable->num_rows - 1);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "entry has bad row {} (max {})", entry->row, entry->hashtable->num_rows - 1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ namespace pvpgn
|
|||
if (len++ == pos)
|
||||
return curr->data;
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "requested position %u but len=%u", pos, len);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "requested position {} but len={}", pos, len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ namespace pvpgn
|
|||
if (!list)
|
||||
{
|
||||
#ifdef LIST_DEBUG
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL list from %s:%u", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL list from {}:{}", fn, ln);
|
||||
#else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL list");
|
||||
#endif
|
||||
|
@ -293,7 +293,7 @@ namespace pvpgn
|
|||
if (!list)
|
||||
{
|
||||
#ifdef LIST_DEBUG
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL list from %s:%u", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL list from {}:{}", fn, ln);
|
||||
#else
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL list");
|
||||
#endif
|
||||
|
@ -308,7 +308,7 @@ namespace pvpgn
|
|||
{
|
||||
if (!elem)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL elem from %s:%u", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL elem from {}:{}", fn, ln);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,11 +68,11 @@ namespace pvpgn
|
|||
psock_errno() == PSOCK_ECONNRESET ||
|
||||
#endif
|
||||
0) {
|
||||
/* eventlog(eventlog_level_debug,__FUNCTION__,"[%d] remote host closed connection (psock_recv: %s)",sock,std::strerror(psock_errno())); */
|
||||
/* eventlog(eventlog_level_debug,__FUNCTION__,"[{}] remote host closed connection (psock_recv: {})",sock,std::strerror(psock_errno())); */
|
||||
return -1; /* common error: close connection, but no message */
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[%d] receive error (closing connection) (psock_recv: %s)", sock, std::strerror(psock_errno()));
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "[{}] receive error (closing connection) (psock_recv: {})", sock, std::strerror(psock_errno()));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -83,22 +83,22 @@ namespace pvpgn
|
|||
void * temp;
|
||||
|
||||
if (!packet) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL packet (closing connection)", sock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL packet (closing connection)", sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!currsize) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL currsize (closing connection)", sock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL currsize (closing connection)", sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((header_size = packet_get_header_size(packet)) >= MAX_PACKET_SIZE) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not determine header size (closing connection)", sock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not determine header size (closing connection)", sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(temp = packet_get_raw_data_build(packet, *currsize))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] could not obtain raw data pointer at offset %u (closing connection)", sock, *currsize);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] could not obtain raw data pointer at offset {} (closing connection)", sock, *currsize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -108,12 +108,12 @@ namespace pvpgn
|
|||
unsigned int total_size = packet_get_size(packet);
|
||||
|
||||
if (total_size < header_size) {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] corrupted packet received (total_size=%u currsize=%u) (closing connection)", sock, total_size, *currsize);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] corrupted packet received (total_size={} currsize={}) (closing connection)", sock, total_size, *currsize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (*currsize >= total_size) {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[%d] more data requested for already complete packet (total_size=%u currsize=%u) (closing connection)", sock, total_size, *currsize);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "[{}] more data requested for already complete packet (total_size={} currsize={}) (closing connection)", sock, total_size, *currsize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ namespace pvpgn
|
|||
#ifdef PSOCK_ECONNRESET
|
||||
psock_errno() != PSOCK_ECONNRESET &&
|
||||
#endif
|
||||
1) eventlog(eventlog_level_debug, __FUNCTION__, "[%d] could not send data (closing connection) (psock_send: %s)", sock, std::strerror(psock_errno()));
|
||||
1) eventlog(eventlog_level_debug, __FUNCTION__, "[{}] could not send data (closing connection) (psock_send: {})", sock, std::strerror(psock_errno()));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -176,17 +176,17 @@ namespace pvpgn
|
|||
int addlen;
|
||||
|
||||
if (!packet) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL packet (closing connection)", sock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL packet (closing connection)", sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!currsize) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL currsize (closing connection)", sock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] got NULL currsize (closing connection)", sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((size = packet_get_size(packet)) < 1) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[%d] packet to send is empty (skipping it)", sock);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "[{}] packet to send is empty (skipping it)", sock);
|
||||
*currsize = 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace pvpgn
|
|||
pclass != packet_class_w3route &&
|
||||
pclass != packet_class_wolgameres)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid packet class %d", (int)pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid packet class {}", (int)pclass);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ namespace pvpgn
|
|||
case packet_class_none:
|
||||
return packet_class_none;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class %d", (int)packet->pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class {}", (int)packet->pclass);
|
||||
return packet_class_none;
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ namespace pvpgn
|
|||
case packet_class_none:
|
||||
return "none";
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class %d", (int)packet->pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class {}", (int)packet->pclass);
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ namespace pvpgn
|
|||
pclass != packet_class_w3route &&
|
||||
pclass != packet_class_wolgameres)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid packet class %d", (int)pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid packet class {}", (int)pclass);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ namespace pvpgn
|
|||
case packet_class_bnet:
|
||||
if (packet_get_size(packet) < sizeof(t_bnet_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bnet packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bnet packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return 0;
|
||||
}
|
||||
return (unsigned int)bn_short_get(packet->u.bnet.h.type);
|
||||
|
@ -241,7 +241,7 @@ namespace pvpgn
|
|||
case packet_class_file:
|
||||
if (packet_get_size(packet) < sizeof(t_file_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "file packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "file packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return 0;
|
||||
}
|
||||
return (unsigned int)bn_short_get(packet->u.file.h.type);
|
||||
|
@ -249,7 +249,7 @@ namespace pvpgn
|
|||
case packet_class_udp:
|
||||
if (packet_get_size(packet) < sizeof(t_udp_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "udp packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "udp packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return 0;
|
||||
}
|
||||
return bn_int_get(packet->u.udp.h.type);
|
||||
|
@ -260,7 +260,7 @@ namespace pvpgn
|
|||
case packet_class_d2game:
|
||||
if (packet_get_size(packet) < sizeof(t_d2game_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2game packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2game packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return 0;
|
||||
}
|
||||
return bn_byte_get(packet->u.d2game.h.type);
|
||||
|
@ -268,13 +268,13 @@ namespace pvpgn
|
|||
case packet_class_d2gs:
|
||||
if (packet_get_size(packet) < sizeof(t_d2cs_d2gs_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2gs packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2gs packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return 0;
|
||||
}
|
||||
return bn_short_get(packet->u.d2cs_d2gs.h.type);
|
||||
case packet_class_d2cs_bnetd:
|
||||
if (packet_get_size(packet) < sizeof(t_d2cs_bnetd_header)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs_bnetd packet shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs_bnetd packet shorter than header (len={})", packet_get_size(packet));
|
||||
return 0;
|
||||
}
|
||||
return bn_short_get(packet->u.d2cs_d2gs.h.type);
|
||||
|
@ -282,7 +282,7 @@ namespace pvpgn
|
|||
case packet_class_d2cs:
|
||||
if (packet_get_size(packet) < sizeof(t_d2cs_client_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return 0;
|
||||
}
|
||||
return bn_byte_get(packet->u.d2cs_client.h.type);
|
||||
|
@ -290,7 +290,7 @@ namespace pvpgn
|
|||
case packet_class_w3route:
|
||||
if (packet_get_size(packet) < sizeof(t_w3route_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "w3route packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "w3route packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return 0;
|
||||
}
|
||||
return bn_short_get(packet->u.w3route.h.type);
|
||||
|
@ -298,7 +298,7 @@ namespace pvpgn
|
|||
return 0; /* wolgameres packets don't have a type */
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class %d", (int)packet->pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class {}", (int)packet->pclass);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ namespace pvpgn
|
|||
case packet_class_bnet:
|
||||
if (packet_get_size(packet) < sizeof(t_bnet_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_short_get(packet->u.bnet.h.type))
|
||||
|
@ -505,7 +505,7 @@ namespace pvpgn
|
|||
case packet_class_file:
|
||||
if (packet_get_size(packet) < sizeof(t_file_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_short_get(packet->u.file.h.type))
|
||||
|
@ -518,7 +518,7 @@ namespace pvpgn
|
|||
case packet_class_udp:
|
||||
if (packet_get_size(packet) < sizeof(t_udp_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_int_get(packet->u.udp.h.type))
|
||||
|
@ -540,7 +540,7 @@ namespace pvpgn
|
|||
case packet_class_d2game:
|
||||
if (packet_get_size(packet) < sizeof(t_d2game_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_byte_get(packet->u.d2game.h.type))
|
||||
|
@ -560,7 +560,7 @@ namespace pvpgn
|
|||
case packet_class_w3route:
|
||||
if (packet_get_size(packet) < sizeof(t_w3route_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_short_get(packet->u.bnet.h.type))
|
||||
|
@ -586,7 +586,7 @@ namespace pvpgn
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class %d", (int)packet->pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class {}", (int)packet->pclass);
|
||||
return "unknown";
|
||||
|
||||
case packet_dir_from_server:
|
||||
|
@ -597,7 +597,7 @@ namespace pvpgn
|
|||
case packet_class_bnet:
|
||||
if (packet_get_size(packet) < sizeof(t_bnet_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_short_get(packet->u.bnet.h.type))
|
||||
|
@ -758,7 +758,7 @@ namespace pvpgn
|
|||
case packet_class_file:
|
||||
if (packet_get_size(packet) < sizeof(t_file_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_short_get(packet->u.file.h.type))
|
||||
|
@ -771,7 +771,7 @@ namespace pvpgn
|
|||
case packet_class_udp:
|
||||
if (packet_get_size(packet) < sizeof(t_udp_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_int_get(packet->u.udp.h.type))
|
||||
|
@ -787,7 +787,7 @@ namespace pvpgn
|
|||
case packet_class_d2game:
|
||||
if (packet_get_size(packet) < sizeof(t_d2game_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_byte_get(packet->u.d2game.h.type))
|
||||
|
@ -807,7 +807,7 @@ namespace pvpgn
|
|||
case packet_class_w3route:
|
||||
if (packet_get_size(packet) < sizeof(t_w3route_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return "unknown";
|
||||
}
|
||||
switch (bn_short_get(packet->u.bnet.h.type))
|
||||
|
@ -836,11 +836,11 @@ namespace pvpgn
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class %d", (int)packet->pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class {}", (int)packet->pclass);
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unknown direction %d", (int)dir);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got unknown direction {}", (int)dir);
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
|
@ -858,7 +858,7 @@ namespace pvpgn
|
|||
case packet_class_init:
|
||||
if (type != CLIENT_INITCONN)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "init packet type 0x%08x is not valid", type);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "init packet type 0x{:08} is not valid", type);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -866,12 +866,12 @@ namespace pvpgn
|
|||
case packet_class_bnet:
|
||||
if (packet_get_size(packet)<sizeof(t_bnet_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bnet packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bnet packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
if (type>MAX_NORMAL_TYPE)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bnet packet type 0x%08x is too large", type);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "bnet packet type 0x{:08} is too large", type);
|
||||
return -1;
|
||||
}
|
||||
bn_short_set(&packet->u.bnet.h.type, (unsigned short)type);
|
||||
|
@ -880,12 +880,12 @@ namespace pvpgn
|
|||
case packet_class_file:
|
||||
if (packet_get_size(packet)<sizeof(t_file_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "file packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "file packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
if (type>MAX_FILE_TYPE)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "file packet type 0x%08x is too large", type);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "file packet type 0x{:08} is too large", type);
|
||||
return -1;
|
||||
}
|
||||
bn_short_set(&packet->u.file.h.type, (unsigned short)type);
|
||||
|
@ -894,7 +894,7 @@ namespace pvpgn
|
|||
case packet_class_udp:
|
||||
if (packet_get_size(packet) < sizeof(t_udp_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "udp packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "udp packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
bn_int_set(&packet->u.udp.h.type, type);
|
||||
|
@ -903,7 +903,7 @@ namespace pvpgn
|
|||
case packet_class_d2game:
|
||||
if (packet_get_size(packet) < sizeof(t_d2game_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2game packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2game packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
bn_byte_set(&packet->u.d2game.h.type, type);
|
||||
|
@ -912,7 +912,7 @@ namespace pvpgn
|
|||
case packet_class_d2gs:
|
||||
if (packet_get_size(packet) < sizeof(t_d2cs_d2gs_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2gs packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2gs packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
bn_short_set(&packet->u.d2cs_d2gs.h.type, type);
|
||||
|
@ -921,7 +921,7 @@ namespace pvpgn
|
|||
case packet_class_d2cs_bnetd:
|
||||
if (packet_get_size(packet) < sizeof(t_d2cs_bnetd_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs_bnetd packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs_bnetd packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
bn_short_set(&packet->u.d2cs_bnetd.h.type, type);
|
||||
|
@ -930,7 +930,7 @@ namespace pvpgn
|
|||
case packet_class_d2cs:
|
||||
if (packet_get_size(packet) < sizeof(t_d2cs_client_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "d2cs packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
bn_byte_set(&packet->u.d2cs_client.h.type, type);
|
||||
|
@ -939,7 +939,7 @@ namespace pvpgn
|
|||
case packet_class_w3route:
|
||||
if (packet_get_size(packet) < sizeof(t_w3route_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "w3route packet is shorter than header (len=%u)", packet_get_size(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "w3route packet is shorter than header (len={})", packet_get_size(packet));
|
||||
return -1;
|
||||
}
|
||||
bn_short_set(&packet->u.w3route.h.type, (unsigned short)type);
|
||||
|
@ -954,7 +954,7 @@ namespace pvpgn
|
|||
return 0;
|
||||
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class %d", (int)packet->pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class {}", (int)packet->pclass);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1012,19 +1012,19 @@ namespace pvpgn
|
|||
size = (unsigned int)bn_short_nget(packet->u.wolgameres.h.rngd_size);
|
||||
// if (size>MAX_WOL_GAMERES_PACKET_SIZE) { /* PELISH: Fix for bug but also disable WOL gameres */
|
||||
if (size > MAX_PACKET_SIZE) {
|
||||
// eventlog(eventlog_level_error,__FUNCTION__,"packet has bad size %u",size);
|
||||
// eventlog(eventlog_level_error,__FUNCTION__,"packet has bad size {}",size);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class %d", (int)packet->pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class {}", (int)packet->pclass);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size > MAX_PACKET_SIZE)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has bad size %u", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has bad size {}", size);
|
||||
return 0;
|
||||
}
|
||||
return size;
|
||||
|
@ -1040,7 +1040,7 @@ namespace pvpgn
|
|||
}
|
||||
if (size > MAX_PACKET_SIZE)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad size %u", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad size {}", size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ namespace pvpgn
|
|||
case packet_class_init:
|
||||
if (size != 0 && size != sizeof(t_client_initconn))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size %u for init packet", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size {} for init packet", size);
|
||||
return -1;
|
||||
}
|
||||
packet->len = size;
|
||||
|
@ -1057,7 +1057,7 @@ namespace pvpgn
|
|||
case packet_class_bnet:
|
||||
if (size != 0 && size < sizeof(t_bnet_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size %u for bnet packet", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size {} for bnet packet", size);
|
||||
return -1;
|
||||
}
|
||||
bn_short_set(&packet->u.bnet.h.size, size);
|
||||
|
@ -1065,7 +1065,7 @@ namespace pvpgn
|
|||
case packet_class_file:
|
||||
if (size != 0 && size < sizeof(t_file_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size %u for file packet", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size {} for file packet", size);
|
||||
return -1;
|
||||
}
|
||||
bn_short_set(&packet->u.file.h.size, size);
|
||||
|
@ -1073,7 +1073,7 @@ namespace pvpgn
|
|||
case packet_class_udp:
|
||||
if (size != 0 && size < sizeof(t_udp_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size %u for udp packet", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size {} for udp packet", size);
|
||||
return -1;
|
||||
}
|
||||
packet->len = size;
|
||||
|
@ -1096,7 +1096,7 @@ namespace pvpgn
|
|||
case packet_class_w3route:
|
||||
if (size != 0 && size < sizeof(t_w3route_header))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size %u for w3route packet", size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "invalid size {} for w3route packet", size);
|
||||
return -1;
|
||||
}
|
||||
bn_short_set(&packet->u.w3route.h.size, size);
|
||||
|
@ -1106,7 +1106,7 @@ namespace pvpgn
|
|||
packet->len = size;
|
||||
return 0;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class %d", (int)packet->pclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has invalid class {}", (int)packet->pclass);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1145,7 +1145,7 @@ namespace pvpgn
|
|||
case packet_class_wolgameres:
|
||||
return sizeof(t_wolgameres_header);
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has bad class %d", (int)packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "packet has bad class {}", (int)packet_get_class(packet));
|
||||
return MAX_PACKET_SIZE;
|
||||
}
|
||||
}
|
||||
|
@ -1330,7 +1330,7 @@ namespace pvpgn
|
|||
size = (unsigned int)packet_get_size(packet);
|
||||
if (offset >= size || (((offset >= MAX_PACKET_SIZE) && (packet->pclass != packet_class_wolgameres)) || (offset >= MAX_WOL_GAMERES_PACKET_SIZE)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset %u for packet size %u", offset, size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset {} for packet size {}", offset, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1350,7 +1350,7 @@ namespace pvpgn
|
|||
size = (unsigned int)packet_get_size(packet);
|
||||
if (offset >= size || (((offset >= MAX_PACKET_SIZE) && (packet->pclass != packet_class_wolgameres)) || (offset >= MAX_WOL_GAMERES_PACKET_SIZE)))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset %u for packet size %u", offset, size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset {} for packet size {}", offset, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1368,7 +1368,7 @@ namespace pvpgn
|
|||
|
||||
if (((offset >= MAX_PACKET_SIZE) && (packet->pclass != packet_class_wolgameres)) || (offset >= MAX_WOL_GAMERES_PACKET_SIZE))
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset %u for packet", offset);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset {} for packet", offset);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1390,7 +1390,7 @@ namespace pvpgn
|
|||
size = (unsigned int)packet_get_size(packet);
|
||||
if (offset >= size)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset %u for packet size %u", offset, size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset {} for packet size {}", offset, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1420,7 +1420,7 @@ namespace pvpgn
|
|||
size = (unsigned int)packet_get_size(packet);
|
||||
if (offset + len>size)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset %u and length %u for packet size %u", offset, len, size);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad offset {} and length {} for packet size {}", offset, len, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace pvpgn
|
|||
t_queue * temp;
|
||||
t_packet * packet;
|
||||
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue %p", queue);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue {:p}", queue);
|
||||
if (!queue)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL queue pointer");
|
||||
|
@ -48,12 +48,12 @@ namespace pvpgn
|
|||
if (!temp || !temp->ulen)
|
||||
return NULL;
|
||||
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "getting element from tail (%d/%d head/tail %d/%d)", temp->alen, temp->ulen, temp->head, temp->tail);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "getting element from tail ({}/{} head/tail {}/{})", temp->alen, temp->ulen, temp->head, temp->tail);
|
||||
/* getting entry from tail and updating queue */
|
||||
packet = temp->ring[temp->tail];
|
||||
temp->tail = (temp->tail + 1) % temp->alen;
|
||||
temp->ulen--;
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "read %p element from tail (%d/%d head/tail %d/%d)", packet, temp->alen, temp->ulen, temp->head, temp->tail);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "read {:p} element from tail ({}/{} head/tail {}/{})", packet, temp->alen, temp->ulen, temp->head, temp->tail);
|
||||
|
||||
if (!packet)
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ namespace pvpgn
|
|||
{
|
||||
t_packet * packet;
|
||||
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue %p", queue);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue {:p}", queue);
|
||||
if (!queue)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL queue pointer");
|
||||
|
@ -95,7 +95,7 @@ namespace pvpgn
|
|||
t_queue * temp;
|
||||
void *ptr;
|
||||
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue %p packet %p", queue, packet);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue {:p} packet {:p}", queue, packet);
|
||||
if (!queue)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL queue pointer");
|
||||
|
@ -122,14 +122,14 @@ namespace pvpgn
|
|||
if (temp->ulen == temp->alen) { /* ring queue is full, need to allocate some memory */
|
||||
/* FIXME: find a solution
|
||||
if (temp->alen)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "queue is full (resizing) (oldsize: %u)", temp->alen);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "queue is full (resizing) (oldsize: {})", temp->alen);
|
||||
*/
|
||||
|
||||
ptr = xrealloc(temp->ring, sizeof(t_packet *)* (temp->alen + QUEUE_QUANTUM));
|
||||
temp->ring = (t_packet **)ptr;
|
||||
temp->alen += QUEUE_QUANTUM;
|
||||
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "queue new size %d/%d head/tail %d/%d", temp->alen, temp->ulen, temp->head, temp->tail);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "queue new size {}/{} head/tail {}/{}", temp->alen, temp->ulen, temp->head, temp->tail);
|
||||
if (temp->head) {
|
||||
unsigned moved;
|
||||
|
||||
|
@ -151,13 +151,13 @@ namespace pvpgn
|
|||
|
||||
temp->head = (temp->head + 1) % temp->alen;
|
||||
temp->ulen++;
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "packet added (%d/%d head/tail %d/%d)", temp->alen, temp->ulen, temp->head, temp->tail);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "packet added ({}/{} head/tail {}/{})", temp->alen, temp->ulen, temp->head, temp->tail);
|
||||
}
|
||||
|
||||
|
||||
extern int queue_get_length(t_queue const * const * queue)
|
||||
{
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue %p", queue);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue {:p}", queue);
|
||||
if (!queue)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL queue pointer");
|
||||
|
@ -174,7 +174,7 @@ namespace pvpgn
|
|||
{
|
||||
t_packet * temp;
|
||||
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue %p", queue);
|
||||
// eventlog(eventlog_level_debug, __FUNCTION__, "entered: queue {:p}", queue);
|
||||
if (!queue)
|
||||
{
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL queue pointer");
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace pvpgn
|
|||
#ifdef HAVE_GETRLIMIT
|
||||
struct rlimit rlim;
|
||||
if (getrlimit(RLIM_NUMFILES, &rlim) < 0)
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "getrlimit returned error: %s", std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "getrlimit returned error: {}", std::strerror(errno));
|
||||
socklimit = rlim.rlim_cur;
|
||||
#else
|
||||
/* FIXME: WIN32: somehow get WSAData win32 socket limit here */
|
||||
|
|
|
@ -80,10 +80,10 @@
|
|||
const int LISTEN_QUEUE = 10;
|
||||
|
||||
/* the format for account numbers */
|
||||
#define UID_FORMAT "#%08u"
|
||||
#define UID_FORMAT "{:08}"
|
||||
|
||||
/* the format for game ids */
|
||||
#define GAMEID_FORMAT "#%06u"
|
||||
#define GAMEID_FORMAT "{:06}"
|
||||
|
||||
/* the format of timestamps in the userlogfile */
|
||||
#define USEREVENT_TIME_FORMAT "%b %d %H:%M"
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace pvpgn
|
|||
|
||||
len = std::strlen(tag_str);
|
||||
if (len != 4)
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got unusual sized clienttag '%s'", tag_str);
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "got unusual sized clienttag '{}'", tag_str);
|
||||
|
||||
for (i = 0; i < len && i < 4; i++)
|
||||
temp_str[i] = safe_toupper(tag_str[i]);
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace pvpgn
|
|||
return -1;
|
||||
}
|
||||
if (!(fp = std::fopen(filename, "r"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"%s\" for reading (std::fopen: %s)", filename, std::strerror(errno));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
trans_head = list_create();
|
||||
|
@ -79,39 +79,39 @@ namespace pvpgn
|
|||
buff[endpos + 1] = '\0';
|
||||
}
|
||||
if (!(input = std::strtok(buff, " \t"))) { /* std::strtok modifies the string it is passed */
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing input line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing input line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
/* check for port number - this tells us what programs will use this entry */
|
||||
if (!(temp = std::strrchr(input, ':'))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing port # on input line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing port # on input line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
temp++;
|
||||
/* bnetd doesn't want the port 4000 entries */
|
||||
if (program == TRANS_BNETD && std::strcmp(temp, "4000") == 0) {
|
||||
#ifdef DEBUG_TRANS
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "d2gs input (ignoring) \"%s\"", input);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "d2gs input (ignoring) \"{}\"", input);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
/* d2cs only wants the port 4000 entries */
|
||||
if (program == TRANS_D2CS && std::strcmp(temp, "4000") != 0) {
|
||||
#ifdef DEBUG_TRANS
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "non d2gs input (ignoring) \"%s\"", input);
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "non d2gs input (ignoring) \"{}\"", input);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
if (!(output = std::strtok(NULL, " \t"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing output on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing output on line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(exclude = std::strtok(NULL, " \t"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing exclude on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing exclude on line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
if (!(include = std::strtok(NULL, " \t"))) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing include on line %u of file \"%s\"", line, filename);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing include on line {} of file \"{}\"", line, filename);
|
||||
continue;
|
||||
}
|
||||
/* add exlude networks */
|
||||
|
@ -164,7 +164,7 @@ namespace pvpgn
|
|||
}
|
||||
#ifdef DEBUG_TRANS
|
||||
eventlog(eventlog_level_debug, __FUNCTION__,
|
||||
"Adding Host -> %s, Output -> %s, Network %s - (exclude)",
|
||||
"Adding Host -> {}, Output -> {}, Network {} - (exclude)",
|
||||
addr_get_addr_str(entry->input, tmp1, sizeof(tmp1)),
|
||||
addr_get_addr_str(entry->output, tmp2, sizeof(tmp2)),
|
||||
netaddr_get_addr_str(entry->network, tmp3, sizeof(tmp3)));
|
||||
|
@ -223,7 +223,7 @@ namespace pvpgn
|
|||
}
|
||||
#ifdef DEBUG_TRANS
|
||||
eventlog(eventlog_level_debug, __FUNCTION__,
|
||||
"Adding Host -> %s, Output -> %s, Network %s - (include)",
|
||||
"Adding Host -> {}, Output -> {}, Network {} - (include)",
|
||||
addr_get_addr_str(entry->input, tmp1, sizeof(tmp1)),
|
||||
addr_get_addr_str(entry->output, tmp2, sizeof(tmp2)),
|
||||
netaddr_get_addr_str(entry->network, tmp3, sizeof(tmp3)));
|
||||
|
@ -281,7 +281,7 @@ namespace pvpgn
|
|||
char temp4[32];
|
||||
|
||||
#ifdef DEBUG_TRANS
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "checking %s for client %s ...",
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "checking {} for client {} ...",
|
||||
addr_num_to_addr_str(*addr, *port),
|
||||
addr_num_to_ip_str(clientaddr));
|
||||
#endif
|
||||
|
@ -295,7 +295,7 @@ namespace pvpgn
|
|||
}
|
||||
|
||||
#ifdef DEBUG_TRANS
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "against entry -> %s output %s network %s",
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "against entry -> {} output {} network {}",
|
||||
addr_get_addr_str(entry->input, temp1, sizeof(temp1)),
|
||||
addr_get_addr_str(entry->output, temp2, sizeof(temp2)),
|
||||
netaddr_get_addr_str(entry->network, temp3, sizeof(temp3)));
|
||||
|
@ -313,7 +313,7 @@ namespace pvpgn
|
|||
continue;
|
||||
}
|
||||
#ifdef DEBUG_TRANS
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "%s translated to %s",
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "{} translated to {}",
|
||||
addr_num_to_addr_str(*addr, *port),
|
||||
addr_get_addr_str(entry->output, temp4, sizeof(temp4)));
|
||||
#endif
|
||||
|
@ -323,7 +323,7 @@ namespace pvpgn
|
|||
}
|
||||
}
|
||||
#ifdef DEBUG_TRANS
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "no match found for %s (not translated)",
|
||||
eventlog(eventlog_level_debug, __FUNCTION__, "no match found for {} (not translated)",
|
||||
addr_num_to_addr_str(*addr, *port));
|
||||
#endif
|
||||
return 0; /* no match found in list */
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace pvpgn
|
|||
|
||||
res = malloc(size);
|
||||
if (!res) {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "out of memory (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "out of memory (from {}:{})", fn, ln);
|
||||
if (oom_cb && oom_cb() && (res = malloc(size))) return res;
|
||||
std::abort();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace pvpgn
|
|||
|
||||
res = calloc(nmemb, size);
|
||||
if (!res) {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "out of memory (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "out of memory (from {}:{})", fn, ln);
|
||||
if (oom_cb && oom_cb() && (res = calloc(nmemb, size))) return res;
|
||||
std::abort();
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ namespace pvpgn
|
|||
|
||||
res = std::realloc(ptr, size);
|
||||
if (!res) {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "out of memory (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "out of memory (from {}:{})", fn, ln);
|
||||
if (oom_cb && oom_cb() && (res = std::realloc(ptr, size))) return res;
|
||||
std::abort();
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace pvpgn
|
|||
|
||||
res = strdup(str);
|
||||
if (!res) {
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "out of memory (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_fatal, __FUNCTION__, "out of memory (from {}:{})", fn, ln);
|
||||
if (oom_cb && oom_cb() && (res = strdup(str))) return res;
|
||||
std::abort();
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ namespace pvpgn
|
|||
void xfree_real(void *ptr, const char *fn, unsigned ln)
|
||||
{
|
||||
if (!ptr) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL ptr (from %s:%u)", fn, ln);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got NULL ptr (from {}:{})", fn, ln);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ namespace pvpgn
|
|||
CASE(conn_class_d2gs, packet = packet_create(packet_class_d2gs));
|
||||
CASE(conn_class_bnetd, packet = packet_create(packet_class_d2cs_bnetd));
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad connection class %d", c->cclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad connection class {}", c->cclass);
|
||||
return NULL;
|
||||
}
|
||||
if (!packet) {
|
||||
|
@ -228,10 +228,10 @@ namespace pvpgn
|
|||
int retval;
|
||||
|
||||
if (net_check_connected(c->sock) < 0) {
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "can not connect to %s", addr_num_to_addr_str(c->addr, c->port));
|
||||
eventlog(eventlog_level_warn, __FUNCTION__, "can not connect to {}", addr_num_to_addr_str(c->addr, c->port));
|
||||
return -1;
|
||||
}
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "connected to %s", addr_num_to_addr_str(c->addr, c->port));
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "connected to {}", addr_num_to_addr_str(c->addr, c->port));
|
||||
c->state = conn_state_init;
|
||||
/* this is a kind of hack to not update fd but updating breaks kqueue
|
||||
* and the clean fix would require a cache a userland copy of the kernel
|
||||
|
@ -243,7 +243,7 @@ namespace pvpgn
|
|||
retval = handle_bnetd_init(c);
|
||||
break;
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad connection class %d", c->cclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad connection class {}", c->cclass);
|
||||
return -1;
|
||||
}
|
||||
return retval;
|
||||
|
@ -259,7 +259,7 @@ namespace pvpgn
|
|||
CASE(conn_class_d2gs, retval = handle_d2gs_packet(c, packet));
|
||||
CASE(conn_class_bnetd, retval = handle_bnetd_packet(c, packet));
|
||||
default:
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad connection class %d (close connection)", c->cclass);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad connection class {} (close connection)", c->cclass);
|
||||
retval = -1;
|
||||
break;
|
||||
}
|
||||
|
@ -357,13 +357,13 @@ namespace pvpgn
|
|||
switch (c->cclass) {
|
||||
case conn_class_d2cs:
|
||||
if (prefs_get_idletime() && (now - c->last_active > prefs_get_idletime())) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "client %d idled too long std::time, destroy it", c->sessionnum);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "client {} idled too long std::time, destroy it", c->sessionnum);
|
||||
d2cs_conn_set_state(c, conn_state_destroy);
|
||||
}
|
||||
break;
|
||||
case conn_class_d2gs:
|
||||
if (prefs_get_s2s_idletime() && now - c->last_active > prefs_get_s2s_idletime()) {
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "server %d timed out", c->sessionnum);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "server {} timed out", c->sessionnum);
|
||||
d2cs_conn_set_state(c, conn_state_destroy);
|
||||
}
|
||||
break;
|
||||
|
@ -418,7 +418,7 @@ namespace pvpgn
|
|||
return NULL;
|
||||
}
|
||||
total_connection++;
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "created session=%d socket=%d (%d current connections)", c->sessionnum, sock, total_connection);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "created session={} socket={} ({} current connections)", c->sessionnum, sock, total_connection);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ namespace pvpgn
|
|||
psock_close(c->sock);
|
||||
|
||||
total_connection--;
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[%d] closed connection %d (%d left)", c->sock, c->sessionnum, total_connection);
|
||||
eventlog(eventlog_level_info, __FUNCTION__, "[{}] closed connection {} ({} left)", c->sock, c->sessionnum, total_connection);
|
||||
xfree(c);
|
||||
return 0;
|
||||
}
|
||||
|
@ -602,20 +602,20 @@ namespace pvpgn
|
|||
size = packet_get_size(packet);
|
||||
|
||||
if (type >= table_size || !table[type].size) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad packet type %d (class %d)", type, packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad packet type {} (class {})", type, packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
if (size < table[type].size) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad packet size %d (type %d class %d)", size, type, packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "got bad packet size {} (type {} class {})", size, type, packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
if (!(c->state & table[type].state)) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "connection %d state mismatch for packet type %d (class %d)", c->sessionnum,
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "connection {} state mismatch for packet type {} (class {})", c->sessionnum,
|
||||
type, packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
if (!table[type].handler) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing handler for packet type %d (class %d)", type, packet_get_class(packet));
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "missing handler for packet type {} (class {})", type, packet_get_class(packet));
|
||||
return -1;
|
||||
}
|
||||
return table[type].handler(c, packet);
|
||||
|
@ -649,7 +649,7 @@ namespace pvpgn
|
|||
if (charname) temp = xstrdup(charname);
|
||||
if (c->charname) {
|
||||
if (hashtable_remove_data(conn_charname_list_head, c, c->charname_hash) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error remove charname %s from list", charname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error remove charname {} from list", charname);
|
||||
if (temp) xfree((void *)temp);
|
||||
return -1;
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ namespace pvpgn
|
|||
c->charname = temp;
|
||||
c->charname_hash = conn_charname_hash(charname);
|
||||
if (hashtable_insert_data(conn_charname_list_head, c, c->charname_hash) < 0) {
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error insert charname %s to list", charname);
|
||||
eventlog(eventlog_level_error, __FUNCTION__, "error insert charname {} to list", charname);
|
||||
xfree((void *)c->charname);
|
||||
c->charname = NULL;
|
||||
return -1;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue