diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-14 15:40:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-14 15:40:28 +0000 |
commit | 5049950f23d8a84b1bb286cbc6bf1ab3e6944fb0 (patch) | |
tree | 5356966724f7f66334bf89690dc36618cb5dd711 /protocols/GTalkExt/src | |
parent | d6b7f083ef11b88282290370988aa7cb60a53345 (diff) |
crazy leaky piece of junk eliminated
git-svn-id: http://svn.miranda-ng.org/main/trunk@4027 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/GTalkExt/src')
-rw-r--r-- | protocols/GTalkExt/src/GTalkExt.cpp | 3 | ||||
-rw-r--r-- | protocols/GTalkExt/src/avatar.cpp | 2 | ||||
-rw-r--r-- | protocols/GTalkExt/src/db.cpp | 2 | ||||
-rw-r--r-- | protocols/GTalkExt/src/dllmain.cpp | 40 | ||||
-rw-r--r-- | protocols/GTalkExt/src/handlers.cpp | 2 | ||||
-rw-r--r-- | protocols/GTalkExt/src/menu.cpp | 4 | ||||
-rw-r--r-- | protocols/GTalkExt/src/notifications.cpp | 24 | ||||
-rw-r--r-- | protocols/GTalkExt/src/options.cpp | 4 | ||||
-rw-r--r-- | protocols/GTalkExt/src/popups.cpp | 104 | ||||
-rw-r--r-- | protocols/GTalkExt/src/popups.h | 25 | ||||
-rw-r--r-- | protocols/GTalkExt/src/resources.h | 1 |
11 files changed, 29 insertions, 182 deletions
diff --git a/protocols/GTalkExt/src/GTalkExt.cpp b/protocols/GTalkExt/src/GTalkExt.cpp index e40df25053..463f1985b8 100644 --- a/protocols/GTalkExt/src/GTalkExt.cpp +++ b/protocols/GTalkExt/src/GTalkExt.cpp @@ -45,11 +45,8 @@ PLUGININFOEX pluginInfo={ {0x08B86253, 0xEC6E, 0x4d09, { 0xB7, 0xA9, 0x64, 0xAC, 0xDF, 0x06, 0x27, 0xB8 }} //{08B86253-EC6E-4d09-B7A9-64ACDF0627B8}
};
-extern DWORD g_mirandaVersion;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- g_mirandaVersion = mirandaVersion;
return &pluginInfo;
}
diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index 1e55937a44..c78073ec0a 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -142,7 +142,7 @@ VOID CALLBACK CallSetAvatar(PVOID lpParameter, BOOLEAN TimerOrWaitFired) int AvaChanged(WPARAM wParam, LPARAM lParam)
{
- if (!lParam && DBGetContactSettingByte((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
+ if (!lParam && db_get_b((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
BOOL enqueued = FALSE;
AVACHANGED *ach = (AVACHANGED*)malloc(sizeof(AVACHANGED));
__try {
diff --git a/protocols/GTalkExt/src/db.cpp b/protocols/GTalkExt/src/db.cpp index 27290afafb..dcdde85451 100644 --- a/protocols/GTalkExt/src/db.cpp +++ b/protocols/GTalkExt/src/db.cpp @@ -91,7 +91,7 @@ void RenewPseudocontactHandles() HANDLE hContact = db_find_first();
while (hContact) {
- if (DBGetContactSettingByte(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
+ if (db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
LPCSTR proto = (LPCSTR)GetContactProto(hContact);
DBWriteContactSettingDword(0, proto, PSEUDOCONTACT_LINK, (DWORD)hContact);
}
diff --git a/protocols/GTalkExt/src/dllmain.cpp b/protocols/GTalkExt/src/dllmain.cpp index e1097a3ea6..bcc54371fb 100644 --- a/protocols/GTalkExt/src/dllmain.cpp +++ b/protocols/GTalkExt/src/dllmain.cpp @@ -22,41 +22,27 @@ #include "stdafx.h"
#include "notifications.h"
#include "options.h"
-#include "popups.h"
HINSTANCE hInst = 0;
DWORD itlsSettings = TLS_OUT_OF_INDEXES;
DWORD itlsRecursion = TLS_OUT_OF_INDEXES;
-DWORD itlsPopupHook = TLS_OUT_OF_INDEXES;
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID)
{
- hInst = hinstDLL;
-
switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- if (((itlsSettings = TlsAlloc()) == TLS_OUT_OF_INDEXES) ||
- ((itlsRecursion = TlsAlloc()) == TLS_OUT_OF_INDEXES) ||
- ((itlsPopupHook = TlsAlloc()) == TLS_OUT_OF_INDEXES))
- return FALSE;
- break;
-
- case DLL_THREAD_ATTACH:
- TlsSetValue(itlsPopupHook,
- (PVOID)SetWindowsHookEx(WH_CALLWNDPROCRET, PopupHookProc, NULL, GetCurrentThreadId()));
- break;
-
- case DLL_THREAD_DETACH:
- UnhookWindowsHookEx((HHOOK)TlsGetValue(itlsPopupHook));
- break;
-
- case DLL_PROCESS_DETACH:
- TlsFree(itlsSettings);
- TlsFree(itlsRecursion);
- TlsFree(itlsPopupHook);
- break;
- }
+ case DLL_PROCESS_ATTACH:
+ hInst = hinstDLL;
+ if (((itlsSettings = TlsAlloc()) == TLS_OUT_OF_INDEXES) ||
+ ((itlsRecursion = TlsAlloc()) == TLS_OUT_OF_INDEXES))
+ return FALSE;
+ break;
+
+ case DLL_PROCESS_DETACH:
+ TlsFree(itlsSettings);
+ TlsFree(itlsRecursion);
+ break;
+ }
return TRUE;
}
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 7bd814a802..6ca82693f0 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -24,7 +24,6 @@ #include "db.h"
#include "notifications.h"
#include "options.h"
-#include "popups.h"
static const LPCTSTR JABBER_IQID = _T("mir_");
static const LPCTSTR JABBER_IQID_FORMAT = _T("mir_%d");
@@ -417,7 +416,6 @@ int AccListChanged(WPARAM wParam, LPARAM lParam) int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
RenewPseudocontactHandles();
- DetectPopupModule();
int count;
PROTOACCOUNT **protos;
diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp index 0f04ae8d5c..23e571c206 100644 --- a/protocols/GTalkExt/src/menu.cpp +++ b/protocols/GTalkExt/src/menu.cpp @@ -34,7 +34,7 @@ HANDLE hOnPrebuildMenu = 0; INT_PTR OpenMailboxMenuHandler(WPARAM wParam, LPARAM lParam)
{
- if (DBGetContactSettingByte((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
+ if (db_get_b((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
OpenContactInbox((HANDLE)wParam);
return 0;
}
@@ -43,7 +43,7 @@ int OnPrebuildMenu(WPARAM wParam, LPARAM lParam) {
CLISTMENUITEM cmi = { sizeof(cmi) };
cmi.flags = CMIM_FLAGS;
- if (!DBGetContactSettingByte((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
+ if (!db_get_b((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
cmi.flags |= CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hOpenMailboxMenuItem, (LPARAM)&cmi);
return 0;
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index e9252aad7a..d20dd09360 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -49,7 +49,6 @@ struct POPUP_DATA_HEADER { };
extern DWORD itlsSettings;
-BOOL isOriginalPopups = FALSE;
LRESULT CALLBACK WndProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -105,7 +104,7 @@ void MarkEventRead(HANDLE hCnt, HANDLE hEvt) int OnEventDeleted(WPARAM hContact, LPARAM hDbEvent, LPARAM wnd)
{
- if (DBGetContactSettingByte((HANDLE)hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
+ if (db_get_b((HANDLE)hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
CallService(MS_CLIST_REMOVEEVENT, hContact, hDbEvent);
PostMessage((HWND)wnd, EVENT_DELETED_MSG, hContact, hDbEvent);
}
@@ -117,15 +116,16 @@ LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) {
if (EVENT_DELETED_MSG == msg) {
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd);
- if ((HANDLE)lParam == ppdh->hDbEvent) ppdh->hDbEvent = NULL;
+ if ((HANDLE)lParam == ppdh->hDbEvent)
+ ppdh->hDbEvent = NULL;
return 0;
}
- else
- if (MESSAGE_CLOSEPOPUP == msg) {
- POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd);
- ppdh->MarkRead = TRUE;
- PUDeletePopUp(wnd);
- }
+
+ if (MESSAGE_CLOSEPOPUP == msg) {
+ POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd);
+ ppdh->MarkRead = TRUE;
+ PUDeletePopUp(wnd);
+ }
switch (msg) {
case UM_INITPOPUP: {
@@ -219,7 +219,7 @@ void FormatPseudocontactDisplayName(LPTSTR buff, LPCTSTR jid, LPCTSTR unreadCoun HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName)
{
HANDLE result = (HANDLE)DBGetContactSettingDword(0, acc, PSEUDOCONTACT_LINK, 0);
- if (!result || !DBGetContactSettingByte(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
+ if (!result || !db_get_b(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
result = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
DBWriteContactSettingDword(0, acc, PSEUDOCONTACT_LINK, (DWORD)result);
DBWriteContactSettingByte(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 1);
@@ -319,7 +319,7 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP memcpy(ppdh->url, url, lurl);
HWND code = DoAddPopup(data);
- if ((code == (HWND)-1) || (isOriginalPopups && !code))
+ if (code == (HWND)-1 || !code)
return;
data->PluginData = NULL; // freed in popup wndproc
}
@@ -367,7 +367,7 @@ void ClearNotificationContactHistory(LPCSTR acc) {
HANDLE hEvent = 0;
HANDLE hContact = (HANDLE)DBGetContactSettingDword(0, acc, PSEUDOCONTACT_LINK, 0);
- if (hContact && DBGetContactSettingByte(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
+ if (hContact && db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
while ((hEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0)) &&
!CallService(MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)hEvent)) {};
}
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index 7f9291cd8f..6febd4892a 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -51,7 +51,6 @@ void CheckControlsEnabled(HWND wnd) BOOL CListEnabled = (SendMessage(GetDlgItem(wnd, IDC_PSEUDOCONTACTENABLED), BM_GETSTATE, 0, 0) & BST_CHECKED) == BST_CHECKED;
EnableWindow(GetDlgItem(wnd, IDC_CLEARPSEUDOCONTACTLOG), CListEnabled);
- EnableWindow(GetDlgItem(wnd, IDC_SUPRESSFOREIGN), CListEnabled);
EnableWindow(GetDlgItem(wnd, IDC_MARKEVENTREAD), PopupsEnabled && CListEnabled);
EnableWindow(GetDlgItem(wnd, IDC_ADDSNIP), PopupsEnabled || CListEnabled);
@@ -77,7 +76,6 @@ DWORD ReadCheckboxes(HWND wnd, LPCSTR mod) ReadCheckbox(wnd, IDC_PSEUDOCONTACTENABLED, controls);
ReadCheckbox(wnd, IDC_CLEARPSEUDOCONTACTLOG, controls);
ReadCheckbox(wnd, IDC_POPUPSINFULLSCREEN, controls);
- ReadCheckbox(wnd, IDC_SUPRESSFOREIGN, controls);
ReadCheckbox(wnd, IDC_MARKEVENTREAD, controls);
ReadCheckbox(wnd, IDC_AUTHONMAILBOX, controls);
ReadCheckbox(wnd, IDC_ADDSNIP, controls);
@@ -100,7 +98,6 @@ void SaveControls(HWND wnd, LPCSTR mod) GetCheckboxSaveValue(wnd, IDC_POPUPSINFULLSCREEN) |
GetCheckboxSaveValue(wnd, IDC_POPUPSENABLED) |
GetCheckboxSaveValue(wnd, IDC_PSEUDOCONTACTENABLED) |
- GetCheckboxSaveValue(wnd, IDC_SUPRESSFOREIGN) |
GetCheckboxSaveValue(wnd, IDC_MARKEVENTREAD) |
GetCheckboxSaveValue(wnd, IDC_AUTHONMAILBOX) |
GetCheckboxSaveValue(wnd, IDC_ADDSNIP) |
@@ -135,7 +132,6 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa case IDC_CLEARPSEUDOCONTACTLOG:
case IDC_POPUPSINFULLSCREEN:
- case IDC_SUPRESSFOREIGN:
case IDC_MARKEVENTREAD:
case IDC_AUTHONMAILBOX:
case IDC_ADDSNIP:
diff --git a/protocols/GTalkExt/src/popups.cpp b/protocols/GTalkExt/src/popups.cpp deleted file mode 100644 index 0f0b6c2d04..0000000000 --- a/protocols/GTalkExt/src/popups.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//***************************************************************************************
-//
-// Google Extension plugin for the Miranda IM's Jabber protocol
-// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru)
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-//***************************************************************************************
-
-#include "stdafx.h"
-#include "popups.h"
-#include "options.h"
-
-static const LPTSTR YAPP_WND_CLASS1 = _T("YAPPYAPPWindowClass");
-static const LPTSTR YAPP_WND_CLASS2 = _T("YAPPWinClass");
-
-extern BOOL isOriginalPopups;
-
-LRESULT CALLBACK PopupHookProc(int nCode, WPARAM wParam, LPARAM lParam)
-{
- PCWPRETSTRUCT cs = (PCWPRETSTRUCT)lParam;
- if ((HC_ACTION == nCode) &&
- (WM_CREATE == cs->message) &&
- (-1 != cs->lResult) &&
- ServiceExists(MS_POPUP_GETCONTACT)) {
-
- // with YAPP we can't call MS_POPUP_GETCONTACT on a random window
- TCHAR ClassName[32];
- GetClassName(cs->hwnd, ClassName, sizeof(ClassName) / sizeof(TCHAR));
- if (isOriginalPopups ||
- !lstrcmp(YAPP_WND_CLASS1, ClassName) ||
- !lstrcmp(YAPP_WND_CLASS2, ClassName)) {
-
- HANDLE hContact = (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)cs->hwnd, 0);
- if (hContact != (HANDLE)-1 &&
- hContact != (HANDLE)0x80000000 &&
- DBGetContactSettingByte(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
- LPCSTR proto = (LPCSTR)GetContactProto(hContact);
- DWORD checkboxes = ReadCheckboxes(0, proto);
- if (ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, checkboxes) &&
- ReadCheckbox(0, IDC_SUPRESSFOREIGN, checkboxes))
- PostMessage(cs->hwnd, WM_CLOSE, 0, 0);
- }
- }
- }
- return CallNextHookEx(0, nCode, wParam, lParam);
-}
-
-typedef PLUGININFOEX* (MIRANDAPLUGININFOEX) (DWORD mirandaVersion);
-
-static GUID POPUP_GUID1 = {0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x54}};
-static GUID POPUP_GUID2 = {0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x53}};
-
-DWORD g_mirandaVersion = 0;
-
-BOOL IsOriginalPopupModule(HMODULE hMod)
-{
- MIRANDAPLUGININFOEX *MirandaPluginInfoEx = (MIRANDAPLUGININFOEX*)GetProcAddress(hMod, "MirandaPluginInfoEx");
- if (!MirandaPluginInfoEx) return FALSE;
-
- PLUGININFOEX *PluginInfoEx = MirandaPluginInfoEx(g_mirandaVersion);
- if (!PluginInfoEx) return FALSE;
-
- GUID *guid1 = (GUID*)&PluginInfoEx->uuid;
- GUID *guid2 = (GUID*)&POPUP_GUID1;
- GUID *guid3 = (GUID*)&POPUP_GUID2;
- return (IsEqualGUID(*guid1, *guid2) || IsEqualGUID(*guid1, *guid3));
-}
-
-extern BOOL isOriginalPopups;
-
-void DetectPopupModule()
-{
- DWORD bytesNeeded;
- if (!EnumProcessModules(GetCurrentProcess(), NULL, 0, &bytesNeeded))
- return;
-
- HMODULE *mods = (HMODULE*)malloc(bytesNeeded);
- __try {
- if (!EnumProcessModules(GetCurrentProcess(), mods, bytesNeeded, &bytesNeeded))
- return;
-
- for (DWORD i = 0; i < (bytesNeeded / sizeof(HMODULE)); i++)
- if (IsOriginalPopupModule(mods[i])) {
- isOriginalPopups = TRUE;
- break;
- }
- }
- __finally {
- free(mods);
- }
-}
diff --git a/protocols/GTalkExt/src/popups.h b/protocols/GTalkExt/src/popups.h deleted file mode 100644 index f9e142e0e6..0000000000 --- a/protocols/GTalkExt/src/popups.h +++ /dev/null @@ -1,25 +0,0 @@ -//***************************************************************************************
-//
-// Google Extension plugin for the Miranda IM's Jabber protocol
-// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru)
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-//***************************************************************************************
-
-#pragma once
-
-LRESULT CALLBACK PopupHookProc(int nCode, WPARAM wParam, LPARAM lParam);
-void DetectPopupModule();
\ No newline at end of file diff --git a/protocols/GTalkExt/src/resources.h b/protocols/GTalkExt/src/resources.h index d72e34dcef..547a3c7ee2 100644 --- a/protocols/GTalkExt/src/resources.h +++ b/protocols/GTalkExt/src/resources.h @@ -30,7 +30,6 @@ #define IDC_PSEUDOCONTACTENABLED IDC_BASE + 1
#define IDC_CLEARPSEUDOCONTACTLOG IDC_BASE + 2
#define IDC_POPUPSINFULLSCREEN IDC_BASE + 3
-#define IDC_SUPRESSFOREIGN IDC_BASE + 4
#define IDC_MARKEVENTREAD IDC_BASE + 5
#define IDC_AUTHONMAILBOX IDC_BASE + 6
#define IDC_ADDSNIP IDC_BASE + 7
|