From 5161fd3fe53b85f579cfece81e25b562f1fa56ae Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 16 Sep 2012 11:50:15 +0000 Subject: - event code standardization for protocols - fix for EVENTTYPE_AUTHREQUEST processing - protocols' custom CallService core removed git-svn-id: http://svn.miranda-ng.org/main/trunk@1576 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_protosvc.h | 75 ++++--- plugins/!NotAdopted/Skype/skype.c | 365 +++++++++++++++---------------- plugins/!NotAdopted/Tlen/jabber_misc.c | 4 +- plugins/!NotAdopted/Tlen/jabber_svc.c | 7 +- plugins/BasicHistory/src/EventList.cpp | 53 ++--- plugins/Msg_Export/src/utils.cpp | 15 +- plugins/NewEventNotify/src/popup.cpp | 2 +- plugins/StopSpamMod/src/stopspam.cpp | 3 +- plugins/StopSpamPlus/src/events.cpp | 37 ++-- protocols/AimOscar/proto.cpp | 10 +- protocols/FacebookRM/messages.cpp | 3 +- protocols/FacebookRM/process.cpp | 14 +- protocols/FacebookRM/proto.cpp | 11 +- protocols/FacebookRM/stubs.cpp | 36 +-- protocols/Gadu-Gadu/filetransfer.cpp | 3 +- protocols/Gadu-Gadu/gg_proto.cpp | 25 +-- protocols/IRCG/ircproto.cpp | 6 +- protocols/IcqOscarJ/icq_proto.cpp | 57 +++-- protocols/IcqOscarJ/utilities.cpp | 8 +- protocols/JabberG/jabber.cpp | 4 +- protocols/JabberG/jabber.h | 6 - protocols/JabberG/jabber_bookmarks.cpp | 2 +- protocols/JabberG/jabber_byte.cpp | 6 +- protocols/JabberG/jabber_captcha.cpp | 2 +- protocols/JabberG/jabber_chat.cpp | 4 +- protocols/JabberG/jabber_events.cpp | 2 +- protocols/JabberG/jabber_file.cpp | 4 +- protocols/JabberG/jabber_ft.cpp | 2 +- protocols/JabberG/jabber_icolib.cpp | 10 +- protocols/JabberG/jabber_iq_handlers.cpp | 2 +- protocols/JabberG/jabber_iqid.cpp | 10 +- protocols/JabberG/jabber_menu.cpp | 68 +++--- protocols/JabberG/jabber_misc.cpp | 41 ++-- protocols/JabberG/jabber_opt.cpp | 6 +- protocols/JabberG/jabber_privacy.cpp | 8 +- protocols/JabberG/jabber_proto.cpp | 56 +++-- protocols/JabberG/jabber_proxy.cpp | 2 +- protocols/JabberG/jabber_rc.cpp | 36 +-- protocols/JabberG/jabber_secur.cpp | 4 +- protocols/JabberG/jabber_std.cpp | 13 +- protocols/JabberG/jabber_thread.cpp | 34 +-- protocols/JabberG/jabber_treelist.cpp | 6 +- protocols/JabberG/jabber_userinfo.cpp | 6 +- protocols/JabberG/jabber_util.cpp | 18 +- protocols/JabberG/jabber_vcard.cpp | 6 +- protocols/JabberG/jabber_ws.cpp | 4 +- protocols/JabberG/jabber_xstatus.cpp | 2 +- protocols/MRA/MraProto.cpp | 20 +- protocols/MSN/msn.cpp | 2 +- protocols/MSN/msn_auth.cpp | 18 +- protocols/MSN/msn_chat.cpp | 6 +- protocols/MSN/msn_commands.cpp | 16 +- protocols/MSN/msn_contact.cpp | 4 +- protocols/MSN/msn_ftold.cpp | 2 +- protocols/MSN/msn_global.h | 6 - protocols/MSN/msn_http.cpp | 2 +- protocols/MSN/msn_links.cpp | 2 +- protocols/MSN/msn_lists.cpp | 12 +- protocols/MSN/msn_mail.cpp | 2 +- protocols/MSN/msn_menu.cpp | 24 +- protocols/MSN/msn_misc.cpp | 32 +-- protocols/MSN/msn_natdetect.cpp | 2 +- protocols/MSN/msn_opts.cpp | 16 +- protocols/MSN/msn_p2p.cpp | 10 +- protocols/MSN/msn_proto.cpp | 67 +++--- protocols/MSN/msn_soapab.cpp | 2 +- protocols/MSN/msn_srv.cpp | 2 +- protocols/MSN/msn_std.cpp | 21 +- protocols/MSN/msn_threads.cpp | 14 +- protocols/MSN/msn_ws.cpp | 12 +- protocols/Omegle/stubs.cpp | 58 ++--- protocols/Twitter/proto.cpp | 3 +- protocols/Twitter/stubs.cpp | 48 ++-- protocols/Yahoo/avatar.cpp | 2 +- protocols/Yahoo/chat.cpp | 8 +- protocols/Yahoo/icolib.cpp | 2 +- protocols/Yahoo/im.cpp | 3 +- protocols/Yahoo/main.cpp | 2 +- protocols/Yahoo/options.cpp | 6 +- protocols/Yahoo/proto.cpp | 91 ++------ protocols/Yahoo/services.cpp | 12 +- protocols/Yahoo/util.cpp | 15 +- protocols/Yahoo/yahoo.cpp | 24 +- protocols/Yahoo/yahoo.h | 2 - src/core/stdauth/auth.cpp | 16 +- src/core/stdfile/file.cpp | 2 +- src/modules/protocols/protocols.cpp | 17 ++ 87 files changed, 802 insertions(+), 901 deletions(-) diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 1c6d04bb39..304c52b188 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -732,10 +732,58 @@ typedef struct { #define PREF_TCHAR 0 #endif +/* Proto/RecvMessage +Copies a message from a PROTORECVEVENT event into the database + wParam = 0 (unused) + lParam = CCSDATA* +Returns the result of MS_DB_EVENT_ADD +*/ #define PSR_MESSAGE "/RecvMessage" #define MS_PROTO_RECVMSG "Proto/RecvMessage" +__forceinline INT_PTR Proto_RecvMessage(HANDLE hContact, PROTORECVEVENT *pcre) +{ + CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pcre }; + return CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs ); +} + +/* Proto/AuthRecv +Copies the EVENTTYPE_AUTHREQUEST event from PROTORECVEVENT into DBEVENTINFO and adds it + wParam = char* : protocol name + lParam = PROTORECVEVENT* +Returns the result of MS_DB_EVENT_ADD +*/ +#define MS_PROTO_AUTHRECV "Proto/AuthRecv" + +__forceinline INT_PTR Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pcre) +{ return CallService(MS_PROTO_AUTHRECV, (WPARAM)szProtoName, (LPARAM)pcre); +} + +//File(s) have been received +//wParam = 0 +//lParam = (LPARAM)(PROTORECVFILET*)&prf + +typedef struct { + DWORD flags; + DWORD timestamp; //unix time + TCHAR *tszDescription; + int fileCount; + TCHAR **ptszFiles; + LPARAM lParam; //extra space for the network level protocol module +} PROTORECVFILET; + +#define PSR_FILE "/RecvFile" + +#define MS_PROTO_RECVFILET "Proto/RecvFileT" + +__forceinline INT_PTR Proto_RecvFile(HANDLE hContact, PROTORECVFILET *pcre) +{ + CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pcre }; + return CallService(MS_PROTO_RECVFILET, 0, ( LPARAM )&ccs); +} + + //An URL has been received //wParam = 0 //lParam = (LPARAM)(PROTORECVEVENT*)&pre @@ -767,33 +815,6 @@ zero-terminated, binary data should be converted to text. Use PS_ADDTOLISTBYEVENT to add the contacts from one of these to the list. */ -//File(s) have been received (0.9.x) -//wParam = 0 -//lParam = (LPARAM)(PROTORECVFILE*)&prf -typedef struct { - DWORD flags; - DWORD timestamp; //unix time - TCHAR *tszDescription; - int fileCount; - TCHAR **ptszFiles; - LPARAM lParam; //extra space for the network level protocol module -} PROTORECVFILET; - -#define MS_PROTO_RECVFILET "Proto/RecvFileT" - -#define PSR_FILE "/RecvFile" - -// left for compatibility with the old Miranda versions. - -typedef struct { - DWORD flags; - DWORD timestamp; //unix time - char *szDescription; - char **pFiles; - LPARAM lParam; //extra space for the network level protocol module -} PROTORECVFILE; -#define MS_PROTO_RECVFILE "Proto/RecvFile" - //An away message reply has been received //wParam = statusMode //lParam = (LPARAM)(PROTORECVEVENT*)&pre diff --git a/plugins/!NotAdopted/Skype/skype.c b/plugins/!NotAdopted/Skype/skype.c index ea35153860..f229c5a6c3 100644 --- a/plugins/!NotAdopted/Skype/skype.c +++ b/plugins/!NotAdopted/Skype/skype.c @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning (disable: 4706) // assignment within conditional expression -struct MM_INTERFACE mmi; +struct MM_INTERFACE mmi; POPUPDATAT MessagePopup; @@ -143,7 +143,7 @@ int InitVSApi() pfnDrawThemeBackground = (PDTB)GetProcAddress(hUxTheme, "DrawThemeBackground"); pfnCloseThemeData = (PCTD)GetProcAddress(hUxTheme, "CloseThemeData"); pfnDrawThemeText = (PDTT)GetProcAddress(hUxTheme, "DrawThemeText"); - + MyEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); if(pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0) { return 1; @@ -192,7 +192,7 @@ void RegisterToDbeditorpp(void) void RegisterToUpdate(void) { //Use for the Updater plugin - if(ServiceExists(MS_UPDATE_REGISTER)) + if(ServiceExists(MS_UPDATE_REGISTER)) { Update update = {0}; char szVersion[16]; @@ -275,7 +275,7 @@ int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) { MessagePopup.colorText = ! popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT); MessagePopup.iSeconds = popupTimeSec; MessagePopup.PluginData = (void *)1; - + lstrcpy(MessagePopup.lptzText, lpzText); #ifdef _UNICODE @@ -288,7 +288,7 @@ int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) { CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&MessagePopup,0); return 0; - } + } else { if (mustShow==1) MessageBox(NULL,lpzText,_T("Skype Protocol"), MB_OK | MB_ICONWARNING); @@ -344,7 +344,7 @@ void GetInfoThread(HANDLE hContact) { int i; char *ptr; BOOL bSetNick = FALSE; - // All properties are already handled in the WndProc, so we just consume the + // All properties are already handled in the WndProc, so we just consume the // messages here to do proper ERROR handling // If you add something here, be sure to handle it in WndProc, but let it // fall through there so that message gets added to the queue in order to be @@ -355,7 +355,7 @@ void GetInfoThread(HANDLE hContact) { LOG (("GetInfoThread started.")); EnterCriticalSection (&QueryThreadMutex); - if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) + if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) { LOG (("GetInfoThread terminated, cannot find Skype Name for contact %08X.", hContact)); LeaveCriticalSection (&QueryThreadMutex); @@ -418,7 +418,7 @@ void GetInfoThread(HANDLE hContact) { time_t SkypeTime(time_t *timer) { struct _timeb tb; - + EnterCriticalSection (&TimeMutex); _ftime(&tb); if (timer) *timer=tb.time; @@ -501,7 +501,7 @@ void GetDisplaynameThread(char *dummy) { char *ptr; UNREFERENCED_PARAMETER(dummy); - + LOG(("GetDisplaynameThread started.")); if (DBGetContactSettingString(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) { LOG(("GetDisplaynameThread terminated.")); @@ -523,7 +523,7 @@ INT_PTR ImportHistory(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; UNREFERENCED_PARAMETER(lParam); - + if (DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)) { if (DBGetContactSettingString((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoomID", &dbv)) return 0; SkypeSend ("GET CHAT %s CHATMESSAGES", dbv.pszVal); @@ -578,7 +578,7 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) { PROTORECVEVENT pre={0}; HANDLE hContact; char *firstname=NULL, *lastname=NULL, *pCurBlob; - + LOG(("Awaiting auth: %s", token)); ccs.szProtoService=PSR_AUTH; ccs.hContact=hContact=add_contact(token, PALF_TEMPORARY); @@ -595,16 +595,16 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) { *lastname=0; lastname++; } - - pre.lParam=sizeof(DWORD)+sizeof(HANDLE)+strlen(token)+5; - if (firstname) pre.lParam+=strlen(firstname); - if (lastname) pre.lParam+=strlen(lastname); + + pre.lParam=sizeof(DWORD)*2 + 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; + *(DWORD*)pCurBlob = (DWORD)hContact; pCurBlob += sizeof(DWORD); + strcpy((char *)pCurBlob,token); pCurBlob += strlen((char *)pCurBlob)+1; if (firstname) { - strcpy((char *)pCurBlob,firstname); + strcpy((char *)pCurBlob,firstname); if (lastname) { pCurBlob+=strlen((char *)pCurBlob)+1; strcpy((char *)pCurBlob,lastname); @@ -705,10 +705,10 @@ void __cdecl SkypeSystemInit(char *dummy) { SkypeSend("GET PRIVILEGE SKYPEOUT")==-1) { Initializing=FALSE; LOG (("SkypeSystemInit thread stopped with failure.")); - return; + return; } - if(DBGetContactSettingString(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv) == 0) + if(DBGetContactSettingString(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv) == 0) { if (*dbv.pszVal) { @@ -727,7 +727,7 @@ void __cdecl SkypeSystemInit(char *dummy) { // care of? If in doubt, let's wait a while for it to report its hWnd to us. LOG (("Userhandle %s doesn't match username %s from settings", pszUser, dbv.pszVal)); if (!hSkypeWndSecondary) Sleep(3000); - if (hSkypeWndSecondary) + if (hSkypeWndSecondary) { hSkypeWnd = hSkypeWndSecondary; hSkypeWndSecondary = NULL; @@ -742,7 +742,7 @@ void __cdecl SkypeSystemInit(char *dummy) { // If we need to start Skype as secondary instance, we should do it now if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "StartSkype", 1) && - DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "secondary", 0)) + DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "secondary", 0)) { int oldstatus; @@ -754,7 +754,7 @@ void __cdecl SkypeSystemInit(char *dummy) { ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus); ConnectToSkypeAPI(skype_path, 1); } - if (hForbiddenSkypeWnd == hSkypeWnd && !hSkypeWndSecondary) + if (hForbiddenSkypeWnd == hSkypeWnd && !hSkypeWndSecondary) { int oldstatus; @@ -781,8 +781,8 @@ void __cdecl SkypeSystemInit(char *dummy) { } #ifdef SKYPEBUG_OFFLN - if (!ResetEvent(GotUserstatus) || SkypeSend("GET USERSTATUS")==-1 || - WaitForSingleObject(GotUserstatus, INFINITE)==WAIT_FAILED) + if (!ResetEvent(GotUserstatus) || SkypeSend("GET USERSTATUS")==-1 || + WaitForSingleObject(GotUserstatus, INFINITE)==WAIT_FAILED) { LOG (("SkypeSystemInit thread stopped with failure.")); Initializing=FALSE; @@ -793,7 +793,7 @@ void __cdecl SkypeSystemInit(char *dummy) { if (SearchFriends()==-1) { LOG (("SkypeSystemInit thread stopped with failure.")); Initializing=FALSE; - return; + return; } if (protocol>=5 || bIsImoproxy) { SkypeSend ("CREATE APPLICATION libpurple_typing"); @@ -805,7 +805,7 @@ void __cdecl SkypeSystemInit(char *dummy) { SearchRecentChats(NULL); } SkypeSend("SEARCH MISSED%sS", cmdMessage); - + #ifndef SKYPEBUG_OFFLN if (SkypeSend("GET USERSTATUS")==-1) @@ -828,11 +828,11 @@ void FirstLaunch(char *dummy) { UNREFERENCED_PARAMETER(dummy); LOG (("FirstLaunch thread started.")); - if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "StartSkype", 1) || ConnectToSkypeAPI(skype_path, FALSE)==-1) + if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "StartSkype", 1) || ConnectToSkypeAPI(skype_path, FALSE)==-1) { int oldstatus=SkypeStatus; - LOG(("OnModulesLoaded starting offline..")); + LOG(("OnModulesLoaded starting offline..")); InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE); ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus); } @@ -840,7 +840,7 @@ void FirstLaunch(char *dummy) { LOG (("FirstLaunch thread stopped because of invalid Attachstatus.")); return; } - + // When you launch Skype and Attach is Successfull, it still takes some time // until it becomes available for receiving messages. // Let's probe this with PINGing @@ -864,7 +864,7 @@ void FirstLaunch(char *dummy) { int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam) { TTBButton ttb={0}; - + UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); @@ -895,7 +895,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { GCInit(); add_contextmenu(NULL); - if ( ServiceExists( MS_GC_REGISTER )) + if ( ServiceExists( MS_GC_REGISTER )) { GCREGISTER gcr = {0}; static COLORREF crCols[1] = {0}; @@ -905,7 +905,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { gcr.dwFlags = GC_CHANMGR | GC_TCHAR; // |GC_ACKMSG; // TODO: Not implemented yet gcr.ptszModuleDispName = _T("Skype protocol"); gcr.pszModule = SKYPE_PROTONAME; - if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr)) + if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr)) { OUTPUT(_T("Unable to register with Groupchat module!")); } @@ -930,7 +930,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { mir_snprintf(DefaultAvatarsFolder, sizeof(DefaultAvatarsFolder), "%s\\%s", tmpPath, SKYPE_PROTONAME); hProtocolAvatarsFolder = (HANDLE) FoldersRegisterCustomPath(SKYPE_PROTONAME, "Avatars Cache", DefaultAvatarsFolder); } - + if (hProtocolAvatarsFolder == NULL) { // Use defaults @@ -960,7 +960,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (!pargs) return; args = *pargs; free (pargs); - + sprintf (szPartnerHandle, "%s_HANDLE", cmdPartner); pre.lParam = strtoul(args.msgnum, NULL, 10); if (args.bIsRead) pre.flags |= PREF_CREATEREAD; @@ -982,7 +982,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { // Get chat status if ((status=SkypeGetErr ("CHAT", chat, "STATUS")) && !strcmp(status, "MULTI_SUBSCRIBED")) isGroupChat=TRUE; - + // Get chat type if (!(type=SkypeGetErr (cmdMessage, args.msgnum, "TYPE"))) __leave; bEmoted = strcmp(type, "EMOTED")==0; @@ -993,14 +993,14 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (bUseGroupChat) { BOOL bAddedMembers = FALSE; - if (!strcmp(type,"SAWMEMBERS") || !strcmp(type, "CREATEDCHATWITH")) + if (!strcmp(type,"SAWMEMBERS") || !strcmp(type, "CREATEDCHATWITH")) { // We have a new Groupchat LOG(("FetchMessageThread CHAT SAWMEMBERS")); if (!hChat) ChatStart(chat, FALSE); __leave; } - if (!strcmp(type,"KICKED")) + if (!strcmp(type,"KICKED")) { GCDEST gcd = {0}; GCEVENT gce = {0}; @@ -1023,9 +1023,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { ci.cbSize = sizeof(ci); ci.szProto = SKYPE_PROTONAME; ci.dwFlag = CNF_DISPLAY | CNF_TCHAR; - if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; + if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; else gce.ptszNick=gce.ptszUID; - + CallService(MS_GC_EVENT, 0, (LPARAM)&gce); RemChatContact (GetChat(gcd.ptszID), gce.ptszUID); free_nonutf_tchar_string((void*)gce.ptszStatus); @@ -1036,7 +1036,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { free_nonutf_tchar_string((void*)gcd.ptszID); __leave; } - if (!strcmp(type,"SETROLE")) + if (!strcmp(type,"SETROLE")) { GCDEST gcd = {0}; GCEVENT gce = {0}; @@ -1064,14 +1064,14 @@ void FetchMessageThread(fetchmsg_arg *pargs) { ci.dwFlag = CNF_DISPLAY | CNF_TCHAR; ci.hContact = find_contact(who); if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) { - gce.ptszText=_tcsdup(ci.pszVal); + gce.ptszText=_tcsdup(ci.pszVal); miranda_sys_free (ci.pszVal); ci.pszVal = NULL; } else gce.ptszText=make_tchar_string((const unsigned char*)who); ci.hContact = find_contact(users); - if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; + if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; else gce.ptszNick=gce.ptszUID; if (gcContact = GetChatContact(GetChat(gcd.ptszID), gce.ptszUID)) @@ -1094,7 +1094,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { free_nonutf_tchar_string((void*)gcd.ptszID); __leave; } - if (!strcmp(type,"SETTOPIC")) + if (!strcmp(type,"SETTOPIC")) { GCDEST gcd = {0}; GCEVENT gce = {0}; @@ -1114,7 +1114,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { ci.cbSize = sizeof(ci); ci.szProto = SKYPE_PROTONAME; ci.dwFlag = CNF_DISPLAY | CNF_TCHAR; - if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; + if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; else gce.ptszNick=gce.ptszUID; if (ptr=SkypeGetErr (cmdMessage, args.msgnum, "BODY")) { @@ -1134,7 +1134,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { } __leave; } - if (!strcmp(type,"LEFT") || (bAddedMembers = strcmp(type,"ADDEDMEMBERS")==0)) + if (!strcmp(type,"LEFT") || (bAddedMembers = strcmp(type,"ADDEDMEMBERS")==0)) { GCDEST gcd = {0}; GCEVENT gce = {0}; @@ -1163,13 +1163,13 @@ void FetchMessageThread(fetchmsg_arg *pargs) { DBFreeVariant(&dbv); } if (!gce.bIsMe) ci.hContact = find_contact(who); - gce.ptszUID= make_nonutf_tchar_string((const unsigned char*)who); + gce.ptszUID= make_nonutf_tchar_string((const unsigned char*)who); ci.cbSize = sizeof(ci); ci.szProto = SKYPE_PROTONAME; ci.dwFlag = CNF_DISPLAY | CNF_TCHAR; - if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; + if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; else gce.ptszNick=gce.ptszUID; - + CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); free_nonutf_tchar_string((void*)gce.ptszUID); if (ci.pszVal) miranda_sys_free (ci.pszVal); @@ -1237,7 +1237,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (!(hContact=find_contact(who))) { // Arrgh, the user has been deleted from contact list. // In this case, we add him temp. to receive the msg at least. - hContact=add_contact(who, PALF_TEMPORARY); + hContact=add_contact(who, PALF_TEMPORARY); } } // Text which was sent (on edited msg, BODY may already be in queue, check) @@ -1324,7 +1324,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { __leave; } // skype sends some xml statics after a call has finished. Check if thats the case and suppress it if necessary... - if ((DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", 1) && + if ((DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", 1) && bHasPartList) || msgptr[0]==0) __leave; if (isGroupChat && bUseGroupChat) { @@ -1353,8 +1353,8 @@ void FetchMessageThread(fetchmsg_arg *pargs) { ci.dwFlag = CNF_DISPLAY | CNF_TCHAR; ci.hContact = !gce.bIsMe?hContact:NULL; gce.ptszNick=gce.ptszUID; - if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; - gce.time = timestamp>0?timestamp:(DWORD)SkypeTime(NULL); + if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; + gce.time = timestamp>0?timestamp:(DWORD)SkypeTime(NULL); gce.pszText = msgptr; if (pre.flags & PREF_UNICODE) gce.pszText += msglen; gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR; @@ -1418,7 +1418,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { } } - if (!args.QueryMsgDirection && !args.bDontMarkSeen) + if (!args.QueryMsgDirection && !args.bDontMarkSeen) SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum); } } @@ -1431,7 +1431,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { ccs.hContact = hContact; ccs.wParam = 0; ccs.lParam = (LPARAM)⪯ - pre.flags |= direction; + pre.flags |= direction; if(isGroupChat && DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "MarkGroupchatRead", 0)) pre.flags |= PREF_CREATEREAD; pre.timestamp = timestamp>0?timestamp:(DWORD)SkypeTime(NULL); @@ -1459,7 +1459,7 @@ void FetchMessageThreadSync(fetchmsg_arg *pargs) { // been added so that MsgList_FindEntry will find it. WaitForSingleObject (FetchMessageEvent, 30000); // Wait max. 30 sec. for previous message fetch to complete if ((pargs->pMsgEntry = MsgList_FindMessage(strtoul(pargs->msgnum, NULL, 10))) && !pargs->pMsgEntry->tEdited) { - // Better don't do this, as we set the msg as read and with this code, we would + // Better don't do this, as we set the msg as read and with this code, we would // mark messages not opened by user as read which isn't that good /* if (pargs->bIsRead && pMsgEvent->hEvent != INVALID_HANDLE_VALUE) @@ -1550,11 +1550,11 @@ HANDLE GetMetaHandle(DWORD dwId) { if (szProto!=NULL && !strcmp(szProto, "MetaContacts") && DBGetContactSettingDword(hContact, "MetaContacts", "MetaID", MAXDWORD)==dwId) return hContact; - } + } return 0; } -LRESULT CALLBACK InCallPopUpProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +LRESULT CALLBACK InCallPopUpProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { @@ -1563,7 +1563,7 @@ LRESULT CALLBACK InCallPopUpProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) case WM_CONTEXTMENU: SendMessage(hwnd,UM_DESTROYPOPUP,0,0); - break; + break; case UM_FREEPLUGINDATA: //Here we'd free our own data, if we had it. return FALSE; @@ -1588,13 +1588,13 @@ void RingThread(char *szSkypeMsg) { // so that only one function is running at the same time. This is needed, because when // a initated and unaccepted call (which is still ringing) is hangup/canceled, skype // sends two messages. First "CALL xxx STATUS RINGING" .. second "CALL xx STATUS CANCELED". - // This starts two independend threads (first: RingThread; second: EndCallThread). Now + // This starts two independend threads (first: RingThread; second: EndCallThread). Now // the two message are processed in reverse order sometimes. This causes the EndCallThread to - // delete the contacts "CallId" property and after that the RingThread saves the contacts + // delete the contacts "CallId" property and after that the RingThread saves the contacts // "CallId" again. After that its not possible to call this contact, because the plugin - // thinks that there is already a call going and the hangup-function isnt working, because + // thinks that there is already a call going and the hangup-function isnt working, because // skype doesnt accept status-changes for finished calls. The CriticalSection syncronizes - // the threads and the messages are processed in correct order. + // the threads and the messages are processed in correct order. // Not the best solution, but it works. EnterCriticalSection (&RingAndEndcallMutex); @@ -1610,7 +1610,7 @@ void RingThread(char *szSkypeMsg) { } DBWriteContactSettingString(hContact, SKYPE_PROTONAME, "CallId", szSkypeMsg); } - + if (!(ptr=SkypeGet(szSkypeMsg, "TYPE", ""))) { LOG(("RingThread terminated.")); goto l_exitRT;; @@ -1624,7 +1624,7 @@ void RingThread(char *szSkypeMsg) { if (!strncmp(ptr, "INCOMING", 8)) { if (!hContact) { char *szHandle; - + if (szHandle=GetCallerHandle(szSkypeMsg)) { if (!(hContact=add_contact(szHandle, PALF_TEMPORARY))) { free(szHandle); @@ -1649,12 +1649,12 @@ void RingThread(char *szSkypeMsg) { dbei.timestamp=(DWORD)SkypeTime(NULL); dbei.pBlob=(unsigned char*)Translate("Phonecall"); dbei.cbBlob=strlen((const char*)dbei.pBlob)+1; - if (!strncmp(ptr, "INCOMING", 8)) + if (!strncmp(ptr, "INCOMING", 8)) { CLISTEVENT cle={0}; char toolTip[256]; - if(PopupServiceExists) + if(PopupServiceExists) { BOOL showPopup, popupWindowColor; unsigned int popupBackColor, popupTextColor; @@ -1675,7 +1675,7 @@ void RingThread(char *szSkypeMsg) { InCallPopup.iSeconds = popupTimeSec; InCallPopup.PluginWindowProc = (WNDPROC)InCallPopUpProc; InCallPopup.PluginData = (void *)1; - + lstrcpy(InCallPopup.lptzText, TranslateT("Incoming Skype Call")); lstrcpy(InCallPopup.lptzContactName, lpzContactName); @@ -1693,8 +1693,8 @@ void RingThread(char *szSkypeMsg) { _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); - } - else + } + else { dbei.flags=DBEF_SENT; CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei); @@ -1716,13 +1716,13 @@ void EndCallThread(char *szSkypeMsg) { // so that only one function is running at the same time. This is needed, because when // a initated and unaccepted call (which is still ringing) is hangup/canceled, skype // sends two messages. First "CALL xxx STATUS RINGING" .. second "CALL xx STATUS CANCELED". - // This starts two independend threads (first: RingThread; second: EndCallThread). Now + // This starts two independend threads (first: RingThread; second: EndCallThread). Now // the two message are processed in reverse order sometimes. This causes the EndCallThread to - // delete the contacts "CallId" property and after that the RingThread saves the contacts + // delete the contacts "CallId" property and after that the RingThread saves the contacts // "CallId" again. After that its not possible to call this contact, because the plugin - // thinks that there is already a call going and the hangup-function isnt working, because + // thinks that there is already a call going and the hangup-function isnt working, because // skype doesnt accept status-changes for finished calls. The CriticalSection syncronizes - // the threads and the messages are processed in correct order. + // the threads and the messages are processed in correct order. // Not the best solution, but it works. EnterCriticalSection (&RingAndEndcallMutex); @@ -1758,7 +1758,7 @@ void EndCallThread(char *szSkypeMsg) { if (!DBGetContactSettingString(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) { DBFreeVariant(&dbv); - if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), SKYPE_PROTONAME) && + if (!strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), SKYPE_PROTONAME) && DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) ) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); @@ -1824,7 +1824,7 @@ void LaunchSkypeAndSetStatusThread(void *newStatus) { LOG (("LaunchSkypeAndSetStatusThread started.")); InterlockedExchange((long *)&SkypeStatus, (int)ID_STATUS_CONNECTING); ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus); - + if (ConnectToSkypeAPI(skype_path, 1)!=-1) { pthread_create(( pThreadFunc )SkypeSystemInit, NULL); //InterlockedExchange((long *)&SkypeStatus, (int)newStatus); @@ -1836,9 +1836,9 @@ void LaunchSkypeAndSetStatusThread(void *newStatus) { bLaunching = FALSE; } -LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) -{ - PCOPYDATASTRUCT CopyData; +LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) +{ + PCOPYDATASTRUCT CopyData; char *ptr, *szSkypeMsg=NULL, *nick, *buf; static char *onlinestatus=NULL; static BOOL RestoreUserStatus=FALSE; @@ -1848,11 +1848,11 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) static int iReentranceCnt = 0; iReentranceCnt++; - switch (message) - { - case WM_COPYDATA: + switch (message) + { + case WM_COPYDATA: LOG(("WM_COPYDATA start")); - if(hSkypeWnd==(HWND)wParam) { + if(hSkypeWnd==(HWND)wParam) { char *pData; CopyData=(PCOPYDATASTRUCT)lParam; pData = (char*)CopyData->lpData; @@ -1869,7 +1869,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) sstat=ID_STATUS_OFFLINE; if (g_hWnd) KillTimer (g_hWnd, 1); logoff_contacts(TRUE); - } else + } else sstat=SkypeStatusToMiranda(szSkypeMsg+11); if (sstat) { @@ -1891,7 +1891,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) } if (!strncmp(szSkypeMsg, "USERSTATUS", 10)) { // if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11)) && SkypeStatus!=ID_STATUS_CONNECTING) { - if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11))) { + if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11))) { if (RestoreUserStatus && RequestedStatus) { RestoreUserStatus=FALSE; SkypeSend ("SET USERSTATUS %s", RequestedStatus); @@ -1900,8 +1900,8 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) InterlockedExchange((long*)&SkypeStatus, sstat); ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, sstat); #ifdef SKYPEBUG_OFFLN - if ((oldstatus==ID_STATUS_OFFLINE || oldstatus==ID_STATUS_CONNECTING) && - SkypeStatus!=ID_STATUS_CONNECTING && SkypeStatus!=ID_STATUS_OFFLINE) + if ((oldstatus==ID_STATUS_OFFLINE || oldstatus==ID_STATUS_CONNECTING) && + SkypeStatus!=ID_STATUS_CONNECTING && SkypeStatus!=ID_STATUS_OFFLINE) pthread_create(( pThreadFunc )SearchFriendsThread, NULL); #endif } @@ -1969,7 +1969,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) SkypeSend("GET USER %s BUDDYSTATUS", nick); free (buf); break; - } + } if (!strcmp(ptr, "ONLINESTATUS")) { if (SkypeStatus!=ID_STATUS_OFFLINE) @@ -1997,7 +1997,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) * If we don't remove the ERRORs from the list, another consumer may see the ERROR * as a reply to his query and process it. * In case the SKYPE Protocol really broadcasts one of these messages without being - * requested by GetInfoThread (i.e. MOOD_TEXT), the garbage collector will take + * requested by GetInfoThread (i.e. MOOD_TEXT), the garbage collector will take * care of them and remove them after some time. * This may not be the most efficient way, but ensures that we finally do proper * error handling. @@ -2009,7 +2009,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) { SkypeDBWriteContactSettingUTF8String(hContact, SKYPE_PROTONAME, "FirstName", nm); if (!(nm=strtok_r(NULL, "", &nextoken))) DBDeleteContactSetting(hContact, SKYPE_PROTONAME, "LastName"); - else + else SkypeDBWriteContactSettingUTF8String(hContact, SKYPE_PROTONAME, "LastName", nm); } } else @@ -2033,7 +2033,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries); for (i=0; i= 86400 )?(256-((2*(atoi(ptr+9)-86400))/3600)):((-2*(atoi(ptr+9)-86400))/3600); - if (tms.tm_isdst == 1 && DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseTimeZonePatch", 0)) + if (tms.tm_isdst == 1 && DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseTimeZonePatch", 0)) { LOG(("WndProc: Using the TimeZonePatch")); DBWriteContactSettingByte(hContact, "UserInfo", "Timezone", (BYTE)(tz+2)); @@ -2128,7 +2128,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) } else if (!strcmp(ptr, "DISPLAYNAME")) { // Skype Bug? -> If nickname isn't customised in the Skype-App, this won't return anything :-( - if (ptr[12]) + if (ptr[12]) SkypeDBWriteContactSettingUTF8String(hContact, SKYPE_PROTONAME, "Nick", ptr+12); } else // Other proerties that can be directly assigned to a DB-Value { @@ -2151,7 +2151,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) 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); + case 3: add_contact(nick, flag); SkypeSend("GET USER %s ONLINESTATUS", nick); break; } @@ -2165,7 +2165,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) DBVARIANT dbv={0}; if(DBGetContactSettingString(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv) || - !*dbv.pszVal || _stricmp (szSkypeMsg+18, dbv.pszVal)==0) + !*dbv.pszVal || _stricmp (szSkypeMsg+18, dbv.pszVal)==0) { DBWriteContactSettingString(NULL, SKYPE_PROTONAME, SKYPE_NAME, szSkypeMsg+18); DBWriteContactSettingString(NULL, SKYPE_PROTONAME, "Nick", szSkypeMsg+18); @@ -2175,20 +2175,20 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) } if (strstr(szSkypeMsg, "AUTOAWAY") || !strncmp(szSkypeMsg, "OPEN ",5) || (SkypeInitialized && !strncmp (szSkypeMsg, "PONG", 4)) || - !strncmp (szSkypeMsg, "MINIMIZE", 8)) + !strncmp (szSkypeMsg, "MINIMIZE", 8)) { - // Currently we do not process these messages + // Currently we do not process these messages break; } if (!strncmp(szSkypeMsg, "CHAT ", 5)) { // Currently we only process these notifications if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) && - (ptr = strchr (szSkypeMsg, ' ')) && (ptr = strchr (++ptr, ' '))) + (ptr = strchr (szSkypeMsg, ' ')) && (ptr = strchr (++ptr, ' '))) { if (strncmp(ptr, " MEMBERS", 8) == 0) { LOG(("WndProc AddMembers")); pthread_create(( pThreadFunc )AddMembersThread, _strdup(szSkypeMsg)); - } else + } else if (strncmp(ptr, " FRIENDLYNAME ", 14) == 0) { // Chat session name HANDLE hContact; @@ -2249,7 +2249,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if (!bSkypeOut) { CLISTMENUITEM mi={0}; - bSkypeOut=TRUE; + bSkypeOut=TRUE; mi.cbSize=sizeof(mi); mi.position=-2000005000; mi.flags=0; @@ -2270,9 +2270,9 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) break; } if (!strncmp(szSkypeMsg, "MESSAGES", 8) || !strncmp(szSkypeMsg, "CHATMESSAGES", 12)) { - if (strlen(szSkypeMsg)<=(UINT)(strchr(szSkypeMsg, ' ')-szSkypeMsg+1)) + if (strlen(szSkypeMsg)<=(UINT)(strchr(szSkypeMsg, ' ')-szSkypeMsg+1)) { - LOG(( "%s %d %s %d", szSkypeMsg,(UINT)(strchr(szSkypeMsg, ' ')-szSkypeMsg+1), + LOG(( "%s %d %s %d", szSkypeMsg,(UINT)(strchr(szSkypeMsg, ' ')-szSkypeMsg+1), strchr(szSkypeMsg, ' '), strlen(szSkypeMsg))); break; } @@ -2280,7 +2280,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) pthread_create(( pThreadFunc )MessageListProcessingThread, _strdup(strchr(szSkypeMsg, ' ')+1)); break; } - if (!strncmp(szSkypeMsg, "MESSAGE", 7) || !strncmp(szSkypeMsg, "CHATMESSAGE", 11)) + if (!strncmp(szSkypeMsg, "MESSAGE", 7) || !strncmp(szSkypeMsg, "CHATMESSAGE", 11)) { char *pMsgNum; TYP_MSGLENTRY *pEntry; @@ -2295,7 +2295,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) pEntry->tEdited = atol(ptr+18); } bFetchMsg = TRUE; - } else bFetchMsg = (strncmp(ptr, " STATUS RE", 10) == 0 && !rcvwatchers) || + } else bFetchMsg = (strncmp(ptr, " STATUS RE", 10) == 0 && !rcvwatchers) || (strncmp(ptr, " STATUS SENT", 12) == 0 && !sendwatchers); if (bFetchMsg) { @@ -2322,7 +2322,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) bProtocolSet = TRUE; if (protocol<5 && !hMenuAddSkypeContact && - DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "EnableMenu", 1)) + DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "EnableMenu", 1)) { hMenuAddSkypeContact = add_mainmenu(); } @@ -2331,7 +2331,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) SkypeMsgAdd(szSkypeMsg); ReleaseSemaphore(SkypeMsgReceived, receivers, NULL); } - break; + break; case WM_TIMER: if (iReentranceCnt>1) break; @@ -2349,9 +2349,9 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) break; case WM_DESTROY: KillTimer (hWndDlg, 1); - break; + break; - default: + default: if(message==ControlAPIAttach) { // Skype responds with Attach to the discover-message if ((HWND)wParam == hForbiddenSkypeWnd) { @@ -2370,7 +2370,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) } } if (AttachStatus!=SKYPECONTROLAPI_ATTACH_API_AVAILABLE && - AttachStatus!=SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE) + AttachStatus!=SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE) { LOG(("Attaching: SkypeReady fired, Attachstatus is %d", AttachStatus)); SetEvent(SkypeReady); @@ -2379,17 +2379,17 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) break; } --iReentranceCnt; - return (DefWindowProc(hWndDlg, message, wParam, lParam)); + return (DefWindowProc(hWndDlg, message, wParam, lParam)); } LOG(("WM_COPYDATA exit (%08X)", message)); if (szSkypeMsg) free(szSkypeMsg); --iReentranceCnt; return 1; -} +} void TellError(DWORD err) { LPVOID lpMsgBuf; - + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL); MessageBox( NULL, (TCHAR*)lpMsgBuf, _T("GetLastError"), MB_OK|MB_ICONINFORMATION ); @@ -2436,13 +2436,13 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus); } */ - - if ((int)wParam==ID_STATUS_OFFLINE && UnloadOnOffline) + + if ((int)wParam==ID_STATUS_OFFLINE && UnloadOnOffline) { if(UseCustomCommand) { DBVARIANT dbv; - if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"CommandLine",&dbv)) + if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"CommandLine",&dbv)) { CloseSkypeAPI(dbv.pszVal); DBFreeVariant(&dbv); @@ -2453,13 +2453,13 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) CloseSkypeAPI(skype_path); } - } else if (AttachStatus==-1) + } else if (AttachStatus==-1) { pthread_create(LaunchSkypeAndSetStatusThread, (void *)wParam); return 0; } - iRet = SetUserStatus(); + iRet = SetUserStatus(); LOG (("SkypeSetStatus exit")); return iRet; } @@ -2549,7 +2549,7 @@ static int _GetFileSize(char* filename) } /* RetrieveUserAvatar - * + * * Purpose: Get a user avatar from skype itself * Params : param=(void *)(HANDLE)hContact */ @@ -2570,12 +2570,12 @@ void RetrieveUserAvatar(void *param) ack.hContact = hContact; ack.type = ACKTYPE_AVATAR; ack.result = ACKRESULT_FAILED; - + AI.cbSize = sizeof( AI ); AI.hContact = hContact; // Get skype name - if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) + if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) { if (dbv.pszVal) { @@ -2593,13 +2593,13 @@ void RetrieveUserAvatar(void *param) CloseHandle(file); if (ptr=SkypeGet ("USER", dbv.pszVal, AvatarTmpFile)) { - if (strncmp(ptr, "ERROR", 5) && - GetFileAttributesA(pszTempFile) != INVALID_FILE_ATTRIBUTES) + if (strncmp(ptr, "ERROR", 5) && + GetFileAttributesA(pszTempFile) != INVALID_FILE_ATTRIBUTES) { ack.result = ACKRESULT_SUCCESS; // Is no avatar image? - if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", 0) + if (!DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", 0) && GetFileHash(pszTempFile) == 0x8d34e05d && _GetFileSize(pszTempFile) == 3751) { // Has no avatar @@ -2630,7 +2630,7 @@ void RetrieveUserAvatar(void *param) /* SkypeGetAvatarInfo - * + * * Purpose: Set user avatar in profile * Params : wParam=0 * lParam=(LPARAM)(const char*)filename @@ -2641,7 +2641,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) { DBVARIANT dbv; - PROTO_AVATAR_INFORMATION* AI = ( PROTO_AVATAR_INFORMATION* )lParam; + PROTO_AVATAR_INFORMATION* AI = ( PROTO_AVATAR_INFORMATION* )lParam; if (AI->hContact == NULL) // User { if (!DBGetContactSettingString(NULL,SKYPE_PROTONAME, "AvatarFile", &dbv)) @@ -2653,7 +2653,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) else return GAIR_NOAVATAR; } - else // Contact + else // Contact { DBVARIANT dbv; char AvatarFile[MAX_PATH+1]; @@ -2668,7 +2668,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) return GAIR_WAITFOR; } - if (DBGetContactSettingString(AI->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) + if (DBGetContactSettingString(AI->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) // No skype name ?? return GAIR_NOAVATAR; @@ -2687,7 +2687,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) // Check if the file exists if (GetFileAttributesA(AvatarFile) == INVALID_FILE_ATTRIBUTES) return GAIR_NOAVATAR; - + // Return the avatar AI->format = PA_FORMAT_JPEG; strcpy(AI->filename, AvatarFile); @@ -2697,7 +2697,7 @@ INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam) /* SkypeGetAvatarCaps - * + * * Purpose: Query avatar caps for a protocol * Params : wParam=One of AF_* * lParam=Depends on wParam @@ -2750,7 +2750,7 @@ INT_PTR SkypeGetStatus(WPARAM wParam, LPARAM lParam) { INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam) { CCSDATA *ccs = (CCSDATA *) lParam; - + UNREFERENCED_PARAMETER(wParam); pthread_create(GetInfoThread, ccs->hContact); @@ -2807,7 +2807,7 @@ INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam) { char *msg = (char *) ccs->lParam, *utfmsg=NULL, *mymsgcmd=cmdMessage, szId[16]={0}; static DWORD dwMsgNum = 0; BYTE bIsChatroom = 0 != DBGetContactSettingByte(ccs->hContact, SKYPE_PROTONAME, "ChatRoom", 0); - + UNREFERENCED_PARAMETER(wParam); if (bIsChatroom) @@ -2822,7 +2822,7 @@ INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam) { return 0; mymsgcmd="MESSAGE"; } - + if (ccs->wParam & PREF_UTF) { utfmsg = msg; } else if (ccs->wParam & PREF_UNICODE) { @@ -2841,7 +2841,7 @@ INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam) { if (sendok) { msgsendwt_arg *psendarg = calloc(1, sizeof(msgsendwt_arg)); - + if (psendarg) { psendarg->hContact = ccs->hContact; strcpy (psendarg->szId, szId); @@ -2849,7 +2849,7 @@ INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam) { } else InterlockedDecrement (&sendwatchers); return 1; } else InterlockedDecrement (&sendwatchers); - if (!bIsChatroom) + if (!bIsChatroom) ProtoBroadcastAck(SKYPE_PROTONAME, ccs->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1, (LPARAM)Translate("Connection to Skype lost")); return 0; } @@ -2885,7 +2885,7 @@ INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam) { if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv)) { if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) { char szCmd[256]; - _snprintf (szCmd, sizeof(szCmd), + _snprintf (szCmd, sizeof(szCmd), "ALTER APPLICATION libpurple_typing CONNECT %s", dbv.pszVal); SkypeSend (szCmd); DBFreeVariant (&dbv); @@ -2897,7 +2897,7 @@ INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam) { return 0; } - SkypeSend ("ALTER APPLICATION libpurple_typing DATAGRAM %s %s", dbv.pszVal, + SkypeSend ("ALTER APPLICATION libpurple_typing DATAGRAM %s %s", dbv.pszVal, (lParam==PROTOTYPE_SELFTYPING_ON?"PURPLE_TYPING":"PURPLE_NOT_TYPING")); DBFreeVariant(&dbv); return 0; @@ -2946,12 +2946,12 @@ char *__skypeauth(WPARAM wParam) { dbei.cbSize = sizeof(dbei); if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, wParam, 0))==-1 || - !(dbei.pBlob = (unsigned char*)malloc(dbei.cbBlob))) + !(dbei.pBlob = (unsigned char*)malloc(dbei.cbBlob))) { return NULL; } if (CallService(MS_DB_EVENT_GET, wParam, (LPARAM)&dbei) || dbei.eventType != EVENTTYPE_AUTHREQUEST || - strcmp(dbei.szModule, SKYPE_PROTONAME)) + strcmp(dbei.szModule, SKYPE_PROTONAME)) { free(dbei.pBlob); return NULL; @@ -2965,8 +2965,8 @@ INT_PTR SkypeAuthAllow(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); if (pBlob=__skypeauth(wParam)) - { - int retval=SkypeSend("SET USER %s ISAUTHORIZED TRUE", pBlob+sizeof(DWORD)+sizeof(HANDLE)); + { + int retval=SkypeSend("SET USER %s ISAUTHORIZED TRUE", pBlob+sizeof(DWORD)*2); free(pBlob); if (!retval) return 0; } @@ -2979,8 +2979,8 @@ INT_PTR SkypeAuthDeny(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); if (pBlob=__skypeauth(wParam)) - { - int retval=SkypeSend("SET USER %s ISAUTHORIZED FALSE", pBlob+sizeof(DWORD)+sizeof(HANDLE)); + { + int retval=SkypeSend("SET USER %s ISAUTHORIZED FALSE", pBlob+sizeof(DWORD)*2); free(pBlob); if (!retval) return 0; } @@ -2994,8 +2994,8 @@ INT_PTR SkypeAddToListByEvent(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); if (pBlob=__skypeauth(wParam)) - { - HANDLE hContact=add_contact(pBlob+sizeof(DWORD)+sizeof(HANDLE), LOWORD(wParam)); + { + HANDLE hContact = add_contact(pBlob+sizeof(DWORD)*2, LOWORD(wParam)); free(pBlob); if (hContact) return (int)hContact; } @@ -3026,7 +3026,7 @@ void CleanupNicknames(char *dummy) { for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) { szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && - DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0) + DBGetContactSettingByte(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0) { if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue; if (DBGetContactSettingString(hContact, SKYPE_PROTONAME, "Nick", &dbv2)) { @@ -3107,14 +3107,14 @@ int EnumOldPluginName(const char *szSetting,LPARAM lParam) if (pdi && lParam) { pdi->szSettings=(char**)realloc(pdi->szSettings,(pdi->dwCount+1)*sizeof(char*)); pdi->szSettings[pdi->dwCount++]=_strdup(szSetting); - } + } return 0; } -// Are there any Skype users on list? +// Are there any Skype users on list? // 1 --> Yes // 0 --> No -int AnySkypeusers(void) +int AnySkypeusers(void) { HANDLE hContact; DBVARIANT dbv; @@ -3123,9 +3123,9 @@ int AnySkypeusers(void) // already on list? for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact != NULL; - hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) + hContact=(HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) { - // GETCONTACTBASEPROTO doesn't work on not loaded protocol, therefore get + // GETCONTACTBASEPROTO doesn't work on not loaded protocol, therefore get // protocol from DB if (DBGetContactSettingString(hContact, "Protocol", "p", &dbv)) continue; tCompareResult = !strcmp(dbv.pszVal, SKYPE_PROTONAME); @@ -3137,7 +3137,7 @@ int AnySkypeusers(void) void UpgradeName(char *OldName) -{ +{ DBCONTACTENUMSETTINGS cns; DBCONTACTWRITESETTING cws; DBVARIANT dbv; @@ -3168,11 +3168,11 @@ void UpgradeName(char *OldName) if (!CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws)) DBDeleteContactSetting(hContact,OldName,pdi.szSettings[i]); DBFreeVariant(&dbv); - } + } free(pdi.szSettings[i]); } free(pdi.szSettings); - } + } // Upgrade Protocol assignment, if we are not main contact if (hContact && !DBGetContactSettingString(hContact, "Protocol", "p", &dbv)) { if (!strcmp(dbv.pszVal, OldName)) @@ -3191,25 +3191,25 @@ void __cdecl MsgPump (char *dummy) { MSG msg; - WNDCLASS WndClass; + WNDCLASS WndClass; UNREFERENCED_PARAMETER(dummy); // Create window class - WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS; - WndClass.lpfnWndProc = (WNDPROC)WndProc; - WndClass.cbClsExtra = 0; - WndClass.cbWndExtra = 0; + WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS; + WndClass.lpfnWndProc = (WNDPROC)WndProc; + WndClass.cbClsExtra = 0; + WndClass.cbWndExtra = 0; WndClass.hInstance = hInst; - WndClass.hIcon = NULL; + WndClass.hIcon = NULL; WndClass.hCursor = NULL; WndClass.hbrBackground = NULL; - WndClass.lpszMenuName = NULL; - WndClass.lpszClassName = _T("SkypeApiDispatchWindow"); + WndClass.lpszMenuName = NULL; + WndClass.lpszClassName = _T("SkypeApiDispatchWindow"); RegisterClass(&WndClass); // Do not check the retval of RegisterClass, because on non-unicode // win98 it will fail, as it is a stub that returns false() there - + // Create main window g_hWnd=CreateWindowEx( WS_EX_APPWINDOW|WS_EX_WINDOWEDGE, _T("SkypeApiDispatchWindow"), _T(""), WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX, @@ -3220,10 +3220,10 @@ void __cdecl MsgPump (char *dummy) OUTPUT(_T("Cannot create window.")); TellError(GetLastError()); SetEvent(MessagePumpReady); - return; + return; } - ShowWindow(g_hWnd, 0); - UpdateWindow(g_hWnd); + ShowWindow(g_hWnd, 0); + UpdateWindow(g_hWnd); msgPumpThreadId = GetCurrentThreadId(); SetEvent(MessagePumpReady); @@ -3289,7 +3289,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) char path[MAX_PATH]; pluginLink = link; - mir_getMMI( &mmi ); + mir_getMMI( &mmi ); //mir_getLP(&pluginInfo); GetModuleFileNameA( hInst, path, sizeof( path )); @@ -3340,7 +3340,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) UseCustomCommand = (BYTE)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0); UseSockets = (BOOL)DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseSkype2Socket", 0); - if (!UseSockets && !UseCustomCommand) + if (!UseSockets && !UseCustomCommand) { if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey)!=ERROR_SUCCESS) { @@ -3349,10 +3349,10 @@ int __declspec(dllexport) Load(PLUGINLINK *link) SkypeInstalled=FALSE; } } - + Buffsize=sizeof(skype_path); - - if (SkypeInstalled==FALSE || RegQueryValueExA(MyKey, "SkypePath", NULL, NULL, (unsigned char *)skype_path, &Buffsize)!=ERROR_SUCCESS) + + if (SkypeInstalled==FALSE || RegQueryValueExA(MyKey, "SkypePath", NULL, NULL, (unsigned char *)skype_path, &Buffsize)!=ERROR_SUCCESS) { //OUTPUT("Skype was not found installed :( \nMaybe you are using portable skype."); RegCloseKey(MyKey); @@ -3363,13 +3363,13 @@ int __declspec(dllexport) Load(PLUGINLINK *link) } WSAStartup(MAKEWORD(2,2), &wsaData); - // Start Skype connection - if (!(ControlAPIAttach=RegisterWindowMessage(_T("SkypeControlAPIAttach"))) || !(ControlAPIDiscover=RegisterWindowMessage(_T("SkypeControlAPIDiscover")))) + // Start Skype connection + if (!(ControlAPIAttach=RegisterWindowMessage(_T("SkypeControlAPIAttach"))) || !(ControlAPIDiscover=RegisterWindowMessage(_T("SkypeControlAPIDiscover")))) { OUTPUT(_T("Cannot register Window message.")); return 0; } - + SkypeMsgReceived=CreateSemaphore(NULL, 0, MAX_MSGS, NULL); if (!(SkypeReady=CreateEvent(NULL, TRUE, FALSE, NULL)) || !(MessagePumpReady=CreateEvent(NULL, FALSE, FALSE, NULL)) || @@ -3406,19 +3406,19 @@ int __declspec(dllexport) Load(PLUGINLINK *link) -int __declspec( dllexport ) Unload(void) +int __declspec( dllexport ) Unload(void) { BOOL UseCustomCommand = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0); BOOL Shutdown = DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "Shutdown", 0); - + LOG (("Unload started")); - + if ( Shutdown && ((skype_path && skype_path[0]) ||UseCustomCommand) ) { if(UseCustomCommand) { DBVARIANT dbv; - if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"CommandLine",&dbv)) + if(!DBGetContactSettingString(NULL,SKYPE_PROTONAME,"CommandLine",&dbv)) { char szAbsolutePath[MAX_PATH]; @@ -3433,7 +3433,7 @@ int __declspec( dllexport ) Unload(void) _spawnl(_P_NOWAIT, skype_path, skype_path, "/SHUTDOWN", NULL); LOG (("Unload Sent /shutdown to %s", skype_path)); } - + } SkypeMsgCleanup(); //WSACleanup(); @@ -3467,4 +3467,3 @@ int __declspec( dllexport ) Unload(void) DeleteCriticalSection(&TimeMutex); return 0; } - diff --git a/plugins/!NotAdopted/Tlen/jabber_misc.c b/plugins/!NotAdopted/Tlen/jabber_misc.c index 33ddf80f1e..c514c71c88 100644 --- a/plugins/!NotAdopted/Tlen/jabber_misc.c +++ b/plugins/!NotAdopted/Tlen/jabber_misc.c @@ -62,8 +62,8 @@ void JabberDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) //blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ) cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)strlen(nick) + (int)strlen(jid) + 5; pBlob = pCurBlob = (PBYTE) mir_alloc(cbBlob); - *((PDWORD) pCurBlob) = 0; pCurBlob += sizeof(DWORD); - *((PHANDLE) pCurBlob) = hContact; pCurBlob += sizeof(HANDLE); + *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD); + *((PDWORD)pCurBlob) = hContact; pCurBlob += sizeof(DWORD); strcpy((char *) pCurBlob, nick); pCurBlob += strlen(nick)+1; *pCurBlob = '\0'; pCurBlob++; //firstName *pCurBlob = '\0'; pCurBlob++; //lastName diff --git a/plugins/!NotAdopted/Tlen/jabber_svc.c b/plugins/!NotAdopted/Tlen/jabber_svc.c index ecc3b26bfb..36ef5d547f 100644 --- a/plugins/!NotAdopted/Tlen/jabber_svc.c +++ b/plugins/!NotAdopted/Tlen/jabber_svc.c @@ -268,7 +268,7 @@ HANDLE TlenAddToListByEvent(PROTO_INTERFACE *ptr, int flags, int iContact, HANDL return (int)(HANDLE) NULL; } - nick = (char *) (dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE)); + nick = (char *)dbei.pBlob + sizeof(DWORD)*2; firstName = nick + strlen(nick) + 1; lastName = firstName + strlen(firstName) + 1; jid = lastName + strlen(lastName) + 1; @@ -307,7 +307,7 @@ int TlenAuthAllow(PROTO_INTERFACE *ptr, HANDLE hContact) return 1; } - nick = (char *) (dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE)); + nick = (char *)dbei.pBlob + sizeof(DWORD)*2; firstName = nick + strlen(nick) + 1; lastName = firstName + strlen(firstName) + 1; jid = lastName + strlen(lastName) + 1; @@ -361,7 +361,7 @@ int TlenAuthDeny(PROTO_INTERFACE *ptr, HANDLE hContact, const TCHAR* szReason) return 1; } - nick = (char *) (dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE)); + nick = (char *)dbei.pBlob + sizeof(DWORD)*2; firstName = nick + strlen(nick) + 1; lastName = firstName + strlen(firstName) + 1; jid = lastName + strlen(lastName) + 1; @@ -1297,4 +1297,3 @@ void TlenInitServicesVTbl(TlenProtocol *proto) { CreateServiceFunction_Ex(s, proto, TlenAccMgrUI); } - diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 8ac9e2eb37..e6bf5ef0d3 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -82,7 +82,7 @@ bool EventList::CanShowHistory(DBEVENTINFO* dbei) else if(defFilter < 1) { - switch( dbei->eventType ) + switch( dbei->eventType ) { case EVENTTYPE_MESSAGE: case EVENTTYPE_URL: @@ -92,7 +92,7 @@ bool EventList::CanShowHistory(DBEVENTINFO* dbei) default: { DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService( MS_DB_EVENT_GETTYPE, ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType ); - if ( et && ( et->flags & DETF_HISTORY )) + if ( et && ( et->flags & DETF_HISTORY )) { return true; } @@ -140,7 +140,7 @@ bool EventList::CanShowHistory(const IImport::ExternalMessage& message) else if(defFilter < 1) { - switch(message.eventType ) + switch(message.eventType ) { case EVENTTYPE_MESSAGE: case EVENTTYPE_URL: @@ -240,14 +240,14 @@ void EventList::GetTempList(std::list& tempList, bool noFilter, ti.isExternal = false; ei.isExternal = false; hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRST,(WPARAM)_hContact,0); - while ( hDbEvent != NULL ) + while ( hDbEvent != NULL ) { if (isWndLocal && !IsWindow( hWnd )) break; ei.hEvent = hDbEvent; if(GetEventData(ei, data)) { - if(noFilter || CanShowHistory(&gdbei)) + if(noFilter || CanShowHistory(&gdbei)) { ti.hEvent = hDbEvent; ti.timestamp = data.timestamp; @@ -286,7 +286,7 @@ void EventList::RefreshEventList() if(useImportedMessages) { std::vector messages; - + EnterCriticalSection(&criticalSection); std::map::iterator it = contactFileMap.find(hContact); if(it != contactFileMap.end()) @@ -300,7 +300,7 @@ void EventList::RefreshEventList() } LeaveCriticalSection(&criticalSection); - + ImportMessages(messages); } @@ -314,7 +314,7 @@ void EventList::RefreshEventList() revTempList.insert(revTempList.begin(), tempList.rbegin(), tempList.rend()); nrTempList = revTempList; } - + eventList.clear(); eventList.push_back(std::deque()); DWORD lastTime = MAXDWORD; @@ -352,7 +352,7 @@ void EventList::RefreshEventList() } } - if(!eventList.back().empty()) + if(!eventList.back().empty()) { ei = eventList.back().front(); AddGroup(ei); @@ -366,7 +366,7 @@ bool EventList::SearchInContact(HANDLE hContact, TCHAR *strFind, ComparatorInter if(useImportedMessages) { std::vector messages; - + EnterCriticalSection(&criticalSection); std::map::iterator it = contactFileMap.find(hContact); if(it != contactFileMap.end()) @@ -391,7 +391,7 @@ bool EventList::SearchInContact(HANDLE hContact, TCHAR *strFind, ComparatorInter std::list tempList; GetTempList(tempList, false, true, hContact); - + EventIndex ei; EventData ed; TCHAR str[MAXSELECTSTR + 8]; // for safety reason @@ -458,7 +458,7 @@ void EventList::AddGroup(const EventIndex& ev) eventText[Options::instance->groupMessageLen - 1] = '.'; eventText[Options::instance->groupMessageLen] = 0; } - + int ico = 0; GetEventIcon(data.isMe, data.eventType, ico); AddGroup(data.isMe, time, user, eventText, ico); @@ -478,26 +478,26 @@ std::wstring EventList::GetContactName() void GetInfo(CONTACTINFO& ci, std::wstring& str) { - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { - if (ci.type == CNFT_ASCIIZ) + if (ci.type == CNFT_ASCIIZ) { str = ci.pszVal; mir_free(ci.pszVal); } - else if (ci.type == CNFT_DWORD) + else if (ci.type == CNFT_DWORD) { TCHAR buf[20]; _ltot_s(ci.dVal, buf, 10 ); str = buf; - } - else if (ci.type == CNFT_WORD) + } + else if (ci.type == CNFT_WORD) { TCHAR buf[20]; _ltot_s(ci.wVal, buf, 10 ); str = buf; - } + } } } @@ -591,13 +591,15 @@ static void GetAuthRequestDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf { std::wstring allName; buf[0] = 0; - size_t pos = sizeof( DWORD ) + sizeof( HANDLE ); + size_t pos = sizeof(DWORD)*2; if(pos >= dbei->cbBlob) return; - DWORD uin = *((DWORD*)dbei->pBlob); - HANDLE hContact = *((HANDLE*)(dbei->pBlob + sizeof( DWORD ))); + + PDWORD evDwords = (PDWORD)dbei->pBlob; + DWORD uin = evDwords[0]; + HANDLE hContact = (HANDLE)evDwords[1]; char* nick, *firstName, *lastName, *jid, *reason; - nick = ( char* )( dbei->pBlob + sizeof( DWORD )+ sizeof( HANDLE )); + nick = (char*)&evDwords[2]; pos += strnlen_s(nick, dbei->cbBlob - pos) + 1; if(pos >= dbei->cbBlob) return; @@ -649,7 +651,7 @@ static void GetAuthRequestDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf allName += _T(", "); } - _sntprintf_s(buf, cbBuf, _TRUNCATE, TranslateT("Authorisation request by %s (%s%d): %s"), + _sntprintf_s(buf, cbBuf, _TRUNCATE, TranslateT("Authorisation request by %s (%s%d): %s"), (newNick[0] == 0 ? (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR) : newNick), allName.c_str(), uin, newReason); mir_free( newNick ); @@ -661,8 +663,7 @@ static void GetAuthRequestDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf void EventList::GetObjectDescription( DBEVENTINFO *dbei, TCHAR* str, int cbStr ) { - switch( dbei->eventType ) - { + switch( dbei->eventType ) { case EVENTTYPE_AUTHREQUEST: GetAuthRequestDescription( dbei, str, cbStr ); break; @@ -754,7 +755,7 @@ bool EventList::GetEventData(const EventIndex& ev, EventData& data) if(!ev.isExternal) { DWORD newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)ev.hEvent,0); - if(newBlobSize>goldBlobSize) + if(newBlobSize>goldBlobSize) { gdbei.pBlob=(PBYTE)mir_realloc(gdbei.pBlob,newBlobSize); goldBlobSize=newBlobSize; diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 0c5186a021..68bf7cd7a5 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -1271,11 +1271,6 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) LPGENT("e-mail :"), LPGENT("Reason :")}; - /*// test code - dbei.pBlob = (BYTE*)("\xED\xA8\x29\x09nick\0first\0last\0email"); - dbei.cbBlob = 26; - */ - if( dbei.cbBlob < 8 || dbei.cbBlob > 5000 ) { int n = _sntprintf( szTemp , sizeof( szTemp ) , LPGENT("Invalid Database event received. Type %d, size %d"),dbei.eventType, dbei.cbBlob ); @@ -1287,16 +1282,19 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) bool bWriteOk = false; int nStringCount; - const _TCHAR * pszTitle; + const _TCHAR *pszTitle; + char *pszCurBlobPos; if( dbei.eventType == EVENTTYPE_AUTHREQUEST ) { // request - //blob is: uin(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) + //blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) nStringCount = 5; + pszCurBlobPos = (char *)dbei.pBlob + sizeof( DWORD )*2; pszTitle = LPGENT("The following user made an authorization request:"); } else { // Added //blob is: uin(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) + pszCurBlobPos = (char *)dbei.pBlob + sizeof(DWORD); nStringCount = 4; pszTitle = LPGENT("The following user added you to their contact list:"); } @@ -1309,8 +1307,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) int n = _sntprintf( szTemp , sizeof( szTemp ) ,_T("%d"), uin ); if( bWriteTextToFile( hFile , szTemp , bWriteUTF8Format , n ) ) { - char * pszCurBlobPos = (char *) (dbei.pBlob + sizeof( DWORD )); - char * pszEnd = (char *) (dbei.pBlob + dbei.cbSize); + char *pszEnd = (char *) (dbei.pBlob + dbei.cbSize); for( int n = 0 ; n < nStringCount && pszCurBlobPos < pszEnd ; n++ ) { if( *pszCurBlobPos ) diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 355ef6cc86..6e2059a39a 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -457,7 +457,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN // retrieve correct hContact for AUTH events if (dbe.pBlob && (eventType == EVENTTYPE_ADDED || eventType == EVENTTYPE_AUTHREQUEST)) - hContact = *((PHANDLE)(dbe.pBlob + sizeof(DWORD))); + hContact = DbGetAuthEventContact(&dbe); // set plugin_data ... will be usable within PopupDlgProc pdata = (PLUGIN_DATA*)mir_alloc(sizeof(PLUGIN_DATA)); diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index 5c13ec6056..1c3f06e62d 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -50,8 +50,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) { if(!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { - HANDLE hcntct; - hcntct=*((PHANDLE)(dbei.pBlob+sizeof(DWORD))); + HANDLE hcntct = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact int a = DBGetContactSettingByte(hcntct, "CList", "NotOnList", 0); diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index 41f4d9e8eb..3c007afe86 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -8,9 +8,9 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0); - if (-1 == dbei.cbBlob) + if (-1 == dbei.cbBlob) return 0; - + dbei.pBlob = new BYTE[dbei.cbBlob]; CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei); @@ -23,34 +23,34 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) // event is an auth request if (!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { - HANDLE hcntct=*(HANDLE*)(dbei.pBlob + sizeof(DWORD)); + HANDLE hcntct = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact //and if I don't sent message to this contact - if(DBGetContactSettingByte(hcntct, "CList", "NotOnList", 0) && - !DBGetContactSettingByte(hcntct, pluginName, answeredSetting, 0) && - !IsExistMyMessage(hcntct)) + if(DBGetContactSettingByte(hcntct, "CList", "NotOnList", 0) && + !DBGetContactSettingByte(hcntct, pluginName, answeredSetting, 0) && + !IsExistMyMessage(hcntct)) { if (!plSets->HandleAuthReq.Get()) { - + char * buf=mir_utf8encodeW(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str()); CallContactService(hcntct, PSS_MESSAGE, PREF_UTF, (LPARAM)buf); mir_free(buf); - + } char *AuthRepl; - + AuthRepl=mir_u2a(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str()); - + // ...send message std::string allowService = dbei.szModule; allowService += PS_AUTHDENY; CallService(allowService.c_str(), (WPARAM)hDbEvent, (LPARAM)AuthRepl); - + mir_free(AuthRepl); - + DBWriteContactSettingByte(hcntct, "CList", "NotOnList", 1); DBWriteContactSettingByte(hcntct, "CList", "Hidden", 1); if (!plSets->HistLog.Get()) @@ -70,7 +70,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) if (!l) //fix potential DEP crash return 0; DBEVENTINFO * dbei = (DBEVENTINFO*)l; - + // if event is in protocol that is not despammed if(plSets->ProtoDisabled(dbei->szModule)) // ...let the event go its way @@ -101,7 +101,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) return 1; tstring message; - + if(dbei->flags & DBEF_UTF){ WCHAR* msg_u=mir_utf8decodeW((char*)dbei->pBlob); @@ -117,7 +117,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) } - // if message equal right answer... + // if message equal right answer... tstring answers = variables_parse(plSets->Answer.Get(), hContact); answers.append(plSets->AnswSplitString.Get()); tstring::size_type pos = 0; @@ -146,11 +146,11 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) DBDeleteContactSetting(hContact, "CList", "NotOnList"); // send congratulation - + char * buf=mir_utf8encodeW(variables_parse(plSets->Congratulation.Get(), hContact).c_str()); CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf); mir_free(buf); - + // process the event return 1; } @@ -171,7 +171,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf); mir_free(buf); - + // increment question count DWORD questCount = DBGetContactSettingDword(hContact, pluginName, questCountSetting, 0); DBWriteContactSettingDword(hContact, pluginName, questCountSetting, questCount + 1); @@ -234,4 +234,3 @@ MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l) return 0; } - diff --git a/protocols/AimOscar/proto.cpp b/protocols/AimOscar/proto.cpp index fa8d40c564..09f7ba4ab1 100644 --- a/protocols/AimOscar/proto.cpp +++ b/protocols/AimOscar/proto.cpp @@ -468,8 +468,7 @@ int __cdecl CAimProto::RecvContacts(HANDLE hContact, PROTORECVEVENT*) int __cdecl CAimProto::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) { - CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)evt }; - return CallService(MS_PROTO_RECVFILET, 0, (LPARAM)&ccs); + return Proto_RecvFile(hContact, evt); } //////////////////////////////////////////////////////////////////////////////////////// @@ -477,8 +476,6 @@ int __cdecl CAimProto::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) int __cdecl CAimProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) { - CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre }; - char *omsg = pre->szMessage; char *bbuf = NULL; if (getByte(AIM_KEY_FI, 1)) @@ -489,10 +486,9 @@ int __cdecl CAimProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) LOG("Stripping html."); html_decode(pre->szMessage); - HANDLE res = (HANDLE)CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs); - mir_free(bbuf); + INT_PTR res = Proto_RecvMessage(hContact, pre); + mir_free(bbuf); pre->szMessage = omsg; - return ( int )res; } diff --git a/protocols/FacebookRM/messages.cpp b/protocols/FacebookRM/messages.cpp index 1f6d80a6d5..8b27b4721f 100644 --- a/protocols/FacebookRM/messages.cpp +++ b/protocols/FacebookRM/messages.cpp @@ -34,8 +34,7 @@ int FacebookProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF); - CCSDATA ccs = { hContact,PSR_MESSAGE,0,reinterpret_cast(pre) }; - return CallService(MS_PROTO_RECVMSG,0,reinterpret_cast(&ccs)); + return Proto_RecvMessage(hContact, pre); } void FacebookProto::SendMsgWorker(void *p) diff --git a/protocols/FacebookRM/process.cpp b/protocols/FacebookRM/process.cpp index f1481ba8ad..1691fcda08 100644 --- a/protocols/FacebookRM/process.cpp +++ b/protocols/FacebookRM/process.cpp @@ -597,16 +597,16 @@ void FacebookProto::ProcessFriendRequests( void* ) dbei.timestamp = ::time( NULL ); dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_AUTHREQUEST; - dbei.cbBlob = (DWORD)(sizeof( DWORD )+ sizeof( HANDLE ) + fbu->real_name.length() + 5); + dbei.cbBlob = (DWORD)(sizeof( DWORD )*2 + fbu->real_name.length() + 5); PBYTE pCurBlob = dbei.pBlob = ( PBYTE ) mir_alloc( dbei.cbBlob ); - *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID - *(PHANDLE)pCurBlob = hContact; pCurBlob += sizeof(HANDLE); // Contact Handle + *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID + *(PDWORD)pCurBlob = (DWORD)hContact; pCurBlob += sizeof(DWORD); // Contact Handle strcpy((char*)pCurBlob, fbu->real_name.data()); pCurBlob += fbu->real_name.length()+1; // Nickname - *pCurBlob = '\0'; pCurBlob++; // First Name - *pCurBlob = '\0'; pCurBlob++; // Last Name - *pCurBlob = '\0'; pCurBlob++; // E-mail - *pCurBlob = '\0'; // Reason + *pCurBlob = '\0'; pCurBlob++; // First Name + *pCurBlob = '\0'; pCurBlob++; // Last Name + *pCurBlob = '\0'; pCurBlob++; // E-mail + *pCurBlob = '\0'; // Reason CallService(MS_DB_EVENT_ADD, (WPARAM)NULL, (LPARAM)&dbei); diff --git a/protocols/FacebookRM/proto.cpp b/protocols/FacebookRM/proto.cpp index cc5f446662..c2d7a39151 100644 --- a/protocols/FacebookRM/proto.cpp +++ b/protocols/FacebookRM/proto.cpp @@ -566,12 +566,9 @@ int FacebookProto::OnCancelFriendshipRequest(WPARAM wParam,LPARAM lParam) HANDLE FacebookProto::HContactFromAuthEvent(HANDLE hEvent) { - DBEVENTINFO dbei; - DWORD body[3]; - - ZeroMemory(&dbei, sizeof(dbei)); - dbei.cbSize = sizeof(dbei); - dbei.cbBlob = sizeof(DWORD) + sizeof(HANDLE); + DWORD body[2]; + DBEVENTINFO dbei = { sizeof(dbei) }; + dbei.cbBlob = sizeof(DWORD)*2; dbei.pBlob = (PBYTE)&body; if (CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei)) @@ -583,5 +580,5 @@ HANDLE FacebookProto::HContactFromAuthEvent(HANDLE hEvent) if (strcmp(dbei.szModule, m_szModuleName)) return INVALID_HANDLE_VALUE; - return *(HANDLE*)&body[1]; // this is bad - needs new auth system + return DbGetAuthEventContact(&dbei); } diff --git a/protocols/FacebookRM/stubs.cpp b/protocols/FacebookRM/stubs.cpp index 6237a39129..25d3f45252 100644 --- a/protocols/FacebookRM/stubs.cpp +++ b/protocols/FacebookRM/stubs.cpp @@ -24,38 +24,38 @@ along with this program. If not, see . HANDLE FacebookProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent) { - return 0; + return NULL; } int FacebookProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } HANDLE FacebookProto::ChangeInfo(int type,void *info_data) { MessageBoxA(0,"ChangeInfo","",0); - return 0; + return NULL; } HANDLE FacebookProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *path) { - return 0; + return NULL; } int FacebookProto::FileCancel(HANDLE hContact,HANDLE hTransfer) { - return 0; + return 1; } int FacebookProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *reason) { - return 0; + return 1; } int FacebookProto::FileResume(HANDLE hTransfer,int *action,const PROTOCHAR **filename) { - return 0; + return 1; } int FacebookProto::GetInfo( HANDLE hContact, int infoType ) @@ -66,55 +66,55 @@ int FacebookProto::GetInfo( HANDLE hContact, int infoType ) HWND FacebookProto::SearchAdvanced(HWND owner) { - return 0; + return NULL; } HWND FacebookProto::CreateExtendedSearchUI(HWND owner) { - return 0; + return NULL; } int FacebookProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } int FacebookProto::RecvFile(HANDLE hContact,PROTORECVFILET *) { - return 0; + return 1; } int FacebookProto::RecvUrl(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } int FacebookProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *hContactsList) { - return 0; + return 1; } HANDLE FacebookProto::SendFile(HANDLE hContact,const PROTOCHAR *desc, PROTOCHAR **files) { - return 0; + return NULL; } int FacebookProto::SendUrl(HANDLE hContact,int flags,const char *url) { - return 0; + return 1; } int FacebookProto::SetApparentMode(HANDLE hContact,int mode) { - return 0; + return 1; } int FacebookProto::RecvAwayMsg(HANDLE hContact,int mode,PROTORECVEVENT *evt) { - return 0; + return 1; } int FacebookProto::SendAwayMsg(HANDLE hContact,HANDLE hProcess,const char *msg) { - return 0; + return 1; } diff --git a/protocols/Gadu-Gadu/filetransfer.cpp b/protocols/Gadu-Gadu/filetransfer.cpp index d7c7aa52d5..0637273ddb 100644 --- a/protocols/Gadu-Gadu/filetransfer.cpp +++ b/protocols/Gadu-Gadu/filetransfer.cpp @@ -870,8 +870,7 @@ int GGPROTO::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReas int GGPROTO::RecvFile(HANDLE hContact, PROTOFILEEVENT* pre) { - CCSDATA ccs = { hContact, PSR_FILE, 0, ( LPARAM )pre }; - return CallService( MS_PROTO_RECVFILE, 0, ( LPARAM )&ccs ); + return Proto_RecvFile(hContact, pre); } //////////////////////////////////////////////////////////// diff --git a/protocols/Gadu-Gadu/gg_proto.cpp b/protocols/Gadu-Gadu/gg_proto.cpp index 5342193547..0a0db3a173 100644 --- a/protocols/Gadu-Gadu/gg_proto.cpp +++ b/protocols/Gadu-Gadu/gg_proto.cpp @@ -125,19 +125,19 @@ GGPROTO::~GGPROTO() // Dummies for function that have to be implemented HANDLE GGPROTO::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) { return NULL; } -int GGPROTO::Authorize(HANDLE hDbEvent) { return 0; } -int GGPROTO::AuthDeny(HANDLE hDbEvent, const TCHAR *szReason) { return 0; } -int GGPROTO::AuthRecv(HANDLE hContact, PROTORECVEVENT *pre) { return 0; } -int GGPROTO::AuthRequest(HANDLE hContact, const TCHAR *szMessage) { return 0; } +int GGPROTO::Authorize(HANDLE hDbEvent) { return 1; } +int GGPROTO::AuthDeny(HANDLE hDbEvent, const TCHAR *szReason) { return 1; } +int GGPROTO::AuthRecv(HANDLE hContact, PROTORECVEVENT *pre) { return 1; } +int GGPROTO::AuthRequest(HANDLE hContact, const TCHAR *szMessage) { return 1; } HANDLE GGPROTO::ChangeInfo(int iInfoType, void *pInfoData) { return NULL; } -int GGPROTO::FileResume(HANDLE hTransfer, int *action, const PROTOCHAR** szFilename) { return 0; } +int GGPROTO::FileResume(HANDLE hTransfer, int *action, const PROTOCHAR** szFilename) { return 1; } HANDLE GGPROTO::SearchByEmail(const PROTOCHAR *email) { return NULL; } -int GGPROTO::RecvContacts(HANDLE hContact, PROTORECVEVENT *pre) { return 0; } -int GGPROTO::RecvUrl(HANDLE hContact, PROTORECVEVENT *pre) { return 0; } -int GGPROTO::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE *hContactsList) { return 0; } -int GGPROTO::SendUrl(HANDLE hContact, int flags, const char *url) { return 0; } -int GGPROTO::RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT *evt) { return 0; } -int GGPROTO::SendAwayMsg(HANDLE hContact, HANDLE hProcess, const char *msg) { return 0; } +int GGPROTO::RecvContacts(HANDLE hContact, PROTORECVEVENT *pre) { return 1; } +int GGPROTO::RecvUrl(HANDLE hContact, PROTORECVEVENT *pre) { return 1; } +int GGPROTO::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE *hContactsList) { return 1; } +int GGPROTO::SendUrl(HANDLE hContact, int flags, const char *url) { return 1; } +int GGPROTO::RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT *evt) { return 1; } +int GGPROTO::SendAwayMsg(HANDLE hContact, HANDLE hProcess, const char *msg) { return 1; } ////////////////////////////////////////////////////////// // when contact is added to list @@ -558,8 +558,7 @@ HWND GGPROTO::CreateExtendedSearchUI(HWND owner) int GGPROTO::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) { - CCSDATA ccs = { hContact, PSR_MESSAGE, 0, ( LPARAM )pre }; - return CallService(MS_PROTO_RECVMSG, 0, ( LPARAM )&ccs); + return Proto_RecvMessage(hContact, pre); } ////////////////////////////////////////////////////////// diff --git a/protocols/IRCG/ircproto.cpp b/protocols/IRCG/ircproto.cpp index b81880247e..9ff2a1c851 100644 --- a/protocols/IRCG/ircproto.cpp +++ b/protocols/IRCG/ircproto.cpp @@ -656,8 +656,7 @@ int __cdecl CIrcProto::RecvContacts( HANDLE, PROTORECVEVENT* ) int __cdecl CIrcProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt ) { - CCSDATA ccs = { hContact, PSR_FILE, 0, ( LPARAM )evt }; - return CallService( MS_PROTO_RECVFILET, 0, ( LPARAM )&ccs ); + return Proto_RecvFile(hContact, evt); } //////////////////////////////////////////////////////////////////////////////////////// @@ -665,8 +664,7 @@ int __cdecl CIrcProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt ) int __cdecl CIrcProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* evt ) { - CCSDATA ccs = { hContact, PSR_MESSAGE, 0, ( LPARAM )evt }; - return CallService( MS_PROTO_RECVMSG, 0, ( LPARAM )&ccs ); + return Proto_RecvMessage(hContact, evt); } //////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/IcqOscarJ/icq_proto.cpp b/protocols/IcqOscarJ/icq_proto.cpp index 7df3c037d3..017bfe5482 100755 --- a/protocols/IcqOscarJ/icq_proto.cpp +++ b/protocols/IcqOscarJ/icq_proto.cpp @@ -439,38 +439,37 @@ HANDLE __cdecl CIcqProto::AddToListByEvent( int flags, int iContact, HANDLE hDbE if (strcmpnull(dbei.szModule, m_szModuleName)) return 0; // this event is not ours - if (dbei.eventType == EVENTTYPE_CONTACTS) - { - int i; - char *pbOffset, *pbEnd; - - for (i = 0, pbOffset = (char*)dbei.pBlob, pbEnd = pbOffset + dbei.cbBlob; i <= iContact; i++) + switch(dbei.eventType) { + case EVENTTYPE_CONTACTS: { - pbOffset += strlennull(pbOffset) + 1; // Nick - if (pbOffset >= pbEnd) break; - if (i == iContact) - { // we found the contact, get uid - if (IsStringUIN((char*)pbOffset)) - uin = atoi((char*)pbOffset); - else - { - uin = 0; - strcpy(uid, (char*)pbOffset); + char *pbOffset = (char*)dbei.pBlob; + char *pbEnd = pbOffset + dbei.cbBlob; + for (int i = 0; i <= iContact; i++) { + pbOffset += strlennull(pbOffset) + 1; // Nick + if (pbOffset >= pbEnd) break; + if (i == iContact) + { // we found the contact, get uid + if (IsStringUIN((char*)pbOffset)) + uin = atoi((char*)pbOffset); + else + { + uin = 0; + strcpy(uid, (char*)pbOffset); + } } + pbOffset += strlennull(pbOffset) + 1; // Uin + if (pbOffset >= pbEnd) break; } - pbOffset += strlennull(pbOffset) + 1; // Uin - if (pbOffset >= pbEnd) break; } - } - else if (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED) - { - return 0; - } - else // auth req or added event - { - HANDLE hContact = *(HANDLE*)(dbei.pBlob + sizeof(DWORD)); // this sucks - awaiting new auth system - if (getContactUid(hContact, &uin, &uid)) + break; + + case EVENTTYPE_AUTHREQUEST: + case EVENTTYPE_ADDED: + if ( getContactUid( DbGetAuthEventContact(&dbei), &uin, &uid)) return 0; + + default: + return 0; } if (uin != 0) @@ -549,7 +548,6 @@ int __cdecl CIcqProto::AuthRecv( HANDLE hContact, PROTORECVEVENT* pre ) return 0; } - //////////////////////////////////////////////////////////////////////////////////////// // PSS_AUTHREQUEST @@ -1111,8 +1109,7 @@ int __cdecl CIcqProto::RecvContacts( HANDLE hContact, PROTORECVEVENT* pre ) int __cdecl CIcqProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt ) { - CCSDATA ccs = { hContact, PSR_FILE, 0, ( LPARAM )evt }; - return CallService( MS_PROTO_RECVFILE, 0, ( LPARAM )&ccs ); + return Proto_RecvFile(hContact, evt); } diff --git a/protocols/IcqOscarJ/utilities.cpp b/protocols/IcqOscarJ/utilities.cpp index 4f68ecb535..70f7547108 100644 --- a/protocols/IcqOscarJ/utilities.cpp +++ b/protocols/IcqOscarJ/utilities.cpp @@ -593,12 +593,10 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) HANDLE CIcqProto::HContactFromAuthEvent(HANDLE hEvent) { - DBEVENTINFO dbei; + DBEVENTINFO dbei = { sizeof(dbei) }; DWORD body[3]; - ZeroMemory(&dbei, sizeof(dbei)); - dbei.cbSize = sizeof(dbei); - dbei.cbBlob = sizeof(DWORD) + sizeof(HANDLE); + dbei.cbBlob = sizeof(DWORD)*2; dbei.pBlob = (PBYTE)&body; if (CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei)) @@ -610,7 +608,7 @@ HANDLE CIcqProto::HContactFromAuthEvent(HANDLE hEvent) if (strcmpnull(dbei.szModule, m_szModuleName)) return INVALID_HANDLE_VALUE; - return *(HANDLE*)&body[1]; // this is bad - needs new auth system + return DbGetAuthEventContact(&dbei); } char *NickFromHandle(HANDLE hContact) diff --git a/protocols/JabberG/jabber.cpp b/protocols/JabberG/jabber.cpp index 5ea6fc7b84..a3dd31a3fa 100644 --- a/protocols/JabberG/jabber.cpp +++ b/protocols/JabberG/jabber.cpp @@ -224,10 +224,10 @@ extern "C" int __declspec( dllexport ) Load() mir_getLP( &pluginInfo ); WORD v[4]; - JCallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v); + CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v); mir_sntprintf(szCoreVersion, SIZEOF(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]); - JCallService( MS_UTILS_GETCOUNTRYLIST, ( WPARAM )&g_cbCountries, ( LPARAM )&g_countries ); + CallService( MS_UTILS_GETCOUNTRYLIST, ( WPARAM )&g_cbCountries, ( LPARAM )&g_countries ); setlocale(LC_ALL, ""); diff --git a/protocols/JabberG/jabber.h b/protocols/JabberG/jabber.h index f9ffdda8a6..957b7d66bf 100644 --- a/protocols/JabberG/jabber.h +++ b/protocols/JabberG/jabber.h @@ -703,12 +703,6 @@ struct JabberAdHocData void __fastcall JFreeVariant( DBVARIANT* dbv ); char* __fastcall JTranslate( const char* str ); -#if defined( _DEBUG ) - #define JCallService CallService -#else - INT_PTR __stdcall JCallService( const char* szSvcName, WPARAM wParam, LPARAM lParam ); -#endif - //---- jabber_util.cpp ------------------------------------------------------------------ struct TStringPairsElem diff --git a/protocols/JabberG/jabber_bookmarks.cpp b/protocols/JabberG/jabber_bookmarks.cpp index 9ad9baf91a..158f83e669 100644 --- a/protocols/JabberG/jabber_bookmarks.cpp +++ b/protocols/JabberG/jabber_bookmarks.cpp @@ -370,7 +370,7 @@ void CJabberDlgBookmarks::OpenBookmark() } else { char *szUrl = mir_t2a(item->jid); - JCallService(MS_UTILS_OPENURL, 1, (LPARAM)szUrl); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)szUrl); mir_free(szUrl); } } diff --git a/protocols/JabberG/jabber_byte.cpp b/protocols/JabberG/jabber_byte.cpp index 2126aab373..9e86b51388 100644 --- a/protocols/JabberG/jabber_byte.cpp +++ b/protocols/JabberG/jabber_byte.cpp @@ -207,7 +207,7 @@ void CJabberProto::ByteSendThread( JABBER_BYTE_TRANSFER *jbt ) nlb.pfnNewConnectionV2 = JabberByteSendConnection; nlb.pExtra = this; nlb.wPort = 0; // Use user-specified incoming port ranges, if available - jbt->hConn = ( HANDLE ) JCallService( MS_NETLIB_BINDPORT, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nlb ); + jbt->hConn = ( HANDLE ) CallService( MS_NETLIB_BINDPORT, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nlb ); if ( jbt->hConn == NULL ) { Log( "Cannot allocate port for bytestream_send thread, thread ended." ); delete jbt; @@ -463,7 +463,7 @@ void CJabberProto::ByteSendViaProxy( JABBER_BYTE_TRANSFER *jbt ) nloc.cbSize = sizeof( nloc ); nloc.szHost = mir_t2a(szHost); nloc.wPort = port; - hConn = ( HANDLE ) JCallService( MS_NETLIB_OPENCONNECTION, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nloc ); + hConn = ( HANDLE ) CallService( MS_NETLIB_OPENCONNECTION, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nloc ); mir_free((void*)nloc.szHost); if ( hConn != NULL ) { @@ -645,7 +645,7 @@ void __cdecl CJabberProto::ByteReceiveThread( JABBER_BYTE_TRANSFER *jbt ) nloc.cbSize = sizeof( nloc ); nloc.szHost = mir_t2a(szHost); nloc.wPort = port; - hConn = ( HANDLE ) JCallService( MS_NETLIB_OPENCONNECTION, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nloc ); + hConn = ( HANDLE ) CallService( MS_NETLIB_OPENCONNECTION, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nloc ); mir_free((void*)nloc.szHost); if ( hConn == NULL ) { diff --git a/protocols/JabberG/jabber_captcha.cpp b/protocols/JabberG/jabber_captcha.cpp index 641538d190..88d3038ab7 100644 --- a/protocols/JabberG/jabber_captcha.cpp +++ b/protocols/JabberG/jabber_captcha.cpp @@ -144,7 +144,7 @@ bool CJabberProto::ProcessCaptcha (HXML node, HXML parentNode, ThreadData* info GetCaptchaImage(parentNode, ImageBuf, PicType, CaptchaPath); char* p = mir_t2a( CaptchaPath ); - param.bmp = ( HBITMAP ) JCallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )p ); + param.bmp = ( HBITMAP ) CallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )p ); DeleteFile(CaptchaPath); mir_free(CaptchaPath); mir_free(p); diff --git a/protocols/JabberG/jabber_chat.cpp b/protocols/JabberG/jabber_chat.cpp index f73d2c1559..7a36012092 100644 --- a/protocols/JabberG/jabber_chat.cpp +++ b/protocols/JabberG/jabber_chat.cpp @@ -1427,7 +1427,7 @@ static void sttLogListHook( CJabberProto* ppro, JABBER_LIST_ITEM* item, GCHOOK* if (item != NULL) { item->type = _T("conference"); HANDLE hContact = ppro->HContactFromJID( item->jid ); - item->name = ( TCHAR* )JCallService( MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR ); + item->name = ( TCHAR* )CallService( MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR ); ppro->AddEditBookmark( item ); } } @@ -1507,7 +1507,7 @@ static void sttSendPrivateMessage( CJabberProto* ppro, JABBER_LIST_ITEM* item, c DBWriteContactSettingByte( hContact, "CList", "Hidden", 1 ); ppro->JSetStringT( hContact, "Nick", nick ); DBWriteContactSettingDword( hContact, "Ignore", "Mask1", 0 ); - JCallService( MS_MSG_SENDMESSAGE, ( WPARAM )hContact, 0 ); + CallService( MS_MSG_SENDMESSAGE, ( WPARAM )hContact, 0 ); } } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/JabberG/jabber_events.cpp b/protocols/JabberG/jabber_events.cpp index 87a4aa4e7a..3f416aa54b 100644 --- a/protocols/JabberG/jabber_events.cpp +++ b/protocols/JabberG/jabber_events.cpp @@ -137,7 +137,7 @@ void __cdecl CJabberProto::OnRenameContact( DBCONTACTWRITESETTING* cws, HANDLE h return; if ( cws->value.type == DBVT_DELETED ) { - TCHAR* nick = ( TCHAR* )JCallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, GCDNF_NOMYHANDLE | GCDNF_TCHAR ); + TCHAR* nick = ( TCHAR* )CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, GCDNF_NOMYHANDLE | GCDNF_TCHAR ); AddContactToRoster( item->jid, nick, item->group ); mir_free(nick); return; diff --git a/protocols/JabberG/jabber_file.cpp b/protocols/JabberG/jabber_file.cpp index c445e1f4b0..5db215d024 100644 --- a/protocols/JabberG/jabber_file.cpp +++ b/protocols/JabberG/jabber_file.cpp @@ -51,7 +51,7 @@ void __cdecl CJabberProto::FileReceiveThread( filetransfer* ft ) nloc.cbSize = sizeof( NETLIBOPENCONNECTION ); nloc.szHost = ft->httpHostName; nloc.wPort = ft->httpPort; - info.s = ( HANDLE ) JCallService( MS_NETLIB_OPENCONNECTION, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nloc ); + info.s = ( HANDLE ) CallService( MS_NETLIB_OPENCONNECTION, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nloc ); if ( info.s == NULL ) { Log( "Connection failed ( %d ), thread ended", WSAGetLastError()); JSendBroadcast( ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0 ); @@ -262,7 +262,7 @@ void __cdecl CJabberProto::FileServerThread( filetransfer* ft ) nlb.pfnNewConnectionV2 = JabberFileServerConnection; nlb.pExtra = this; nlb.wPort = 0; // Use user-specified incoming port ranges, if available - info.s = ( HANDLE ) JCallService( MS_NETLIB_BINDPORT, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nlb ); + info.s = ( HANDLE ) CallService( MS_NETLIB_BINDPORT, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nlb ); if ( info.s == NULL ) { Log( "Cannot allocate port to bind for file server thread, thread ended." ); JSendBroadcast( ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0 ); diff --git a/protocols/JabberG/jabber_ft.cpp b/protocols/JabberG/jabber_ft.cpp index 906b5b3562..4ded28d84d 100644 --- a/protocols/JabberG/jabber_ft.cpp +++ b/protocols/JabberG/jabber_ft.cpp @@ -372,7 +372,7 @@ void CJabberProto::FtHandleSiRequest( HXML iqNode ) pre.tszDescription = ( TCHAR* )xmlGetText( n ); CCSDATA ccs = { ft->std.hContact, PSR_FILE, 0, ( LPARAM )&pre }; - JCallService( MS_PROTO_CHAINRECV, 0, ( LPARAM )&ccs ); + CallService( MS_PROTO_CHAINRECV, 0, ( LPARAM )&ccs ); return; } else { diff --git a/protocols/JabberG/jabber_icolib.cpp b/protocols/JabberG/jabber_icolib.cpp index 04609604f4..7fae4936cc 100644 --- a/protocols/JabberG/jabber_icolib.cpp +++ b/protocols/JabberG/jabber_icolib.cpp @@ -310,7 +310,7 @@ HICON CJabberProto::LoadIconEx( const char* name, bool big ) char szSettingName[100]; mir_snprintf( szSettingName, sizeof( szSettingName ), "%s_%s", m_szModuleName, name ); - return ( HICON )JCallService( MS_SKIN2_GETICON, big, (LPARAM)szSettingName ); + return ( HICON )CallService( MS_SKIN2_GETICON, big, (LPARAM)szSettingName ); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -585,9 +585,9 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR* jid, HANDLE hContact void CJabberProto::CheckAllContactsAreTransported() { - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( !lstrcmpA( m_szModuleName, szProto )) { DBVARIANT dbv; if ( !JGetStringT( hContact, "jid", &dbv )) { @@ -595,7 +595,7 @@ void CJabberProto::CheckAllContactsAreTransported() JFreeVariant( &dbv ); } } - hContact = ( HANDLE )JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 ); + hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 ); } } ///////////////////////////////////////////////////////////////////////////////////////// @@ -706,7 +706,7 @@ HICON g_LoadIconEx( const char* name, bool big ) { char szSettingName[100]; mir_snprintf( szSettingName, sizeof( szSettingName ), "%s_%s", GLOBAL_SETTING_PREFIX, name ); - return ( HICON )JCallService( MS_SKIN2_GETICON, big, (LPARAM)szSettingName ); + return ( HICON )CallService( MS_SKIN2_GETICON, big, (LPARAM)szSettingName ); } void g_ReleaseIcon( HICON hIcon ) diff --git a/protocols/JabberG/jabber_iq_handlers.cpp b/protocols/JabberG/jabber_iq_handlers.cpp index ff3863e116..7f3385ff6e 100644 --- a/protocols/JabberG/jabber_iq_handlers.cpp +++ b/protocols/JabberG/jabber_iq_handlers.cpp @@ -664,7 +664,7 @@ BOOL CJabberProto::OnIqRequestOOB( HXML, CJabberIqInfo *pInfo ) pre.lParam = ( LPARAM )ft; CCSDATA ccs = { ft->std.hContact, PSR_FILE, 0, ( LPARAM )&pre }; - JCallService( MS_PROTO_CHAINRECV, 0, ( LPARAM )&ccs ); + CallService( MS_PROTO_CHAINRECV, 0, ( LPARAM )&ccs ); mir_free( str2 ); } else { diff --git a/protocols/JabberG/jabber_iqid.cpp b/protocols/JabberG/jabber_iqid.cpp index dcc7f9c6ee..a4a5d5a5f2 100644 --- a/protocols/JabberG/jabber_iqid.cpp +++ b/protocols/JabberG/jabber_iqid.cpp @@ -526,9 +526,9 @@ void CJabberProto::OnIqResultGetRoster( HXML iqNode, CJabberIqInfo* pInfo ) if ( m_options.RosterSync == TRUE ) { int listSize = 0, listAllocSize = 0; HANDLE* list = NULL; - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* str = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* str = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( str != NULL && !strcmp( str, m_szModuleName )) { DBVARIANT dbv; if ( !JGetStringT( hContact, "jid", &dbv )) { @@ -546,12 +546,12 @@ void CJabberProto::OnIqResultGetRoster( HXML iqNode, CJabberIqInfo* pInfo ) JFreeVariant( &dbv ); } } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } for ( i=0; i < listSize; i++ ) { Log( "Syncing roster: deleting 0x%x", list[i] ); - JCallService( MS_DB_CONTACT_DELETE, ( WPARAM ) list[i], 0 ); + CallService( MS_DB_CONTACT_DELETE, ( WPARAM ) list[i], 0 ); } if ( list != NULL ) mir_free( list ); @@ -694,7 +694,7 @@ LBL_Ret: Log( "%d bytes written", nWritten ); if ( hContact == NULL ) { hasPhoto = TRUE; - JCallService( MS_AV_SETMYAVATART, ( WPARAM )m_szModuleName, ( LPARAM )szAvatarFileName ); + CallService( MS_AV_SETMYAVATART, ( WPARAM )m_szModuleName, ( LPARAM )szAvatarFileName ); Log( "My picture saved to " TCHAR_STR_PARAM, szAvatarFileName ); } diff --git a/protocols/JabberG/jabber_menu.cpp b/protocols/JabberG/jabber_menu.cpp index 81bfb8d4c9..6bc4c1f8c8 100644 --- a/protocols/JabberG/jabber_menu.cpp +++ b/protocols/JabberG/jabber_menu.cpp @@ -81,7 +81,7 @@ static INT_PTR JabberMenuChooseService( WPARAM wParam, LPARAM lParam ) static CJabberProto* JabberGetInstanceByHContact( HANDLE hContact ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto == NULL ) return NULL; @@ -172,7 +172,7 @@ static void sttEnableMenuItem( HANDLE hMenuItem, BOOL bEnable ) if ( !bEnable ) clmi.flags |= CMIF_HIDDEN; - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuItem, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuItem, ( LPARAM )&clmi ); } static int JabberPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) @@ -206,7 +206,7 @@ void g_MenuInit( void ) mnu.cbSize = sizeof(mnu); mnu.name = "JabberAccountChooser"; mnu.ExecService = "Jabber/MenuChoose"; - hChooserMenu = (HANDLE)JCallService( MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu ); + hChooserMenu = (HANDLE)CallService( MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu ); TMO_MenuItem tmi = { 0 }; tmi.cbSize = sizeof( tmi ); @@ -214,7 +214,7 @@ void g_MenuInit( void ) tmi.pszName = "Cancel"; tmi.position = 9999999; tmi.hIcolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); - JCallService( MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, ( LPARAM )&tmi ); + CallService( MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, ( LPARAM )&tmi ); ////////////////////////////////////////////////////////////////////////////////////// // Contact menu initialization @@ -358,14 +358,14 @@ void g_MenuInit( void ) void g_MenuUninit( void ) { - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRequestAuth, 0 ); - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuGrantAuth, 0 ); - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRevokeAuth, 0 ); - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuConvert, 0 ); - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRosterAdd, 0 ); - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuLogin, 0 ); - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRefresh, 0 ); - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuAddBookmark, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRequestAuth, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuGrantAuth, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRevokeAuth, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuConvert, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRosterAdd, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuLogin, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuRefresh, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )g_hMenuAddBookmark, 0 ); UnhookEvent( hPrebuildMenuHook ); for (int i = 0; i < arServices.realCount; i++) @@ -394,7 +394,7 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) clmi.cbSize = sizeof( clmi ); clmi.pszName = bIsChatRoom ? (char *)LPGEN("&Convert to Contact") : (char *)LPGEN("&Convert to Chat Room"); clmi.flags = CMIM_NAME | CMIM_FLAGS; - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuConvert, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuConvert, ( LPARAM )&clmi ); } } if (!m_bJabberOnline) @@ -678,7 +678,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd( WPARAM wParam, LPARAM ) item = ( JABBER_LIST_ITEM* )mir_alloc( sizeof( JABBER_LIST_ITEM )); ZeroMemory( item, sizeof( JABBER_LIST_ITEM )); item->jid = mir_tstrdup(roomID); - item->name = ( TCHAR* )JCallService( MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR ); + item->name = ( TCHAR* )CallService( MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR ); item->type = _T("conference"); if ( !JGetStringT(( HANDLE ) wParam, "MyNick", &dbv )) { item->nick = mir_tstrdup(dbv.ptszVal); @@ -718,7 +718,7 @@ void CJabberProto::MenuInit() } else { if ( m_hMenuRoot ) - JCallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 ); + CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 ); m_hMenuRoot = NULL; } @@ -918,7 +918,7 @@ void CJabberProto::GlobalMenuInit() tmi.ownerdata = this; tmi.position = iChooserMenuPos++; tmi.ptszName = m_tszUserName; - m_hChooseMenuItem = (HANDLE)JCallService( MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, ( LPARAM )&tmi ); + m_hChooseMenuItem = (HANDLE)CallService( MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, ( LPARAM )&tmi ); ////////////////////////////////////////////////////////////////////////////////////// // Hotkeys @@ -1005,14 +1005,14 @@ void CJabberProto::GlobalMenuUninit() { if ( m_phMenuResourceItems ) { for ( int i=0; i < m_nMenuResourceItems; i++ ) - JCallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )m_phMenuResourceItems[i], 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )m_phMenuResourceItems[i], 0 ); mir_free(m_phMenuResourceItems); m_phMenuResourceItems = NULL; } m_nMenuResourceItems = 0; if ( m_hMenuRoot ) - JCallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 ); + CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 ); m_hMenuRoot = NULL; } @@ -1030,30 +1030,30 @@ void CJabberProto::CheckMenuItems() if ( !m_menuItemsStatus ) clmi.flags |= CMIF_GRAYED; - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuChangePassword, ( LPARAM )&clmi ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuGroupchat, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuChangePassword, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuGroupchat, ( LPARAM )&clmi ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuPrivacyLists, ( LPARAM )&clmi ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRosterControl, ( LPARAM )&clmi ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuServiceDiscovery, ( LPARAM )&clmi ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDMyTransports, ( LPARAM )&clmi ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDTransports, ( LPARAM )&clmi ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDConferences, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuPrivacyLists, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRosterControl, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuServiceDiscovery, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDMyTransports, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDTransports, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuSDConferences, ( LPARAM )&clmi ); clmi.flags = CMIM_FLAGS | (( m_ThreadInfo && ( m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) ? 0 : CMIF_HIDDEN ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuBookmarks, ( LPARAM )&clmi ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuNotes, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuBookmarks, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuNotes, ( LPARAM )&clmi ); clmi.flags = CMIM_FLAGS | (( m_ThreadInfo && ( m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVACY_LISTS)) ? 0 : CMIF_HIDDEN ); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hPrivacyMenuRoot, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hPrivacyMenuRoot, ( LPARAM )&clmi ); clmi.flags = CMIM_FLAGS | ( m_menuItemsStatus ? 0 : CMIF_HIDDEN); - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuPriorityRoot, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuPriorityRoot, ( LPARAM )&clmi ); if ( !m_bPepSupported ) clmi.flags |= CMIF_HIDDEN; for ( int i=0; i < m_pepServices.getCount(); i++ ) - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_pepServices[i].GetMenu(), ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_pepServices[i].GetMenu(), ( LPARAM )&clmi ); JabberUpdateDialogs( m_menuItemsStatus ); } @@ -1296,14 +1296,14 @@ CJabberProto *JabberChooseInstance(bool bIsLink) } else clmi.flags |= CMIF_HIDDEN; - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )ppro->m_hChooseMenuItem, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )ppro->m_hChooseMenuItem, ( LPARAM )&clmi ); } if ( nItems > 1 ) { ListParam param = { 0 }; param.MenuObjectHandle = hChooserMenu; HMENU hMenu = CreatePopupMenu(); - JCallService( MO_BUILDMENU, ( WPARAM )hMenu, ( LPARAM )¶m ); + CallService( MO_BUILDMENU, ( WPARAM )hMenu, ( LPARAM )¶m ); POINT pt; GetCursorPos(&pt); @@ -1313,7 +1313,7 @@ CJabberProto *JabberChooseInstance(bool bIsLink) if ( res ) { CJabberProto* pro = NULL; - JCallService( MO_PROCESSCOMMANDBYMENUIDENT, res, ( LPARAM )&pro ); + CallService( MO_PROCESSCOMMANDBYMENUIDENT, res, ( LPARAM )&pro ); return pro; } diff --git a/protocols/JabberG/jabber_misc.cpp b/protocols/JabberG/jabber_misc.cpp index 101711e1b7..2fb483f905 100644 --- a/protocols/JabberG/jabber_misc.cpp +++ b/protocols/JabberG/jabber_misc.cpp @@ -94,7 +94,7 @@ static void JabberContactListCreateClistGroup( TCHAR* groupName ) _tcsncpy( newName+1, groupName, SIZEOF( newName )-1 ); newName[ SIZEOF( newName )-1] = '\0'; DBWriteContactSettingTString( NULL, "CListGroups", str, newName ); - JCallService( MS_CLUI_GROUPADDED, i+1, 0 ); + CallService( MS_CLUI_GROUPADDED, i+1, 0 ); } void JabberContactListCreateGroup( TCHAR* groupName ) @@ -127,25 +127,24 @@ void CJabberProto::DBAddAuthRequest( const TCHAR* jid, const TCHAR* nick ) char* szJid = mir_utf8encodeT( jid ); char* szNick = mir_utf8encodeT( nick ); - //blob is: uin( DWORD ), hContact( HANDLE ), nick( ASCIIZ ), first( ASCIIZ ), last( ASCIIZ ), email( ASCIIZ ), reason( ASCIIZ ) - //blob is: 0( DWORD ), hContact( HANDLE ), nick( ASCIIZ ), ""( ASCIIZ ), ""( ASCIIZ ), email( ASCIIZ ), ""( ASCIIZ ) - DBEVENTINFO dbei = {0}; - dbei.cbSize = sizeof( DBEVENTINFO ); + //blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) + //blob is: 0( DWORD ), hContact(DWORD), nick( ASCIIZ ), ""( ASCIIZ ), ""( ASCIIZ ), email( ASCIIZ ), ""( ASCIIZ ) + DBEVENTINFO dbei = { sizeof(DBEVENTINFO) }; dbei.szModule = m_szModuleName; dbei.timestamp = ( DWORD )time( NULL ); dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_AUTHREQUEST; - dbei.cbBlob = (DWORD)(sizeof( DWORD )+ sizeof( HANDLE ) + strlen( szNick ) + strlen( szJid ) + 5); - PBYTE pCurBlob = dbei.pBlob = ( PBYTE ) mir_alloc( dbei.cbBlob ); - *(( PDWORD ) pCurBlob ) = 0; pCurBlob += sizeof( DWORD ); - *(( PHANDLE ) pCurBlob ) = hContact; pCurBlob += sizeof( HANDLE ); + dbei.cbBlob = (DWORD)(sizeof(DWORD)*2 + strlen( szNick ) + strlen( szJid ) + 5); + PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); + *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD); + *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD); strcpy(( char* )pCurBlob, szNick ); pCurBlob += strlen( szNick )+1; *pCurBlob = '\0'; pCurBlob++; //firstName *pCurBlob = '\0'; pCurBlob++; //lastName strcpy(( char* )pCurBlob, szJid ); pCurBlob += strlen( szJid )+1; *pCurBlob = '\0'; //reason - JCallService( MS_DB_EVENT_ADD, ( WPARAM ) ( HANDLE ) NULL, ( LPARAM )&dbei ); + CallService( MS_DB_EVENT_ADD, ( WPARAM ) ( HANDLE ) NULL, ( LPARAM )&dbei ); Log( "Setup DBAUTHREQUEST with nick='%s' jid='%s'", szNick, szJid ); mir_free( szJid ); @@ -176,9 +175,9 @@ HANDLE CJabberProto::DBCreateContact( const TCHAR* jid, const TCHAR* nick, BOOL len = _tcslen( s ); // We can't use JabberHContactFromJID() here because of the stripResource option - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto!=NULL && !strcmp( m_szModuleName, szProto )) { DBVARIANT dbv; if ( !JGetStringT( hContact, "jid", &dbv )) { @@ -189,12 +188,12 @@ HANDLE CJabberProto::DBCreateContact( const TCHAR* jid, const TCHAR* nick, BOOL } JFreeVariant( &dbv ); } } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } if ( hContact == NULL ) { - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_ADD, 0, 0 ); - JCallService( MS_PROTO_ADDTOCONTACT, ( WPARAM ) hContact, ( LPARAM )m_szModuleName ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_ADD, 0, 0 ); + CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM ) hContact, ( LPARAM )m_szModuleName ); JSetStringT( hContact, "jid", s ); if ( nick != NULL && *nick != '\0' ) JSetStringT( hContact, "Nick", nick ); @@ -277,7 +276,7 @@ void CJabberProto::GetAvatarFileName( HANDLE hContact, TCHAR* pszDest, size_t cb DWORD dwAttributes = GetFileAttributes( pszDest ); if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 ) - JCallService( MS_UTILS_CREATEDIRTREET, 0, ( LPARAM )pszDest ); + CallService( MS_UTILS_CREATEDIRTREET, 0, ( LPARAM )pszDest ); pszDest[ tPathLen++ ] = '\\'; @@ -328,10 +327,10 @@ void CJabberProto::ResolveTransportNicks( const TCHAR* jid ) // Set all contacts to offline HANDLE hContact = m_ThreadInfo->resolveContact; if ( hContact == NULL ) - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); - for ( ; hContact != NULL; hContact = ( HANDLE )JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 )) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + for ( ; hContact != NULL; hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 )) { + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( lstrcmpA( szProto, m_szModuleName )) continue; @@ -620,7 +619,7 @@ void CJabberProto::InitPopups(void) mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Errors")); mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Error"); - JCallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&ppc); + CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&ppc); } void CJabberProto::MsgPopup(HANDLE hContact, const TCHAR *szMsg, const TCHAR *szTitle) @@ -635,7 +634,7 @@ void CJabberProto::MsgPopup(HANDLE hContact, const TCHAR *szMsg, const TCHAR *sz ppd.hContact = hContact; mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Error"); - JCallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); + CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); } else { DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP; MessageBox(NULL, szMsg, szTitle, mtype); diff --git a/protocols/JabberG/jabber_opt.cpp b/protocols/JabberG/jabber_opt.cpp index 9f41640340..b3e02d96fc 100644 --- a/protocols/JabberG/jabber_opt.cpp +++ b/protocols/JabberG/jabber_opt.cpp @@ -1062,10 +1062,10 @@ void CJabberProto::_RosterHandleGetRequest( HXML node ) } // now it is require to process whole contact list to add not in roster contacts { - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* str = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* str = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( str != NULL && !strcmp( str, m_szModuleName )) { DBVARIANT dbv; @@ -1100,7 +1100,7 @@ void CJabberProto::_RosterHandleGetRequest( HXML node ) DBFreeVariant( &dbv ); } } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } } rrud.bReadyToDownload = FALSE; diff --git a/protocols/JabberG/jabber_privacy.cpp b/protocols/JabberG/jabber_privacy.cpp index 7d9258c021..bb9c9fb97b 100644 --- a/protocols/JabberG/jabber_privacy.cpp +++ b/protocols/JabberG/jabber_privacy.cpp @@ -432,10 +432,10 @@ public: SendDlgItemMessage( m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0 ); - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto != NULL && !strcmp( szProto, m_proto->m_szModuleName )) { DBVARIANT dbv; @@ -445,7 +445,7 @@ public: JFreeVariant( &dbv ); } } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } // append known chatroom jids from bookmarks @@ -2278,7 +2278,7 @@ void CJabberProto::BuildPrivacyListsMenu( bool bDeleteOld ) int i; if ( bDeleteOld ) for ( i=0; i < m_hPrivacyMenuItems.getCount(); i++ ) - JCallService( MO_REMOVEMENUITEM, (WPARAM)m_hPrivacyMenuItems[i], 0 ); + CallService( MO_REMOVEMENUITEM, (WPARAM)m_hPrivacyMenuItems[i], 0 ); m_hPrivacyMenuItems.destroy(); m_privacyListManager.Lock(); diff --git a/protocols/JabberG/jabber_proto.cpp b/protocols/JabberG/jabber_proto.cpp index 0139bdf0eb..3057267688 100644 --- a/protocols/JabberG/jabber_proto.cpp +++ b/protocols/JabberG/jabber_proto.cpp @@ -182,18 +182,18 @@ CJabberProto::CJabberProto( const char* aProtoName, const TCHAR* aUserName ) : char text[ MAX_PATH ]; mir_snprintf( text, sizeof( text ), "%s/Status", m_szModuleName ); - JCallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); + CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); mir_snprintf( text, sizeof( text ), "%s/%s", m_szModuleName, DBSETTING_DISPLAY_UID ); - JCallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); + CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); mir_snprintf( text, sizeof( text ), "%s/SubscriptionText", m_szModuleName ); - JCallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); + CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); mir_snprintf( text, sizeof( text ), "%s/Subscription", m_szModuleName ); - JCallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); + CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); mir_snprintf( text, sizeof( text ), "%s/Auth", m_szModuleName ); - JCallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); + CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); mir_snprintf( text, sizeof( text ), "%s/Grant", m_szModuleName ); - JCallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); + CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text ); DBVARIANT dbv; if ( !JGetStringT( NULL, "XmlLang", &dbv )) { @@ -203,7 +203,7 @@ CJabberProto::CJabberProto( const char* aProtoName, const TCHAR* aUserName ) : else m_tszSelectedLang = mir_tstrdup( _T( "en" )); if (!DBGetContactSettingString(NULL, m_szModuleName, "Password", &dbv)) { - JCallService(MS_DB_CRYPT_DECODESTRING, lstrlenA(dbv.pszVal) + 1, (LPARAM)dbv.pszVal); + CallService(MS_DB_CRYPT_DECODESTRING, lstrlenA(dbv.pszVal) + 1, (LPARAM)dbv.pszVal); TCHAR *pssw = mir_a2t(dbv.pszVal); JSetStringCrypt(NULL, "LoginPassword", pssw); mir_free(pssw); @@ -320,12 +320,12 @@ int CJabberProto::OnModulesLoadedEx( WPARAM, LPARAM ) JHookEvent( ME_MSG_ICONPRESSED, &CJabberProto::OnProcessSrmmIconClick ); JHookEvent( ME_MSG_WINDOWEVENT, &CJabberProto::OnProcessSrmmEvent ); - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto != NULL && !strcmp( szProto, m_szModuleName )) MenuHideSrmmIcon(hContact); - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } } DBEVENTTYPEDESCR dbEventType = {0}; @@ -333,12 +333,12 @@ int CJabberProto::OnModulesLoadedEx( WPARAM, LPARAM ) dbEventType.eventType = JABBER_DB_EVENT_TYPE_CHATSTATES; dbEventType.module = m_szModuleName; dbEventType.descr = "Chat state notifications"; - JCallService( MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType ); + CallService( MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType ); dbEventType.eventType = JABBER_DB_EVENT_TYPE_PRESENCE; dbEventType.module = m_szModuleName; dbEventType.descr = "Presence notifications"; - JCallService( MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType ); + CallService( MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType ); JHookEvent( ME_IDLE_CHANGED, &CJabberProto::OnIdleChanged ); @@ -383,8 +383,8 @@ HANDLE CJabberProto::AddToListByJID( const TCHAR* newJid, DWORD flags ) // not already there: add jid = mir_tstrdup( newJid ); Log( "Add new jid to contact jid = " TCHAR_STR_PARAM, jid ); - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_ADD, 0, 0 ); - JCallService( MS_PROTO_ADDTOCONTACT, ( WPARAM ) hContact, ( LPARAM )m_szModuleName ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_ADD, 0, 0 ); + CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM ) hContact, ( LPARAM )m_szModuleName ); JSetStringT( hContact, "jid", jid ); if (( nick=JabberNickFromJID( newJid )) == NULL ) nick = mir_tstrdup( newJid ); @@ -435,11 +435,11 @@ HANDLE __cdecl CJabberProto::AddToListByEvent( int flags, int /*iContact*/, HAND Log( "AddToListByEvent" ); ZeroMemory( &dbei, sizeof( dbei )); dbei.cbSize = sizeof( dbei ); - if (( dbei.cbBlob = JCallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hDbEvent, 0 )) == ( DWORD )( -1 )) + if (( dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hDbEvent, 0 )) == ( DWORD )( -1 )) return NULL; if (( dbei.pBlob=( PBYTE ) alloca( dbei.cbBlob )) == NULL ) return NULL; - if ( JCallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )) + if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )) return NULL; if ( strcmp( dbei.szModule, m_szModuleName )) return NULL; @@ -454,7 +454,7 @@ HANDLE __cdecl CJabberProto::AddToListByEvent( int flags, int /*iContact*/, HAND if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ) return NULL; - nick = ( char* )( dbei.pBlob + sizeof( DWORD )+ sizeof( HANDLE )); + nick = ( char* )( dbei.pBlob + sizeof( DWORD )*2); firstName = nick + strlen( nick ) + 1; lastName = firstName + strlen( firstName ) + 1; jid = lastName + strlen( lastName ) + 1; @@ -478,11 +478,11 @@ int CJabberProto::Authorize( HANDLE hDbEvent ) memset( &dbei, 0, sizeof( dbei )); dbei.cbSize = sizeof( dbei ); - if (( dbei.cbBlob=JCallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hDbEvent, 0 )) == ( DWORD )( -1 )) + if (( dbei.cbBlob=CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hDbEvent, 0 )) == ( DWORD )( -1 )) return 1; if (( dbei.pBlob=( PBYTE )alloca( dbei.cbBlob )) == NULL ) return 1; - if ( JCallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )) + if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )) return 1; if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ) return 1; @@ -531,11 +531,11 @@ int CJabberProto::AuthDeny( HANDLE hDbEvent, const TCHAR* /*szReason*/ ) Log( "Entering AuthDeny" ); memset( &dbei, 0, sizeof( dbei )); dbei.cbSize = sizeof( dbei ); - if (( dbei.cbBlob=JCallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hDbEvent, 0 )) == ( DWORD )( -1 )) + if (( dbei.cbBlob=CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hDbEvent, 0 )) == ( DWORD )( -1 )) return 1; if (( dbei.pBlob=( PBYTE ) mir_alloc( dbei.cbBlob )) == NULL ) return 1; - if ( JCallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )) { + if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )) { mir_free( dbei.pBlob ); return 1; } @@ -548,7 +548,7 @@ int CJabberProto::AuthDeny( HANDLE hDbEvent, const TCHAR* /*szReason*/ ) return 1; } - nick = ( char* )( dbei.pBlob + sizeof( DWORD )+ sizeof( HANDLE )); + nick = ( char* )( dbei.pBlob + sizeof(DWORD)*2); firstName = nick + strlen( nick ) + 1; lastName = firstName + strlen( firstName ) + 1; jid = lastName + strlen( lastName ) + 1; @@ -990,8 +990,7 @@ int __cdecl CJabberProto::RecvContacts( HANDLE /*hContact*/, PROTORECVEVENT* ) int __cdecl CJabberProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt ) { - CCSDATA ccs = { hContact, PSR_FILE, 0, ( LPARAM )evt }; - return JCallService( MS_PROTO_RECVFILET, 0, ( LPARAM )&ccs ); + return Proto_RecvFile(hContact, evt); } //////////////////////////////////////////////////////////////////////////////////////// @@ -999,13 +998,12 @@ int __cdecl CJabberProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt ) int __cdecl CJabberProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* evt ) { - CCSDATA ccs = { hContact, PSR_MESSAGE, 0, ( LPARAM )evt }; - int nDbEvent = JCallService( MS_PROTO_RECVMSG, 0, ( LPARAM )&ccs ); + INT_PTR nDbEvent = Proto_RecvMessage(hContact, evt); EnterCriticalSection( &m_csLastResourceMap ); if (IsLastResourceExists( (void *)evt->lParam)) { - m_ulpResourceToDbEventMap[ m_dwResourceMapPointer++ ] = ( ULONG_PTR )nDbEvent; - m_ulpResourceToDbEventMap[ m_dwResourceMapPointer++ ] = ( ULONG_PTR )evt->lParam; + m_ulpResourceToDbEventMap[ m_dwResourceMapPointer++ ] = nDbEvent; + m_ulpResourceToDbEventMap[ m_dwResourceMapPointer++ ] = evt->lParam; if ( m_dwResourceMapPointer >= SIZEOF( m_ulpResourceToDbEventMap )) m_dwResourceMapPointer = 0; } @@ -1647,7 +1645,7 @@ int __cdecl CJabberProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPAR clmi.cbSize = sizeof(CLISTMENUITEM); clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; clmi.ptszName = m_tszUserName; - JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRoot, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRoot, ( LPARAM )&clmi ); } break; diff --git a/protocols/JabberG/jabber_proxy.cpp b/protocols/JabberG/jabber_proxy.cpp index 0741dcd53e..1702eb52de 100644 --- a/protocols/JabberG/jabber_proxy.cpp +++ b/protocols/JabberG/jabber_proxy.cpp @@ -71,7 +71,7 @@ int JabberHttpGatewayInit( HANDLE /*hConn*/, NETLIBOPENCONNECTION* /*nloc*/, NET nlhpi.firstPostSequence = 1; sprintf( szHttpGetUrl, "http://%s/monitor?sid=%s", szHttpServer, szSid ); sprintf( szHttpPostUrl, "http://%s/data?sid=%s&seq=", szHttpServer, szSid ); - return JCallService( MS_NETLIB_SETHTTPPROXYINFO, ( WPARAM )hConn, ( LPARAM )&nlhpi ); + return CallService( MS_NETLIB_SETHTTPPROXYINFO, ( WPARAM )hConn, ( LPARAM )&nlhpi ); #endif return 1; } diff --git a/protocols/JabberG/jabber_rc.cpp b/protocols/JabberG/jabber_rc.cpp index 1a9ac3e346..f0a6f658d2 100644 --- a/protocols/JabberG/jabber_rc.cpp +++ b/protocols/JabberG/jabber_rc.cpp @@ -275,7 +275,7 @@ int CJabberProto::AdhocSetStatusHandler( HXML, CJabberIqInfo* pInfo, CJabberAdho fieldNode << XCHILD( _T("required")); - int status = JCallService( MS_CLIST_GETSTATUSMODE, 0, 0 ); + int status = CallService( MS_CLIST_GETSTATUSMODE, 0, 0 ); switch ( status ) { case ID_STATUS_INVISIBLE: fieldNode << XCHILD( _T("value"), _T("invisible")); @@ -323,7 +323,7 @@ int CJabberProto::AdhocSetStatusHandler( HXML, CJabberIqInfo* pInfo, CJabberAdho fieldNode = xNode << XCHILD( _T("field")) << XATTR( _T("label"), TranslateT("Change global status")) << XATTR( _T("type"), _T("boolean")) << XATTR( _T("var"), _T("status-global")); - char* szStatusMsg = (char *)JCallService( MS_AWAYMSG_GETSTATUSMSG, status, 0 ); + char* szStatusMsg = (char *)CallService( MS_AWAYMSG_GETSTATUSMSG, status, 0 ); if ( szStatusMsg ) { fieldNode << XCHILD( _T("value"), _A2T(szStatusMsg)); mir_free( szStatusMsg ); @@ -387,7 +387,7 @@ int CJabberProto::AdhocSetStatusHandler( HXML, CJabberIqInfo* pInfo, CJabberAdho fieldNode = xmlGetChildByTag( xNode, "field", "var", _T("status-global")); if ( fieldNode && (valueNode = xmlGetChild( fieldNode , "value" ))) { if ( xmlGetText( valueNode ) && _ttoi( xmlGetText( valueNode ))) - JCallService( MS_CLIST_SETSTATUSMODE, status, NULL ); + CallService( MS_CLIST_SETSTATUSMODE, status, NULL ); else CallProtoService( m_szModuleName, PS_SETSTATUS, status, NULL ); } @@ -476,20 +476,20 @@ int CJabberProto::AdhocOptionsHandler( HXML, CJabberIqInfo* pInfo, CJabberAdhocS int CJabberProto::RcGetUnreadEventsCount() { int nEventsSent = 0; - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto != NULL && !strcmp( szProto, m_szModuleName )) { DBVARIANT dbv; if ( !JGetStringT( hContact, "jid", &dbv )) { - HANDLE hDbEvent = (HANDLE)JCallService( MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0 ); + HANDLE hDbEvent = (HANDLE)CallService( MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0 ); while ( hDbEvent ) { DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0 ); if ( dbei.cbBlob != -1 ) { dbei.pBlob = (PBYTE)mir_alloc( dbei.cbBlob + 1 ); - int nGetTextResult = JCallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei ); + int nGetTextResult = CallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei ); if ( !nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) { TCHAR* szEventText = DbGetEventTextT( &dbei, CP_ACP ); if ( szEventText ) { @@ -499,12 +499,12 @@ int CJabberProto::RcGetUnreadEventsCount() } mir_free( dbei.pBlob ); } - hDbEvent = (HANDLE)JCallService( MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0 ); + hDbEvent = (HANDLE)CallService( MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0 ); } JFreeVariant( &dbv ); } } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } return nEventsSent; } @@ -573,21 +573,21 @@ int CJabberProto::AdhocForwardHandler( HXML, CJabberIqInfo* pInfo, CJabberAdhocS m_options.RcMarkMessagesAsRead = bRemoveCListEvents ? 1 : 0; int nEventsSent = 0; - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto != NULL && !strcmp( szProto, m_szModuleName )) { DBVARIANT dbv; if ( !JGetStringT( hContact, "jid", &dbv )) { - HANDLE hDbEvent = (HANDLE)JCallService( MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0 ); + HANDLE hDbEvent = (HANDLE)CallService( MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0 ); while ( hDbEvent ) { DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0 ); if ( dbei.cbBlob != -1 ) { dbei.pBlob = (PBYTE)mir_alloc( dbei.cbBlob + 1 ); - int nGetTextResult = JCallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei ); + int nGetTextResult = CallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei ); if ( !nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) { TCHAR* szEventText = DbGetEventTextT( &dbei, CP_ACP ); if ( szEventText ) { @@ -618,21 +618,21 @@ int CJabberProto::AdhocForwardHandler( HXML, CJabberIqInfo* pInfo, CJabberAdhocS nEventsSent++; - JCallService( MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDbEvent ); + CallService( MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDbEvent ); if ( bRemoveCListEvents ) - JCallService( MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hDbEvent ); + CallService( MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hDbEvent ); mir_free( szEventText ); } } mir_free( dbei.pBlob ); } - hDbEvent = (HANDLE)JCallService( MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0 ); + hDbEvent = (HANDLE)CallService( MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0 ); } JFreeVariant( &dbv ); } } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } mir_sntprintf( szMsg, SIZEOF(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent ); @@ -679,7 +679,7 @@ int CJabberProto::AdhocLockWSHandler( HXML, CJabberIqInfo* pInfo, CJabberAdhocSe static void __stdcall JabberQuitMirandaIMThread( void* ) { - JCallService( "CloseAction", 0, 0 ); + CallService( "CloseAction", 0, 0 ); } int CJabberProto::AdhocQuitMirandaHandler( HXML, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession ) diff --git a/protocols/JabberG/jabber_secur.cpp b/protocols/JabberG/jabber_secur.cpp index db928d74ee..c48ded22d6 100644 --- a/protocols/JabberG/jabber_secur.cpp +++ b/protocols/JabberG/jabber_secur.cpp @@ -169,7 +169,7 @@ char* TMD5Auth::getChallenge( const TCHAR* challenge ) DWORD digest[4], hash1[4], hash2[4]; mir_md5_state_t ctx; - JCallService( MS_UTILS_GETRANDOM, sizeof( digest ), ( LPARAM )digest ); + CallService( MS_UTILS_GETRANDOM, sizeof( digest ), ( LPARAM )digest ); sprintf( cnonce, "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3])); char *uname = mir_utf8encodeT( info->username ), @@ -383,7 +383,7 @@ char* TScramAuth::getInitialRequest() *serv = mir_utf8encode( info->server ); unsigned char nonce[24]; - JCallService( MS_UTILS_GETRANDOM, sizeof(nonce), ( LPARAM )nonce ); + CallService( MS_UTILS_GETRANDOM, sizeof(nonce), ( LPARAM )nonce ); cnonce = JabberBase64Encode(( char* )nonce, sizeof( nonce )); char buf[4096]; diff --git a/protocols/JabberG/jabber_std.cpp b/protocols/JabberG/jabber_std.cpp index d9d1229e78..099c28b993 100644 --- a/protocols/JabberG/jabber_std.cpp +++ b/protocols/JabberG/jabber_std.cpp @@ -65,13 +65,6 @@ HANDLE CJabberProto::JForkThreadEx( JThreadFunc pFunc, void *param, UINT* thread ///////////////////////////////////////////////////////////////////////////////////////// -#if !defined( _DEBUG ) -INT_PTR __stdcall JCallService( const char* szSvcName, WPARAM wParam, LPARAM lParam ) -{ - return CallService( szSvcName, wParam, lParam ); -} -#endif - void CJabberProto::JDeleteSetting( HANDLE hContact, const char* valueName ) { DBDeleteContactSetting( hContact, m_szModuleName, valueName ); @@ -89,7 +82,7 @@ DWORD CJabberProto::JGetByte( HANDLE hContact, const char* valueName, int parDef char* __stdcall JGetContactName( HANDLE hContact ) { - return ( char* )JCallService( MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM( hContact ), 0 ); + return ( char* )CallService( MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM( hContact ), 0 ); } DWORD CJabberProto::JGetDword( HANDLE hContact, const char* valueName, DWORD parDefltValue ) @@ -108,7 +101,7 @@ int CJabberProto::JGetStaticString( const char* valueName, HANDLE hContact, char sVal.pValue = &dbv; sVal.szModule = m_szModuleName; sVal.szSetting = valueName; - if ( JCallService( MS_DB_CONTACT_GETSETTINGSTATIC, ( WPARAM )hContact, ( LPARAM )&sVal ) != 0 ) + if ( CallService( MS_DB_CONTACT_GETSETTINGSTATIC, ( WPARAM )hContact, ( LPARAM )&sVal ) != 0 ) return 1; return ( dbv.type != DBVT_ASCIIZ ); @@ -175,7 +168,7 @@ int CJabberProto::JSendBroadcast( HANDLE hContact, int type, int result, HANDLE ack.result = result; ack.hProcess = hProcess; ack.lParam = lParam; - return JCallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack ); + return CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack ); } /* DWORD CJabberProto::JSetByte( const char* valueName, int parValue ) diff --git a/protocols/JabberG/jabber_thread.cpp b/protocols/JabberG/jabber_thread.cpp index b93b1127d8..07c609fc84 100644 --- a/protocols/JabberG/jabber_thread.cpp +++ b/protocols/JabberG/jabber_thread.cpp @@ -427,7 +427,7 @@ LBL_FatalError: // Determine local IP if ( info->useSSL ) { Log( "Intializing SSL connection" ); - if (!JCallService( MS_NETLIB_STARTSSL, ( WPARAM )info->s, 0)) { + if (!CallService( MS_NETLIB_STARTSSL, ( WPARAM )info->s, 0)) { Log( "SSL intialization failed" ); if ( info->type == JABBER_SESSION_NORMAL ) { JSendBroadcast( NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK ); @@ -471,7 +471,7 @@ LBL_FatalError: nls.cbSize = sizeof( NETLIBSELECT ); nls.dwTimeout = dwConnectionKeepAliveInterval - dwIdle; nls.hReadConns[0] = info->s; - int nSelRes = JCallService( MS_NETLIB_SELECT, 0, ( LPARAM )&nls ); + int nSelRes = CallService( MS_NETLIB_SELECT, 0, ( LPARAM )&nls ); if ( nSelRes == -1 ) // error break; else if ( nSelRes == 0 && m_bSendKeepAlive ) { @@ -583,15 +583,15 @@ recvRest: JSendBroadcast( NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, ( HANDLE ) oldStatus, m_iStatus ); // Set all contacts to offline - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - if ( !lstrcmpA(( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ), m_szModuleName )) + if ( !lstrcmpA(( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ), m_szModuleName )) { SetContactOfflineStatus( hContact ); MenuHideSrmmIcon( hContact ); } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } mir_free( m_szJabberJID ); @@ -988,7 +988,7 @@ void CJabberProto::OnProcessProceed( HXML node, ThreadData* info ) NETLIBSSL ssl = {0}; ssl.cbSize = sizeof(ssl); ssl.host = isHosted ? info->manualHost : info->server; - if (!JCallService( MS_NETLIB_STARTSSL, ( WPARAM )info->s, ( LPARAM )&ssl)) { + if (!CallService( MS_NETLIB_STARTSSL, ( WPARAM )info->s, ( LPARAM )&ssl)) { Log( "SSL initialization failed" ); info->send( "" ); info->shutdown(); @@ -1066,7 +1066,7 @@ void CJabberProto::OnProcessPubsubEvent( HXML node ) DWORD JabberGetLastContactMessageTime( HANDLE hContact ) { // TODO: time cache can improve performance - HANDLE hDbEvent = (HANDLE)JCallService( MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0 ); + HANDLE hDbEvent = (HANDLE)CallService( MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0 ); if ( !hDbEvent ) return 0; @@ -1077,7 +1077,7 @@ DWORD JabberGetLastContactMessageTime( HANDLE hContact ) dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0 ); if ( dbei.cbBlob != -1 ) { dbei.pBlob = (PBYTE)mir_alloc( dbei.cbBlob + 1 ); - int nGetTextResult = JCallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei ); + int nGetTextResult = CallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei ); if ( !nGetTextResult ) dwTime = dbei.timestamp; mir_free( dbei.pBlob ); @@ -1204,15 +1204,15 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) // chatstates composing event if ( hContact && xmlGetChildByTag( node, "composing", "xmlns", _T( JABBER_FEAT_CHATSTATES ))) - JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM )hContact, 60 ); + CallService( MS_PROTO_CONTACTISTYPING, ( WPARAM )hContact, 60 ); // chatstates paused event if ( hContact && xmlGetChildByTag( node, "paused", "xmlns", _T( JABBER_FEAT_CHATSTATES ))) - JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM )hContact, PROTOTYPE_CONTACTTYPING_OFF ); + CallService( MS_PROTO_CONTACTISTYPING, ( WPARAM )hContact, PROTOTYPE_CONTACTTYPING_OFF ); // chatstates inactive event if ( hContact && xmlGetChildByTag( node, "inactive", "xmlns", _T( JABBER_FEAT_CHATSTATES ))) - JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM )hContact, PROTOTYPE_CONTACTTYPING_OFF ); + CallService( MS_PROTO_CONTACTISTYPING, ( WPARAM )hContact, PROTOTYPE_CONTACTTYPING_OFF ); // message receipts delivery notification if ( n = xmlGetChildByTag( node, "received", "xmlns", _T( JABBER_FEAT_MESSAGE_RECEIPTS ))) { @@ -1348,12 +1348,12 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) } if ( hContact && xmlGetChild( xNode , "composing" ) != NULL ) - JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM ) hContact, 60 ); + CallService( MS_PROTO_CONTACTISTYPING, ( WPARAM ) hContact, 60 ); // Maybe a cancel to the previous composing HXML child = xmlGetChild( xNode ,0); if ( hContact && ( !child || ( child && idNode != NULL ))) - JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM ) hContact, PROTOTYPE_CONTACTTYPING_OFF ); + CallService( MS_PROTO_CONTACTISTYPING, ( WPARAM ) hContact, PROTOTYPE_CONTACTTYPING_OFF ); } else { // Check whether any event is requested @@ -1428,7 +1428,7 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) else if ( !_tcscmp( action, _T("delete"))) { HANDLE hContact = HContactFromJID( jid ); if ( hContact ) - JCallService( MS_DB_CONTACT_DELETE, ( WPARAM ) hContact, 0 ); + CallService( MS_DB_CONTACT_DELETE, ( WPARAM ) hContact, 0 ); } } } @@ -1473,7 +1473,7 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) if ( item != NULL ) { if ( resourceStatus ) resourceStatus->bMessageSessionActive = TRUE; if ( hContact != NULL ) - JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM ) hContact, PROTOTYPE_CONTACTTYPING_OFF ); + CallService( MS_PROTO_CONTACTISTYPING, ( WPARAM ) hContact, PROTOTYPE_CONTACTTYPING_OFF ); // no we will monitor last resource in all modes if ( /*item->resourceMode==RSMODE_LASTSEEN &&*/ ( fromResource = _tcschr( from, '/' ))!=NULL ) { @@ -1513,7 +1513,7 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) ccs.wParam = 0; ccs.szProtoService = PSR_MESSAGE; ccs.lParam = ( LPARAM )&recv; - JCallService( MS_PROTO_CHAINRECV, 0, ( LPARAM )&ccs ); + CallService( MS_PROTO_CHAINRECV, 0, ( LPARAM )&ccs ); mir_free(( void* )szMessage ); mir_free( buf ); @@ -1689,7 +1689,7 @@ void CJabberProto::OnProcessPresence( HXML node, ThreadData* info ) if ( _tcschr( from, '@' )==NULL ) { UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH); } - Log( TCHAR_STR_PARAM " ( " TCHAR_STR_PARAM " ) online, set contact status to %s", nick, from, JCallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)status,0 )); + Log( TCHAR_STR_PARAM " ( " TCHAR_STR_PARAM " ) online, set contact status to %s", nick, from, CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)status,0 )); mir_free( nick ); HXML xNode; diff --git a/protocols/JabberG/jabber_treelist.cpp b/protocols/JabberG/jabber_treelist.cpp index c6305209e7..8e1e28cb45 100644 --- a/protocols/JabberG/jabber_treelist.cpp +++ b/protocols/JabberG/jabber_treelist.cpp @@ -135,9 +135,9 @@ void TreeList_Create(HWND hwnd) ListView_SetImageList (hwnd, hIml, LVSIL_SMALL); hIml = ImageList_Create(16, 16, ILC_MASK + ( IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16 ), 2, 1); - ImageList_AddIcon_Icolib(hIml, (HICON)JCallService( MS_SKIN_LOADICON, SKINICON_OTHER_GROUPOPEN, 0 )); - ImageList_AddIcon_Icolib(hIml, (HICON)JCallService( MS_SKIN_LOADICON, SKINICON_OTHER_GROUPSHUT, 0 )); - ImageList_AddIcon_Icolib(hIml, (HICON)JCallService( MS_SKIN_LOADICON, SKINICON_OTHER_DOWNARROW, 0 )); + ImageList_AddIcon_Icolib(hIml, (HICON)CallService( MS_SKIN_LOADICON, SKINICON_OTHER_GROUPOPEN, 0 )); + ImageList_AddIcon_Icolib(hIml, (HICON)CallService( MS_SKIN_LOADICON, SKINICON_OTHER_GROUPSHUT, 0 )); + ImageList_AddIcon_Icolib(hIml, (HICON)CallService( MS_SKIN_LOADICON, SKINICON_OTHER_DOWNARROW, 0 )); ListView_SetImageList (hwnd, hIml, LVSIL_STATE); } diff --git a/protocols/JabberG/jabber_userinfo.cpp b/protocols/JabberG/jabber_userinfo.cpp index 40d5190a5d..9d8b476851 100644 --- a/protocols/JabberG/jabber_userinfo.cpp +++ b/protocols/JabberG/jabber_userinfo.cpp @@ -662,7 +662,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc( HWND hwndDlg, UINT msg, WPARAM w if ( item->photoFileName ) { photoInfo->ppro->Log( "Showing picture from " TCHAR_STR_PARAM, item->photoFileName ); char* p = mir_t2a( item->photoFileName ); - photoInfo->hBitmap = ( HBITMAP ) JCallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )p ); + photoInfo->hBitmap = ( HBITMAP ) CallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )p ); mir_free( p ); JabberBitmapPremultiplyChannels(photoInfo->hBitmap); ShowWindow( GetDlgItem( hwndDlg, IDC_SAVE ), SW_SHOW ); @@ -843,7 +843,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc( HWND hwndDlg, UINT msg, WPARAM w int CJabberProto::OnUserInfoInit( WPARAM wParam, LPARAM lParam ) { - if ( !JCallService( MS_PROTO_ISPROTOCOLLOADED, 0, ( LPARAM )m_szModuleName )) + if ( !CallService( MS_PROTO_ISPROTOCOLLOADED, 0, ( LPARAM )m_szModuleName )) return 0; OPTIONSDIALOGPAGE odp = {0}; @@ -853,7 +853,7 @@ int CJabberProto::OnUserInfoInit( WPARAM wParam, LPARAM lParam ) HANDLE hContact = ( HANDLE )lParam; if ( hContact ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto != NULL && !strcmp( szProto, m_szModuleName )) { odp.pfnDlgProc = JabberUserInfoDlgProc; odp.position = -2000000000; diff --git a/protocols/JabberG/jabber_util.cpp b/protocols/JabberG/jabber_util.cpp index eaf277099f..a290b56ba2 100644 --- a/protocols/JabberG/jabber_util.cpp +++ b/protocols/JabberG/jabber_util.cpp @@ -62,7 +62,7 @@ void CJabberProto::Log( const char* fmt, ... ) mir_vsnprintf( str, 32000, fmt, vararg ); va_end( vararg ); - JCallService( MS_NETLIB_LOG, ( WPARAM )m_hNetlibUser, ( LPARAM )str ); + CallService( MS_NETLIB_LOG, ( WPARAM )m_hNetlibUser, ( LPARAM )str ); } /////////////////////////////////////////////////////////////////////////////// @@ -74,9 +74,9 @@ HANDLE CJabberProto::ChatRoomHContactFromJID( const TCHAR* jid ) return ( HANDLE )NULL; HANDLE hContactMatched = NULL; - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto != NULL && !strcmp( m_szModuleName, szProto )) { DBVARIANT dbv; int result = JGetStringT( hContact, "ChatRoomID", &dbv ); @@ -92,7 +92,7 @@ HANDLE CJabberProto::ChatRoomHContactFromJID( const TCHAR* jid ) break; } } } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } return hContactMatched; @@ -109,9 +109,9 @@ HANDLE CJabberProto::HContactFromJID( const TCHAR* jid , BOOL bStripResource ) JABBER_LIST_ITEM* item = ListGetItemPtr( LIST_CHATROOM, jid ); HANDLE hContactMatched = NULL; - HANDLE hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ); if ( szProto != NULL && !strcmp( m_szModuleName, szProto )) { DBVARIANT dbv; int result; @@ -145,7 +145,7 @@ HANDLE CJabberProto::HContactFromJID( const TCHAR* jid , BOOL bStripResource ) break; } } } - hContact = ( HANDLE ) JCallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); + hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 ); } return hContactMatched; @@ -1692,7 +1692,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) nlhr.szUrl = avs[i].Url; nlhr.nlc = hHttpCon; - NETLIBHTTPREQUEST * res = (NETLIBHTTPREQUEST*)JCallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST * res = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&nlhr); if (res) { hHttpCon = res->nlc; @@ -1741,7 +1741,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) } } } - JCallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)res); + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)res); } else hHttpCon = NULL; diff --git a/protocols/JabberG/jabber_vcard.cpp b/protocols/JabberG/jabber_vcard.cpp index 3d43c0f650..691f3516ed 100644 --- a/protocols/JabberG/jabber_vcard.cpp +++ b/protocols/JabberG/jabber_vcard.cpp @@ -300,7 +300,7 @@ static INT_PTR CALLBACK PhotoDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPA dat->ppro->Log( "Temp file = " TCHAR_STR_PARAM, szTempFileName ); if ( CopyFile( szAvatarFileName, szTempFileName, FALSE ) == TRUE ) { char* p = mir_t2a( szTempFileName ); - if (( dat->hBitmap=( HBITMAP ) JCallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )p )) != NULL ) { + if (( dat->hBitmap=( HBITMAP ) CallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )p )) != NULL ) { JabberBitmapPremultiplyChannels( dat->hBitmap ); _tcscpy( dat->ppro->m_szPhotoFileName, szTempFileName ); EnableWindow( GetDlgItem( hwndDlg, IDC_DELETE ), TRUE ); @@ -327,7 +327,7 @@ static INT_PTR CALLBACK PhotoDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPA TCHAR szFilter[512]; TCHAR szFileName[MAX_PATH]; - JCallService( MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF( szFilter ), ( LPARAM )szFilter ); + CallService( MS_UTILS_GETBITMAPFILTERSTRINGST, SIZEOF( szFilter ), ( LPARAM )szFilter ); OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); @@ -353,7 +353,7 @@ static INT_PTR CALLBACK PhotoDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPA dat->ppro->Log( "Temp file = " TCHAR_STR_PARAM, szTempFileName ); if ( CopyFile( szFileName, szTempFileName, FALSE ) == TRUE ) { char* pszTemp = mir_t2a( szTempFileName ); - if (( hNewBitmap=( HBITMAP ) JCallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )pszTemp )) != NULL ) { + if (( hNewBitmap=( HBITMAP ) CallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )pszTemp )) != NULL ) { if ( dat->hBitmap ) { DeleteObject( dat->hBitmap ); DeleteFile( dat->ppro->m_szPhotoFileName ); diff --git a/protocols/JabberG/jabber_ws.cpp b/protocols/JabberG/jabber_ws.cpp index fcb6753f85..494dcf3454 100644 --- a/protocols/JabberG/jabber_ws.cpp +++ b/protocols/JabberG/jabber_ws.cpp @@ -40,7 +40,7 @@ BOOL CJabberProto::WsInit( void ) //nlu.pfnHttpGatewayBegin = JabberHttpGatewayBegin; //nlu.pfnHttpGatewayWrapSend = JabberHttpGatewayWrapSend; //nlu.pfnHttpGatewayUnwrapRecv = JabberHttpGatewayUnwrapRecv; - m_hNetlibUser = ( HANDLE ) JCallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); + m_hNetlibUser = ( HANDLE ) CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); return m_hNetlibUser != NULL; } @@ -58,7 +58,7 @@ JABBER_SOCKET CJabberProto::WsConnect( char* host, WORD port ) nloc.szHost = host; nloc.wPort = port; nloc.timeout = 6; - return ( HANDLE )JCallService( MS_NETLIB_OPENCONNECTION, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nloc ); + return ( HANDLE )CallService( MS_NETLIB_OPENCONNECTION, ( WPARAM ) m_hNetlibUser, ( LPARAM )&nloc ); } int CJabberProto::WsSend( JABBER_SOCKET hConn, char* data, int datalen, int flags ) diff --git a/protocols/JabberG/jabber_xstatus.cpp b/protocols/JabberG/jabber_xstatus.cpp index 07ee610a80..d15cae2bcd 100644 --- a/protocols/JabberG/jabber_xstatus.cpp +++ b/protocols/JabberG/jabber_xstatus.cpp @@ -1249,7 +1249,7 @@ int CJabberProto::CListMW_ExtraIconsApply( WPARAM wParam, LPARAM ) { if (m_bJabberOnline && m_bPepSupported && ServiceExists(MS_CLIST_EXTRA_SET_ICON)) { - char* szProto = ( char* )JCallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 ); + char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 ); if ( szProto==NULL || strcmp( szProto, m_szModuleName )) return 0; // only apply icons to our contacts, do not mess others diff --git a/protocols/MRA/MraProto.cpp b/protocols/MRA/MraProto.cpp index 5ee6c3bbd1..7be880f92f 100644 --- a/protocols/MRA/MraProto.cpp +++ b/protocols/MRA/MraProto.cpp @@ -273,7 +273,7 @@ HANDLE CMraProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) !strcmp(dbei.szModule, m_szModuleName) && (dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_CONTACTS)) { - char *nick = (char*)(dbei.pBlob + sizeof(DWORD)+ sizeof(HANDLE)); + char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2); char *firstName = nick + strlen(nick) + 1; char *lastName = firstName + strlen(firstName) + 1; char *email = lastName + strlen(lastName) + 1; @@ -342,16 +342,7 @@ int CMraProto::AuthDeny(HANDLE hDBEvent, const TCHAR* szReason) int CMraProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) { - DBEVENTINFO dbei = {0}; - dbei.cbSize = sizeof(dbei); - dbei.szModule = m_szModuleName; - dbei.timestamp = pre->timestamp; - dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0; - dbei.eventType = EVENTTYPE_AUTHREQUEST; - dbei.cbBlob = pre->lParam; - dbei.pBlob = (PBYTE)pre->szMessage; - CallService(MS_DB_EVENT_ADD, (WPARAM)NULL, (LPARAM)&dbei); - return 0; + return Proto_AuthRecv(m_szModuleName, pre); } int CMraProto::AuthRequest(HANDLE hContact, const TCHAR *lptszMessage) @@ -507,15 +498,12 @@ int CMraProto::RecvContacts(HANDLE hContact, PROTORECVEVENT* pre) int CMraProto::RecvFile(HANDLE hContact, PROTORECVFILET *pre) { - CallService(MS_PROTO_RECVFILET, 0, (LPARAM)pre); - return 0; + return Proto_RecvFile(hContact, pre); } int CMraProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) { - CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre }; - CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs); - return 0; + return Proto_RecvMessage(hContact, pre); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/MSN/msn.cpp b/protocols/MSN/msn.cpp index 9399bf6e3a..de85a0c6bf 100644 --- a/protocols/MSN/msn.cpp +++ b/protocols/MSN/msn.cpp @@ -126,7 +126,7 @@ extern "C" int __declspec(dllexport) Load(void) pd.fnInit = (pfnInitProto)msnProtoInit; pd.fnUninit = (pfnUninitProto)msnProtoUninit; pd.type = PROTOTYPE_PROTOCOL; - MSN_CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); + CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); MsnInitIcons(); MSN_InitContactMenu(); diff --git a/protocols/MSN/msn_auth.cpp b/protocols/MSN/msn_auth.cpp index 065f4c0247..32bbe01e0d 100644 --- a/protocols/MSN/msn_auth.cpp +++ b/protocols/MSN/msn_auth.cpp @@ -133,7 +133,7 @@ int CMsnProto::MSN_GetPassportAuth(void) char szPassword[100]; getStaticString(NULL, "Password", szPassword, sizeof(szPassword)); - MSN_CallService(MS_DB_CRYPT_DECODESTRING, strlen(szPassword)+1, (LPARAM)szPassword); + CallService(MS_DB_CRYPT_DECODESTRING, strlen(szPassword)+1, (LPARAM)szPassword); szPassword[16] = 0; char* szEncPassword = HtmlEncode(szPassword); @@ -254,7 +254,7 @@ int CMsnProto::MSN_GetPassportAuth(void) if (errurl) { MSN_DebugLog("Starting URL: '%s'", errurl); - MSN_CallService(MS_UTILS_OPENURL, 1, (LPARAM)errurl); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)errurl); } ezxml_t tokf = ezxml_get(xml, "S:Body", 0, "S:Fault", 0, "S:Detail", -1); @@ -436,7 +436,7 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) unsigned char* key1 = (unsigned char*)alloca(key1len); NETLIBBASE64 nlb = { authSecretToken, (int)keylen, key1, (int)key1len }; - MSN_CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb)); + CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb)); key1len = nlb.cbDecoded; mir_sha1_byte_t key2[MIR_SHA1_HASH_SIZE+4]; @@ -464,7 +464,7 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) p += sizeof(MsgrUsrKeyHdr); unsigned char iv[8]; - MSN_CallService(MS_UTILS_GETRANDOM, sizeof(iv), (LPARAM)iv); + CallService(MS_UTILS_GETRANDOM, sizeof(iv), (LPARAM)iv); memcpy(p, iv, sizeof(iv)); p += sizeof(iv); @@ -483,7 +483,7 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) char* buf = (char*)mir_alloc(rlen); NETLIBBASE64 nlb1 = { buf, (int)rlen, userKey, (int)pktsz }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb1)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb1)); return buf; } @@ -492,14 +492,14 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) char* CMsnProto::HotmailLogin(const char* url) { unsigned char nonce[24]; - MSN_CallService(MS_UTILS_GETRANDOM, sizeof(nonce), (LPARAM)nonce); + CallService(MS_UTILS_GETRANDOM, sizeof(nonce), (LPARAM)nonce); const size_t hotSecretlen = strlen(hotSecretToken); size_t key1len = Netlib_GetBase64DecodedBufferSize(hotSecretlen); unsigned char* key1 = (unsigned char*)alloca(key1len); NETLIBBASE64 nlb = { hotSecretToken, (int)hotSecretlen, key1, (int)key1len }; - MSN_CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb)); + CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb)); key1len = nlb.cbDecoded; static const unsigned char encdata[] = "WS-SecureConversation"; @@ -519,7 +519,7 @@ char* CMsnProto::HotmailLogin(const char* url) size_t noncenclen = Netlib_GetBase64EncodedBufferSize(sizeof(nonce)); char* noncenc = (char*)alloca(noncenclen); NETLIBBASE64 nlb1 = { noncenc, (int)noncenclen, nonce, sizeof(nonce) }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb1)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb1)); noncenclen = nlb1.cchEncoded - 1; const size_t fnpstlen = strlen(xmlenc) + strlen(url) + 3*noncenclen + 100; @@ -534,7 +534,7 @@ char* CMsnProto::HotmailLogin(const char* url) hmac_sha1(hash, key2, sizeof(key2), (mir_sha1_byte_t*)fnpst, sz); NETLIBBASE64 nlb2 = { noncenc, (int)noncenclen, hash, sizeof(hash) }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb2)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb2)); sz += mir_snprintf(fnpst + sz, fnpstlen - sz, "&hash="); diff --git a/protocols/MSN/msn_chat.cpp b/protocols/MSN/msn_chat.cpp index 58bfcbf866..620477c6a3 100644 --- a/protocols/MSN/msn_chat.cpp +++ b/protocols/MSN/msn_chat.cpp @@ -382,7 +382,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) { char *email = mir_t2a(gch->ptszUID); HANDLE hContact = MSN_HContactFromEmail(email); - MSN_CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); + CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); mir_free(email); break; } @@ -410,11 +410,11 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) switch(gch->dwData) { case 10: - MSN_CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break; case 20: - MSN_CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0); + CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0); break; case 110: diff --git a/protocols/MSN/msn_commands.cpp b/protocols/MSN/msn_commands.cpp index 76dab93234..5a239dd986 100644 --- a/protocols/MSN/msn_commands.cpp +++ b/protocols/MSN/msn_commands.cpp @@ -161,7 +161,7 @@ void CMsnProto::sttInviteMessage(ThreadData* info, char* msgBody, char* email, c ccs.szProtoService = PSR_FILE; ccs.wParam = 0; ccs.lParam = (LPARAM)⪯ - MSN_CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); return; } @@ -310,7 +310,7 @@ void CMsnProto::sttCustomSmiley(const char* msgBody, char* email, char* nick, in char* buf = (char*)mir_alloc(rlen); NETLIBBASE64 nlb = { buf, (int)rlen, (PBYTE)lastsml, (int)slen }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); char* smileyName = (char*)mir_alloc(rlen*3); UrlEncode(buf, smileyName, rlen*3); @@ -509,7 +509,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para { if (!sentMsg) { - MSN_CallService(MS_PROTO_CONTACTISTYPING, WPARAM(ccs.hContact), 0); + CallService(MS_PROTO_CONTACTISTYPING, WPARAM(ccs.hContact), 0); PROTORECVEVENT pre; pre.szMessage = (char*)msgBody; @@ -520,7 +520,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para ccs.szProtoService = PSR_MESSAGE; ccs.wParam = 0; ccs.lParam = (LPARAM)⪯ - MSN_CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); } else { @@ -535,7 +535,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para dbei.timestamp = time(NULL); dbei.cbBlob = (unsigned)strlen(msgBody) + 1; dbei.pBlob = (PBYTE)msgBody; - MSN_CallService(MS_DB_EVENT_ADD, (WPARAM)ccs.hContact, (LPARAM)&dbei); + CallService(MS_DB_EVENT_ADD, (WPARAM)ccs.hContact, (LPARAM)&dbei); } } } @@ -564,7 +564,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para if (tTypingUser != NULL && info->mChatID[0] == 0 && _stricmp(email, MyOptions.szEmail)) { HANDLE hContact = MSN_HContactFromEmail(tTypingUser, tTypingUser); - MSN_CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, 7); + CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, 7); } } else if (!_strnicmp(tContentType, "text/x-msnmsgr-datacast", 23)) @@ -789,7 +789,7 @@ void CMsnProto::sttProcessRemove(char* buf, size_t len) { if (msc->hContact && _stricmp(szEmail, MyOptions.szEmail)) { - MSN_CallService(MS_DB_CONTACT_DELETE, (WPARAM)msc->hContact, 0); + CallService(MS_DB_CONTACT_DELETE, (WPARAM)msc->hContact, 0); msc->hContact = NULL; } } @@ -984,7 +984,7 @@ void CMsnProto::sttProcessPage(char* buf, unsigned len) ccs.hContact = MSN_HContactFromEmail(szTel, szTel, true, true); ccs.szProtoService = PSR_MESSAGE; ccs.lParam = (LPARAM)⪯ - MSN_CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); } ezxml_free(xmlnot); diff --git a/protocols/MSN/msn_contact.cpp b/protocols/MSN/msn_contact.cpp index f87a6fafca..086bf6b3ed 100644 --- a/protocols/MSN/msn_contact.cpp +++ b/protocols/MSN/msn_contact.cpp @@ -33,8 +33,8 @@ HANDLE CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, if (hContact == NULL && addIfNeeded) { - hContact = (HANDLE)MSN_CallService(MS_DB_CONTACT_ADD, 0, 0); - MSN_CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); + hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); setString(hContact, "e-mail", szEmail); setStringUtf(hContact, "Nick", msnNick ? msnNick : wlid); if (temporary) diff --git a/protocols/MSN/msn_ftold.cpp b/protocols/MSN/msn_ftold.cpp index fcf894c4e2..6ed5ce08af 100644 --- a/protocols/MSN/msn_ftold.cpp +++ b/protocols/MSN/msn_ftold.cpp @@ -342,7 +342,7 @@ void CMsnProto::msnftp_startFileSend(ThreadData* info, const char* Invcommand, c nlb.pfnNewConnectionV2 = MSN_ConnectionProc; nlb.pExtra = this; - sb = (HANDLE)MSN_CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlibUser, (LPARAM)&nlb); + sb = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlibUser, (LPARAM)&nlb); if (sb == NULL) MSN_DebugLog("Unable to bind the port for incoming transfers"); } diff --git a/protocols/MSN/msn_global.h b/protocols/MSN/msn_global.h index 955c3123db..0e348901f7 100644 --- a/protocols/MSN/msn_global.h +++ b/protocols/MSN/msn_global.h @@ -179,12 +179,6 @@ bool MSN_MsgWndExist(HANDLE hContact); #define MSN_SendNickname(a) MSN_SendNicknameUtf(UTF8(a)) -#if defined(_DEBUG) -#define MSN_CallService CallService -#else -INT_PTR MSN_CallService(const char* szSvcName, WPARAM wParam, LPARAM lParam); -#endif - void MSN_FreeVariant(DBVARIANT* dbv); char* MSN_Translate(const char* str); unsigned MSN_GenRandom(void); diff --git a/protocols/MSN/msn_http.cpp b/protocols/MSN/msn_http.cpp index 5f727ef30b..a53f9401fb 100644 --- a/protocols/MSN/msn_http.cpp +++ b/protocols/MSN/msn_http.cpp @@ -42,7 +42,7 @@ int msn_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION* nloc, NETLIBHTTPREQU nlhpi.szHttpPostUrl = "messenger.hotmail.com"; nlhpi.flags = NLHPIF_HTTP11; nlhpi.combinePackets = MSN_PACKETS_COMBINE; - return MSN_CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi); + return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi); } //======================================================================================= diff --git a/protocols/MSN/msn_links.cpp b/protocols/MSN/msn_links.cpp index 7da85b3202..1d54afd64c 100644 --- a/protocols/MSN/msn_links.cpp +++ b/protocols/MSN/msn_links.cpp @@ -111,7 +111,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) psr.flags = PSR_TCHAR; psr.nick = email; psr.email = email; - MSN_CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs); + CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs); } return 0; } diff --git a/protocols/MSN/msn_lists.cpp b/protocols/MSN/msn_lists.cpp index 5325e8190b..8e4b48a129 100644 --- a/protocols/MSN/msn_lists.cpp +++ b/protocols/MSN/msn_lists.cpp @@ -236,10 +236,10 @@ void CMsnProto::Lists_Remove(int list, const char* email) void CMsnProto::Lists_Populate(void) { - HANDLE hContact = (HANDLE)MSN_CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact != NULL) { - HANDLE hContactN = (HANDLE)MSN_CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); + HANDLE hContactN = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); if (MSN_IsMyContact(hContact)) { char szEmail[MSN_MAX_EMAIL_LEN] = "";; @@ -255,7 +255,7 @@ void CMsnProto::Lists_Populate(void) Lists_Add(0, NETID_UNKNOWN, szEmail, hContact); } else - MSN_CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); + CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); } hContact = hContactN; } @@ -304,7 +304,7 @@ void CMsnProto::MSN_CleanupLists(void) if (!(p.list & (LIST_LL | LIST_FL))) { - MSN_CallService(MS_DB_CONTACT_DELETE, (WPARAM)p.hContact, 0); + CallService(MS_DB_CONTACT_DELETE, (WPARAM)p.hContact, 0); p.hContact = NULL; } @@ -322,7 +322,7 @@ void CMsnProto::MSN_CleanupLists(void) cont.type = 0; cont.path = path; - MSN_CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, (LPARAM)&cont); + CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, (LPARAM)&cont); } } } @@ -571,7 +571,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto) { if (!IsHContactInfo(hItem)) { - MSN_CallService(MS_DB_CONTACT_DELETE, (WPARAM)hItem, 0); + CallService(MS_DB_CONTACT_DELETE, (WPARAM)hItem, 0); MsnContact* msc = proto->Lists_Get(szEmail); if (msc) msc->hContact = NULL; } diff --git a/protocols/MSN/msn_mail.cpp b/protocols/MSN/msn_mail.cpp index 57996b65ac..869642d1d4 100644 --- a/protocols/MSN/msn_mail.cpp +++ b/protocols/MSN/msn_mail.cpp @@ -126,7 +126,7 @@ void CMsnProto::getOIMs(ezxml_t xmli) ccs.hContact = MSN_HContactFromEmail(szEmail); ccs.szProtoService = PSR_MESSAGE; ccs.lParam = (LPARAM)⪯ - MSN_CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); mir_free(pre.szMessage); ezxml_t delmid = ezxml_add_child(delmids, "messageId", 0); diff --git a/protocols/MSN/msn_menu.cpp b/protocols/MSN/msn_menu.cpp index e90480fb32..1913483b36 100644 --- a/protocols/MSN/msn_menu.cpp +++ b/protocols/MSN/msn_menu.cpp @@ -155,17 +155,17 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB; if (noChat) mi.flags |= CMIF_HIDDEN; mi.pszName = (char*)((listId & LIST_BL) ? "&Unblock" : "&Block"); - MSN_CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hBlockMenuItem, (LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hBlockMenuItem, (LPARAM)&mi); mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB; if (!emailEnabled) mi.flags |= CMIF_HIDDEN; mi.pszName = isMe ? LPGEN("Open &Hotmail Inbox") : LPGEN("Send &Hotmail E-mail"); - MSN_CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hOpenInboxMenuItem, (LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hOpenInboxMenuItem, (LPARAM)&mi); mi.flags = CMIM_FLAGS | CMIF_ICONFROMICOLIB | CMIF_NOTOFFLINE; if (noChat) mi.flags |= CMIF_HIDDEN; - MSN_CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hNetmeetingMenuItem, (LPARAM)&mi); - MSN_CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hChatInviteMenuItem, (LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hNetmeetingMenuItem, (LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hChatInviteMenuItem, (LPARAM)&mi); } return 0; @@ -359,7 +359,7 @@ void CMsnProto::MsnInitMainMenu(void) void CMsnProto::MsnRemoveMainMenus(void) { if (mainMenuRoot) - MSN_CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)mainMenuRoot, 0); + CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)mainMenuRoot, 0); } void CMsnProto::MSN_EnableMenuItems(bool bEnable) @@ -373,14 +373,14 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable) for (unsigned i=0; i < SIZEOF(menuItemsMain); i++) { if (menuItemsMain[i] != NULL) - MSN_CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[i], (LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[i], (LPARAM)&mi); } if (bEnable) { mi.flags = CMIM_FLAGS; if (!emailEnabled) mi.flags |= CMIF_HIDDEN; - MSN_CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[1], (LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[1], (LPARAM)&mi); } } @@ -499,11 +499,11 @@ void MSN_RemoveContactMenus(void) { UnhookEvent(hPrebuildMenuHook); - MSN_CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hBlockMenuItem, 0); - MSN_CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hLiveSpaceMenuItem, 0); - MSN_CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hNetmeetingMenuItem, 0); - MSN_CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hChatInviteMenuItem, 0); - MSN_CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hOpenInboxMenuItem, 0); + CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hBlockMenuItem, 0); + CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hLiveSpaceMenuItem, 0); + CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hNetmeetingMenuItem, 0); + CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hChatInviteMenuItem, 0); + CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hOpenInboxMenuItem, 0); DestroyServiceFunction(hNetMeeting); DestroyServiceFunction(hBlockCom); diff --git a/protocols/MSN/msn_misc.cpp b/protocols/MSN/msn_misc.cpp index 12b07cd08e..c313fd4467 100644 --- a/protocols/MSN/msn_misc.cpp +++ b/protocols/MSN/msn_misc.cpp @@ -118,7 +118,7 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const c strcpy(pCurBlob, email); pCurBlob += emaillen + 1; // E-mail strcpy(pCurBlob, reason); // Reason - MSN_CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -133,7 +133,7 @@ void CMsnProto::MSN_DebugLog(const char *fmt, ...) if (_vsnprintf(str, sizeof(str), fmt, vararg) != 0) { str[sizeof(str)-1] = 0; - MSN_CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)str); + CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)str); } va_end(vararg); } @@ -170,7 +170,7 @@ char* MSN_GetAvatarHash(char* szContext) const size_t len = strlen(szAvatarHash); NETLIBBASE64 nlb = { (char*)szAvatarHash, (int)len, szActHash, sizeof(szActHash) }; - int decod = MSN_CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb)); + int decod = CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb)); if (decod != 0 && nlb.cbDecoded > 0) res = arrayToHex(szActHash, nlb.cbDecoded); } @@ -203,7 +203,7 @@ void CMsnProto::MSN_GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t c } if (_taccess(pszDest, 0)) - MSN_CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); size_t tPathLen2 = tPathLen; if (hContact != NULL) @@ -323,7 +323,7 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen { NETLIBBASE64 nlb = { szSha1d, sizeof(szSha1d), (PBYTE)sha1d, sizeof(sha1d) }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); } mir_sha1_init(&sha1ctx); @@ -359,7 +359,7 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen { NETLIBBASE64 nlb = { szSha1c, sizeof(szSha1c), (PBYTE)sha1c, sizeof(sha1c) }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); } // ezxml_set_attr(xmlp, "SHA1C", szSha1c); @@ -457,7 +457,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(HANDLE hContact, TCHAR* pszDest, si } if (!exist) - MSN_CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); TCHAR *sztSmileyName = mir_a2t(SmileyName); mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s.%s"), sztSmileyName, @@ -580,7 +580,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha void ThreadData::sendCaps(void) { char mversion[100], capMsg[1000]; - MSN_CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mversion), (LPARAM)mversion); + CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mversion), (LPARAM)mversion); mir_snprintf(capMsg, sizeof(capMsg), "Content-Type: text/x-clientcaps\r\n\r\n" @@ -927,7 +927,7 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url) } MSN_DebugLog("Starting URL: '%s'", hippy); - MSN_CallService(MS_UTILS_OPENURL, 1, (LPARAM)hippy); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)hippy); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -938,7 +938,7 @@ void CMsnProto::MSN_ShowError(const char* msgtext, ...) TCHAR tBuffer[4096]; va_list tArgs; - TCHAR *buf = (TCHAR*)MSN_CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)msgtext); + TCHAR *buf = (TCHAR*)CallService(MS_LANGPACK_PCHARTOTCHAR, 0, (LPARAM)msgtext); va_start(tArgs, msgtext); mir_vsntprintf(tBuffer, SIZEOF(tBuffer), buf, tArgs); @@ -971,7 +971,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara else { if (tData->url != NULL) - MSN_CallService(MS_UTILS_OPENURL, 1, (LPARAM)tData->url); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)tData->url); } } PUDeletePopUp(hWnd); @@ -1365,7 +1365,7 @@ char* MSN_Base64Decode(const char* str) } NETLIBBASE64 nlb = { p, (int)len, (PBYTE)res, (int)reslen }; - if (!MSN_CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb))) nlb.cbDecoded = 0; + if (!CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb))) nlb.cbDecoded = 0; res[nlb.cbDecoded] = 0; return res; @@ -1373,7 +1373,7 @@ char* MSN_Base64Decode(const char* str) bool CMsnProto::MSN_IsMyContact(HANDLE hContact) { - const char* szProto = (char*)MSN_CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + const char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); return szProto != NULL && strcmp(m_szModuleName, szProto) == 0; } @@ -1396,14 +1396,14 @@ bool MSN_MsgWndExist(HANDLE hContact) MessageWindowData msgWinData = {0}; msgWinData.cbSize = sizeof(MessageWindowData); - bool res = MSN_CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0; + bool res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0; res = res || msgWinData.hwndWindow; if (res) { - msgWinInData.hContact = (HANDLE)MSN_CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); + msgWinInData.hContact = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); if (msgWinInData.hContact != NULL) { - res = MSN_CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0; + res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0; res |= (msgWinData.hwndWindow == NULL); } } diff --git a/protocols/MSN/msn_natdetect.cpp b/protocols/MSN/msn_natdetect.cpp index 827f51590d..0d17f4a530 100644 --- a/protocols/MSN/msn_natdetect.cpp +++ b/protocols/MSN/msn_natdetect.cpp @@ -194,7 +194,7 @@ void CMsnProto::MSNatDetect(void) nlb.pfnNewConnectionV2 = MSN_ConnectionProc; nlb.pExtra = this; - HANDLE sb = (HANDLE) MSN_CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlibUser, (LPARAM)&nlb); + HANDLE sb = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlibUser, (LPARAM)&nlb); if ( sb != NULL ) { MyConnection.upnpNAT = htonl(nlb.dwExternalIP) == MyConnection.extIP; diff --git a/protocols/MSN/msn_opts.cpp b/protocols/MSN/msn_opts.cpp index b2fd4a9f8c..b92e21ee5b 100644 --- a/protocols/MSN/msn_opts.cpp +++ b/protocols/MSN/msn_opts.cpp @@ -80,7 +80,7 @@ HICON LoadIconEx(const char* name, bool big) { char szSettingName[100]; mir_snprintf(szSettingName, sizeof(szSettingName), "MSN_%s", name); - return (HICON)MSN_CallService(MS_SKIN2_GETICON, big, (LPARAM)szSettingName); + return (HICON)CallService(MS_SKIN2_GETICON, big, (LPARAM)szSettingName); } HANDLE GetIconHandle(int iconId) @@ -96,7 +96,7 @@ void ReleaseIconEx(const char* name, bool big) { char szSettingName[100]; mir_snprintf(szSettingName, sizeof(szSettingName), "MSN_%s", name); - MSN_CallService(big ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, 0, (LPARAM)szSettingName); + CallService(big ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, 0, (LPARAM)szSettingName); } INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -120,7 +120,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP char tBuffer[MAX_PATH]; if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer))) { - MSN_CallService(MS_DB_CRYPT_DECODESTRING, strlen(tBuffer)+1, (LPARAM)tBuffer); + CallService(MS_DB_CRYPT_DECODESTRING, strlen(tBuffer)+1, (LPARAM)tBuffer); tBuffer[16] = 0; SetDlgItemTextA(hwndDlg, IDC_PASSWORD, tBuffer); } @@ -161,7 +161,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND: if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK) { - MSN_CallService(MS_UTILS_OPENURL, 1, (LPARAM)"https://signup.live.com"); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)"https://signup.live.com"); return TRUE; } @@ -278,7 +278,7 @@ LBL_Continue: } GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password)); - MSN_CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(password),(LPARAM)password); + CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(password),(LPARAM)password); if (!proto->getString("Password", &dbv)) { if (strcmp(password, dbv.pszVal)) @@ -601,7 +601,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L char tBuffer[MAX_PATH]; if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer))) { - MSN_CallService(MS_DB_CRYPT_DECODESTRING, strlen(tBuffer)+1, (LPARAM)tBuffer); + CallService(MS_DB_CRYPT_DECODESTRING, strlen(tBuffer)+1, (LPARAM)tBuffer); tBuffer[16] = 0; SetDlgItemTextA(hwndDlg, IDC_PASSWORD, tBuffer); } @@ -619,7 +619,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_COMMAND: if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK) { - MSN_CallService(MS_UTILS_OPENURL, 1, (LPARAM)"https://signup.live.com"); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)"https://signup.live.com"); return TRUE; } @@ -649,7 +649,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L } GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password)); - MSN_CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(password),(LPARAM)password); + CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(password),(LPARAM)password); if (!proto->getString("Password", &dbv)) { if (strcmp(password, dbv.pszVal)) diff --git a/protocols/MSN/msn_p2p.cpp b/protocols/MSN/msn_p2p.cpp index 84d1ee8d2c..599dee57fd 100644 --- a/protocols/MSN/msn_p2p.cpp +++ b/protocols/MSN/msn_p2p.cpp @@ -86,7 +86,7 @@ bool CMsnProto::p2p_createListener(filetransfer* ft, directconnection *dc, MimeH nlb.cbSize = sizeof(nlb); nlb.pfnNewConnectionV2 = MSN_ConnectionProc; nlb.pExtra = this; - HANDLE sb = (HANDLE) MSN_CallService(MS_NETLIB_BINDPORT, (WPARAM) hNetlibUser, (LPARAM)&nlb); + HANDLE sb = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) hNetlibUser, (LPARAM)&nlb); if (sb == NULL) { MSN_DebugLog("Unable to bind the port for incoming transfers"); @@ -278,7 +278,7 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) cont.path = pathcpy; - MSN_CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, (LPARAM)&cont); + CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, (LPARAM)&cont); mir_free(pathcpy); } break; @@ -731,7 +731,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) MSN_DebugLog("Connecting to %s:%d", tConn.szHost, tConn.wPort); - info->s = (HANDLE)MSN_CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&tConn); + info->s = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&tConn); if (info->s == NULL) { TWinErrorCode err; @@ -1335,7 +1335,7 @@ void CMsnProto::p2p_InitFileTransfer( ccs.szProtoService = PSR_FILE; ccs.wParam = 0; ccs.lParam = (LPARAM)⪯ - MSN_CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); } break; @@ -2318,7 +2318,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) int cbContextEnc = Netlib_GetBase64EncodedBufferSize((int)cbContext); char* szContextEnc = (char*)alloca(cbContextEnc); NETLIBBASE64 nlb = { szContextEnc, cbContextEnc, (PBYTE)pContext, (int)cbContext }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); MimeHeaders chdrs(10); chdrs.addString("EUF-GUID", szAppID); diff --git a/protocols/MSN/msn_proto.cpp b/protocols/MSN/msn_proto.cpp index db417d84d0..23abd2cfe6 100644 --- a/protocols/MSN/msn_proto.cpp +++ b/protocols/MSN/msn_proto.cpp @@ -50,19 +50,19 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : m_szProtoName[0] = (char)toupper(m_szProtoName[0]); mir_snprintf(path, sizeof(path), "%s/Status", m_szModuleName); - MSN_CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); + CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); mir_snprintf(path, sizeof(path), "%s/IdleTS", m_szModuleName); - MSN_CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); + CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); mir_snprintf(path, sizeof(path), "%s/p2pMsgId", m_szModuleName); - MSN_CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); + CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); mir_snprintf(path, sizeof(path), "%s/MobileEnabled", m_szModuleName); - MSN_CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); + CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); mir_snprintf(path, sizeof(path), "%s/MobileAllowed", m_szModuleName); - MSN_CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); + CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)path); // Protocol services and events... hMSNNudge = CreateProtoEvent("/Nudge"); @@ -94,7 +94,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : LoadOptions(); - HANDLE hContact = (HANDLE)MSN_CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact != NULL) { if (MSN_IsMyContact(hContact)) @@ -104,7 +104,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : deleteSetting(hContact, "p2pMsgId"); deleteSetting(hContact, "AccList"); } - hContact = (HANDLE)MSN_CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0); + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0); } deleteSetting(NULL, "MobileEnabled"); deleteSetting(NULL, "MobileAllowed"); @@ -149,7 +149,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : mir_snprintf(szDbsettings, sizeof(szDbsettings), "%s_HTTPS", m_szModuleName); mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s plugin HTTPS connections"), m_tszUserName); - hNetlibUserHttps = (HANDLE)MSN_CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu1); + hNetlibUserHttps = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu1); NETLIBUSER nlu = {0}; nlu.cbSize = sizeof(nlu); @@ -163,7 +163,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : nlu.pfnHttpGatewayUnwrapRecv = msn_httpGatewayUnwrapRecv; mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s plugin connections"), m_tszUserName); - hNetlibUser = (HANDLE)MSN_CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); + hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); } CMsnProto::~CMsnProto() @@ -290,15 +290,15 @@ HANDLE __cdecl CMsnProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEv { DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); - if ((dbei.cbBlob = MSN_CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == (DWORD)(-1)) + if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == (DWORD)(-1)) return NULL; dbei.pBlob=(PBYTE) alloca(dbei.cbBlob); - if (MSN_CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei)) return NULL; + if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei)) return NULL; if (strcmp(dbei.szModule, m_szModuleName)) return NULL; if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return NULL; - char* nick = (char *) (dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE)); + char* nick = (char *) (dbei.pBlob + sizeof(DWORD)*2); char* firstName = nick + strlen(nick) + 1; char* lastName = firstName + strlen(firstName) + 1; char* email = lastName + strlen(lastName) + 1; @@ -308,21 +308,7 @@ HANDLE __cdecl CMsnProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEv int CMsnProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) { - DBEVENTINFO dbei = { 0 }; - - dbei.cbSize = sizeof(dbei); - dbei.szModule = m_szModuleName; - dbei.timestamp = pre->timestamp; - dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0; - dbei.flags |= (pre->flags & PREF_UTF) ? DBEF_UTF : 0; - dbei.eventType = EVENTTYPE_AUTHREQUEST; - - /* Just copy the Blob from PSR_AUTH event. */ - dbei.cbBlob = pre->lParam; - dbei.pBlob = (PBYTE)pre->szMessage; - MSN_CallService(MS_DB_EVENT_ADD, 0,(LPARAM)&dbei); - - return 0; + return Proto_AuthRecv(m_szModuleName, pre); } //////////////////////////////////////////////////////////////////////////////////////// @@ -375,11 +361,11 @@ int CMsnProto::Authorize(HANDLE hDbEvent) DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); - if ((int)(dbei.cbBlob = MSN_CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1) + if ((int)(dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1) return 1; dbei.pBlob = (PBYTE)alloca(dbei.cbBlob); - if (MSN_CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei)) + if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei)) return 1; if (dbei.eventType != EVENTTYPE_AUTHREQUEST) @@ -388,7 +374,7 @@ int CMsnProto::Authorize(HANDLE hDbEvent) if (strcmp(dbei.szModule, m_szModuleName)) return 1; - char* nick = (char*)(dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE)); + char* nick = (char*)(dbei.pBlob + sizeof(DWORD)*2); char* firstName = nick + strlen(nick) + 1; char* lastName = firstName + strlen(firstName) + 1; char* email = lastName + strlen(lastName) + 1; @@ -415,11 +401,11 @@ int CMsnProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); - if ((int)(dbei.cbBlob = MSN_CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1) + if ((int)(dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1) return 1; dbei.pBlob = (PBYTE)alloca(dbei.cbBlob); - if (MSN_CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei)) + if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei)) return 1; if (dbei.eventType != EVENTTYPE_AUTHREQUEST) @@ -428,7 +414,7 @@ int CMsnProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) if (strcmp(dbei.szModule, m_szModuleName)) return 1; - char* nick = (char*)(dbei.pBlob + sizeof(DWORD) + sizeof(HANDLE)); + char* nick = (char*)(dbei.pBlob + sizeof(DWORD)*2); char* firstName = nick + strlen(nick) + 1; char* lastName = firstName + strlen(firstName) + 1; char* email = lastName + strlen(lastName) + 1; @@ -442,10 +428,10 @@ int CMsnProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) if (!(msc->list & (LIST_FL | LIST_LL))) { - if (msc->hContact) MSN_CallService(MS_DB_CONTACT_DELETE, (WPARAM)msc->hContact, 0); + if (msc->hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)msc->hContact, 0); msc->hContact = NULL; HANDLE hContact = MSN_HContactFromEmail(email); - if (hContact) MSN_CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); + if (hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); } return 0; @@ -808,8 +794,7 @@ int __cdecl CMsnProto::RecvContacts(HANDLE hContact, PROTORECVEVENT*) int __cdecl CMsnProto::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) { - CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)evt }; - return MSN_CallService(MS_PROTO_RECVFILET, 0, (LPARAM)&ccs); + return Proto_RecvFile(hContact, evt); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -823,9 +808,7 @@ int __cdecl CMsnProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) if (Lists_IsInList(LIST_FL, tEmail)) DBDeleteContactSetting(hContact, "CList", "Hidden"); - CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre }; - MSN_CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs); - return 0; + return Proto_RecvMessage(hContact, pre); } //////////////////////////////////////////////////////////////////////////////////////// @@ -1232,7 +1215,7 @@ int __cdecl CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l { char szDbsettings[64]; mir_snprintf(szDbsettings, sizeof(szDbsettings), "%s_HTTPS", m_szModuleName); - MSN_CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbsettings); + CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbsettings); break; } @@ -1243,7 +1226,7 @@ int __cdecl CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l clmi.cbSize = sizeof(CLISTMENUITEM); clmi.flags = CMIM_NAME | CMIF_TCHAR; clmi.ptszName = m_tszUserName; - MSN_CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)mainMenuRoot, (LPARAM)&clmi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)mainMenuRoot, (LPARAM)&clmi); } break; diff --git a/protocols/MSN/msn_soapab.cpp b/protocols/MSN/msn_soapab.cpp index df6f513dbf..b565305199 100644 --- a/protocols/MSN/msn_soapab.cpp +++ b/protocols/MSN/msn_soapab.cpp @@ -976,7 +976,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas char* szCircleTicketEnc = (char*)alloca(cbCircleTicketEnc); NETLIBBASE64 nlb = { szCircleTicketEnc, cbCircleTicketEnc, (PBYTE)szCircleTicket, cbCircleTicket }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); if (szCircleTicketEnc[0]) msnNsThread->sendPacket("USR", "SHA A %s", szCircleTicketEnc); diff --git a/protocols/MSN/msn_srv.cpp b/protocols/MSN/msn_srv.cpp index 5a4f611ad3..a01cd401da 100644 --- a/protocols/MSN/msn_srv.cpp +++ b/protocols/MSN/msn_srv.cpp @@ -346,7 +346,7 @@ void CMsnProto::msn_storeAvatarThread(void* arg) size_t szEncPngSize = Netlib_GetBase64EncodedBufferSize(dat->dataSize); szEncBuf = (char*)mir_alloc(szEncPngSize); NETLIBBASE64 nlb = { szEncBuf, (int)szEncPngSize, dat->data, (int)dat->dataSize }; - MSN_CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); + CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb)); } if (photoid[0] && dat) diff --git a/protocols/MSN/msn_std.cpp b/protocols/MSN/msn_std.cpp index 082e0044ac..588df3c9e9 100644 --- a/protocols/MSN/msn_std.cpp +++ b/protocols/MSN/msn_std.cpp @@ -79,7 +79,7 @@ int CMsnProto::getStaticString(HANDLE hContact, const char* valueName, char* de sVal.pValue = &dbv; sVal.szModule = m_szModuleName; sVal.szSetting = valueName; - if (MSN_CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0) + if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0) return 1; return (dbv.type != DBVT_ASCIIZ); @@ -171,7 +171,7 @@ void CMsnProto::ForkThread(MsnThreadFunc pFunc, void* param) CloseHandle((HANDLE)mir_forkthreadowner((pThreadFuncOwner)*(void**)&pFunc, this, param, &threadID)); } -int CMsnProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam) +int CMsnProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam) { ACKDATA ack = {0}; ack.cbSize = sizeof(ACKDATA); @@ -181,21 +181,14 @@ int CMsnProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hPro ack.result = result; ack.hProcess = hProcess; ack.lParam = lParam; - return MSN_CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack); + return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack); } -#if !defined(_DEBUG) -INT_PTR MSN_CallService(const char* szSvcName, WPARAM wParam, LPARAM lParam) -{ - return CallService(szSvcName, wParam, lParam); -} -#endif - -TCHAR* CMsnProto::GetContactNameT(HANDLE hContact) +TCHAR* CMsnProto::GetContactNameT(HANDLE hContact) { if (hContact) - return (TCHAR*)MSN_CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR); + return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR); else { CONTACTINFO ci = {0}; @@ -214,7 +207,7 @@ void MSN_FreeVariant(DBVARIANT* dbv) DBFreeVariant(dbv); } -char* MSN_Translate(const char* str) +char* MSN_Translate(const char* str) { return Translate(str); } @@ -222,6 +215,6 @@ char* MSN_Translate(const char* str) unsigned MSN_GenRandom(void) { unsigned rndnum; - MSN_CallService(MS_UTILS_GETRANDOM, sizeof(rndnum), (LPARAM)&rndnum); + CallService(MS_UTILS_GETRANDOM, sizeof(rndnum), (LPARAM)&rndnum); return rndnum & 0x7FFFFFFF; } diff --git a/protocols/MSN/msn_threads.cpp b/protocols/MSN/msn_threads.cpp index 3581f9afad..ca625b4fa1 100644 --- a/protocols/MSN/msn_threads.cpp +++ b/protocols/MSN/msn_threads.cpp @@ -133,7 +133,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) MSN_DebugLog("Thread started: server='%s:%d', type=%d", tConn.szHost, tConn.wPort, info->mType); - info->s = (HANDLE)MSN_CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&tConn); + info->s = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&tConn); if (info->s == NULL) { MSN_DebugLog("Connection Failed (%d) server='%s:%d'", WSAGetLastError(), tConn.szHost, tConn.wPort); @@ -152,7 +152,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) } if (usingGateway) - MSN_CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(info->s), info->mGatewayTimeout); + CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(info->s), info->mGatewayTimeout); MSN_DebugLog("Connected with handle=%08X", info->s); @@ -321,14 +321,14 @@ void CMsnProto::MSN_CloseConnections(void) if (T->s != NULL && !T->sessionClosed && !T->termPending) { nls.hReadConns[0] = T->s; - int res = MSN_CallService(MS_NETLIB_SELECTEX, 0, (LPARAM)&nls); + int res = CallService(MS_NETLIB_SELECTEX, 0, (LPARAM)&nls); if (res >= 0 || nls.hReadStatus[0] == 0) T->sendTerminate(); } break; case SERVER_P2P_DIRECT : - MSN_CallService(MS_NETLIB_SHUTDOWN, (WPARAM)T->s, 0); + CallService(MS_NETLIB_SHUTDOWN, (WPARAM)T->s, 0); break; } } @@ -336,7 +336,7 @@ void CMsnProto::MSN_CloseConnections(void) LeaveCriticalSection(&sttLock); if (hHttpsConnection) - MSN_CallService(MS_NETLIB_SHUTDOWN, (WPARAM)hHttpsConnection, 0); + CallService(MS_NETLIB_SHUTDOWN, (WPARAM)hHttpsConnection, 0); } void CMsnProto::MSN_CloseThreads(void) @@ -363,7 +363,7 @@ void CMsnProto::MSN_CloseThreads(void) ThreadData* T = &sttThreads[i]; if (T->s != NULL) - MSN_CallService(MS_NETLIB_SHUTDOWN, (WPARAM)T->s, 0); + CallService(MS_NETLIB_SHUTDOWN, (WPARAM)T->s, 0); } LeaveCriticalSection(&sttLock); @@ -729,7 +729,7 @@ void ThreadData::applyGatewayData(HANDLE hConn, bool isPoll) nlhpi.szHttpGetUrl = NULL; nlhpi.szHttpPostUrl = szHttpPostUrl; nlhpi.combinePackets = 5; - MSN_CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi); + CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi); } void ThreadData::getGatewayUrl(char* dest, int destlen, bool isPoll) diff --git a/protocols/MSN/msn_ws.cpp b/protocols/MSN/msn_ws.cpp index b1dff440c8..653343e7f8 100644 --- a/protocols/MSN/msn_ws.cpp +++ b/protocols/MSN/msn_ws.cpp @@ -33,10 +33,10 @@ int ThreadData::send(const char data[], size_t datalen) if (proto->usingGateway && !(mType == SERVER_FILETRANS || mType == SERVER_P2P_DIRECT)) { mGatewayTimeout = 2; - MSN_CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout); + CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout); } - int rlen = MSN_CallService(MS_NETLIB_SEND, (WPARAM)s, (LPARAM)&nlb); + int rlen = CallService(MS_NETLIB_SEND, (WPARAM)s, (LPARAM)&nlb); if (rlen == SOCKET_ERROR) { // should really also check if sendlen is the same as datalen @@ -127,7 +127,7 @@ int ThreadData::recv(char* data, size_t datalen) for (;;) { - int ret = MSN_CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls); + int ret = CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls); if (ret < 0) { proto->MSN_DebugLog("Connection abortively closed, error %d", WSAGetLastError()); @@ -143,7 +143,7 @@ int ThreadData::recv(char* data, size_t datalen) } LBL_RecvAgain: - int ret = MSN_CallService(MS_NETLIB_RECV, (WPARAM)s, (LPARAM)&nlb); + int ret = CallService(MS_NETLIB_RECV, (WPARAM)s, (LPARAM)&nlb); if (ret == 0) { proto->MSN_DebugLog("Connection closed gracefully"); @@ -163,14 +163,14 @@ LBL_RecvAgain: if (sessionClosed || isTimeout()) return 0; if ((mGatewayTimeout += 2) > 20) mGatewayTimeout = 20; - MSN_CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout); + CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout); goto LBL_RecvAgain; } else { resetTimeout(); mGatewayTimeout = 1; - MSN_CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout); + CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout); } } diff --git a/protocols/Omegle/stubs.cpp b/protocols/Omegle/stubs.cpp index 825c60ac8c..b02fd71ef5 100644 --- a/protocols/Omegle/stubs.cpp +++ b/protocols/Omegle/stubs.cpp @@ -24,57 +24,57 @@ along with this program. If not, see . HANDLE OmegleProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - return 0; + return NULL; }; HANDLE OmegleProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent) { - return 0; + return NULL; }; int OmegleProto::Authorize(HANDLE hDbEvent) { - return 0; + return 1; } int OmegleProto::AuthDeny(HANDLE hDbEvent,const PROTOCHAR *reason) { - return 0; + return 1; } int OmegleProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } int OmegleProto::AuthRequest(HANDLE hContact,const PROTOCHAR *message) { - return 0; + return 1; } HANDLE OmegleProto::ChangeInfo(int type,void *info_data) { - return 0; + return NULL; } HANDLE OmegleProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *path) { - return 0; + return NULL; } int OmegleProto::FileCancel(HANDLE hContact,HANDLE hTransfer) { - return 0; + return 1; } int OmegleProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *reason) { - return 0; + return 1; } int OmegleProto::FileResume(HANDLE hTransfer,int *action,const PROTOCHAR **filename) { - return 0; + return 1; } int OmegleProto::GetInfo( HANDLE hContact, int infoType ) @@ -84,90 +84,90 @@ int OmegleProto::GetInfo( HANDLE hContact, int infoType ) HANDLE OmegleProto::SearchBasic( const PROTOCHAR* id ) { - return 0; + return NULL; } HANDLE OmegleProto::SearchByEmail( const PROTOCHAR* email ) { - return 0; + return NULL; } HANDLE OmegleProto::SearchByName( const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName ) { - return 0; + return NULL; } HWND OmegleProto::SearchAdvanced(HWND owner) { - return 0; + return NULL; } HWND OmegleProto::CreateExtendedSearchUI(HWND owner) { - return 0; + return NULL; } int OmegleProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } int OmegleProto::RecvFile(HANDLE hContact,PROTORECVFILET *) { - return 0; + return 1; } int OmegleProto::RecvUrl(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } int OmegleProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *hContactsList) { - return 0; + return 1; } HANDLE OmegleProto::SendFile(HANDLE hContact,const PROTOCHAR *desc, PROTOCHAR **files) { - return 0; + return NULL; } int OmegleProto::SendUrl(HANDLE hContact,int flags,const char *url) { - return 0; + return 1; } int OmegleProto::SetApparentMode(HANDLE hContact,int mode) { - return 0; + return 1; } int OmegleProto::RecvAwayMsg(HANDLE hContact,int mode,PROTORECVEVENT *evt) { - return 0; + return 1; } int OmegleProto::SendAwayMsg(HANDLE hContact,HANDLE hProcess,const char *msg) { - return 0; + return 1; } int OmegleProto::UserIsTyping(HANDLE hContact, int type) { - return 0; + return 1; } int OmegleProto::SetAwayMsg(int iStatus, const PROTOCHAR* msg) { - return 0; + return 1; } HANDLE OmegleProto::GetAwayMsg( HANDLE hContact ) { - return 0; + return NULL; } int OmegleProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) { - return 0; + return 1; } diff --git a/protocols/Twitter/proto.cpp b/protocols/Twitter/proto.cpp index d81fe8163c..40f0e30ec4 100644 --- a/protocols/Twitter/proto.cpp +++ b/protocols/Twitter/proto.cpp @@ -147,8 +147,7 @@ HICON TwitterProto::GetIcon(int index) int TwitterProto::RecvMsg(HANDLE hContact,PROTORECVEVENT *pre) { - CCSDATA ccs = { hContact,PSR_MESSAGE,0,reinterpret_cast(pre) }; - return (int)CallService(MS_PROTO_RECVMSG,0,reinterpret_cast(&ccs)); + return Proto_RecvMessage(hContact, pre); } // ************************* diff --git a/protocols/Twitter/stubs.cpp b/protocols/Twitter/stubs.cpp index 6dabe5ec76..472138abe3 100644 --- a/protocols/Twitter/stubs.cpp +++ b/protocols/Twitter/stubs.cpp @@ -19,121 +19,121 @@ along with this program. If not, see . HANDLE TwitterProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent) { - return 0; + return NULL; } int TwitterProto::Authorize(HANDLE hDbEvent) { - return 0; + return 1; } int TwitterProto::AuthDeny(HANDLE hDbEvent,const TCHAR *reason) { - return 0; + return 1; } int TwitterProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } int TwitterProto::AuthRequest(HANDLE hContact,const TCHAR *message) { - return 0; + return 1; } HANDLE TwitterProto::ChangeInfo(int type,void *info_data) { MessageBoxA(0,"ChangeInfo","",0); - return 0; + return NULL; } HANDLE TwitterProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const TCHAR *path) { - return 0; + return NULL; } int TwitterProto::FileCancel(HANDLE hContact,HANDLE hTransfer) { - return 0; + return 1; } int TwitterProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const TCHAR *reason) { - return 0; + return 1; } int TwitterProto::FileResume(HANDLE hTransfer,int *action,const TCHAR **filename) { - return 0; + return 1; } HANDLE TwitterProto::SearchByName(const TCHAR *nick,const TCHAR *first_name, const TCHAR *last_name) { - return 0; + return NULL; } HWND TwitterProto::SearchAdvanced(HWND owner) { - return 0; + return NULL; } HWND TwitterProto::CreateExtendedSearchUI(HWND owner) { - return 0; + return NULL; } int TwitterProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } int TwitterProto::RecvFile(HANDLE hContact,PROTORECVFILET *) { - return 0; + return 1; } int TwitterProto::RecvUrl(HANDLE hContact,PROTORECVEVENT *) { - return 0; + return 1; } int TwitterProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *hContactsList) { - return 0; + return 1; } HANDLE TwitterProto::SendFile(HANDLE hContact,const TCHAR *desc, TCHAR **files) { - return 0; + return NULL; } int TwitterProto::SendUrl(HANDLE hContact,int flags,const char *url) { - return 0; + return 1; } int TwitterProto::SetApparentMode(HANDLE hContact,int mode) { - return 0; + return 1; } int TwitterProto::RecvAwayMsg(HANDLE hContact,int mode,PROTORECVEVENT *evt) { - return 0; + return 1; } int TwitterProto::SendAwayMsg(HANDLE hContact,HANDLE hProcess,const char *msg) { - return 0; + return 1; } int TwitterProto::SetAwayMsg(int status,const TCHAR *msg) { - return 0; + return 1; } int TwitterProto::UserIsTyping(HANDLE hContact,int type) { - return 0; + return 1; } \ No newline at end of file diff --git a/protocols/Yahoo/avatar.cpp b/protocols/Yahoo/avatar.cpp index a838e24ea1..c35707203d 100644 --- a/protocols/Yahoo/avatar.cpp +++ b/protocols/Yahoo/avatar.cpp @@ -648,7 +648,7 @@ void CYahooProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, int cbLen, } if ( _taccess(pszDest, 0)) - YAHOO_CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); + CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); if (hContact != NULL) { int ck_sum = DBGetContactSettingDword(hContact, m_szModuleName,"PictCK", 0); diff --git a/protocols/Yahoo/chat.cpp b/protocols/Yahoo/chat.cpp index 9275d90e86..4477e5a0d9 100644 --- a/protocols/Yahoo/chat.cpp +++ b/protocols/Yahoo/chat.cpp @@ -259,7 +259,7 @@ void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const TC TCHAR* snt = mir_a2t(who); HANDLE hContact = getbuddyH(who); - TCHAR* nick = hContact ? (TCHAR*)YAHOO_CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR) : snt; + TCHAR* nick = hContact ? (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR) : snt; GCDEST gcd = { m_szModuleName, { NULL }, evt }; gcd.ptszID = idt; @@ -320,7 +320,7 @@ int __cdecl CYahooProto::OnGCEventHook(WPARAM, LPARAM lParam) break; case GC_USER_PRIVMESS: - YAHOO_CallService(MS_MSG_SENDMESSAGE, (WPARAM)getbuddyH(who), 0); + CallService(MS_MSG_SENDMESSAGE, (WPARAM)getbuddyH(who), 0); break; case GC_USER_LOGMENU: @@ -341,11 +341,11 @@ int __cdecl CYahooProto::OnGCEventHook(WPARAM, LPARAM lParam) switch (gch->dwData) { case 10: - YAHOO_CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)getbuddyH(who), 0); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)getbuddyH(who), 0); break; case 20: - YAHOO_CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)getbuddyH(who), 0); + CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)getbuddyH(who), 0); break; case 110: diff --git a/protocols/Yahoo/icolib.cpp b/protocols/Yahoo/icolib.cpp index edb364eece..09ad4853b0 100644 --- a/protocols/Yahoo/icolib.cpp +++ b/protocols/Yahoo/icolib.cpp @@ -82,5 +82,5 @@ void CYahooProto::ReleaseIconEx(const char* name, bool big) { char szSettingName[100]; mir_snprintf(szSettingName, sizeof(szSettingName), "YAHOO_%s", name); - YAHOO_CallService(big ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, 0, (LPARAM)szSettingName); + CallService(big ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, 0, (LPARAM)szSettingName); } diff --git a/protocols/Yahoo/im.cpp b/protocols/Yahoo/im.cpp index 7478b1090b..5e28ec9d5f 100644 --- a/protocols/Yahoo/im.cpp +++ b/protocols/Yahoo/im.cpp @@ -242,8 +242,7 @@ int __cdecl CYahooProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre ) return 0; } - CCSDATA ccs = { hContact, PSR_MESSAGE, 0, ( LPARAM )pre }; - return CallService( MS_PROTO_RECVMSG, 0, ( LPARAM )&ccs ); + return Proto_RecvMessage(hContact, pre); } //======================================================= diff --git a/protocols/Yahoo/main.cpp b/protocols/Yahoo/main.cpp index 6b5a440e3c..df432b5223 100644 --- a/protocols/Yahoo/main.cpp +++ b/protocols/Yahoo/main.cpp @@ -110,7 +110,7 @@ extern "C" int __declspec(dllexport)Load(void) nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_HTTPCONNS; nlu.szSettingsModule = "YAHOO/libyahoo2"; nlu.ptszDescriptiveName = TranslateT("YAHOO plugin HTTP connections"); - g_hNetlibUser = ( HANDLE )YAHOO_CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); + g_hNetlibUser = ( HANDLE )CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); YmsgrLinksInit(); /** diff --git a/protocols/Yahoo/options.cpp b/protocols/Yahoo/options.cpp index 30e821f892..17ff35bb66 100644 --- a/protocols/Yahoo/options.cpp +++ b/protocols/Yahoo/options.cpp @@ -50,7 +50,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if ( !ppro->GetString( YAHOO_PASSWORD, &dbv )) { //bit of a security hole here, since it's easy to extract a password from an edit box - YAHOO_CallService( MS_DB_CRYPT_DECODESTRING, strlen( dbv.pszVal )+1, ( LPARAM )dbv.pszVal ); + CallService( MS_DB_CRYPT_DECODESTRING, strlen( dbv.pszVal )+1, ( LPARAM )dbv.pszVal ); SetDlgItemTextA( hwndDlg, IDC_PASSWORD, dbv.pszVal ); DBFreeVariant( &dbv ); } @@ -68,7 +68,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch ( LOWORD( wParam )) { case IDC_NEWYAHOOACCOUNTLINK: - YAHOO_CallService( MS_UTILS_OPENURL, 1, + CallService( MS_UTILS_OPENURL, 1, ppro->GetByte( "YahooJapan", 0 ) ? (LPARAM)"http://edit.yahoo.co.jp/config/eval_register" : (LPARAM)"http://edit.yahoo.com/config/eval_register" ); @@ -112,7 +112,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ppro->SetString( YAHOO_LOGINID, str ); GetDlgItemTextA( hwndDlg, IDC_PASSWORD, str, sizeof( str )); - YAHOO_CallService( MS_DB_CRYPT_ENCODESTRING, sizeof( str ),( LPARAM )str ); + CallService( MS_DB_CRYPT_ENCODESTRING, sizeof( str ),( LPARAM )str ); dbv.pszVal = NULL; if ( ppro->GetString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal )) reconnectRequired = TRUE; diff --git a/protocols/Yahoo/proto.cpp b/protocols/Yahoo/proto.cpp index a79d3cfbf7..e73af363c8 100644 --- a/protocols/Yahoo/proto.cpp +++ b/protocols/Yahoo/proto.cpp @@ -103,7 +103,7 @@ int CYahooProto::OnModulesLoadedEx( WPARAM, LPARAM ) nlu.pfnHttpGatewayUnwrapRecv = YAHOO_httpGatewayUnwrapRecv; #endif - m_hNetlibUser = ( HANDLE )YAHOO_CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); + m_hNetlibUser = ( HANDLE )CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); MenuContactInit(); return 0; @@ -150,23 +150,19 @@ HANDLE CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) HANDLE __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, HANDLE hDbEvent ) { - DBEVENTINFO dbei = {0}; - HANDLE hContact; - DebugLog("[YahooAddToListByEvent]"); if ( !m_bLoggedIn ) return 0; - dbei.cbSize = sizeof( dbei ); - - if (( dbei.cbBlob = YAHOO_CallService( MS_DB_EVENT_GETBLOBSIZE, ( LPARAM )hDbEvent, 0 )) == -1 ) { + DBEVENTINFO dbei = { sizeof( dbei ) }; + if (( dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, ( LPARAM )hDbEvent, 0 )) == -1 ) { DebugLog("[YahooAddToListByEvent] ERROR: Can't get blob size."); return 0; } DebugLog("[YahooAddToListByEvent] Got blob size: %lu", dbei.cbBlob); dbei.pBlob = ( PBYTE )_alloca( dbei.cbBlob ); - if ( YAHOO_CallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )) { + if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )) { DebugLog("[YahooAddToListByEvent] ERROR: Can't get event."); return 0; } @@ -181,29 +177,10 @@ HANDLE __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, HANDL return 0; } - //Adds a contact to the contact list given an auth, added or contacts event -//wParam=MAKEWPARAM(flags,iContact) -//lParam=(LPARAM)(HANDLE)hDbEvent -//Returns a HANDLE to the new contact, or NULL on failure -//hDbEvent must be either EVENTTYPE_AUTHREQ or EVENTTYPE_ADDED -//flags are the same as for PS_ADDTOLIST. -//iContact is only used for contacts events. It is the 0-based index of the -//contact in the event to add. There is no way to add two or more contacts at -//once, you should just do lots of calls. - - /* TYPE ADDED - blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), - last(ASCIIZ), email(ASCIIZ) - - TYPE AUTH REQ - blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), - last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) - */ - memcpy(&hContact,( char* )( dbei.pBlob + sizeof( DWORD )), sizeof(HANDLE)); - - if (hContact != NULL) { + HANDLE hContact = DbGetAuthEventContact(&dbei); + if (hContact != NULL) DebugLog("Temp Buddy found at: %p ", hContact); - } else + else DebugLog("hContact NULL???"); return hContact; @@ -220,27 +197,22 @@ int CYahooProto::Authorize( HANDLE hdbe ) return 1; } - DBEVENTINFO dbei; - memset( &dbei, 0, sizeof( dbei )); - dbei.cbSize = sizeof( dbei ); - if (( dbei.cbBlob = YAHOO_CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0 )) == -1 ) + DBEVENTINFO dbei = { sizeof(dbei) }; + if (( dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0 )) == -1 ) return 1; dbei.pBlob = ( PBYTE )_alloca( dbei.cbBlob ); - if ( YAHOO_CallService( MS_DB_EVENT_GET, ( WPARAM )hdbe, ( LPARAM )&dbei )) + if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hdbe, ( LPARAM )&dbei )) return 1; - if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ) + if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1; - if ( strcmp( dbei.szModule, m_szModuleName )) + if ( strcmp(dbei.szModule, m_szModuleName)) return 1; - HANDLE hContact; - memcpy(&hContact,( char* )( dbei.pBlob + sizeof( DWORD )), sizeof(HANDLE)); - /* Need to remove the buddy from our Miranda Lists */ - + HANDLE hContact = DbGetAuthEventContact(&dbei); if (hContact != NULL) { char *who = DBGetString(hContact, m_szModuleName, YAHOO_LOGINID); if (!who) return 0; @@ -270,13 +242,13 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) memset( &dbei, 0, sizeof( dbei )); dbei.cbSize = sizeof( dbei ); - if (( dbei.cbBlob = YAHOO_CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0 )) == -1 ) { + if (( dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0 )) == -1 ) { DebugLog("[YahooAuthDeny] ERROR: Can't get blob size"); return 1; } dbei.pBlob = ( PBYTE )alloca( dbei.cbBlob ); - if ( YAHOO_CallService( MS_DB_EVENT_GET, ( WPARAM )hdbe, ( LPARAM )&dbei )) { + if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hdbe, ( LPARAM )&dbei )) { DebugLog("YahooAuthDeny - Can't get db event!"); return 1; } @@ -291,12 +263,9 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) return 1; } - HANDLE hContact; - memcpy(&hContact, dbei.pBlob + sizeof(DWORD), sizeof(HANDLE)); - /* Need to remove the buddy from our Miranda Lists */ - if (hContact != NULL) - { + HANDLE hContact = DbGetAuthEventContact(&dbei); + if (hContact != NULL) { char *who = DBGetString(hContact, m_szModuleName, YAHOO_LOGINID); if (!who) return 0; @@ -305,7 +274,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) DebugLog("Rejecting buddy:%s msg: %s", who, u_reason); reject(myid, who, GetWord(hContact, "yprotoid", 0), u_reason); - YAHOO_CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); + CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); mir_free(u_reason); mir_free(myid); @@ -317,26 +286,11 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AUTH -int __cdecl CYahooProto::AuthRecv( HANDLE hContact, PROTORECVEVENT* pre ) +int __cdecl CYahooProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) { DebugLog("[YahooRecvAuth] "); DBDeleteContactSetting(hContact,"CList","Hidden"); - - DBEVENTINFO dbei = { 0 }; - dbei.cbSize = sizeof(dbei); - dbei.szModule = m_szModuleName; - dbei.timestamp = pre->timestamp; - dbei.flags = pre->flags & (PREF_CREATEREAD?DBEF_READ:0); - dbei.flags |= (pre->flags & PREF_UTF) ? DBEF_UTF : 0; - dbei.eventType = EVENTTYPE_AUTHREQUEST; - - /* Just copy the Blob from PSR_AUTH event. */ - dbei.cbBlob = pre->lParam; - dbei.pBlob = (PBYTE)pre->szMessage; - - CallService(MS_DB_EVENT_ADD,(WPARAM)NULL,(LPARAM)&dbei); - - return 0; + return Proto_AuthRecv(m_szModuleName, pre); } //////////////////////////////////////////////////////////////////////////////////////// @@ -470,8 +424,7 @@ int __cdecl CYahooProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt ) { DBDeleteContactSetting(hContact, "CList", "Hidden"); - CCSDATA ccs = { hContact, PSR_FILE, 0, ( LPARAM )evt }; - return CallService( MS_PROTO_RECVFILE, 0, ( LPARAM )&ccs ); + return Proto_RecvFile(hContact, evt); } //////////////////////////////////////////////////////////////////////////////////////// @@ -811,7 +764,7 @@ int __cdecl CYahooProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARA clmi.cbSize = sizeof(CLISTMENUITEM); clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; clmi.ptszName = m_tszUserName; - YAHOO_CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )mainMenuRoot, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )mainMenuRoot, ( LPARAM )&clmi ); } break; diff --git a/protocols/Yahoo/services.cpp b/protocols/Yahoo/services.cpp index e36a27163c..2ea817d279 100644 --- a/protocols/Yahoo/services.cpp +++ b/protocols/Yahoo/services.cpp @@ -31,7 +31,7 @@ void CYahooProto::logoff_buddies() { //set all contacts to 'offline' - HANDLE hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { if (IsMyContact(hContact)) { @@ -45,7 +45,7 @@ void CYahooProto::logoff_buddies() //DBDeleteContactSetting(hContact, m_szModuleName, "MirVer" ); } - hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); + hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); } } @@ -393,7 +393,7 @@ void CYahooProto::MenuMainInit( void ) } else { if ( mainMenuRoot ) - YAHOO_CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )mainMenuRoot, 0 ); + CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )mainMenuRoot, 0 ); mainMenuRoot = NULL; } @@ -500,9 +500,9 @@ void CYahooProto::MenuContactInit( void ) void CYahooProto::MenuUninit( void ) { if ( mainMenuRoot ) - YAHOO_CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )mainMenuRoot, 0 ); + CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )mainMenuRoot, 0 ); - YAHOO_CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )hShowProfileMenuItem, 0 ); + CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )hShowProfileMenuItem, 0 ); } int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) @@ -522,7 +522,7 @@ int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) if (GetWord( hContact, "yprotoid", 0) != 0) mi.flags |= CMIF_HIDDEN; - YAHOO_CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowProfileMenuItem, (LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowProfileMenuItem, (LPARAM)&mi); return 0; } diff --git a/protocols/Yahoo/util.cpp b/protocols/Yahoo/util.cpp index e607ec0a8c..977d0b43cc 100644 --- a/protocols/Yahoo/util.cpp +++ b/protocols/Yahoo/util.cpp @@ -49,11 +49,6 @@ void CYahooProto::YHookEvent( const char* szEvent, YEventFunc handler ) ::HookEventObj( szEvent, ( MIRANDAHOOKOBJ )*( void** )&handler, this ); } -INT_PTR __stdcall YAHOO_CallService( const char* szSvcName, WPARAM wParam, LPARAM lParam ) -{ - return CallService( szSvcName, wParam, lParam ); -} - int CYahooProto::DebugLog( const char *fmt, ... ) { char str[ 4096 ]; @@ -114,7 +109,7 @@ DWORD CYahooProto::GetDword( HANDLE hContact, const char* valueName, DWORD parDe DWORD CYahooProto::SetDword( const char* valueName, DWORD parValue ) { - return DBWriteContactSettingDword( NULL, m_szModuleName, valueName, parValue); + return DBWriteContactSettingDword( NULL, m_szModuleName, valueName, parValue); } DWORD CYahooProto::GetDword( const char* valueName, DWORD parDefltValue ) @@ -124,7 +119,7 @@ DWORD CYahooProto::GetDword( const char* valueName, DWORD parDefltValue ) DWORD CYahooProto::SetDword( HANDLE hContact, const char* valueName, DWORD parValue ) { - return DBWriteContactSettingDword( hContact, m_szModuleName, valueName, parValue); + return DBWriteContactSettingDword( hContact, m_szModuleName, valueName, parValue); } @@ -171,7 +166,7 @@ int CYahooProto::SendBroadcast( HANDLE hContact, int type, int result, HANDLE hP ack.result = result; ack.hProcess = hProcess; ack.lParam = lParam; - return YAHOO_CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack ); + return CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack ); } int CYahooProto::GetString( const char* name, DBVARIANT* result ) @@ -267,7 +262,7 @@ int CYahooProto::ShowPopup( const char* nickname, const char* msg, const char *s DebugLog("[MS_POPUP_ADDPOPUPEX] Generating a popup for [%s] %s", nickname, msg); - YAHOO_CallService( MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0 ); + CallService( MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0 ); return 1; } @@ -332,7 +327,7 @@ bool CYahooProto::IsMyContact(HANDLE hContact) char* YAHOO_GetContactName( HANDLE hContact ) { - return ( char* )YAHOO_CallService( MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0 ); + return ( char* )CallService( MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0 ); } extern PLUGININFOEX pluginInfo; diff --git a/protocols/Yahoo/yahoo.cpp b/protocols/Yahoo/yahoo.cpp index dbec251ef1..591a651d10 100644 --- a/protocols/Yahoo/yahoo.cpp +++ b/protocols/Yahoo/yahoo.cpp @@ -286,9 +286,9 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id) { HANDLE hContact; - for ( hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + for ( hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); hContact != NULL; - hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 )) + hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 )) { if (IsMyContact(hContact)) { @@ -334,8 +334,8 @@ HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int //not already there: add LOG(("[add_buddy] Adding buddy id: %s (Nick: %s), flags: %lu", yid, yahoo_name, flags)); - hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_ADD, 0, 0 ); - YAHOO_CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hContact,( LPARAM )m_szModuleName ); + hContact = ( HANDLE )CallService( MS_DB_CONTACT_ADD, 0, 0 ); + CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hContact,( LPARAM )m_szModuleName ); SetString( hContact, YAHOO_LOGINID, yid ); Set_Protocol( hContact, protocol ); @@ -621,9 +621,9 @@ void CYahooProto::ext_got_stealth(char *stealthlist) if (stealthlist) stealth = y_strsplit(stealthlist, ",", -1); - for ( hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); + for ( hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); hContact != NULL; - hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 )) + hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 )) { if (IsMyContact(hContact)) { DBVARIANT dbv; @@ -751,7 +751,7 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) * Make sure the contact is temporary so we could delete it w/o extra traffic */ DBWriteContactSettingByte( hContact, "CList", "NotOnList", 1 ); - YAHOO_CallService( MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); + CallService( MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); } else LOG(("[ext_rejected] Buddy not on our buddy list")); @@ -780,7 +780,7 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status ShowPopup( "Invalid Contact", "The id you tried to add is invalid.", NULL); /* Make it TEMP first, we don't want to send any extra packets for FALSE ids */ DBWriteContactSettingByte( hContact, "CList", "NotOnList", 1 ); - YAHOO_CallService( MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); + CallService( MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); } break; @@ -790,7 +790,7 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status ShowPopup( "Invalid Contact", "Unknown Error??.", NULL); /* Make it TEMP first, we don't want to send any extra packets for FALSE ids */ DBWriteContactSettingByte( hContact, "CList", "NotOnList", 1 ); - YAHOO_CallService( MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); + CallService( MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); } break; @@ -1076,7 +1076,7 @@ void ext_yahoo_got_cookies(int id) //wsprintfA(z, "Cookie: %s; Y=%s", Bcookie, yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t")); wsprintfA(z, "Cookie: Y=%s; T=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t")); LOG(("Our Cookie: '%s'", z)); - YAHOO_CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hnuMain, (LPARAM)z);*/ + CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hnuMain, (LPARAM)z);*/ #ifdef HTTP_GATEWAY if (iHTTPGateway) { @@ -1086,7 +1086,7 @@ void ext_yahoo_got_cookies(int id) mir_snprintf(z, sizeof(z), "Cookie: Y=%s; T=%s; C=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"), yahoo_get_cookie(id, "c")); LOG(("Our Cookie: '%s'", z)); - YAHOO_CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hNetlibUser, (LPARAM)z); + CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hNetlibUser, (LPARAM)z); } #endif @@ -1398,7 +1398,7 @@ static void connect_complete(void *data, int source, yahoo_input_condition condi //tSelect.dwTimeout = T->mGatewayTimeout * 1000; tSelect.dwTimeout = 1; tSelect.hReadConns[ 0 ] = ( HANDLE )source; - error = YAHOO_CallService( MS_NETLIB_SELECT, 0, ( LPARAM )&tSelect ); + error = CallService( MS_NETLIB_SELECT, 0, ( LPARAM )&tSelect ); if(error) { //close(source); diff --git a/protocols/Yahoo/yahoo.h b/protocols/Yahoo/yahoo.h index ed90bf8756..29772a0817 100644 --- a/protocols/Yahoo/yahoo.h +++ b/protocols/Yahoo/yahoo.h @@ -116,8 +116,6 @@ extern HINSTANCE hInstance; extern int iHTTPGateway; #endif -INT_PTR __stdcall YAHOO_CallService( const char* szSvcName, WPARAM wParam, LPARAM lParam ); - #define YAHOO_hasnotification() ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) int YAHOO_util_dbsettingchanged(WPARAM wParam, LPARAM lParam); diff --git a/src/core/stdauth/auth.cpp b/src/core/stdauth/auth.cpp index 9146653db8..e124c10bbf 100644 --- a/src/core/stdauth/auth.cpp +++ b/src/core/stdauth/auth.cpp @@ -2,8 +2,8 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people +Copyright 2000-2009 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people listed in contributors.txt. This program is free software; you can redistribute it and/or @@ -11,7 +11,7 @@ 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, +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. @@ -49,14 +49,14 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); CallService(MS_DB_EVENT_GET, (WPARAM)lParam, (LPARAM)&dbei); - if (dbei.flags & (DBEF_SENT | DBEF_READ) || (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED)) + if (dbei.flags & (DBEF_SENT | DBEF_READ) || (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED)) return 0; dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, lParam, 0); dbei.pBlob = (PBYTE)alloca(dbei.cbBlob); CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei); - HANDLE hContact = *(PHANDLE)(dbei.pBlob + sizeof(DWORD)); + HANDLE hContact = DbGetAuthEventContact(&dbei); CLISTEVENT cli = {0}; cli.cbSize = sizeof(cli); @@ -89,7 +89,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) if (szUid[0]) mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%s requests authorization"), szUid); else - mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u requests authorization"), *((PDWORD)dbei.pBlob)); + mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob); cli.hIcon = LoadSkinIcon(SKINICON_OTHER_MIRANDA); cli.pszService = MS_AUTH_SHOWREQUEST; @@ -100,7 +100,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) if (szUid[0]) mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%s added you to their contact list"), szUid); else - mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u added you to their contact list"), *((PDWORD)dbei.pBlob)); + mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob); cli.hIcon = LoadSkinIcon(SKINICON_OTHER_MIRANDA); cli.pszService = MS_AUTH_SHOWADDED; @@ -119,4 +119,4 @@ int LoadSendRecvAuthModule(void) SkinAddNewSoundEx("AddedEvent", LPGEN("Alerts"), LPGEN("Added event")); return 0; -} +} diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index aff4fcbfa3..a7088ac378 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -467,7 +467,7 @@ int LoadSendRecvFileModule(void) HookEvent(ME_OPT_INITIALISE, FileOptInitialise); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRFilePreBuildMenu); - CreateServiceFunction(MS_PROTO_RECVFILE, Proto_RecvFile); + CreateServiceFunction(MS_PROTO_RECVFILET, Proto_RecvFile); CreateServiceFunction(MS_PROTO_RECVFILET, Proto_RecvFileT); CreateServiceFunction(MS_FILE_SENDFILE, SendFileCommand); diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 7c15f1de39..fb3c33e644 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -177,6 +177,22 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) return CallService(MS_DB_EVENT_ADD, (WPARAM) ccs->hContact, (LPARAM)&dbei); } +static INT_PTR Proto_AuthRecv(WPARAM wParam, LPARAM lParam) +{ + PROTORECVEVENT* pre = (PROTORECVEVENT*)lParam; + + DBEVENTINFO dbei = { 0 }; + dbei.cbSize = sizeof(dbei); + dbei.szModule = (char*)wParam; + dbei.timestamp = pre->timestamp; + dbei.flags = pre->flags & (PREF_CREATEREAD?DBEF_READ:0); + dbei.flags |= (pre->flags & PREF_UTF) ? DBEF_UTF : 0; + dbei.eventType = EVENTTYPE_AUTHREQUEST; + dbei.cbBlob = pre->lParam; + dbei.pBlob = (PBYTE)pre->szMessage; + return CallService(MS_DB_EVENT_ADD,(WPARAM)NULL,(LPARAM)&dbei); +} + ///////////////////////////////////////////////////////////////////////////////////////// // User Typing Notification services @@ -700,6 +716,7 @@ int LoadProtocolsModule(void) CreateServiceFunction(MS_PROTO_CONTACTISTYPING, Proto_ContactIsTyping); CreateServiceFunction(MS_PROTO_RECVMSG, Proto_RecvMessage); + CreateServiceFunction(MS_PROTO_AUTHRECV, Proto_AuthRecv); CreateServiceFunction("Proto/EnumProtocols", Proto_EnumAccounts); CreateServiceFunction(MS_PROTO_ENUMACCOUNTS, Proto_EnumAccounts); -- cgit v1.2.3