diff options
Diffstat (limited to 'protocols/SkypeClassic/src/skype.cpp')
-rw-r--r-- | protocols/SkypeClassic/src/skype.cpp | 460 |
1 files changed, 100 insertions, 360 deletions
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 8bc2fc4574..20d4048458 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -26,13 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "pthread.h"
#include "gchat.h"
#include "m_toptoolbar.h"
-
-#ifdef IS_MIRANDAIM
-#include "voiceservice.h"
-#else
-inline BOOL HasVoiceService() { return FALSE; }
-#endif
-
#include "msglist.h"
#include "memlist.h"
#include <sys/timeb.h>
@@ -47,11 +40,6 @@ inline BOOL HasVoiceService() { return FALSE; } #pragma warning (disable: 4706) // assignment within conditional expression
-#ifdef IS_MIRANDAIM
-PLUGINLINK *pluginLink;
-struct MM_INTERFACE mmi;
-#endif
-
POPUPDATAT MessagePopup;
// Exported Globals
@@ -183,9 +171,6 @@ 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 } }
};
@@ -202,58 +187,6 @@ 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
*
@@ -488,32 +421,6 @@ 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;
@@ -582,82 +489,6 @@ int SearchFriends(void) { return iRet;
}
-static void QueryUserWaitingAuthorization(char *pszNick, char *pszAuthRq)
-{
- CCSDATA ccs={0};
- PROTORECVEVENT pre={0};
- MCONTACT hContact;
- char *firstname=NULL, *lastname=NULL, *pCurBlob, *authmsg=NULL;
-
- LOG(("Awaiting auth: %s", pszNick));
- ccs.szProtoService=PSR_AUTH;
- ccs.hContact = hContact = add_contact(pszNick, PALF_TEMPORARY);
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)⪯
- pre.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;
@@ -672,8 +503,47 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) { token = strtok_r(cmd + 10, ", ", &nextoken);
while (token) {
- QueryUserWaitingAuthorization (token, NULL);
- token=strtok_r(NULL, ", ", &nextoken);
+ CCSDATA ccs = { 0 };
+ PROTORECVEVENT pre = { 0 };
+ MCONTACT hContact;
+ char *firstname = NULL, *lastname = NULL, *pCurBlob;
+
+ LOG(("Awaiting auth: %s", token));
+ ccs.szProtoService = PSR_AUTH;
+ ccs.hContact = hContact = add_contact(token, PALF_TEMPORARY);
+ ccs.wParam = 0;
+ ccs.lParam = (LPARAM)⪯
+ pre.flags = 0;
+ pre.timestamp = (DWORD)SkypeTime(NULL);
+
+ /* blob is: */
+ //DWORD protocolSpecific MCONTACT hContact
+ //ASCIIZ nick, firstName, lastName, e-mail, requestReason
+ if (firstname = SkypeGet("USER", token, "FULLNAME"))
+ if (lastname = strchr(firstname, ' ')) {
+ *lastname = 0;
+ lastname++;
+ }
+
+ pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + strlen(token) + 5;
+ if (firstname) pre.lParam += strlen(firstname);
+ if (lastname) pre.lParam += strlen(lastname);
+ if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
+ pCurBlob += sizeof(DWORD); // Not used
+ memcpy(pCurBlob, &hContact, sizeof(HANDLE)); pCurBlob += sizeof(HANDLE);
+ strcpy((char *)pCurBlob, token); pCurBlob += strlen((char *)pCurBlob) + 1;
+ if (firstname) {
+ strcpy((char *)pCurBlob, firstname);
+ if (lastname) {
+ pCurBlob += strlen((char *)pCurBlob) + 1;
+ strcpy((char *)pCurBlob, lastname);
+ }
+ }
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ free(pre.szMessage);
+ }
+ if (firstname) free(firstname);
+ token = strtok_r(NULL, ", ", &nextoken);
}
free(cmd);
return;
@@ -858,7 +728,7 @@ void __cdecl SkypeSystemInit(char *dummy) { SkypeSend("CREATE APPLICATION libpurple_typing");
testfor("CREATE APPLICATION libpurple_typing", 2000);
}
- if (protocol>=5) {
+ if (protocol >= 5 || bIsImoproxy) {
SearchUsersWaitingMyAuthorization(NULL);
if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0))
SearchRecentChats(NULL);
@@ -929,19 +799,10 @@ int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam) { ttb.cbSize = sizeof(ttb);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- ttb.name = Translate("Do a SkypeOut-call");
-#ifdef TTB_WINDOW_HANDLE
- /* New Top toolbar */
ttb.hIconHandleDn = ttb.hIconHandleUp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CALL));
ttb.pszService = SKYPEOUT_CALL;
+ ttb.name = Translate("Do a SkypeOut-call");
if ((int)(TopToolbar_AddButton(&ttb)) == -1) httbButton = 0;
-#else
- /* Old Top toolbar */
- ttb.dwFlags |= TTBBF_DRAWBORDER;
- ttb.hbBitmapDown = ttb.hbBitmapUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CALL));
- ttb.pszServiceDown = ttb.pszServiceUp = SKYPEOUT_CALL;
- if ((int)(httbButton=(HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0))==-1) httbButton=0;
-#endif
return 0;
}
@@ -957,33 +818,18 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { logoff_contacts(FALSE);
HookEventsLoaded();
- RegisterToUpdate();
RegisterToDbeditorpp();
-#ifdef IS_MIRANDAIM
- VoiceServiceModulesLoaded();
-#endif
GCInit();
add_contextmenu(NULL);
if (ServiceExists(MS_GC_REGISTER))
{
- GCREGISTER gcr = {0};
- static COLORREF crCols[1] = {0};
+ static COLORREF crCols[1] = { 0 };
char szEvent[MAXMODULELABELLENGTH];
-
- gcr.cbSize = sizeof( GCREGISTER );
+ GCREGISTER gcr = { sizeof(gcr) };
gcr.dwFlags = GC_CHANMGR; // |GC_ACKMSG; // TODO: Not implemented yet
-#ifdef GC_TCHAR
- gcr.dwFlags |= GC_TCHAR;
-#ifdef IS_MIRANDAIM
- gcr.ptszModuleDispName = _T("Skype protocol");
-#else
- gcr.ptszDispName = _T("Skype protocol");
-#endif
-#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!"));
@@ -1048,13 +894,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { // Get Timestamp
if (!args.pMsgEntry || !args.pMsgEntry->tEdited) {
- if (!(ptr=SkypeGet (cmdMessage, args.msgnum, "TIMESTAMP"))) return;
- if (strncmp(ptr, "ERROR", 5)) {
- timestamp=atol(ptr);
- // Ensure time correction on clock skew...
- if (timestamp>(DWORD)SkypeTime(NULL)) timestamp=(DWORD)SkypeTime(NULL);
- }
- else timestamp=(DWORD)SkypeTime(NULL);
+ if (!(ptr = SkypeGet(cmdMessage, args.msgnum, "TIMESTAMP"))) return;
+ if (strncmp(ptr, "ERROR", 5)) timestamp = atol(ptr);
+ else timestamp = (DWORD)SkypeTime(NULL);
free(ptr);
}
else timestamp = (DWORD)(args.pMsgEntry->tEdited);
@@ -1087,21 +929,14 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "KICKED"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
-
if (!hChat) __leave;
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_KICK;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_KICK };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
-
+ CONTACTINFO ci = { 0 };
ci.hContact = find_contact(users);
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
@@ -1124,9 +959,6 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "SETROLE"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
gchat_contact *gcContact;
char *pszRole;
@@ -1134,18 +966,15 @@ void FetchMessageThread(fetchmsg_arg *pargs) { // USERS - Wessen Rolle wurde gesetzt
// ROLE - Die neue Rolle
if (!hChat) __leave;
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_REMOVESTATUS;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_REMOVESTATUS };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
-
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
@@ -1183,20 +1012,13 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "SETTOPIC"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
-
LOG(("FetchMessageThread CHAT SETTOPIC"));
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_TOPIC;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_TOPIC };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
-
+ CONTACTINFO ci = { 0 };
ci.hContact = find_contact(who);
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
ci.cbSize = sizeof(ci);
@@ -1224,24 +1046,14 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "LEFT") || (bAddedMembers = strcmp(type, "ADDEDMEMBERS") == 0))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
- char *pszInvited = Translate("invited");
-
LOG(("FetchMessageThread CHAT LEFT or ADDEDMEMBERS"));
if (bAddedMembers) {
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_ACTION;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_ACTION };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
- // We assume that users buffer has enough room for "invited" string
- memmove (users+strlen(pszInvited), users, strlen(users)+1);
- memcpy (users, pszInvited, strlen(pszInvited));
+ CMString(FORMAT, _T("%S %s"), users, TranslateT("invited"));
gce.ptszText = make_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
DBVARIANT dbv;
@@ -1251,6 +1063,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
if (!gce.bIsMe)
ci.hContact = find_contact(who);
@@ -1374,7 +1187,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { mir_free(ci.pszVal);
}
}
- newlen = strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9;
+ newlen = int(strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9);
if (pMsg = (char *)malloc(newlen)) {
sprintf(pMsg, "** %s%s%s **", (pszUTFnick ? pszUTFnick : ""), (pszUTFnick ? " " : ""), (char*)msgptr);
free(ptr);
@@ -1402,7 +1215,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { #ifdef _UNICODE
msglen = (int)strlen(msg) + 1;
msgptr = (char*)make_unicode_string((const unsigned char*)msgptr);
- wcLen = (int)(_tcslen((TCHAR*)msgptr) + 1)*sizeof(TCHAR);
+ wcLen = int(_tcslen((TCHAR*)msgptr) + 1)*sizeof(TCHAR);
msg = (char*)realloc(msg, msglen + wcLen);
memcpy(msg + msglen, msgptr, wcLen);
free(msgptr);
@@ -1422,17 +1235,12 @@ void FetchMessageThread(fetchmsg_arg *pargs) { bHasPartList) || msgptr[0] == 0) __leave;
if (isGroupChat && bUseGroupChat) {
-
- GCDEST gcd = { 0 };
- GCEVENT gce = { sizeof(gce), &gcd };
DBVARIANT dbv = { 0 };
- CONTACTINFO ci = { 0 };
LOG(("FetchMessageThread This is a group chat message"));
if (!hChat) ChatStart(chat, FALSE);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = bEmoted?GC_EVENT_ACTION:GC_EVENT_MESSAGE;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), bEmoted ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
if ((gce.bIsMe = (direction&DBEF_SENT) ? TRUE : FALSE) && db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
{
free(who);
@@ -1442,6 +1250,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
gce.ptszNick = gce.ptszUID;
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
@@ -1449,15 +1258,8 @@ 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);
-
-#ifdef IS_MIRANDAIM
- gce.pszText = msgptr;
- if (pre.flags & PREF_UNICODE) gce.pszText += msglen;
-#else
gce.ptszText = (TCHAR*)(msgptr + msglen);
-#endif
-
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ gce.dwFlags = GCEF_ADDTOLOG;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
MsgList_Add(pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat
if (ci.pszVal) mir_free(ci.pszVal);
@@ -1488,7 +1290,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { TYP_MSGLENTRY *pme;
LOG(("FetchMessageThread Adding event"));
- if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)))
+ if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0)))
dbei.szModule = SKYPE_PROTONAME;
dbei.cbBlob = msglen;
if (pre.flags & PREF_UNICODE)
@@ -1642,9 +1444,7 @@ MCONTACT GetCallerContact(char *szSkypeMsg) MCONTACT GetMetaHandle(DWORD dwId)
{
- MCONTACT hContact;
-
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, "MetaContacts") &&
db_get_dw(hContact, "MetaContacts", "MetaID", MAXDWORD) == dwId)
@@ -1715,13 +1515,6 @@ void RingThread(char *szSkypeMsg) { goto l_exitRT;;
}
-#ifdef IS_MIRANDAIM
- if (!strncmp(ptr, "INCOMING", 8))
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_RINGING);
- else
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_CALLING);
-#endif
-
if (!strncmp(ptr, "INCOMING", 8)) {
if (!hContact) {
char *szHandle;
@@ -1740,11 +1533,6 @@ void RingThread(char *szSkypeMsg) { }
}
- if (HasVoiceService()) {
- // Voice service will handle it
- goto l_exitRT;
- }
-
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_CALL;
dbei.szModule = SKYPE_PROTONAME;
@@ -1762,7 +1550,7 @@ void RingThread(char *szSkypeMsg) { unsigned int popupBackColor, popupTextColor;
int popupTimeSec;
POPUPDATAT InCallPopup;
- TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
@@ -1792,7 +1580,7 @@ void RingThread(char *szSkypeMsg) { dbei.flags = DBEF_READ;
cle.hContact = hContact;
cle.hDbEvent = db_event_add(hContact, &dbei);
- _snprintf(toolTip, sizeof(toolTip), Translate("Incoming call from %s"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0));
+ _snprintf(toolTip, sizeof(toolTip), Translate("Incoming call from %s"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
cle.pszTooltip = toolTip;
CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
@@ -1840,33 +1628,27 @@ void EndCallThread(char *szSkypeMsg) { }
if (hContact)
{
-#ifdef IS_MIRANDAIM
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_ENDED);
-#endif
-
db_unset(hContact, SKYPE_PROTONAME, "CallId");
- if (!HasVoiceService()) {
- dbei.cbSize = sizeof(dbei);
- hDbEvent = db_event_firstUnread(hContact);
- while (hDbEvent) {
- dbei.cbBlob = 0;
- db_event_get(hDbEvent, &dbei);
- if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CALL) {
- db_event_markRead(hContact, hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hDbEvent);
- }
- if (dbei.pBlob) free(dbei.pBlob);
- hDbEvent = db_event_next(hContact, hDbEvent);
+ dbei.cbSize = sizeof(dbei);
+ hDbEvent = db_event_firstUnread(hContact);
+ while (hDbEvent) {
+ dbei.cbBlob = 0;
+ db_event_get(hDbEvent, &dbei);
+ if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CALL) {
+ db_event_markRead(hContact, hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)hDbEvent);
}
+ free(dbei.pBlob);
+ hDbEvent = db_event_next(hContact, hDbEvent);
}
if (!db_get_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) {
db_free(&dbv);
- if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), SKYPE_PROTONAME) &&
+ if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0), SKYPE_PROTONAME) &&
db_get_b(hContact, "CList", "NotOnList", 0)
)
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
}
free(szSkypeMsg);
@@ -1883,9 +1665,6 @@ void HoldCallThread(char *szSkypeMsg) { }
if (hContact = GetCallerContact(szSkypeMsg)) {
db_set_b(hContact, SKYPE_PROTONAME, "OnHold", 1);
-#ifdef IS_MIRANDAIM
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_ON_HOLD);
-#endif
}
free(szSkypeMsg);
LOG(("HoldCallThread terminated gracefully"));
@@ -1901,9 +1680,6 @@ void ResumeCallThread(char *szSkypeMsg) { }
if (hContact = GetCallerContact(szSkypeMsg)) {
db_unset(hContact, SKYPE_PROTONAME, "OnHold");
-#ifdef IS_MIRANDAIM
- NofifyVoiceService(hContact, szSkypeMsg, VOICE_STATE_TALKING);
-#endif
}
free(szSkypeMsg);
LOG(("ResumeCallThread terminated gracefully."));
@@ -2052,7 +1828,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) LPARAM lTyping = PROTOTYPE_CONTACTTYPING_OFF;
if (!strcmp(p, "PURPLE_TYPING")) lTyping = PROTOTYPE_CONTACTTYPING_INFINITE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, lTyping);
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, lTyping);
break;
}
}
@@ -2118,7 +1894,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if (nm = strtok_r(NULL, " ", &nextoken))
{
db_set_utf(hContact, SKYPE_PROTONAME, "FirstName", nm);
- if (!(nm = strtok_r(NULL, "", &nextoken))) {db_unset(hContact, SKYPE_PROTONAME, "LastName");}
+ if (!(nm = strtok_r(NULL, "", &nextoken))) db_unset(hContact, SKYPE_PROTONAME, "LastName");
else
db_set_utf(hContact, SKYPE_PROTONAME, "LastName", nm);
}
@@ -2237,7 +2013,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) else { // BUDDYSTATUS:
flag = 0;
switch (atoi(ptr + 12)) {
- case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); break;
+ case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, hContact, 0); break;
case 0: break;
case 2: flag = PALF_TEMPORARY;
case 3: add_contact(nick, flag);
@@ -2286,18 +2062,12 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) *ptr = 0;
if (hContact = find_chatA(szSkypeMsg + 5))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) !=
ID_STATUS_OFFLINE)
{
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5);
- gcd.iType = GC_EVENT_CHANGESESSIONAME;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.ptszText = make_tchar_string((const unsigned char*)ptr+14);
- gce.dwFlags = GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)szSkypeMsg + 5), GC_EVENT_CHANGESESSIONAME };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.ptszText = make_tchar_string((const unsigned char*)ptr + 14);
if (gce.ptszText) {
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
db_set_ts(hContact, SKYPE_PROTONAME, "Nick", gce.ptszText);
@@ -2444,7 +2214,6 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) KillTimer(hWndDlg, 1);
break;
case WM_COPYDATALOCAL:
- --iReentranceCnt;
return WndProc(hWndDlg, WM_COPYDATA, wParam, lParam);
default:
@@ -2563,8 +2332,7 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) int __stdcall SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
- ACKDATA ack = {0};
- ack.cbSize = sizeof( ACKDATA );
+ ACKDATA ack = { sizeof(ACKDATA) };
ack.szModule = SKYPE_PROTONAME;
ack.hContact = hContact;
ack.type = type;
@@ -3131,7 +2899,7 @@ void CleanupNicknames(char *dummy) { LOG(("CleanupNicknames Cleaning up..."));
for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
@@ -3345,22 +3113,12 @@ void __cdecl MsgPump(char *dummy) // DLL Stuff //
-#ifdef IS_MIRANDAIM
-extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirVersion)
-{
- mirandaVersion = mirVersion;
-
- pluginInfo.cbSize = sizeof(PLUGININFO);
- return (PLUGININFO*) &pluginInfo;
-}
-#else
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVersion)
{
mirandaVersion = mirVersion;
return &pluginInfo;
}
-#endif
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MUUID_SKYPE_CALL, MIID_LAST };
@@ -3382,31 +3140,20 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) { return 0;
}
-#ifdef IS_MIRANDAIM
-extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
-#else
extern "C" 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
- // Used to enable Copy DLL hack in older Miranda versions for muliple accounts
- GetModuleFileNameA( hInst, path, sizeof( path ));
- _splitpath (path, NULL, NULL, SKYPE_PROTONAME, NULL);
- CharUpperA( SKYPE_PROTONAME );
+ // RM: commented so it will always use predefined name - or was this really needed?
+ ///GetModuleFileNameA( hInst, path, sizeof( path ));
+ ///_splitpath (path, NULL, NULL, SKYPE_PROTONAME, NULL);
+ ///CharUpperA( SKYPE_PROTONAME );
InitializeCriticalSection(&RingAndEndcallMutex);
InitializeCriticalSection(&QueryThreadMutex);
@@ -3495,15 +3242,11 @@ extern "C" int __declspec(dllexport) Load(void) }
/* Register the module */
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = SKYPE_PROTONAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
-#ifdef IS_MIRANDAIM
- VoiceServiceInit();
-#endif
-
CreateServices();
HookEvents();
InitVSApi();
@@ -3556,9 +3299,6 @@ extern "C" int __declspec(dllexport) Unload(void) UnhookEvent(hChatMenu);
UnhookEvent(hEvInitChat);
DestroyHookableEvent(hInitChat);
-#ifdef IS_MIRANDAIM
- VoiceServiceExit();
-#endif
GCExit();
MsgList_Exit();
|