diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-10 14:35:33 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-10 14:35:33 +0000 |
commit | dc0661ecf229f34b766a90a0a989fff0290878ab (patch) | |
tree | 556339afc7e00908195882357c640920018db95d /protocols/SkypeClassic/src | |
parent | 5ebc752cd3731e2de4140eff3e6fca0e5d82fcf4 (diff) |
SkypeClassic:
- Fixed bug from r11805
- workaround for LPGEN
git-svn-id: http://svn.miranda-ng.org/main/trunk@11818 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeClassic/src')
-rw-r--r-- | protocols/SkypeClassic/src/gchat.cpp | 7 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.cpp | 16 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skypeapi.cpp | 38 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skypeopt.cpp | 35 |
4 files changed, 40 insertions, 56 deletions
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;i<gc->mJoinedCount;i++) + if (!gc) + return; + for (int i=0;i<gc->mJoinedCount;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<receivers; i++)
+ for (int i=0;i<receivers; i++)
{
SkypeMsgAdd ("ERROR Semaphore was blocked");
}
@@ -773,9 +771,7 @@ INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam) * Params : p - Pointer to the buffer with the number
*/
static void FixNumber(char *p) {
- unsigned int i;
-
- for (i=0;i<=strlen(p);i++)
+ for (unsigned int i=0;i<=strlen(p);i++)
if ((p[i]<'0' || p[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<sizeof(statusModes)/sizeof(statusModes[0]);i++) {
- int k;
-
- k=SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_ADDSTRING,0,(LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,statusModes[i],GSMDF_TCHAR));
+ int j=db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE);
+ for(int i=0;i<sizeof(statusModes)/sizeof(statusModes[0]);i++) {
+ int k=SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_ADDSTRING,0,(LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,statusModes[i],GSMDF_TCHAR));
SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_SETITEMDATA,k,statusModes[i]);
if (statusModes[i]==j) SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_SETCURSEL,i,0);
}
initDlg=FALSE;
return TRUE;
-
+ }
case WM_NOTIFY: {
NMHDR* nmhdr = (NMHDR*)lParam;
@@ -517,13 +513,9 @@ static int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM, LPARAM lpDa case BFFM_INITIALIZED:
{
// Set initial directory.
-#ifdef UNICODE
wchar_t* wszInitFolder = make_unicode_string((const unsigned char*)lpData);
SendMessage(hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)wszInitFolder);
free(wszInitFolder);
-#else
- SendMessage(hWnd, BFFM_SETSELECTION, TRUE, lpData);
-#endif
break;
}
}
@@ -538,13 +530,11 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case WM_INITDIALOG:
{
DBVARIANT dbv;
- BOOL startSkype;
- int i;
initDlg = TRUE;
TranslateDialogDefault(hwndDlg);
- startSkype = db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1);
+ BOOL startSkype = db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1);
CheckDlgButton(hwndDlg, IDC_STARTSKYPE, startSkype ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOSPLASH, db_get_b(NULL, SKYPE_PROTONAME, "nosplash", 1) ? BST_CHECKED : BST_UNCHECKED);
@@ -571,7 +561,7 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L db_free(&dbv);
}
- for(i=0; i < SIZEOF(skypeLaunchControls); i++)
+ for(int i=0; i < SIZEOF(skypeLaunchControls); i++)
EnableWindow(GetDlgItem(hwndDlg, skypeLaunchControls[i]), startSkype);
EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSECMDL), startSkype && IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND));
@@ -648,12 +638,10 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L }
case WM_COMMAND: {
switch (LOWORD(wParam)) {
- BOOL startSkype;
- int i;
- case IDC_STARTSKYPE:
- startSkype = IsDlgButtonChecked(hwndDlg, IDC_STARTSKYPE);
+ case IDC_STARTSKYPE: {
+ BOOL startSkype = IsDlgButtonChecked(hwndDlg, IDC_STARTSKYPE);
- for (i = 0; i < SIZEOF(skypeLaunchControls); i ++)
+ for (int i = 0; i < SIZEOF(skypeLaunchControls); i ++)
EnableWindow(GetDlgItem(hwndDlg, skypeLaunchControls[i]), startSkype);
EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSECMDL), startSkype && IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND));
@@ -661,6 +649,7 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSEDP), startSkype && IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO));
EnableWindow(GetDlgItem(hwndDlg, IDC_DATAPATH), startSkype && IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO));
+ }
break;
case IDC_CLEANUP:
pthread_create(( pThreadFunc )CleanupNicknames, NULL);
|