diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-10-08 08:55:53 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-10-08 08:55:53 +0000 |
commit | 0d11f71e3bb30c9760f7fc8b027897047530b136 (patch) | |
tree | f65324ac5278878e1bad871dd083b1c972590c38 /protocols/SkypeClassic | |
parent | a134f7e823d5d334bfee65652534c206569e0b3e (diff) |
SkypeClassic: Sync from leecher's repo (r1963)
- Fixed a severe bug that prevented the correct auth user to be read preventing every authentication accept.
- Fixed a crash in Groupchat when only 2 users were left and user parted the groupchat
- Added feature for blocking contacts
git-svn-id: http://svn.miranda-ng.org/main/trunk@10744 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeClassic')
-rw-r--r-- | protocols/SkypeClassic/res/Resource.rc | 1 | ||||
-rw-r--r-- | protocols/SkypeClassic/res/blockcon.ico | bin | 0 -> 318 bytes | |||
-rw-r--r-- | protocols/SkypeClassic/src/contacts.cpp | 23 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/gchat.cpp | 12 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/resource.h | 3 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.cpp | 69 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.h | 2 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skypeapi.cpp | 20 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skypeapi.h | 1 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skypesvc.cpp | 5 |
10 files changed, 96 insertions, 40 deletions
diff --git a/protocols/SkypeClassic/res/Resource.rc b/protocols/SkypeClassic/res/Resource.rc index fcf58a3055..7bfd83e121 100644 --- a/protocols/SkypeClassic/res/Resource.rc +++ b/protocols/SkypeClassic/res/Resource.rc @@ -376,6 +376,7 @@ IDI_DND ICON DISCARDABLE "dnd.ico" IDI_INVISIBLE ICON DISCARDABLE "invisible.ico"
IDI_OFFLINE ICON DISCARDABLE "offline.ico"
IDI_PHONE ICON DISCARDABLE "phone.ico"
+IDI_BLOCKCONTACT ICON DISCARDABLE "blockcon.ico"
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/SkypeClassic/res/blockcon.ico b/protocols/SkypeClassic/res/blockcon.ico Binary files differnew file mode 100644 index 0000000000..c371be9473 --- /dev/null +++ b/protocols/SkypeClassic/res/blockcon.ico diff --git a/protocols/SkypeClassic/src/contacts.cpp b/protocols/SkypeClassic/src/contacts.cpp index 92b07eaab2..3c986d3826 100644 --- a/protocols/SkypeClassic/src/contacts.cpp +++ b/protocols/SkypeClassic/src/contacts.cpp @@ -21,7 +21,7 @@ extern BOOL bSkypeOut, bIsImoproxy; extern char protocol, g_szProtoName[];
// Handles
-static HANDLE hMenuCallItem, hMenuCallHangup, hMenuSkypeOutCallItem, hMenuHoldCallItem, hMenuFileTransferItem, hMenuChatInitItem;
+static HANDLE hMenuCallItem, hMenuCallHangup, hMenuSkypeOutCallItem, hMenuHoldCallItem, hMenuFileTransferItem, hMenuChatInitItem, hMenuBlockContactItem;
// Check if alpha blending icons are supported
// Seems to be not neccessary
@@ -150,6 +150,19 @@ CLISTMENUITEM ChatInitItem(void) { return mi;
}
+CLISTMENUITEM BlockContactItem(void) {
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ mi.position = -2000005000;
+ mi.flags = CMIF_HIDDEN | CMIF_TCHAR;
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_BLOCKCONTACT));
+ mi.ptszName = LPGENT("Block contact");
+ mi.pszContactOwner = SKYPE_PROTONAME;
+ mi.pszService = SKYPE_BLOCKCONTACT;
+ return mi;
+}
+
HANDLE add_contextmenu(MCONTACT hContact) {
CLISTMENUITEM mi;
@@ -174,6 +187,8 @@ HANDLE add_contextmenu(MCONTACT hContact) { mi = ChatInitItem();
hMenuChatInitItem = Menu_AddContactMenuItem(&mi);
+ mi = BlockContactItem();
+ hMenuBlockContactItem = Menu_AddContactMenuItem(&mi);
ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi);
@@ -264,6 +279,12 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { mi.flags ^= CMIF_HIDDEN;
mi.flags |= CMIM_FLAGS;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuChatInitItem, (LPARAM)&mi);
+ mi = BlockContactItem();
+ mi.flags ^= CMIF_HIDDEN;
+ mi.flags |= CMIM_FLAGS | CMIM_NAME;
+ if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "IsBlocked", 0) == 1)
+ mi.ptszName = LPGENT("Unblock contact");
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuBlockContactItem, (LPARAM)&mi);
}
}
diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp index cefd1c891f..da5615dd5d 100644 --- a/protocols/SkypeClassic/src/gchat.cpp +++ b/protocols/SkypeClassic/src/gchat.cpp @@ -234,6 +234,10 @@ int __cdecl AddMembers(char *szSkypeMsg) { if (protocol>=7 && (pszMemObjs = SkypeGet ("CHAT", szSkypeMsg+5, "MEMBEROBJECTS"))) {
// Add new contacts (protocol 7+ with memberobjects, supports roles)
for (token=strtok_r(pszMemObjs, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) {
+ if (!contactmask && !(contactmask = (unsigned char*)calloc(gc->mJoinedCount, 1))) {
+ iRet = -1;
+ break;
+ }
if (!(who = SkypeGet ("CHATMEMBER", token, "IDENTITY"))) continue;
if (strcmp(who, dbv2.pszVal)) {
char *pszRole;
@@ -245,7 +249,6 @@ int __cdecl AddMembers(char *szSkypeMsg) { i=AddChatContact(gc, who, ptszRole);
free_nonutf_tchar_string (ptszRole);
if (pszRole) free (pszRole);
- if (i>=0 && !contactmask && !(contactmask = (unsigned char*)calloc(gc->mJoinedCount, 1))) i=-2;
if (!(contactmask= (unsigned char *) realloc(contactmask, gc->mJoinedCount))) {
iRet = -1;
free (who);
@@ -261,9 +264,12 @@ int __cdecl AddMembers(char *szSkypeMsg) { {
// Add new contacts (normal)
for (who=strtok_r(ptr, " ", &nextoken); who; who=strtok_r(NULL, " ", &nextoken)) {
+ if (!contactmask && !(contactmask = (unsigned char*)calloc(gc->mJoinedCount, 1))) {
+ iRet = -1;
+ break;
+ }
if (strcmp(who, dbv2.pszVal)) {
i=AddChatContact(gc, who, NULL);
- if (i>=0 && !contactmask && !(contactmask = (unsigned char*)calloc(gc->mJoinedCount, 1))) i=-2;
if (i<0 || !(contactmask= (unsigned char *) realloc(contactmask, gc->mJoinedCount))) {
iRet = -1;
break;
@@ -290,13 +296,13 @@ int __cdecl AddMembers(char *szSkypeMsg) { ci.dwFlag = CNF_TCHAR;
if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
else gce.ptszNick=gc->mJoinedContacts[i].who;
- RemChatContact(gc, gc->mJoinedContacts[i].who);
gce.ptszUID = gc->mJoinedContacts[i].who;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
if (ci.pszVal) {
mir_free (ci.pszVal);
ci.pszVal=NULL;
}
+ RemChatContact(gc, gc->mJoinedContacts[i].who);
}
// We don't do this, because the dialog group-chat may have been started intentionally
/*
diff --git a/protocols/SkypeClassic/src/resource.h b/protocols/SkypeClassic/src/resource.h index 5f57feb9a3..427289efde 100644 --- a/protocols/SkypeClassic/src/resource.h +++ b/protocols/SkypeClassic/src/resource.h @@ -33,6 +33,7 @@ #define IDD_SETDETAILS 177
#define IDD_OPT_ADVANCED 178
#define IDD_OPT_POPUP 179
+#define IDI_BLOCKCONTACT 182
#define IDI_PHONE 1002
#define IDC_SHUTDOWN 1004
#define IDC_ENABLEMENU 1005
@@ -116,7 +117,7 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 181
+#define _APS_NEXT_RESOURCE_VALUE 183
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1072
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 8f5b22805d..eee5dffa4a 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -1993,39 +1993,42 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) LOG(("WndProc: Deleting the TimeZone in UserInfo Section"));
db_unset(hContact, "UserInfo", "Timezone");
}
- }
- else
- if (!strcmp(ptr, "IS_VIDEO_CAPABLE")){
- if (!_stricmp(ptr + 17, "True"))
- db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype 2.0");
- else
- db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype");
- }
+ } else
+ if (!strcmp(ptr, "IS_VIDEO_CAPABLE")){
+ if (!_stricmp(ptr + 17, "True"))
+ db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype 2.0");
else
- if (!strcmp(ptr, "RICH_MOOD_TEXT")) {
- db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype 3.0");
+ db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype");
+ } else
+ if (!strcmp(ptr, "ISBLOCKED")){
+ if (!_stricmp(ptr + 10, "True"))
+ db_set_b(hContact, SKYPE_PROTONAME, "IsBlocked", 1);
+ else
+ db_unset(hContact, SKYPE_PROTONAME, "IsBlocked");
+ } else
+ if (!strcmp(ptr, "RICH_MOOD_TEXT")) {
+ db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype 3.0");
+ } else
+ if (!strcmp(ptr, "DISPLAYNAME")) {
+ // Skype Bug? -> If nickname isn't customised in the Skype-App, this won't return anything :-(
+ if (ptr[12])
+ db_set_utf(hContact, SKYPE_PROTONAME, "Nick", ptr + 12);
+ }
+ else // Other proerties that can be directly assigned to a DB-Value
+ {
+ int i;
+ char *pszProp;
+
+ for (i = 0; i < sizeof(m_settings) / sizeof(m_settings[0]); i++) {
+ if (!strcmp(ptr, m_settings[i].SkypeSetting)) {
+ pszProp = ptr + strlen(m_settings[i].SkypeSetting) + 1;
+ if (*pszProp)
+ db_set_utf(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting, pszProp);
+ else
+ db_unset(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting);
}
- else
- if (!strcmp(ptr, "DISPLAYNAME")) {
- // Skype Bug? -> If nickname isn't customised in the Skype-App, this won't return anything :-(
- if (ptr[12])
- db_set_utf(hContact, SKYPE_PROTONAME, "Nick", ptr + 12);
- }
- else // Other proerties that can be directly assigned to a DB-Value
- {
- int i;
- char *pszProp;
-
- for (i = 0; i < sizeof(m_settings) / sizeof(m_settings[0]); i++) {
- if (!strcmp(ptr, m_settings[i].SkypeSetting)) {
- pszProp = ptr + strlen(m_settings[i].SkypeSetting) + 1;
- if (*pszProp)
- db_set_utf(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting, pszProp);
- else
- db_unset(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting);
- }
- }
- }
+ }
+ }
}
else { // BUDDYSTATUS:
flag = 0;
@@ -2835,7 +2838,7 @@ char *__skypeauth(WPARAM wParam) { if (!SkypeInitialized) return NULL;
dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = db_event_getBlobSize((HANDLE)wParam) == -1 ||
+ if (((dbei.cbBlob = db_event_getBlobSize((HANDLE)wParam)) == -1 ||
!(dbei.pBlob = (unsigned char*)malloc(dbei.cbBlob))))
{
return NULL;
@@ -3286,7 +3289,7 @@ extern "C" int __declspec(dllexport) Unload(void) LOG(("Unload started"));
- if (Shutdown && ((skype_path && skype_path[0]) || UseCustomCommand)) {
+ if (Shutdown && (skype_path[0] || UseCustomCommand)) {
if (UseCustomCommand)
{
diff --git a/protocols/SkypeClassic/src/skype.h b/protocols/SkypeClassic/src/skype.h index f6821b0063..7e066ddf1a 100644 --- a/protocols/SkypeClassic/src/skype.h +++ b/protocols/SkypeClassic/src/skype.h @@ -96,6 +96,7 @@ typedef struct { char SkypeOutCallUser[MAXMODULELABELLENGTH];
char CallHangupUser[MAXMODULELABELLENGTH];
char CallUser[MAXMODULELABELLENGTH];
+ char BlockContact[MAXMODULELABELLENGTH];
} SKYPE_SVCNAMES;
#define SKYPE_CALL g_svcNames.CallUser
#define SKYPE_CALLHANGUP g_svcNames.CallHangupUser
@@ -107,6 +108,7 @@ typedef struct { #define SKYPE_SENDFILE g_svcNames.SendFile
#define SKYPE_SETAVATAR g_svcNames.SetAvatar
#define SKYPE_CHATNEW g_svcNames.ChatNew
+#define SKYPE_BLOCKCONTACT g_svcNames.BlockContact
#define EVENTTYPE_CALL 2000
#define WM_COPYDATALOCAL WM_USER+100 // WM_COPYDATA for local window communication, needed due to Win98 bug
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index b5bd939172..09a5fdb6bc 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -745,7 +745,7 @@ static INT_PTR CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR if (!strncmp(number, "00", 2)) {
memmove(number, number+1, sizeof(number)-1);
number[0]='+';
- number[sizeof(number)]=0;
+ number[sizeof(number)-1] = 0;
}
if (!hContact) {
if (!(hContact=add_contact(number, PALF_TEMPORARY))) {
@@ -1183,6 +1183,24 @@ INT_PTR SkypeChatCreate(WPARAM wParam, LPARAM lParam) { return 0;
}
+/* SkypeBlockContact
+*
+* Purpose: Blocks/unblocks contact
+*/
+INT_PTR SkypeBlockContact(WPARAM wParam, LPARAM lParam) {
+ DBVARIANT dbv;
+ MCONTACT hContact = (MCONTACT)wParam;
+ int iRet = 0;
+
+ if (!hContact || db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
+ return -1;
+
+ if (SkypeSend("SET USER %s ISBLOCKED %s", dbv.pszVal, db_get_b(hContact, SKYPE_PROTONAME, "IsBlocked", 0) ? "FALSE" : "TRUE"))
+ iRet = -1;
+ db_free(&dbv);
+ return iRet;
+}
+
/* SkypeAdduserDlg
*
* Purpose: Show Skype's Add user Dialog
diff --git a/protocols/SkypeClassic/src/skypeapi.h b/protocols/SkypeClassic/src/skypeapi.h index aaff523921..3d1c00eb01 100644 --- a/protocols/SkypeClassic/src/skypeapi.h +++ b/protocols/SkypeClassic/src/skypeapi.h @@ -45,6 +45,7 @@ INT_PTR SkypeAdduserDlg(WPARAM wParam, LPARAM lParam); INT_PTR SkypeAnswerCall(WPARAM wParam, LPARAM lParam);
int SkypeMsgCollectGarbage(time_t age);
INT_PTR SkypeSendFile(WPARAM wParam, LPARAM lParam);
+INT_PTR SkypeBlockContact(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetAwayMessageW(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/SkypeClassic/src/skypesvc.cpp b/protocols/SkypeClassic/src/skypesvc.cpp index 11ad13d1fe..f8ad3aa44f 100644 --- a/protocols/SkypeClassic/src/skypesvc.cpp +++ b/protocols/SkypeClassic/src/skypesvc.cpp @@ -35,6 +35,7 @@ void CreateServices(void) CreateServiceName(SkypeOutCallUser);
CreateServiceName(CallHangupUser);
CreateServiceName(CallUser);
+ CreateServiceName(BlockContact);
CreateServiceFunction(SKYPE_CALL, SkypeCall);
CreateServiceFunction(SKYPE_CALLHANGUP, SkypeCallHangup);
@@ -45,6 +46,7 @@ void CreateServices(void) CreateServiceFunction(SKYPE_ANSWERCALL, SkypeAnswerCall);
CreateServiceFunction(SKYPE_SENDFILE, SkypeSendFile);
CreateServiceFunction(SKYPE_SETAVATAR, SkypeSetAvatar);
+ CreateServiceFunction(SKYPE_BLOCKCONTACT, SkypeBlockContact);
CreateProtoService(PS_GETCAPS, SkypeGetCaps);
CreateProtoService(PS_GETNAME, SkypeGetName);
@@ -54,6 +56,7 @@ void CreateServices(void) CreateProtoService(PS_ADDTOLIST, SkypeAddToList);
CreateProtoService(PS_ADDTOLISTBYEVENT, SkypeAddToListByEvent);
CreateProtoService(PS_BASICSEARCH, SkypeBasicSearch);
+ CreateProtoService(PS_SEARCHBYEMAIL, SkypeBasicSearch);
CreateProtoService(PSS_GETINFO, SkypeGetInfo);
CreateProtoService(PSS_MESSAGE, SkypeSendMessage);
@@ -106,7 +109,7 @@ INT_PTR SkypeGetCaps(WPARAM wParam, LPARAM lParam) switch (wParam) {
case PFLAGNUM_1:
- ret = PF1_BASICSEARCH | PF1_IM | PF1_MODEMSG; // | PF1_AUTHREQ;
+ ret = PF1_BASICSEARCH | PF1_IM | PF1_MODEMSG | PF1_SEARCHBYEMAIL; // | PF1_AUTHREQ;
if (protocol>=5) ret |= PF1_ADDSEARCHRES;
break;
|