summaryrefslogtreecommitdiff
path: root/protocols/SkypeClassic
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-08-14 17:13:51 +0000
committerRobert Pösel <robyer@seznam.cz>2014-08-14 17:13:51 +0000
commite18bb0689bb3ff2bdd622b5feca554d7559ca8e8 (patch)
tree44d78a0f86cdd788f9f0073949bcc53d6463b711 /protocols/SkypeClassic
parent0a1ec91589a265b41210068b8d21fa469e750a08 (diff)
SkypeClassic: Complete revert to NG version
git-svn-id: http://svn.miranda-ng.org/main/trunk@10182 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeClassic')
-rw-r--r--protocols/SkypeClassic/res/Resource.rc10
-rw-r--r--protocols/SkypeClassic/src/contacts.cpp86
-rw-r--r--protocols/SkypeClassic/src/gchat.cpp126
-rw-r--r--protocols/SkypeClassic/src/gchat.h5
-rw-r--r--protocols/SkypeClassic/src/skype.cpp312
-rw-r--r--protocols/SkypeClassic/src/skype.h5
-rw-r--r--protocols/SkypeClassic/src/skypeapi.cpp6
-rw-r--r--protocols/SkypeClassic/src/skypeopt.cpp2
-rw-r--r--protocols/SkypeClassic/src/voiceservice.cpp169
-rw-r--r--protocols/SkypeClassic/src/voiceservice.h18
10 files changed, 188 insertions, 551 deletions
diff --git a/protocols/SkypeClassic/res/Resource.rc b/protocols/SkypeClassic/res/Resource.rc
index 6c2ab5f710..fcf58a3055 100644
--- a/protocols/SkypeClassic/res/Resource.rc
+++ b/protocols/SkypeClassic/res/Resource.rc
@@ -42,7 +42,7 @@ STYLE DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "Start Skype with Miranda if not running using the following command line options:",
+ CONTROL "Start Skype with Miranda NG if not running using the following command line options:",
IDC_STARTSKYPE,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,10,4,290,10
CONTROL "/NOSPLASH - Don't show splash screen on startup",
@@ -66,9 +66,9 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,36,103,264,10
EDITTEXT IDC_COMMANDLINE,47,116,236,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BROWSECMDL,285,115,16,15
- CTEXT "* Relative path root is Miranda folder",
+ CTEXT "* Relative path root is Miranda NG folder",
IDC_STATIC_PATHINFO,10,136,290,8,NOT WS_GROUP
- CONTROL "Shutdown Skype when you close Miranda",IDC_SHUTDOWN,
+ CONTROL "Shutdown Skype when you close Miranda NG",IDC_SHUTDOWN,
"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,151,
290,10
CONTROL "Unload Skype when you change to Offline status",
@@ -141,7 +141,7 @@ BEGIN
EDITTEXT IDC_HOST,41,19,133,12,ES_AUTOHSCROLL
LTEXT "Port:",IDC_STATIC_PORT,180,21,16,10,0,WS_EX_RIGHT
EDITTEXT IDC_PORT,200,19,29,12,ES_AUTOHSCROLL | ES_NUMBER
- CTEXT "* You must restart Miranda in order to let the settings take effect",
+ CTEXT "* You must restart Miranda NG in order to let the settings take effect",
IDC_STATIC_RESTART,10,54,290,8,NOT WS_GROUP
CONTROL "This Skype proxy requires password authentication:",
IDC_REQPASS,"Button",BS_AUTOCHECKBOX | WS_GROUP |
@@ -383,7 +383,7 @@ IDI_PHONE ICON DISCARDABLE "phone.ico"
// Bitmap
//
-IDB_CALL BITMAP MOVEABLE PURE "call.bmp"
+IDB_CALL BITMAP MOVEABLE PURE "res\\call.bmp"
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/SkypeClassic/src/contacts.cpp b/protocols/SkypeClassic/src/contacts.cpp
index 2bb2bb0898..92b07eaab2 100644
--- a/protocols/SkypeClassic/src/contacts.cpp
+++ b/protocols/SkypeClassic/src/contacts.cpp
@@ -7,7 +7,6 @@
#include "debug.h"
#include "pthread.h"
#include "gchat.h"
-#include "voiceservice.h"
#pragma warning (push)
#pragma warning (disable: 4100) // unreferenced formal parameter
@@ -156,20 +155,16 @@ HANDLE add_contextmenu(MCONTACT hContact) {
UNREFERENCED_PARAMETER(hContact);
- if (!HasVoiceService()) {
- mi = CallItem();
- hMenuCallItem = Menu_AddContactMenuItem(&mi);
- mi = HupItem();
- hMenuCallHangup = Menu_AddContactMenuItem(&mi);
- }
+ mi = CallItem();
+ hMenuCallItem = Menu_AddContactMenuItem(&mi);
+ mi = HupItem();
+ hMenuCallHangup = Menu_AddContactMenuItem(&mi);
mi = SkypeOutCallItem();
hMenuSkypeOutCallItem = Menu_AddContactMenuItem(&mi);
- if (!HasVoiceService()) {
- mi = HoldCallItem();
- hMenuHoldCallItem = Menu_AddContactMenuItem(&mi);
- }
+ mi = HoldCallItem();
+ hMenuHoldCallItem = Menu_AddContactMenuItem(&mi);
// We cannot use flag PF1_FILESEND for sending files, as Skype opens its own
// sendfile-Dialog.
@@ -216,42 +211,37 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
if (!(szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0))) return 0;
- if (!HasVoiceService())
- {
- // Clear hold-Item in case it exists
- mi = HoldCallItem();
- mi.flags |= CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem, (LPARAM)&mi);
- }
+ // Clear hold-Item in case it exists
+ mi = HoldCallItem();
+ mi.flags |= CMIM_ALL;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem, (LPARAM)&mi);
if (!strcmp(szProto, SKYPE_PROTONAME)) {
- if (!HasVoiceService()) {
- if (!db_get((MCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
- if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "OnHold", 0))
- mi = ResumeCallItem(); else mi = HoldCallItem();
- mi.flags = CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem, (LPARAM)&mi);
+ if (!db_get((MCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) {
+ if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "OnHold", 0))
+ mi = ResumeCallItem(); else mi = HoldCallItem();
+ mi.flags = CMIM_ALL;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem, (LPARAM)&mi);
- callAvailable = FALSE;
- hangupAvailable = TRUE;
+ callAvailable = FALSE;
+ hangupAvailable = TRUE;
- db_free(&dbv);
- }
- else { callAvailable = TRUE; hangupAvailable = FALSE; }
+ db_free(&dbv);
+ }
+ else { callAvailable = TRUE; hangupAvailable = FALSE; }
- if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0) != 0) {
- callAvailable = FALSE;
- hangupAvailable = FALSE;
- }
+ if (db_get_b((MCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0) != 0) {
+ callAvailable = FALSE;
+ hangupAvailable = FALSE;
+ }
- mi = CallItem();
- mi.flags |= CMIM_ALL | (!callAvailable ? CMIF_HIDDEN : 0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallItem, (LPARAM)&mi);
+ mi = CallItem();
+ mi.flags |= CMIM_ALL | (!callAvailable ? CMIF_HIDDEN : 0);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallItem, (LPARAM)&mi);
- mi = HupItem();
- mi.flags |= CMIM_ALL | (!hangupAvailable ? CMIF_HIDDEN : 0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallHangup, (LPARAM)&mi);
- }
+ mi = HupItem();
+ mi.flags |= CMIM_ALL | (!hangupAvailable ? CMIF_HIDDEN : 0);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallHangup, (LPARAM)&mi);
// Clear SkypeOut menu in case it exists
mi = SkypeOutCallItem();
@@ -313,13 +303,12 @@ return 0;
MCONTACT find_contact(char *name)
{
int tCompareResult;
- MCONTACT hContact;
DBVARIANT dbv;
// already on list?
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
@@ -335,13 +324,12 @@ MCONTACT find_contact(char *name)
MCONTACT find_contactT(TCHAR *name)
{
int tCompareResult;
- MCONTACT hContact;
DBVARIANT dbv;
// already on list?
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
if (db_get_ts(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
@@ -373,9 +361,9 @@ MCONTACT add_contact(char *name, DWORD flags)
LOG(("add_contact: Adding %s", name));
hContact = (MCONTACT)CallServiceSync(MS_DB_CONTACT_ADD, 0, 0);
if (hContact) {
- if (CallServiceSync(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)SKYPE_PROTONAME) != 0) {
+ if (CallServiceSync(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)SKYPE_PROTONAME) != 0) {
LOG(("add_contact: Ouch! MS_PROTO_ADDTOCONTACT failed for some reason"));
- CallServiceSync(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ CallServiceSync(MS_DB_CONTACT_DELETE, hContact, 0);
return NULL;
}
if (name[0]) db_set_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, name);
@@ -401,7 +389,7 @@ void logoff_contacts(BOOL bCleanup) {
LOG(("logoff_contacts: Logging off contacts."));
for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME))
{
if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp
index 3091f0f8d9..cefd1c891f 100644
--- a/protocols/SkypeClassic/src/gchat.cpp
+++ b/protocols/SkypeClassic/src/gchat.cpp
@@ -24,12 +24,6 @@
#define STR "%s"
#endif
-/* VC6 PSDK compatibility */
-#if !defined(_WIN64) && !defined(SetWindowLongPtr)
-#define SetWindowLongPtr SetWindowLong
-#define GetWindowLongPtr GetWindowLong
-#endif
-
#pragma warning (disable: 4706) // assignment within conditional expression
extern HANDLE hInitChat;
@@ -119,8 +113,6 @@ static int AddChatContact(gchat_contacts *gc, char *who, TCHAR *pszRole)
{
int i = -2;
MCONTACT hContact;
- GCDEST gcd = {0};
- GCEVENT gce = {0};
CONTACTINFO ci = {0};
TCHAR *twho;
@@ -130,15 +122,11 @@ static int AddChatContact(gchat_contacts *gc, char *who, TCHAR *pszRole)
if ((i=ExistsChatContact(gc, twho))>=0) return i;
hContact=find_contact(who);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = gc->szChatName;
- gcd.iType = GC_EVENT_JOIN;
-
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.ptszStatus = pszRole?pszRole:_T("USER");
+ GCDEST gcd = { SKYPE_PROTONAME, gc->szChatName, GC_EVENT_JOIN };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ gce.dwFlags = GCEF_ADDTOLOG;
+ gce.ptszStatus = pszRole ? pszRole : _T("USER");
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
@@ -184,7 +172,7 @@ MCONTACT find_chat(LPCTSTR chatname) {
DBVARIANT dbv;
for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
+ szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1)
{
@@ -206,7 +194,7 @@ MCONTACT find_chatA(char *chatname) {
DBVARIANT dbv;
for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) {
- szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
+ szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1)
{
@@ -286,17 +274,10 @@ int __cdecl AddMembers(char *szSkypeMsg) {
}
// Quit contacts which are no longer there
if (iRet == 0 && contactmask) {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
-
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = szChatId;
- gcd.iType = GC_EVENT_QUIT;
-
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
+ GCDEST gcd = { SKYPE_PROTONAME, szChatId, GC_EVENT_QUIT };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ gce.dwFlags = GCEF_ADDTOLOG;
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
@@ -380,22 +361,18 @@ INT_PTR CALLBACK InputBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
lParam = 1 - Create groupchat, but don't open it
0 - Default - open groupchat after init
*/
-int __cdecl ChatInit(WPARAM wParam, LPARAM lParam) {
- GCSESSION gcw = {0};
- GCEVENT gce = {0};
- GCDEST gcd = {0};
+
+int __cdecl ChatInit(WPARAM wParam, LPARAM lParam)
+{
DBVARIANT dbv, dbv2;
char *szChatName;
int iRet = -1;
- UNREFERENCED_PARAMETER(lParam);
-
if (!wParam) return -1;
- gcw.cbSize = sizeof(GCSESSION);
+ GCSESSION gcw = { sizeof(gcw) };
gcw.iType = GCW_CHATROOM;
gcw.pszModule = SKYPE_PROTONAME;
- gcw.dwFlags = GC_TCHAR;
if (!(szChatName = SkypeGet ("CHAT", (char *)wParam, "FRIENDLYNAME")) || !*szChatName)
gcw.ptszName=TranslateT("Unknown"); else {
@@ -413,13 +390,9 @@ int __cdecl ChatInit(WPARAM wParam, LPARAM lParam) {
if (!CallService(MS_GC_NEWSESSION, 0, (LPARAM)&gcw)) {
char *szChatRole;
- gce.cbSize = sizeof(GCEVENT);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = (TCHAR*)gcw.ptszID;
- gcd.iType = GC_EVENT_ADDGROUP;
- gce.pDest = &gcd;
+ GCDEST gcd = { SKYPE_PROTONAME, gcw.ptszID, GC_EVENT_ADDGROUP };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszStatus = _T("CREATOR");
- gce.dwFlags = GC_TCHAR;
// BUG: Groupchat returns nonzero on success here in earlier versions, so we don't check
// it here
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
@@ -457,10 +430,9 @@ int __cdecl ChatInit(WPARAM wParam, LPARAM lParam) {
gce.bIsMe = TRUE;
gce.dwFlags |= GCEF_ADDTOLOG;
if (!CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce)) {
- gce.cbSize = sizeof(GCEVENT);
gcd.iType = GC_EVENT_CONTROL;
- gce.pDest = &gcd;
- if (!lParam) CallService(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
+ if (!lParam)
+ CallService(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
CallService(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
CallService(MS_GC_EVENT, lParam ? WINDOW_HIDDEN : WINDOW_VISIBLE, (LPARAM)&gce);
SkypeSend ("GET CHAT %s MEMBERS", (char *)wParam);
@@ -490,14 +462,11 @@ int __cdecl ChatStart(char *szChatId, BOOL bJustCreate) {
}
-void KillChatSession(GCDEST *gcd) {
- GCEVENT gce = {0};
-
+void KillChatSession(GCDEST *gcd)
+{
+ GCEVENT gce = { sizeof(gce), gcd };
EnterCriticalSection(&m_GCMutex);
LOG(("KillChatSession: Groupchatsession terminated."));
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR;
- gce.pDest = gcd;
gcd->iType = GC_EVENT_CONTROL;
if (SkypeSend ("ALTER CHAT "STR" LEAVE", gcd->ptszID) == 0)
{
@@ -525,7 +494,7 @@ void InviteUser(const TCHAR *szChatId)
// generate a list of contact
while (hContact) {
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact,0 );
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact,0 );
if (szProto && !strcmp(SKYPE_PROTONAME, szProto) &&
!db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) &&
db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE)
@@ -539,7 +508,7 @@ void InviteUser(const TCHAR *szChatId)
}
if (!alreadyInSession)
AppendMenu(tMenu, MF_STRING, (UINT_PTR)hContact,
- (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
+ (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
}
hContact = db_find_next(hContact);
}
@@ -566,21 +535,13 @@ static void KickUser (MCONTACT hContact, GCHOOK *gch)
if (SkypeSend ("ALTER CHAT "STR" KICK "STR, gch->pDest->ptszID, gch->ptszUID)!=-1) {
if (ptr=SkypeRcv("ALTER CHAT KICK", 2000)) {
if (strncmp(ptr, "ERROR", 5)) {
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
- DBVARIANT dbv;
-
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = (TCHAR*)gch->pDest->ptszID;
- gcd.iType = GC_EVENT_KICK;
-
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
+ GCDEST gcd = { SKYPE_PROTONAME, gch->pDest->ptszID, GC_EVENT_KICK };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
- gce.ptszUID= gch->ptszUID;
+ gce.dwFlags = GCEF_ADDTOLOG;
+ gce.ptszUID = gch->ptszUID;
+ CONTACTINFO ci = {0};
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
@@ -588,6 +549,7 @@ static void KickUser (MCONTACT hContact, GCHOOK *gch)
if (hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal;
else gce.ptszNick=gce.ptszUID;
+ DBVARIANT dbv;
if (!db_get_ts(NULL, SKYPE_PROTONAME, "Nick", &dbv)) {
gce.ptszStatus = dbv.ptszVal;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
@@ -604,20 +566,14 @@ static void KickUser (MCONTACT hContact, GCHOOK *gch)
void SetChatTopic(const TCHAR *szChatId, TCHAR *szTopic, BOOL bSet)
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
MCONTACT hContact = find_chat (szChatId);
char *szUTFTopic;
- gce.cbSize = sizeof(GCEVENT);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = szChatId;
- gcd.iType = GC_EVENT_TOPIC;
- gce.pDest = &gcd;
+ GCDEST gcd = { SKYPE_PROTONAME, szChatId, GC_EVENT_TOPIC };
+ GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszText = szTopic;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = (DWORD)time (NULL);
- gce.dwFlags = GC_TCHAR;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
gcd.iType = GC_EVENT_SETSBTEXT;
@@ -666,7 +622,7 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) {
}
// Delete Chatroom from Contact list, as we don't need it anymore...?
if (hContact = find_chat(gc->szChatName))
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
RemChat(gc->szChatName);
break;
@@ -675,8 +631,6 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) {
if(gch && gch->ptszText && _tcslen(gch->ptszText) > 0) {
DBVARIANT dbv, dbv2;
CCSDATA ccs = {0};
- GCDEST gcd = { 0 };
- GCEVENT gce = { sizeof(gce), &gcd };
TCHAR *pEnd;
// remove the ending linebreak
@@ -708,8 +662,8 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) {
}
// Add our line to the chatlog
- gcd.pszModule = gch->pDest->pszModule;
- gcd.ptszID = gch->pDest->ptszID;
+ GCDEST gcd = { gch->pDest->pszModule, gch->pDest->ptszID, 0 };
+ GCEVENT gce = { sizeof(gce), &gcd };
if ( _tcsncmp(gch->ptszText, _T("/me "), 4)==0 && _tcslen(gch->ptszText)>4) {
gce.ptszText = gch->ptszText+4;
gcd.iType = GC_EVENT_ACTION;
@@ -738,7 +692,7 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) {
break;
case GC_USER_PRIVMESS: {
MCONTACT hContact = find_contactT(gch->ptszUID);
- if (hContact) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
+ if (hContact) CallService(MS_MSG_SENDMESSAGE, hContact, 0);
break;
}
@@ -763,8 +717,8 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) {
MCONTACT hContact = find_contactT(gch->ptszUID);
switch(gch->dwData) {
- case 10:CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break;
- case 20:CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0); break;
+ case 10:CallService(MS_USERINFO_SHOWDIALOG, hContact, 0); break;
+ case 20:CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0); break;
case 30: KickUser(hContact, gch); break;
case 110: KillChatSession(gch->pDest); break;
}
@@ -874,11 +828,7 @@ INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM lParam)
if (db_get_ts(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv) == 0)
{
- GCDEST gcd = {0};
-
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.iType = GC_EVENT_CONTROL;
- gcd.ptszID = dbv.ptszVal;
+ GCDEST gcd = { SKYPE_PROTONAME, dbv.ptszVal, GC_EVENT_CONTROL };
KillChatSession(&gcd);
db_free(&dbv);
}
diff --git a/protocols/SkypeClassic/src/gchat.h b/protocols/SkypeClassic/src/gchat.h
index 227f2f515c..91dcef43f4 100644
--- a/protocols/SkypeClassic/src/gchat.h
+++ b/protocols/SkypeClassic/src/gchat.h
@@ -11,11 +11,6 @@
#define MAX_BUF 256 // Buffer for topic-string
-// In case this you compile for Miranda NG with a non-Tchar aware Groupchat plugin, null the flag out
-#ifndef GC_TCHAR
-#define GC_TCHAR 0
-#endif
-
typedef struct {
MCONTACT hContact;
TCHAR who[33];
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp
index 6f155010aa..20d4048458 100644
--- a/protocols/SkypeClassic/src/skype.cpp
+++ b/protocols/SkypeClassic/src/skype.cpp
@@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "pthread.h"
#include "gchat.h"
#include "m_toptoolbar.h"
-
-inline BOOL HasVoiceService() { return FALSE; }
-
#include "msglist.h"
#include "memlist.h"
#include <sys/timeb.h>
@@ -492,82 +489,6 @@ int SearchFriends(void) {
return iRet;
}
-static void QueryUserWaitingAuthorization(char *pszNick, char *pszAuthRq)
-{
- CCSDATA ccs={0};
- PROTORECVEVENT pre={0};
- MCONTACT hContact;
- char *firstname=NULL, *lastname=NULL, *pCurBlob, *authmsg=NULL;
-
- LOG(("Awaiting auth: %s", pszNick));
- ccs.szProtoService=PSR_AUTH;
- ccs.hContact = hContact = add_contact(pszNick, PALF_TEMPORARY);
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- pre.flags = 0;
- pre.timestamp = (DWORD)SkypeTime(NULL);
-
- /* blob is: */
- //DWORD protocolSpecific HANDLE hContact
- //ASCIIZ nick, firstName, lastName, e-mail, requestReason
- if (firstname=SkypeGet("USER", pszNick, "FULLNAME")) {
- if (mirandaVersion < 0x070000) {
- char *tmp;
-
- if (utf8_decode(firstname, &tmp)!=-1) {
- free (firstname);
- firstname = tmp;
- }
- }
- if (lastname=strchr(firstname, ' ')) {
- *lastname=0;
- lastname++;
- }
- }
-
- pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + strlen(pszNick) + 5;
- if (firstname) pre.lParam += strlen(firstname);
- if (lastname) pre.lParam += strlen(lastname);
- if (pszAuthRq) authmsg = strdup(pszAuthRq);
- if (authmsg || ((protocol>=4 || bIsImoproxy) && (authmsg=SkypeGetID("USER", pszNick, "RECEIVEDAUTHREQUEST"))))
- pre.lParam+=strlen(authmsg);
- if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
- pCurBlob+=sizeof(DWORD); // Not used
- memcpy(pCurBlob, &hContact, sizeof(HANDLE)); pCurBlob += sizeof(HANDLE);
-
- if (mirandaVersion >= 0x070000) // 0.7.0+ supports PREF_UTF flag, no need to decode UTF8
- pre.flags |= PREF_UTF;
- else {
- char *tmp;
-
- if (authmsg && utf8_decode(authmsg, &tmp)!=-1) {
- free (authmsg);
- authmsg = tmp;
- }
- }
-
- sprintf (pCurBlob, "%s%c%s%c%s%c%c%s", pszNick, 0, firstname?firstname:"", 0, lastname?lastname:"", 0, 0, authmsg?authmsg:"");
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
- free(pre.szMessage);
- }
- if (firstname) free(firstname);
- if (authmsg) free (authmsg);
- return;
-}
-
-
-void __cdecl ProcessAuthRq(void *pPmsg) {
- char *nick, *auth;
-
- strtok ((char*)pPmsg, " ");
- nick = strtok (NULL, " ");
- strtok (NULL, " ");
- auth = strtok (NULL, "");
- QueryUserWaitingAuthorization(nick, auth);
- free (pPmsg);
-}
-
void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) {
char *cmd, *token, *nextoken;
@@ -582,8 +503,47 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) {
token = strtok_r(cmd + 10, ", ", &nextoken);
while (token) {
- QueryUserWaitingAuthorization (token, NULL);
- token=strtok_r(NULL, ", ", &nextoken);
+ CCSDATA ccs = { 0 };
+ PROTORECVEVENT pre = { 0 };
+ MCONTACT hContact;
+ char *firstname = NULL, *lastname = NULL, *pCurBlob;
+
+ LOG(("Awaiting auth: %s", token));
+ ccs.szProtoService = PSR_AUTH;
+ ccs.hContact = hContact = add_contact(token, PALF_TEMPORARY);
+ ccs.wParam = 0;
+ ccs.lParam = (LPARAM)&pre;
+ pre.flags = 0;
+ pre.timestamp = (DWORD)SkypeTime(NULL);
+
+ /* blob is: */
+ //DWORD protocolSpecific MCONTACT hContact
+ //ASCIIZ nick, firstName, lastName, e-mail, requestReason
+ if (firstname = SkypeGet("USER", token, "FULLNAME"))
+ if (lastname = strchr(firstname, ' ')) {
+ *lastname = 0;
+ lastname++;
+ }
+
+ pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + strlen(token) + 5;
+ if (firstname) pre.lParam += strlen(firstname);
+ if (lastname) pre.lParam += strlen(lastname);
+ if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
+ pCurBlob += sizeof(DWORD); // Not used
+ memcpy(pCurBlob, &hContact, sizeof(HANDLE)); pCurBlob += sizeof(HANDLE);
+ strcpy((char *)pCurBlob, token); pCurBlob += strlen((char *)pCurBlob) + 1;
+ if (firstname) {
+ strcpy((char *)pCurBlob, firstname);
+ if (lastname) {
+ pCurBlob += strlen((char *)pCurBlob) + 1;
+ strcpy((char *)pCurBlob, lastname);
+ }
+ }
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ free(pre.szMessage);
+ }
+ if (firstname) free(firstname);
+ token = strtok_r(NULL, ", ", &nextoken);
}
free(cmd);
return;
@@ -768,7 +728,7 @@ void __cdecl SkypeSystemInit(char *dummy) {
SkypeSend("CREATE APPLICATION libpurple_typing");
testfor("CREATE APPLICATION libpurple_typing", 2000);
}
- if (protocol>=5) {
+ if (protocol >= 5 || bIsImoproxy) {
SearchUsersWaitingMyAuthorization(NULL);
if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0))
SearchRecentChats(NULL);
@@ -839,19 +799,10 @@ int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam) {
ttb.cbSize = sizeof(ttb);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- ttb.name = Translate("Do a SkypeOut-call");
-#ifdef TTB_WINDOW_HANDLE
- /* New Top toolbar */
ttb.hIconHandleDn = ttb.hIconHandleUp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CALL));
ttb.pszService = SKYPEOUT_CALL;
+ ttb.name = Translate("Do a SkypeOut-call");
if ((int)(TopToolbar_AddButton(&ttb)) == -1) httbButton = 0;
-#else
- /* Old Top toolbar */
- ttb.dwFlags |= TTBBF_DRAWBORDER;
- ttb.hbBitmapDown = ttb.hbBitmapUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CALL));
- ttb.pszServiceDown = ttb.pszServiceUp = SKYPEOUT_CALL;
- if ((int)(httbButton=(HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0))==-1) httbButton=0;
-#endif
return 0;
}
@@ -868,20 +819,16 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
HookEventsLoaded();
RegisterToDbeditorpp();
-
GCInit();
add_contextmenu(NULL);
if (ServiceExists(MS_GC_REGISTER))
{
- GCREGISTER gcr = {0};
- static COLORREF crCols[1] = {0};
+ static COLORREF crCols[1] = { 0 };
char szEvent[MAXMODULELABELLENGTH];
-
- gcr.cbSize = sizeof( GCREGISTER );
+ GCREGISTER gcr = { sizeof(gcr) };
gcr.dwFlags = GC_CHANMGR; // |GC_ACKMSG; // TODO: Not implemented yet
- gcr.dwFlags |= GC_TCHAR;
gcr.ptszDispName = _T("Skype protocol");
gcr.pszModule = SKYPE_PROTONAME;
if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr))
@@ -947,13 +894,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
// Get Timestamp
if (!args.pMsgEntry || !args.pMsgEntry->tEdited) {
- if (!(ptr=SkypeGet (cmdMessage, args.msgnum, "TIMESTAMP"))) return;
- if (strncmp(ptr, "ERROR", 5)) {
- timestamp=atol(ptr);
- // Ensure time correction on clock skew...
- if (timestamp>(DWORD)SkypeTime(NULL)) timestamp=(DWORD)SkypeTime(NULL);
- }
- else timestamp=(DWORD)SkypeTime(NULL);
+ if (!(ptr = SkypeGet(cmdMessage, args.msgnum, "TIMESTAMP"))) return;
+ if (strncmp(ptr, "ERROR", 5)) timestamp = atol(ptr);
+ else timestamp = (DWORD)SkypeTime(NULL);
free(ptr);
}
else timestamp = (DWORD)(args.pMsgEntry->tEdited);
@@ -986,21 +929,14 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
}
if (!strcmp(type, "KICKED"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
-
if (!hChat) __leave;
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_KICK;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_KICK };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
-
+ CONTACTINFO ci = { 0 };
ci.hContact = find_contact(users);
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
@@ -1023,9 +959,6 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
}
if (!strcmp(type, "SETROLE"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
gchat_contact *gcContact;
char *pszRole;
@@ -1033,18 +966,15 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
// USERS - Wessen Rolle wurde gesetzt
// ROLE - Die neue Rolle
if (!hChat) __leave;
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_REMOVESTATUS;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_REMOVESTATUS };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
-
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
@@ -1082,20 +1012,13 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
}
if (!strcmp(type, "SETTOPIC"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
-
LOG(("FetchMessageThread CHAT SETTOPIC"));
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_TOPIC;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_TOPIC };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
-
+ CONTACTINFO ci = { 0 };
ci.hContact = find_contact(who);
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
ci.cbSize = sizeof(ci);
@@ -1123,24 +1046,14 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
}
if (!strcmp(type, "LEFT") || (bAddedMembers = strcmp(type, "ADDEDMEMBERS") == 0))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
- char *pszInvited = Translate("invited");
-
LOG(("FetchMessageThread CHAT LEFT or ADDEDMEMBERS"));
if (bAddedMembers) {
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_ACTION;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_ACTION };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
- // We assume that users buffer has enough room for "invited" string
- memmove (users+strlen(pszInvited), users, strlen(users)+1);
- memcpy (users, pszInvited, strlen(pszInvited));
+ CMString(FORMAT, _T("%S %s"), users, TranslateT("invited"));
gce.ptszText = make_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
DBVARIANT dbv;
@@ -1150,6 +1063,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
}
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
if (!gce.bIsMe)
ci.hContact = find_contact(who);
@@ -1273,7 +1187,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
mir_free(ci.pszVal);
}
}
- newlen = strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9;
+ newlen = int(strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9);
if (pMsg = (char *)malloc(newlen)) {
sprintf(pMsg, "** %s%s%s **", (pszUTFnick ? pszUTFnick : ""), (pszUTFnick ? " " : ""), (char*)msgptr);
free(ptr);
@@ -1301,7 +1215,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
#ifdef _UNICODE
msglen = (int)strlen(msg) + 1;
msgptr = (char*)make_unicode_string((const unsigned char*)msgptr);
- wcLen = (int)(_tcslen((TCHAR*)msgptr) + 1)*sizeof(TCHAR);
+ wcLen = int(_tcslen((TCHAR*)msgptr) + 1)*sizeof(TCHAR);
msg = (char*)realloc(msg, msglen + wcLen);
memcpy(msg + msglen, msgptr, wcLen);
free(msgptr);
@@ -1321,17 +1235,12 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
bHasPartList) || msgptr[0] == 0) __leave;
if (isGroupChat && bUseGroupChat) {
-
- GCDEST gcd = { 0 };
- GCEVENT gce = { sizeof(gce), &gcd };
DBVARIANT dbv = { 0 };
- CONTACTINFO ci = { 0 };
LOG(("FetchMessageThread This is a group chat message"));
if (!hChat) ChatStart(chat, FALSE);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = bEmoted?GC_EVENT_ACTION:GC_EVENT_MESSAGE;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), bEmoted ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
if ((gce.bIsMe = (direction&DBEF_SENT) ? TRUE : FALSE) && db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
{
free(who);
@@ -1341,6 +1250,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
gce.ptszNick = gce.ptszUID;
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
@@ -1349,7 +1259,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
gce.ptszNick = ci.pszVal;
gce.time = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
gce.ptszText = (TCHAR*)(msgptr + msglen);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ gce.dwFlags = GCEF_ADDTOLOG;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
MsgList_Add(pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat
if (ci.pszVal) mir_free(ci.pszVal);
@@ -1380,7 +1290,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) {
TYP_MSGLENTRY *pme;
LOG(("FetchMessageThread Adding event"));
- if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)))
+ if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0)))
dbei.szModule = SKYPE_PROTONAME;
dbei.cbBlob = msglen;
if (pre.flags & PREF_UNICODE)
@@ -1534,9 +1444,7 @@ MCONTACT GetCallerContact(char *szSkypeMsg)
MCONTACT GetMetaHandle(DWORD dwId)
{
- MCONTACT hContact;
-
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, "MetaContacts") &&
db_get_dw(hContact, "MetaContacts", "MetaID", MAXDWORD) == dwId)
@@ -1625,11 +1533,6 @@ void RingThread(char *szSkypeMsg) {
}
}
- if (HasVoiceService()) {
- // Voice service will handle it
- goto l_exitRT;
- }
-
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_CALL;
dbei.szModule = SKYPE_PROTONAME;
@@ -1647,7 +1550,7 @@ void RingThread(char *szSkypeMsg) {
unsigned int popupBackColor, popupTextColor;
int popupTimeSec;
POPUPDATAT InCallPopup;
- TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
@@ -1677,7 +1580,7 @@ void RingThread(char *szSkypeMsg) {
dbei.flags = DBEF_READ;
cle.hContact = hContact;
cle.hDbEvent = db_event_add(hContact, &dbei);
- _snprintf(toolTip, sizeof(toolTip), Translate("Incoming call from %s"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0));
+ _snprintf(toolTip, sizeof(toolTip), Translate("Incoming call from %s"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
cle.pszTooltip = toolTip;
CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
@@ -1727,27 +1630,25 @@ void EndCallThread(char *szSkypeMsg) {
{
db_unset(hContact, SKYPE_PROTONAME, "CallId");
- if (!HasVoiceService()) {
- dbei.cbSize = sizeof(dbei);
- hDbEvent = db_event_firstUnread(hContact);
- while (hDbEvent) {
- dbei.cbBlob = 0;
- db_event_get(hDbEvent, &dbei);
- if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CALL) {
- db_event_markRead(hContact, hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hDbEvent);
- }
- if (dbei.pBlob) free(dbei.pBlob);
- hDbEvent = db_event_next(hContact, hDbEvent);
+ dbei.cbSize = sizeof(dbei);
+ hDbEvent = db_event_firstUnread(hContact);
+ while (hDbEvent) {
+ dbei.cbBlob = 0;
+ db_event_get(hDbEvent, &dbei);
+ if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CALL) {
+ db_event_markRead(hContact, hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)hDbEvent);
}
+ free(dbei.pBlob);
+ hDbEvent = db_event_next(hContact, hDbEvent);
}
if (!db_get_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) {
db_free(&dbv);
- if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), SKYPE_PROTONAME) &&
+ if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0), SKYPE_PROTONAME) &&
db_get_b(hContact, "CList", "NotOnList", 0)
)
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
}
free(szSkypeMsg);
@@ -1927,7 +1828,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
LPARAM lTyping = PROTOTYPE_CONTACTTYPING_OFF;
if (!strcmp(p, "PURPLE_TYPING")) lTyping = PROTOTYPE_CONTACTTYPING_INFINITE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, lTyping);
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, lTyping);
break;
}
}
@@ -1993,7 +1894,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
if (nm = strtok_r(NULL, " ", &nextoken))
{
db_set_utf(hContact, SKYPE_PROTONAME, "FirstName", nm);
- if (!(nm = strtok_r(NULL, "", &nextoken))) {db_unset(hContact, SKYPE_PROTONAME, "LastName");}
+ if (!(nm = strtok_r(NULL, "", &nextoken))) db_unset(hContact, SKYPE_PROTONAME, "LastName");
else
db_set_utf(hContact, SKYPE_PROTONAME, "LastName", nm);
}
@@ -2112,7 +2013,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
else { // BUDDYSTATUS:
flag = 0;
switch (atoi(ptr + 12)) {
- case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); break;
+ case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, hContact, 0); break;
case 0: break;
case 2: flag = PALF_TEMPORARY;
case 3: add_contact(nick, flag);
@@ -2161,18 +2062,12 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
*ptr = 0;
if (hContact = find_chatA(szSkypeMsg + 5))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) !=
ID_STATUS_OFFLINE)
{
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5);
- gcd.iType = GC_EVENT_CHANGESESSIONAME;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.ptszText = make_tchar_string((const unsigned char*)ptr+14);
- gce.dwFlags = GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)szSkypeMsg + 5), GC_EVENT_CHANGESESSIONAME };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.ptszText = make_tchar_string((const unsigned char*)ptr + 14);
if (gce.ptszText) {
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
db_set_ts(hContact, SKYPE_PROTONAME, "Nick", gce.ptszText);
@@ -2319,7 +2214,6 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
KillTimer(hWndDlg, 1);
break;
case WM_COPYDATALOCAL:
- --iReentranceCnt;
return WndProc(hWndDlg, WM_COPYDATA, wParam, lParam);
default:
@@ -2438,8 +2332,7 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam)
int __stdcall SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
- ACKDATA ack = {0};
- ack.cbSize = sizeof( ACKDATA );
+ ACKDATA ack = { sizeof(ACKDATA) };
ack.szModule = SKYPE_PROTONAME;
ack.hContact = hContact;
ack.type = type;
@@ -3006,7 +2899,7 @@ void CleanupNicknames(char *dummy) {
LOG(("CleanupNicknames Cleaning up..."));
for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
@@ -3247,26 +3140,26 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) {
return 0;
}
-extern "C" int __declspec(dllexport) Load()
+extern "C" int __declspec(dllexport) Load(void)
{
DWORD Buffsize;
HKEY MyKey;
BOOL SkypeInstalled;
BOOL UseCustomCommand;
WSADATA wsaData;
- char path[MAX_PATH];
mir_getLP(&pluginInfo);
- // Used to enable Copy DLL hack in older Miranda versions for muliple accounts
- GetModuleFileNameA( hInst, path, sizeof( path ));
- _splitpath (path, NULL, NULL, SKYPE_PROTONAME, NULL);
- CharUpperA( SKYPE_PROTONAME );
+ // RM: commented so it will always use predefined name - or was this really needed?
+ ///GetModuleFileNameA( hInst, path, sizeof( path ));
+ ///_splitpath (path, NULL, NULL, SKYPE_PROTONAME, NULL);
+ ///CharUpperA( SKYPE_PROTONAME );
InitializeCriticalSection(&RingAndEndcallMutex);
InitializeCriticalSection(&QueryThreadMutex);
InitializeCriticalSection(&TimeMutex);
+
#ifdef _DEBUG
init_debug();
#endif
@@ -3349,8 +3242,7 @@ extern "C" int __declspec(dllexport) Load()
}
/* Register the module */
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = PROTOCOLDESCRIPTOR_V3_SIZE;
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = SKYPE_PROTONAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/protocols/SkypeClassic/src/skype.h b/protocols/SkypeClassic/src/skype.h
index 3772398ab9..f6821b0063 100644
--- a/protocols/SkypeClassic/src/skype.h
+++ b/protocols/SkypeClassic/src/skype.h
@@ -5,6 +5,7 @@
#define CP_ACP 0
#define code_page CP_ACP;
+#define MIRANDA_CUSTOM_LP
// System includes
@@ -43,9 +44,7 @@
#include <m_contacts.h>
#include <m_metacontacts.h>
#include <m_popup.h>
-#include <m_core.h>
-
-#define MIRANDA_CUSTOM_LP
+#include <m_string.h>
#pragma warning (pop)
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp
index 1534a3530a..b5bd939172 100644
--- a/protocols/SkypeClassic/src/skypeapi.cpp
+++ b/protocols/SkypeClassic/src/skypeapi.cpp
@@ -782,7 +782,7 @@ static INT_PTR CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
OUTPUTA(ptr);
free(ptr);
}
- if (TempAdded) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ if (TempAdded) CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
free(msg);
}
@@ -816,7 +816,7 @@ static INT_PTR CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
// Check, if another call is in progress
for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) {
- char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
+ char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) && hContact != (MCONTACT)lParam &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0 &&
!db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv2))
@@ -831,7 +831,7 @@ static INT_PTR CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
if (dbv2.pszVal)
{
char buf[256], buf2[256];
- char *szOtherCaller=(char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0);
+ char *szOtherCaller=(char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,0);
Utils_RestoreWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "CALLSTATdlg");
TranslateDialogDefault(hwndDlg);
diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp
index 07fa5905db..16b421cdb4 100644
--- a/protocols/SkypeClassic/src/skypeopt.cpp
+++ b/protocols/SkypeClassic/src/skypeopt.cpp
@@ -163,7 +163,7 @@ INT_PTR CALLBACK OptPopupDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
TCHAR * lpzContactName;
hContact = db_find_first();
- lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR);
+ lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,GCDNF_TCHAR);
InCallPopup.lchContact = hContact;
InCallPopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
InCallPopup.colorBack = ! popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
diff --git a/protocols/SkypeClassic/src/voiceservice.cpp b/protocols/SkypeClassic/src/voiceservice.cpp
deleted file mode 100644
index 80d4cf7b51..0000000000
--- a/protocols/SkypeClassic/src/voiceservice.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-#include "skype.h"
-#include "skypeapi.h"
-#include "skypesvc.h"
-#include "voiceservice.h"
-#ifdef IS_MIRANDAIM
-#include "sdk/m_voiceservice.h"
-#endif
-
-#pragma warning (push)
-#pragma warning (disable: 4100) // unreferenced formal parameter
-#include "m_utils.h"
-#pragma warning (pop)
-
-HANDLE hVoiceNotify = NULL;
-BOOL has_voice_service = FALSE;
-
-extern char g_szProtoName[];
-
-
-BOOL HasVoiceService()
-{
- return has_voice_service;
-}
-
-void NofifyVoiceService(HANDLE hContact, char *callId, int state)
-{
-#ifdef IS_MIRANDAIM
- VOICE_CALL vc = {0};
- vc.cbSize = sizeof(vc);
- vc.szModule = SKYPE_PROTONAME;
- vc.id = callId;
- vc.flags = VOICE_CALL_CONTACT;
- vc.state = state;
- vc.hContact = hContact;
- NotifyEventHooks(hVoiceNotify, (WPARAM) &vc, 0);
-#endif
-}
-
-#ifdef IS_MIRANDAIM
-static INT_PTR VoiceGetInfo(WPARAM wParam, LPARAM lParam)
-{
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
-
- return VOICE_SUPPORTED | VOICE_CALL_CONTACT | VOICE_CAN_HOLD;
-}
-
-static HANDLE FindContactByCallId(char *callId)
-{
- HANDLE hContact;
- int iCmpRes;
- for (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- hContact != NULL;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
- {
- char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
-
- DBVARIANT dbv;
- if (szProto != NULL
- && !strcmp(szProto, SKYPE_PROTONAME)
- && DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0
- && !DBGetContactSettingString(hContact, SKYPE_PROTONAME, "CallId", &dbv))
- {
- iCmpRes = strcmp(callId, dbv.pszVal);
- DBFreeVariant(&dbv);
- if (iCmpRes == 0) return hContact;
- }
- }
-
- return NULL;
-}
-
-static INT_PTR VoiceCall(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return -1;
-
- SkypeSend("CALL %s", dbv.pszVal);
- DBFreeVariant (&dbv);
-
- return 0;
-}
-
-static INT_PTR VoiceAnswer(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS INPROGRESS", callId);
- testfor("ERROR", 200);
-
- return 0;
-}
-
-static INT_PTR VoiceDrop(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS FINISHED", callId);
-
- return 0;
-}
-
-static INT_PTR VoiceHold(WPARAM wParam, LPARAM lParam)
-{
- char *callId = (char *) wParam;
-
- UNREFERENCED_PARAMETER(lParam);
-
- if (!wParam) return -1;
-
- if (FindContactByCallId(callId) == NULL)
- return -1;
-
- SkypeSend("SET %s STATUS ONHOLD", callId);
-
- return 0;
-}
-#endif
-
-void VoiceServiceInit()
-{
-#ifdef IS_MIRANDAIM
- // leecher, 26.03.2011: Did this ever work in the old versions??
- char szEvent[MAXMODULELABELLENGTH];
-
- _snprintf (szEvent, sizeof(szEvent), "%s%s", SKYPE_PROTONAME, PE_VOICE_CALL_STATE);
- hVoiceNotify = CreateHookableEvent( szEvent );
- CreateProtoService( PS_VOICE_GETINFO, VoiceGetInfo );
- CreateProtoService( PS_VOICE_CALL, VoiceCall );
- CreateProtoService( PS_VOICE_ANSWERCALL, VoiceAnswer );
- CreateProtoService( PS_VOICE_DROPCALL, VoiceDrop );
- CreateProtoService( PS_VOICE_HOLDCALL, VoiceHold );
-#endif
-}
-
-void VoiceServiceExit()
-{
-#ifdef IS_MIRANDAIM
- DestroyHookableEvent(hVoiceNotify);
-#endif
-}
-
-void VoiceServiceModulesLoaded()
-{
-#ifdef IS_MIRANDAIM
- has_voice_service = ServiceExists(MS_VOICESERVICE_REGISTER);
-#endif
-}
-
diff --git a/protocols/SkypeClassic/src/voiceservice.h b/protocols/SkypeClassic/src/voiceservice.h
deleted file mode 100644
index 6665fcaa5c..0000000000
--- a/protocols/SkypeClassic/src/voiceservice.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _VOICESERVICE_H_
-#define _VOICESERVICE_H_
-
-#pragma warning (push)
-#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
-
-#pragma warning (pop)
-
-BOOL HasVoiceService();
-void VoiceServiceInit();
-void VoiceServiceExit();
-void VoiceServiceModulesLoaded();
-void NofifyVoiceService(HANDLE hContact, char *callId, int state) ;
-
-
-
-#endif // _VOICESERVICE_H_
-