From 60a33e845999d81bb9325ad5fa7ed2bd01c99704 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 18 Nov 2014 19:08:03 +0000 Subject: SkypeClassic -Minor cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@11015 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeClassic/src/contacts.cpp | 3 +-- protocols/SkypeClassic/src/gchat.cpp | 32 +++++++++++++++++--------------- protocols/SkypeClassic/src/skype.cpp | 15 +++++++-------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/protocols/SkypeClassic/src/contacts.cpp b/protocols/SkypeClassic/src/contacts.cpp index 6950d91f54..7a24ed7f70 100644 --- a/protocols/SkypeClassic/src/contacts.cpp +++ b/protocols/SkypeClassic/src/contacts.cpp @@ -214,8 +214,7 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM) { return 0; // Clear hold-Item in case it exists - CLISTMENUITEM mi; - mi = HoldCallItem(); + CLISTMENUITEM mi = HoldCallItem(); mi.flags |= CMIM_ALL; Menu_ModifyItem(hMenuHoldCallItem, &mi); diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp index 5b357768a3..444256b582 100644 --- a/protocols/SkypeClassic/src/gchat.cpp +++ b/protocols/SkypeClassic/src/gchat.cpp @@ -170,11 +170,12 @@ MCONTACT find_chat(LPCTSTR chatname) { if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1) { DBVARIANT dbv; - if (db_get_ts(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) continue; - int tCompareResult = _tcscmp(dbv.ptszVal, chatname); - db_free(&dbv); - if (!tCompareResult) - return hContact; // already there, return handle + if (!db_get_ts(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) { + int tCompareResult = _tcscmp(dbv.ptszVal, chatname); + db_free(&dbv); + if (!tCompareResult) + return hContact; // already there, return handle + } } } return NULL; @@ -205,15 +206,16 @@ int __cdecl AddMembers(char *szSkypeMsg) { DBVARIANT dbv2; CONTACTINFO ci={0}; char *ptr, *who, *nextoken; - TCHAR *szChatId; int i, iRet = 0; gchat_contacts *gc; - LOG(("AddMembers STARTED")); - if (!(ptr=strstr(szSkypeMsg, " MEMBERS"))) return -1; + LOG(("AddMembers STARTED")); + char *ptr=strstr(szSkypeMsg, " MEMBERS"); + if (!ptr) + return -1; EnterCriticalSection(&m_GCMutex); ptr[0]=0; - szChatId = make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5); + TCHAR *szChatId = make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5); ptr+=9; if (find_chat(szChatId) && (gc=GetChat(szChatId)) && !db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv2)) @@ -312,8 +314,8 @@ int __cdecl AddMembers(char *szSkypeMsg) { void AddMembersThread(char *szSkypeMsg) { - AddMembers (szSkypeMsg); - free (szSkypeMsg); + AddMembers(szSkypeMsg); + free(szSkypeMsg); } /****************************************************************************/ @@ -359,17 +361,17 @@ INT_PTR CALLBACK InputBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l int __cdecl ChatInit(WPARAM wParam, LPARAM lParam) { + if (!wParam) return -1; + DBVARIANT dbv, dbv2; - char *szChatName; int iRet = -1; - if (!wParam) return -1; - GCSESSION gcw = { sizeof(gcw) }; gcw.iType = GCW_CHATROOM; gcw.pszModule = SKYPE_PROTONAME; - if (!(szChatName = SkypeGet ("CHAT", (char *)wParam, "FRIENDLYNAME")) || !*szChatName) + char *szChatName = SkypeGet ("CHAT", (char *)wParam, "FRIENDLYNAME"); + if (!szChatName || !*szChatName) gcw.ptszName=TranslateT("Unknown"); else { #ifdef _UNICODE gcw.ptszName=make_unicode_string((const unsigned char*)szChatName); diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index c25018c621..76cb2801dc 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -1563,6 +1563,7 @@ void RingThread(char *szSkypeMsg) { dbei.flags = DBEF_READ; cle.hContact = hContact; cle.hDbEvent = db_event_add(hContact, &dbei); + cle.flags = CLEF_TCHAR; TCHAR toolTip[256]; mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Incoming call from %s"), lpzContactName); cle.ptszTooltip = toolTip; @@ -1585,7 +1586,6 @@ void EndCallThread(char *szSkypeMsg) { HANDLE hDbEvent; DBEVENTINFO dbei = { 0 }; DBVARIANT dbv; - int tCompareResult; // We use a single critical section for the RingThread- and the EndCallThread-functions // so that only one function is running at the same time. This is needed, because when @@ -1605,9 +1605,10 @@ void EndCallThread(char *szSkypeMsg) { if (szSkypeMsg) { for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { if (db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) continue; - tCompareResult = strcmp(dbv.pszVal, szSkypeMsg); + int tCompareResult = strcmp(dbv.pszVal, szSkypeMsg); db_free(&dbv); - if (tCompareResult) continue; else break; + if (!tCompareResult) + break; } } if (hContact) @@ -2386,8 +2387,6 @@ void RetrieveUserAvatar(void *param) if (hContact == NULL) return; - HANDLE file; - DBVARIANT dbv; char AvatarFile[MAX_PATH + 1], AvatarTmpFile[MAX_PATH + 10], *pszTempFile; // Mount default ack @@ -2403,6 +2402,7 @@ void RetrieveUserAvatar(void *param) AI.hContact = hContact; // Get skype name + DBVARIANT dbv; if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) { if (dbv.pszVal) @@ -2416,7 +2416,7 @@ void RetrieveUserAvatar(void *param) // Just to be sure DeleteFileA(pszTempFile); - file = CreateFileA(pszTempFile, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFileA(pszTempFile, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (file != INVALID_HANDLE_VALUE) { CloseHandle(file); @@ -2581,9 +2581,8 @@ INT_PTR SkypeGetInfo(WPARAM, LPARAM lParam) { } INT_PTR SkypeAddToList(WPARAM wParam, LPARAM lParam) { - PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam; - LOG(("SkypeAddToList Adding API function called")); + PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam; if (psr->cbSize != sizeof(PROTOSEARCHRESULT) || !psr->nick) return 0; LOG(("SkypeAddToList OK")); return (INT_PTR)add_contact(_T2A(psr->nick), (DWORD)wParam); -- cgit v1.2.3