From 9b480a3d2721f5fff3236e5081bb559d7d9baea5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 6 Nov 2023 18:45:45 +0300 Subject: =?UTF-8?q?fixes=20#3851=20(Omegle:=20=D1=81=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20=D1=81=D0=BF=D0=B8=D1=81=D0=BE=D0=BA=20?= =?UTF-8?q?=D1=8F=D0=B7=D1=8B=D0=BA=D0=BE=D0=B2=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D0=B8=D0=BC=D1=8B=D0=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Omegle/src/communication.cpp | 25 ------- protocols/Omegle/src/connection.cpp | 6 ++ protocols/Omegle/src/constants.h | 88 ------------------------- protocols/Omegle/src/dialogs.cpp | 117 ++++++++++++++++++++++++++++++++- 4 files changed, 121 insertions(+), 115 deletions(-) (limited to 'protocols/Omegle/src') diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index dfd1dc4dd4..060430a9ec 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -161,31 +161,6 @@ bool Omegle_client::handle_error(const std::string &method, bool force_disconnec ////////////////////////////////////////////////////////////////////////////// -std::string Omegle_client::get_server(bool not_last) -{ - int q = not_last ? 1 : 0; - - int server = db_get_b(0, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0); - if (server < 0 || server >= (int)(_countof(servers) - q)) - server = 0; - - if (server == 0) { - srand(::time(0)); - server = (rand() % (_countof(servers) - 1 - q)) + 1; - } - - return servers[server]; -} - -std::string Omegle_client::get_language() -{ - int language = db_get_b(0, parent->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0); - if (language < 0 || language >= (_countof(languages))) - language = 0; - - return language > 0 ? languages[language].id : "en"; -} - std::string Omegle_client::choose_server(int request_type) { switch (request_type) diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp index db2b73970c..f0f40221f1 100644 --- a/protocols/Omegle/src/connection.cpp +++ b/protocols/Omegle/src/connection.cpp @@ -22,6 +22,12 @@ along with this program. If not, see . #include "stdafx.h" +// Known server messages, only to inform lpgen +const char *server_messages[] = { + LPGEN("Stranger is using Omegle's mobile Web site (omegle.com on a phone or tablet)"), + LPGEN("You both speak the same language.") +}; + void OmegleProto::SignOn(void*) { SYSTEMTIME t; diff --git a/protocols/Omegle/src/constants.h b/protocols/Omegle/src/constants.h index 5bc923f4a3..960a07e980 100644 --- a/protocols/Omegle/src/constants.h +++ b/protocols/Omegle/src/constants.h @@ -45,91 +45,3 @@ along with this program. If not, see . #define OMEGLE_REQUEST_TYPING_START 310 // started typing #define OMEGLE_REQUEST_TYPING_STOP 311 // stoped typing #define OMEGLE_REQUEST_RECAPTCHA 400 // recaptcha handling - -// Servers list -//static const char *servers[] = {"Random", "bajor", "cardassia", "promenade", "odo-bucket", "ferengi", "quilt", "empok-nor", "quibbler"}; -static const char *servers[] = { LPGEN("Random"), "front1", "front2", "front3", "front4", "front5", "front6", "front7", "front8", "front9", "front10", "front11", "front12", "front13", "front14", "front15", "front16", "front17", "front18", "front19", "front20", "front21", "front22", "front23", "front24", "front25", "front26", "front27", "front28", "front29", "front30", "front31", "front32" }; - -static const struct { - const char *id; - const char *lang; -} languages[] = { - { "en", "English" }, - { "af", "Afrikaans" }, - { "sq", "Albanian" }, - { "ar", "Arabic" }, - { "hy", "Armenian" }, - { "az", "Azerbaijani" }, - { "eu", "Basque" }, - { "be", "Belarusian" }, - { "bn", "Bengali" }, - { "bs", "Bosnian" }, - { "bg", "Bulgarian" }, - { "ceb", "Cebuanese" }, - { "cs", "Czech" }, - { "zh-CN", "Chinese (simplified)" }, - { "zh-TW", "Chinese (traditional)" }, - { "da", "Danish" }, - { "eo", "Esperanto" }, - { "et", "Estonian" }, - { "tl", "Philipino" }, - { "fi", "Finnish" }, - { "fr", "French" }, - { "gl", "Galician" }, - { "ka", "Georgian" }, - { "gu", "Gujarati" }, - { "ht", "Haitian Creole" }, - { "iw", "Hebrew" }, - { "hi", "Hindi" }, - { "hmn", "Hmong" }, - { "nl", "Dutch" }, - { "hr", "Croat" }, - { "id", "Indonesian" }, - { "ga", "Irish" }, - { "is", "Icelandic" }, - { "it", "Italian" }, - { "ja", "Japanese" }, - { "jw", "Javanese" }, - { "yi", "Yiddish" }, - { "kn", "Kannada" }, - { "ca", "Catalan" }, - { "km", "Khmer" }, - { "ko", "Korean" }, - { "lo", "Lao" }, - { "la", "Latina" }, - { "lt", "Lithuanian" }, - { "lv", "Latvian" }, - { "hu", "Hungarian" }, - { "mk", "Macedonian" }, - { "ms", "Malay" }, - { "mt", "Maltese" }, - { "mr", "Marathi" }, - { "de", "German" }, - { "no", "Norwegian" }, - { "fa", "Persian" }, - { "pl", "Polish" }, - { "pt", "Portugese" }, - { "ro", "Romaсian" }, - { "ru", "Russian" }, - { "el", "Greek" }, - { "sk", "Slovak" }, - { "sl", "Slovenian" }, - { "sr", "Serbian" }, - { "sw", "Swahili" }, - { "es", "Spanish" }, - { "sv", "Swedish" }, - { "ta", "Tamil" }, - { "te", "Telugu" }, - { "th", "Thai" }, - { "tr", "Turkish" }, - { "uk", "Ukrainian" }, - { "ur", "Urdu" }, - { "cy", "Welsh" }, - { "vi", "Vietnamese" } -}; - -// Known server messages, only to inform lpgen -static const char *server_messages[] = { - LPGEN("Stranger is using Omegle's mobile Web site (omegle.com on a phone or tablet)"), - LPGEN("You both speak the same language.") -}; diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index ee243053c0..33ac1453a4 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -22,6 +22,119 @@ along with this program. If not, see . #include "stdafx.h" +struct +{ + const char *id; + const wchar_t *lang; +} +static languages[] = { + { "en", LPGENW("English") }, + { "af", LPGENW("Afrikaans") }, + { "sq", LPGENW("Albanian") }, + { "ar", LPGENW("Arabic") }, + { "hy", LPGENW("Armenian") }, + { "az", LPGENW("Azerbaijani") }, + { "eu", LPGENW("Basque") }, + { "be", LPGENW("Belarusian") }, + { "bn", LPGENW("Bengali") }, + { "bs", LPGENW("Bosnian") }, + { "bg", LPGENW("Bulgarian") }, + { "ceb", LPGENW("Cebuanese") }, + { "cs", LPGENW("Czech") }, + { "zh-CN", LPGENW("Chinese (simplified)") }, + { "zh-TW", LPGENW("Chinese (traditional)") }, + { "da", LPGENW("Danish") }, + { "eo", LPGENW("Esperanto") }, + { "et", LPGENW("Estonian") }, + { "tl", LPGENW("Philipino") }, + { "fi", LPGENW("Finnish") }, + { "fr", LPGENW("French") }, + { "gl", LPGENW("Galician") }, + { "ka", LPGENW("Georgian") }, + { "gu", LPGENW("Gujarati") }, + { "ht", LPGENW("Haitian Creole") }, + { "iw", LPGENW("Hebrew") }, + { "hi", LPGENW("Hindi") }, + { "hmn", LPGENW("Hmong") }, + { "nl", LPGENW("Dutch") }, + { "hr", LPGENW("Croat") }, + { "id", LPGENW("Indonesian") }, + { "ga", LPGENW("Irish") }, + { "is", LPGENW("Icelandic") }, + { "it", LPGENW("Italian") }, + { "ja", LPGENW("Japanese") }, + { "jw", LPGENW("Javanese") }, + { "yi", LPGENW("Yiddish") }, + { "kn", LPGENW("Kannada") }, + { "ca", LPGENW("Catalan") }, + { "km", LPGENW("Khmer") }, + { "ko", LPGENW("Korean") }, + { "lo", LPGENW("Lao") }, + { "la", LPGENW("Latina") }, + { "lt", LPGENW("Lithuanian") }, + { "lv", LPGENW("Latvian") }, + { "hu", LPGENW("Hungarian") }, + { "mk", LPGENW("Macedonian") }, + { "ms", LPGENW("Malay") }, + { "mt", LPGENW("Maltese") }, + { "mr", LPGENW("Marathi") }, + { "de", LPGENW("German") }, + { "no", LPGENW("Norwegian") }, + { "fa", LPGENW("Persian") }, + { "pl", LPGENW("Polish") }, + { "pt", LPGENW("Portugese") }, + { "ro", LPGENW("Romaсian") }, + { "ru", LPGENW("Russian") }, + { "el", LPGENW("Greek") }, + { "sk", LPGENW("Slovak") }, + { "sl", LPGENW("Slovenian") }, + { "sr", LPGENW("Serbian") }, + { "sw", LPGENW("Swahili") }, + { "es", LPGENW("Spanish") }, + { "sv", LPGENW("Swedish") }, + { "ta", LPGENW("Tamil") }, + { "te", LPGENW("Telugu") }, + { "th", LPGENW("Thai") }, + { "tr", LPGENW("Turkish") }, + { "uk", LPGENW("Ukrainian") }, + { "ur", LPGENW("Urdu") }, + { "cy", LPGENW("Welsh") }, + { "vi", LPGENW("Vietnamese") } +}; + +std::string Omegle_client::get_language() +{ + int language = db_get_b(0, parent->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0); + if (language < 0 || language >= (_countof(languages))) + language = 0; + + return language > 0 ? languages[language].id : "en"; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Servers list + +static const char *servers[] = { LPGEN("Random"), "front1", "front2", "front3", "front4", "front5", "front6", "front7", "front8", "front9", "front10", "front11", "front12", "front13", "front14", "front15", "front16", "front17", "front18", "front19", "front20", "front21", "front22", "front23", "front24", "front25", "front26", "front27", "front28", "front29", "front30", "front31", "front32" }; + +std::string Omegle_client::get_server(bool not_last) +{ + int q = not_last ? 1 : 0; + + int server = db_get_b(0, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0); + if (server < 0 || server >= (int)(_countof(servers) - q)) + server = 0; + + if (server == 0) { + srand(::time(0)); + server = (rand() % (_countof(servers) - 1 - q)) + 1; + } + + return servers[server]; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Options + static BOOL LoadDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting, uint8_t bDef = 0) { BOOL state = db_get_b(0, ppro->m_szModuleName, szSetting, bDef); @@ -75,7 +188,7 @@ INT_PTR CALLBACK OmegleAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARA // Language for (size_t i = 0; i < _countof(languages); i++) - SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast(Translate(languages[i].lang))); + SendDlgItemMessageW(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast(TranslateW(languages[i].lang))); SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(0, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0); LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME); @@ -146,7 +259,7 @@ INT_PTR CALLBACK OmegleOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARA // Language for (size_t i = 0; i < _countof(languages); i++) - SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast(Translate(languages[i].lang))); + SendDlgItemMessageW(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast(TranslateW(languages[i].lang))); SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(0, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0); LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME); -- cgit v1.2.3