From ac831bca3cd6f256deb4e58bf0c167f128c2efc4 Mon Sep 17 00:00:00 2001 From: RoLex Date: Sat, 2 Mar 2019 11:58:43 +0100 Subject: [PATCH] Allow to disable reserving buffer strings --- CMakeLists.txt | 3 +- plugins/chatroom/crooms.cpp | 2 + plugins/floodprot/cpifloodprot.cpp | 4 + plugins/lua/callbacks.cpp | 2 + plugins/perl/callbacks.cpp | 2 + plugins/python/cpipython.cpp | 4 + po/verlihub_core.pot | 694 ++++++++++++++--------------- po/verlihub_plugins.pot | 2 +- src/casyncconn.cpp | 18 + src/casyncconn.h | 4 +- src/cbanlist.cpp | 2 + src/cconfigbase.h | 5 +- src/cconfigitembase.cpp | 4 + src/cconndc.cpp | 2 + src/cdcconsole.cpp | 14 + src/cdcproto.cpp | 102 +++++ src/cserverdc.cpp | 64 +++ src/cusercollection.cpp | 16 + src/cusercollection.h | 12 + src/cvhplugin.cpp | 2 + src/script_api.cpp | 6 + src/stringutils.h | 2 + 22 files changed, 614 insertions(+), 352 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e23bc27a..a5764428 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ message(STATUS) SET(VERLIHUB_VERSION_MAJOR 1) SET(VERLIHUB_VERSION_MINOR 1) SET(VERLIHUB_VERSION_PATCH 0) -SET(VERLIHUB_VERSION_TWEAK 46) +SET(VERLIHUB_VERSION_TWEAK 47) SET(VERLIHUB_VERSION "${VERLIHUB_VERSION_MAJOR}.${VERLIHUB_VERSION_MINOR}.${VERLIHUB_VERSION_PATCH}.${VERLIHUB_VERSION_TWEAK}") #SET(VERLIHUB_SOVERSION "${VERLIHUB_VERSION_MAJOR}.${VERLIHUB_VERSION_MINOR}.${VERLIHUB_VERSION_PATCH}") SET(PROJECT_NAME "verlihub") @@ -185,6 +185,7 @@ IF(NOT HAVE_GETOPT_H) MESSAGE(FATAL_ERROR "[ ER ] getopt.h header not found, it is required to build Verlihub.") ENDIF(NOT HAVE_GETOPT_H) +OPTION(USE_BUFFER_RESERVE "Use buffer string reservation?" OFF) # use cmake -DUSE_BUFFER_RESERVE=ON to use buffer string reservation OPTION(DEFINE_DEBUG "Build the project using debugging code" OFF) # use cmake -DDEFINE_DEBUG=ON to enable debug IF(DEFINE_DEBUG) diff --git a/plugins/chatroom/crooms.cpp b/plugins/chatroom/crooms.cpp index 518b6d45..ce14958d 100644 --- a/plugins/chatroom/crooms.cpp +++ b/plugins/chatroom/crooms.cpp @@ -77,8 +77,10 @@ void cRoom::OnLoad() mChatRoom->mClass = tUserCl(3); if (mTopic.size()) { +#ifdef USE_BUFFER_RESERVE if (desc.capacity() < (desc.size() + 2 + mTopic.size())) desc.reserve(desc.size() + 2 + mTopic.size()); +#endif desc.append(": "); desc.append(mTopic); diff --git a/plugins/floodprot/cpifloodprot.cpp b/plugins/floodprot/cpifloodprot.cpp index c9fb07ca..d1f4c11a 100644 --- a/plugins/floodprot/cpifloodprot.cpp +++ b/plugins/floodprot/cpifloodprot.cpp @@ -63,7 +63,9 @@ bool cpiFloodprot::OnNewConn(cConnDC *conn) { if (!mFloodprotect->AddConn(conn, 1)) { string omsg; +#ifdef USE_BUFFER_RESERVE omsg.reserve(63 + 1); +#endif omsg = "Sorry, the limit of connections from your IP has been exceeded."; // length = 63 conn->Send(omsg, true); conn->CloseNice(500); // not sure if this is needed @@ -77,7 +79,9 @@ bool cpiFloodprot::OnUserLogin(cUser *user) { if (!mFloodprotect->AddConn(user->mxConn, 1)) { string omsg; +#ifdef USE_BUFFER_RESERVE omsg.reserve(76 + 1); +#endif omsg = "Sorry, the limit of unregistered connections form your IP has been exceeded."; // length = 76 user->mxConn->Send(omsg, true); user->mxConn->CloseNice(500); // not sure if this is needed diff --git a/plugins/lua/callbacks.cpp b/plugins/lua/callbacks.cpp index 0e734799..73bf5840 100644 --- a/plugins/lua/callbacks.cpp +++ b/plugins/lua/callbacks.cpp @@ -2200,8 +2200,10 @@ int _EditBot(lua_State *L) serv->mP.Create_MyINFO(robot->mMyINFO, nick, desc, conn, mail, shar, false); // send new myinfo after quit, dont reserve for pipe, we are not sending this +#ifdef USE_BUFFER_RESERVE if (temp.capacity() < (robot->mMyINFO.size() + 1)) // reserve for pipe temp.reserve(robot->mMyINFO.size() + 1); +#endif temp = robot->mMyINFO; serv->mUserList.SendToAll(temp, serv->mC.delayed_myinfo, true); // show new myinfo to all diff --git a/plugins/perl/callbacks.cpp b/plugins/perl/callbacks.cpp index 1b1ecced..5d7ef157 100644 --- a/plugins/perl/callbacks.cpp +++ b/plugins/perl/callbacks.cpp @@ -152,7 +152,9 @@ bool nVerliHub::nPerlPlugin::nCallback::EditBot(const char *nick, int clas, cons serv->mP.Create_MyINFO(robot->mMyINFO, nick, desc, conn, mail, shar, false); // dont reserve for pipe, we are not sending this //pi->mPerl.editBot(nick, shar, (char*)robot->mMyINFO.c_str(), clas); string temp; +#ifdef USE_BUFFER_RESERVE temp.reserve(robot->mMyINFO.size() + 1); // first use, reserve for pipe +#endif serv->mUserList.SendToAll(temp, serv->mC.delayed_myinfo, true); // show new myinfo to all if (clas >= 3) { // todo: oplist_class, userip diff --git a/plugins/python/cpipython.cpp b/plugins/python/cpipython.cpp index 6a828624..ffd2aac7 100644 --- a/plugins/python/cpipython.cpp +++ b/plugins/python/cpipython.cpp @@ -1338,11 +1338,15 @@ w_Targs *_SetMyINFO(int id, w_Targs *args) freee(origmail); freee(origsize); +#ifdef USE_BUFFER_RESERVE if (u->mMyINFO.capacity() < newinfo.size()) u->mMyINFO.reserve(newinfo.size()); +#endif u->mMyINFO = newinfo; +#ifdef USE_BUFFER_RESERVE newinfo.reserve(newinfo.size() + 1); // reserve for pipe +#endif cpiPython::me->server->mUserList.SendToAll(newinfo, cpiPython::me->server->mC.delayed_myinfo, true); return w_ret1; } diff --git a/po/verlihub_core.pot b/po/verlihub_core.pot index 7b240a91..8dd43445 100644 --- a/po/verlihub_core.pot +++ b/po/verlihub_core.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Verlihub\n" "Report-Msgid-Bugs-To: Verlihub Team \n" -"POT-Creation-Date: 2019-01-27 01:17+0100\n" +"POT-Creation-Date: 2019-03-02 11:44+0100\n" "PO-Revision-Date: 2016-03-11 20:28+0100\n" "Last-Translator: Frog \n" "Language-Team: Verlihub Team \n" @@ -19,13 +19,13 @@ msgstr "" "X-Generator: Poedit 2.2.1\n" "X-Poedit-SearchPath-0: ../src\n" -#: ../src/cban.cpp:107 ../src/cserverdc.cpp:2542 ../src/cuser.cpp:199 +#: ../src/cban.cpp:107 ../src/cserverdc.cpp:2597 ../src/cuser.cpp:199 #: ../src/cuser.cpp:229 #, c-format msgid "Nick: %s" msgstr "" -#: ../src/cban.cpp:110 ../src/cserverdc.cpp:2544 ../src/cuser.cpp:205 +#: ../src/cban.cpp:110 ../src/cserverdc.cpp:2599 ../src/cuser.cpp:205 #, c-format msgid "IP: %s" msgstr "" @@ -103,7 +103,7 @@ msgid "Nick + IP" msgstr "" #: ../src/cban.cpp:176 ../src/cdcconsole.cpp:328 ../src/cdcconsole.cpp:403 -#: ../src/cdcconsole.cpp:552 ../src/cdcconsole.cpp:1287 +#: ../src/cdcconsole.cpp:552 ../src/cdcconsole.cpp:1291 msgid "IP" msgstr "" @@ -157,7 +157,7 @@ msgid "Type" msgstr "" #: ../src/cbanlist.cpp:484 ../src/cpenaltylist.cpp:199 -#: ../src/cserverdc.cpp:2513 +#: ../src/cserverdc.cpp:2568 msgid "Operator" msgstr "" @@ -245,19 +245,19 @@ msgstr "" msgid "General timeout" msgstr "" -#: ../src/cconndc.cpp:448 +#: ../src/cconndc.cpp:450 msgid "Protocol flood detected" msgstr "" -#: ../src/cconndc.cpp:484 ../src/cdcproto.cpp:3519 ../src/cdcproto.cpp:3670 -#: ../src/cserverdc.cpp:2353 ../src/cserverdc.cpp:2420 -#: ../src/cserverdc.cpp:2461 +#: ../src/cconndc.cpp:486 ../src/cdcproto.cpp:3553 ../src/cdcproto.cpp:3704 +#: ../src/cserverdc.cpp:2408 ../src/cserverdc.cpp:2475 +#: ../src/cserverdc.cpp:2516 msgid "Chat" msgstr "" -#: ../src/cconndc.cpp:504 ../src/cconndc.cpp:508 ../src/cdcproto.cpp:3583 -#: ../src/cdcproto.cpp:3722 ../src/cdctag.cpp:211 ../src/creguserinfo.cpp:112 -#: ../src/cserverdc.cpp:2497 ../src/cserverdc.cpp:2521 +#: ../src/cconndc.cpp:506 ../src/cconndc.cpp:510 ../src/cdcproto.cpp:3617 +#: ../src/cdcproto.cpp:3756 ../src/cdctag.cpp:211 ../src/creguserinfo.cpp:112 +#: ../src/cserverdc.cpp:2552 ../src/cserverdc.cpp:2576 msgid "Unknown" msgstr "" @@ -389,12 +389,12 @@ msgid "User" msgstr "" #: ../src/cdcconsole.cpp:330 ../src/cdcconsole.cpp:365 -#: ../src/cdcconsole.cpp:410 ../src/cdcconsole.cpp:1172 -#: ../src/cdcconsole.cpp:1197 ../src/cdcconsole.cpp:1223 -#: ../src/cdcconsole.cpp:1257 ../src/cdcconsole.cpp:1435 -#: ../src/cdcconsole.cpp:2279 ../src/cdcconsole.cpp:2713 -#: ../src/cdcconsole.cpp:2725 ../src/cdcproto.cpp:3258 -#: ../src/cserverdc.cpp:2605 +#: ../src/cdcconsole.cpp:410 ../src/cdcconsole.cpp:1176 +#: ../src/cdcconsole.cpp:1201 ../src/cdcconsole.cpp:1227 +#: ../src/cdcconsole.cpp:1261 ../src/cdcconsole.cpp:1441 +#: ../src/cdcconsole.cpp:2285 ../src/cdcconsole.cpp:2719 +#: ../src/cdcconsole.cpp:2731 ../src/cdcproto.cpp:3288 +#: ../src/cserverdc.cpp:2660 #, c-format msgid "User not found: %s" msgstr "" @@ -413,7 +413,7 @@ msgstr[0] "" msgstr[1] "" #: ../src/cdcconsole.cpp:361 ../src/cdcconsole.cpp:408 -#: ../src/cdcconsole.cpp:1288 +#: ../src/cdcconsole.cpp:1292 msgid "Host" msgstr "" @@ -452,7 +452,7 @@ msgstr "" msgid "Please note, hub has been scheduled to stop in: %s" msgstr "" -#: ../src/cdcconsole.cpp:469 ../src/cserverdc.cpp:3254 +#: ../src/cdcconsole.cpp:469 ../src/cserverdc.cpp:3315 msgid "Please note, hub will be stopped now." msgstr "" @@ -468,7 +468,7 @@ msgstr[0] "" msgstr[1] "" #: ../src/cdcconsole.cpp:536 ../src/cdcconsole.cpp:688 -#: ../src/cserverdc.cpp:1255 +#: ../src/cserverdc.cpp:1307 msgid "Your information" msgstr "" @@ -480,11 +480,11 @@ msgstr "" msgid "This command is currently disabled." msgstr "" -#: ../src/cdcconsole.cpp:573 ../src/cdcproto.cpp:1950 +#: ../src/cdcconsole.cpp:573 ../src/cdcproto.cpp:1968 msgid "Main chat is currently disabled for users with your class." msgstr "" -#: ../src/cdcconsole.cpp:594 ../src/cdcproto.cpp:1958 +#: ../src/cdcconsole.cpp:594 ../src/cdcproto.cpp:1976 msgid "Your message wasn't sent because it equals your previous message." msgstr "" @@ -504,7 +504,7 @@ msgstr "" msgid "Public chat messages are already hidden. To show them, write: +chat" msgstr "" -#: ../src/cdcconsole.cpp:637 ../src/cserverdc.cpp:2582 +#: ../src/cdcconsole.cpp:637 ../src/cserverdc.cpp:2637 #, c-format msgid "Software: %s %s" msgstr "" @@ -589,12 +589,12 @@ msgstr "" #: ../src/cdcconsole.cpp:681 ../src/cmaxminddb.cpp:1063 #: ../src/cmaxminddb.cpp:1077 ../src/cmaxminddb.cpp:1091 -#: ../src/cserverdc.cpp:2586 +#: ../src/cserverdc.cpp:2641 #, c-format msgid "Status: %s" msgstr "" -#: ../src/cdcconsole.cpp:682 ../src/cserverdc.cpp:2584 +#: ../src/cdcconsole.cpp:682 ../src/cserverdc.cpp:2639 #, c-format msgid "Users: %d" msgstr "" @@ -616,7 +616,7 @@ msgstr "" #: ../src/cdcconsole.cpp:686 ../src/cdcconsole.cpp:716 #: ../src/cinfoserver.cpp:436 ../src/cpenaltylist.cpp:264 -#: ../src/cserverdc.cpp:2585 +#: ../src/cserverdc.cpp:2640 #, c-format msgid "Share: %s" msgstr "" @@ -668,707 +668,707 @@ msgid "You are not registered yet." msgstr "" #: ../src/cdcconsole.cpp:763 ../src/cdcconsole.cpp:764 -#: ../src/cdcconsole.cpp:3172 ../src/cdcconsole.cpp:3173 +#: ../src/cdcconsole.cpp:3178 ../src/cdcconsole.cpp:3179 #: ../src/script_api.cpp:713 ../src/script_api.cpp:714 msgid "You have been unregistered." msgstr "" -#: ../src/cdcconsole.cpp:795 +#: ../src/cdcconsole.cpp:797 msgid "User has been unregistered" msgstr "" -#: ../src/cdcconsole.cpp:798 +#: ../src/cdcconsole.cpp:800 msgid "An error occured while unregistering." msgstr "" -#: ../src/cdcconsole.cpp:803 +#: ../src/cdcconsole.cpp:805 msgid "Unregistration request" msgstr "" -#: ../src/cdcconsole.cpp:804 +#: ../src/cdcconsole.cpp:806 msgid "Thank you, your unregistration request has been sent to operators. Please await an answer." msgstr "" -#: ../src/cdcconsole.cpp:822 +#: ../src/cdcconsole.cpp:824 #, c-format msgid "Your nick must start with: %s" msgstr "" -#: ../src/cdcconsole.cpp:845 +#: ../src/cdcconsole.cpp:847 #, c-format msgid "You need to share at least: %s" msgstr "" -#: ../src/cdcconsole.cpp:856 ../src/cdcconsole.cpp:1023 ../src/cdcproto.cpp:798 +#: ../src/cdcconsole.cpp:858 ../src/cdcconsole.cpp:1025 ../src/cdcproto.cpp:800 #, c-format msgid "Minimum password length is %d characters. Please retry." msgstr "" -#: ../src/cdcconsole.cpp:872 ../src/cdcconsole.cpp:3126 +#: ../src/cdcconsole.cpp:874 ../src/cdcconsole.cpp:3132 #, c-format msgid "You have been registered with class %d and following password: %s" msgstr "" -#: ../src/cdcconsole.cpp:889 +#: ../src/cdcconsole.cpp:891 #, c-format msgid "New user has been registered with class %d" msgstr "" -#: ../src/cdcconsole.cpp:893 +#: ../src/cdcconsole.cpp:895 msgid "An error occured while registering." msgstr "" -#: ../src/cdcconsole.cpp:904 +#: ../src/cdcconsole.cpp:906 #, c-format msgid "Registration request with password: %s" msgstr "" -#: ../src/cdcconsole.cpp:906 +#: ../src/cdcconsole.cpp:908 msgid "Registration request without password" msgstr "" -#: ../src/cdcconsole.cpp:909 +#: ../src/cdcconsole.cpp:911 msgid "Thank you, your registration request has been sent to operators. Please await an answer." msgstr "" -#: ../src/cdcconsole.cpp:919 +#: ../src/cdcconsole.cpp:921 msgid "You have no rights to change topic." msgstr "" -#: ../src/cdcconsole.cpp:931 +#: ../src/cdcconsole.cpp:933 #, c-format msgid "Topic must not exceed 255 characters, but your topic has %d characters." msgstr "" -#: ../src/cdcconsole.cpp:940 ../src/cdcconsole.cpp:1692 -#: ../src/cdcconsole.cpp:1812 ../src/cdcconsole.cpp:2180 -#: ../src/cdcconsole.cpp:3116 ../src/cdcconsole.cpp:3161 -#: ../src/cdcconsole.cpp:3233 ../src/cserverdc.cpp:2740 +#: ../src/cdcconsole.cpp:942 ../src/cdcconsole.cpp:1698 +#: ../src/cdcconsole.cpp:1818 ../src/cdcconsole.cpp:2186 +#: ../src/cdcconsole.cpp:3122 ../src/cdcconsole.cpp:3167 +#: ../src/cdcconsole.cpp:3241 ../src/cserverdc.cpp:2795 msgid "Your action was blocked by a plugin." msgstr "" -#: ../src/cdcconsole.cpp:950 +#: ../src/cdcconsole.cpp:952 #, c-format msgid "%s changed the topic to: %s" msgstr "" -#: ../src/cdcconsole.cpp:952 +#: ../src/cdcconsole.cpp:954 #, c-format msgid "%s removed the topic." msgstr "" -#: ../src/cdcconsole.cpp:1014 +#: ../src/cdcconsole.cpp:1016 msgid "You are not allowed to change your password now. Ask an operator for help." msgstr "" -#: ../src/cdcconsole.cpp:1030 ../src/cdcconsole.cpp:3219 -#: ../src/cdcproto.cpp:806 +#: ../src/cdcconsole.cpp:1032 ../src/cdcconsole.cpp:3227 +#: ../src/cdcproto.cpp:808 msgid "Error updating password." msgstr "" -#: ../src/cdcconsole.cpp:1048 ../src/cdcproto.cpp:826 +#: ../src/cdcconsole.cpp:1050 ../src/cdcproto.cpp:828 msgid "Password updated successfully." msgstr "" -#: ../src/cdcconsole.cpp:1061 +#: ../src/cdcconsole.cpp:1063 msgid "Please use: !hideme , where is the maximum class of users that may not see your kicks." msgstr "" -#: ../src/cdcconsole.cpp:1067 +#: ../src/cdcconsole.cpp:1069 #, c-format msgid "Your kicks are now hidden from users with class %d and below." msgstr "" -#: ../src/cdcconsole.cpp:1079 +#: ../src/cdcconsole.cpp:1081 msgid "Command usage: !userlimit [=60]" msgstr "" -#: ../src/cdcconsole.cpp:1090 +#: ../src/cdcconsole.cpp:1092 #, c-format msgid "Updating max_users variable to %d for the duration of %d minute." msgid_plural "Updating max_users variable to %d for the duration of %d minutes." msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:1114 +#: ../src/cdcconsole.cpp:1116 #, c-format msgid "Command usage: !class [class=%d]" msgstr "" -#: ../src/cdcconsole.cpp:1114 +#: ../src/cdcconsole.cpp:1116 #, c-format msgid "maximum allowed class is %d" msgstr "" -#: ../src/cdcconsole.cpp:1125 +#: ../src/cdcconsole.cpp:1127 #, c-format msgid "Temporarily changing class from %d to %d for user: %s" msgstr "" -#: ../src/cdcconsole.cpp:1169 +#: ../src/cdcconsole.cpp:1173 #, c-format msgid "You have no rights to change class for this user: %s" msgstr "" -#: ../src/cdcconsole.cpp:1191 +#: ../src/cdcconsole.cpp:1195 #, c-format msgid "Kicks of this user are now hidden: %s" msgstr "" -#: ../src/cdcconsole.cpp:1194 ../src/cdcconsole.cpp:1220 -#: ../src/cdcconsole.cpp:1255 ../src/cdcconsole.cpp:1309 -#: ../src/cdcconsole.cpp:1455 ../src/cdcconsole.cpp:1550 -#: ../src/cdcconsole.cpp:1775 ../src/cdcconsole.cpp:1897 -#: ../src/cdcconsole.cpp:1971 ../src/cdcconsole.cpp:2077 -#: ../src/cdcconsole.cpp:2155 ../src/cdcconsole.cpp:2252 -#: ../src/cdcconsole.cpp:2541 ../src/cdcconsole.cpp:2845 -#: ../src/cdcconsole.cpp:2966 ../src/cdcconsole.cpp:2987 -#: ../src/cdcconsole.cpp:3036 ../src/cdcconsole.cpp:3093 -#: ../src/cdcconsole.cpp:3449 ../src/cdcconsole.cpp:3534 +#: ../src/cdcconsole.cpp:1198 ../src/cdcconsole.cpp:1224 +#: ../src/cdcconsole.cpp:1259 ../src/cdcconsole.cpp:1313 +#: ../src/cdcconsole.cpp:1461 ../src/cdcconsole.cpp:1556 +#: ../src/cdcconsole.cpp:1781 ../src/cdcconsole.cpp:1903 +#: ../src/cdcconsole.cpp:1977 ../src/cdcconsole.cpp:2083 +#: ../src/cdcconsole.cpp:2161 ../src/cdcconsole.cpp:2258 +#: ../src/cdcconsole.cpp:2547 ../src/cdcconsole.cpp:2851 +#: ../src/cdcconsole.cpp:2972 ../src/cdcconsole.cpp:2993 +#: ../src/cdcconsole.cpp:3042 ../src/cdcconsole.cpp:3099 +#: ../src/cdcconsole.cpp:3463 ../src/cdcconsole.cpp:3548 #: ../src/tlistconsole.h:92 msgid "You have no rights to do this." msgstr "" -#: ../src/cdcconsole.cpp:1217 +#: ../src/cdcconsole.cpp:1221 #, c-format msgid "Kicks of this user are now visible: %s" msgstr "" -#: ../src/cdcconsole.cpp:1241 +#: ../src/cdcconsole.cpp:1245 msgid "Use !protect ." msgstr "" -#: ../src/cdcconsole.cpp:1241 +#: ../src/cdcconsole.cpp:1245 #, c-format msgid "Max class is %d" msgstr "" -#: ../src/cdcconsole.cpp:1252 +#: ../src/cdcconsole.cpp:1256 #, c-format msgid "User %s is temporarily protected from class %d" msgstr "" -#: ../src/cdcconsole.cpp:1266 ../src/cserverdc.cpp:3279 +#: ../src/cdcconsole.cpp:1270 ../src/cserverdc.cpp:3340 msgid "Done reloading all lists and databases." msgstr "" -#: ../src/cdcconsole.cpp:1273 +#: ../src/cdcconsole.cpp:1277 msgid "Report command is currently disabled." msgstr "" -#: ../src/cdcconsole.cpp:1286 +#: ../src/cdcconsole.cpp:1290 #, c-format msgid "Reported user %s" msgstr "" -#: ../src/cdcconsole.cpp:1290 +#: ../src/cdcconsole.cpp:1294 #, c-format msgid "Reported offline user %s" msgstr "" -#: ../src/cdcconsole.cpp:1293 +#: ../src/cdcconsole.cpp:1297 msgid "Without reason" msgstr "" -#: ../src/cdcconsole.cpp:1295 +#: ../src/cdcconsole.cpp:1299 msgid "Reason" msgstr "" -#: ../src/cdcconsole.cpp:1299 +#: ../src/cdcconsole.cpp:1303 msgid "Thank you, your report has been accepted." msgstr "" -#: ../src/cdcconsole.cpp:1377 ../src/cdcconsole.cpp:1636 -#: ../src/cdcconsole.cpp:2124 ../src/cdcconsole.cpp:2264 -#: ../src/cdcconsole.cpp:2582 ../src/cdcconsole.cpp:3024 -#: ../src/cdcconsole.cpp:3099 +#: ../src/cdcconsole.cpp:1381 ../src/cdcconsole.cpp:1642 +#: ../src/cdcconsole.cpp:2130 ../src/cdcconsole.cpp:2270 +#: ../src/cdcconsole.cpp:2588 ../src/cdcconsole.cpp:3030 +#: ../src/cdcconsole.cpp:3105 msgid "Missing command parameters." msgstr "" -#: ../src/cdcconsole.cpp:1445 +#: ../src/cdcconsole.cpp:1451 msgid "Protocol command successfully sent." msgstr "" -#: ../src/cdcconsole.cpp:1500 +#: ../src/cdcconsole.cpp:1506 msgid "Ban list has been cleaned." msgstr "" -#: ../src/cdcconsole.cpp:1505 +#: ../src/cdcconsole.cpp:1511 msgid "Temporary ban list has been cleaned." msgstr "" -#: ../src/cdcconsole.cpp:1510 +#: ../src/cdcconsole.cpp:1516 msgid "Unban list has been cleaned." msgstr "" -#: ../src/cdcconsole.cpp:1515 +#: ../src/cdcconsole.cpp:1521 msgid "Kick list has been cleaned." msgstr "" -#: ../src/cdcconsole.cpp:1522 +#: ../src/cdcconsole.cpp:1528 msgid "Temporary rights list has been cleaned." msgstr "" -#: ../src/cdcconsole.cpp:1531 +#: ../src/cdcconsole.cpp:1537 msgid "Ban, unban, kick and temporary ban lists has been cleaned." msgstr "" -#: ../src/cdcconsole.cpp:1535 ../src/cdcconsole.cpp:1884 -#: ../src/cdcconsole.cpp:1961 ../src/cdcconsole.cpp:2064 -#: ../src/cdcconsole.cpp:2811 ../src/cdcconsole.cpp:3324 -#: ../src/cdcconsole.cpp:3457 +#: ../src/cdcconsole.cpp:1541 ../src/cdcconsole.cpp:1890 +#: ../src/cdcconsole.cpp:1967 ../src/cdcconsole.cpp:2070 +#: ../src/cdcconsole.cpp:2817 ../src/cdcconsole.cpp:3334 +#: ../src/cdcconsole.cpp:3471 msgid "This command is not implemented." msgstr "" -#: ../src/cdcconsole.cpp:1668 +#: ../src/cdcconsole.cpp:1674 msgid "Please provide a valid ban time." msgstr "" -#: ../src/cdcconsole.cpp:1688 ../src/cdcconsole.cpp:1734 +#: ../src/cdcconsole.cpp:1694 ../src/cdcconsole.cpp:1740 msgid "No reason specified" msgstr "" -#: ../src/cdcconsole.cpp:1697 +#: ../src/cdcconsole.cpp:1703 msgid "Removed ban" msgstr "" -#: ../src/cdcconsole.cpp:1699 +#: ../src/cdcconsole.cpp:1705 msgid "Ban information" msgstr "" -#: ../src/cdcconsole.cpp:1724 +#: ../src/cdcconsole.cpp:1730 #, c-format msgid "%d ban found." msgid_plural "%d bans found." msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:1785 +#: ../src/cdcconsole.cpp:1791 #, c-format msgid "Unknown range format: %s" msgstr "" -#: ../src/cdcconsole.cpp:1835 ../src/cdcconsole.cpp:1861 +#: ../src/cdcconsole.cpp:1841 ../src/cdcconsole.cpp:1867 #, c-format msgid "%s was banned for %s by %s with reason: %s" msgstr "" -#: ../src/cdcconsole.cpp:1837 ../src/cdcconsole.cpp:1863 +#: ../src/cdcconsole.cpp:1843 ../src/cdcconsole.cpp:1869 #, c-format msgid "%s was banned for %s by %s without reason." msgstr "" -#: ../src/cdcconsole.cpp:1840 ../src/cdcconsole.cpp:1866 +#: ../src/cdcconsole.cpp:1846 ../src/cdcconsole.cpp:1872 #, c-format msgid "%s was banned permanently by %s with reason: %s" msgstr "" -#: ../src/cdcconsole.cpp:1842 ../src/cdcconsole.cpp:1868 +#: ../src/cdcconsole.cpp:1848 ../src/cdcconsole.cpp:1874 #, c-format msgid "%s was banned permanently by %s without reason." msgstr "" -#: ../src/cdcconsole.cpp:1879 +#: ../src/cdcconsole.cpp:1885 msgid "Added new ban" msgstr "" -#: ../src/cdcconsole.cpp:2055 +#: ../src/cdcconsole.cpp:2061 #, c-format msgid "Trigger definition: %s" msgstr "" -#: ../src/cdcconsole.cpp:2060 +#: ../src/cdcconsole.cpp:2066 #, c-format msgid "Trigger not found: %s" msgstr "" -#: ../src/cdcconsole.cpp:2116 +#: ../src/cdcconsole.cpp:2122 #, c-format msgid "Configuration file: %s" msgstr "" -#: ../src/cdcconsole.cpp:2119 +#: ../src/cdcconsole.cpp:2125 #, c-format msgid "Configuration file is empty: %s" msgstr "" -#: ../src/cdcconsole.cpp:2139 +#: ../src/cdcconsole.cpp:2145 #, c-format msgid "Configuration filter results: %s" msgstr "" -#: ../src/cdcconsole.cpp:2141 +#: ../src/cdcconsole.cpp:2147 #, c-format msgid "Configuration filter didn't return any results: %s" msgstr "" -#: ../src/cdcconsole.cpp:2177 +#: ../src/cdcconsole.cpp:2183 #, c-format msgid "Undefined configuration variable: %s.%s" msgstr "" -#: ../src/cdcconsole.cpp:2183 +#: ../src/cdcconsole.cpp:2189 #, c-format msgid "Updated configuration %s.%s: %s -> %s" msgstr "" -#: ../src/cdcconsole.cpp:2192 +#: ../src/cdcconsole.cpp:2198 #, c-format msgid "Warning: %s allows maximum %d users, but current resource limit is %d, so consider running ulimit -n and restarting the hub." msgstr "" -#: ../src/cdcconsole.cpp:2349 ../src/cdcconsole.cpp:2774 +#: ../src/cdcconsole.cpp:2355 ../src/cdcconsole.cpp:2780 #, c-format msgid "Error setting rights or restrictions for user: %s" msgstr "" -#: ../src/cdcconsole.cpp:2359 ../src/cdcconsole.cpp:2782 +#: ../src/cdcconsole.cpp:2365 ../src/cdcconsole.cpp:2788 #, c-format msgid "Allowing user to use main chat again: %s" msgstr "" -#: ../src/cdcconsole.cpp:2361 ../src/cdcconsole.cpp:2780 +#: ../src/cdcconsole.cpp:2367 ../src/cdcconsole.cpp:2786 #, c-format msgid "Restricting user from using main chat: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2369 ../src/cdcconsole.cpp:2798 +#: ../src/cdcconsole.cpp:2375 ../src/cdcconsole.cpp:2804 #, c-format msgid "%s was allowed to use main chat again by %s without reason." msgstr "" -#: ../src/cdcconsole.cpp:2371 ../src/cdcconsole.cpp:2793 +#: ../src/cdcconsole.cpp:2377 ../src/cdcconsole.cpp:2799 #, c-format msgid "%s was restricted from using main chat for %s by %s without reason." msgstr "" -#: ../src/cdcconsole.cpp:2384 +#: ../src/cdcconsole.cpp:2390 #, c-format msgid "Allowing user to use private chat again: %s" msgstr "" -#: ../src/cdcconsole.cpp:2386 +#: ../src/cdcconsole.cpp:2392 #, c-format msgid "Restricting user from using private chat: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2394 +#: ../src/cdcconsole.cpp:2400 #, c-format msgid "%s was allowed to use private chat again by %s without reason." msgstr "" -#: ../src/cdcconsole.cpp:2396 +#: ../src/cdcconsole.cpp:2402 #, c-format msgid "%s was restricted from using private chat for %s by %s without reason." msgstr "" -#: ../src/cdcconsole.cpp:2409 +#: ../src/cdcconsole.cpp:2415 #, c-format msgid "Allowing user to use main and private chat again: %s" msgstr "" -#: ../src/cdcconsole.cpp:2411 +#: ../src/cdcconsole.cpp:2417 #, c-format msgid "Restricting user from using main and private chat: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2419 +#: ../src/cdcconsole.cpp:2425 #, c-format msgid "%s was allowed to use main and private chat again by %s without reason." msgstr "" -#: ../src/cdcconsole.cpp:2421 +#: ../src/cdcconsole.cpp:2427 #, c-format msgid "%s was restricted from using main and private chat for %s by %s without reason." msgstr "" -#: ../src/cdcconsole.cpp:2434 +#: ../src/cdcconsole.cpp:2440 #, c-format msgid "Allowing user to download again: %s" msgstr "" -#: ../src/cdcconsole.cpp:2436 +#: ../src/cdcconsole.cpp:2442 #, c-format msgid "Restricting user from downloading: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2445 +#: ../src/cdcconsole.cpp:2451 #, c-format msgid "Allowing user to use search again: %s" msgstr "" -#: ../src/cdcconsole.cpp:2447 +#: ../src/cdcconsole.cpp:2453 #, c-format msgid "Restricting user from using search: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2456 +#: ../src/cdcconsole.cpp:2462 #, c-format msgid "Taking away the right to hide share: %s" msgstr "" -#: ../src/cdcconsole.cpp:2458 +#: ../src/cdcconsole.cpp:2464 #, c-format msgid "Giving user the right to hide share: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2467 +#: ../src/cdcconsole.cpp:2473 #, c-format msgid "Taking away the right to register others: %s" msgstr "" -#: ../src/cdcconsole.cpp:2469 +#: ../src/cdcconsole.cpp:2475 #, c-format msgid "Giving user the right to register others: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2478 +#: ../src/cdcconsole.cpp:2484 #, c-format msgid "Taking away the right to kick others: %s" msgstr "" -#: ../src/cdcconsole.cpp:2480 +#: ../src/cdcconsole.cpp:2486 #, c-format msgid "Giving user the right to kick others: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2489 +#: ../src/cdcconsole.cpp:2495 #, c-format msgid "Taking away the right to use operator chat: %s" msgstr "" -#: ../src/cdcconsole.cpp:2491 +#: ../src/cdcconsole.cpp:2497 #, c-format msgid "Giving user the right to use operator chat: %s for %s" msgstr "" -#: ../src/cdcconsole.cpp:2598 +#: ../src/cdcconsole.cpp:2604 #, c-format msgid "Found %d user with IP %s" msgid_plural "Found %d users with IP %s" msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:2609 +#: ../src/cdcconsole.cpp:2615 #, c-format msgid "Found %d user with range %s" msgid_plural "Found %d users with range %s" msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:2615 +#: ../src/cdcconsole.cpp:2621 msgid "Country code must be 2 characters long, for example RU." msgstr "" -#: ../src/cdcconsole.cpp:2623 +#: ../src/cdcconsole.cpp:2629 #, c-format msgid "Found %d user with country code %s" msgid_plural "Found %d users with country code %s" msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:2632 +#: ../src/cdcconsole.cpp:2638 #, c-format msgid "Found %d user with city %s" msgid_plural "Found %d users with city %s" msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:2641 +#: ../src/cdcconsole.cpp:2647 #, c-format msgid "Found %d user on hub port %d" msgid_plural "Found %d users on hub port %d" msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:2650 +#: ../src/cdcconsole.cpp:2656 #, c-format msgid "Found %d user with hub URL %s" msgid_plural "Found %d users with hub URL %s" msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:2661 +#: ../src/cdcconsole.cpp:2667 msgid "No users found." msgstr "" -#: ../src/cdcconsole.cpp:2693 +#: ../src/cdcconsole.cpp:2699 msgid "You have no rights to gag, drop or kick anyone." msgstr "" -#: ../src/cdcconsole.cpp:2716 +#: ../src/cdcconsole.cpp:2722 #, c-format msgid "You have no rights to drop or kick user: %s" msgstr "" -#: ../src/cdcconsole.cpp:2729 ../src/cdcconsole.cpp:2734 +#: ../src/cdcconsole.cpp:2735 ../src/cdcconsole.cpp:2740 #, c-format msgid "You have no rights to gag user: %s" msgstr "" -#: ../src/cdcconsole.cpp:2738 +#: ../src/cdcconsole.cpp:2744 #, c-format msgid "You have no rights to gag nick: %s" msgstr "" -#: ../src/cdcconsole.cpp:2791 +#: ../src/cdcconsole.cpp:2797 #, c-format msgid "%s was restricted from using main chat for %s by %s with reason: %s" msgstr "" -#: ../src/cdcconsole.cpp:2796 +#: ../src/cdcconsole.cpp:2802 #, c-format msgid "%s was allowed to use main chat again by %s with reason: %s" msgstr "" -#: ../src/cdcconsole.cpp:2858 +#: ../src/cdcconsole.cpp:2864 msgid "Loaded plugins" msgstr "" -#: ../src/cdcconsole.cpp:2862 +#: ../src/cdcconsole.cpp:2868 msgid "Plugin callbacks" msgstr "" -#: ../src/cdcconsole.cpp:2870 +#: ../src/cdcconsole.cpp:2876 msgid "You don't want to unload Plugman because all other plugins are loaded via it." msgstr "" -#: ../src/cdcconsole.cpp:2893 +#: ../src/cdcconsole.cpp:2899 msgid "You don't want to reload Plugman because all other plugins are loaded via it." msgstr "" -#: ../src/cdcconsole.cpp:2971 +#: ../src/cdcconsole.cpp:2977 #, c-format msgid "classdif_reg value must be between %d and %d. Please correct this first." msgstr "" -#: ../src/cdcconsole.cpp:2995 +#: ../src/cdcconsole.cpp:3001 #, c-format msgid "Found %d registered user with class %d" msgid_plural "Found %d registered users with class %d" msgstr[0] "" msgstr[1] "" -#: ../src/cdcconsole.cpp:2997 +#: ../src/cdcconsole.cpp:3003 #, c-format msgid "No registered users with class %d found." msgstr "" -#: ../src/cdcconsole.cpp:3047 +#: ../src/cdcconsole.cpp:3053 msgid "You specified invalid class number." msgstr "" -#: ../src/cdcconsole.cpp:3089 +#: ../src/cdcconsole.cpp:3095 #, c-format msgid "Registered user not found: %s" msgstr "" -#: ../src/cdcconsole.cpp:3091 ../src/cdcconsole.cpp:3110 +#: ../src/cdcconsole.cpp:3097 ../src/cdcconsole.cpp:3116 #, c-format msgid "User is already registered: %s" msgstr "" -#: ../src/cdcconsole.cpp:3128 ../src/script_api.cpp:667 +#: ../src/cdcconsole.cpp:3134 ../src/script_api.cpp:667 #, c-format msgid "You have been registered with class %d. Please set your password by using following command: +passwd " msgstr "" -#: ../src/cdcconsole.cpp:3148 +#: ../src/cdcconsole.cpp:3154 #, c-format msgid "%s has been registered with class %d and password." msgstr "" -#: ../src/cdcconsole.cpp:3150 +#: ../src/cdcconsole.cpp:3156 #, c-format msgid "%s has been registered with class %d. Please tell him to set his password." msgstr "" -#: ../src/cdcconsole.cpp:3152 +#: ../src/cdcconsole.cpp:3158 msgid "Error adding new user." msgstr "" -#: ../src/cdcconsole.cpp:3169 +#: ../src/cdcconsole.cpp:3175 #, c-format msgid "%s has been unregistered, user information" msgstr "" -#: ../src/cdcconsole.cpp:3208 +#: ../src/cdcconsole.cpp:3216 #, c-format msgid "Error unregistering %s, user information" msgstr "" -#: ../src/cdcconsole.cpp:3217 +#: ../src/cdcconsole.cpp:3225 msgid "Password updated." msgstr "" -#: ../src/cdcconsole.cpp:3225 +#: ../src/cdcconsole.cpp:3233 msgid "You can change your password now. Use the +passwd command followed by your new password." msgstr "" -#: ../src/cdcconsole.cpp:3282 ../src/script_api.cpp:775 +#: ../src/cdcconsole.cpp:3292 ../src/script_api.cpp:777 #, c-format msgid "Your class has been changed to %d." msgstr "" -#: ../src/cdcconsole.cpp:3289 +#: ../src/cdcconsole.cpp:3299 msgid "Your registration has been enabled." msgstr "" -#: ../src/cdcconsole.cpp:3296 +#: ../src/cdcconsole.cpp:3306 msgid "Your registration has been disabled." msgstr "" -#: ../src/cdcconsole.cpp:3301 +#: ../src/cdcconsole.cpp:3311 #, c-format msgid "You are protected from being kicked by class %s and lower." msgstr "" -#: ../src/cdcconsole.cpp:3310 +#: ../src/cdcconsole.cpp:3320 #, c-format msgid "You kicks are hidden from class %s and lower." msgstr "" -#: ../src/cdcconsole.cpp:3318 +#: ../src/cdcconsole.cpp:3328 #, c-format msgid "%s registration information" msgstr "" -#: ../src/cdcconsole.cpp:3337 +#: ../src/cdcconsole.cpp:3347 msgid "Your share is now visible." msgstr "" -#: ../src/cdcconsole.cpp:3344 +#: ../src/cdcconsole.cpp:3354 msgid "Your share is now hidden." msgstr "" -#: ../src/cdcconsole.cpp:3356 ../src/cdcconsole.cpp:3391 +#: ../src/cdcconsole.cpp:3366 ../src/cdcconsole.cpp:3403 msgid "Your operator key is now visible." msgstr "" -#: ../src/cdcconsole.cpp:3378 ../src/cdcconsole.cpp:3413 +#: ../src/cdcconsole.cpp:3390 ../src/cdcconsole.cpp:3427 msgid "Your operator key is now hidden." msgstr "" -#: ../src/cdcconsole.cpp:3419 +#: ../src/cdcconsole.cpp:3433 #, c-format msgid "Updated variable %s to value %s for user: %s" msgstr "" -#: ../src/cdcconsole.cpp:3422 +#: ../src/cdcconsole.cpp:3436 #, c-format msgid "Password reset for user: %s" msgstr "" -#: ../src/cdcconsole.cpp:3435 +#: ../src/cdcconsole.cpp:3449 #, c-format msgid "Error setting variable %s to value %s for user: %s" msgstr "" -#: ../src/cdcconsole.cpp:3461 +#: ../src/cdcconsole.cpp:3475 msgid "Command console is not ready." msgstr "" -#: ../src/cdcconsole.cpp:3547 +#: ../src/cdcconsole.cpp:3561 #, c-format msgid "Message delivered to %d user in %s." msgid_plural "Message delivered to %d users in %s." @@ -1396,393 +1396,393 @@ msgstr "" msgid "Invalid login sequence, your client already sent supports." msgstr "" -#: ../src/cdcproto.cpp:575 +#: ../src/cdcproto.cpp:577 msgid "Invalid login sequence, your client already validated nick." msgstr "" -#: ../src/cdcproto.cpp:626 +#: ../src/cdcproto.cpp:628 #, c-format msgid "User limit in country zone %s exceeded at %d/%d online users." msgstr "" -#: ../src/cdcproto.cpp:629 +#: ../src/cdcproto.cpp:631 #, c-format msgid "User limit in IP zone %s exceeded at %d/%d online users." msgstr "" -#: ../src/cdcproto.cpp:643 +#: ../src/cdcproto.cpp:645 #, c-format msgid "User limit in main zone exceeded at %d/%d online users." msgstr "" -#: ../src/cdcproto.cpp:651 +#: ../src/cdcproto.cpp:653 #, c-format msgid "User limit exceeded at %d online users." msgstr "" -#: ../src/cdcproto.cpp:660 +#: ../src/cdcproto.cpp:662 msgid "This is a registered users only hub." msgstr "" -#: ../src/cdcproto.cpp:683 +#: ../src/cdcproto.cpp:685 #, c-format msgid "User limit from IP address %s exceeded at %d online users." msgstr "" -#: ../src/cdcproto.cpp:699 +#: ../src/cdcproto.cpp:701 #, c-format msgid "Authorization IP mismatch from %s" msgstr "" -#: ../src/cdcproto.cpp:701 +#: ../src/cdcproto.cpp:703 #, c-format msgid "Authorization IP for this account doesn't match your IP address: %s" msgstr "" -#: ../src/cdcproto.cpp:770 +#: ../src/cdcproto.cpp:772 msgid "Invalid login sequence, you client already sent password." msgstr "" -#: ../src/cdcproto.cpp:855 +#: ../src/cdcproto.cpp:857 msgid "Incorrect password" msgstr "" -#: ../src/cdcproto.cpp:869 +#: ../src/cdcproto.cpp:871 msgid "You've been temporarily banned due to incorrect password." msgstr "" -#: ../src/cdcproto.cpp:891 +#: ../src/cdcproto.cpp:893 msgid "Invalid login sequence, you didn't specify support for hub URL command." msgstr "" -#: ../src/cdcproto.cpp:901 +#: ../src/cdcproto.cpp:903 msgid "Invalid login sequence, your client already sent hub URL." msgstr "" -#: ../src/cdcproto.cpp:945 +#: ../src/cdcproto.cpp:947 msgid "Invalid login sequence, you client already sent version." msgstr "" -#: ../src/cdcproto.cpp:1020 +#: ../src/cdcproto.cpp:1022 msgid "Your client didn't specify a tag." msgstr "" -#: ../src/cdcproto.cpp:1091 +#: ../src/cdcproto.cpp:1093 #, c-format msgid "Passive user limit exceeded at %d users. Try again later or set up an active connection." msgstr "" -#: ../src/cdcproto.cpp:1148 +#: ../src/cdcproto.cpp:1150 #, c-format msgid "You share %s but minimum allowed is %s (%s for active users, %s for passive users)." msgstr "" -#: ../src/cdcproto.cpp:1150 +#: ../src/cdcproto.cpp:1152 #, c-format msgid "You share %s but maximum allowed is %s." msgstr "" -#: ../src/cdcproto.cpp:1209 +#: ../src/cdcproto.cpp:1211 #, c-format msgid "You are already in the hub using another nick: %s" msgstr "" -#: ../src/cdcproto.cpp:1226 ../src/cserverdc.cpp:1618 +#: ../src/cdcproto.cpp:1228 ../src/cserverdc.cpp:1672 msgid "You are prohibited from entering this hub" msgstr "" -#: ../src/cdcproto.cpp:1226 ../src/cserverdc.cpp:1618 +#: ../src/cdcproto.cpp:1228 ../src/cserverdc.cpp:1672 msgid "You are banned from this hub" msgstr "" -#: ../src/cdcproto.cpp:1487 +#: ../src/cdcproto.cpp:1495 msgid "Invalid login sequence, you didn't specify support for IN command." msgstr "" -#: ../src/cdcproto.cpp:1589 +#: ../src/cdcproto.cpp:1597 msgid "Invalid login sequence, you didn't specify support for ExtJSON command." msgstr "" -#: ../src/cdcproto.cpp:1707 ../src/cdcproto.cpp:1824 +#: ../src/cdcproto.cpp:1721 ../src/cdcproto.cpp:1840 #, c-format msgid "You're trying to send private message to an offline user: %s" msgstr "" -#: ../src/cdcproto.cpp:1726 ../src/cdcproto.cpp:1830 +#: ../src/cdcproto.cpp:1740 ../src/cdcproto.cpp:1846 #, c-format msgid "You're trying to send private message to a bot: %s" msgstr "" -#: ../src/cdcproto.cpp:1735 ../src/cdcproto.cpp:1838 +#: ../src/cdcproto.cpp:1749 ../src/cdcproto.cpp:1854 msgid "You're not allowed to use private chat right now." msgstr "" -#: ../src/cdcproto.cpp:1738 ../src/cdcproto.cpp:1841 +#: ../src/cdcproto.cpp:1752 ../src/cdcproto.cpp:1857 #, c-format msgid "User tries to speak with gag in PM to %s: %s" msgstr "" -#: ../src/cdcproto.cpp:1744 ../src/cdcproto.cpp:1847 +#: ../src/cdcproto.cpp:1758 ../src/cdcproto.cpp:1863 msgid "Private chat is currently disabled for users with your class." msgstr "" -#: ../src/cdcproto.cpp:1751 ../src/cdcproto.cpp:1854 +#: ../src/cdcproto.cpp:1765 ../src/cdcproto.cpp:1870 msgid "You can't talk to this user." msgstr "" -#: ../src/cdcproto.cpp:1763 +#: ../src/cdcproto.cpp:1777 #, c-format msgid "Same message flood in PM: %s" msgstr "" -#: ../src/cdcproto.cpp:1782 +#: ../src/cdcproto.cpp:1796 #, c-format msgid "Your PM contains %d characters but maximum allowed is %d characters." msgstr "" -#: ../src/cdcproto.cpp:1866 +#: ../src/cdcproto.cpp:1882 #, c-format msgid "Same message flood in MCTo: %s" msgstr "" -#: ../src/cdcproto.cpp:1885 ../src/cdcproto.cpp:4043 +#: ../src/cdcproto.cpp:1901 ../src/cdcproto.cpp:4077 #, c-format msgid "Your chat message contains %d characters but maximum allowed is %d characters." msgstr "" -#: ../src/cdcproto.cpp:1930 +#: ../src/cdcproto.cpp:1948 #, c-format msgid "Your message wasn't sent because minimum chat delay is %lu ms but you waited only %s." msgstr "" -#: ../src/cdcproto.cpp:1941 +#: ../src/cdcproto.cpp:1959 msgid "You're not allowed to use main chat right now." msgstr "" -#: ../src/cdcproto.cpp:1944 +#: ../src/cdcproto.cpp:1962 #, c-format msgid "User tries to speak with gag in MC: %s" msgstr "" -#: ../src/cdcproto.cpp:2041 +#: ../src/cdcproto.cpp:2061 #, c-format msgid "You're trying to connect a bot: %s" msgstr "" -#: ../src/cdcproto.cpp:2050 ../src/cdcproto.cpp:2258 +#: ../src/cdcproto.cpp:2070 ../src/cdcproto.cpp:2278 msgid "You're trying to connect to yourself." msgstr "" -#: ../src/cdcproto.cpp:2057 ../src/cdcproto.cpp:2283 +#: ../src/cdcproto.cpp:2077 ../src/cdcproto.cpp:2303 #, c-format msgid "You can't download unless you are registered with class %d." msgstr "" -#: ../src/cdcproto.cpp:2084 ../src/cdcproto.cpp:2310 +#: ../src/cdcproto.cpp:2104 ../src/cdcproto.cpp:2330 #, c-format msgid "You can't download unless you share %s." msgstr "" -#: ../src/cdcproto.cpp:2093 ../src/cdcproto.cpp:2319 +#: ../src/cdcproto.cpp:2113 ../src/cdcproto.cpp:2339 msgid "You're not allowed to download from anyone." msgstr "" -#: ../src/cdcproto.cpp:2100 ../src/cdcproto.cpp:2326 +#: ../src/cdcproto.cpp:2120 ../src/cdcproto.cpp:2346 #, c-format msgid "You can't download from this user: %s" msgstr "" -#: ../src/cdcproto.cpp:2109 +#: ../src/cdcproto.cpp:2129 #, c-format msgid "You can't download from this user because one of you is in a LAN: %s" msgstr "" -#: ../src/cdcproto.cpp:2118 ../src/cdcproto.cpp:2335 +#: ../src/cdcproto.cpp:2138 ../src/cdcproto.cpp:2355 #, c-format msgid "You can't download from this user because he is in chat only mode: %s" msgstr "" -#: ../src/cdcproto.cpp:2205 +#: ../src/cdcproto.cpp:2225 #, c-format msgid "Replacing wrong IP address specified in your connection request with real one: %s -> %s" msgstr "" -#: ../src/cdcproto.cpp:2240 +#: ../src/cdcproto.cpp:2260 #, c-format msgid "You're trying to connect to an offline user: %s" msgstr "" -#: ../src/cdcproto.cpp:2249 +#: ../src/cdcproto.cpp:2269 #, c-format msgid "You're trying to connect to a bot: %s" msgstr "" -#: ../src/cdcproto.cpp:2265 +#: ../src/cdcproto.cpp:2285 #, c-format msgid "You can't download from this user, because he is also in passive mode: %s" msgstr "" -#: ../src/cdcproto.cpp:2274 +#: ../src/cdcproto.cpp:2294 #, c-format msgid "You can't download from this user while your share is hidden, because you are in passive mode: %s" msgstr "" -#: ../src/cdcproto.cpp:2386 ../src/cdcproto.cpp:2664 ../src/cdcproto.cpp:2843 +#: ../src/cdcproto.cpp:2408 ../src/cdcproto.cpp:2686 ../src/cdcproto.cpp:2865 msgid "Sorry, hub load is too high to process your search request. Please try again later." msgstr "" -#: ../src/cdcproto.cpp:2463 ../src/cdcproto.cpp:2722 ../src/cdcproto.cpp:2886 +#: ../src/cdcproto.cpp:2485 ../src/cdcproto.cpp:2744 ../src/cdcproto.cpp:2908 msgid "Don't search too often." msgstr "" -#: ../src/cdcproto.cpp:2464 ../src/cdcproto.cpp:2723 ../src/cdcproto.cpp:2887 +#: ../src/cdcproto.cpp:2486 ../src/cdcproto.cpp:2745 ../src/cdcproto.cpp:2909 #, c-format msgid "You can perform %d search in %s." msgid_plural "You can perform %d searches in %s." msgstr[0] "" msgstr[1] "" -#: ../src/cdcproto.cpp:2486 ../src/cdcproto.cpp:2746 ../src/cdcproto.cpp:2910 +#: ../src/cdcproto.cpp:2508 ../src/cdcproto.cpp:2768 ../src/cdcproto.cpp:2932 #, c-format msgid "You can't search unless you are registered with class %d." msgstr "" -#: ../src/cdcproto.cpp:2516 ../src/cdcproto.cpp:2776 ../src/cdcproto.cpp:2940 +#: ../src/cdcproto.cpp:2538 ../src/cdcproto.cpp:2798 ../src/cdcproto.cpp:2962 #, c-format msgid "You can't search unless you share %s." msgstr "" -#: ../src/cdcproto.cpp:2525 ../src/cdcproto.cpp:2785 ../src/cdcproto.cpp:2949 +#: ../src/cdcproto.cpp:2547 ../src/cdcproto.cpp:2807 ../src/cdcproto.cpp:2971 msgid "You're not allowed to search for anything." msgstr "" -#: ../src/cdcproto.cpp:2568 +#: ../src/cdcproto.cpp:2590 #, c-format msgid "Minimum search length is %d character." msgid_plural "Minimum search length is %d characters." msgstr[0] "" msgstr[1] "" -#: ../src/cdcproto.cpp:2590 ../src/cdcproto.cpp:2802 +#: ../src/cdcproto.cpp:2612 ../src/cdcproto.cpp:2824 #, c-format msgid "Replacing wrong IP address specified in your search request with real one: %s -> %s" msgstr "" -#: ../src/cdcproto.cpp:2642 ../src/cdcproto.cpp:2821 +#: ../src/cdcproto.cpp:2664 ../src/cdcproto.cpp:2843 msgid "Invalid login sequence, you didn't specify support for short TTH search command." msgstr "" -#: ../src/cdcproto.cpp:3029 +#: ../src/cdcproto.cpp:3053 msgid "Invalid login sequence, you didn't identify yourself as pinger." msgstr "" -#: ../src/cdcproto.cpp:3039 +#: ../src/cdcproto.cpp:3063 msgid "Invalid login sequence, you already sent pinger information." msgstr "" -#: ../src/cdcproto.cpp:3058 +#: ../src/cdcproto.cpp:3082 #, c-format msgid "Pinger entered the hub: %s" msgstr "" -#: ../src/cdcproto.cpp:3194 +#: ../src/cdcproto.cpp:3224 #, c-format msgid "You're trying to redirect an offline user: %s" msgstr "" -#: ../src/cdcproto.cpp:3200 +#: ../src/cdcproto.cpp:3230 #, c-format msgid "You're trying to redirect a bot: %s" msgstr "" -#: ../src/cdcproto.cpp:3206 +#: ../src/cdcproto.cpp:3236 #, c-format msgid "You're trying to redirect a protected user: %s" msgstr "" -#: ../src/cdcproto.cpp:3214 +#: ../src/cdcproto.cpp:3244 msgid "Please specify valid redirect address." msgstr "" -#: ../src/cdcproto.cpp:3223 +#: ../src/cdcproto.cpp:3253 #, c-format msgid "You are being redirected to %s because: %s" msgstr "" -#: ../src/cdcproto.cpp:3264 +#: ../src/cdcproto.cpp:3294 msgid "Please provide a valid reason." msgstr "" -#: ../src/cdcproto.cpp:3270 +#: ../src/cdcproto.cpp:3300 msgid "You can't ban a user that is protected or has higher class." msgstr "" -#: ../src/cdcproto.cpp:3276 +#: ../src/cdcproto.cpp:3306 msgid "You can't ban a bot." msgstr "" -#: ../src/cdcproto.cpp:3282 +#: ../src/cdcproto.cpp:3312 #, c-format msgid "You are temporarily prohibited from entering the hub for %s because: %s" msgstr "" -#: ../src/cdcproto.cpp:3284 +#: ../src/cdcproto.cpp:3314 #, c-format msgid "You are permanently banned from the hub because: %s" msgstr "" -#: ../src/cdcproto.cpp:3319 +#: ../src/cdcproto.cpp:3349 #, c-format msgid "No banned user found with IP %s." msgstr "" -#: ../src/cdcproto.cpp:3323 +#: ../src/cdcproto.cpp:3353 #, c-format msgid "Removed %d ban." msgid_plural "Removed %d bans." msgstr[0] "" msgstr[1] "" -#: ../src/cdcproto.cpp:3395 +#: ../src/cdcproto.cpp:3429 #, c-format msgid "Topic is set to: %s" msgstr "" -#: ../src/cdcproto.cpp:3519 +#: ../src/cdcproto.cpp:3553 #, c-format msgid "Invalid login sequence, your client must validate nick first: %s" msgstr "" -#: ../src/cdcproto.cpp:3521 +#: ../src/cdcproto.cpp:3555 msgid "Invalid login sequence, your client must validate nick first." msgstr "" -#: ../src/cdcproto.cpp:3588 +#: ../src/cdcproto.cpp:3622 #, c-format msgid "You have no rights to perform following operator action: %s" msgstr "" -#: ../src/cdcproto.cpp:3727 +#: ../src/cdcproto.cpp:3761 #, c-format msgid "Your client sent malformed protocol command: %s" msgstr "" -#: ../src/cdcproto.cpp:3838 +#: ../src/cdcproto.cpp:3872 #, c-format msgid "Your client sent too long protocol command: %s" msgstr "" -#: ../src/cdcproto.cpp:3853 +#: ../src/cdcproto.cpp:3887 #, c-format msgid "Nick spoofing attempt detected from your client: %s" msgstr "" -#: ../src/cdcproto.cpp:3974 ../src/cdcproto.cpp:3993 +#: ../src/cdcproto.cpp:4008 ../src/cdcproto.cpp:4027 #, c-format msgid "Unknown hub command: %s" msgstr "" -#: ../src/cdcproto.cpp:4051 +#: ../src/cdcproto.cpp:4085 #, c-format msgid "Your chat message contains %d lines but maximum allowed is %d lines." msgstr "" @@ -2119,7 +2119,7 @@ msgid "Kernel: %s [%s]" msgstr "" #: ../src/cinfoserver.cpp:314 ../src/cinfoserver.cpp:428 -#: ../src/cserverdc.cpp:2583 +#: ../src/cserverdc.cpp:2638 #, c-format msgid "Uptime: %s" msgstr "" @@ -2485,317 +2485,317 @@ msgstr "" msgid "Alternate IP: %s" msgstr "" -#: ../src/cserverdc.cpp:507 +#: ../src/cserverdc.cpp:517 msgid "You won't see public chat messages, to restore use +chat command." msgstr "" -#: ../src/cserverdc.cpp:1056 +#: ../src/cserverdc.cpp:1108 msgid "Hub is currently unable to service your request, please try again in a few minutes." msgstr "" -#: ../src/cserverdc.cpp:1065 ../src/cserverdc.cpp:1518 +#: ../src/cserverdc.cpp:1117 ../src/cserverdc.cpp:1572 #, c-format msgid "You're still temporarily prohibited from entering the hub for %s because: %s" msgstr "" -#: ../src/cserverdc.cpp:1122 +#: ../src/cserverdc.cpp:1174 msgid "You're already logged in with same nick and IP address." msgstr "" -#: ../src/cserverdc.cpp:1136 +#: ../src/cserverdc.cpp:1188 msgid "Another user has logged in with same nick and IP address." msgstr "" -#: ../src/cserverdc.cpp:1149 ../src/cserverdc.cpp:1566 +#: ../src/cserverdc.cpp:1201 ../src/cserverdc.cpp:1620 msgid "Your nick is already taken by another user." msgstr "" -#: ../src/cserverdc.cpp:1225 +#: ../src/cserverdc.cpp:1277 msgid "You must set your password now using +passwd command or entering it in password dialog." msgstr "" -#: ../src/cserverdc.cpp:1227 +#: ../src/cserverdc.cpp:1279 msgid "You must set your password now using +passwd command." msgstr "" -#: ../src/cserverdc.cpp:1311 +#: ../src/cserverdc.cpp:1363 msgid "Reconnecting too fast" msgstr "" -#: ../src/cserverdc.cpp:1535 +#: ../src/cserverdc.cpp:1589 msgid "Your nick contains forbidden characters." msgstr "" -#: ../src/cserverdc.cpp:1538 +#: ../src/cserverdc.cpp:1592 #, c-format msgid "Valid nick characters: %s" msgstr "" -#: ../src/cserverdc.cpp:1546 +#: ../src/cserverdc.cpp:1600 #, c-format msgid "Your nick is too short, minimum allowed length is %d characters." msgstr "" -#: ../src/cserverdc.cpp:1558 +#: ../src/cserverdc.cpp:1612 #, c-format msgid "Your nick is too long, maximum allowed length is %d characters." msgstr "" -#: ../src/cserverdc.cpp:1571 +#: ../src/cserverdc.cpp:1625 #, c-format msgid "Please use one of following nick prefixes: %s" msgstr "" -#: ../src/cserverdc.cpp:1579 +#: ../src/cserverdc.cpp:1633 msgid "Your nick contains operator prefix but you are not registered, please remove it." msgstr "" -#: ../src/cserverdc.cpp:1587 +#: ../src/cserverdc.cpp:1641 msgid "Unknown bad nick error, sorry." msgstr "" -#: ../src/cserverdc.cpp:1635 +#: ../src/cserverdc.cpp:1689 #, c-format msgid "Please use following nick prefix: %s" msgstr "" -#: ../src/cserverdc.cpp:1842 +#: ../src/cserverdc.cpp:1893 #, c-format msgid "DDoS detection filtered %lu new connections and found %d new exploited hubs" msgstr "" -#: ../src/cserverdc.cpp:1844 +#: ../src/cserverdc.cpp:1895 #, c-format msgid "DDoS detection filtered %lu new connections." msgstr "" -#: ../src/cserverdc.cpp:1855 +#: ../src/cserverdc.cpp:1906 #, c-format msgid "DDoS stopped, filtered totally %lu connections." msgstr "" -#: ../src/cserverdc.cpp:1928 +#: ../src/cserverdc.cpp:1979 msgid "Available time units are: s(econds), m(inutes), h(ours), d(ays) is default, w(eeks), M(onths) and y(ears)" msgstr "" -#: ../src/cserverdc.cpp:1939 +#: ../src/cserverdc.cpp:1990 msgid "Please provide positive number for time unit." msgstr "" -#: ../src/cserverdc.cpp:1958 +#: ../src/cserverdc.cpp:2009 msgid "Hublist registration results" msgstr "" -#: ../src/cserverdc.cpp:1961 +#: ../src/cserverdc.cpp:2012 #, c-format msgid "Sending information to: %s:%d" msgstr "" -#: ../src/cserverdc.cpp:1965 +#: ../src/cserverdc.cpp:2016 msgid "Connection error" msgstr "" -#: ../src/cserverdc.cpp:2007 +#: ../src/cserverdc.cpp:2058 msgid "Registration done" msgstr "" -#: ../src/cserverdc.cpp:2009 +#: ../src/cserverdc.cpp:2060 msgid "Send error" msgstr "" -#: ../src/cserverdc.cpp:2011 +#: ../src/cserverdc.cpp:2062 msgid "Protocol error" msgstr "" -#: ../src/cserverdc.cpp:2014 ../src/cserverdc.cpp:2017 +#: ../src/cserverdc.cpp:2065 ../src/cserverdc.cpp:2068 msgid "Read error" msgstr "" -#: ../src/cserverdc.cpp:2029 +#: ../src/cserverdc.cpp:2080 msgid "Finished registering in hublists." msgstr "" -#: ../src/cserverdc.cpp:2041 +#: ../src/cserverdc.cpp:2092 msgid "Hublist host is empty, nothing to do." msgstr "" -#: ../src/cserverdc.cpp:2048 +#: ../src/cserverdc.cpp:2099 msgid "Hublist port number is invalid, nothing to do." msgstr "" -#: ../src/cserverdc.cpp:2056 +#: ../src/cserverdc.cpp:2107 msgid "Registering in hublists, please wait." msgstr "" -#: ../src/cserverdc.cpp:2245 +#: ../src/cserverdc.cpp:2300 #, c-format msgid "Detected clone of user with share %s: %s" msgstr "" -#: ../src/cserverdc.cpp:2251 +#: ../src/cserverdc.cpp:2306 msgid "Clone detected" msgstr "" -#: ../src/cserverdc.cpp:2332 +#: ../src/cserverdc.cpp:2387 #, c-format msgid "Protocol command has been unlocked after stopped flood to user %s from all" msgstr "" -#: ../src/cserverdc.cpp:2348 +#: ../src/cserverdc.cpp:2403 msgid "Protocol command has been unlocked after stopped flood from all" msgstr "" -#: ../src/cserverdc.cpp:2385 +#: ../src/cserverdc.cpp:2440 #, c-format msgid "Protocol command has been locked due to detection of flood to user %s from all" msgstr "" -#: ../src/cserverdc.cpp:2415 +#: ../src/cserverdc.cpp:2470 msgid "Protocol command has been locked due to detection of flood from all" msgstr "" -#: ../src/cserverdc.cpp:2456 +#: ../src/cserverdc.cpp:2511 msgid "Sorry, following protocol command is temporarily locked due to flood detection" msgstr "" -#: ../src/cserverdc.cpp:2487 +#: ../src/cserverdc.cpp:2542 msgid "Normal" msgstr "" -#: ../src/cserverdc.cpp:2489 +#: ../src/cserverdc.cpp:2544 msgid "Progressive" msgstr "" -#: ../src/cserverdc.cpp:2491 +#: ../src/cserverdc.cpp:2546 msgid "Capacity" msgstr "" -#: ../src/cserverdc.cpp:2493 +#: ../src/cserverdc.cpp:2548 msgid "Recovery" msgstr "" -#: ../src/cserverdc.cpp:2495 +#: ../src/cserverdc.cpp:2550 msgid "Down" msgstr "" -#: ../src/cserverdc.cpp:2505 +#: ../src/cserverdc.cpp:2560 msgid "Pinger" msgstr "" -#: ../src/cserverdc.cpp:2507 +#: ../src/cserverdc.cpp:2562 msgid "Guest" msgstr "" -#: ../src/cserverdc.cpp:2509 +#: ../src/cserverdc.cpp:2564 msgid "Registered" msgstr "" -#: ../src/cserverdc.cpp:2511 +#: ../src/cserverdc.cpp:2566 msgid "VIP" msgstr "" -#: ../src/cserverdc.cpp:2515 +#: ../src/cserverdc.cpp:2570 msgid "Cheef" msgstr "" -#: ../src/cserverdc.cpp:2517 +#: ../src/cserverdc.cpp:2572 msgid "Administrator" msgstr "" -#: ../src/cserverdc.cpp:2519 +#: ../src/cserverdc.cpp:2574 msgid "Master" msgstr "" -#: ../src/cserverdc.cpp:2558 ../src/cuser.cpp:208 +#: ../src/cserverdc.cpp:2613 ../src/cuser.cpp:208 #, c-format msgid "Host: %s" msgstr "" -#: ../src/cserverdc.cpp:2589 +#: ../src/cserverdc.cpp:2644 #, c-format msgid "Software: %s %s%s ][ Uptime: %s ][ Users: %d ][ Share: %s" msgstr "" -#: ../src/cserverdc.cpp:2607 +#: ../src/cserverdc.cpp:2662 #, c-format msgid "You have no rights to kick user: %s" msgstr "" -#: ../src/cserverdc.cpp:2609 +#: ../src/cserverdc.cpp:2664 #, c-format msgid "User is protected from your kicks: %s" msgstr "" -#: ../src/cserverdc.cpp:2669 +#: ../src/cserverdc.cpp:2724 #, c-format msgid "You have been kicked because: %s" msgstr "" -#: ../src/cserverdc.cpp:2671 +#: ../src/cserverdc.cpp:2726 msgid "You have been kicked from hub." msgstr "" -#: ../src/cserverdc.cpp:2691 +#: ../src/cserverdc.cpp:2746 #, c-format msgid "User was kicked and banned for %s: %s" msgstr "" -#: ../src/cserverdc.cpp:2694 +#: ../src/cserverdc.cpp:2749 #, c-format msgid "%s was kicked and banned for %s by %s with reason: %s" msgstr "" -#: ../src/cserverdc.cpp:2696 +#: ../src/cserverdc.cpp:2751 #, c-format msgid "%s was kicked and banned for %s by %s without reason." msgstr "" -#: ../src/cserverdc.cpp:2700 +#: ../src/cserverdc.cpp:2755 #, c-format msgid "User was kicked and banned permanently: %s" msgstr "" -#: ../src/cserverdc.cpp:2703 +#: ../src/cserverdc.cpp:2758 #, c-format msgid "%s was kicked and banned permanently by %s with reason: %s" msgstr "" -#: ../src/cserverdc.cpp:2705 +#: ../src/cserverdc.cpp:2760 #, c-format msgid "%s was kicked and banned permanently by %s without reason." msgstr "" -#: ../src/cserverdc.cpp:2716 +#: ../src/cserverdc.cpp:2771 #, c-format msgid "%s dropped user with reason: %s" msgstr "" -#: ../src/cserverdc.cpp:2718 +#: ../src/cserverdc.cpp:2773 #, c-format msgid "%s dropped user without reason" msgstr "" -#: ../src/cserverdc.cpp:2723 +#: ../src/cserverdc.cpp:2778 #, c-format msgid "%s was dropped by %s with reason: %s" msgstr "" -#: ../src/cserverdc.cpp:2725 +#: ../src/cserverdc.cpp:2780 #, c-format msgid "%s was dropped by %s without reason." msgstr "" -#: ../src/cserverdc.cpp:2729 +#: ../src/cserverdc.cpp:2784 #, c-format msgid "You have been dropped because: %s" msgstr "" -#: ../src/cserverdc.cpp:2734 +#: ../src/cserverdc.cpp:2789 #, c-format msgid "User was dropped: %s" msgstr "" -#: ../src/cserverdc.cpp:3205 +#: ../src/cserverdc.cpp:3266 msgid "DDoS detected, gathering attack information..." msgstr "" @@ -3104,12 +3104,12 @@ msgstr "" msgid "Hub security doesn't accept private messages, use main chat instead." msgstr "" -#: ../src/cvhplugin.cpp:96 +#: ../src/cvhplugin.cpp:98 #, c-format msgid "Plugin %s %s cannot load extra script." msgstr "" -#: ../src/cvhplugin.cpp:102 +#: ../src/cvhplugin.cpp:104 #, c-format msgid "Plugin %s %s cannot load script '%s'." msgstr "" diff --git a/po/verlihub_plugins.pot b/po/verlihub_plugins.pot index 2d3c6d48..cb6f570d 100644 --- a/po/verlihub_plugins.pot +++ b/po/verlihub_plugins.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Verlihub\n" "Report-Msgid-Bugs-To: Verlihub Team \n" -"POT-Creation-Date: 2019-01-27 01:17+0100\n" +"POT-Creation-Date: 2019-03-02 11:44+0100\n" "PO-Revision-Date: 2016-01-31 20:13+0100\n" "Last-Translator: Alexander Zenkov \n" "Language-Team: Verlihub Team \n" diff --git a/src/casyncconn.cpp b/src/casyncconn.cpp index 6c9ca114..c1931c21 100644 --- a/src/casyncconn.cpp +++ b/src/casyncconn.cpp @@ -131,7 +131,9 @@ cAsyncConn::cAsyncConn(int desc, cAsyncSocketServer *s, tConnType ct): // incomi struct sockaddr_in *addr_in = (struct sockaddr_in*)&saddr; mIP = addr_in->sin_addr.s_addr; // copy ip char *temp = inet_ntoa(addr_in->sin_addr); +#ifdef USE_BUFFER_RESERVE mAddrIP.reserve(strlen(temp)); +#endif mAddrIP = temp; // ip address mNumIP = cBanList::Ip2Num(mAddrIP); @@ -143,7 +145,9 @@ cAsyncConn::cAsyncConn(int desc, cAsyncSocketServer *s, tConnType ct): // incomi if (getsockname(mSockDesc, &saddr, &addr_size) == 0) { // get server address and port that user is connected to addr_in = (struct sockaddr_in*)&saddr; temp = inet_ntoa(addr_in->sin_addr); +#ifdef USE_BUFFER_RESERVE mServAddr.reserve(strlen(temp)); +#endif mServAddr = temp; mServPort = ntohs(addr_in->sin_port); } else if (Log(2)) { @@ -255,7 +259,9 @@ int cAsyncConn::ReadLineLocal() return 0; } +#ifdef USE_BUFFER_RESERVE mxLine->reserve(len); +#endif mxLine->append((char*)buf, len); mBufEnd = 0; mBufReadPos = 0; @@ -263,7 +269,9 @@ int cAsyncConn::ReadLineLocal() } len = pos - buf; +#ifdef USE_BUFFER_RESERVE mxLine->reserve(len); +#endif mxLine->append((char*)buf, len); mBufReadPos += len + 1; meLineStatus = AC_LS_LINE_DONE; @@ -841,7 +849,9 @@ int cAsyncConn::Write(const string &data, bool flush) // note: data can actually } if (data_size) { // we have something new to append +#ifdef USE_BUFFER_RESERVE mBufFlush.reserve(mBufFlush.size() + data_size); // always reserve because we are adding new data +#endif mBufFlush.append(data.data(), data_size); flush_size += data_size; } @@ -871,12 +881,16 @@ int cAsyncConn::Write(const string &data, bool flush) // note: data can actually if (calc_size && zlib_buf) { // compression successful buf_size -= flush_size; // recalculate final send buffer size buf_size += calc_size; +#ifdef USE_BUFFER_RESERVE mBufSend.reserve(mBufSend.size() + calc_size); // always reserve because we are adding new data +#endif mBufSend.append(zlib_buf, calc_size); // add compressed data to final send buffer serv->mProtoSaved[0] += flush_size - calc_size; // add difference to saved upload statistics } else { // compression is larger than initial data or something failed +#ifdef USE_BUFFER_RESERVE mBufSend.reserve(mBufSend.size() + flush_size); // always reserve because we are adding new data +#endif mBufSend.append(send_buf, flush_size); // add uncompressed data to final send buffer if (Log(5)) { @@ -904,7 +918,9 @@ int cAsyncConn::Write(const string &data, bool flush) // note: data can actually } } else { // compression is disabled or data too short for good result +#ifdef USE_BUFFER_RESERVE mBufSend.reserve(mBufSend.size() + flush_size); // always reserve because we are adding new data +#endif mBufSend.append(send_buf, flush_size); // add uncompressed data to final send buffer mBufFlush.clear(); // clean up flush buffer ShrinkStringToFit(mBufFlush); @@ -1037,7 +1053,9 @@ bool cAsyncConn::DNSLookup() struct hostent *hp; if ((hp = gethostbyaddr((char*)&mIP, sizeof(mIP), AF_INET))) { +#ifdef USE_BUFFER_RESERVE mAddrHost.reserve(strlen(hp->h_name)); +#endif mAddrHost = hp->h_name; } diff --git a/src/casyncconn.h b/src/casyncconn.h index 30084ad6..decb48a5 100644 --- a/src/casyncconn.h +++ b/src/casyncconn.h @@ -24,8 +24,8 @@ // buffer sizes #define MAX_MESS_SIZE 524288 // 0.50 mb, maximum size of input buffer #define MAX_SEND_SIZE 1048576 // 1.00 mb, maximum size of output buffer, is now configurable with max_outbuf_size -#define MAX_SEND_FILL_SIZE 524288 // 0.50 mb, on this level incoming data is blocked, in order to finish sending output buffer, is now configurable with max_outfill_size -#define MAX_SEND_UNBLOCK_SIZE 786432 // 0.75 mb, under this level incoming data is unblocked again, is now configurable with max_unblock_size +#define MAX_SEND_FILL_SIZE 786432 // 0.75 mb, on this level incoming data is blocked, in order to finish sending output buffer, is now configurable with max_outfill_size +#define MAX_SEND_UNBLOCK_SIZE 524288 // 0.50 mb, under this level incoming data is unblocked again, is now configurable with max_unblock_size #include "cobj.h" #include "ctime.h" diff --git a/src/cbanlist.cpp b/src/cbanlist.cpp index 08572020..065ad409 100644 --- a/src/cbanlist.cpp +++ b/src/cbanlist.cpp @@ -541,7 +541,9 @@ void cBanList::Num2Ip(unsigned long mask, string &ip) if (inet_ntop(AF_INET, &(sa.sin_addr), temp, INET_ADDRSTRLEN)) { ip.clear(); +#ifdef USE_BUFFER_RESERVE ip.reserve(strlen(temp)); +#endif ip = temp; } */ diff --git a/src/cconfigbase.h b/src/cconfigbase.h index d3d1f15d..944826a0 100644 --- a/src/cconfigbase.h +++ b/src/cconfigbase.h @@ -94,7 +94,10 @@ class cConfigBaseBase : public cObj */ struct iterator { - iterator():mC(NULL){} + iterator(): + mC(NULL) + {} + iterator (class cConfigBaseBase *C,const tIVIt &it):mC(C),mIT(it){} cConfigItemBase * operator* () { return mC->mhItems.GetByHash(*mIT);} iterator &operator ++() { ++mIT; return *this; } diff --git a/src/cconfigitembase.cpp b/src/cconfigitembase.cpp index 37c309a8..1fa20d98 100644 --- a/src/cconfigitembase.cpp +++ b/src/cconfigitembase.cpp @@ -104,7 +104,9 @@ void cConfigItemBasePChar::ConvertFrom(const std::string &str) void cConfigItemBaseBool::ConvertTo(std::string &str) { +#ifdef USE_BUFFER_RESERVE str.reserve(1); +#endif str = ((this->Data()) ? "1" : "0"); } @@ -158,7 +160,9 @@ void cConfigItemBaseChar::ConvertTo(std::string &str) void cConfigItemBaseString::ConvertTo(std::string &str) { +#ifdef USE_BUFFER_RESERVE str.reserve(this->Data().size()); +#endif str = this->Data(); } diff --git a/src/cconndc.cpp b/src/cconndc.cpp index 3e73cc5f..35e69247 100644 --- a/src/cconndc.cpp +++ b/src/cconndc.cpp @@ -201,7 +201,9 @@ int cConnDC::OnTimer(const cTime &now) if (mpUser && mpUser->mInList && Server()->mC.delayed_ping && Server()->MinDelay(mT.ping, Server()->mC.delayed_ping)) { // check frozen users, every minute by default string omsg; +#ifdef USE_BUFFER_RESERVE omsg.reserve(1); +#endif omsg.append(1, '|'); Send(omsg, false); } diff --git a/src/cdcconsole.cpp b/src/cdcconsole.cpp index ec22c308..9b0e9cde 100644 --- a/src/cdcconsole.cpp +++ b/src/cdcconsole.cpp @@ -772,8 +772,10 @@ int cDCConsole::CmdRegMe(istringstream &cmd_line, cConnDC *conn, bool unreg) mOwner->mP.Create_Quit(data, conn->mpUser->mNick, true); // send quit to all, reserve for pipe mOwner->mUserList.SendToAll(data, mOwner->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE if (data.capacity() < (conn->mpUser->mMyINFO.size() + 1)) // send myinfo to all, reserve for pipe data.reserve(conn->mpUser->mMyINFO.size() + 1); +#endif data = conn->mpUser->mMyINFO; mOwner->mUserList.SendToAll(data, mOwner->mC.delayed_myinfo, true); @@ -1152,8 +1154,10 @@ int cDCConsole::CmdClass(istringstream &cmd_line, cConnDC *conn) mOwner->mP.Create_Quit(msg, user->mNick, true); // send quit to all, reserve for pipe mOwner->mUserList.SendToAll(msg, mOwner->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE if (msg.capacity() < (user->mMyINFO.size() + 1)) // send myinfo to all, reserve for pipe msg.reserve(user->mMyINFO.size() + 1); +#endif msg = user->mMyINFO; mOwner->mUserList.SendToAll(msg, mOwner->mC.delayed_myinfo, true); @@ -1425,7 +1429,9 @@ bool cDCConsole::cfRaw::operator()() if (user && user->mxConn) { if (id == eRC_PM) { +#ifdef USE_BUFFER_RESERVE cmd.reserve(cmd.size() + nick.size() + end.size() + 1); // more additions, reserve for pipe again +#endif cmd.append(nick); cmd.append(end); } @@ -3181,8 +3187,10 @@ bool cDCConsole::cfRegUsr::operator()() mS->mP.Create_Quit(msg, user->mNick, true); // send quit to all, reserve for pipe mS->mUserList.SendToAll(msg, mS->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE if (msg.capacity() < (user->mMyINFO.size() + 1)) // send myinfo to all msg.reserve(user->mMyINFO.size() + 1); +#endif msg = user->mMyINFO; mS->mUserList.SendToAll(msg, mS->mC.delayed_myinfo, true); @@ -3261,8 +3269,10 @@ bool cDCConsole::cfRegUsr::operator()() mS->mP.Create_Quit(msg, user->mNick, true); // send quit to all, reserve for pipe mS->mUserList.SendToAll(msg, mS->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE if (msg.capacity() < (user->mMyINFO.size() + 1)) // send myinfo to all, reserve for pipe msg.reserve(user->mMyINFO.size() + 1); +#endif msg = user->mMyINFO; mS->mUserList.SendToAll(msg, mS->mC.delayed_myinfo, true); @@ -3363,8 +3373,10 @@ bool cDCConsole::cfRegUsr::operator()() mS->mP.Create_Quit(msg, user->mNick, true); // send quit to all, reserve for pipe mS->mUserList.SendToAll(msg, mS->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE if (msg.capacity() < (user->mMyINFO.size() + 1)) // send myinfo to all, reserve for pipe msg.reserve(user->mMyINFO.size() + 1); +#endif msg = user->mMyINFO; mS->mUserList.SendToAll(msg, mS->mC.delayed_myinfo, true); @@ -3398,8 +3410,10 @@ bool cDCConsole::cfRegUsr::operator()() mS->mP.Create_Quit(msg, user->mNick, true); // send quit to all, reserve for pipe mS->mUserList.SendToAll(msg, mS->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE if (msg.capacity() < (user->mMyINFO.size() + 1)) // send myinfo to all, reserve for pipe msg.reserve(user->mMyINFO.size() + 1); +#endif msg = user->mMyINFO; mS->mUserList.SendToAll(msg, mS->mC.delayed_myinfo, true); diff --git a/src/cdcproto.cpp b/src/cdcproto.cpp index 74c209a3..4b551947 100644 --- a/src/cdcproto.cpp +++ b/src/cdcproto.cpp @@ -380,6 +380,7 @@ int cDCProto::DC_Supports(cMessageDC *msg, cConnDC *conn) istringstream is(supports); string feature, omsg, pars; +#ifdef USE_BUFFER_RESERVE pars.reserve( // all possible support flags, i think we win by doing this due to massive appendings later, todo: update list when new flags added /*OpPlus */7 + /*NoHello */8 + @@ -401,6 +402,7 @@ int cDCProto::DC_Supports(cMessageDC *msg, cConnDC *conn) /*HubURL */7 + /*ExtJSON2 */9 ); +#endif while (1) { feature = mS->mEmpty; @@ -1360,15 +1362,21 @@ int cDCProto::DC_MyINFO(cMessageDC *msg, cConnDC *conn) */ if (mS->MinDelay(conn->mpUser->mT.info, mS->mC.int_myinfo) && (StrCompare(conn->mpUser->mMyINFO, 0, conn->mpUser->mMyINFO.size(), myinfo) != 0)) { +#ifdef USE_BUFFER_RESERVE if (conn->mpUser->mMyINFO.capacity() < myinfo.size()) conn->mpUser->mMyINFO.reserve(myinfo.size()); +#endif conn->mpUser->mMyINFO = myinfo; +#ifdef USE_BUFFER_RESERVE myinfo.reserve(myinfo.size() + 1); // reserve for pipe +#endif mS->mUserList.SendToAll(myinfo, mS->mC.delayed_myinfo, true); } } else { // user logs in for the first time +#ifdef USE_BUFFER_RESERVE conn->mpUser->mMyINFO.reserve(myinfo.size()); // first use +#endif conn->mpUser->mMyINFO = myinfo; conn->SetLSFlag(eLS_MYINFO); @@ -1627,10 +1635,14 @@ int cDCProto::DC_ExtJSON(cMessageDC *msg, cConnDC *conn) { if (conn->mpUser->mExtJSON.empty() || (StrCompare(msg->mStr, 0, conn->mpUser->mExtJSON.size(), conn->mpUser->mExtJSON) != 0)) { string _str; +#ifdef USE_BUFFER_RESERVE _str.reserve(msg->mStr.size() + 1); // first use, reserve for pipe +#endif _str = msg->mStr; mS->mUserList.SendToAllWithFeature(_str, eSF_EXTJSON2, mS->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE conn->mpUser->mExtJSON.reserve(msg->mStr.size()); +#endif conn->mpUser->mExtJSON = msg->mStr; } } @@ -1672,8 +1684,10 @@ int cDCProto::DC_GetINFO(cMessageDC *msg, cConnDC *conn) return 0; if (!(conn->mFeatures & eSF_NOGETINFO)) { // send it +#ifdef USE_BUFFER_RESERVE if (omsg.capacity() < (user->mMyINFO.size() + 1)) omsg.reserve(user->mMyINFO.size() + 1); // reserve for pipe +#endif omsg = user->mMyINFO; conn->Send(omsg, true, false); // must be flushed, else user can wait for data forever @@ -1793,7 +1807,9 @@ int cDCProto::DC_To(cMessageDC *msg, cConnDC *conn) #endif string _str; +#ifdef USE_BUFFER_RESERVE _str.reserve(msg->mStr.size() + 1); // first use +#endif _str = msg->mStr; other->mxConn->Send(_str, true); // send it return 0; @@ -1898,7 +1914,9 @@ int cDCProto::DC_MCTo(cMessageDC *msg, cConnDC *conn) string mcto; if (other->mxConn->mFeatures & eSF_MCTO) { // send as is if supported by client +#ifdef USE_BUFFER_RESERVE mcto.reserve(msg->mStr.size() + 1); // reserve for pipe +#endif mcto = msg->mStr; } else { // convert to private main chat message Create_Chat(mcto, conn->mpUser->mNick, text, true); // reserve for pipe @@ -1984,7 +2002,9 @@ int cDCProto::DC_Chat(cMessageDC *msg, cConnDC *conn) #endif string _str; +#ifdef USE_BUFFER_RESERVE _str.reserve(msg->mStr.size() + 1); // first use, reserve for pipe +#endif _str = msg->mStr; mS->mChatUsers.SendToAll(_str, mS->mC.delayed_chat, true); // send it return 0; @@ -2348,7 +2368,9 @@ int cDCProto::DC_RevConnectToMe(cMessageDC *msg, cConnDC *conn) #endif string _str; +#ifdef USE_BUFFER_RESERVE _str.reserve(msg->mStr.size() + 1); // first use +#endif _str = msg->mStr; other->mxConn->Send(_str, true); // send it return 0; @@ -3008,7 +3030,9 @@ int cDCProto::DC_SR(cMessageDC *msg, cConnDC *conn) return 0; string sr; +#ifdef USE_BUFFER_RESERVE sr.reserve(msg->mChunks[eCH_SR_TO].first/* - 1 + 1*/); // first use, reserve for pipe +#endif sr.assign(msg->mStr, 0, msg->mChunks[eCH_SR_TO].first - 1); // cut the end other->mxConn->Send(sr, true, !mS->mC.delayed_search); // part of search, must be delayed too return 0; @@ -3093,7 +3117,9 @@ int cDCProto::DCB_BotINFO(cMessageDC *msg, cConnDC *conn) os << mS->mC.hub_encoding; string info; +#ifdef USE_BUFFER_RESERVE info.reserve(os.str().size() + 1); // first use, reserve for pipe +#endif info = os.str(); conn->Send(info, true, false); conn->SetLSFlag(eLS_BOTINFO); @@ -3137,13 +3163,17 @@ int cDCProto::DCO_UserIP(cMessageDC *msg, cConnDC *conn) if (other && other->mInList) { if (other->mxConn) { // real user +#ifdef USE_BUFFER_RESERVE back.reserve(back.size() + nick.size() + 1 + other->mxConn->AddrIP().size() + sep.size()); // we are always reserving, no need for capacity check +#endif back.append(nick); back.append(1, ' '); back.append(other->mxConn->AddrIP()); } else { // bots have local ip +#ifdef USE_BUFFER_RESERVE back.reserve(back.size() + nick.size() + 1 + 9 + sep.size()); // we are always reserving, no need for capacity check +#endif back.append(nick); back.append(" 127.0.0.1"); // size() = 1 + 9 } @@ -3350,13 +3380,17 @@ int cDCProto::DCO_WhoIP(cMessageDC *msg, cConnDC *conn) const string &ip = msg->ChunkString(eCH_1_PARAM); string nicklist, sep("$$"); +#ifdef USE_BUFFER_RESERVE nicklist.reserve(13 + ip.size() + 1); +#endif nicklist.append("$UsersWithIP "); nicklist.append(ip); nicklist.append(1, '$'); const unsigned long num = cBanList::Ip2Num(ip); mS->WhoIP(num, num, nicklist, sep, true); +#ifdef USE_BUFFER_RESERVE nicklist.reserve(nicklist.size() + 1); // reserve for pipe +#endif conn->Send(nicklist, true); return 0; } @@ -4061,8 +4095,10 @@ void cDCProto::Create_MyINFO(string &dest, const string &nick, const string &des if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (13 + nick.size() + 1 + desc.size() + 3 + speed.size() + 1 + mail.size() + 1 + share.size() + 1 + (pipe ? 1 : 0))) dest.reserve(13 + nick.size() + 1 + desc.size() + 3 + speed.size() + 1 + mail.size() + 1 + share.size() + 1 + (pipe ? 1 : 0)); +#endif dest.append("$MyINFO $ALL "); dest.append(nick); @@ -4082,8 +4118,10 @@ void cDCProto::Create_Lock(string &dest, const string &lock, const string &name, if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (6 + lock.size() + 4 + name.size() + 1 + vers.size() + (pipe ? 1 : 0))) dest.reserve(6 + lock.size() + 4 + name.size() + 1 + vers.size() + (pipe ? 1 : 0)); +#endif dest.append("$Lock "); dest.append(lock); @@ -4098,8 +4136,10 @@ void cDCProto::Create_Chat(string &dest, const string &nick, const string &text, if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (1 + nick.size() + 2 + text.size() + (pipe ? 1 : 0))) dest.reserve(1 + nick.size() + 2 + text.size() + (pipe ? 1 : 0)); +#endif dest.append(1, '<'); dest.append(nick); @@ -4112,8 +4152,10 @@ void cDCProto::Create_Me(string &dest, const string &nick, const string &text, c if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (3 + nick.size() + 1 + text.size() + (pipe ? 1 : 0))) dest.reserve(3 + nick.size() + 1 + text.size() + (pipe ? 1 : 0)); +#endif dest.append("** "); dest.append(nick); @@ -4126,8 +4168,10 @@ void cDCProto::Create_PM(string &dest,const string &from, const string &to, cons if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (5 + to.size() + 7 + from.size() + 3 + sign.size() + 2 + text.size() + (pipe ? 1 : 0))) dest.reserve(5 + to.size() + 7 + from.size() + 3 + sign.size() + 2 + text.size() + (pipe ? 1 : 0)); +#endif dest.append("$To: "); dest.append(to); @@ -4148,11 +4192,13 @@ void cDCProto::Create_PMForBroadcast(string &start, string &end, const string &f if (end.size()) end.clear(); +#ifdef USE_BUFFER_RESERVE if (start.capacity() < (5)) start.reserve(5); if (end.capacity() < (7 + from.size() + 3 + sign.size() + 2 + text.size() + (pipe ? 1 : 0))) end.reserve(7 + from.size() + 3 + sign.size() + 2 + text.size() + (pipe ? 1 : 0)); +#endif start.append("$To: "); end.append(" From: "); @@ -4168,6 +4214,7 @@ void cDCProto::Create_HubName(string &dest, const string &name, const string &to if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (topic.size()) { if (dest.capacity() < (9 + name.size() + 3 + topic.size() + (pipe ? 1 : 0))) dest.reserve(9 + name.size() + 3 + topic.size() + (pipe ? 1 : 0)); @@ -4175,6 +4222,7 @@ void cDCProto::Create_HubName(string &dest, const string &name, const string &to if (dest.capacity() < (9 + name.size() + (pipe ? 1 : 0))) dest.reserve(9 + name.size() + (pipe ? 1 : 0)); } +#endif dest.append("$HubName "); dest.append(name); @@ -4190,8 +4238,10 @@ void cDCProto::Create_HubTopic(string &dest, const string &topic, const bool pip if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (10 + topic.size() + (pipe ? 1 : 0))) dest.reserve(10 + topic.size() + (pipe ? 1 : 0)); +#endif dest.append("$HubTopic "); dest.append(topic); @@ -4202,8 +4252,10 @@ void cDCProto::Create_Quit(string &dest, const string &nick, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (6 + nick.size() + (pipe ? 1 : 0))) dest.reserve(6 + nick.size() + (pipe ? 1 : 0)); +#endif dest.append("$Quit "); dest.append(nick); @@ -4214,8 +4266,10 @@ void cDCProto::Create_Hello(string &dest, const string &nick, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (7 + nick.size() + (pipe ? 1 : 0))) dest.reserve(7 + nick.size() + (pipe ? 1 : 0)); +#endif dest.append("$Hello "); dest.append(nick); @@ -4226,8 +4280,10 @@ void cDCProto::Create_LogedIn(string &dest, const string &nick, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (9 + nick.size() + (pipe ? 1 : 0))) dest.reserve(9 + nick.size() + (pipe ? 1 : 0)); +#endif dest.append("$LogedIn "); dest.append(nick); @@ -4238,8 +4294,10 @@ void cDCProto::Create_ValidateDenide(string &dest, const string &nick, const boo if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (16 + nick.size() + (pipe ? 1 : 0))) dest.reserve(16 + nick.size() + (pipe ? 1 : 0)); +#endif dest.append("$ValidateDenide "); dest.append(nick); @@ -4250,6 +4308,7 @@ void cDCProto::Create_BadNick(string &dest, const string &id, const string &par, if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (par.size()) { if (dest.capacity() < (9 + id.size() + 1 + par.size() + (pipe ? 1 : 0))) dest.reserve(9 + id.size() + 1 + par.size() + (pipe ? 1 : 0)); @@ -4257,6 +4316,7 @@ void cDCProto::Create_BadNick(string &dest, const string &id, const string &par, if (dest.capacity() < (9 + id.size() + (pipe ? 1 : 0))) dest.reserve(9 + id.size() + (pipe ? 1 : 0)); } +#endif dest.append("$BadNick "); dest.append(id); @@ -4272,8 +4332,10 @@ void cDCProto::Create_NickList(string &dest, const string &nick, const bool pipe if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (10 + nick.size() + 2 + (pipe ? 1 : 0))) dest.reserve(10 + nick.size() + 2 + (pipe ? 1 : 0)); +#endif dest.append("$NickList "); dest.append(nick); @@ -4285,8 +4347,10 @@ void cDCProto::Create_OpList(string &dest, const string &nick, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (8 + nick.size() + 2 + (pipe ? 1 : 0))) dest.reserve(8 + nick.size() + 2 + (pipe ? 1 : 0)); +#endif dest.append("$OpList "); dest.append(nick); @@ -4298,8 +4362,10 @@ void cDCProto::Create_BotList(string &dest, const string &nick, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (9 + nick.size() + 2 + (pipe ? 1 : 0))) dest.reserve(9 + nick.size() + 2 + (pipe ? 1 : 0)); +#endif dest.append("$BotList "); dest.append(nick); @@ -4311,8 +4377,10 @@ void cDCProto::Create_Key(string &dest, const string &key, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (5 + key.size() + (pipe ? 1 : 0))) dest.reserve(5 + key.size() + (pipe ? 1 : 0)); +#endif dest.append("$Key "); dest.append(key); @@ -4322,8 +4390,10 @@ void cDCProto::Create_FailOver(string &dest, const string &addr, const bool pipe { dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (10 + addr.size() + (pipe ? 1 : 0))) dest.reserve(10 + addr.size() + (pipe ? 1 : 0)); +#endif dest.append("$FailOver "); dest.append(addr); @@ -4335,10 +4405,12 @@ void cDCProto::Create_ForceMove(string &dest, const string &addr, const bool cle if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (11 + addr.size() + (pipe ? 1 : 0))) dest.reserve(11 + addr.size() + (pipe ? 1 : 0)); } else if (dest.capacity() < (dest.size() + 11 + addr.size() + (pipe ? 1 : 0))) { dest.reserve(dest.size() + 11 + addr.size() + (pipe ? 1 : 0)); +#endif } dest.append("$ForceMove "); @@ -4350,8 +4422,10 @@ void cDCProto::Create_ConnectToMe(string &dest, const string &nick, const string if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (13 + nick.size() + 1 + addr.size() + 1 + port.size() + extra.size() + (pipe ? 1 : 0))) dest.reserve(13 + nick.size() + 1 + addr.size() + 1 + port.size() + extra.size() + (pipe ? 1 : 0)); +#endif dest.append("$ConnectToMe "); dest.append(nick); @@ -4367,8 +4441,10 @@ void cDCProto::Create_Search(string &dest, const string &addr, const string &lim if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (8 + addr.size() + 1 + lims.size() + spat.size() + (pipe ? 1 : 0))) dest.reserve(8 + addr.size() + 1 + lims.size() + spat.size() + (pipe ? 1 : 0)); +#endif dest.append("$Search "); dest.append(addr); @@ -4382,6 +4458,7 @@ void cDCProto::Create_Search(string &dest, const string &addr, const string &tth if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (pas) { if (dest.capacity() < (8 + 4 + addr.size() + 13 + tth.size() + (pipe ? 1 : 0))) dest.reserve(8 + 4 + addr.size() + 13 + tth.size() + (pipe ? 1 : 0)); @@ -4389,6 +4466,7 @@ void cDCProto::Create_Search(string &dest, const string &addr, const string &tth if (dest.capacity() < (8 + addr.size() + 13 + tth.size() + (pipe ? 1 : 0))) dest.reserve(8 + addr.size() + 13 + tth.size() + (pipe ? 1 : 0)); } +#endif dest.append("$Search "); @@ -4405,8 +4483,10 @@ void cDCProto::Create_SA(string &dest, const string &tth, const string &addr, co if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (4 + tth.size() + 1 + addr.size() + (pipe ? 1 : 0))) dest.reserve(4 + tth.size() + 1 + addr.size() + (pipe ? 1 : 0)); +#endif dest.append("$SA "); dest.append(tth); @@ -4419,8 +4499,10 @@ void cDCProto::Create_SP(string &dest, const string &tth, const string &nick, co if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (4 + tth.size() + 1 + nick.size() + (pipe ? 1 : 0))) dest.reserve(4 + tth.size() + 1 + nick.size() + (pipe ? 1 : 0)); +#endif dest.append("$SP "); dest.append(tth); @@ -4433,8 +4515,10 @@ void cDCProto::Create_UserIP(string &dest, const string &list, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (8 + list.size() + (pipe ? 1 : 0))) dest.reserve(8 + list.size() + (pipe ? 1 : 0)); +#endif dest.append("$UserIP "); dest.append(list); @@ -4445,8 +4529,10 @@ void cDCProto::Create_UserIP(string &dest, const string &nick, const string &add if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (8 + nick.size() + 1 + addr.size() + 2 + (pipe ? 1 : 0))) dest.reserve(8 + nick.size() + 1 + addr.size() + 2 + (pipe ? 1 : 0)); +#endif dest.append("$UserIP "); dest.append(nick); @@ -4460,8 +4546,10 @@ void cDCProto::Create_GetPass(string &dest, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (8 + (pipe ? 1 : 0))) dest.reserve(8 + (pipe ? 1 : 0)); +#endif dest.append("$GetPass"); } @@ -4471,8 +4559,10 @@ void cDCProto::Create_BadPass(string &dest, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (8 + (pipe ? 1 : 0))) dest.reserve(8 + (pipe ? 1 : 0)); +#endif dest.append("$BadPass"); } @@ -4482,8 +4572,10 @@ void cDCProto::Create_GetHubURL(string &dest, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (10 + (pipe ? 1 : 0))) dest.reserve(10 + (pipe ? 1 : 0)); +#endif dest.append("$GetHubURL"); } @@ -4493,8 +4585,10 @@ void cDCProto::Create_HubIsFull(string &dest, const bool pipe) if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (10 + (pipe ? 1 : 0))) dest.reserve(10 + (pipe ? 1 : 0)); +#endif dest.append("$HubIsFull"); } @@ -4504,8 +4598,10 @@ void cDCProto::Create_Supports(string &dest, const string &flags, const bool pip if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (10 + flags.size() + (pipe ? 1 : 0))) dest.reserve(10 + flags.size() + (pipe ? 1 : 0)); +#endif dest.append("$Supports "); dest.append(flags); @@ -4516,8 +4612,10 @@ void cDCProto::Create_NickRule(string &dest, const string &rules, const bool pip if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (10 + rules.size() + (pipe ? 1 : 0))) dest.reserve(10 + rules.size() + (pipe ? 1 : 0)); +#endif dest.append("$NickRule "); dest.append(rules); @@ -4528,8 +4626,10 @@ void cDCProto::Create_SearchRule(string &dest, const string &rules, const bool p if (dest.size()) dest.clear(); +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (12 + rules.size() + (pipe ? 1 : 0))) dest.reserve(12 + rules.size() + (pipe ? 1 : 0)); +#endif dest.append("$SearchRule "); dest.append(rules); @@ -4540,7 +4640,9 @@ cConnType* cDCProto::ParseSpeed(const string &uspeed) string speed; if (uspeed.size() > 1) { +#ifdef USE_BUFFER_RESERVE speed.reserve(uspeed.size() - 1); +#endif speed.assign(uspeed, 0, uspeed.size() - 1); } diff --git a/src/cserverdc.cpp b/src/cserverdc.cpp index 02b3edb4..a6972c55 100644 --- a/src/cserverdc.cpp +++ b/src/cserverdc.cpp @@ -164,7 +164,9 @@ cServerDC::cServerDC(string CfgBase, const string &ExecPath): mOpchatList.SetNickListSeparator("\r\n"); string tag, name(HUB_VERSION_NAME), vers(HUB_VERSION_VERS), flag("\x1"), mail, shar("0"), val_new, val_old; // add the bots +#ifdef USE_BUFFER_RESERVE tag.reserve(1 + name.size() + 3 + vers.size() + 17); +#endif tag.append(1, '<'); tag.append(name); tag.append(" V:"); @@ -401,9 +403,13 @@ int cServerDC::DCPublic(const string &from, const string &txt, cConnDC *conn) int cServerDC::DCPublicToAll(const string &from, const string &txt, int min_class, int max_class, bool delay) { string msg, nick, data; +#ifdef USE_BUFFER_RESERVE nick.reserve(from.size()); // first use +#endif nick = from; +#ifdef USE_BUFFER_RESERVE data.reserve(txt.size()); +#endif data = txt; mP.Create_Chat(msg, from, txt, true); // reserve for pipe @@ -424,9 +430,13 @@ int cServerDC::DCPublicHS(const string &text, cConnDC *conn) void cServerDC::DCPublicHSToAll(const string &text, bool delay) { string msg, nick, data; +#ifdef USE_BUFFER_RESERVE nick.reserve(mC.hub_security.size()); // first use +#endif nick = mC.hub_security; +#ifdef USE_BUFFER_RESERVE data.reserve(text.size()); +#endif data = text; mP.Create_Chat(msg, nick, text, true); // reserve for pipe mUserList.SendToAll(msg, delay, true); @@ -653,7 +663,9 @@ cConnDC* cServerDC::GetConnByIP(const unsigned long ip) void cServerDC::SendToAll(const string &data, int cm, int cM) // note: class range is ignored here, bug? { string str; +#ifdef USE_BUFFER_RESERVE str.reserve(data.size() + 1); // reserve for pipe +#endif str = data; cConnDC *conn; tCLIt i; @@ -677,8 +689,10 @@ int cServerDC::SendToAllWithNick(const string &start, const string &end, int cm, conn = (cConnDC*)(*i); if (conn && conn->ok && conn->mpUser && conn->mpUser->mInList && (conn->mpUser->mClass >= cm) && (conn->mpUser->mClass <= cM)) { +#ifdef USE_BUFFER_RESERVE if (str.capacity() < (start.size() + conn->mpUser->mNick.size() + end.size() + 1)) // reserve for pipe str.reserve(start.size() + conn->mpUser->mNick.size() + end.size() + 1); +#endif str = start + conn->mpUser->mNick + end; conn->Send(str, true); // pipe is added by default for safety @@ -726,8 +740,10 @@ int cServerDC::SendToAllWithNickVars(const string &start, const string &end, int ReplaceVarInString(tend, "IP", tend, conn->AddrIP()); ReplaceVarInString(tend, "HOST", tend, conn->AddrHost()); +#ifdef USE_BUFFER_RESERVE if (temp.capacity() < (start.size() + conn->mpUser->mNick.size() + end.size() + 1)) // reserve for pipe temp.reserve(start.size() + conn->mpUser->mNick.size() + end.size() + 1); +#endif temp = start + conn->mpUser->mNick + tend; // finalize conn->Send(temp, true); // pipe is added by default for safety @@ -775,8 +791,10 @@ int cServerDC::SendToAllNoNickVars(const string &msg, int cm, int cM) ReplaceVarInString(tmsg, "IP", tmsg, conn->AddrIP()); ReplaceVarInString(tmsg, "HOST", tmsg, conn->AddrHost()); +#ifdef USE_BUFFER_RESERVE if (tmsg.capacity() < (tmsg.size() + 1)) // reserve for pipe tmsg.reserve(tmsg.size() + 1); +#endif conn->Send(tmsg, true); // pipe is added by default for safety tot++; @@ -800,8 +818,10 @@ int cServerDC::SendToAllWithNickCC(const string &start, const string &end, int c str = conn->GetGeoCC(); if (cc_zone.find(str) != cc_zone.npos) { +#ifdef USE_BUFFER_RESERVE if (str.capacity() < (start.size() + conn->mpUser->mNick.size() + end.size() + 1)) // reserve for pipe str.reserve(start.size() + conn->mpUser->mNick.size() + end.size() + 1); +#endif str = start + conn->mpUser->mNick + end; conn->Send(str, true); // pipe is added by default for safety @@ -851,8 +871,10 @@ int cServerDC::SendToAllWithNickCCVars(const string &start, const string &end, i ReplaceVarInString(tend, "IP", tend, conn->AddrIP()); ReplaceVarInString(tend, "HOST", tend, conn->AddrHost()); +#ifdef USE_BUFFER_RESERVE if (str.capacity() < (start.size() + conn->mpUser->mNick.size() + tend.size() + 1)) // reserve for pipe str.reserve(start.size() + conn->mpUser->mNick.size() + tend.size() + 1); +#endif str = start + conn->mpUser->mNick + tend; // finalize conn->Send(str, true); // pipe is added by default for safety @@ -870,11 +892,13 @@ unsigned int cServerDC::SearchToAll(cConnDC *conn, string &data, string &tths, b tCLIt i; unsigned int count = 0; size_t saved = 0, len_data = data.size(), len_tths = tths.size(); +#ifdef USE_BUFFER_RESERVE string _tths, _data; _tths.reserve(tths.size() + 1); // first use, reserve for pipe _tths = tths; _data.reserve(data.size() + 1); _data = data; +#endif if (len_tths) saved = len_data - len_tths; @@ -909,9 +933,17 @@ unsigned int cServerDC::SearchToAll(cConnDC *conn, string &data, string &tths, b if (tth && len_tths && (other->mFeatures & eSF_TTHS)) { mProtoSaved[1] += saved; // add saved upload with tths +#ifdef USE_BUFFER_RESERVE other->Send(_tths, true, !mC.delayed_search); +#else + other->Send(tths, true, !mC.delayed_search); +#endif } else { +#ifdef USE_BUFFER_RESERVE other->Send(_data, true, !mC.delayed_search); +#else + other->Send(data, true, !mC.delayed_search); +#endif } count++; @@ -948,9 +980,17 @@ unsigned int cServerDC::SearchToAll(cConnDC *conn, string &data, string &tths, b if (tth && len_tths && (other->mFeatures & eSF_TTHS)) { mProtoSaved[1] += saved; // add saved upload with tths +#ifdef USE_BUFFER_RESERVE other->Send(_tths, true, !mC.delayed_search); +#else + other->Send(tths, true, !mC.delayed_search); +#endif } else { +#ifdef USE_BUFFER_RESERVE other->Send(_data, true, !mC.delayed_search); +#else + other->Send(data, true, !mC.delayed_search); +#endif } count++; @@ -983,9 +1023,17 @@ unsigned int cServerDC::SearchToAll(cConnDC *conn, string &data, string &tths, b if (tth && len_tths && (other->mFeatures & eSF_TTHS)) { mProtoSaved[1] += saved; // add saved upload with tths +#ifdef USE_BUFFER_RESERVE other->Send(_tths, true, !mC.delayed_search); +#else + other->Send(tths, true, !mC.delayed_search); +#endif } else { +#ifdef USE_BUFFER_RESERVE other->Send(_data, true, !mC.delayed_search); +#else + other->Send(data, true, !mC.delayed_search); +#endif } count++; @@ -1018,7 +1066,9 @@ unsigned int cServerDC::CollectExtJSON(string &dest, cConnDC *conn) if (conn && conn->mpUser && (other->mpUser->mNickHash == conn->mpUser->mNickHash)) // skip self continue; +#ifdef USE_BUFFER_RESERVE dest.reserve(other->mpUser->mExtJSON.size() + 1); +#endif dest.append(other->mpUser->mExtJSON); dest.append(1, '|'); count++; @@ -1039,7 +1089,9 @@ int cServerDC::OnNewConn(cAsyncConn *nc) return -1; #endif +#ifdef USE_BUFFER_RESERVE conn->mLock.reserve(22 + 4); // better to reserve +#endif conn->mLock.append("EXTENDEDPROTOCOL_NMDC_"); // length = 22 conn->mLock.append(StringFrom(rand() % 10)); conn->mLock.append(StringFrom(rand() % 10)); @@ -1371,7 +1423,9 @@ bool cServerDC::BeginUserLogin(cConnDC *conn) bool cServerDC::ShowUserToAll(cUser *user) { string data; +#ifdef USE_BUFFER_RESERVE data.reserve(user->mMyINFO.size() + 1); // first use, reserve for pipe +#endif data = user->mMyINFO; mUserList.SendToAll(data, mC.delayed_myinfo, true); // all users get myinfo, use cache, so this can be after user is added @@ -2178,13 +2232,17 @@ unsigned int cServerDC::WhoIP(unsigned long ip_min, unsigned long ip_max, string ipnum = conn->IP2Num(); if (exact && (ip_min == ipnum)) { +#ifdef USE_BUFFER_RESERVE dest.reserve(sep.size() + (*it)->mNick.size()); // reserve all the way +#endif dest.append(sep); dest.append((*it)->mNick); tot++; } else if ((ip_min <= ipnum) && (ip_max >= ipnum)) { +#ifdef USE_BUFFER_RESERVE dest.reserve(sep.size() + (*it)->mNick.size() + 2 + conn->AddrIP().size() + 1); // reserve all the way +#endif dest.append(sep); dest.append((*it)->mNick); dest.append(" ["); @@ -2829,7 +2887,9 @@ int cServerDC::SetConfig(const char *conf, const char *var, const char *val, str if (((svar == "hub_security") || (svar == "opchat_name") || (svar == "hub_security_desc") || (svar == "opchat_desc") || (svar == "cmd_start_op") || (svar == "cmd_start_user")) && (val_new != val_old)) { // take care of special hub configs in real time string tag, name(HUB_VERSION_NAME), vers(HUB_VERSION_VERS), flag("\x1"), mail, shar("0"), data; +#ifdef USE_BUFFER_RESERVE tag.reserve(1 + name.size() + 3 + vers.size() + 17); +#endif tag.append(1, '<'); tag.append(name); tag.append(" V:"); @@ -2886,14 +2946,18 @@ int cServerDC::SetConfig(const char *conf, const char *var, const char *val, str } else if (svar == "hub_security_desc") { mP.Create_MyINFO(mHubSec->mMyINFO, mHubSec->mNick, val_new + tag, flag, mail, shar, false); // send new myinfo, dont reserve for pipe, we are not sending this +#ifdef USE_BUFFER_RESERVE data.reserve(mHubSec->mMyINFO.size() + 1); // first use, reserve for pipe +#endif data = mHubSec->mMyINFO; mUserList.SendToAll(data, mC.delayed_myinfo, true); } else if (svar == "opchat_desc") { if (mOpChat) { mP.Create_MyINFO(mOpChat->mMyINFO, mOpChat->mNick, val_new + tag, flag, mail, shar, false); // send new myinfo, dont reserve for pipe, we are not sending this +#ifdef USE_BUFFER_RESERVE data.reserve(mOpChat->mMyINFO.size() + 1); // first use, reserve for pipe +#endif data = mOpChat->mMyINFO; mUserList.SendToAll(data, mC.delayed_myinfo, true); } diff --git a/src/cusercollection.cpp b/src/cusercollection.cpp index 3a46327b..c1a39382 100644 --- a/src/cusercollection.cpp +++ b/src/cusercollection.cpp @@ -37,7 +37,9 @@ void cUserCollection::ufSendWithNick::operator()(cUserBase *user) { if (user && user->CanSend()) { string _str; +#ifdef USE_BUFFER_RESERVE _str.reserve(mDataStart.size() + user->mNick.size() + mDataEnd.size() + 1); // first use, reserve for pipe +#endif _str = mDataStart + user->mNick + mDataEnd; user->Send(_str, true, true); // always flushes } @@ -94,14 +96,18 @@ void cUserCollection::Nick2Hash(const string &nick, tHashType &hash) void cUserCollection::ufDoNickList::AppendList(string &list, cUserBase *user) { +#ifdef USE_BUFFER_RESERVE list.reserve(list.size() + user->mNick.size() + mSep.size()); // always reserve because we are adding new data every time +#endif list.append(user->mNick); list.append(mSep); } void cUserCollection::ufDoInfoList::AppendList(string &list, cUserBase *user) { +#ifdef USE_BUFFER_RESERVE list.reserve(list.size() + user->mMyINFO.size() + mSep.size()); // always reserve because we are adding new data every time +#endif list.append(user->mMyINFO); list.append(mSep); } @@ -111,13 +117,17 @@ void cUserCollection::ufDoIPList::AppendList(string &list, cUserBase *user) cUser *point = static_cast(user); if (point->mxConn) { // real user +#ifdef USE_BUFFER_RESERVE list.reserve(list.size() + point->mNick.size() + 1 + point->mxConn->AddrIP().size() + mSep.size()); // always reserve because we are adding new data every time +#endif list.append(point->mNick); list.append(1, ' '); list.append(point->mxConn->AddrIP()); } else { // bots have local ip +#ifdef USE_BUFFER_RESERVE list.reserve(list.size() + point->mNick.size() + 1 + 9 + mSep.size()); +#endif list.append(point->mNick); list.append(" 127.0.0.1"); // size() = 1 + 9 } @@ -149,8 +159,10 @@ void cUserCollection::GetNickList(string &dest, const bool pipe) mRemakeNextNickList = false; } +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (mNickList.size() + (pipe ? 1 : 0))) dest.reserve((mNickList.size() + (pipe ? 1 : 0))); +#endif dest = mNickList; } @@ -163,8 +175,10 @@ void cUserCollection::GetInfoList(string &dest, const bool pipe) mRemakeNextInfoList = false; } +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (mInfoList.size() + (pipe ? 1 : 0))) dest.reserve((mInfoList.size() + (pipe ? 1 : 0))); +#endif dest = mInfoList; } @@ -177,8 +191,10 @@ void cUserCollection::GetIPList(string &dest, const bool pipe) mRemakeNextIPList = false; } +#ifdef USE_BUFFER_RESERVE if (dest.capacity() < (mIPList.size() + (pipe ? 1 : 0))) dest.reserve((mIPList.size() + (pipe ? 1 : 0))); +#endif dest = mIPList; } diff --git a/src/cusercollection.h b/src/cusercollection.h index 40ab049f..501cecb9 100644 --- a/src/cusercollection.h +++ b/src/cusercollection.h @@ -142,7 +142,9 @@ class cUserCollection: public tHashArray mList(list) { /* +#ifdef USE_BUFFER_RESERVE mSep.reserve(2); +#endif mSep = "$$"; */ } @@ -158,7 +160,9 @@ class cUserCollection: public tHashArray ShrinkStringToFit(mList); if (mStart.size()) { +#ifdef USE_BUFFER_RESERVE mList.reserve(mStart.size()); +#endif mList.append(mStart); } } @@ -176,7 +180,9 @@ class cUserCollection: public tHashArray ufDoInfoList(string &list): ufDoNickList(list) { +#ifdef USE_BUFFER_RESERVE mSep.reserve(1); +#endif mSep = "|"; } @@ -193,8 +199,10 @@ class cUserCollection: public tHashArray ufDoIPList(string &list): ufDoNickList(list) { +#ifdef USE_BUFFER_RESERVE mSep.reserve(2); mStart.reserve(8); +#endif mSep = "$$"; mStart = "$UserIP "; } @@ -231,13 +239,17 @@ class cUserCollection: public tHashArray void SetNickListStart(const string &start) { +#ifdef USE_BUFFER_RESERVE mNickListMaker.mStart.reserve(start.size()); +#endif mNickListMaker.mStart = start; } void SetNickListSeparator(const string &sep) { +#ifdef USE_BUFFER_RESERVE mNickListMaker.mSep.reserve(sep.size()); +#endif mNickListMaker.mSep = sep; } diff --git a/src/cvhplugin.cpp b/src/cvhplugin.cpp index fdaa4a0d..a670dee4 100644 --- a/src/cvhplugin.cpp +++ b/src/cvhplugin.cpp @@ -70,7 +70,9 @@ cPluginRobot* cVHPlugin::NewRobot(const string &nick, const int clas, const stri { cPluginRobot *robot = new cPluginRobot(nick, this, mServer); robot->mClass = tUserCl(clas); //set class and myinfo before adding to list, so server can show user to all +#ifdef USE_BUFFER_RESERVE robot->mMyINFO.reserve(info.size()); +#endif robot->mMyINFO = info; if (AddRobot(robot)) { diff --git a/src/script_api.cpp b/src/script_api.cpp index 702b27be..89c9991e 100644 --- a/src/script_api.cpp +++ b/src/script_api.cpp @@ -722,8 +722,10 @@ bool DelRegUser(const char *nick) serv->mP.Create_Quit(data, user->mNick, true); // send quit to all, reserve for pipe serv->mUserList.SendToAll(data, serv->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE if (data.capacity() < (user->mMyINFO.size() + 1)) // send myinfo to all, reserve for pipe data.reserve(user->mMyINFO.size() + 1); +#endif data = user->mMyINFO; serv->mUserList.SendToAll(data, serv->mC.delayed_myinfo, true); @@ -800,8 +802,10 @@ bool SetRegClass(const char *nick, int clas) serv->mP.Create_Quit(data, user->mNick, true); // send quit to all, reserve for pipe serv->mUserList.SendToAll(data, serv->mC.delayed_myinfo, true); +#ifdef USE_BUFFER_RESERVE if (data.capacity() < (user->mMyINFO.size() + 1)) // send myinfo to all, reserve for pipe data.reserve(user->mMyINFO.size() + 1); +#endif data = user->mMyINFO; serv->mUserList.SendToAll(data, serv->mC.delayed_myinfo, true); @@ -889,8 +893,10 @@ bool CheckDataPipe(string &data) if (data.size() && (data[data.size() - 1] == '|')) return false; +#ifdef USE_BUFFER_RESERVE if (data.capacity() < (data.size() + 1)) // reserve for pipe data.reserve(data.size() + 1); +#endif return true; } diff --git a/src/stringutils.h b/src/stringutils.h index c03c10c5..1f7c2fcd 100644 --- a/src/stringutils.h +++ b/src/stringutils.h @@ -62,7 +62,9 @@ inline void AppendReservePlusPipe(string &dest, string &data, const bool pipe) if (pipe) // must always be already reserved for pipe data.append(1, '|'); +#ifdef USE_BUFFER_RESERVE dest.reserve(dest.size() + data.size()); +#endif dest.append(data); }