From dc0661ecf229f34b766a90a0a989fff0290878ab Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 10 Jan 2015 14:35:33 +0000 Subject: SkypeClassic: - Fixed bug from r11805 - workaround for LPGEN git-svn-id: http://svn.miranda-ng.org/main/trunk@11818 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeClassic/src/gchat.cpp | 7 +++--- protocols/SkypeClassic/src/skype.cpp | 16 ++++++++------ protocols/SkypeClassic/src/skypeapi.cpp | 38 ++++++++++++++------------------- protocols/SkypeClassic/src/skypeopt.cpp | 35 +++++++++++------------------- 4 files changed, 40 insertions(+), 56 deletions(-) (limited to 'protocols/SkypeClassic') diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp index c89f79b4e2..e40b417331 100644 --- a/protocols/SkypeClassic/src/gchat.cpp +++ b/protocols/SkypeClassic/src/gchat.cpp @@ -150,10 +150,9 @@ static int AddChatContact(gchat_contacts *gc, char *who, TCHAR *pszRole) } void RemChatContact(gchat_contacts *gc, const TCHAR *who) { - int i; - - if (!gc) return; - for (i=0;imJoinedCount;i++) + if (!gc) + return; + for (int i=0;imJoinedCount;i++) if (_tcscmp(gc->mJoinedContacts[i].who, who)==0) { if (i<--gc->mJoinedCount) memmove(&gc->mJoinedContacts[i], &gc->mJoinedContacts[i+1], (gc->mJoinedCount-i)*sizeof(gchat_contact)); diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 746e51ad9a..4eafe65e8c 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -679,9 +679,9 @@ void __cdecl SkypeSystemInit(char *dummy) { { int oldstatus; char szError[256]; - sprintf(szError, Translate("Username '%s' provided by Skype API doesn't match username '%s' in " - "your settings. Please either remove username setting in you configuration or correct " - "it. Will not connect!"), pszUser, dbv.pszVal); + sprintf(szError, + Translate("Username '%s' provided by Skype API doesn't match username '%s' in your settings. Please either remove username setting in your configuration or correct it. Will not connect!"), + pszUser, dbv.pszVal); OUTPUTA(szError); Initializing = FALSE; AttachStatus = -1; @@ -2700,7 +2700,6 @@ void MessageSendWatchThread(void *a) { INT_PTR SkypeSendMessage(WPARAM, LPARAM lParam) { CCSDATA *ccs = (CCSDATA *)lParam; DBVARIANT dbv; - BOOL sendok = TRUE; char *msg = (char *)ccs->lParam, *utfmsg = NULL, *mymsgcmd = cmdMessage, szId[16] = { 0 }; static DWORD dwMsgNum = 0; BYTE bIsChatroom = 0 != db_get_b(ccs->hContact, SKYPE_PROTONAME, "ChatRoom", 0); @@ -2732,7 +2731,9 @@ INT_PTR SkypeSendMessage(WPARAM, LPARAM lParam) { sprintf(szId, "#M%d ", dwMsgNum++); } InterlockedIncrement(&sendwatchers); - if (!utfmsg || SkypeSend("%s%s %s %s", szId, mymsgcmd, dbv.pszVal, utfmsg)) sendok = FALSE; + BOOL sendok = true; + if (!utfmsg || SkypeSend("%s%s %s %s", szId, mymsgcmd, dbv.pszVal, utfmsg)) + sendok = false; if (utfmsg && utfmsg != msg) free(utfmsg); db_free(&dbv); @@ -2749,11 +2750,12 @@ INT_PTR SkypeSendMessage(WPARAM, LPARAM lParam) { pthread_create(MessageSendWatchThread, psendarg); return 1; } - InterlockedDecrement(&sendwatchers); } + InterlockedDecrement(&sendwatchers); return 1; } - else InterlockedDecrement(&sendwatchers); + else + InterlockedDecrement(&sendwatchers); if (!bIsChatroom) ProtoBroadcastAck(SKYPE_PROTONAME, ccs->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)Translate("Connection to Skype lost")); return 0; diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index 0f67db8ee4..d4cb34cb95 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -318,13 +318,11 @@ int SkypeMsgAdd(char *msg) { * Purpose: Clean up the whole MESSagequeue - free() all */ void SkypeMsgCleanup(void) { - int i; - LOG(("SkypeMsgCleanup Cleaning up message queue..")); if (receivers>1) { LOG (("SkypeMsgCleanup Releasing %d receivers", receivers)); - for (i=0;i'9')) if (p[i]) { memmove(p+i, p+i+1, strlen(p+i)); @@ -858,12 +854,11 @@ static INT_PTR CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR db_unset(hContact, "CList", "Hidden"); db_set_w(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda("SKYPEOUT")); if (SendDlgItemMessage(hwndDlg,IDC_NUMBER,CB_FINDSTRING,0,(LPARAM)number)==CB_ERR) { - int i; char buf[64]; DBVARIANT dbv; if (entries>MAX_ENTRIES) entries=MAX_ENTRIES; - for (i=entries;i>0;i--) { + for (int i=entries;i>0;i--) { sprintf(buf, "LastNumber%d", i-1); if (!db_get_s(NULL, SKYPE_PROTONAME, buf, &dbv)) { sprintf(buf, "LastNumber%d", i); @@ -1331,11 +1326,11 @@ void SkypeFlush(void) { * 0 - Nothing found */ int SkypeStatusToMiranda(char *s) { - int i; - if (!strcmp("SKYPEOUT", s)) return db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE); - for(i=0; status_codes[i].szStat; i++) + if (!strcmp("SKYPEOUT", s)) + return db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE); + for(int i=0; status_codes[i].szStat; i++) if (!strcmp(status_codes[i].szStat, s)) - return status_codes[i].id; + return status_codes[i].id; return 0; } @@ -1347,7 +1342,6 @@ int SkypeStatusToMiranda(char *s) { * NULL - Nothing found */ char *MirandaStatusToSkype(int id) { - int i; if (db_get_b(NULL, SKYPE_PROTONAME, "NoSkype3Stats", 0)) { switch (id) { @@ -1355,7 +1349,7 @@ char *MirandaStatusToSkype(int id) { case ID_STATUS_FREECHAT: return "ONLINE"; } } - for(i=0; status_codes[i].szStat; i++) + for(int i=0; status_codes[i].szStat; i++) if (status_codes[i].id==id) return status_codes[i].szStat; return NULL; @@ -1378,14 +1372,14 @@ char *GetSkypeErrorMsg(char *str) { } if ((pos=strstr(str, "FAILURE")) ) { switch(atoi(pos+14)) { - case MISC_ERROR: msg="Misc. Error"; break; - case USER_NOT_FOUND: msg="User does not exist, check username"; break; - case USER_NOT_ONLINE: msg="Trying to send IM to an user, who is not online"; break; - case USER_BLOCKED: msg="IM blocked by recipient"; break; - case TYPE_UNSUPPORTED: msg="Type unsupported"; break; - case SENDER_NOT_FRIEND: msg="Sending IM message to user, who has not added you to friendslist and has chosen 'only people in my friendslist can start IM'"; break; - case SENDER_NOT_AUTHORIZED: msg="Sending IM message to user, who has not authorized you and has chosen 'only people whom I have authorized can start IM'"; break; - default: msg="Unknown error"; + case MISC_ERROR: msg=Translate("Misc. Error"); break; + case USER_NOT_FOUND: msg=Translate("User does not exist, check username"); break; + case USER_NOT_ONLINE: msg=Translate("Trying to send IM to an user, who is not online"); break; + case USER_BLOCKED: msg=Translate("IM blocked by recipient"); break; + case TYPE_UNSUPPORTED: msg=Translate("Type unsupported"); break; + case SENDER_NOT_FRIEND: msg=Translate("Sending IM message to user, who has not added you to friendslist and has chosen 'only people in my friendslist can start IM'"); break; + case SENDER_NOT_AUTHORIZED: msg=Translate("Sending IM message to user, who has not authorized you and has chosen 'only people whom I have authorized can start IM'"); break; + default: msg=Translate("Unknown error"); } reason=(char *)malloc(strlen(pos)+strlen(msg)+3); sprintf (reason, "%s: %s", pos, msg); diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp index 48f1908505..b11ce2a64a 100644 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ b/protocols/SkypeClassic/src/skypeopt.cpp @@ -365,7 +365,6 @@ INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA const int Skype2SocketControls[]={ IDC_STATIC_HOST, IDC_HOST, IDC_STATIC_PORT, IDC_PORT, IDC_REQPASS, IDC_PASSWORD, IDC_STATIC_RESTART }; static BOOL initDlg=FALSE; DBVARIANT dbv; - int i; switch (uMsg){ case WM_INITDIALOG: @@ -411,7 +410,7 @@ INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_USES2S: - for (i=0; i < SIZEOF(Skype2SocketControls); i++) + for (int i=0; i < SIZEOF(Skype2SocketControls); i++) EnableWindow(GetDlgItem(hwndDlg, Skype2SocketControls[i]), IsDlgButtonChecked(hwndDlg, LOWORD(wParam))); if (IsDlgButtonChecked(hwndDlg, LOWORD(wParam))) SendMessage(hwndDlg, WM_COMMAND, IDC_REQPASS, 0); @@ -430,10 +429,9 @@ INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA INT_PTR CALLBACK OptionsAdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static BOOL initDlg=FALSE; static int statusModes[]={ID_STATUS_OFFLINE,ID_STATUS_ONLINE,ID_STATUS_AWAY,ID_STATUS_NA,ID_STATUS_OCCUPIED,ID_STATUS_DND,ID_STATUS_FREECHAT,ID_STATUS_INVISIBLE,ID_STATUS_OUTTOLUNCH,ID_STATUS_ONTHEPHONE}; - int i, j; switch (uMsg){ - case WM_INITDIALOG: + case WM_INITDIALOG: { initDlg=TRUE; TranslateDialogDefault(hwndDlg); @@ -463,17 +461,15 @@ INT_PTR CALLBACK OptionsAdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, #endif EnableWindow(GetDlgItem(hwndDlg, IDC_USEPOPUP), FALSE); - j=db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE); - for(i=0;i