summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Skype/src/skype_utils.cpp')
-rw-r--r--protocols/Skype/src/skype_utils.cpp339
1 files changed, 4 insertions, 335 deletions
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index 199e3b3c8f..55cbcb6149 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -1,37 +1,6 @@
#include "skype_proto.h"
-wchar_t* CSkypeProto::LogoutReasons[] =
-{
- LPGENW("LOGOUT_CALLED") /* LOGOUT_CALLED */,
- LPGENW("HTTPS_PROXY_AUTH_FAILED") /* HTTPS_PROXY_AUTH_FAILED */,
- LPGENW("SOCKS_PROXY_AUTH_FAILED") /* SOCKS_PROXY_AUTH_FAILED */,
- LPGENW("P2P_CONNECT_FAILED") /* P2P_CONNECT_FAILED */,
- LPGENW("SERVER_CONNECT_FAILED") /* SERVER_CONNECT_FAILED */,
- LPGENW("SERVER_OVERLOADED") /* SERVER_OVERLOADED */,
- LPGENW("DB_IN_USE") /* DB_IN_USE */,
- LPGENW("Invalid skypename") /* INVALID_SKYPENAME */,
- LPGENW("Invalid email") /* INVALID_EMAIL */,
- LPGENW("Unacceptable password") /* UNACCEPTABLE_PASSWORD */,
- LPGENW("SKYPENAME_TAKEN") /* SKYPENAME_TAKEN */,
- LPGENW("REJECTED_AS_UNDERAGE") /* REJECTED_AS_UNDERAGE */,
- LPGENW("NO_SUCH_IDENTITY") /* NO_SUCH_IDENTITY */,
- LPGENW("Incorrect password") /* INCORRECT_PASSWORD */,
- LPGENW("Too many login attempts") /* TOO_MANY_LOGIN_ATTEMPTS */,
- LPGENW("PASSWORD_HAS_CHANGED") /* PASSWORD_HAS_CHANGED */,
- LPGENW("PERIODIC_UIC_UPDATE_FAILED") /* PERIODIC_UIC_UPDATE_FAILED */,
- LPGENW("DB_DISK_FULL") /* DB_DISK_FULL */,
- LPGENW("DB_IO_ERROR") /* DB_IO_ERROR */,
- LPGENW("DB_CORRUPT") /* DB_CORRUPT */,
- LPGENW("DB_FAILURE") /* DB_FAILURE */,
- LPGENW("INVALID_APP_ID") /* INVALID_APP_ID */,
- LPGENW("APP_ID_FAILURE") /* APP_ID_FAILURE */,
- LPGENW("UNSUPPORTED_VERSION") /* UNSUPPORTED_VERSION */,
- LPGENW("ATO (Account TakeOver) detected, account blocked") /* ATO_BLOCKED */,
- LPGENW("Logout from another instance") /* REMOTE_LOGOUT */,
- LPGENW("") /* ACCESS_TOKEN_RENEWAL_FAILED */
-};
-
-wchar_t* CSkypeProto::ValidationReasons[] =
+wchar_t *CSkypeProto::ValidationReasons[] =
{
LPGENW("NOT_VALIDATED") /* NOT_VALIDATED */,
LPGENW("Validation succeeded") /* VALIDATED_OK */,
@@ -46,273 +15,7 @@ wchar_t* CSkypeProto::ValidationReasons[] =
LPGENW("Value starts with an invalid character") /* STARTS_WITH_INVALID_CHAR */,
};
-wchar_t* CSkypeProto::PasswordChangeReasons[] =
-{
- LPGENW("Password change succeeded") /* PWD_OK */,
- LPGENW("") /* PWD_CHANGING */,
- LPGENW("Old password was incorrect") /* PWD_INVALID_OLD_PASSWORD */,
- LPGENW("Failed to verify password. No connection to server") /* PWD_SERVER_CONNECT_FAILED */,
- LPGENW("Password was set but server didn't like it much") /* PWD_OK_BUT_CHANGE_SUGGESTED */,
- LPGENW("New password was exactly the same as old one") /* PWD_MUST_DIFFER_FROM_OLD */,
- LPGENW("The new password was unacceptable") /* PWD_INVALID_NEW_PWD */,
- LPGENW("Account was currently not logged in") /* PWD_MUST_LOG_IN_TO_CHANGE */,
-};
-
-LanguagesListEntry CSkypeProto::languages[] =
-{
- {"Abkhazian", "ab"},
- {"Afar", "aa"},
- {"Afrikaans", "af"},
- {"Akan", "ak"},
- {"Albanian", "sq"},
- {"Amharic", "am"},
- {"Arabic", "ar"},
- {"Aragonese", "an"},
- {"Armenian", "hy"},
- {"Assamese", "as"},
- {"Avaric", "av"},
- {"Avestan", "ae"},
- {"Aymara", "ay"},
- {"Azerbaijani", "az"},
- {"Bambara", "bm"},
- {"Bashkir", "ba"},
- {"Basque", "eu"},
- {"Belarusian", "be"},
- {"Bengali", "bn"},
- {"Bihari languages", "bh"},
- {"Bislama", "bi"},
- {"Bokmal, Norwegian", "nb"},
- {"Bosnian", "bs"},
- {"Breton", "br"},
- {"Bulgarian", "bg"},
- {"Burmese", "my"},
- {"Castilian", "es"},
- {"Catalan", "ca"},
- {"Central Khmer", "km"},
- {"Chamorro", "ch"},
- {"Chechen", "ce"},
- {"Chewa", "ny"},
- {"Chichewa", "ny"},
- {"Chinese", "zh"},
- {"Chuang", "za"},
- {"Church Slavic", "cu"},
- {"Church Slavonic", "cu"},
- {"Chuvash", "cv"},
- {"Cornish", "kw"},
- {"Corsican", "co"},
- {"Cree", "cr"},
- {"Croatian", "hr"},
- {"Czech", "cs"},
- {"Danish", "da"},
- {"Dhivehi", "dv"},
- {"Divehi", "dv"},
- {"Dutch", "nl"},
- {"Dzongkha", "dz"},
- {"English", "en"},
- {"Esperanto", "eo"},
- {"Estonian", "et"},
- {"Ewe", "ee"},
- {"Faroese", "fo"},
- {"Fijian", "fj"},
- {"Finnish", "fi"},
- {"Flemish", "nl"},
- {"French", "fr"},
- {"Fulah", "ff"},
- {"Gaelic", "gd"},
- {"Galician", "gl"},
- {"Ganda", "lg"},
- {"Georgian", "ka"},
- {"German", "de"},
- {"Gikuyu", "ki"},
- {"Greek, Modern (1453-)", "el"},
- {"Greenlandic", "kl"},
- {"Guarani", "gn"},
- {"Gujarati", "gu"},
- {"Haitian", "ht"},
- {"Haitian Creole", "ht"},
- {"Hausa", "ha"},
- {"Hebrew", "he"},
- {"Herero", "hz"},
- {"Hindi", "hi"},
- {"Hiri Motu", "ho"},
- {"Hungarian", "hu"},
- {"Icelandic", "is"},
- {"Ido", "io"},
- {"Igbo", "ig"},
- {"Indonesian", "id"},
- {"Interlingua (International Auxiliary Language Association)", "ia"},
- {"Interlingue", "ie"},
- {"Inuktitut", "iu"},
- {"Inupiaq", "ik"},
- {"Irish", "ga"},
- {"Italian", "it"},
- {"Japanese", "ja"},
- {"Javanese", "jv"},
- {"Kalaallisut", "kl"},
- {"Kannada", "kn"},
- {"Kanuri", "kr"},
- {"Kashmiri", "ks"},
- {"Kazakh", "kk"},
- {"Kikuyu", "ki"},
- {"Kinyarwanda", "rw"},
- {"Kirghiz", "ky"},
- {"Komi", "kv"},
- {"Kongo", "kg"},
- {"Korean", "ko"},
- {"Kuanyama", "kj"},
- {"Kurdish", "ku"},
- {"Kwanyama", "kj"},
- {"Kyrgyz", "ky"},
- {"Lao", "lo"},
- {"Latin", "la"},
- {"Latvian", "lv"},
- {"Letzeburgesch", "lb"},
- {"Limburgan", "li"},
- {"Limburger", "li"},
- {"Limburgish", "li"},
- {"Lingala", "ln"},
- {"Lithuanian", "lt"},
- {"Luba-Katanga", "lu"},
- {"Luxembourgish", "lb"},
- {"Macedonian", "mk"},
- {"Malagasy", "mg"},
- {"Malay", "ms"},
- {"Malayalam", "ml"},
- {"Maldivian", "dv"},
- {"Maltese", "mt"},
- {"Manx", "gv"},
- {"Maori", "mi"},
- {"Marathi", "mr"},
- {"Marshallese", "mh"},
- {"Moldavian", "ro"},
- {"Moldovan", "ro"},
- {"Mongolian", "mn"},
- {"Nauru", "na"},
- {"Navaho", "nv"},
- {"Navajo", "nv"},
- {"Ndebele, North", "nd"},
- {"Ndebele, South", "nr"},
- {"Ndonga", "ng"},
- {"Nepali", "ne"},
- {"North Ndebele", "nd"},
- {"Northern Sami", "se"},
- {"Norwegian", "no"},
- {"Norwegian Bokmal", "nb"},
- {"Norwegian Nynorsk", "nn"},
- {"Nuosu", "ii"},
- {"Nyanja", "ny"},
- {"Nynorsk, Norwegian", "nn"},
- {"Occidental", "ie"},
- {"Occitan (post 1500)", "oc"},
- {"Ojibwa", "oj"},
- {"Old Bulgarian", "cu"},
- {"Old Church Slavonic", "cu"},
- {"Old Slavonic", "cu"},
- {"Oriya", "or"},
- {"Oromo", "om"},
- {"Ossetian", "os"},
- {"Ossetic", "os"},
- {"Pali", "pi"},
- {"Panjabi", "pa"},
- {"Pashto", "ps"},
- {"Persian", "fa"},
- {"Polish", "pl"},
- {"Portuguese", "pt"},
- {"Punjabi", "pa"},
- {"Pushto", "ps"},
- {"Quechua", "qu"},
- {"Romanian", "ro"},
- {"Romansh", "rm"},
- {"Rundi", "rn"},
- {"Russian", "ru"},
- {"Samoan", "sm"},
- {"Sango", "sg"},
- {"Sanskrit", "sa"},
- {"Sardinian", "sc"},
- {"Scottish Gaelic", "gd"},
- {"Serbian", "sr"},
- {"Shona", "sn"},
- {"Sichuan Yi", "ii"},
- {"Sindhi", "sd"},
- {"Sinhala", "si"},
- {"Sinhalese", "si"},
- {"Slovak", "sk"},
- {"Slovenian", "sl"},
- {"Somali", "so"},
- {"Sotho, Southern", "st"},
- {"South Ndebele", "nr"},
- {"Spanish", "es"},
- {"Sundanese", "su"},
- {"Swahili", "sw"},
- {"Swati", "ss"},
- {"Swedish", "sv"},
- {"Tagalog", "tl"},
- {"Tahitian", "ty"},
- {"Tajik", "tg"},
- {"Tamil", "ta"},
- {"Tatar", "tt"},
- {"Telugu", "te"},
- {"Thai", "th"},
- {"Tibetan", "bo"},
- {"Tigrinya", "ti"},
- {"Tonga (Tonga Islands)", "to"},
- {"Tsonga", "ts"},
- {"Tswana", "tn"},
- {"Turkish", "tr"},
- {"Turkmen", "tk"},
- {"Twi", "tw"},
- {"Uighur", "ug"},
- {"Ukrainian", "uk"},
- {"Urdu", "ur"},
- {"Uyghur", "ug"},
- {"Uzbek", "uz"},
- {"Valencian", "ca"},
- {"Venda", "ve"},
- {"Vietnamese", "vi"},
- {"Volapuk", "vo"},
- {"Walloon", "wa"},
- {"Welsh", "cy"},
- {"Western Frisian", "fy"},
- {"Wolof", "wo"},
- {"Xhosa", "xh"},
- {"Yiddish", "yi"},
- {"Yoruba", "yo"},
- {"Zhuang", "za"},
- {"Zulu", "zu"}
-};
-
-int CSkypeProto::DetectAvatarFormatBuffer(const char *pBuffer)
-{
- if (!strncmp(pBuffer, "%PNG", 4))
- return PA_FORMAT_PNG;
-
- if (!strncmp(pBuffer, "GIF8", 4))
- return PA_FORMAT_GIF;
-
- if (!_strnicmp(pBuffer, "<?xml", 5))
- return PA_FORMAT_XML;
-
- if ((((DWORD*)pBuffer)[0] == 0xE0FFD8FFul) || (((DWORD*)pBuffer)[0] == 0xE1FFD8FFul))
- return PA_FORMAT_JPEG;
-
- if (!strncmp(pBuffer, "BM", 2))
- return PA_FORMAT_BMP;
-
- return PA_FORMAT_UNKNOWN;
-}
-
-int CSkypeProto::DetectAvatarFormat(const wchar_t *path)
-{
- int src = _wopen(path, _O_BINARY | _O_RDONLY, 0);
- if (src == -1)
- return PA_FORMAT_UNKNOWN;
-
- char pBuf[32];
- _read(src, pBuf, 32);
- _close(src);
-
- return CSkypeProto::DetectAvatarFormatBuffer(pBuf);
-}
+// ---
void CSkypeProto::InitCustomFolders()
{
@@ -322,45 +25,11 @@ void CSkypeProto::InitCustomFolders()
m_bInitDone = true;
TCHAR AvatarsFolder[MAX_PATH];
- mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), this->m_szModuleName);
+ ::mir_sntprintf(AvatarsFolder, SIZEOF(AvatarsFolder), _T("%%miranda_avatarcache%%\\%S"), this->m_szModuleName);
m_hAvatarsFolder = ::FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, AvatarsFolder, m_tszUserName);
}
-wchar_t* CSkypeProto::GetContactAvatarFilePath(HANDLE hContact)
-{
- wchar_t* path = new wchar_t[MAX_PATH];
-
- this->InitCustomFolders();
-
- if (m_hAvatarsFolder == NULL || FoldersGetCustomPathT(m_hAvatarsFolder, path, MAX_PATH, _T("")))
- {
- wchar_t *tmpPath = ::Utils_ReplaceVarsT(L"%miranda_avatarcache%");
- ::mir_sntprintf(path, MAX_PATH, _T("%s\\%S"), tmpPath, this->m_szModuleName);
- ::mir_free(tmpPath);
- }
-
- DWORD dwAttributes = GetFileAttributes(path);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
-
- ::mir_ptr<wchar_t> sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN));
- if (hContact != NULL)
- ::mir_sntprintf(path, MAX_PATH, _T("%s\\%s.jpg"), path, sid);
- else if (sid != NULL)
- ::mir_sntprintf(path, MAX_PATH, _T("%s\\%s avatar.jpg"), path, sid);
- else
- {
- delete [] path;
- return NULL;
- }
-
- return path;
-}
-
-int CSkypeProto::CompareProtos(const CSkypeProto *p1, const CSkypeProto *p2)
-{
- return wcscmp(p1->m_tszUserName, p2->m_tszUserName);
-}
+// ---
void CSkypeProto::CreateServiceObj(const char* szService, SkypeServiceFunc serviceProc)
{