From 6f703dbe7162e00a84130beeb4dd40200ef155c4 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 27 Oct 2012 13:48:53 +0000 Subject: - added own info loading and updating git-svn-id: http://svn.miranda-ng.org/main/trunk@2092 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/Skype.vcxproj | 1 + protocols/Skype/Skype.vcxproj.filters | 3 + protocols/Skype/src/skype_contacts.cpp | 228 +----------------------------- protocols/Skype/src/skype_proto.cpp | 6 + protocols/Skype/src/skype_proto.h | 28 +++- protocols/Skype/src/skype_subclassing.cpp | 14 ++ protocols/Skype/src/skype_subclassing.h | 8 +- protocols/Skype/src/skype_utils.cpp | 224 +++++++++++++++++++++++++++++ 8 files changed, 283 insertions(+), 229 deletions(-) (limited to 'protocols/Skype') diff --git a/protocols/Skype/Skype.vcxproj b/protocols/Skype/Skype.vcxproj index 823d6c449e..cbe9b8ca74 100644 --- a/protocols/Skype/Skype.vcxproj +++ b/protocols/Skype/Skype.vcxproj @@ -113,6 +113,7 @@ + diff --git a/protocols/Skype/Skype.vcxproj.filters b/protocols/Skype/Skype.vcxproj.filters index e44c53eb09..480778e487 100644 --- a/protocols/Skype/Skype.vcxproj.filters +++ b/protocols/Skype/Skype.vcxproj.filters @@ -54,6 +54,9 @@ Source Files + + Source Files + diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 3df78707a8..f39f34c175 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -186,228 +186,6 @@ void CSkypeProto::UpdateContactHomepage(HANDLE hContact, CContact::Ref contact) ::mir_free(homepage); } -static LanguagesListEntry 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"} -}; - void CSkypeProto::UpdateContactLanguages(HANDLE hContact, CContact::Ref contact) { // languages (en, ru, etc), space searated @@ -419,10 +197,10 @@ void CSkypeProto::UpdateContactLanguages(HANDLE hContact, CContact::Ref contact) this->DeleteSetting(hContact, "Language1"); } else { - for (int i = 0; i < SIZEOF(languages); i++) - if ( lstrcmpiA((char*)isocode, languages[i].ISOcode) == 0) + for (int i = 0; i < SIZEOF(CSkypeProto::languages); i++) + if ( lstrcmpiA((char*)isocode, CSkypeProto::languages[i].ISOcode) == 0) { - this->SetSettingString(hContact, "Language1", ::mir_a2u(languages[i].szName)); + this->SetSettingString(hContact, "Language1", ::mir_a2u(CSkypeProto::languages[i].szName)); break; } } diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 87a1e758cf..789c84525e 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -363,6 +363,10 @@ void __cdecl CSkypeProto::SignInAsync(void*) } else { + this->account.fetch(); + this->account->SetOnAccountChangedCallback( + (CAccount::OnAccountChanged)&CSkypeProto::OnAccountChanged, this); + g_skype->GetConversationList(g_skype->inbox, CConversation::INBOX_CONVERSATIONS); fetch(g_skype->inbox); g_skype->SetOnConversationAddedCallback( @@ -374,6 +378,8 @@ void __cdecl CSkypeProto::SignInAsync(void*) } this->SetStatus(this->m_iDesiredStatus); + this->ForkThread(&CSkypeProto::LoadOwnInfo, this); + //this->LoadOwnInfo(this); this->ForkThread(&CSkypeProto::LoadContactList, this); //this->LoadContactList(this); } diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 064e6f3d93..36e1b6f78a 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -127,6 +127,8 @@ protected: bool IsOnline(); + static LanguagesListEntry languages[]; + // messages void OnOnMessageReceived(const char *sid, const char *text); void OnConversationAdded(CConversation::Ref conversation); @@ -172,11 +174,31 @@ protected: void __cdecl SearchByNamesAsync(void*); void __cdecl SearchByEmailAsync(void*); + // profile + void UpdateOwnAvatar(); + void UpdateOwnBirthday(); + void UpdateOwnCity(); + void UpdateOwnCountry(); + void UpdateOwnEmails(); + void UpdateOwnGender(); + void UpdateOwnHomepage(); + void UpdateOwnLanguages(); + void UpdateOwnMobilePhone(); + void UpdateOwnNickName(); + void UpdateOwnPhone(); + void UpdateOwnOfficePhone(); + void UpdateOwnState(); + void UpdateOwnStatusMessage(); + void UpdateOwnTimezone(); + void UpdateOwnProfile(); + + void OnAccountChanged(int prop); + + void __cdecl LoadOwnInfo(void*); + // utils static void FakeAsync(void*); - static char* GetCountryNameById(int countryId); - static int GetCountryIdByName(const char* countryName); - + wchar_t* GetAvatarFilePath(wchar_t* skypeName); int SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason); diff --git a/protocols/Skype/src/skype_subclassing.cpp b/protocols/Skype/src/skype_subclassing.cpp index 8014241905..3dbf36d12b 100644 --- a/protocols/Skype/src/skype_subclassing.cpp +++ b/protocols/Skype/src/skype_subclassing.cpp @@ -59,6 +59,15 @@ CAccount::CAccount(unsigned int oid, SERootObject* root) : Account(oid, root) { this->isLoggedIn = false; this->isLoggedOut = false; + + this->proto = NULL; + this->callback == NULL; +} + +void CAccount::SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto* proto) +{ + this->proto = proto; + this->callback = callback; } void CAccount::OnChange(int prop) @@ -84,6 +93,11 @@ void CAccount::OnChange(int prop) this->isLoggedOut = true; } } + else + { + if (this->proto) + (proto->*callback)(prop); + } } void CAccount::BlockWhileLoggingIn() diff --git a/protocols/Skype/src/skype_subclassing.h b/protocols/Skype/src/skype_subclassing.h index 578de49ef7..17b8f1f1c2 100644 --- a/protocols/Skype/src/skype_subclassing.h +++ b/protocols/Skype/src/skype_subclassing.h @@ -97,6 +97,8 @@ private: class CAccount : public Account { public: + typedef void (CSkypeProto::* OnAccountChanged)(int); + typedef DRef Ref; typedef DRefs Refs; @@ -112,7 +114,11 @@ public: bool IsOnline(); -private: + void SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto* proto); + +private: + CSkypeProto* proto; + OnAccountChanged callback; void OnChange(int prop); }; diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index 88e92b3d19..fbe5647248 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -1,5 +1,229 @@ #include "skype_proto.h" +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"} +}; + + void CSkypeProto::FakeAsync(void *param) { ::Sleep(100); -- cgit v1.2.3