diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-04-05 19:30:17 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-04-05 19:30:17 +0300 |
commit | d7730685516d6ed6fc278a6ea74f7a5cf12e0042 (patch) | |
tree | 41a381fbe4051ed4b9041f5596913b6c174cf9be /extraimg.c | |
parent | 7fd9fe181150f166a098eaf4e006f878c28cb770 (diff) |
dos2unixspamfilter
Diffstat (limited to 'extraimg.c')
-rw-r--r-- | extraimg.c | 234 |
1 files changed, 117 insertions, 117 deletions
@@ -1,118 +1,118 @@ -/*
-
-"Spam Filter"-Plugin for Miranda IM
-
-Copyright 2003-2006 Heiko Herkenrath
-
-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 ("SpamFilter-License.txt"); if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-
-// -- Includes
-#include "common.h"
-
-// -- Variables: Events/Services
-HANDLE hHookExtraListRebuild = NULL;
-HANDLE hHookExtraImageApply = NULL;
-HANDLE hHookDbSettingChanged = NULL;
-
-// -- Variables
-HANDLE hSpammerImage;
-
-
-// -----------------------------------------
-
-
-void SetSpammerIcon(HANDLE hContact, BOOL bShow)
-{
- IconExtraColumn iec;
-
- ZeroMemory(&iec, sizeof(iec));
- iec.cbSize = sizeof(iec);
- iec.ColumnType = EXTRA_ICON_ADV2;
- iec.hImage = bShow?hSpammerImage:INVALID_HANDLE_VALUE;
-
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
-}
-
-
-static int ExtraImageApply(WPARAM wParam, LPARAM lParam)
-{
- // Assign extra icon to contact
- if (DBGetContactSettingByte((HANDLE)wParam, DB_MODULE_NAME, DB_SETTING_ISSPAMMER, (BYTE)FALSE))
- SetSpammerIcon((HANDLE)wParam, TRUE);
-
- return 0;
-}
-
-
-static int ExtraImageListRebuild(WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact;
-
- // Add spam icon to image list of clist extra images
- hSpammerImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)SkinGetIcon(DB_ICON_ISSPAMMER_SETTING, IDI_DEFAULT, FALSE), 0);
-
- // Update spammer icons for all contacts in list
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
- ExtraImageApply(wParam, lParam);
-
- return 0;
-}
-
-
-static int DbSettingChanged(WPARAM wParam, LPARAM lParam)
-{
- DBCONTACTWRITESETTING* pdcws = (DBCONTACTWRITESETTING*)lParam;
-
- // Watch DB_SETTING_ISSPAMMER to be in sync with spammer icon
- if (StrCmpA(pdcws->szModule, DB_MODULE_NAME) == 0)
- if (StrCmpA(pdcws->szSetting, DB_SETTING_ISSPAMMER) == 0)
- {
- BOOL bIsSpammer = (pdcws->value.type==DBVT_DELETED) ? FALSE : (pdcws->value.bVal?TRUE:FALSE);
- SetSpammerIcon((HANDLE)wParam, bIsSpammer);
- NotifySpammerStateChanged((HANDLE)wParam, bIsSpammer);
-
- if (IsWindow(hwndSpammersInfo))
- PostMessage(hwndSpammersInfo, SFM_REFRESH_SPAMMERS, 0, 0);
- }
-
- return 0;
-}
-
-
-// ------------------------------------
-
-
-void InitExtraImg(void)
-{
- // Enable CList extra image support (in clist clones)
- if (ServiceExists(MS_CLIST_EXTRA_SET_ICON) && ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- SkinAddNewIcon(DB_ICON_ISSPAMMER_SETTING, TranslateT("Spam Filter"), TranslateT("Spammer Indicator"), IDI_DEFAULT, FALSE);
-
- hHookExtraListRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ExtraImageListRebuild);
- hHookExtraImageApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, ExtraImageApply);
- hHookDbSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged);
- }
-}
-
-
-void UninitExtraImg(void)
-{
- if (hHookExtraListRebuild) UnhookEvent(hHookExtraListRebuild);
- if (hHookExtraImageApply) UnhookEvent(hHookExtraImageApply);
- if (hHookDbSettingChanged) UnhookEvent(hHookDbSettingChanged);
+/* + +"Spam Filter"-Plugin for Miranda IM + +Copyright 2003-2006 Heiko Herkenrath + +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 ("SpamFilter-License.txt"); if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +// -- Includes +#include "common.h" + +// -- Variables: Events/Services +HANDLE hHookExtraListRebuild = NULL; +HANDLE hHookExtraImageApply = NULL; +HANDLE hHookDbSettingChanged = NULL; + +// -- Variables +HANDLE hSpammerImage; + + +// ----------------------------------------- + + +void SetSpammerIcon(HANDLE hContact, BOOL bShow) +{ + IconExtraColumn iec; + + ZeroMemory(&iec, sizeof(iec)); + iec.cbSize = sizeof(iec); + iec.ColumnType = EXTRA_ICON_ADV2; + iec.hImage = bShow?hSpammerImage:INVALID_HANDLE_VALUE; + + CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec); +} + + +static int ExtraImageApply(WPARAM wParam, LPARAM lParam) +{ + // Assign extra icon to contact + if (DBGetContactSettingByte((HANDLE)wParam, DB_MODULE_NAME, DB_SETTING_ISSPAMMER, (BYTE)FALSE)) + SetSpammerIcon((HANDLE)wParam, TRUE); + + return 0; +} + + +static int ExtraImageListRebuild(WPARAM wParam, LPARAM lParam) +{ + HANDLE hContact; + + // Add spam icon to image list of clist extra images + hSpammerImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)SkinGetIcon(DB_ICON_ISSPAMMER_SETTING, IDI_DEFAULT, FALSE), 0); + + // Update spammer icons for all contacts in list + for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) + ExtraImageApply(wParam, lParam); + + return 0; +} + + +static int DbSettingChanged(WPARAM wParam, LPARAM lParam) +{ + DBCONTACTWRITESETTING* pdcws = (DBCONTACTWRITESETTING*)lParam; + + // Watch DB_SETTING_ISSPAMMER to be in sync with spammer icon + if (StrCmpA(pdcws->szModule, DB_MODULE_NAME) == 0) + if (StrCmpA(pdcws->szSetting, DB_SETTING_ISSPAMMER) == 0) + { + BOOL bIsSpammer = (pdcws->value.type==DBVT_DELETED) ? FALSE : (pdcws->value.bVal?TRUE:FALSE); + SetSpammerIcon((HANDLE)wParam, bIsSpammer); + NotifySpammerStateChanged((HANDLE)wParam, bIsSpammer); + + if (IsWindow(hwndSpammersInfo)) + PostMessage(hwndSpammersInfo, SFM_REFRESH_SPAMMERS, 0, 0); + } + + return 0; +} + + +// ------------------------------------ + + +void InitExtraImg(void) +{ + // Enable CList extra image support (in clist clones) + if (ServiceExists(MS_CLIST_EXTRA_SET_ICON) && ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) + { + SkinAddNewIcon(DB_ICON_ISSPAMMER_SETTING, TranslateT("Spam Filter"), TranslateT("Spammer Indicator"), IDI_DEFAULT, FALSE); + + hHookExtraListRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ExtraImageListRebuild); + hHookExtraImageApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, ExtraImageApply); + hHookDbSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged); + } +} + + +void UninitExtraImg(void) +{ + if (hHookExtraListRebuild) UnhookEvent(hHookExtraListRebuild); + if (hHookExtraImageApply) UnhookEvent(hHookExtraImageApply); + if (hHookDbSettingChanged) UnhookEvent(hHookDbSettingChanged); }
\ No newline at end of file |