summaryrefslogtreecommitdiff
path: root/plugins/IgnoreState/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/IgnoreState/src')
-rw-r--r--plugins/IgnoreState/src/commonheaders.h3
-rw-r--r--plugins/IgnoreState/src/main.cpp48
-rw-r--r--plugins/IgnoreState/src/options.cpp98
3 files changed, 75 insertions, 74 deletions
diff --git a/plugins/IgnoreState/src/commonheaders.h b/plugins/IgnoreState/src/commonheaders.h
index 1701e21a03..5367d0828e 100644
--- a/plugins/IgnoreState/src/commonheaders.h
+++ b/plugins/IgnoreState/src/commonheaders.h
@@ -1,4 +1,5 @@
/*
+
IgnoreState plugin for Miranda-IM (www.miranda-im.org)
(c) 2010 by Kildor
@@ -16,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ */
#ifndef COMMHEADERS_H
#define COMMHEADERS_H
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp
index e88d4aa31b..bcceb62910 100644
--- a/plugins/IgnoreState/src/main.cpp
+++ b/plugins/IgnoreState/src/main.cpp
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ */
#include "commonheaders.h"
@@ -33,21 +33,21 @@ INT currentFilter = 0;
INT clistIcon = 0; //Icon slot to use
IGNOREITEMS ii[] = {
- { LPGENT("All"), IGNOREEVENT_ALL, SKINICON_OTHER_FILLEDBLOB },
- { LPGENT("Messages"), IGNOREEVENT_MESSAGE, SKINICON_EVENT_MESSAGE },
- { LPGENT("URL"), IGNOREEVENT_URL, SKINICON_EVENT_URL },
- { LPGENT("Files"), IGNOREEVENT_FILE, SKINICON_EVENT_FILE },
- { LPGENT("User Online"), IGNOREEVENT_USERONLINE, SKINICON_OTHER_USERONLINE },
- { LPGENT("Authorization"), IGNOREEVENT_AUTHORIZATION, SKINICON_OTHER_MIRANDA },
- { LPGENT("You Were Added"), IGNOREEVENT_YOUWEREADDED, SKINICON_OTHER_ADDCONTACT },
- { LPGENT("Typing Notify"), IGNOREEVENT_TYPINGNOTIFY, SKINICON_OTHER_TYPING }
+ { LPGENT("All"), IGNOREEVENT_ALL, SKINICON_OTHER_FILLEDBLOB },
+ { LPGENT("Messages"), IGNOREEVENT_MESSAGE, SKINICON_EVENT_MESSAGE },
+ { LPGENT("URL"), IGNOREEVENT_URL, SKINICON_EVENT_URL },
+ { LPGENT("Files"), IGNOREEVENT_FILE, SKINICON_EVENT_FILE },
+ { LPGENT("User Online"), IGNOREEVENT_USERONLINE, SKINICON_OTHER_USERONLINE },
+ { LPGENT("Authorization"), IGNOREEVENT_AUTHORIZATION, SKINICON_OTHER_MIRANDA },
+ { LPGENT("You Were Added"), IGNOREEVENT_YOUWEREADDED, SKINICON_OTHER_ADDCONTACT },
+ { LPGENT("Typing Notify"), IGNOREEVENT_TYPINGNOTIFY, SKINICON_OTHER_TYPING }
};
int nII = SIZEOF(ii);
/////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo={
+PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -58,16 +58,16 @@ PLUGININFOEX pluginInfo={
__AUTHORWEB,
UNICODE_AWARE,
// A6872BCD-F2A1-41B8-B2F1-DD7CEC055734
- {0xa6872bcd, 0xf2a1, 0x41b8, {0xb2, 0xf1, 0xdd, 0x7c, 0xec, 0x05, 0x57, 0x34}}
+ { 0xa6872bcd, 0xf2a1, 0x41b8, { 0xb2, 0xf1, 0xdd, 0x7c, 0xec, 0x05, 0x57, 0x34 } }
};
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
- g_hInst = hinstDLL;
- return TRUE;
+ g_hInst = hinstDLL;
+ return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -76,7 +76,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
inline BOOL checkState(int type)
{
- return ((currentFilter>>(type-1))&1);
+ return ((currentFilter >> (type - 1)) & 1);
}
INT_PTR isIgnored(MCONTACT hContact, int type)
@@ -90,7 +90,7 @@ INT_PTR isIgnored(MCONTACT hContact, int type)
if (isIgnored(hContact, ii[i].type))
ii[i].filtered ? filtered++ : all++;
- return (all+filtered == SIZEOF(ii)-1) ? 1 : (all > 0 ? -1 : 0) ;
+ return (all + filtered == SIZEOF(ii) - 1) ? 1 : (all > 0 ? -1 : 0);
}
void applyExtraImage(MCONTACT hContact)
@@ -110,7 +110,7 @@ void applyExtraImage(MCONTACT hContact)
static IconItem iconList[] =
{
- { LPGEN("Full Ignore"), "ignore_full", IDI_IFULL },
+ { LPGEN("Full Ignore"), "ignore_full", IDI_IFULL },
{ LPGEN("Partial Ignore"), "ignore_part", IDI_IPART },
{ LPGEN("Message Ignore"), "ignore_mess", IDI_IMESS },
};
@@ -121,15 +121,15 @@ VOID fill_filter(void)
currentFilter = bUseMirandaSettings ? db_get_dw(NULL, "Ignore", "Default1", 0) : db_get_dw(NULL, MODULENAME, "Filter", 0x8);
- for (int i=0; i < SIZEOF(ii); i++) {
+ for (int i = 0; i < SIZEOF(ii); i++) {
if (checkState((ii[i].type)))
- ii[i].filtered = true;
+ ii[i].filtered = true;
else
- ii[i].filtered = false;
+ ii[i].filtered = false;
}
}
-int onModulesLoaded(WPARAM wParam,LPARAM lParam)
+int onModulesLoaded(WPARAM, LPARAM)
{
HookEvent(ME_OPT_INITIALISE, onOptInitialise);
@@ -146,10 +146,10 @@ int onContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
- if ( !mir_strcmp(cws->szModule, "Ignore") && !mir_strcmp(cws->szSetting, "Mask1"))
+ if (!mir_strcmp(cws->szModule, "Ignore") && !mir_strcmp(cws->szSetting, "Mask1"))
applyExtraImage(hContact);
else if (hContact == 0) {
- if (( !mir_strcmp(cws->szModule, MODULENAME) && !mir_strcmp(cws->szSetting, "Filter")) ||
+ if ((!mir_strcmp(cws->szModule, MODULENAME) && !mir_strcmp(cws->szSetting, "Filter")) ||
(bUseMirandaSettings && !mir_strcmp(cws->szModule, "Ignore") && !mir_strcmp(cws->szSetting, "Default1")))
{
fill_filter();
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp
index 1dee050760..c928736353 100644
--- a/plugins/IgnoreState/src/options.cpp
+++ b/plugins/IgnoreState/src/options.cpp
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ */
#include "commonheaders.h"
@@ -26,44 +26,44 @@ static bool bInitializing;
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- HWND hTree=GetDlgItem(hwndDlg,IDC_FILTER);
+ HWND hTree = GetDlgItem(hwndDlg, IDC_FILTER);
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- bInitializing = true;
- fill_filter();
-
- SetWindowLongPtr(hTree,GWL_STYLE,GetWindowLongPtr(hTree,GWL_STYLE)|TVS_NOHSCROLL);
-
- HIMAGELIST himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,2,2);
- TreeView_SetImageList(hTree,himlButtonIcons,TVSIL_NORMAL);
- TreeView_DeleteAllItems(hTree);
-
- for (int i=2; i < nII; i++) { // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
- TVINSERTSTRUCT tvis={0};
- int index = ImageList_AddIcon(himlButtonIcons, LoadSkinnedIcon(ii[i].icon));
- tvis.hParent=NULL;
- tvis.hInsertAfter=TVI_LAST;
- tvis.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_STATE;
- tvis.item.lParam=(LPARAM)(ii[i].type);
- tvis.item.pszText=TranslateTS(ii[i].name);
- tvis.item.iImage=tvis.item.iSelectedImage=index;
- HTREEITEM hti = TreeView_InsertItem(hTree,&tvis);
- TreeView_SetCheckState(hTree, hti, checkState(ii[i].type));
- }
-
- CheckDlgButton(hwndDlg, IDC_IGNORE_IGNOREALL, bUseMirandaSettings ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !bUseMirandaSettings);
- bInitializing = false;
+ {
+ TranslateDialogDefault(hwndDlg);
+ bInitializing = true;
+ fill_filter();
+
+ SetWindowLongPtr(hTree, GWL_STYLE, GetWindowLongPtr(hTree, GWL_STYLE) | TVS_NOHSCROLL);
+
+ HIMAGELIST himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
+ TreeView_SetImageList(hTree, himlButtonIcons, TVSIL_NORMAL);
+ TreeView_DeleteAllItems(hTree);
+
+ for (int i = 2; i < nII; i++) { // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
+ TVINSERTSTRUCT tvis = { 0 };
+ int index = ImageList_AddIcon(himlButtonIcons, LoadSkinnedIcon(ii[i].icon));
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
+ tvis.item.lParam = (LPARAM)(ii[i].type);
+ tvis.item.pszText = TranslateTS(ii[i].name);
+ tvis.item.iImage = tvis.item.iSelectedImage = index;
+ HTREEITEM hti = TreeView_InsertItem(hTree, &tvis);
+ TreeView_SetCheckState(hTree, hti, checkState(ii[i].type));
}
- return TRUE;
+
+ CheckDlgButton(hwndDlg, IDC_IGNORE_IGNOREALL, bUseMirandaSettings ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !bUseMirandaSettings);
+ bInitializing = false;
+ }
+ return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_IGNORE_IGNOREALL:
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
@@ -74,24 +74,24 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- DWORD flags=0;
- TVITEM tvi;
- tvi.mask=TVIF_HANDLE|TBIF_LPARAM;
- HWND hTree=GetDlgItem(hwndDlg,IDC_FILTER);
- tvi.hItem=TreeView_GetRoot(hTree); //check ignore all
- while(tvi.hItem) {
- TreeView_GetItem(hTree,&tvi);
- if(TreeView_GetCheckState(hTree,tvi.hItem)) flags|=1<<(tvi.lParam-1);
- tvi.hItem=TreeView_GetNextSibling(hTree,tvi.hItem);
- }
- db_set_dw(NULL, MODULENAME, "Filter", flags);
-
- bUseMirandaSettings = IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL) ? 1 : 0;
- db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
-
- fill_filter();
+ {
+ DWORD flags = 0;
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE | TBIF_LPARAM;
+ HWND hTree = GetDlgItem(hwndDlg, IDC_FILTER);
+ tvi.hItem = TreeView_GetRoot(hTree); //check ignore all
+ while (tvi.hItem) {
+ TreeView_GetItem(hTree, &tvi);
+ if (TreeView_GetCheckState(hTree, tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
+ tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
}
+ db_set_dw(NULL, MODULENAME, "Filter", flags);
+
+ bUseMirandaSettings = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL) ? 1 : 0;
+ db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
+
+ fill_filter();
+ }
}
case IDC_FILTER:
if (((LPNMHDR)lParam)->code == NM_CLICK)
@@ -102,7 +102,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return FALSE;
}
-int onOptInitialise(WPARAM wParam, LPARAM lParam)
+int onOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = g_hInst;