From 12aab78ca9748bf56f2d6be2ab6b5f7b146313ed Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 24 Apr 2013 08:55:07 +0000 Subject: small cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@4524 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.cpp | 94 +++++++++++++++------------------- protocols/Skype/src/skype_account.cpp | 8 +-- protocols/Skype/src/skype_chat.cpp | 87 +++++++++++++++---------------- protocols/Skype/src/skype_contacts.cpp | 27 +++++----- protocols/Skype/src/skype_database.cpp | 35 +++++-------- protocols/Skype/src/skype_dialogs.cpp | 46 ++++++++--------- 6 files changed, 139 insertions(+), 158 deletions(-) (limited to 'protocols/Skype/src') diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp index a385020a33..bbc948e6ca 100644 --- a/protocols/Skype/src/skype.cpp +++ b/protocols/Skype/src/skype.cpp @@ -53,11 +53,11 @@ BOOL IsRunAsAdmin() // Allocate and initialize a SID of the administrators group. SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY; if ( !AllocateAndInitializeSid( - &NtAuthority, - 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, + &NtAuthority, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &pAdministratorsGroup)) { dwError = GetLastError(); @@ -127,36 +127,29 @@ char *LoadKeyPair(HINSTANCE hInstance) int StartSkypeRuntime(HINSTANCE hInstance, const wchar_t *profileName, int &port/*, const wchar_t *dbPath*/) { - STARTUPINFO cif; - PROCESS_INFORMATION pi; - wchar_t param[128]; - - ::ZeroMemory(&cif, sizeof(STARTUPINFO)); + STARTUPINFO cif = {0}; cif.cb = sizeof(STARTUPINFO); cif.dwFlags = STARTF_USESHOWWINDOW; cif.wShowWindow = SW_HIDE; - //HRSRC hRes; - //HGLOBAL hResource; wchar_t fileName[MAX_PATH]; + ::GetModuleFileName(hInstance, fileName, MAX_PATH); - HRSRC hRes = ::FindResource(hInstance, MAKEINTRESOURCE(/*IDR_RUNTIME*/102), L"BIN"); - if (hRes) + wchar_t *skypeKitPath = ::wcsrchr(fileName, '\\'); + if (skypeKitPath != NULL) + *skypeKitPath = 0; + ::swprintf(fileName, SIZEOF(fileName), L"%s\\%s", fileName, L"SkypeKit.exe"); + if ( !::PathFileExists(fileName)) { - HGLOBAL hResource = ::LoadResource(hInstance, hRes); - if (hResource) + HRSRC hRes = ::FindResource(hInstance, MAKEINTRESOURCE(/*IDR_RUNTIME*/102), L"BIN"); + if (hRes) { - HANDLE hFile; - char *pData = (char *)LockResource(hResource); - DWORD dwSize = SizeofResource(hInstance, hRes), written = 0; - ::GetModuleFileName(hInstance, fileName, MAX_PATH); - - wchar_t *skypeKitPath = ::wcsrchr(fileName, '\\'); - if (skypeKitPath != NULL) - *skypeKitPath = 0; - ::swprintf(fileName, SIZEOF(fileName), L"%s\\%s", fileName, L"SkypeKit.exe"); - if ( !::PathFileExists(fileName)) + HGLOBAL hResource = ::LoadResource(hInstance, hRes); + if (hResource) { + HANDLE hFile; + char *pData = (char *)LockResource(hResource); + DWORD dwSize = SizeofResource(hInstance, hRes), written = 0; if ((hFile = ::CreateFile( fileName, GENERIC_WRITE, @@ -180,17 +173,17 @@ int StartSkypeRuntime(HINSTANCE hInstance, const wchar_t *profileName, int &port if (profileName) ::swprintf( - cmdLine, - SIZEOF(cmdLine), - L" /restart:%d /profile=%s", - ::GetCurrentProcessId(), - profileName); + cmdLine, + SIZEOF(cmdLine), + L" /restart:%d /profile=%s", + ::GetCurrentProcessId(), + profileName); else ::swprintf( - cmdLine, - SIZEOF(cmdLine), - L" /restart:%d", - ::GetCurrentProcessId()); + cmdLine, + SIZEOF(cmdLine), + L" /restart:%d", + ::GetCurrentProcessId()); // Launch itself as administrator. SHELLEXECUTEINFO sei = { sizeof(sei) }; @@ -209,16 +202,16 @@ int StartSkypeRuntime(HINSTANCE hInstance, const wchar_t *profileName, int &port // Do nothing ... } } - //else - //{ - // //DestroyWindow(hDlg); // Quit itself - // ::CallService("CloseAction", 0, 0); - //} } - return 0; + else + return 0; } } + else + return 0; } + else + return 0; } PROCESSENTRY32 entry; @@ -237,6 +230,8 @@ int StartSkypeRuntime(HINSTANCE hInstance, const wchar_t *profileName, int &port } ::CloseHandle(snapshot); + wchar_t param[128]; + PROCESS_INFORMATION pi; //::swprintf(param, SIZEOF(param), L"-p -P %d -f %s", port, dbPath); ::swprintf(param, SIZEOF(param), L"-p -P %d", port); int startingrt = ::CreateProcess( @@ -244,12 +239,7 @@ int StartSkypeRuntime(HINSTANCE hInstance, const wchar_t *profileName, int &port NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &cif, &pi); - DWORD rterr = GetLastError(); - //if (startingrt && rterr == ERROR_SUCCESS) - //return 1; - //else - //return 0; return startingrt; } @@ -263,7 +253,7 @@ extern "C" int __declspec(dllexport) Load(void) int port = 8963; VARST profilename( _T("%miranda_profilename%")); - if ( !StartSkypeRuntime(g_hInstance, (TCHAR*)profilename, port)) + if ( !StartSkypeRuntime(g_hInstance, (TCHAR *)profilename, port)) { ::MessageBox(NULL, TranslateT("Proccess SkypeKit.exe did not start."), _T(MODULE), MB_OK | MB_ICONERROR); return 1; @@ -295,11 +285,11 @@ extern "C" int __declspec(dllexport) Load(void) // --- PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; - pd.szName = "SKYPE"; - pd.type = PROTOTYPE_PROTOCOL; - pd.fnInit = (pfnInitProto) CSkypeProto::InitSkypeProto; - pd.fnUninit = (pfnUninitProto)CSkypeProto::UninitSkypeProto; - CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast(&pd)); + pd.szName = "SKYPE"; + pd.type = PROTOTYPE_PROTOCOL; + pd.fnInit = (pfnInitProto)CSkypeProto::InitSkypeProto; + pd.fnUninit = (pfnUninitProto)CSkypeProto::UninitSkypeProto; + CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); CSkypeProto::InitIcons(); CSkypeProto::InitServiceList(); diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index d28116a6ee..6c9d45be2a 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -7,7 +7,7 @@ void CSkypeProto::OnAccountChanged(int prop) case CAccount::P_STATUS: CAccount::STATUS loginStatus; this->account->GetPropStatus(loginStatus); - + if (loginStatus == CAccount::LOGGED_IN) { this->ForkThread(&CSkypeProto::SignInAsync, 0); @@ -103,14 +103,14 @@ void __cdecl CSkypeProto::SignInAsync(void*) bool CSkypeProto::PrepareLogin() { - this->login = ::db_get_wsa(NULL, this->m_szModuleName, SKYPE_SETTINGS_LOGIN); + this->login = ::db_get_wsa(NULL, this->m_szModuleName, SKYPE_SETTINGS_LOGIN); if ( !this->login || !::wcslen(this->login)) { this->m_iStatus = ID_STATUS_OFFLINE; this->SendBroadcast(ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID); this->ShowNotification( ::TranslateT("You have not entered a Skype name.\n\ - Configure this in Options->Network->Skype and try again.")); + Configure this in Options->Network->Skype and try again.")); return false; } @@ -146,7 +146,7 @@ bool CSkypeProto::PreparePassword() this->rememberPassword = param.rememberPassword; } } - else + else ::CallService(MS_DB_CRYPT_DECODESTRING, ::strlen(this->password), (LPARAM)this->password); } diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index 42a19fe190..51c00fe2dc 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -68,7 +68,7 @@ HANDLE CSkypeProto::AddChatRoom(CConversation::Ref conversation) mir_ptr defaultGroup = ::db_get_wsa(NULL, "Chat", "AddToGroup"); if (defaultGroup) { - ::db_set_ws(hContact, "CList", "Group", defaultGroup); + ::db_set_ws(hContact, "CList", "Group", defaultGroup); } } @@ -106,7 +106,7 @@ void CSkypeProto::ChatPrepare(HANDLE hItem, HWND hwndList, const wchar_t *contac this->ChatValidateContact(hItem, hwndList, contacts); hItem = hItemN; - } + } } void CSkypeProto::GetInviteContacts(HANDLE hItem, HWND hwndList, SEStringList &chatTargets) @@ -114,12 +114,13 @@ void CSkypeProto::GetInviteContacts(HANDLE hItem, HWND hwndList, SEStringList &c if (hItem == NULL) hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); - while (hItem) + while (hItem) { if (IsHContactGroup(hItem)) { HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) this->GetInviteContacts(hItemT, hwndList, chatTargets); + if (hItemT) + this->GetInviteContacts(hItemT, hwndList, chatTargets); } else { @@ -133,7 +134,7 @@ void CSkypeProto::GetInviteContacts(HANDLE hItem, HWND hwndList, SEStringList &c if (buf[0]) chatTargets.append(mir_t2a(buf)); } - else + else { ::mir_ptr sid(::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); chatTargets.append(::mir_u2a(sid)); @@ -196,7 +197,7 @@ void CSkypeProto::CreateChatWindow(CConversation::Ref conversation, bool showWin gcd.iType = GC_EVENT_CONTROL; ::CallServiceSync(MS_GC_EVENT, showWindow ? SESSION_INITDONE : WINDOW_HIDDEN, (LPARAM)&gce); - ::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce); + ::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce); ::mir_free(cid); ::mir_free(chatName); @@ -208,7 +209,7 @@ wchar_t *CSkypeProto::StartChat(const wchar_t *cid, const SEStringList &invitedC SEString data; CConversation::Ref conversation; - if (invitedContacts.size()) + if (invitedContacts.size()) { if (cid) { @@ -222,13 +223,13 @@ wchar_t *CSkypeProto::StartChat(const wchar_t *cid, const SEStringList &invitedC else { g_skype->CreateConference(conversation); - conversation->SetOption(CConversation::P_OPT_JOINING_ENABLED, true); - conversation->SetOption(CConversation::P_OPT_ENTRY_LEVEL_RANK, CParticipant::WRITER); - conversation->SetOption(CConversation::P_OPT_DISCLOSE_HISTORY, 1); + conversation->SetOption(CConversation::P_OPT_JOINING_ENABLED, true); + conversation->SetOption(CConversation::P_OPT_ENTRY_LEVEL_RANK, CParticipant::WRITER); + conversation->SetOption(CConversation::P_OPT_DISCLOSE_HISTORY, 1); conversation->GetPropIdentity(data); chatID = ::mir_utf8decodeW(data); - } + } conversation->AddConsumers(invitedContacts); @@ -269,7 +270,7 @@ wchar_t *CSkypeProto::StartChat(const wchar_t *cid, const SEStringList &invitedC ::mir_free(chatName); return chatID; - } + } else return NULL; } @@ -294,7 +295,7 @@ void CSkypeProto::JoinToChat(CConversation::Ref conversation, bool showWindow) { participants[i]->GetPropIdentity(data); mir_ptr sid = ::mir_utf8decodeW(data); - + CParticipant::RANK rank; participants[i]->GetPropRank(rank); mir_ptr group = ::mir_utf8decodeW(CParticipant::GetRankName(rank)); @@ -306,7 +307,7 @@ void CSkypeProto::JoinToChat(CConversation::Ref conversation, bool showWindow) contact->GetPropAvailability(status); this->AddChatContact( - chatID, + chatID, sid, group, this->SkypeToMirandaStatus(status)); @@ -340,7 +341,7 @@ void CSkypeProto::RaiseChatEvent(const wchar_t *cid, const wchar_t *sid, int evt ::mir_a2u((char *)::CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), 0)) : ::mir_wstrdup(sid); - GCDEST gcd = { this->m_szModuleName, { NULL }, evt }; + GCDEST gcd = { this->m_szModuleName, { NULL }, evt }; gcd.ptszID = ::mir_wstrdup(cid); GCEVENT gce = {0}; @@ -351,7 +352,7 @@ void CSkypeProto::RaiseChatEvent(const wchar_t *cid, const wchar_t *sid, int evt gce.ptszUID = sid; gce.bIsMe = ::wcsicmp(sid, this->login) == 0; gce.dwItemData = itemData; - gce.ptszStatus = status; + gce.ptszStatus = status; gce.ptszText = message; gce.time = time(NULL); ::CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); @@ -413,25 +414,25 @@ INT_PTR __cdecl CSkypeProto::OnLeaveChat(WPARAM wParam, LPARAM) wchar_t *cid = ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"); this->LeaveChat(cid); - + ::mir_free(cid); } return 0; } -int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) +int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) { GCHOOK *gch = (GCHOOK *)lParam; if (!gch) return 1; - if (::strcmp(gch->pDest->pszModule, this->m_szModuleName)) + if (::strcmp(gch->pDest->pszModule, this->m_szModuleName)) return 0; wchar_t *chatID = ::mir_wstrdup(gch->pDest->ptszID); wchar_t *sid = ::mir_wstrdup(gch->ptszUID); - switch (gch->pDest->iType) + switch (gch->pDest->iType) { case GC_SESSION_TERMINATE: { @@ -446,7 +447,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) break; case GC_USER_MESSAGE: - if (gch->ptszText && gch->ptszText[0]) + if (gch->ptszText && gch->ptszText[0]) { CConversation::Ref conversation; if (g_skype->GetConversationByIdentity(::mir_utf8encodeW(chatID), conversation, false)) @@ -458,12 +459,12 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) } break; - case GC_USER_CHANMGR: + case GC_USER_CHANMGR: DialogBoxParam( - g_hInstance, - MAKEINTRESOURCE(IDD_CHATROOM_INVITE), - NULL, - CSkypeProto::InviteToChatProc, + g_hInstance, + MAKEINTRESOURCE(IDD_CHATROOM_INVITE), + NULL, + CSkypeProto::InviteToChatProc, LPARAM(new InviteChatParam(chatID, NULL, this))); break; @@ -472,14 +473,14 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) break; case GC_USER_LOGMENU: - switch(gch->dwData) + switch(gch->dwData) { case 10: ::DialogBoxParam( g_hInstance, - MAKEINTRESOURCE(IDD_CHATROOM_INVITE), - NULL, - CSkypeProto::InviteToChatProc, + MAKEINTRESOURCE(IDD_CHATROOM_INVITE), + NULL, + CSkypeProto::InviteToChatProc, (LPARAM)new InviteChatParam(chatID, NULL, this)); break; @@ -488,9 +489,9 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) break; } break; - - case GC_USER_NICKLISTMENU: - switch (gch->dwData) + + case GC_USER_NICKLISTMENU: + switch (gch->dwData) { case 10: ::CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)this->GetContactBySid(sid), 0); @@ -506,7 +507,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) } break; - case GC_USER_TYPNOTIFY: + case GC_USER_TYPNOTIFY: break; } ::mir_free(sid); @@ -515,13 +516,14 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) return 0; } -int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) +int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) { GCMENUITEMS *gcmi = (GCMENUITEMS*) lParam; - if (gcmi == NULL || ::stricmp(gcmi->pszModule, this->m_szModuleName)) return 0; + if (gcmi == NULL || ::stricmp(gcmi->pszModule, this->m_szModuleName)) + return 0; - if (gcmi->Type == MENU_ON_LOG) + if (gcmi->Type == MENU_ON_LOG) { static const struct gc_item Items[] = { @@ -531,10 +533,10 @@ int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) gcmi->nItems = SIZEOF(Items); gcmi->Item = (gc_item*)Items; } - else if (gcmi->Type == MENU_ON_NICKLIST) + else if (gcmi->Type == MENU_ON_NICKLIST) { wchar_t *id = mir_wstrdup(gcmi->pszUID); - if (!::wcsicmp(this->login, id)) + if (!::wcsicmp(this->login, id)) { static const struct gc_item Items[] = { @@ -546,7 +548,7 @@ int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) gcmi->nItems = SIZEOF(Items); gcmi->Item = (gc_item*)Items; } - else + else { static const struct gc_item Items[] = { @@ -562,7 +564,6 @@ int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) return 0; } - wchar_t *CSkypeProto::GetChatUsers(const wchar_t *cid) { GC_INFO gci = {0}; @@ -597,8 +598,8 @@ void CSkypeProto::UpdateChatUserStatus(CContact::Ref contact) ::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci); this->RaiseChatEvent( - gci.pszID, - sid, + gci.pszID, + sid, GC_EVENT_SETCONTACTSTATUS, 0, this->SkypeToMirandaStatus(availability)); diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 22ef53c8de..68546d252b 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -85,6 +85,7 @@ void CSkypeProto::OnContactChanged(CContact::Ref contact, int prop) } } break; + case CContact::P_AUTHREQUEST_COUNT: // todo: all authrequests after first should be catch here this->UpdateContactAuthState(hContact, contact); @@ -99,6 +100,7 @@ void CSkypeProto::OnContactChanged(CContact::Ref contact, int prop) case CContact::P_AVATAR_TIMESTAMP: this->UpdateProfileAvatar(contactObj, hContact); break; + //case CContact::P_MOOD_TEXT: case CContact::P_MOOD_TIMESTAMP: this->UpdateProfileStatusMessage(contactObj, hContact); @@ -151,7 +153,7 @@ HANDLE CSkypeProto::GetContactBySid(const wchar_t *sid) HANDLE hContact = ::db_find_first(); while (hContact) { - if (this->IsProtoContact(hContact) && !this->IsChatRoom(hContact)) + if (this->IsProtoContact(hContact) && !this->IsChatRoom(hContact)) { mir_ptr contactSid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN)); if (contactSid && ::wcsicmp(sid, contactSid) == 0) @@ -199,13 +201,12 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact) wchar_t *nick = ::mir_utf8decodeW(contact->GetNick()); - switch(availability) { case CContact::SKYPEOUT: this->SetSettingByte(hContact, "IsSkypeOut", 1); break; - + case CContact::PENDINGAUTH: ::db_set_b(hContact, "CList", "NotOnList", 1); break; @@ -297,13 +298,13 @@ void __cdecl CSkypeProto::LoadAuthWaitList(void*) this); this->authWaitList->GetContacts(authContacts); - for (uint i = 0; i < authContacts.size(); i++) - { + for (uint i = 0; i < authContacts.size(); i++) + { CContact::Ref contact = authContacts[i]; uint newTS = 0; contact->GetPropAuthreqTimestamp(newTS); - + this->RaiseAuthRequestEvent(newTS, contact); } } @@ -311,9 +312,9 @@ void __cdecl CSkypeProto::LoadAuthWaitList(void*) bool CSkypeProto::IsContactOnline(HANDLE hContact) { return ::db_get_w( - hContact, - this->m_szModuleName, - SKYPE_SETTINGS_STATUS, + hContact, + this->m_szModuleName, + SKYPE_SETTINGS_STATUS, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE; } @@ -322,7 +323,7 @@ void CSkypeProto::SetAllContactStatus(int status) HANDLE hContact = ::db_find_first(); while (hContact) { - if (this->IsProtoContact(hContact) && this->GetSettingByte(hContact, "IsSkypeOut", 0) == 0) + if (this->IsProtoContact(hContact) && this->GetSettingByte(hContact, "IsSkypeOut", 0) == 0) this->SetSettingWord(hContact, SKYPE_SETTINGS_STATUS, status); hContact = ::db_find_next(hContact); @@ -339,13 +340,13 @@ void CSkypeProto::OnContactFinded(CContact::Ref contact, HANDLE hSearch) PROTOSEARCHRESULT psr = {0}; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - + SEString data; contact->GetPropSkypename(data); psr.id = ::mir_utf8decodeW(data); contact->GetPropDisplayname(data); psr.nick = ::mir_utf8decodeW(data); - + SEString firstName, lastName; contact->GetFullname(firstName, lastName); psr.firstName = ::mir_utf8decodeW(firstName); @@ -391,7 +392,7 @@ void __cdecl CSkypeProto::SearchBySidAsync(void* arg) bool valid; if (!search->IsValid(valid) || !valid || !search->Submit()) { - return; + return; } search->BlockWhileSearch(); search->Release(); diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index 2e4bfe4139..8884cb2485 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -30,7 +30,7 @@ bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, const char* gu } ::mir_free(dbei.pBlob); - hDbEvent = ::db_event_prev(hDbEvent); + hDbEvent = ::db_event_prev(hDbEvent); } return result; @@ -50,10 +50,8 @@ HANDLE CSkypeProto::AddDataBaseEvent(HANDLE hContact, WORD type, DWORD timestamp return ::db_event_add(hContact, &dbei); } -void CSkypeProto::RaiseAuthRequestEvent( - DWORD timestamp, - CContact::Ref contact) -{ +void CSkypeProto::RaiseAuthRequestEvent(DWORD timestamp, CContact::Ref contact) +{ char *sid = ::mir_strdup(contact->GetSid()); char *nick = ::mir_strdup(contact->GetNick()); @@ -76,12 +74,12 @@ void CSkypeProto::RaiseAuthRequestEvent( ::strlen(firstName) + ::strlen(lastName) + ::strlen(sid) + - ::strlen(reason) + + ::strlen(reason) + 5; - PBYTE pBlob, pCurBlob; + PBYTE pBlob, pCurBlob; pCurBlob = pBlob = (PBYTE)::mir_alloc(cbBlob); - + *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD); *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD); ::strcpy((char*)pCurBlob, nick); pCurBlob += ::strlen(nick) + 1; @@ -89,17 +87,12 @@ void CSkypeProto::RaiseAuthRequestEvent( ::strcpy((char*)pCurBlob, lastName); pCurBlob += ::strlen(lastName) + 1; ::strcpy((char*)pCurBlob, sid); pCurBlob += ::strlen(sid) + 1; ::strcpy((char*)pCurBlob, reason); - + this->AddDataBaseEvent(hContact, EVENTTYPE_AUTHREQUEST, time(NULL), PREF_UTF, cbBlob, pBlob); } -void CSkypeProto::RaiseMessageReceivedEvent( - HANDLE hContact, - DWORD timestamp, - const char *guid, - const wchar_t *message, - bool isNeedCheck) -{ +void CSkypeProto::RaiseMessageReceivedEvent(HANDLE hContact, DWORD timestamp, const char *guid, const wchar_t *message, bool isNeedCheck) +{ //if (isNeedCheck) // if (this->IsMessageInDB(hContact, timestamp, guid)) // return; @@ -109,16 +102,12 @@ void CSkypeProto::RaiseMessageReceivedEvent( recv.lParam = (LPARAM)guid; recv.timestamp = timestamp; recv.szMessage = ::mir_utf8encodeW(message); - + ::ProtoChainRecvMsg(hContact, &recv); } -void CSkypeProto::RaiseMessageSendedEvent( - HANDLE hContact, - DWORD timestamp, - const char *guid, - const wchar_t *message) -{ +void CSkypeProto::RaiseMessageSendedEvent(HANDLE hContact, DWORD timestamp, const char *guid, const wchar_t *message) +{ //if (this->IsMessageInDB(hContact, timestamp, guid, DBEF_SENT)) // return; diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 5c31c68dec..71bf155c5f 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -39,7 +39,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR { CheckDlgButton(hwnd, IDC_USE_ALT_PORTS, proto->GetSettingByte("UseAlternativePorts", 1)); } - if (proto->IsOnline()) + if (proto->IsOnline()) { SendMessage(GetDlgItem(hwnd, IDC_SL), EM_SETREADONLY, 1, 0); SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0); @@ -55,7 +55,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR } return TRUE; - case WM_COMMAND: + case WM_COMMAND: { switch(LOWORD(wParam)) { @@ -96,10 +96,10 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR char sid[128], pwd[128]; GetDlgItemTextA(hwnd, IDC_SL, sid, SIZEOF(sid)); GetDlgItemTextA(hwnd, IDC_PW, pwd, SIZEOF(pwd)); - + CSkype::VALIDATERESULT reason; g_skype->ValidatePassword(sid, pwd, reason); - + if (reason == CSkype::VALIDATED_OK) { CAccount::Ref account; @@ -166,10 +166,10 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR INT_PTR __cdecl CSkypeProto::OnAccountManagerInit(WPARAM wParam, LPARAM lParam) { return (int)::CreateDialogParam( - g_hInstance, - MAKEINTRESOURCE(IDD_ACCMGR), - (HWND)lParam, - &CSkypeProto::SkypeMainOptionsProc, + g_hInstance, + MAKEINTRESOURCE(IDD_ACCMGR), + (HWND)lParam, + &CSkypeProto::SkypeMainOptionsProc, (LPARAM)this); } @@ -196,7 +196,7 @@ INT_PTR CALLBACK CSkypeProto::SkypePasswordRequestProc(HWND hwndDlg, UINT msg, W { PasswordRequestBoxParam *param = reinterpret_cast(::GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); - switch (msg) + switch (msg) { case WM_INITDIALOG: ::TranslateDialogDefault(hwndDlg); @@ -228,7 +228,7 @@ INT_PTR CALLBACK CSkypeProto::SkypePasswordRequestProc(HWND hwndDlg, UINT msg, W case WM_COMMAND: { - switch (LOWORD(wParam)) + switch (LOWORD(wParam)) { case IDOK: { @@ -268,7 +268,7 @@ INT_PTR CALLBACK CSkypeProto::SkypePasswordChangeProc(HWND hwndDlg, UINT msg, WP { PasswordChangeBoxParam *param = reinterpret_cast(::GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); - switch (msg) + switch (msg) { case WM_INITDIALOG: ::TranslateDialogDefault(hwndDlg); @@ -287,7 +287,7 @@ INT_PTR CALLBACK CSkypeProto::SkypePasswordChangeProc(HWND hwndDlg, UINT msg, WP case WM_COMMAND: { - switch (LOWORD(wParam)) + switch (LOWORD(wParam)) { case IDOK: { @@ -451,7 +451,7 @@ INT_PTR CALLBACK CSkypeProto::OwnSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa LV_ITEM lvi = {0}; lvi.mask = LVIF_PARAM | LVIF_TEXT; - for (lvi.iItem = 0; lvi.iItem < SIZEOF(CSkypeProto::setting); lvi.iItem++) + for (lvi.iItem = 0; lvi.iItem < SIZEOF(CSkypeProto::setting); lvi.iItem++) { lvi.lParam = lvi.iItem; lvi.pszText = (LPTSTR)setting[lvi.iItem].szDescription; @@ -540,7 +540,7 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP { InviteChatParam *param = (InviteChatParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) + switch (msg) { case WM_INITDIALOG: { @@ -570,10 +570,10 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP NMCLISTCONTROL* nmc = (NMCLISTCONTROL*)lParam; if (nmc->hdr.idFrom == IDC_CCLIST) { - switch (nmc->hdr.code) + switch (nmc->hdr.code) { case CLN_NEWCONTACT: - if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) + if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) { wchar_t *contacts = NULL; if (param->id) @@ -589,7 +589,7 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP break; case CLN_LISTREBUILT: - if (param) + if (param) { wchar_t *contacts = NULL; if (param->id) @@ -602,7 +602,7 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP } param->ppro->ChatPrepare(NULL, nmc->hdr.hwndFrom, contacts); } - break; + break; } } } @@ -610,7 +610,7 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP case WM_COMMAND: { - switch (LOWORD(wParam)) + switch (LOWORD(wParam)) { case IDC_ADDSCR: if (param->ppro->IsOnline()) @@ -624,10 +624,10 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP cii.pszText = ::wcslwr(sid); HANDLE hItem = (HANDLE)::SendDlgItemMessage( - hwndDlg, - IDC_CCLIST, - CLM_ADDINFOITEM, - 0, + hwndDlg, + IDC_CCLIST, + CLM_ADDINFOITEM, + 0, (LPARAM)&cii); ::SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_SETCHECKMARK, (LPARAM)hItem, 1); } -- cgit v1.2.3