diff options
Diffstat (limited to 'protocols/SkypeClassic/src/skype.cpp')
-rw-r--r-- | protocols/SkypeClassic/src/skype.cpp | 312 |
1 files changed, 102 insertions, 210 deletions
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 6f155010aa..20d4048458 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "pthread.h"
#include "gchat.h"
#include "m_toptoolbar.h"
-
-inline BOOL HasVoiceService() { return FALSE; }
-
#include "msglist.h"
#include "memlist.h"
#include <sys/timeb.h>
@@ -492,82 +489,6 @@ int SearchFriends(void) { return iRet;
}
-static void QueryUserWaitingAuthorization(char *pszNick, char *pszAuthRq)
-{
- CCSDATA ccs={0};
- PROTORECVEVENT pre={0};
- MCONTACT hContact;
- char *firstname=NULL, *lastname=NULL, *pCurBlob, *authmsg=NULL;
-
- LOG(("Awaiting auth: %s", pszNick));
- ccs.szProtoService=PSR_AUTH;
- ccs.hContact = hContact = add_contact(pszNick, PALF_TEMPORARY);
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)⪯
- pre.flags = 0;
- pre.timestamp = (DWORD)SkypeTime(NULL);
-
- /* blob is: */
- //DWORD protocolSpecific HANDLE hContact
- //ASCIIZ nick, firstName, lastName, e-mail, requestReason
- if (firstname=SkypeGet("USER", pszNick, "FULLNAME")) {
- if (mirandaVersion < 0x070000) {
- char *tmp;
-
- if (utf8_decode(firstname, &tmp)!=-1) {
- free (firstname);
- firstname = tmp;
- }
- }
- if (lastname=strchr(firstname, ' ')) {
- *lastname=0;
- lastname++;
- }
- }
-
- pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + strlen(pszNick) + 5;
- if (firstname) pre.lParam += strlen(firstname);
- if (lastname) pre.lParam += strlen(lastname);
- if (pszAuthRq) authmsg = strdup(pszAuthRq);
- if (authmsg || ((protocol>=4 || bIsImoproxy) && (authmsg=SkypeGetID("USER", pszNick, "RECEIVEDAUTHREQUEST"))))
- pre.lParam+=strlen(authmsg);
- if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
- pCurBlob+=sizeof(DWORD); // Not used
- memcpy(pCurBlob, &hContact, sizeof(HANDLE)); pCurBlob += sizeof(HANDLE);
-
- if (mirandaVersion >= 0x070000) // 0.7.0+ supports PREF_UTF flag, no need to decode UTF8
- pre.flags |= PREF_UTF;
- else {
- char *tmp;
-
- if (authmsg && utf8_decode(authmsg, &tmp)!=-1) {
- free (authmsg);
- authmsg = tmp;
- }
- }
-
- sprintf (pCurBlob, "%s%c%s%c%s%c%c%s", pszNick, 0, firstname?firstname:"", 0, lastname?lastname:"", 0, 0, authmsg?authmsg:"");
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
- free(pre.szMessage);
- }
- if (firstname) free(firstname);
- if (authmsg) free (authmsg);
- return;
-}
-
-
-void __cdecl ProcessAuthRq(void *pPmsg) {
- char *nick, *auth;
-
- strtok ((char*)pPmsg, " ");
- nick = strtok (NULL, " ");
- strtok (NULL, " ");
- auth = strtok (NULL, "");
- QueryUserWaitingAuthorization(nick, auth);
- free (pPmsg);
-}
-
void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) {
char *cmd, *token, *nextoken;
@@ -582,8 +503,47 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) { token = strtok_r(cmd + 10, ", ", &nextoken);
while (token) {
- QueryUserWaitingAuthorization (token, NULL);
- token=strtok_r(NULL, ", ", &nextoken);
+ CCSDATA ccs = { 0 };
+ PROTORECVEVENT pre = { 0 };
+ MCONTACT hContact;
+ char *firstname = NULL, *lastname = NULL, *pCurBlob;
+
+ LOG(("Awaiting auth: %s", token));
+ ccs.szProtoService = PSR_AUTH;
+ ccs.hContact = hContact = add_contact(token, PALF_TEMPORARY);
+ ccs.wParam = 0;
+ ccs.lParam = (LPARAM)⪯
+ pre.flags = 0;
+ pre.timestamp = (DWORD)SkypeTime(NULL);
+
+ /* blob is: */
+ //DWORD protocolSpecific MCONTACT hContact
+ //ASCIIZ nick, firstName, lastName, e-mail, requestReason
+ if (firstname = SkypeGet("USER", token, "FULLNAME"))
+ if (lastname = strchr(firstname, ' ')) {
+ *lastname = 0;
+ lastname++;
+ }
+
+ pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + strlen(token) + 5;
+ if (firstname) pre.lParam += strlen(firstname);
+ if (lastname) pre.lParam += strlen(lastname);
+ if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
+ pCurBlob += sizeof(DWORD); // Not used
+ memcpy(pCurBlob, &hContact, sizeof(HANDLE)); pCurBlob += sizeof(HANDLE);
+ strcpy((char *)pCurBlob, token); pCurBlob += strlen((char *)pCurBlob) + 1;
+ if (firstname) {
+ strcpy((char *)pCurBlob, firstname);
+ if (lastname) {
+ pCurBlob += strlen((char *)pCurBlob) + 1;
+ strcpy((char *)pCurBlob, lastname);
+ }
+ }
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ free(pre.szMessage);
+ }
+ if (firstname) free(firstname);
+ token = strtok_r(NULL, ", ", &nextoken);
}
free(cmd);
return;
@@ -768,7 +728,7 @@ void __cdecl SkypeSystemInit(char *dummy) { SkypeSend("CREATE APPLICATION libpurple_typing");
testfor("CREATE APPLICATION libpurple_typing", 2000);
}
- if (protocol>=5) {
+ if (protocol >= 5 || bIsImoproxy) {
SearchUsersWaitingMyAuthorization(NULL);
if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0))
SearchRecentChats(NULL);
@@ -839,19 +799,10 @@ int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam) { ttb.cbSize = sizeof(ttb);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- ttb.name = Translate("Do a SkypeOut-call");
-#ifdef TTB_WINDOW_HANDLE
- /* New Top toolbar */
ttb.hIconHandleDn = ttb.hIconHandleUp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CALL));
ttb.pszService = SKYPEOUT_CALL;
+ ttb.name = Translate("Do a SkypeOut-call");
if ((int)(TopToolbar_AddButton(&ttb)) == -1) httbButton = 0;
-#else
- /* Old Top toolbar */
- ttb.dwFlags |= TTBBF_DRAWBORDER;
- ttb.hbBitmapDown = ttb.hbBitmapUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CALL));
- ttb.pszServiceDown = ttb.pszServiceUp = SKYPEOUT_CALL;
- if ((int)(httbButton=(HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0))==-1) httbButton=0;
-#endif
return 0;
}
@@ -868,20 +819,16 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { HookEventsLoaded();
RegisterToDbeditorpp();
-
GCInit();
add_contextmenu(NULL);
if (ServiceExists(MS_GC_REGISTER))
{
- GCREGISTER gcr = {0};
- static COLORREF crCols[1] = {0};
+ static COLORREF crCols[1] = { 0 };
char szEvent[MAXMODULELABELLENGTH];
-
- gcr.cbSize = sizeof( GCREGISTER );
+ GCREGISTER gcr = { sizeof(gcr) };
gcr.dwFlags = GC_CHANMGR; // |GC_ACKMSG; // TODO: Not implemented yet
- gcr.dwFlags |= GC_TCHAR;
gcr.ptszDispName = _T("Skype protocol");
gcr.pszModule = SKYPE_PROTONAME;
if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr))
@@ -947,13 +894,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { // Get Timestamp
if (!args.pMsgEntry || !args.pMsgEntry->tEdited) {
- if (!(ptr=SkypeGet (cmdMessage, args.msgnum, "TIMESTAMP"))) return;
- if (strncmp(ptr, "ERROR", 5)) {
- timestamp=atol(ptr);
- // Ensure time correction on clock skew...
- if (timestamp>(DWORD)SkypeTime(NULL)) timestamp=(DWORD)SkypeTime(NULL);
- }
- else timestamp=(DWORD)SkypeTime(NULL);
+ if (!(ptr = SkypeGet(cmdMessage, args.msgnum, "TIMESTAMP"))) return;
+ if (strncmp(ptr, "ERROR", 5)) timestamp = atol(ptr);
+ else timestamp = (DWORD)SkypeTime(NULL);
free(ptr);
}
else timestamp = (DWORD)(args.pMsgEntry->tEdited);
@@ -986,21 +929,14 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "KICKED"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
-
if (!hChat) __leave;
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_KICK;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_KICK };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
-
+ CONTACTINFO ci = { 0 };
ci.hContact = find_contact(users);
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
@@ -1023,9 +959,6 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "SETROLE"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
gchat_contact *gcContact;
char *pszRole;
@@ -1033,18 +966,15 @@ void FetchMessageThread(fetchmsg_arg *pargs) { // USERS - Wessen Rolle wurde gesetzt
// ROLE - Die neue Rolle
if (!hChat) __leave;
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_REMOVESTATUS;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_REMOVESTATUS };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
-
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
@@ -1082,20 +1012,13 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "SETTOPIC"))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
-
LOG(("FetchMessageThread CHAT SETTOPIC"));
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_TOPIC;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_TOPIC };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
-
+ CONTACTINFO ci = { 0 };
ci.hContact = find_contact(who);
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
ci.cbSize = sizeof(ci);
@@ -1123,24 +1046,14 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
if (!strcmp(type, "LEFT") || (bAddedMembers = strcmp(type, "ADDEDMEMBERS") == 0))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
- CONTACTINFO ci = {0};
- char *pszInvited = Translate("invited");
-
LOG(("FetchMessageThread CHAT LEFT or ADDEDMEMBERS"));
if (bAddedMembers) {
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = GC_EVENT_ACTION;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_ACTION };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
gce.time = timestamp;
if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
- // We assume that users buffer has enough room for "invited" string
- memmove (users+strlen(pszInvited), users, strlen(users)+1);
- memcpy (users, pszInvited, strlen(pszInvited));
+ CMString(FORMAT, _T("%S %s"), users, TranslateT("invited"));
gce.ptszText = make_tchar_string((const unsigned char*)users);
if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
DBVARIANT dbv;
@@ -1150,6 +1063,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { }
gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
if (!gce.bIsMe)
ci.hContact = find_contact(who);
@@ -1273,7 +1187,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { mir_free(ci.pszVal);
}
}
- newlen = strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9;
+ newlen = int(strlen(msgptr) + (pszUTFnick ? strlen(pszUTFnick) : 0) + 9);
if (pMsg = (char *)malloc(newlen)) {
sprintf(pMsg, "** %s%s%s **", (pszUTFnick ? pszUTFnick : ""), (pszUTFnick ? " " : ""), (char*)msgptr);
free(ptr);
@@ -1301,7 +1215,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { #ifdef _UNICODE
msglen = (int)strlen(msg) + 1;
msgptr = (char*)make_unicode_string((const unsigned char*)msgptr);
- wcLen = (int)(_tcslen((TCHAR*)msgptr) + 1)*sizeof(TCHAR);
+ wcLen = int(_tcslen((TCHAR*)msgptr) + 1)*sizeof(TCHAR);
msg = (char*)realloc(msg, msglen + wcLen);
memcpy(msg + msglen, msgptr, wcLen);
free(msgptr);
@@ -1321,17 +1235,12 @@ void FetchMessageThread(fetchmsg_arg *pargs) { bHasPartList) || msgptr[0] == 0) __leave;
if (isGroupChat && bUseGroupChat) {
-
- GCDEST gcd = { 0 };
- GCEVENT gce = { sizeof(gce), &gcd };
DBVARIANT dbv = { 0 };
- CONTACTINFO ci = { 0 };
LOG(("FetchMessageThread This is a group chat message"));
if (!hChat) ChatStart(chat, FALSE);
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)chat);
- gcd.iType = bEmoted?GC_EVENT_ACTION:GC_EVENT_MESSAGE;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), bEmoted ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
if ((gce.bIsMe = (direction&DBEF_SENT) ? TRUE : FALSE) && db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
{
free(who);
@@ -1341,6 +1250,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
gce.ptszNick = gce.ptszUID;
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.szProto = SKYPE_PROTONAME;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
@@ -1349,7 +1259,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.ptszNick = ci.pszVal;
gce.time = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
gce.ptszText = (TCHAR*)(msgptr + msglen);
- gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
+ gce.dwFlags = GCEF_ADDTOLOG;
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
MsgList_Add(pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat
if (ci.pszVal) mir_free(ci.pszVal);
@@ -1380,7 +1290,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { TYP_MSGLENTRY *pme;
LOG(("FetchMessageThread Adding event"));
- if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)))
+ if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0)))
dbei.szModule = SKYPE_PROTONAME;
dbei.cbBlob = msglen;
if (pre.flags & PREF_UNICODE)
@@ -1534,9 +1444,7 @@ MCONTACT GetCallerContact(char *szSkypeMsg) MCONTACT GetMetaHandle(DWORD dwId)
{
- MCONTACT hContact;
-
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, "MetaContacts") &&
db_get_dw(hContact, "MetaContacts", "MetaID", MAXDWORD) == dwId)
@@ -1625,11 +1533,6 @@ void RingThread(char *szSkypeMsg) { }
}
- if (HasVoiceService()) {
- // Voice service will handle it
- goto l_exitRT;
- }
-
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_CALL;
dbei.szModule = SKYPE_PROTONAME;
@@ -1647,7 +1550,7 @@ void RingThread(char *szSkypeMsg) { unsigned int popupBackColor, popupTextColor;
int popupTimeSec;
POPUPDATAT InCallPopup;
- TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
@@ -1677,7 +1580,7 @@ void RingThread(char *szSkypeMsg) { dbei.flags = DBEF_READ;
cle.hContact = hContact;
cle.hDbEvent = db_event_add(hContact, &dbei);
- _snprintf(toolTip, sizeof(toolTip), Translate("Incoming call from %s"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0));
+ _snprintf(toolTip, sizeof(toolTip), Translate("Incoming call from %s"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
cle.pszTooltip = toolTip;
CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
@@ -1727,27 +1630,25 @@ void EndCallThread(char *szSkypeMsg) { {
db_unset(hContact, SKYPE_PROTONAME, "CallId");
- if (!HasVoiceService()) {
- dbei.cbSize = sizeof(dbei);
- hDbEvent = db_event_firstUnread(hContact);
- while (hDbEvent) {
- dbei.cbBlob = 0;
- db_event_get(hDbEvent, &dbei);
- if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CALL) {
- db_event_markRead(hContact, hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hDbEvent);
- }
- if (dbei.pBlob) free(dbei.pBlob);
- hDbEvent = db_event_next(hContact, hDbEvent);
+ dbei.cbSize = sizeof(dbei);
+ hDbEvent = db_event_firstUnread(hContact);
+ while (hDbEvent) {
+ dbei.cbBlob = 0;
+ db_event_get(hDbEvent, &dbei);
+ if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CALL) {
+ db_event_markRead(hContact, hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)hDbEvent);
}
+ free(dbei.pBlob);
+ hDbEvent = db_event_next(hContact, hDbEvent);
}
if (!db_get_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) {
db_free(&dbv);
- if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), SKYPE_PROTONAME) &&
+ if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0), SKYPE_PROTONAME) &&
db_get_b(hContact, "CList", "NotOnList", 0)
)
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
}
free(szSkypeMsg);
@@ -1927,7 +1828,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) LPARAM lTyping = PROTOTYPE_CONTACTTYPING_OFF;
if (!strcmp(p, "PURPLE_TYPING")) lTyping = PROTOTYPE_CONTACTTYPING_INFINITE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, lTyping);
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, lTyping);
break;
}
}
@@ -1993,7 +1894,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if (nm = strtok_r(NULL, " ", &nextoken))
{
db_set_utf(hContact, SKYPE_PROTONAME, "FirstName", nm);
- if (!(nm = strtok_r(NULL, "", &nextoken))) {db_unset(hContact, SKYPE_PROTONAME, "LastName");}
+ if (!(nm = strtok_r(NULL, "", &nextoken))) db_unset(hContact, SKYPE_PROTONAME, "LastName");
else
db_set_utf(hContact, SKYPE_PROTONAME, "LastName", nm);
}
@@ -2112,7 +2013,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) else { // BUDDYSTATUS:
flag = 0;
switch (atoi(ptr + 12)) {
- case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); break;
+ case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, hContact, 0); break;
case 0: break;
case 2: flag = PALF_TEMPORARY;
case 3: add_contact(nick, flag);
@@ -2161,18 +2062,12 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) *ptr = 0;
if (hContact = find_chatA(szSkypeMsg + 5))
{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) !=
ID_STATUS_OFFLINE)
{
- gcd.pszModule = SKYPE_PROTONAME;
- gcd.ptszID = make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5);
- gcd.iType = GC_EVENT_CHANGESESSIONAME;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.ptszText = make_tchar_string((const unsigned char*)ptr+14);
- gce.dwFlags = GC_TCHAR;
+ GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)szSkypeMsg + 5), GC_EVENT_CHANGESESSIONAME };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.ptszText = make_tchar_string((const unsigned char*)ptr + 14);
if (gce.ptszText) {
CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
db_set_ts(hContact, SKYPE_PROTONAME, "Nick", gce.ptszText);
@@ -2319,7 +2214,6 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) KillTimer(hWndDlg, 1);
break;
case WM_COPYDATALOCAL:
- --iReentranceCnt;
return WndProc(hWndDlg, WM_COPYDATA, wParam, lParam);
default:
@@ -2438,8 +2332,7 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) int __stdcall SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
- ACKDATA ack = {0};
- ack.cbSize = sizeof( ACKDATA );
+ ACKDATA ack = { sizeof(ACKDATA) };
ack.szModule = SKYPE_PROTONAME;
ack.hContact = hContact;
ack.type = type;
@@ -3006,7 +2899,7 @@ void CleanupNicknames(char *dummy) { LOG(("CleanupNicknames Cleaning up..."));
for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) &&
db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
{
@@ -3247,26 +3140,26 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) { return 0;
}
-extern "C" int __declspec(dllexport) Load()
+extern "C" int __declspec(dllexport) Load(void)
{
DWORD Buffsize;
HKEY MyKey;
BOOL SkypeInstalled;
BOOL UseCustomCommand;
WSADATA wsaData;
- char path[MAX_PATH];
mir_getLP(&pluginInfo);
- // Used to enable Copy DLL hack in older Miranda versions for muliple accounts
- GetModuleFileNameA( hInst, path, sizeof( path ));
- _splitpath (path, NULL, NULL, SKYPE_PROTONAME, NULL);
- CharUpperA( SKYPE_PROTONAME );
+ // RM: commented so it will always use predefined name - or was this really needed?
+ ///GetModuleFileNameA( hInst, path, sizeof( path ));
+ ///_splitpath (path, NULL, NULL, SKYPE_PROTONAME, NULL);
+ ///CharUpperA( SKYPE_PROTONAME );
InitializeCriticalSection(&RingAndEndcallMutex);
InitializeCriticalSection(&QueryThreadMutex);
InitializeCriticalSection(&TimeMutex);
+
#ifdef _DEBUG
init_debug();
#endif
@@ -3349,8 +3242,7 @@ extern "C" int __declspec(dllexport) Load() }
/* Register the module */
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = PROTOCOLDESCRIPTOR_V3_SIZE;
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = SKYPE_PROTONAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
|