From 2b82b6fe83df09a31a60288871227b3ea97d39a5 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 3 Apr 2015 21:57:47 +0000 Subject: SkypeWeb: cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@12597 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/request_queue.cpp | 4 - protocols/SkypeWeb/src/skype_contacts.cpp | 12 +- protocols/SkypeWeb/src/skype_events.cpp | 2 +- protocols/SkypeWeb/src/skype_icons.cpp | 8 - protocols/SkypeWeb/src/skype_menus.cpp | 2 - protocols/SkypeWeb/src/skype_messages.cpp | 32 ++- protocols/SkypeWeb/src/skype_profile.cpp | 444 +++++++++++++++--------------- protocols/SkypeWeb/src/skype_proto.cpp | 36 +-- protocols/SkypeWeb/src/skype_utils.cpp | 2 - 9 files changed, 257 insertions(+), 285 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp index 6448186614..396bc9d62b 100644 --- a/protocols/SkypeWeb/src/request_queue.cpp +++ b/protocols/SkypeWeb/src/request_queue.cpp @@ -20,9 +20,7 @@ void RequestQueue::Start() isTerminated = false; if (hRequestQueueThread == NULL) - { hRequestQueueThread = mir_forkthread((pThreadFunc)&RequestQueue::WorkerThread, this); - } } void RequestQueue::Stop() @@ -52,9 +50,7 @@ void RequestQueue::Execute(RequestQueueItem *item) { NETLIBHTTPREQUEST *response = item->request->Send(hConnection); if (item->responseCallback != NULL) - { item->responseCallback(response, item->arg); - } CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); requests.remove(item); delete item; diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 98563bcda5..a9e7db7e97 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -19,9 +19,7 @@ void CSkypeProto::SetContactStatus(MCONTACT hContact, WORD status) void CSkypeProto::SetAllContactsStatus(WORD status) { for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) - { SetContactStatus(hContact, status); - } } MCONTACT CSkypeProto::GetContactFromAuthEvent(MEVENT hEvent) @@ -50,9 +48,7 @@ MCONTACT CSkypeProto::GetContact(const char *skypename) { ptrA cSkypename(getStringA(hContact, SKYPE_SETTINGS_ID)); if (mir_strcmpi(skypename, cSkypename) == 0) - { break; - } } return hContact; } @@ -78,9 +74,7 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary) setByte(hContact, "Grant", 1); if (isTemporary) - { db_set_b(hContact, "CList", "NotOnList", 1); - } } return hContact; } @@ -207,10 +201,8 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) delSetting(hContact, "Grant"); } else - { setByte(hContact, "Grant", 1); - } - + node = json_get(item, "blocked"); setByte(hContact, "IsBlocked", json_as_bool(node)); @@ -225,9 +217,7 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) PushRequest(new GetContactsInfoRequest(token, skypenames), &CSkypeProto::LoadContactsInfo); for (size_t i = 0; i < skypenames.getCount(); i++) - { mir_free(skypenames[i]); - } skypenames.destroy(); } PushRequest(new GetContactsAuthRequest(token), &CSkypeProto::LoadContactsAuth); diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index eb920659c5..26c0c11ec2 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -172,6 +172,6 @@ void CSkypeProto::OnSetStatus(const NETLIBHTTPREQUEST *response) if (iNewStatus == ID_STATUS_OFFLINE) SetStatus(ID_STATUS_OFFLINE); - else + else ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index 8f5fc273e1..50983df45d 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -33,12 +33,8 @@ void CSkypeProto::InitIcons() HANDLE CSkypeProto::GetIconHandle(const char *name) { for (size_t i = 0; i < SIZEOF(Icons); i++) - { if (mir_strcmpi(Icons[i].Name, name) == 0) - { return Icons[i].Handle; - } - } return 0; } @@ -48,16 +44,12 @@ HANDLE CSkypeProto::GetSkinIconHandle(const char *name) mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, name); HANDLE hIcon = Skin_GetIconHandle(iconName); if (hIcon == NULL) - { hIcon = GetIconHandle(name); - } return hIcon; } void CSkypeProto::UninitIcons() { for (size_t i = 0; i < SIZEOF(Icons); i++) - { Skin_RemoveIcon(Icons[i].Name); - } } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index cd38b5a4c5..de82902909 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -26,9 +26,7 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) int CSkypeProto::PrebuildContactMenu(WPARAM hContact, LPARAM lParam) { for (int i = 0; i < SIZEOF(ContactMenuItems); i++) - { Menu_ShowItem(ContactMenuItems[i], false); - } CSkypeProto *proto = CSkypeProto::GetContactAccount(hContact); return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0; } diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 869d7e75d5..70436ce0e7 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -25,7 +25,37 @@ int CSkypeProto::OnReceiveMessage(const char *from, const char *convLink, time_t // outcoming message flow int CSkypeProto::OnSendMessage(MCONTACT hContact, int flags, const char *szMessage) { - return 0; + UINT hMessage = InterlockedIncrement(&hMessageProcess); + + SendMessageParam *param = (SendMessageParam*)mir_calloc(sizeof(SendMessageParam)); + param->hContact = hContact; + param->hMessage = (HANDLE)hMessage; + param->msg = szMessage; + param->flags = flags; + + ForkThread(&CSkypeProto::SendMsgThread, (void*)param); + + return hMessage; +} + +void CSkypeProto::SendMsgThread(void *arg) +{ + SendMessageParam *param = (SendMessageParam*)arg; + + if (!IsOnline()) + { + ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, (LPARAM)Translate("You cannot send messages when you are offline.")); + mir_free(param); + return; + } + + CMStringA message = (param->flags & PREF_UNICODE) ? ptrA(mir_utf8encode(param->msg)) : param->msg; // TODO: mir_utf8encode check taken from FacebookRM, is it needed? Usually we get PREF_UTF8 flag instead. + + ptrA token(getStringA("registrationToken")); + ptrA username(getStringA(param->hContact, "Skypename")); + PushRequest( + new SendMsgRequest(token, username, message, getStringA("Server"))/*, + &CSkypeProto::OnMessageSent*/); } void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 9067f2b175..2b5ec95218 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -5,225 +5,225 @@ std::map CSkypeProto::languages; void CSkypeProto::InitLanguages() { std::map result; - result[L"ab"] = L"Abkhazian"; - result[L"aa"] = L"Afar"; - result[L"af"] = L"Afrikaans"; - result[L"ak"] = L"Akan"; - result[L"sq"] = L"Albanian"; - result[L"am"] = L"Amharic"; - result[L"ar"] = L"Arabic"; - result[L"an"] = L"Aragonese"; - result[L"hy"] = L"Armenian"; - result[L"as"] = L"Assamese"; - result[L"av"] = L"Avaric"; - result[L"ae"] = L"Avestan"; - result[L"ay"] = L"Aymara"; - result[L"az"] = L"Azerbaijani"; - result[L"bm"] = L"Bambara"; - result[L"ba"] = L"Bashkir"; - result[L"eu"] = L"Basque"; - result[L"be"] = L"Belarusian"; - result[L"bn"] = L"Bengali"; - result[L"bh"] = L"Bihari languages"; - result[L"bi"] = L"Bislama"; - result[L"nb"] = L"Bokmal, Norwegian"; - result[L"bs"] = L"Bosnian"; - result[L"br"] = L"Breton"; - result[L"bg"] = L"Bulgarian"; - result[L"my"] = L"Burmese"; - result[L"es"] = L"Castilian"; - result[L"ca"] = L"Catalan"; - result[L"km"] = L"Central Khmer"; - result[L"ch"] = L"Chamorro"; - result[L"ce"] = L"Chechen"; - result[L"ny"] = L"Chewa"; - result[L"ny"] = L"Chichewa"; - result[L"zh"] = L"Chinese"; - result[L"za"] = L"Chuang"; - result[L"cu"] = L"Church Slavic"; - result[L"cu"] = L"Church Slavonic"; - result[L"cv"] = L"Chuvash"; - result[L"kw"] = L"Cornish"; - result[L"co"] = L"Corsican"; - result[L"cr"] = L"Cree"; - result[L"hr"] = L"Croatian"; - result[L"cs"] = L"Czech"; - result[L"da"] = L"Danish"; - result[L"dv"] = L"Dhivehi"; - result[L"dv"] = L"Divehi"; - result[L"nl"] = L"Dutch"; - result[L"dz"] = L"Dzongkha"; - result[L"en"] = L"English"; - result[L"eo"] = L"Esperanto"; - result[L"et"] = L"Estonian"; - result[L"ee"] = L"Ewe"; - result[L"fo"] = L"Faroese"; - result[L"fj"] = L"Fijian"; - result[L"fi"] = L"Finnish"; - result[L"nl"] = L"Flemish"; - result[L"fr"] = L"French"; - result[L"ff"] = L"Fulah"; - result[L"gd"] = L"Gaelic"; - result[L"gl"] = L"Galician"; - result[L"lg"] = L"Ganda"; - result[L"ka"] = L"Georgian"; - result[L"de"] = L"German"; - result[L"ki"] = L"Gikuyu"; - result[L"el"] = L"Greek, Modern (1453-)"; - result[L"kl"] = L"Greenlandic"; - result[L"gn"] = L"Guarani"; - result[L"gu"] = L"Gujarati"; - result[L"ht"] = L"Haitian"; - result[L"ht"] = L"Haitian Creole"; - result[L"ha"] = L"Hausa"; - result[L"he"] = L"Hebrew"; - result[L"hz"] = L"Herero"; - result[L"hi"] = L"Hindi"; - result[L"ho"] = L"Hiri Motu"; - result[L"hu"] = L"Hungarian"; - result[L"is"] = L"Icelandic"; - result[L"io"] = L"Ido"; - result[L"ig"] = L"Igbo"; - result[L"id"] = L"Indonesian"; - result[L"ia"] = L"Interlingua (International Auxiliary Language Association)"; - result[L"ie"] = L"Interlingue"; - result[L"iu"] = L"Inuktitut"; - result[L"ik"] = L"Inupiaq"; - result[L"ga"] = L"Irish"; - result[L"it"] = L"Italian"; - result[L"ja"] = L"Japanese"; - result[L"jv"] = L"Javanese"; - result[L"kl"] = L"Kalaallisut"; - result[L"kn"] = L"Kannada"; - result[L"kr"] = L"Kanuri"; - result[L"ks"] = L"Kashmiri"; - result[L"kk"] = L"Kazakh"; - result[L"ki"] = L"Kikuyu"; - result[L"rw"] = L"Kinyarwanda"; - result[L"ky"] = L"Kirghiz"; - result[L"kv"] = L"Komi"; - result[L"kg"] = L"Kongo"; - result[L"ko"] = L"Korean"; - result[L"kj"] = L"Kuanyama"; - result[L"ku"] = L"Kurdish"; - result[L"kj"] = L"Kwanyama"; - result[L"ky"] = L"Kyrgyz"; - result[L"lo"] = L"Lao"; - result[L"la"] = L"Latin"; - result[L"lv"] = L"Latvian"; - result[L"lb"] = L"Letzeburgesch"; - result[L"li"] = L"Limburgan"; - result[L"li"] = L"Limburger"; - result[L"li"] = L"Limburgish"; - result[L"ln"] = L"Lingala"; - result[L"lt"] = L"Lithuanian"; - result[L"lu"] = L"Luba-Katanga"; - result[L"lb"] = L"Luxembourgish"; - result[L"mk"] = L"Macedonian"; - result[L"mg"] = L"Malagasy"; - result[L"ms"] = L"Malay"; - result[L"ml"] = L"Malayalam"; - result[L"dv"] = L"Maldivian"; - result[L"mt"] = L"Maltese"; - result[L"gv"] = L"Manx"; - result[L"mi"] = L"Maori"; - result[L"mr"] = L"Marathi"; - result[L"mh"] = L"Marshallese"; - result[L"ro"] = L"Moldavian"; - result[L"ro"] = L"Moldovan"; - result[L"mn"] = L"Mongolian"; - result[L"na"] = L"Nauru"; - result[L"nv"] = L"Navaho"; - result[L"nv"] = L"Navajo"; - result[L"nd"] = L"Ndebele, North"; - result[L"nr"] = L"Ndebele, South"; - result[L"ng"] = L"Ndonga"; - result[L"ne"] = L"Nepali"; - result[L"nd"] = L"North Ndebele"; - result[L"se"] = L"Northern Sami"; - result[L"no"] = L"Norwegian"; - result[L"nb"] = L"Norwegian Bokmal"; - result[L"nn"] = L"Norwegian Nynorsk"; - result[L"ii"] = L"Nuosu"; - result[L"ny"] = L"Nyanja"; - result[L"nn"] = L"Nynorsk, Norwegian"; - result[L"ie"] = L"Occidental"; - result[L"oc"] = L"Occitan (post 1500)"; - result[L"oj"] = L"Ojibwa"; - result[L"cu"] = L"Old Bulgarian"; - result[L"cu"] = L"Old Church Slavonic"; - result[L"cu"] = L"Old Slavonic"; - result[L"or"] = L"Oriya"; - result[L"om"] = L"Oromo"; - result[L"os"] = L"Ossetian"; - result[L"os"] = L"Ossetic"; - result[L"pi"] = L"Pali"; - result[L"pa"] = L"Panjabi"; - result[L"ps"] = L"Pashto"; - result[L"fa"] = L"Persian"; - result[L"pl"] = L"Polish"; - result[L"pt"] = L"Portuguese"; - result[L"pa"] = L"Punjabi"; - result[L"ps"] = L"Pushto"; - result[L"qu"] = L"Quechua"; - result[L"ro"] = L"Romanian"; - result[L"rm"] = L"Romansh"; - result[L"rn"] = L"Rundi"; - result[L"ru"] = L"Russian"; - result[L"sm"] = L"Samoan"; - result[L"sg"] = L"Sango"; - result[L"sa"] = L"Sanskrit"; - result[L"sc"] = L"Sardinian"; - result[L"gd"] = L"Scottish Gaelic"; - result[L"sr"] = L"Serbian"; - result[L"sn"] = L"Shona"; - result[L"ii"] = L"Sichuan Yi"; - result[L"sd"] = L"Sindhi"; - result[L"si"] = L"Sinhala"; - result[L"si"] = L"Sinhalese"; - result[L"sk"] = L"Slovak"; - result[L"sl"] = L"Slovenian"; - result[L"so"] = L"Somali"; - result[L"st"] = L"Sotho, Southern"; - result[L"nr"] = L"South Ndebele"; - result[L"es"] = L"Spanish"; - result[L"su"] = L"Sundanese"; - result[L"sw"] = L"Swahili"; - result[L"ss"] = L"Swati"; - result[L"sv"] = L"Swedish"; - result[L"tl"] = L"Tagalog"; - result[L"ty"] = L"Tahitian"; - result[L"tg"] = L"Tajik"; - result[L"ta"] = L"Tamil"; - result[L"tt"] = L"Tatar"; - result[L"te"] = L"Telugu"; - result[L"th"] = L"Thai"; - result[L"bo"] = L"Tibetan"; - result[L"ti"] = L"Tigrinya"; - result[L"to"] = L"Tonga (Tonga Islands)"; - result[L"ts"] = L"Tsonga"; - result[L"tn"] = L"Tswana"; - result[L"tr"] = L"Turkish"; - result[L"tk"] = L"Turkmen"; - result[L"tw"] = L"Twi"; - result[L"ug"] = L"Uighur"; - result[L"uk"] = L"Ukrainian"; - result[L"ur"] = L"Urdu"; - result[L"ug"] = L"Uyghur"; - result[L"uz"] = L"Uzbek"; - result[L"ca"] = L"Valencian"; - result[L"ve"] = L"Venda"; - result[L"vi"] = L"Vietnamese"; - result[L"vo"] = L"Volapuk"; - result[L"wa"] = L"Walloon"; - result[L"cy"] = L"Welsh"; - result[L"fy"] = L"Western Frisian"; - result[L"wo"] = L"Wolof"; - result[L"xh"] = L"Xhosa"; - result[L"yi"] = L"Yiddish"; - result[L"yo"] = L"Yoruba"; - result[L"za"] = L"Zhuang"; - result[L"zu"] = L"Zulu"; + result[_T("ab")] = _T("Abkhazian"); + result[_T("aa")] = _T("Afar"); + result[_T("af")] = _T("Afrikaans"); + result[_T("ak")] = _T("Akan"); + result[_T("sq")] = _T("Albanian"); + result[_T("am")] = _T("Amharic"); + result[_T("ar")] = _T("Arabic"); + result[_T("an")] = _T("Aragonese"); + result[_T("hy")] = _T("Armenian"); + result[_T("as")] = _T("Assamese"); + result[_T("av")] = _T("Avaric"); + result[_T("ae")] = _T("Avestan"); + result[_T("ay")] = _T("Aymara"); + result[_T("az")] = _T("Azerbaijani"); + result[_T("bm")] = _T("Bambara"); + result[_T("ba")] = _T("Bashkir"); + result[_T("eu")] = _T("Basque"); + result[_T("be")] = _T("Belarusian"); + result[_T("bn")] = _T("Bengali"); + result[_T("bh")] = _T("Bihari languages"); + result[_T("bi")] = _T("Bislama"); + result[_T("nb")] = _T("Bokmal, Norwegian"); + result[_T("bs")] = _T("Bosnian"); + result[_T("br")] = _T("Breton"); + result[_T("bg")] = _T("Bulgarian"); + result[_T("my")] = _T("Burmese"); + result[_T("es")] = _T("Castilian"); + result[_T("ca")] = _T("Catalan"); + result[_T("km")] = _T("Central Khmer"); + result[_T("ch")] = _T("Chamorro"); + result[_T("ce")] = _T("Chechen"); + result[_T("ny")] = _T("Chewa"); + result[_T("ny")] = _T("Chichewa"); + result[_T("zh")] = _T("Chinese"); + result[_T("za")] = _T("Chuang"); + result[_T("cu")] = _T("Church Slavic"); + result[_T("cu")] = _T("Church Slavonic"); + result[_T("cv")] = _T("Chuvash"); + result[_T("kw")] = _T("Cornish"); + result[_T("co")] = _T("Corsican"); + result[_T("cr")] = _T("Cree"); + result[_T("hr")] = _T("Croatian"); + result[_T("cs")] = _T("Czech"); + result[_T("da")] = _T("Danish"); + result[_T("dv")] = _T("Dhivehi"); + result[_T("dv")] = _T("Divehi"); + result[_T("nl")] = _T("Dutch"); + result[_T("dz")] = _T("Dzongkha"); + result[_T("en")] = _T("English"); + result[_T("eo")] = _T("Esperanto"); + result[_T("et")] = _T("Estonian"); + result[_T("ee")] = _T("Ewe"); + result[_T("fo")] = _T("Faroese"); + result[_T("fj")] = _T("Fijian"); + result[_T("fi")] = _T("Finnish"); + result[_T("nl")] = _T("Flemish"); + result[_T("fr")] = _T("French"); + result[_T("ff")] = _T("Fulah"); + result[_T("gd")] = _T("Gaelic"); + result[_T("gl")] = _T("Galician"); + result[_T("lg")] = _T("Ganda"); + result[_T("ka")] = _T("Georgian"); + result[_T("de")] = _T("German"); + result[_T("ki")] = _T("Gikuyu"); + result[_T("el")] = _T("Greek, Modern (1453-)"); + result[_T("kl")] = _T("Greenlandic"); + result[_T("gn")] = _T("Guarani"); + result[_T("gu")] = _T("Gujarati"); + result[_T("ht")] = _T("Haitian"); + result[_T("ht")] = _T("Haitian Creole"); + result[_T("ha")] = _T("Hausa"); + result[_T("he")] = _T("Hebrew"); + result[_T("hz")] = _T("Herero"); + result[_T("hi")] = _T("Hindi"); + result[_T("ho")] = _T("Hiri Motu"); + result[_T("hu")] = _T("Hungarian"); + result[_T("is")] = _T("Icelandic"); + result[_T("io")] = _T("Ido"); + result[_T("ig")] = _T("Igbo"); + result[_T("id")] = _T("Indonesian"); + result[_T("ia")] = _T("Interlingua (International Auxiliary Language Association)"); + result[_T("ie")] = _T("Interlingue"); + result[_T("iu")] = _T("Inuktitut"); + result[_T("ik")] = _T("Inupiaq"); + result[_T("ga")] = _T("Irish"); + result[_T("it")] = _T("Italian"); + result[_T("ja")] = _T("Japanese"); + result[_T("jv")] = _T("Javanese"); + result[_T("kl")] = _T("Kalaallisut"); + result[_T("kn")] = _T("Kannada"); + result[_T("kr")] = _T("Kanuri"); + result[_T("ks")] = _T("Kashmiri"); + result[_T("kk")] = _T("Kazakh"); + result[_T("ki")] = _T("Kikuyu"); + result[_T("rw")] = _T("Kinyarwanda"); + result[_T("ky")] = _T("Kirghiz"); + result[_T("kv")] = _T("Komi"); + result[_T("kg")] = _T("Kongo"); + result[_T("ko")] = _T("Korean"); + result[_T("kj")] = _T("Kuanyama"); + result[_T("ku")] = _T("Kurdish"); + result[_T("kj")] = _T("Kwanyama"); + result[_T("ky")] = _T("Kyrgyz"); + result[_T("lo")] = _T("Lao"); + result[_T("la")] = _T("Latin"); + result[_T("lv")] = _T("Latvian"); + result[_T("lb")] = _T("Letzeburgesch"); + result[_T("li")] = _T("Limburgan"); + result[_T("li")] = _T("Limburger"); + result[_T("li")] = _T("Limburgish"); + result[_T("ln")] = _T("Lingala"); + result[_T("lt")] = _T("Lithuanian"); + result[_T("lu")] = _T("Luba-Katanga"); + result[_T("lb")] = _T("Luxembourgish"); + result[_T("mk")] = _T("Macedonian"); + result[_T("mg")] = _T("Malagasy"); + result[_T("ms")] = _T("Malay"); + result[_T("ml")] = _T("Malayalam"); + result[_T("dv")] = _T("Maldivian"); + result[_T("mt")] = _T("Maltese"); + result[_T("gv")] = _T("Manx"); + result[_T("mi")] = _T("Maori"); + result[_T("mr")] = _T("Marathi"); + result[_T("mh")] = _T("Marshallese"); + result[_T("ro")] = _T("Moldavian"); + result[_T("ro")] = _T("Moldovan"); + result[_T("mn")] = _T("Mongolian"); + result[_T("na")] = _T("Nauru"); + result[_T("nv")] = _T("Navaho"); + result[_T("nv")] = _T("Navajo"); + result[_T("nd")] = _T("Ndebele, North"); + result[_T("nr")] = _T("Ndebele, South"); + result[_T("ng")] = _T("Ndonga"); + result[_T("ne")] = _T("Nepali"); + result[_T("nd")] = _T("North Ndebele"); + result[_T("se")] = _T("Northern Sami"); + result[_T("no")] = _T("Norwegian"); + result[_T("nb")] = _T("Norwegian Bokmal"); + result[_T("nn")] = _T("Norwegian Nynorsk"); + result[_T("ii")] = _T("Nuosu"); + result[_T("ny")] = _T("Nyanja"); + result[_T("nn")] = _T("Nynorsk, Norwegian"); + result[_T("ie")] = _T("Occidental"); + result[_T("oc")] = _T("Occitan (post 1500)"); + result[_T("oj")] = _T("Ojibwa"); + result[_T("cu")] = _T("Old Bulgarian"); + result[_T("cu")] = _T("Old Church Slavonic"); + result[_T("cu")] = _T("Old Slavonic"); + result[_T("or")] = _T("Oriya"); + result[_T("om")] = _T("Oromo"); + result[_T("os")] = _T("Ossetian"); + result[_T("os")] = _T("Ossetic"); + result[_T("pi")] = _T("Pali"); + result[_T("pa")] = _T("Panjabi"); + result[_T("ps")] = _T("Pashto"); + result[_T("fa")] = _T("Persian"); + result[_T("pl")] = _T("Polish"); + result[_T("pt")] = _T("Portuguese"); + result[_T("pa")] = _T("Punjabi"); + result[_T("ps")] = _T("Pushto"); + result[_T("qu")] = _T("Quechua"); + result[_T("ro")] = _T("Romanian"); + result[_T("rm")] = _T("Romansh"); + result[_T("rn")] = _T("Rundi"); + result[_T("ru")] = _T("Russian"); + result[_T("sm")] = _T("Samoan"); + result[_T("sg")] = _T("Sango"); + result[_T("sa")] = _T("Sanskrit"); + result[_T("sc")] = _T("Sardinian"); + result[_T("gd")] = _T("Scottish Gaelic"); + result[_T("sr")] = _T("Serbian"); + result[_T("sn")] = _T("Shona"); + result[_T("ii")] = _T("Sichuan Yi"); + result[_T("sd")] = _T("Sindhi"); + result[_T("si")] = _T("Sinhala"); + result[_T("si")] = _T("Sinhalese"); + result[_T("sk")] = _T("Slovak"); + result[_T("sl")] = _T("Slovenian"); + result[_T("so")] = _T("Somali"); + result[_T("st")] = _T("Sotho, Southern"); + result[_T("nr")] = _T("South Ndebele"); + result[_T("es")] = _T("Spanish"); + result[_T("su")] = _T("Sundanese"); + result[_T("sw")] = _T("Swahili"); + result[_T("ss")] = _T("Swati"); + result[_T("sv")] = _T("Swedish"); + result[_T("tl")] = _T("Tagalog"); + result[_T("ty")] = _T("Tahitian"); + result[_T("tg")] = _T("Tajik"); + result[_T("ta")] = _T("Tamil"); + result[_T("tt")] = _T("Tatar"); + result[_T("te")] = _T("Telugu"); + result[_T("th")] = _T("Thai"); + result[_T("bo")] = _T("Tibetan"); + result[_T("ti")] = _T("Tigrinya"); + result[_T("to")] = _T("Tonga (Tonga Islands)"); + result[_T("ts")] = _T("Tsonga"); + result[_T("tn")] = _T("Tswana"); + result[_T("tr")] = _T("Turkish"); + result[_T("tk")] = _T("Turkmen"); + result[_T("tw")] = _T("Twi"); + result[_T("ug")] = _T("Uighur"); + result[_T("uk")] = _T("Ukrainian"); + result[_T("ur")] = _T("Urdu"); + result[_T("ug")] = _T("Uyghur"); + result[_T("uz")] = _T("Uzbek"); + result[_T("ca")] = _T("Valencian"); + result[_T("ve")] = _T("Venda"); + result[_T("vi")] = _T("Vietnamese"); + result[_T("vo")] = _T("Volapuk"); + result[_T("wa")] = _T("Walloon"); + result[_T("cy")] = _T("Welsh"); + result[_T("fy")] = _T("Western Frisian"); + result[_T("wo")] = _T("Wolof"); + result[_T("xh")] = _T("Xhosa"); + result[_T("yi")] = _T("Yiddish"); + result[_T("yo")] = _T("Yoruba"); + result[_T("za")] = _T("Zhuang"); + result[_T("zu")] = _T("Zulu"); } void CSkypeProto::UpdateProfileFirstName(JSONNODE *root, MCONTACT hContact) @@ -270,14 +270,16 @@ void CSkypeProto::UpdateProfileBirthday(JSONNODE *root, MCONTACT hContact) { JSONNODE *node = json_get(root, "birthday"); CMString birthday = ptrT(json_as_string(node)); - if (!birthday.IsEmpty() && birthday != "null") { + if (!birthday.IsEmpty() && birthday != "null") + { int d, m, y; _stscanf(birthday.GetBuffer(), _T("%d-%d-%d"), &y, &m, &d); setWord(hContact, "BirthYear", y); setByte(hContact, "BirthDay", d); setByte(hContact, "BirthMonth", m); } - else { + else + { delSetting(hContact, "BirthYear"); delSetting(hContact, "BirthDay"); delSetting(hContact, "BirthMonth"); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 61b8f2445a..3937a4e6c7 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -116,37 +116,7 @@ HANDLE CSkypeProto::SendFile(MCONTACT hContact, const PROTOCHAR *szDescription, int CSkypeProto::SendMsg(MCONTACT hContact, int flags, const char *msg) { - UINT hMessage = InterlockedIncrement(&hMessageProcess); - - SendMessageParam *param = (SendMessageParam*)mir_calloc(sizeof(SendMessageParam)); - param->hContact = hContact; - param->hMessage = (HANDLE)hMessage; - param->msg = msg; - param->flags = flags; - - ForkThread(&CSkypeProto::SendMsgThread, (void*)param); - - return hMessage; -} - -void CSkypeProto::SendMsgThread(void *arg) -{ - SendMessageParam *param = (SendMessageParam*)arg; - - if (!IsOnline()) - { - ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, (LPARAM)Translate("You cannot send messages when you are offline.")); - mir_free(param); - return; - } - - CMStringA message = (param->flags & PREF_UNICODE) ? ptrA(mir_utf8encode(param->msg)) : param->msg; // TODO: mir_utf8encode check taken from FacebookRM, is it needed? Usually we get PREF_UTF8 flag instead. - - ptrA token(getStringA("registrationToken")); - ptrA username(getStringA(param->hContact, "Skypename")); - PushRequest( - new SendMsgRequest(token, username, message, getStringA("Server"))/*, - &CSkypeProto::OnMessageSent*/); + return OnSendMessage(hContact, flags, msg); } int CSkypeProto::SendUrl(MCONTACT, int, const char*) { return 0; } @@ -175,18 +145,14 @@ int CSkypeProto::SetStatus(int iNewStatus) requestQueue->Stop(); if (!Miranda_Terminated()) - { SetAllContactsStatus(ID_STATUS_OFFLINE); - } m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; } else { if (old_status == ID_STATUS_CONNECTING) - { return 0; - } else if (old_status == ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_OFFLINE) { // login diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 5d365c0cb1..df66f1ee97 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -115,9 +115,7 @@ int CSkypeProto::SkypeToMirandaStatus(const char *status) void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, int flags, MCONTACT hContact) { if (Miranda_Terminated()) - { return; - } if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) { -- cgit v1.2.3