diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-08-11 21:19:54 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-08-11 21:19:54 +0000 |
commit | 4f3031386a93610686ce917c47582fa04f3d5eca (patch) | |
tree | 6f420819c8945b4b18b9e45e4964baf188dd2e2f /protocols/SkypeClassic/src | |
parent | 41ec75629ab19e84dd25a168797afe5fe8c01594 (diff) |
Updated SkypeClassic sources from leecher (compatible with IM, but broken with NG)
git-svn-id: http://svn.miranda-ng.org/main/trunk@10159 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeClassic/src')
-rw-r--r-- | protocols/SkypeClassic/src/contacts.cpp | 86 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/gchat.cpp | 128 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/gchat.h | 7 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/ng-compat/m_core.h | 52 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/ng-compat/stdver.h | 9 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/sdk/m_chat.h | 635 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/sdk/m_folders.h | 207 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/sdk/m_metacontacts.h | 128 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/sdk/m_toptoolbar.h | 125 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/sdk/m_updater.h | 146 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/sdk/m_voice.h | 158 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/sdk/m_voiceservice.h | 86 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.cpp | 440 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.h | 8 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skypeapi.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skypeopt.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/voiceservice.cpp | 169 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/voiceservice.h | 18 |
18 files changed, 2221 insertions, 189 deletions
diff --git a/protocols/SkypeClassic/src/contacts.cpp b/protocols/SkypeClassic/src/contacts.cpp index 92b07eaab2..2bb2bb0898 100644 --- a/protocols/SkypeClassic/src/contacts.cpp +++ b/protocols/SkypeClassic/src/contacts.cpp @@ -7,6 +7,7 @@ #include "debug.h"
#include "pthread.h"
#include "gchat.h"
+#include "voiceservice.h"
#pragma warning (push)
#pragma warning (disable: 4100) // unreferenced formal parameter
@@ -155,16 +156,20 @@ HANDLE add_contextmenu(MCONTACT hContact) { UNREFERENCED_PARAMETER(hContact);
- mi = CallItem();
- hMenuCallItem = Menu_AddContactMenuItem(&mi);
- mi = HupItem();
- hMenuCallHangup = Menu_AddContactMenuItem(&mi);
+ if (!HasVoiceService()) {
+ mi = CallItem();
+ hMenuCallItem = Menu_AddContactMenuItem(&mi);
+ mi = HupItem();
+ hMenuCallHangup = Menu_AddContactMenuItem(&mi);
+ }
mi = SkypeOutCallItem();
hMenuSkypeOutCallItem = Menu_AddContactMenuItem(&mi);
- mi = HoldCallItem();
- hMenuHoldCallItem = Menu_AddContactMenuItem(&mi);
+ if (!HasVoiceService()) {
+ mi = HoldCallItem();
+ hMenuHoldCallItem = Menu_AddContactMenuItem(&mi);
+ }
// We cannot use flag PF1_FILESEND for sending files, as Skype opens its own
// sendfile-Dialog.
@@ -211,37 +216,42 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { if (!(szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0))) return 0;
- // Clear hold-Item in case it exists
- mi = HoldCallItem();
- mi.flags |= CMIM_ALL;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem, (LPARAM)&mi);
+ if (!HasVoiceService())
+ {
+ // 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 (!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 (!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);
- 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();
@@ -303,12 +313,13 @@ return 0; MCONTACT find_contact(char *name)
{
int tCompareResult;
+ MCONTACT hContact;
DBVARIANT dbv;
// already on list?
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)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;
@@ -324,12 +335,13 @@ MCONTACT find_contact(char *name) MCONTACT find_contactT(TCHAR *name)
{
int tCompareResult;
+ MCONTACT hContact;
DBVARIANT dbv;
// already on list?
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)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;
@@ -361,9 +373,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, hContact, (LPARAM)SKYPE_PROTONAME) != 0) {
+ if (CallServiceSync(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)SKYPE_PROTONAME) != 0) {
LOG(("add_contact: Ouch! MS_PROTO_ADDTOCONTACT failed for some reason"));
- CallServiceSync(MS_DB_CONTACT_DELETE, hContact, 0);
+ CallServiceSync(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
return NULL;
}
if (name[0]) db_set_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, name);
@@ -389,7 +401,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, hContact, 0);
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)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 cefd1c891f..9ba0295e86 100644 --- a/protocols/SkypeClassic/src/gchat.cpp +++ b/protocols/SkypeClassic/src/gchat.cpp @@ -24,6 +24,12 @@ #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;
@@ -113,6 +119,8 @@ 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;
@@ -122,11 +130,15 @@ static int AddChatContact(gchat_contacts *gc, char *who, TCHAR *pszRole) if ((i=ExistsChatContact(gc, twho))>=0) return i;
hContact=find_contact(who);
- GCDEST gcd = { SKYPE_PROTONAME, gc->szChatName, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ 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");
gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszStatus = pszRole ? pszRole : _T("USER");
+ gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
@@ -172,7 +184,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, hContact, 0 );
+ szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1)
{
@@ -194,7 +206,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, hContact, 0 );
+ szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 );
if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1)
{
@@ -274,10 +286,17 @@ int __cdecl AddMembers(char *szSkypeMsg) { }
// Quit contacts which are no longer there
if (iRet == 0 && contactmask) {
- GCDEST gcd = { SKYPE_PROTONAME, szChatId, GC_EVENT_QUIT };
- GCEVENT gce = { sizeof(gce), &gcd };
+ 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;
gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG;
+ gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
@@ -361,18 +380,22 @@ 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)
-{
+int __cdecl ChatInit(WPARAM wParam, LPARAM lParam) {
+ GCSESSION gcw = {0};
+ GCEVENT gce = {0};
+ GCDEST gcd = {0};
DBVARIANT dbv, dbv2;
char *szChatName;
int iRet = -1;
+ UNREFERENCED_PARAMETER(lParam);
+
if (!wParam) return -1;
- GCSESSION gcw = { sizeof(gcw) };
+ gcw.cbSize = sizeof(GCSESSION);
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 {
@@ -390,9 +413,13 @@ int __cdecl ChatInit(WPARAM wParam, LPARAM lParam) if (!CallService(MS_GC_NEWSESSION, 0, (LPARAM)&gcw)) {
char *szChatRole;
- GCDEST gcd = { SKYPE_PROTONAME, gcw.ptszID, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ gce.cbSize = sizeof(GCEVENT);
+ gcd.pszModule = SKYPE_PROTONAME;
+ gcd.ptszID = (TCHAR*)gcw.ptszID;
+ gcd.iType = GC_EVENT_ADDGROUP;
+ gce.pDest = &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);
@@ -430,9 +457,10 @@ 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;
- if (!lParam)
- CallService(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
+ gce.pDest = &gcd;
+ 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);
@@ -462,11 +490,14 @@ int __cdecl ChatStart(char *szChatId, BOOL bJustCreate) { }
-void KillChatSession(GCDEST *gcd)
-{
- GCEVENT gce = { sizeof(gce), gcd };
+void KillChatSession(GCDEST *gcd) {
+ GCEVENT gce = {0};
+
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)
{
@@ -494,7 +525,7 @@ void InviteUser(const TCHAR *szChatId) // generate a list of contact
while (hContact) {
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact,0 );
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)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)
@@ -508,7 +539,7 @@ void InviteUser(const TCHAR *szChatId) }
if (!alreadyInSession)
AppendMenu(tMenu, MF_STRING, (UINT_PTR)hContact,
- (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
}
hContact = db_find_next(hContact);
}
@@ -535,13 +566,21 @@ 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 = { SKYPE_PROTONAME, gch->pDest->ptszID, GC_EVENT_KICK };
- GCEVENT gce = { sizeof(gce), &gcd };
+ 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;
gce.time = (DWORD)time(NULL);
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszUID = gch->ptszUID;
+ gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ gce.ptszUID= gch->ptszUID;
- CONTACTINFO ci = {0};
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
@@ -549,7 +588,6 @@ 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);
@@ -564,16 +602,22 @@ static void KickUser (MCONTACT hContact, GCHOOK *gch) LeaveCriticalSection(&m_GCMutex);
}
-void SetChatTopic(const TCHAR *szChatId, TCHAR *szTopic, BOOL bSet)
+void SetChatTopic(TCHAR *szChatId, TCHAR *szTopic, BOOL bSet)
{
+ GCDEST gcd = {0};
+ GCEVENT gce = {0};
MCONTACT hContact = find_chat (szChatId);
char *szUTFTopic;
- GCDEST gcd = { SKYPE_PROTONAME, szChatId, GC_EVENT_TOPIC };
- GCEVENT gce = { sizeof(gce), &gcd };
+ gce.cbSize = sizeof(GCEVENT);
+ gcd.pszModule = SKYPE_PROTONAME;
+ gcd.ptszID = szChatId;
+ gcd.iType = GC_EVENT_TOPIC;
+ gce.pDest = &gcd;
gce.ptszText = szTopic;
- gce.dwFlags = GCEF_ADDTOLOG;
+ gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
gce.time = (DWORD)time (NULL);
+ gce.dwFlags = GC_TCHAR;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
gcd.iType = GC_EVENT_SETSBTEXT;
@@ -622,7 +666,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, hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
RemChat(gc->szChatName);
break;
@@ -631,6 +675,8 @@ 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
@@ -662,8 +708,8 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) { }
// Add our line to the chatlog
- GCDEST gcd = { gch->pDest->pszModule, gch->pDest->ptszID, 0 };
- GCEVENT gce = { sizeof(gce), &gcd };
+ gcd.pszModule = gch->pDest->pszModule;
+ gcd.ptszID = gch->pDest->ptszID;
if ( _tcsncmp(gch->ptszText, _T("/me "), 4)==0 && _tcslen(gch->ptszText)>4) {
gce.ptszText = gch->ptszText+4;
gcd.iType = GC_EVENT_ACTION;
@@ -692,7 +738,7 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) { break;
case GC_USER_PRIVMESS: {
MCONTACT hContact = find_contactT(gch->ptszUID);
- if (hContact) CallService(MS_MSG_SENDMESSAGE, hContact, 0);
+ if (hContact) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
break;
}
@@ -717,8 +763,8 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) { MCONTACT hContact = find_contactT(gch->ptszUID);
switch(gch->dwData) {
- case 10:CallService(MS_USERINFO_SHOWDIALOG, hContact, 0); break;
- case 20:CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0); break;
+ case 10:CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break;
+ case 20:CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0); break;
case 30: KickUser(hContact, gch); break;
case 110: KillChatSession(gch->pDest); break;
}
@@ -828,7 +874,11 @@ INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM lParam) if (db_get_ts(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv) == 0)
{
- GCDEST gcd = { SKYPE_PROTONAME, dbv.ptszVal, GC_EVENT_CONTROL };
+ GCDEST gcd = {0};
+
+ gcd.pszModule = SKYPE_PROTONAME;
+ gcd.iType = GC_EVENT_CONTROL;
+ gcd.ptszID = dbv.ptszVal;
KillChatSession(&gcd);
db_free(&dbv);
}
diff --git a/protocols/SkypeClassic/src/gchat.h b/protocols/SkypeClassic/src/gchat.h index 91dcef43f4..82648c3e20 100644 --- a/protocols/SkypeClassic/src/gchat.h +++ b/protocols/SkypeClassic/src/gchat.h @@ -11,6 +11,11 @@ #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];
@@ -44,4 +49,4 @@ INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM lParam); INT_PTR GCOnJoinChat(WPARAM wParam,LPARAM lParam);
void GCInit(void);
void GCExit(void);
-void SetChatTopic (const TCHAR *szChatId, TCHAR *szTopic, BOOL bSet);
+void SetChatTopic (TCHAR *szChatId, TCHAR *szTopic, BOOL bSet);
diff --git a/protocols/SkypeClassic/src/ng-compat/m_core.h b/protocols/SkypeClassic/src/ng-compat/m_core.h new file mode 100644 index 0000000000..9777eeb479 --- /dev/null +++ b/protocols/SkypeClassic/src/ng-compat/m_core.h @@ -0,0 +1,52 @@ +#define IS_MIRANDAIM + +typedef HANDLE MCONTACT; + +#define db_get_ws DBGetContactSettingWString +#define db_free DBFreeVariant +#define db_get_b DBGetContactSettingByte +#define db_get_s DBGetContactSettingString +#define db_get_ts DBGetContactSettingTString +#define db_set_s DBWriteContactSettingString +#define db_set_b DBWriteContactSettingByte +#define db_get_w DBGetContactSettingWord +#define db_set_w DBWriteContactSettingWord +#define db_set_ts DBWriteContactSettingTString +#define db_get_dw DBGetContactSettingDword +#define db_set_dw DBWriteContactSettingDword +#define db_set_utf SkypeDBWriteContactSettingUTF8String +#define db_set_ws DBWriteContactSettingWString + + +#define Menu_AddContactMenuItem(mi) (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)mi) +#define Menu_AddMainMenuItem(mi) (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)NULL,(LPARAM)mi) + +#define db_find_first() (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0) +#define db_find_next(hContact) (HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0) +#define db_event_getContact(hContact) (HANDLE)CallService (MS_DB_EVENT_GETCONTACT, (WPARAM)hContact, 0) +#define db_event_delete(hContact,hEvent) CallService (MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)hEvent) +#define db_event_first(hContact) (HANDLE)CallService(MS_DB_EVENT_FINDFIRST,(WPARAM)hContact,0) +#define db_event_get(hDbEvent,dbei) CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)dbei) +#define db_event_last(hContact) (HANDLE)CallService(MS_DB_EVENT_FINDLAST,(WPARAM)hContact,0) +#define db_event_add(hContact,dbei) (HANDLE)CallServiceSync(MS_DB_EVENT_ADD, (WPARAM)(HANDLE)hContact, (LPARAM)dbei) +#define db_event_firstUnread(hContact) (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0) +#define db_event_markRead(hContact,hDbEvent) CallService(MS_DB_EVENT_MARKREAD,(WPARAM)hContact,(LPARAM)hDbEvent) +#define db_event_getBlobSize(hEvent) CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hEvent, 0) +#define db_mc_isSub(hContact) DBGetContactSettingByte(hContact, "MetaContacts", "IsSubcontact", 0) +#define db_event_next(hContact,hDbEvent) (HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0) + +#define Thread_Push(a,b) CallService(MS_SYSTEM_THREAD_PUSH, a, b) +#define Thread_Pop() CallService(MS_SYSTEM_THREAD_POP, 0, 0); + +#define GetContactProto(hContact) (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ) + +#define Options_AddPage(h,odp) CallService(MS_OPT_ADDPAGE, h, (LPARAM)odp); +#define UserInfo_AddPage(h,odp) CallService(MS_USERINFO_ADDPAGE, h, (LPARAM)odp); + +#define _A2T(x) x +#define _T2A(x) x +#define SIZEOF(x) sizeof(x)/sizeof(x[0]) +#define GSMDF_TCHAR GCMDF_TCHAR + +// Write contact setting as UTF-8 for convenience, if possible. Older Miranda IM versions will store it as ANSI +INT_PTR SkypeDBWriteContactSettingUTF8String(HANDLE hContact,const char *szModule,const char *szSetting,const char *val); diff --git a/protocols/SkypeClassic/src/ng-compat/stdver.h b/protocols/SkypeClassic/src/ng-compat/stdver.h new file mode 100644 index 0000000000..4e233c2d6e --- /dev/null +++ b/protocols/SkypeClassic/src/ng-compat/stdver.h @@ -0,0 +1,9 @@ +#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM +#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM + +#define __STRINGIFY_IMPL(x) #x +#define __STRINGIFY(x) __STRINGIFY_IMPL(x) + +#define __VERSION_DWORD PLUGIN_MAKE_VERSION(__MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM) +#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING) +#define __VERSION_STRING_DOTS __STRINGIFY(__FILEVERSION_DOTS) diff --git a/protocols/SkypeClassic/src/sdk/m_chat.h b/protocols/SkypeClassic/src/sdk/m_chat.h new file mode 100644 index 0000000000..7eec607b62 --- /dev/null +++ b/protocols/SkypeClassic/src/sdk/m_chat.h @@ -0,0 +1,635 @@ +/* +Chat module plugin for Miranda IM + +Copyright (C) 2003 Jörgen Persson + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + + +/* + This plugin provides event driven chat rooms for protocols that wish to use it. + It is built for IRC, which I also develop and is naturally biased towards IRC, + but it should work very well with other protocols too. I will try to explain as + careful as possible in this document how to use chat.dll + + -- General guidelines -- + + There is ONE rule a protocol MUST follow to use this: + + 1. Do NOT touch hContacts that has a byte "ChatRoom" set to ANYTHING other than 0! (Could be 1, 2, 3, ...) + This is because chat.dll adds contacts to the clist using the protocol name + supplied by the protocol. But this will naturally not work well if the + protocol also tampers with the contacts. The value of the BYTE indicates which type of + window/contact it is (see the GCW_* flags below). There is two exceptions to this rule: + + * You should continue to handle the right click menu items of these + contacts as usual, by hooking the menu prebuild hook etc. Chat.dll can not + handle this in an efficient manner! + + * You should also handle when the user deletes the contact/room from the + contact list, as the protocol will then most likely have to send some message + to the server that the user has left the room. + + NOTE. Chat keeps its own copies of strings passed. + + + * * Example of implementing this rule * *: + * * This is a code snippet that is common in protocols * *: + + + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + while (hContact) + { + szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); + if (szProto != NULL && !lstrcmpi(szProto, PROTONAME)) + { + ... do something with the hContact here; + } + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + + + + * * You should do this instead * *: + + + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + while (hContact) + { + szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); + if (szProto != NULL && !lstrcmpi(szProto, PROTONAME)) + { + if (DBGetContactSettingByte(hContact, PROTONAME, "ChatRoom", 0) == 0) + { + ... do something with the hContact here; + } + } + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + + + There is not more to it than that! To recapitulate: do NOT touch contacts where the + BYTE "ChatRoom" is set to anything other than 0, + + + + + + + OK, enough of the precautions, HOW DO YOU USE CHAT? In short you need to do FOUR things: + + 1. REGISTER your protocol with Chat + Only registered protocols can use Chat + + 2. CREATE SESSIONS when your protocol are joining a group chat room. (One per room joined) + These sessions will be put on the contact-list and are managed totally by chat. + This is the reason you must obey to the "precautions" I mentioned above. + Do not tamper directly with Chat's hContacts. Use Services provided by Chat instead. + + 3. SEND EVENTS to the sessions created in #3. + These events reflect users joining/leaving/speaking etc. + + 4. DESTROY SESSIONS when the user leaves the room (ie the session is not needed anymore). + + These four points are implemented in three services: MS_GC_REGISTER, MS_GC_NEWSESSION + and MS_GC_EVENT. +*/ + + +//------------------------- SERVICES ------------------------ +/* + Step 1. -- REGISTER with Chat -- + + The first thing that a protocol need to do is register with Chat. This is best done + when ALL modules has loaded (ME_SYSTEM_MODULESLOADED). The registration is + needed to make sure that the protocol obey rule 1 mentioned above, but also to + set protocol specific preferences. + + * Use MS_GC_REGISTER like this: CallService(MS_GC_REGISTER, 0, (LPARAM)(GCREGISTER *) &gcr; + + * returns 0 on success or error code on failure. +*/ + +// Flags +#define GC_BOLD 0x0001 // enable the 'bold' button +#define GC_ITALICS 0x0002 // enable the 'italics' button +#define GC_UNDERLINE 0x0004 // enable the 'underline' button +#define GC_COLOR 0x0008 // enable the 'foreground color' button +#define GC_BKGCOLOR 0x0010 // enable the 'background color' button +#define GC_ACKMSG 0x0020 // the protocol must acknowlege messages sent +#define GC_TYPNOTIF 0x0040 // enable typing notifications. +#define GC_CHANMGR 0x0080 // enable the 'channel settings' button +#define GC_SINGLEFORMAT 0x0100 // the protocol supports only 1 formatting per message +#define GC_FONTSIZE 0x0200 // enable font size selection + +// Error messages +#define GC_REGISTER_WRONGVER 1 // You appear to be using the wrong version of this API. Registration failed. +#define GC_REGISTER_ERROR 2 // An internal error occurred. Registration failed. +#define GC_REGISTER_NOUNICODE 3 // MS_GC_REGISTER returns this error if the Unicode version of chat + // is not installed and GC_UNICODE is set. Registration failed + +// GCREGISTER struct +struct GCREGISTER +{ + int cbSize; // Set to sizeof(GCREGISTER); + DWORD dwFlags; // Use GC_* flags above to indicate features supported + LPCSTR pszModule; // This MUST be the protocol name as registered with Miranda IM + LPCTSTR ptszDispName; // This is the protocol's real name as it will be displayed to the user + int iMaxText; // Max message length the protocol supports. Will limit the typing area input. 0 = no limit + int nColors; // Number of colors in the colorchooser menu for the color buttons. Max = 100 + COLORREF* pColors; // pointer to the first item in a static COLORREF array containing the colors + // that should be showed in the colorchooser menu. + // ie: COLORREF crCols[nColors]; + // pColors = &crCols[0]; +}; + +#define MS_GC_REGISTER "GChat/Register" + +/* + Step 2. -- CREATE a new SESSION -- + + Create a new session (chat room) and set various settings related to it. + The chat room will not be shown to the user until the 'set up' phase is + completed and SESSION_INITDONE is sent. See the MS_GC_EVENT for that. + + * Use MS_GC_NEWSESSION like this: CallService(MS_GC_NEWSESSION, 0, (LPARAM)(GCSESSION *) &gcr; + + * returns 0 on success or error code on failure +*/ + + +// Session type +#define GCW_CHATROOM 1 // the session is a dedicated multi user chat room. ex "IRC channels". + // A hContact will be added for the session +#define GCW_SERVER 2 // the session is used as a network console. ex "IRC server window" + // A hContact will be added for the session, but it will default to being hidden (on the CList) +#define GCW_PRIVMESS 3 // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional + // support for adding more users etc. ex "MSN session". + +// Error messages +#define GC_NEWSESSION_WRONGVER 1 // You appear to be using the wrong version of this API. +#define GC_NEWSESSION_ERROR 2 // An internal error occurred. + +// GCSESSION structure +struct GCSESSION +{ + int cbSize; // set to sizeof(GCSESSION); + int iType; // Use one of the GCW_* flags above to set the type of session + LPCSTR pszModule; // The name of the protocol owning the session (the same as pszModule when you register) + LPCTSTR ptszName; // The name of the session as it will be displayed to the user + LPCTSTR ptszID; // The unique identifier for the session. + LPCTSTR ptszStatusbarText; // Optional text to set in the statusbar of the chat room window, or NULL. + DWORD dwFlags; + INT_PTR dwItemData; // Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event +}; + +#define MS_GC_NEWSESSION "GChat/NewChat" + +/* + Step 3 -- SEND an EVENT -- + + Events is what drives Chat! After having created the session in Step 2 + it is time to make it work for real. Follow these guidelines: + + 1. Start off by telling Chat what possible statuses a user can have (in the nicklist) + by sending GC_EVENT_ADDGROUP as many times as needed. Also supply an icon + to go with this status. Ex "Voice status" on IRC + + 2.Then send "JOIN" events (GC_EVENT_JOIN) to populate the user list. + You will need to send one event per user that should be added. As long as + SESSION_INITDONE has not been sent these events will not show up in the log. + + 3.When you are done with filling the user list it is a good time to end + the set up phase and make the window visible by calling GC_EVENT_CONTROL event + with wParam = SESSION_INITDONE. + + 4.You will also want to send a GC_EVENT_CONTROL with wParam = SESSION_ONLINE to + make the statusbar and the CList item go to "online" status + + You have now set up the session and made it active. A CList hContact has been added + to the contact list and a chat room window is associated to the session. Send EVENTS to + Chat users speaking, users joining and so on. See below for full + list of what events are possible. + + IMPORTANT: For sending events you'll use the GCEVENT and GCDEST structures. A GCDEST + structure pointer is passed inside GCEVENT and it tells Chat what event type it is + and what session it is related to. The GCDEST structure and its members are ALWAYS + used (but the members can be NULL in some occasions). Depending on what type of event + you are sending, the members of GCEVENT have different usage. Each event and how to + use the members are discussed below. The "AddToLog" and "time" members are always valid + and always mean the same. bAddToLog = TRUE means that the event is added to the disk log + (at least when this makes sense). This can be used by Jabber for instance, when + it needs to add channel history to the window, but without logging to disk. + The "time" member is the timestamp of the event.(Tip. use the function time(NULL) + to set the current time) + + NOTE. It is possible to send formatted text (bold, italics, underlined, foreground color + and background color) to Chat by using the following identifiers in the text (pszText): + + %cXX - set the foreground color ( XX is the zero based decimal index of the color registered in MS_GC_REGISTER.. Always use two digits ) + %C - reset foreground color to default + %fXX - set the background color ( XX is the zero based decimal index of the color registered in MS_GC_REGISTER.. Always use two digits ) + %F - reset the background color to default + %b - enable bold + %B - disable bold + %u - enable underlined + %U - disable underlined + %i - enable italics + %I - disable italics + %r - reset all to default + %% - escape the formatting. Translates to % + + IMPORTANT. If you have specified GC_COLOR or GC_BKGCOLOR when you registered you can expect to + get these identifiers in the text you receive from Chat as well. Make sure % is ALWAYS + translated to %% in text you send to Chat to avoid accidental formatting. + NOTE. You will not get %cRRRGGGBBB back, instead you will get the index of the colour as + registered with GC_REGISTER. Eg %c3 (the fourth colour of your index) + + * Use MS_GC_EVENT like this: CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce; + + * returns 0 on success or error code on failure + +*/ + +// * List of possible events to send to Chat. Unlisted members are not valid * +// * for the event. Listed members are mandatory unless otherwise specified * + + +// GC_EVENT_JOIN - "<pszNick> has joined" (A user is joining the session) +// pszNick - Display name +// pszUID - Unique identifier of the user +// pszStatus - Which status does the user have. Should be a status previously +// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC +// bIsMe - Set to TRUE if it is the Miranda user +// Chat needs to know which user in the userlist that is "self" +// It cannot highlight a message containing the "own" nick without this info +// NOTE. if time == NULL, then the event will not be shown in the message log +#define GC_EVENT_JOIN 0x0001 + +// GC_EVENT_PART - "<pszNick> has left: <pszText>" (A user left the session) +// pszNick - Display name +// pszUID - Unique identifier +// pszText - Optional part message, can be NULL +#define GC_EVENT_PART 0x0002 + +// GC_EVENT_QUIT - "<pszNick> disconnected: pszText" (A user disconnected from the network) +// pszID(in GCDEST) - Should be NULL as a disconnect event is global. +// pszNick - Display name +// pszUID - Unique identifier +// pszText - Optional disconnect message, can be NULL +#define GC_EVENT_QUIT 0x0004 + +// GC_EVENT_KICK - "<pszStatus> kicked <pszNick>: <pszText>" (A user is kicking another user from the room) +// pszNick - Display name of the one being being kicked +// pszUID - Unique identifier of the one being kicked +// pszStatus - Name of user who is doing the kicking +// pszText - Optional kick message, can be NULL +#define GC_EVENT_KICK 0x0008 + +// GC_EVENT_NICK - "<pszNick> is now known as <pszText>" (A user changed his name) +// NOTE, see GC_EVENT_CHUID also +// pszID(in GCDEST) - Should be NULL as a nick change event is global. +// pszNick - Old display name +// pszUID - Unique identifier +// pszText - New display name of the user. Color codes are not valid +#define GC_EVENT_NICK 0x0010 + +// GC_EVENT_NOTICE - "Notice from <pszNick>: <pszText>" (An IRC type notice) +// pszID(in GCDEST) - Should be NULL to send to the active window +// pszNick - Display name +// pszUID - Unique identifier +// pszText - Notice text +#define GC_EVENT_NOTICE 0x0020 + +// GC_EVENT_MESSAGE - "<pszNick>: <pszText> (A user is speaking) +// pszNick - Display name +// pszUID - Unique identifier +// bIsMe - Set to TRUE if it is the Miranda user +// pszText - Message text. +#define GC_EVENT_MESSAGE 0x0040 + +// GC_EVENT_TOPIC - "Topic is <pszText> (Set by: <pszNick>" (The room topic was changed/set) +// pszNick - Optional display name of who set the topic, can be NULL +// pszUID - Optional unique identifier of who set the topic, can be NULL +// pszText - Topic text +#define GC_EVENT_TOPIC 0x0080 + +// GC_EVENT_INFORMATION (Informational text) Ex a server response to a /WHO command in IRC +// pszID(in GCDEST) - NULL to send to the active window +// pszText - Information text +#define GC_EVENT_INFORMATION 0x0100 + +// GC_EVENT_ACTION - "<pszNick> <pszText>" (An IRC Style action event) +// pszNick - Display name +// pszUID - Unique identifier +// bIsMe - Set to TRUE if it is the Miranda user +// pszText - Message text. +#define GC_EVENT_ACTION 0x0200 + +// GC_EVENT_ADDSTATUS - "<pszText> enables '<pszStatus>' for <pszNick>" (A status change has occured for a user) +// NOTE. Status changes are cumulative. The user will show in the nicklist with the highest status received. +// Ex, IRC users can have "Op" and "Voice" statuses simultaneously but s/he will be displayed as "Op" +// pszNick - Display name of the one who receives a new status +// pszUID - Unique identifier of the one who receives a new status +// pszText - The display name of the one who is setting the status. Color codes are not valid +// pszStatus - The status. Should be a status previously +// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC +#define GC_EVENT_ADDSTATUS 0x0400 + +// GC_EVENT_REMOVESTATUS - "<pszText> disables '<pszStatus>' for <pszNick>" (A status change has occured for a user) +// NOTE. Status changes are cumulative. The user will show in the nicklist with the highest status received. +// Ex, IRC users can have "Op" and "Voice" statuses simultaneously but s/he will be displayed as "Op" +// pszNick - Display name of the one who got a status mode disabled +// pszUID - Unique identifier of the one who got a status mode disabled +// pszText - The display name of the one disabling the status. Color codes are not valid +// pszStatus - The status. Should be a status previously +// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC +#define GC_EVENT_REMOVESTATUS 0x0800 + +// GC_EVENT_CHUID - not shown in the log (Change the unique identifier of a contact) +// pszID(in GCDEST) - Should be NULL as a unique id's are global. +// pszUID - The current unique identifier +// pszText - The new unique identifier. Color codes are not valid +#define GC_EVENT_CHUID 0x1000 + +// GC_EVENT_CHANGESESSIONAME - not shown in the log (Change the display name of a session) +// pszText - The new name. Color codes are not valid +#define GC_EVENT_CHANGESESSIONAME 0x1001 + +// GC_EVENT_ADDGROUP - not shown in the log (Add a possible status mode to the nicklist, ex IRC uses "Op", "Voice", "Normal" etc ) +// NOTE. When adding several statuses, start with the highest status +// pszStatus - The new group name +// dwItemData - Optional HICON handle to a 10x10 icon. Set to NULL to use the built in icons. +#define GC_EVENT_ADDGROUP 0x1002 + +// GC_EVENT_SETITEMDATA & GC_EVENT_SETITEMDATA - not shown in the log (Get/Set the user defined data of a session) +// dwItemData - The itemdata to set or get +#define GC_EVENT_SETITEMDATA 0x1003 +#define GC_EVENT_GETITEMDATA 0x1004 + +// GC_EVENT_SETSBTEXT - not shown in the log (Set the text of the statusbar for a chat room window) +// pszText - Statusbar text. Color codes are not valid +#define GC_EVENT_SETSBTEXT 0x1006 + +// GC_EVENT_ACK - not shown in the log (Acknowledge a outgoing message, when GC_ACKMSG is set +#define GC_EVENT_ACK 0x1007 + +// GC_EVENT_SENDMESSAGE - not shown in the log ("Fake" a message from a chat room as if the user had typed it). Used by IRC to broadcast /AME and /AMSG messages +// pszText - The text +#define GC_EVENT_SENDMESSAGE 0x1008 + +// GC_EVENT_SETSTATUSEX - not shown in the log (Space or tab delimited list of pszUID's to indicate as away). +// Used by IRC to mark users as away in the nicklist. If UIDs can contain spaces, use tabs +// pszText - Space or tab delimited list of pszUID's + +#define GC_SSE_ONLYLISTED 0x0001 // processes only listed contacts, resets all contacts otherwise +#define GC_SSE_ONLINE 0x0002 // displays a contact online, otherwise away +#define GC_SSE_TABDELIMITED 0x0004 // use tabs as delimiters +#define GC_SSE_OFFLINE 0x0008 // displays a contact offline, otherwise away + +#define GC_EVENT_SETSTATUSEX 0x1009 + +// GC_EVENT_SETCONTACTSTATUS - sets status icon for contact +// pszUID - Unique identifier of the one who receives a new status +// dwItemData - (DWORD)ID_STATUS_* or zero to remove status icon +#define GC_EVENT_SETCONTACTSTATUS 0x100A + +// GC_EVENT_CONTROL - not shown in the log (Control window associated to a session and the session itself) +// NOTE 1: No members of GCEVENT are used, send one of the below flags in wParam instead, +// Ex CallService(GC_EVENT_CONTROL, SESSION_INITDONE, (LPARAM)&gce); +// NOTE 2: The first four control events are the only ones you should use most likely! +// The ones below them are used by IRC to join channels hidden or maximized and show the server window from the system menu. +// The SESSION_VISIBLE, SESSION_HIDDEN, SESSION_MAXIMIZE and SESSION_MINIMIZE events CAN replace SESSION_INITDONE but I urge you not to +// do that as it will override any settings the user has made in the Chat options +// NOTE 3: If pszID (of GCDEST) = NULL then this message will be broadcasted to all sessions, which can be usefule for terminating +// all sessions when the protocol was disconnected +#define SESSION_INITDONE 1 // send this when the session is fully set up (all users have ben added to the nicklist) +#define SESSION_TERMINATE 7 // send to terminate a session and close the window associated with it +#define SESSION_OFFLINE 8 // send to set the session as "online" (hContact is set to Online etc) +#define SESSION_ONLINE 9 // send to set the session as "offline" (hContact is set to Offline etc) + +#define WINDOW_VISIBLE 2 // make the room window visible +#define WINDOW_HIDDEN 3 // close the room window. Session is not terminated. +#define WINDOW_MAXIMIZE 4 // make the room window maximized +#define WINDOW_MINIMIZE 5 // make the room window minimized +#define WINDOW_CLEARLOG 6 // clear the log of the room window + +#define GC_EVENT_CONTROL 0x1005 + +// Error messages +#define GC_EVENT_WRONGVER 1 // You appear to be using the wrong version of this API. +#define GC_EVENT_ERROR 2 // An internal error occurred. + +// The GCDEST structure. It is passed to Chat inside GCEVENT. +struct GCDEST +{ + LPCSTR pszModule; // Name of the protocol (same as you registered with) + LPCTSTR ptszID; // Unique identifier of the session, or NULL to broadcast to all sessions as specified above + int iType; // Use GC_EVENT_* as defined above. Only one event per service call. +}; + +// The GCEVENT structure +struct GCEVENT +{ + int cbSize; // set to sizeof(GCEVENT); + GCDEST *pDest; // pointer to a GCDEST structure which specifies the session to receive the event + LPCTSTR ptszText; // + LPCTSTR ptszNick; // + LPCTSTR ptszUID; // + LPCTSTR ptszStatus; // + LPCTSTR ptszUserInfo; // + + BOOL bIsMe; // Is this event from the Miranda user? + DWORD dwFlags; // event flags: GCEF_ADDTOLOG, GCEF_NOTNOTIFY + + INT_PTR dwItemData; // User specified data. + DWORD time; // Timestamp of the event +}; + +#define MS_GC_EVENT "GChat/NewEvent" + +// This hook is fired when MS_GC_EVENT is called, with the same wParam and lParam as above. +// It allows external plugins to intercept chat events and display then in other ways +#define ME_GC_HOOK_EVENT "GChat/HookEvent" + +#define GCEF_ADDTOLOG 0x0001 +#define GCEF_REMOVECONTACT 0x0002 +// Added in Miranda NG 0.94.4+ +#define GCEF_NOTNOTIFY 0x0004 + +// OK! That was about everything that you need to know about for operating Chat in a basic way. +// There are however some more things you will need to know about. Some you may use and some you may not need, + +/* + -- GETTING info about a SESSION or session data -- + + Use this service to get information on different aspects of the sessions that are registered with Chat. + + * Use MS_GC_GETINFO like this: CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)(char *) pszModule); + * returns -1 on failure and the sessioncount on success +*/ + +#define MS_GC_GETSESSIONCOUNT "GChat/GetCount" + +/* + -- GETTING info about a SESSION or session data -- + Use this service to get information on different aspects of the sessions that are registered with Chat. + + * Use MS_GC_GETINFO like this: CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci; + * returns 0 on success or error code on failure +*/ + +// Flags +#define GCF_BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get +#define GCF_BYID 0x0002 // pszID is valid and should contain the ID of the session to get. This is the default if no +#define GCF_HCONTACT 0x0004 // hContact is valid +#define GCF_DATA 0x0008 // wItemData is valid +#define GCF_ID 0x0010 // pszID is valid. +#define GCF_NAME 0x0020 // pszName is valid +#define GCF_TYPE 0x0040 // iType is valid +#define GCF_COUNT 0x0080 // iCount is valid +#define GCF_USERS 0x0100 // pszUsers is valid + +// The GC_INFO structure +struct GC_INFO +{ + DWORD Flags; // use a combination of the above flags + int iItem; // session type (GCW_*) + int iType; // session type (GCW_*) + LPCSTR pszModule; // the module name as registered in MS_GC_REGISTER + LPCTSTR pszID; // unique ID of the session + LPTSTR pszName; // display name of the session + INT_PTR dwItemData; // user specified data. + int iCount; // count of users in the nicklist + LPSTR pszUsers; // space separated string containing the UID's of the users in the user list. + // NOTE. Use Mirandas mmi_free() on the returned string. + MCONTACT hContact; // hContact for the session (can be NULL) +}; + +#define MS_GC_GETINFO "GChat/GetInfo" + +//------------------------- HOOKS ------------------------ +/* + -- user interaction -- + Hook this to receive notifications about when user take actions in a chat room window. + Check for the below flags to find out what type of user interaction it is. See the + to find out which members of GCHOOK that are valid. + + * wParam=0 + * lParam=(LPARAM)(GCEVENT *)pgch + + * Returning nonzero from your hook will stop other hooks from being called. +*/ + +#define GC_USER_MESSAGE 1 // user sent a message, with \n delimiting lines, pszText contains the text. +#define GC_USER_CHANMGR 2 // user clicked the settings button in a chat room +#define GC_USER_LOGMENU 3 // user has selected a message log menu item, dwData is valid. See ME_GC_BUILDMENU +#define GC_USER_NICKLISTMENU 4 // user has selected a userlist menu item, valid members: dwData. See ME_GC_BUILDMENU +#define GC_USER_TYPNOTIFY 5 // NOT IMPLEMENTED YET! user is typing +#define GC_USER_PRIVMESS 6 // user requests to send a private message to a user. pszUID is valid +#define GC_SESSION_TERMINATE 7 // the session is about to be terminated, the "user defined data" is passed in dwData, which can be good free'ing any allocated memory. +#define GC_USER_LEAVE 8 // user requests to leave the session +#define GC_USER_CLOSEWND 9 // user closed the window (this is usually not an indication that the protocol + // should take action, but MSN may want to terminate the session here) +#define ME_GC_EVENT "GChat/OutgoingEvent" + +struct GCHOOK +{ + GCDEST *pDest; // pointer to a GCDEST structure which specifies from which session the hook was triggered + LPTSTR ptszText; // usage depends on type of event + LPTSTR ptszUID; // unique identifier, usage depends on type of event + INT_PTR dwData; // user defined data, usage depends on type of event +}; + +/* + -- Build the pop up menus -- + The user wants to show a right click (popup) menu and your protocol should tell what + items should be added to the menu. You should create a static array of struct gc_item's. + When you get this notification you should set "nItems" to the number of gc_item's + you want to show on the user's popup menu and then set the "Item" member to point to that array. + + * wParam=0 + * lParam=(LPARAM)(GCMENUITEM *)gcmi + + Returning nonzero from your hook will stop other hooks from being called. +*/ + +// type of item to add to the popup menu +#define MENU_NEWPOPUP 1 // add submenu +#define MENU_POPUPITEM 2 // add item to current submenu +#define MENU_POPUPSEPARATOR 3 // add separator to current submenu +#define MENU_SEPARATOR 4 // add separator to menu +#define MENU_ITEM 5 // add item +#define MENU_POPUPCHECK 6 // add checked item to current submenu +#define MENU_CHECK 7 // add checked item +#define MENU_POPUPHMENU 8 // add custom submenu to current submenu, use dwID to specify HMENU +#define MENU_HMENU 9 // add custom submenu, use dwID to specify HMENU + +// type of menu that is being requested +#define MENU_ON_LOG 1 // pop up menu on the message log +#define MENU_ON_NICKLIST 2 // pop up menu on the user list + +// contains info on a menuitem to be added +struct gc_item { + TCHAR *pszDesc; // Textual description of the menu item to add + DWORD dwID; // when/if the user selects this menu item this + // value will be returned via the above hook, GC_USER_LOGMENU + // or GC_USER_NICKLISTMENU. Must not be 0 and must be unique. + int uType; // What kind of menu item is it? Use MENU_* flags above + BOOL bDisabled; // should the menu item be shown as disabled +}; + +typedef struct { + LPSTR pszModule; // Contains the protocol name, do NOT change. + LPTSTR pszID; // The unique identifier of the session that triggered the hook, do NOT change. + LPTSTR pszUID; // Contains the unique identifier if Type = MENU_ON_NICKLIST. do NOT change. + int Type; // Type of menu. MENU_ON_* flags used. do NOT change. + int nItems; // Set this to the number of menu items you want to add + gc_item *Item; // pointer to the first in the array of gc_item's +} + GCMENUITEMS; + +#define ME_GC_BUILDMENU "GChat/BuildMenu" + +/* + * Example of how to add 2 items to the popup menu for the userlist * + + GCMENUITEMS *gcmi= (GCMENUITEMS*) lParam; + if (gcmi->Type == MENU_ON_NICKLIST) + { + static struct gc_item Item[] = { + {Translate("User &details"), 1, MENU_ITEM, FALSE}, + {Translate("&Op"), 2, MENU_POPUPITEM, FALSE}, + }; + + gcmi->nItems = sizeof(Item)/sizeof(Item[0]); + gcmi->Item = &Item[0]; + gcmi->Item[gcmi->nItems-1].bDisabled = bFlag; + + return 0; + } +*/ + +////////////////////////////////////////////////////////////////////////// +// Get Chat ToolTip Text for buddy +// wParam = (WPARAM)(TCHAR*) roomID parentdat->ptszID +// lParam = (WPARAM)(TCHAR*) userID ui1->pszUID +// result (int)(TCHAR*)mir_tstrdup("tooltip text") +// returns pointer to text of tooltip and starts owns it +#define MS_GC_PROTO_GETTOOLTIPTEXT "/GetChatToolTipText" diff --git a/protocols/SkypeClassic/src/sdk/m_folders.h b/protocols/SkypeClassic/src/sdk/m_folders.h new file mode 100644 index 0000000000..e139d7566e --- /dev/null +++ b/protocols/SkypeClassic/src/sdk/m_folders.h @@ -0,0 +1,207 @@ +/* +Custom profile folders plugin for Miranda IM + +Copyright © 2005 Cristian Libotean + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef M_CUSTOM_FOLDERS_H +#define M_CUSTOM_FOLDERS_H + +#define FOLDERS_API 501 //dunno why it's here but it is :) + +#define PROFILE_PATH "%profile_path%" +#define CURRENT_PROFILE "%current_profile%" +#define MIRANDA_PATH "%miranda_path%" +#define PLUGINS_PATH "%miranda_path%" "\\plugins" + +#define TO_WIDE(x) L ## x + +#define PROFILE_PATHW L"%profile_path%" +#define CURRENT_PROFILEW L"%current_profile%" +#define MIRANDA_PATHW L"%miranda_path%" + +#define FOLDER_AVATARS PROFILE_PATH "\\" CURRENT_PROFILE "\\avatars" +#define FOLDER_VCARDS PROFILE_PATH "\\" CURRENT_PROFILE "\\vcards" +#define FOLDER_LOGS PROFILE_PATH "\\" CURRENT_PROFILE "\\logs" +#define FOLDER_RECEIVED_FILES PROFILE_PATH "\\" CURRENT_PROFILE "\\received files" +#define FOLDER_DOCS MIRANDA_PATH "\\" "docs" + +#define FOLDER_CONFIG PLUGINS_PATH "\\" "config" + +#define FOLDER_SCRIPTS MIRANDA_PATH "\\" "scripts" + +#define FOLDER_UPDATES MIRANDA_PATH "\\" "updates" + +#define FOLDER_CUSTOMIZE MIRANDA_PATH "\\" "customize" +#define FOLDER_CUSTOMIZE_SOUNDS FOLDER_CUSTOMIZE "\\sounds" +#define FOLDER_CUSTOMIZE_ICONS FOLDER_CUSTOMIZE "\\icons" +#define FOLDER_CUSTOMIZE_SMILEYS FOLDER_CUSTOMIZE "\\smileys" +#define FOLDER_CUSTOMIZE_SKINS FOLDER_CUSTOMIZE "\\skins" +#define FOLDER_CUSTOMIZE_THEMES FOLDER_CUSTOMIZE "\\themes" + + +#define FOLDERS_NAME_MAX_SIZE 64 //maximum name and section size + +#define FF_UNICODE 0x00000001 + +typedef struct{ + int cbSize; //size of struct + char szSection[FOLDERS_NAME_MAX_SIZE]; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it + char szName[FOLDERS_NAME_MAX_SIZE]; //entry name - will be shown in options + union{ + const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later. + const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly. + const TCHAR *szFormatT; + }; + DWORD flags; //FF_* flags +} FOLDERSDATA; + +/*Folders/Register/Path service + wParam - not used, must be 0 + lParam - (LPARAM) (const FOLDERDATA *) - Data structure filled with + the necessary information. + Returns a handle to the registered path or 0 on error. + You need to use this to call the other services. +*/ +#define MS_FOLDERS_REGISTER_PATH "Folders/Register/Path" + +/*Folders/Get/PathSize service + wParam - (WPARAM) (int) - handle to registered path + lParam - (LPARAM) (int *) - pointer to the variable that receives the size of the path + string (not including the null character). Depending on the flags set when creating the path + it will either call strlen() or wcslen() to get the length of the string. + Returns the size of the buffer. +*/ +#define MS_FOLDERS_GET_SIZE "Folders/Get/PathSize" + +typedef struct{ + int cbSize; + int nMaxPathSize; //maximum size of buffer. This represents the number of characters that can be copied to it (so for unicode strings you don't send the number of bytes but the length of the string). + union{ + char *szPath; //pointer to the buffer that receives the path without the last "\\" + wchar_t *szPathW; //unicode version of the buffer. + TCHAR *szPathT; + }; +} FOLDERSGETDATA; + +/*Folders/Get/Path service + wParam - (WPARAM) (int) - handle to registered path + lParam - (LPARAM) (FOLDERSGETDATA *) pointer to a FOLDERSGETDATA that has all the relevant fields filled. + Should return 0 on success, or nonzero otherwise. +*/ +#define MS_FOLDERS_GET_PATH "Folders/Get/Path" + +typedef struct{ + int cbSize; + union{ + char **szPath; //address of a string variable (char *) or (wchar_t*) where the path should be stored (the last \ won't be copied). + wchar_t **szPathW; //unicode version of string. + TCHAR **szPathT; + }; +} FOLDERSGETALLOCDATA; + +/*Folders/GetRelativePath/Alloc service + wParam - (WPARAM) (int) - Handle to registered path + lParam - (LPARAM) (FOLDERSALLOCDATA *) data + This service is the same as MS_FOLDERS_GET_PATH with the difference that this service + allocates the needed space for the buffer. It uses miranda's memory functions for that and you need + to use those to free the resulting buffer. + Should return 0 on success, or nonzero otherwise. Currently it only returns 0. +*/ +#define MS_FOLDERS_GET_PATH_ALLOC "Folders/Get/Path/Alloc" + + +/*Folders/On/Path/Changed + wParam - (WPARAM) 0 + lParam - (LPARAM) 0 + Triggered when the folders change, you should reget the paths you registered. +*/ +#define ME_FOLDERS_PATH_CHANGED "Folders/On/Path/Changed" + +#ifndef FOLDERS_NO_HELPER_FUNCTIONS +//#include "../../../include/newpluginapi.h" + +__inline static int FoldersRegisterCustomPath(const char *section, const char *name, const char *defaultPath) +{ + FOLDERSDATA fd = {0}; + if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 1; + fd.cbSize = sizeof(FOLDERSDATA); + strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE); + fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; + strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE); + fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; + fd.szFormat = defaultPath; + return CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd); +} + +__inline static int FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW) +{ + FOLDERSDATA fd = {0}; + if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 1; + fd.cbSize = sizeof(FOLDERSDATA); + strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE); + fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated + strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE); + fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated + fd.szFormatW = defaultPathW; + fd.flags = FF_UNICODE; + return CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd); +} + +__inline static int FoldersGetCustomPath(HANDLE hFolderEntry, char *path, const int size, char *notFound) +{ + FOLDERSGETDATA fgd = {0}; + int res; + fgd.cbSize = sizeof(FOLDERSGETDATA); + fgd.nMaxPathSize = size; + fgd.szPath = path; + res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd); + if (res) + { + strncpy(path, notFound, size); + path[size - 1] = '\0'; //make sure it's NULL terminated + } + return res; +} + +__inline static int FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int count, wchar_t *notFoundW) +{ + FOLDERSGETDATA fgd = {0}; + int res; + fgd.cbSize = sizeof(FOLDERSGETDATA); + fgd.nMaxPathSize = count; + fgd.szPathW = pathW; + res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd); + if (res) + { + wcsncpy(pathW, notFoundW, count); + pathW[count - 1] = '\0'; + } + return res; +} + +# ifdef _UNICODE +# define FoldersGetCustomPathT FoldersGetCustomPathW +# define FoldersRegisterCustomPathT FoldersRegisterCustomPathW +#else +# define FoldersGetCustomPathT FoldersGetCustomPath +# define FoldersRegisterCustomPathT FoldersRegisterCustomPath +#endif + +#endif + +#endif //M_CUSTOM_FOLDERS_H
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/sdk/m_metacontacts.h b/protocols/SkypeClassic/src/sdk/m_metacontacts.h new file mode 100644 index 0000000000..fe19c32d6a --- /dev/null +++ b/protocols/SkypeClassic/src/sdk/m_metacontacts.h @@ -0,0 +1,128 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright © 2004 Universite Louis PASTEUR, STRASBOURG. +Copyright © 2004 Scott Ellis (www.scottellis.com.au mail@scottellis.com.au) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef M_METACONTACTS_H__ +#define M_METACONTACTS_H__ 1 + +//gets the handle for the default contact +//wParam=(HANDLE)hMetaContact +//lParam=0 +//returns a handle to the default contact, or null on failure +#define MS_MC_GETDEFAULTCONTACT "MetaContacts/GetDefault" + +//gets the contact number for the default contact +//wParam=(HANDLE)hMetaContact +//lParam=0 +//returns a DWORD contact number, or -1 on failure +#define MS_MC_GETDEFAULTCONTACTNUM "MetaContacts/GetDefaultNum" + +//gets the handle for the 'most online' contact +//wParam=(HANDLE)hMetaContact +//lParam=0 +//returns a handle to the 'most online' contact +#define MS_MC_GETMOSTONLINECONTACT "MetaContacts/GetMostOnline" + +//gets the number of subcontacts for a metacontact +//wParam=(HANDLE)hMetaContact +//lParam=0 +//returns a DWORD representing the number of subcontacts for the given metacontact +#define MS_MC_GETNUMCONTACTS "MetaContacts/GetNumContacts" + +//gets the handle of a subcontact, using the subcontact's number +//wParam=(HANDLE)hMetaContact +//lParam=(DWORD)contact number +//returns a handle to the specified subcontact +#define MS_MC_GETSUBCONTACT "MetaContacts/GetSubContact" + +//sets the default contact, using the subcontact's contact number +//wParam=(HANDLE)hMetaContact +//lParam=(DWORD)contact number +//returns 0 on success +#define MS_MC_SETDEFAULTCONTACTNUM "MetaContacts/SetDefault" + +//sets the default contact, using the subcontact's handle +//wParam=(HANDLE)hMetaContact +//lParam=(HANDLE)hSubcontact +//returns 0 on success +#define MS_MC_SETDEFAULTCONTACT "MetaContacts/SetDefaultByHandle" + +//forces the metacontact to send using a specific subcontact, using the subcontact's contact number +//wParam=(HANDLE)hMetaContact +//lParam=(DWORD)contact number +//returns 0 on success +#define MS_MC_FORCESENDCONTACTNUM "MetaContacts/ForceSendContact" + +//forces the metacontact to send using a specific subcontact, using the subcontact's handle +//wParam=(HANDLE)hMetaContact +//lParam=(HANDLE)hSubcontact +//returns 0 on success (will fail if 'force default' is in effect) +#define MS_MC_FORCESENDCONTACT "MetaContacts/ForceSendContactByHandle" + +//'unforces' the metacontact to send using a specific subcontact +//wParam=(HANDLE)hMetaContact +//lParam=0 +//returns 0 on success (will fail if 'force default' is in effect) +#define MS_MC_UNFORCESENDCONTACT "MetaContacts/UnforceSendContact" + +//'forces' or 'unforces' (i.e. toggles) the metacontact to send using it's default contact +// overrides (and clears) 'force send' above, and will even force use of offline contacts +// will send ME_MC_FORCESEND or ME_MC_UNFORCESEND event +//wParam=(HANDLE)hMetaContact +//lParam=0 +//returns 1(true) or 0(false) representing new state of 'force default' +#define MS_MC_FORCEDEFAULT "MetaContacts/ForceSendDefault" + +// method to get state of 'force' for a metacontact +// wParam=(HANDLE)hMetaContact +// lParam= (DWORD)&contact_number or NULL +// +// if lparam supplied, the contact_number of the contatct 'in force' will be copied to the address it points to, +// or if none is in force, the value (DWORD)-1 will be copied +// (v0.8.0.8+ returns 1 if 'force default' is true with *lParam == default contact number, else returns 0 with *lParam as above) +#define MS_MC_GETFORCESTATE "MetaContacts/GetForceState" + +// fired when a metacontact's default contact changes (fired upon creation of metacontact also, when default is initially set) +// wParam=(HANDLE)hMetaContact +// lParam=(HANDLE)hDefaultContact +#define ME_MC_DEFAULTTCHANGED "MetaContacts/DefaultChanged" + +// fired when a metacontact's subcontacts change (fired upon creation of metacontact, when contacts are added or removed, and when +// contacts are reordered) - a signal to re-read metacontact data +// wParam=(HANDLE)hMetaContact +// lParam=0 +#define ME_MC_SUBCONTACTSCHANGED "MetaContacts/SubcontactsChanged" + +// fired when a metacontact is forced to send using a specific subcontact +// wParam=(HANDLE)hMetaContact +// lParam=(HANDLE)hForceContact +#define ME_MC_FORCESEND "MetaContacts/ForceSend" + +// fired when a metacontact is 'unforced' to send using a specific subcontact +// wParam=(HANDLE)hMetaContact +// lParam=0 +#define ME_MC_UNFORCESEND "MetaContacts/UnforceSend" + +// method to get protocol name - used to be sure you're dealing with a "real" metacontacts plugin :) +// wParam=lParam=0 +#define MS_MC_GETPROTOCOLNAME "MetaContacts/GetProtoName" + +#endif diff --git a/protocols/SkypeClassic/src/sdk/m_toptoolbar.h b/protocols/SkypeClassic/src/sdk/m_toptoolbar.h new file mode 100644 index 0000000000..8d0daafa04 --- /dev/null +++ b/protocols/SkypeClassic/src/sdk/m_toptoolbar.h @@ -0,0 +1,125 @@ + +#ifndef M_TOPTOOLBAR_H +#define M_TOPTOOLBAR_H + +//button flags +#define TTBBF_DISABLED 1 +#define TTBBF_VISIBLE 2 +#define TTBBF_PUSHED 4 +#define TTBBF_SHOWTOOLTIP 8 +#define TTBBF_DRAWBORDER 16//draw border for bitmap,bitmap must be WxH 16x12 +#define TTBBF_ISSEPARATOR 32 + +//for internal launch buttons +#define TTBBF_ISLBUTTON 64 + +typedef struct { + int cbSize; + HBITMAP hbBitmapUp; + HBITMAP hbBitmapDown; + char *pszServiceUp; + char *pszServiceDown; + DWORD dwFlags; + LPARAM lParamUp; + WPARAM wParamUp; + LPARAM lParamDown; + WPARAM wParamDown; + char *name; + +} TTBButton, * lpTTBButton; + +typedef struct { + int cbSize; + HBITMAP hbBitmapUp; + HBITMAP hbBitmapDown; + char *pszServiceUp; + char *pszServiceDown; + DWORD dwFlags; + LPARAM lParamUp; + WPARAM wParamUp; + LPARAM lParamDown; + WPARAM wParamDown; + char *name; + HICON hIconUp,hIconDn; + char *tooltipUp; + char *tooltipDn; + +} TTBButtonV2, * lpTTBButtonV2; + +//=== EVENTS === +/* +toptoolbar/moduleloaded event +wParam = lParam = 0 +Called when the toolbar services are available + +!!!Warning you may work with TTB services only in this event or later. + +*/ +#define ME_TTB_MODULELOADED "TopToolBar/ModuleLoaded" + + + +//=== SERVICES === +/* +toptoolbar/addbutton service +wparam = (TTBButton*)lpTTBButton +lparam = 0 +returns: hTTBButton - handle of added button on success, -1 on failure. +*/ +#define MS_TTB_ADDBUTTON "TopToolBar/AddButton" + +/* +toptoolbar/removebutton service +wparam = (HANDLE)hTTButton +lparam = 0 +returns: 0 on success, -1 on failure. +*/ +#define MS_TTB_REMOVEBUTTON "TopToolBar/RemoveButton" + +/* +toptoolbar/setstate service +wparam = (HANDLE)hTTButton +lparam = (LPARAM) state +returns: 0 on success, -1 on failure. +*/ +#define TTBST_PUSHED 1 +#define TTBST_RELEASED 2 + +#define MS_TTB_SETBUTTONSTATE "TopToolBar/SetState" + +/* +toptoolbar/getstate service +wparam = (HANDLE)hTTButton +lparam = 0 +returns: state on success, -1 on failure. +*/ +#define MS_TTB_GETBUTTONSTATE "TopToolBar/GetState" + +/* +toptoolbar/getoptions service +(HIWORD)wparam = (HANDLE)hTTButton +(LOWORD)wparam = TTBO_FLAG +lparam = 0,or lparam=lpTTBButton if flag=TTBO_ALLDATA +returns: value on success, -1 on failure. +*/ +#define TTBO_FLAGS 0 //get/set all flags +#define TTBO_POS 1 //position +#define TTBO_WIDTH 2 //not impemented +#define TTBO_HEIGHT 3 //not impemented +#define TTBO_TIPNAME 4 //tool tip name +#define TTBO_ALLDATA 5 //change all data via lparam=lpTTBButton + + +#define MS_TTB_GETBUTTONOPTIONS "TopToolBar/GetOptions" + +/* +toptoolbar/setoptions service +(HIWORD)wparam = (HANDLE)hTTButton +(LOWORD)wparam = TTBO_FLAG +lparam = value +returns: 1 on success, -1 on failure. +*/ +#define MS_TTB_SETBUTTONOPTIONS "TopToolBar/SetOptions" + + +#endif
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/sdk/m_updater.h b/protocols/SkypeClassic/src/sdk/m_updater.h new file mode 100644 index 0000000000..923017bdab --- /dev/null +++ b/protocols/SkypeClassic/src/sdk/m_updater.h @@ -0,0 +1,146 @@ +#ifndef _M_UPDATER_H +#define _M_UPDATER_H + +// NOTES: +// - For langpack updates, include a string of the following format in the langpack text file: +// ";FLID: <file listing name> <version>" +// version must be four numbers seperated by '.', in the range 0-255 inclusive +// - Updater will disable plugins that are downloaded but were not active prior to the update (this is so that, if an archive contains e.g. ansi and +// unicode versions, the correct plugin will be the only one active after the new version is installed)...so if you add a support plugin, you may need +// to install an ini file to make the plugin activate when miranda restarts after the update +// - Updater will replace all dlls that have the same internal shortName as a downloaded update dll (this is so that msn1.dll and msn2.dll, for example, +// will both be updated) - so if you have a unicode and a non-unicode version of a plugin in your archive, you should make the internal names different (which will break automatic +// updates from the file listing if there is only one file listing entry for both versions, unless you use the 'MS_UPDATE_REGISTER' service below) +// - Updater will install all files in the root of the archive into the plugins folder, except for langpack files that contain the FLID string which go into the root folder (same +// folder as miranda32.exe)...all folders in the archive will also be copied to miranda's root folder, and their contents transferred into the new folders. The only exception is a +// special folder called 'root_files' - if there is a folder by that name in the archive, it's contents will also be copied into miranda's root folder - this is intended to be used +// to install additional dlls etc that a plugin may require) + +// if you set Update.szUpdateURL to the following value when registering, as well as setting your beta site and version data, +// Updater will ignore szVersionURL and pbVersionPrefix, and attempt to find the file listing URL's from the backend XML data. +// for this to work, the plugin name in pluginInfo.shortName must match the file listing exactly (except for case) +#define UPDATER_AUTOREGISTER "UpdaterAUTOREGISTER" +// Updater will also use the backend xml data if you provide URL's that reference the miranda file listing for updates (so you can use that method +// if e.g. your plugin shortName does not match the file listing) - it will grab the file listing id from the end of these URLs + +typedef struct Update_tag { + int cbSize; + char *szComponentName; // component name as it will appear in the UI (will be translated before displaying) + + char *szVersionURL; // URL where the current version can be found (NULL to disable) + BYTE *pbVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data + // (note that this URL could point at a binary file - dunno why, but it could :) + int cpbVersionPrefix; // number of bytes pointed to by pbVersionPrefix + char *szUpdateURL; // URL where dll/zip is located + // set to UPDATER_AUTOREGISTER if you want Updater to find the file listing URLs (ensure plugin shortName matches file listing!) + + char *szBetaVersionURL; // URL where the beta version can be found (NULL to disable betas) + BYTE *pbBetaVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data + int cpbBetaVersionPrefix; // number of bytes pointed to by pbVersionPrefix + char *szBetaUpdateURL; // URL where dll/zip is located + + BYTE *pbVersion; // bytes of current version, used for comparison with those in VersionURL + int cpbVersion; // number of bytes pointed to by pbVersion + + char *szBetaChangelogURL; // url for displaying changelog for beta versions +} Update; + +// register a comonent with Updater +// +// wparam = 0 +// lparam = (LPARAM)&Update +#define MS_UPDATE_REGISTER "Update/Register" + +// utility functions to create a version string from a DWORD or from pluginInfo +// point buf at a buffer at least 16 chars wide - but note the version string returned may be shorter +// +__inline static char *CreateVersionString(DWORD version, char *buf) { + mir_snprintf(buf, 16, "%d.%d.%d.%d", (version >> 24) & 0xFF, (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF); + return buf; +} + +__inline static char *CreateVersionStringPlugin(PLUGININFO *pluginInfo, char *buf) { + return CreateVersionString(pluginInfo->version, buf); +} + + +// register the 'easy' way - use this method if you have no beta URL and the plugin is on the miranda file listing +// NOTE: the plugin version string on the file listing must be the string version of the version in pluginInfo (i.e. 0.0.0.1, +// four numbers between 0 and 255 inclusivem, so no letters, brackets, etc.) +// +// wParam = (int)fileID - this is the file ID from the file listing (i.e. the number at the end of the download link) +// lParam = (PLUGININFO*)&pluginInfo +#define MS_UPDATE_REGISTERFL "Update/RegisterFL" + +// this function can be used to 'unregister' components - useful for plugins that register non-plugin/langpack components and +// may need to change those components on the fly +// lParam = (char *)szComponentName +#define MS_UPDATE_UNREGISTER "Update/Unregister" + +// this event is fired when the startup process is complete, but NOT if a restart is imminent +// it is designed for status managment plugins to use as a trigger for beggining their own startup process +// wParam = lParam = 0 (unused) +// (added in version 0.1.6.0) +#define ME_UPDATE_STARTUPDONE "Update/StartupDone" + +// this service can be used to enable/disable Updater's global status control +// it can be called from the StartupDone event handler +// wParam = (BOOL)enable +// lParam = 0 +// (added in version 0.1.6.0) +#define MS_UPDATE_ENABLESTATUSCONTROL "Update/EnableStatusControl" + +// An description of usage of the above service and event: +// Say you are a status control plugin that normally sets protocol or global statuses in your ModulesLoaded event handler. +// In order to make yourself 'Updater compatible', you would move the status control code from ModulesLoaded to another function, +// say DoStartup. Then, in ModulesLoaded you would check for the existence of the MS_UPDATE_ENABLESTATUSCONTROL service. +// If it does not exist, call DoStartup. If it does exist, hook the ME_UPDATE_STARTUPDONE event and call DoStartup from there. You may +// also wish to call MS_UPDATE_ENABLESTATUSCONTROL with wParam == FALSE at this time, to disable Updater's own status control feature. + +// this service can be used to determine whether updates are possible for a component with the given name +// wParam = 0 +// lParam = (char *)szComponentName +// returns TRUE if updates are supported, FALSE otherwise +#define MS_UPDATE_ISUPDATESUPPORTED "Update/IsUpdateSupported" + +#endif + + +/////////////// Usage Example /////////////// + +#ifdef EXAMPLE_CODE + +// you need to #include "m_updater.h" and HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded) in your Load function... + +int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { + + Update update = {0}; // for c you'd use memset or ZeroMemory... + char szVersion[16]; + + update.cbSize = sizeof(Update); + + update.szComponentName = pluginInfo.shortName; + update.pbVersion = (BYTE *)CreateVersionString(&pluginInfo, szVersion); + update.cpbVersion = strlen((char *)update.pbVersion); + + // these are the three lines that matter - the archive, the page containing the version string, and the text (or data) + // before the version that we use to locate it on the page + // (note that if the update URL and the version URL point to standard file listing entries, the backend xml + // data will be used to check for updates rather than the actual web page - this is not true for beta urls) + update.szUpdateURL = "http://scottellis.com.au:81/test/updater.zip"; + update.szVersionURL = "http://scottellis.com.au:81/test/updater_test.html"; + update.pbVersionPrefix = (BYTE *)"Updater version "; + + update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix); + + // do the same for the beta versions of the above struct members if you wish to allow beta updates from another URL + + CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update); + + // Alternatively, to register a plugin with e.g. file ID 2254 on the file listing... + // CallService(MS_UPDATE_REGISTERFL, (WPARAM)2254, (LPARAM)&pluginInfo); + + return 0; +} + +#endif diff --git a/protocols/SkypeClassic/src/sdk/m_voice.h b/protocols/SkypeClassic/src/sdk/m_voice.h new file mode 100644 index 0000000000..0fe31d35fa --- /dev/null +++ b/protocols/SkypeClassic/src/sdk/m_voice.h @@ -0,0 +1,158 @@ +/* +Copyright (C) 2006 Ricardo Pescuma Domenecci + +This is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this file; see the file license.txt. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. +*/ + + +#ifndef __M_VOICE_H__ +# define __M_VOICE_H__ + + +#define EVENTTYPE_VOICE_CALL 8739 + + +#define PROTOTYPE_VOICE (PROTOTYPE_ENCRYPTION-9) + + +#define VOICE_UNICODE 0x80000000 + +#ifdef UNICODE +# define VOICE_TCHAR VOICE_UNICODE +#else +# define VOICE_TCHAR 0 +#endif + +#define VOICE_STATE_TALKING 0 +#define VOICE_STATE_RINGING 1 +#define VOICE_STATE_CALLING 2 +#define VOICE_STATE_ON_HOLD 3 +#define VOICE_STATE_ENDED 4 + +typedef struct { + int cbSize; // Struct size + const char *szModule; // The name of the protocol module (used only in notifications) + char *id; // Protocol especific ID for this call + int flags; // Can be VOICE_CALL_CONTACT or VOICE_CALL_STRING (VOICE_UNICODE to say the string is unicode) + union { // Who to call + HANDLE hContact; + TCHAR *ptszContact; + char *pszContact; + WCHAR *pwszContact; + }; + int state; // VOICE_STATE_* + +} VOICE_CALL; + + +/* +Notifies that a voice call changed state + +wParam: const VOICE_CALL * +lParam: ignored +return: 0 on success +*/ +#define PE_VOICE_CALL_STATE "/Voice/State" + + +#define VOICE_SUPPORTED 1 // Set if proto support voice calls. Probabilly will be 1 ;) +#define VOICE_CALL_CONTACT 2 // Set if a call can be made to a hContact +#define VOICE_CALL_CONTACT_NEED_TEST 4 // Set if the contact need to be tested with PS_VOICE_CALL_CONTACT_VALID (needs VOICE_CALL_CONTACT set to work) +#define VOICE_CALL_STRING 8 // Set if a call can be made to some string (PS_VOICE_CALL_STRING_VALID is used to validate the string) +#define VOICE_CAN_SET_DEVICE 16 // Set if the devices to mic in and sound out can be set (or the protocol will handle it internally) +#define VOICE_CAN_HOLD 32 // Set if a call can be put on hold +/* +Get protocol voice support flags + +wParam: ignored +lParam: ignored +return: 0 on success +*/ +#define PS_VOICE_GETINFO "/Voice/GetInfo" + +/* +Request to the protocol a voice call to hContact. + +wParam: (HANDLE) hContact +lParam: ignored +return: 0 on success +*/ +#define PS_VOICE_CALL "/Voice/Call" + +/* +Service called to make the protocol answer a call. +It is an async call. If the call was answered, the PE_VOICE_STARTEDCALL +notification will be fired. + +wParam: (const char *) id +lParam: ignored +return: 0 on success +*/ +#define PS_VOICE_ANSWERCALL "/Voice/AnswerCall" + +/* +Service called to make the protocol answer a call. This can be called if the +call is ringing or has started. If called any other time it should be ignored. +It is an async call. If the call was droped, the PE_VOICE_ENDEDCALL +notification will be fired. + +wParam: (const char *) id +lParam: ignored +return: 0 on success +*/ +#define PS_VOICE_DROPCALL "/Voice/DropCall" + +/* +Service called to make the protocol hold a call. This means that the call should not +be droped, but it should be muted and put in a hold, to allow other call to be answered. +If the protocol can't hold a cal, it should be droped. + +This can be called if the call has started. If called any other time it should be ignored. +It is an async call. If the call was droped, the PE_VOICE_HOLDEDCALL +notification will be fired. + +wParam: (const char *) id +lParam: ignored +return: 0 on success +*/ +#define PS_VOICE_HOLDCALL "/Voice/HoldCall" + +/* +Used if protocol support VOICE_CALL_STRING. The call string is passed as +wParam and the proto should validate it. + +wParam: (const TCHAR *) call string +lParam: ignored +return: 0 if wrong, 1 if correct +*/ +#define PS_VOICE_CALL_STRING_VALID "/Voice/CallStringValid" + +/* +Used if protocol support VOICE_CALL_CONTACT and VOICE_CALL_CONTACT_NEED_TEST. +The hContact is passed as wParam and the proto should tell if this contact can be +called. + +wParam: (HANDLE) hContact +lParam: (BOOL) TRUE if it is a test for 'can call now?', FALSE if is a test for 'will be possible to call someday?' +return: 0 if can't be called, 1 if can +*/ +#define PS_VOICE_CALL_CONTACT_VALID "/Voice/CallContactValid" + + + + + +#endif // __M_VOICE_H__ diff --git a/protocols/SkypeClassic/src/sdk/m_voiceservice.h b/protocols/SkypeClassic/src/sdk/m_voiceservice.h new file mode 100644 index 0000000000..7a6cd35bb4 --- /dev/null +++ b/protocols/SkypeClassic/src/sdk/m_voiceservice.h @@ -0,0 +1,86 @@ +/* +Copyright (C) 2007 Ricardo Pescuma Domenecci + +This is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this file; see the file license.txt. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. +*/ + + +#ifndef __M_VOICESERVICE_H__ +# define __M_VOICESERVICE_H__ + +#include "m_voice.h" + + +#define MIID_VOICESERVICE { 0x7d64437, 0xef2e, 0x4f60, { 0xbb, 0x2d, 0x3c, 0x51, 0x8f, 0xe2, 0x4d, 0x63 } } + + +/* +This services are a mirror of the services/notifications in m_voice.h, +with the difference that that ones are to be used by protocols, and this ones +are to be used by plugins that can make calls to contacts in multiple protocols. +*/ + + +/* +Notifies that a voice call changed state + +wParam: const VOICE_CALL * +lParam: ignored +return: 0 on success +*/ +#define MS_VOICESERVICE_STATE "VoiceService/State" + + + +struct VOICE_MODULE +{ + int cbSize; // sizeof(VOICE_MODULE) + char *name; // The internal name of the plugin. All PS_* serivces (except PS_VOICE_GETINFO) + // defined in m_voide.h need to be created based in this name. For example, + // PS_VOICE_CALL (/Voice/Call) need to be created as <name>/Voice/Call + int flags; // VOICE_* from m_voice.h +}; +/* +Register a new plugin that can make/receive voice calls. + +wParam: const VOICE_MODULE * +lParam: ignored +return: 0 on success +*/ +#define MS_VOICESERVICE_REGISTER "VoiceService/Register" + + +/* +Request a voice call to hContact. + +wParam: (HANDLE) hContact +lParam: ignored +return: the number of option calls for a contact. If > 0, it can be called +*/ +#define MS_VOICESERVICE_CAN_CALL "VoiceService/CanCall" + +/* +Request a voice call to hContact. + +wParam: (HANDLE) hContact +lParam: (char *) Protocol or NULL to use any proto avaiable +return: 0 on success +*/ +#define MS_VOICESERVICE_CALL "VoiceService/Call" + + + +#endif // __M_VOICESERVICE_H__ diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 20d4048458..98d8598cc6 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "pthread.h"
#include "gchat.h"
#include "m_toptoolbar.h"
+#include "voiceservice.h"
#include "msglist.h"
#include "memlist.h"
#include <sys/timeb.h>
@@ -40,6 +41,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning (disable: 4706) // assignment within conditional expression
+#ifdef IS_MIRANDAIM
+PLUGINLINK *pluginLink;
+struct MM_INTERFACE mmi;
+#endif
+
POPUPDATAT MessagePopup;
// Exported Globals
@@ -171,6 +177,9 @@ PLUGININFOEX pluginInfo = { __COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE,
+#ifdef IS_MIRANDAIM
+ 0, //doesn't replace anything built-in
+#endif
// {A71F8335-7B87-4432-B8A3-81479431C6F5}
{ 0xa71f8335, 0x7b87, 0x4432, { 0xb8, 0xa3, 0x81, 0x47, 0x94, 0x31, 0xc6, 0xf5 } }
};
@@ -187,6 +196,58 @@ void RegisterToDbeditorpp(void) CallService("DBEditorpp/RegisterSingleModule", (WPARAM)SKYPE_PROTONAME, 0);
}
+void RegisterToUpdate(void)
+{
+#ifdef IS_MIRANDAIM
+ //Use for the Updater plugin
+ if(ServiceExists(MS_UPDATE_REGISTER))
+ {
+ Update update = {0};
+ char szVersion[16];
+
+ update.szComponentName = pluginInfo.shortName;
+ update.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO *)&pluginInfo, szVersion);
+ update.cpbVersion = (DWORD)strlen((char *)update.pbVersion);
+
+#ifdef _WIN64
+#ifdef _UNICODE
+ update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/Skype_protocol_unicode_x64.zip";
+#else
+ update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/Skype_protocol_x64.zip";
+#endif
+ update.szBetaVersionURL = "http://dose.0wnz.at/miranda/Skype/";
+ update.pbBetaVersionPrefix = (BYTE *)"SKYPE version ";
+ update.szUpdateURL = update.szBetaUpdateURL; // FIXME!!
+ update.szVersionURL = update.szBetaVersionURL; // FIXME
+ update.pbVersionPrefix = update.pbBetaVersionPrefix; //FIXME
+#else /* _WIN64 */
+#ifdef _UNICODE
+ update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/Skype_protocol_unicode.zip";
+#else
+ update.szBetaUpdateURL = "http://dose.0wnz.at/miranda/Skype/Skype_protocol.zip";
+#endif
+ update.szBetaVersionURL = "http://dose.0wnz.at/miranda/Skype/";
+ update.pbBetaVersionPrefix = (BYTE *)"SKYPE version ";
+#ifdef _UNICODE
+ update.szUpdateURL = update.szBetaUpdateURL; // FIXME!!
+ update.szVersionURL = update.szBetaVersionURL; // FIXME
+ update.pbVersionPrefix = update.pbBetaVersionPrefix; //FIXME
+#else
+ update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile=3200";
+ update.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=3200";
+ update.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Skype Protocol</span>";
+#endif
+#endif
+
+ update.cpbVersionPrefix = (DWORD)strlen((char *)update.pbVersionPrefix);
+ update.cpbBetaVersionPrefix = (DWORD)strlen((char *)update.pbBetaVersionPrefix);
+
+ CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
+
+ }
+#endif
+}
+
/*
* ShowMessage
*
@@ -421,6 +482,32 @@ void BasicSearchThread(char *nick) { return;
}
+#ifdef IS_MIRANDAIM
+INT_PTR SkypeDBWriteContactSettingUTF8String(HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
+ DBCONTACTWRITESETTING cws;
+ INT_PTR iRet;
+
+ // Try to save it as UTF8 sting to DB. If this doesn't succeed (i.e. older Miranda version), we convert
+ // accordingly and try to save again.
+
+ cws.szModule=szModule;
+ cws.szSetting=szSetting;
+ cws.value.type=DBVT_UTF8;
+ cws.value.pszVal=(char*)val;
+ // DBVT_UTF8 support started with version 0.5.0.0, right...?
+ if (mirandaVersion < 0x050000 || (iRet = CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws)))
+ {
+ // Failed, try to convert and then try again
+ cws.value.type=DBVT_TCHAR;
+ if (!(cws.value.ptszVal = make_tchar_string((const unsigned char*)val))) return -1;
+ iRet = CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+ free (cws.value.pszVal);
+ }
+ return iRet;
+}
+#endif
+
// added by TioDuke
void GetDisplaynameThread(char *dummy) {
DBVARIANT dbv;
@@ -489,6 +576,82 @@ 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.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;
@@ -503,47 +666,8 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) { token = strtok_r(cmd + 10, ", ", &nextoken);
while (token) {
- 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.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);
+ QueryUserWaitingAuthorization (token, NULL);
+ token=strtok_r(NULL, ", ", &nextoken);
}
free(cmd);
return;
@@ -728,7 +852,7 @@ void __cdecl SkypeSystemInit(char *dummy) { SkypeSend("CREATE APPLICATION libpurple_typing");
testfor("CREATE APPLICATION libpurple_typing", 2000);
}
- if (protocol >= 5 || bIsImoproxy) {
+ if (protocol>=5) {
SearchUsersWaitingMyAuthorization(NULL);
if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0))
SearchRecentChats(NULL);
@@ -799,10 +923,19 @@ 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;
}
@@ -818,18 +951,27 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { logoff_contacts(FALSE);
HookEventsLoaded();
+ RegisterToUpdate();
RegisterToDbeditorpp();
+ VoiceServiceModulesLoaded();
GCInit();
add_contextmenu(NULL);
if (ServiceExists(MS_GC_REGISTER))
{
- static COLORREF crCols[1] = { 0 };
+ GCREGISTER gcr = {0};
+ static COLORREF crCols[1] = {0};
char szEvent[MAXMODULELABELLENGTH];
- GCREGISTER gcr = { sizeof(gcr) };
+
+ gcr.cbSize = sizeof( GCREGISTER );
gcr.dwFlags = GC_CHANMGR; // |GC_ACKMSG; // TODO: Not implemented yet
+#ifdef GC_TCHAR
+ gcr.dwFlags |= GC_TCHAR;
+ gcr.ptszModuleDispName = _T("Skype protocol");
+#else
gcr.ptszDispName = _T("Skype protocol");
+#endif
gcr.pszModule = SKYPE_PROTONAME;
if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr))
OUTPUT(_T("Unable to register with Groupchat module!"));
@@ -894,9 +1036,13 @@ 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);
- else timestamp = (DWORD)SkypeTime(NULL);
+ 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);
free(ptr);
}
else timestamp = (DWORD)(args.pMsgEntry->tEdited);
@@ -929,14 +1075,21 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "KICKED"))
{
+ GCDEST gcd = {0};
+ GCEVENT gce = {0};
+ CONTACTINFO ci = {0};
+
if (!hChat) __leave;
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_KICK };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
+ 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;
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)) {
@@ -959,6 +1112,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "SETROLE"))
{
+ GCDEST gcd = {0};
+ GCEVENT gce = {0};
+ CONTACTINFO ci = {0};
gchat_contact *gcContact;
char *pszRole;
@@ -966,15 +1122,18 @@ void FetchMessageThread(fetchmsg_arg *pargs) { // USERS - Wessen Rolle wurde gesetzt
// ROLE - Die neue Rolle
if (!hChat) __leave;
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_REMOVESTATUS };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
+ 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;
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;
@@ -1012,13 +1171,20 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "SETTOPIC"))
{
+ GCDEST gcd = {0};
+ GCEVENT gce = {0};
+ CONTACTINFO ci = {0};
+
LOG(("FetchMessageThread CHAT SETTOPIC"));
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_TOPIC };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
+ 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;
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);
@@ -1046,14 +1212,24 @@ 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) {
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_ACTION };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
+ 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;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
- CMString(FORMAT, _T("%S %s"), users, TranslateT("invited"));
+ // We assume that users buffer has enough room for "invited" string
+ memmove (users+strlen(pszInvited), users, strlen(users)+1);
+ memcpy (users, pszInvited, strlen(pszInvited));
gce.ptszText = make_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
DBVARIANT dbv;
@@ -1063,7 +1239,6 @@ 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);
@@ -1187,7 +1362,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { mir_free(ci.pszVal);
}
}
- newlen = int(strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9);
+ newlen = strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9;
if (pMsg = (char *)malloc(newlen)) {
sprintf(pMsg, "** %s%s%s **", (pszUTFnick ? pszUTFnick : ""), (pszUTFnick ? " " : ""), (char*)msgptr);
free(ptr);
@@ -1215,7 +1390,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);
@@ -1235,12 +1410,17 @@ 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);
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), bEmoted ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ gcd.pszModule = SKYPE_PROTONAME;
+ gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
+ gcd.iType = bEmoted?GC_EVENT_ACTION:GC_EVENT_MESSAGE;
if ((gce.bIsMe = (direction&DBEF_SENT) ? TRUE : FALSE) && db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
{
free(who);
@@ -1250,7 +1430,6 @@ 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;
@@ -1258,8 +1437,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci))
gce.ptszNick = ci.pszVal;
gce.time = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
- gce.ptszText = (TCHAR*)(msgptr + msglen);
- gce.dwFlags = GCEF_ADDTOLOG;
+ gce.pszText = msgptr;
+ if (pre.flags & PREF_UNICODE) gce.pszText += msglen;
+ gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
MsgList_Add(pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat
if (ci.pszVal) mir_free(ci.pszVal);
@@ -1290,7 +1470,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { TYP_MSGLENTRY *pme;
LOG(("FetchMessageThread Adding event"));
- if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0)))
+ if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)))
dbei.szModule = SKYPE_PROTONAME;
dbei.cbBlob = msglen;
if (pre.flags & PREF_UNICODE)
@@ -1444,7 +1624,9 @@ MCONTACT GetCallerContact(char *szSkypeMsg) MCONTACT GetMetaHandle(DWORD dwId)
{
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ MCONTACT hContact;
+
+ for (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)
@@ -1515,6 +1697,11 @@ void RingThread(char *szSkypeMsg) { goto l_exitRT;;
}
+ if (!strncmp(ptr, "INCOMING", 8))
+ NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_RINGING);
+ else
+ NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_CALLING);
+
if (!strncmp(ptr, "INCOMING", 8)) {
if (!hContact) {
char *szHandle;
@@ -1533,6 +1720,11 @@ 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;
@@ -1550,7 +1742,7 @@ void RingThread(char *szSkypeMsg) { unsigned int popupBackColor, popupTextColor;
int popupTimeSec;
POPUPDATAT InCallPopup;
- TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
+ TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
@@ -1580,7 +1772,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, hContact, 0));
+ _snprintf(toolTip, sizeof(toolTip), Translate("Incoming call from %s"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0));
cle.pszTooltip = toolTip;
CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
@@ -1628,27 +1820,31 @@ void EndCallThread(char *szSkypeMsg) { }
if (hContact)
{
+ NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_ENDED);
+
db_unset(hContact, SKYPE_PROTONAME, "CallId");
- 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);
+ 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);
}
- 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, hContact, 0), SKYPE_PROTONAME) &&
+ if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), SKYPE_PROTONAME) &&
db_get_b(hContact, "CList", "NotOnList", 0)
)
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
}
}
free(szSkypeMsg);
@@ -1665,6 +1861,7 @@ void HoldCallThread(char *szSkypeMsg) { }
if (hContact = GetCallerContact(szSkypeMsg)) {
db_set_b(hContact, SKYPE_PROTONAME, "OnHold", 1);
+ NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_ON_HOLD);
}
free(szSkypeMsg);
LOG(("HoldCallThread terminated gracefully"));
@@ -1680,6 +1877,7 @@ void ResumeCallThread(char *szSkypeMsg) { }
if (hContact = GetCallerContact(szSkypeMsg)) {
db_unset(hContact, SKYPE_PROTONAME, "OnHold");
+ NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_TALKING);
}
free(szSkypeMsg);
LOG(("ResumeCallThread terminated gracefully."));
@@ -1828,7 +2026,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, hContact, lTyping);
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, lTyping);
break;
}
}
@@ -1894,7 +2092,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);
}
@@ -2013,7 +2211,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, hContact, 0); break;
+ case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); break;
case 0: break;
case 2: flag = PALF_TEMPORARY;
case 3: add_contact(nick, flag);
@@ -2062,12 +2260,18 @@ 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)
{
- 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);
+ 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;
if (gce.ptszText) {
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
db_set_ts(hContact, SKYPE_PROTONAME, "Nick", gce.ptszText);
@@ -2214,6 +2418,7 @@ 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:
@@ -2332,7 +2537,8 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) int __stdcall SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
- ACKDATA ack = { sizeof(ACKDATA) };
+ ACKDATA ack = {0};
+ ack.cbSize = sizeof( ACKDATA );
ack.szModule = SKYPE_PROTONAME;
ack.hContact = hContact;
ack.type = type;
@@ -2899,7 +3105,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, hContact, 0);
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
@@ -3113,16 +3319,24 @@ void __cdecl MsgPump(char *dummy) // DLL Stuff //
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVersion)
+__declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirVersion)
+{
+ mirandaVersion = mirVersion;
+
+ pluginInfo.cbSize = sizeof(PLUGININFO);
+ return (PLUGININFO*) &pluginInfo;
+}
+
+__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVersion)
{
mirandaVersion = mirVersion;
return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MUUID_SKYPE_CALL, MIID_LAST };
+__declspec(dllexport) const MUUID MirandaInterfaces[] = { MUUID_SKYPE_CALL, MIID_LAST };
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
UNREFERENCED_PARAMETER(fdwReason);
UNREFERENCED_PARAMETER(lpvReserved);
@@ -3140,20 +3354,31 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) { return 0;
}
-extern "C" int __declspec(dllexport) Load(void)
+#ifdef IS_MIRANDAIM
+int __declspec(dllexport) Load(PLUGINLINK *link)
+#else
+int __declspec(dllexport) Load(void)
+#endif
{
+ PROTOCOLDESCRIPTOR pd = { 0 };
DWORD Buffsize;
HKEY MyKey;
BOOL SkypeInstalled;
BOOL UseCustomCommand;
WSADATA wsaData;
+ char path[MAX_PATH];
+#ifdef IS_MIRANDAIM
+ pluginLink = link;
+ mir_getMMI( &mmi );
+#else
mir_getLP(&pluginInfo);
+#endif
- // 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 );
+ // 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 );
InitializeCriticalSection(&RingAndEndcallMutex);
InitializeCriticalSection(&QueryThreadMutex);
@@ -3242,11 +3467,13 @@ extern "C" int __declspec(dllexport) Load(void) }
/* Register the module */
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
+ pd.cbSize = sizeof(pd);
pd.szName = SKYPE_PROTONAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+ VoiceServiceInit();
+
CreateServices();
HookEvents();
InitVSApi();
@@ -3262,7 +3489,7 @@ extern "C" int __declspec(dllexport) Load(void) -extern "C" int __declspec(dllexport) Unload(void)
+int __declspec(dllexport) Unload(void)
{
BOOL UseCustomCommand = db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
BOOL Shutdown = db_get_b(NULL, SKYPE_PROTONAME, "Shutdown", 0);
@@ -3299,6 +3526,7 @@ extern "C" int __declspec(dllexport) Unload(void) UnhookEvent(hChatMenu);
UnhookEvent(hEvInitChat);
DestroyHookableEvent(hInitChat);
+ VoiceServiceExit();
GCExit();
MsgList_Exit();
diff --git a/protocols/SkypeClassic/src/skype.h b/protocols/SkypeClassic/src/skype.h index f6821b0063..e28be1051f 100644 --- a/protocols/SkypeClassic/src/skype.h +++ b/protocols/SkypeClassic/src/skype.h @@ -5,7 +5,6 @@ #define CP_ACP 0
#define code_page CP_ACP;
-#define MIRANDA_CUSTOM_LP
// System includes
@@ -44,7 +43,12 @@ #include <m_contacts.h>
#include <m_metacontacts.h>
#include <m_popup.h>
-#include <m_string.h>
+#include <m_core.h>
+#ifdef IS_MIRANDAIM
+#include <m_updater.h>
+#else
+#define MIRANDA_CUSTOM_LP
+#endif
#pragma warning (pop)
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index b5bd939172..1534a3530a 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, hContact, 0);
+ if (TempAdded) CallService(MS_DB_CONTACT_DELETE, (WPARAM)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, hContact, 0 );
+ char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)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,hContact,0);
+ char *szOtherCaller=(char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)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 16b421cdb4..07fa5905db 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,hContact,GCDNF_TCHAR);
+ lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)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 new file mode 100644 index 0000000000..80d4cf7b51 --- /dev/null +++ b/protocols/SkypeClassic/src/voiceservice.cpp @@ -0,0 +1,169 @@ +#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 new file mode 100644 index 0000000000..ced019b15a --- /dev/null +++ b/protocols/SkypeClassic/src/voiceservice.h @@ -0,0 +1,18 @@ +#ifndef _VOICESERVICE_H_ +#define _VOICESERVICE_H_ + +#pragma warning (push) +#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union +#include "sdk/m_voice.h" +#pragma warning (pop) + +BOOL HasVoiceService(); +void VoiceServiceInit(); +void VoiceServiceExit(); +void VoiceServiceModulesLoaded(); +void NofifyVoiceService(HANDLE hContact, char *callId, int state) ; + + + +#endif // _VOICESERVICE_H_ + |