diff options
-rw-r--r-- | plugins/StopSpamPlus/src/eventhooker.cpp | 14 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/events.cpp | 12 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/opt_proto.cpp | 113 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/options.cpp | 180 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/services.cpp | 29 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/settings.cpp | 6 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/stopspam.cpp | 14 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/utils.cpp | 16 | ||||
-rw-r--r-- | plugins/StopSpamPlus/stopspam_12.vcxproj | 8 |
9 files changed, 197 insertions, 195 deletions
diff --git a/plugins/StopSpamPlus/src/eventhooker.cpp b/plugins/StopSpamPlus/src/eventhooker.cpp index 56493eaa76..a7ddd04d3f 100644 --- a/plugins/StopSpamPlus/src/eventhooker.cpp +++ b/plugins/StopSpamPlus/src/eventhooker.cpp @@ -1,16 +1,16 @@ -/* eventhooker.cpp
+/* eventhooker.cpp
* Copyright (C) Miklashevsky Roman
*
* 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.
@@ -25,7 +25,7 @@ namespace miranda std::list<EventHooker*> eventHookerList;
}
- EventHooker::EventHooker(std::string name, MIRANDAHOOK fun) : name_(name), fun_(fun), handle_(0)
+ EventHooker::EventHooker(std::string name, MIRANDAHOOK fun) : name_(name), fun_(fun), handle_(0)
{
eventHookerList.push_back(this);
}
@@ -35,7 +35,7 @@ namespace miranda eventHookerList.remove(this);
}
- void EventHooker::Hook()
+ void EventHooker::Hook()
{
handle_ = HookEvent(name_.c_str(), fun_);
}
@@ -51,7 +51,7 @@ namespace miranda void EventHooker::HookAll()
{
- for(std::list<EventHooker*>::iterator it = eventHookerList.begin(); it != eventHookerList.end(); ++it)
+ for (std::list<EventHooker*>::iterator it = eventHookerList.begin(); it != eventHookerList.end(); ++it)
{
(*it)->Hook();
}
@@ -59,7 +59,7 @@ namespace miranda void EventHooker::UnhookAll()
{
- for(std::list<EventHooker*>::iterator it = eventHookerList.begin(); it != eventHookerList.end(); ++it)
+ for (std::list<EventHooker*>::iterator it = eventHookerList.begin(); it != eventHookerList.end(); ++it)
{
(*it)->Unhook();
}
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index a7af0917a4..58845a2ce1 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -4,7 +4,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) {
MEVENT hDbEvent = (MEVENT)lParam;
- DBEVENTINFO dbei = {0};
+ DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (-1 == dbei.cbBlob)
@@ -59,7 +59,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) return 0;
// if event is not a message, or if the message has been read or sent...
- if (dbei->flags & DBEF_SENT || dbei->flags & DBEF_READ || dbei->eventType != EVENTTYPE_MESSAGE )
+ if (dbei->flags & DBEF_SENT || dbei->flags & DBEF_READ || dbei->eventType != EVENTTYPE_MESSAGE)
// ...let the event go its way
return 0;
@@ -85,7 +85,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) tstring message;
if (dbei->flags & DBEF_UTF){
- WCHAR* msg_u=mir_utf8decodeW((char*)dbei->pBlob);
+ WCHAR* msg_u = mir_utf8decodeW((char*)dbei->pBlob);
message = msg_u;
mir_free(msg_u);
}
@@ -100,7 +100,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) answers.append(plSets->AnswSplitString.Get());
tstring::size_type pos = 0;
tstring::size_type prev_pos = 0;
- while((pos = answers.find(plSets->AnswSplitString.Get(), pos)) != tstring::npos) {
+ while ((pos = answers.find(plSets->AnswSplitString.Get(), pos)) != tstring::npos) {
// get one of answers and trim witespace chars
tstring answer = trim(answers.substr(prev_pos, pos - prev_pos));
// if answer not empty
@@ -119,7 +119,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // send congratulation
- char * buf=mir_utf8encodeW(variables_parse(plSets->Congratulation.Get(), hContact).c_str());
+ char * buf = mir_utf8encodeW(variables_parse(plSets->Congratulation.Get(), hContact).c_str());
CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
mir_free(buf);
@@ -139,7 +139,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) tstring q = infTalkProtPrefix + variables_parse((tstring)(plSets->Question), hContact);
- char * buf=mir_utf8encodeW(q.c_str());
+ char * buf = mir_utf8encodeW(q.c_str());
CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
mir_free(buf);
diff --git a/plugins/StopSpamPlus/src/opt_proto.cpp b/plugins/StopSpamPlus/src/opt_proto.cpp index 2b4d1d36dd..17e38c39ed 100644 --- a/plugins/StopSpamPlus/src/opt_proto.cpp +++ b/plugins/StopSpamPlus/src/opt_proto.cpp @@ -3,65 +3,65 @@ struct ProtocolData
{
char *RealName;
- int show,enabled;
+ int show, enabled;
};
int IsProtoIM(const PROTOACCOUNT *pa)
{
- return (CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM);
+ return !pa->bIsVirtual;
}
int FillTree(HWND hwnd)
{
ProtocolData *PD;
- int i,n;
+ int i, n;
PROTOACCOUNT** pa;
TVINSERTSTRUCT tvis;
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
TreeView_DeleteAllItems(hwnd);
if (CallService(MS_PROTO_ENUMACCOUNTS, (LPARAM)&n, (WPARAM)&pa))
return FALSE;
- for ( i = 0; i < n; i++ ) {
- if (IsAccountEnabled( pa[i] )) {
- PD = ( ProtocolData* )mir_alloc( sizeof( ProtocolData ));
+ for (i = 0; i < n; i++) {
+ if (IsAccountEnabled(pa[i])) {
+ PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData));
PD->RealName = pa[i]->szModuleName;
- PD->enabled = IsProtoIM( pa[i]);
- PD->show = PD->enabled ? (plSets->ProtoDisabled(PD->RealName)?1:0) : 100;
+ PD->enabled = IsProtoIM(pa[i]);
+ PD->show = PD->enabled ? (plSets->ProtoDisabled(PD->RealName) ? 1 : 0) : 100;
- tvis.item.lParam = ( LPARAM )PD;
+ tvis.item.lParam = (LPARAM)PD;
tvis.item.pszText = pa[i]->tszAccountName;
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
- TreeView_InsertItem( hwnd, &tvis );
+ TreeView_InsertItem(hwnd, &tvis);
}
}
return 0;
}
-INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
{
- HWND hwndProto = GetDlgItem(hwnd, IDC_PROTO);
+ HWND hwndProto = GetDlgItem(hwnd, IDC_PROTO);
- switch (msg)
- {
+ switch (msg)
+ {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
SetWindowLongPtr(hwndProto, GWL_STYLE, GetWindowLongPtr(hwndProto, GWL_STYLE) | TVS_NOHSCROLL);
{
- HIMAGELIST himlCheckBoxes = ImageList_Create( GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), ILC_COLOR32|ILC_MASK, 2, 2 );
+ HIMAGELIST himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
HICON Icon;
- Icon=(HICON)LoadSkinnedIcon(SKINICON_OTHER_NOTICK);
+ Icon = (HICON)LoadSkinnedIcon(SKINICON_OTHER_NOTICK);
ImageList_AddIcon(himlCheckBoxes, Icon);
Skin_ReleaseIcon(Icon);
- Icon=(HICON)LoadSkinnedIcon(SKINICON_OTHER_TICK);
+ Icon = (HICON)LoadSkinnedIcon(SKINICON_OTHER_TICK);
ImageList_AddIcon(himlCheckBoxes, Icon);
Skin_ReleaseIcon(Icon);
@@ -72,62 +72,65 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return TRUE;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
-
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+
std::ostringstream out;
-
+
TVITEM tvi;
tvi.hItem = TreeView_GetRoot(hwndProto);
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
- while ( tvi.hItem != NULL ) {
+ while (tvi.hItem != NULL) {
TreeView_GetItem(hwndProto, &tvi);
- if (tvi.lParam!=0) {
- ProtocolData* ppd = ( ProtocolData* )tvi.lParam;
+ if (tvi.lParam != 0) {
+ ProtocolData* ppd = (ProtocolData*)tvi.lParam;
if (ppd->enabled && ppd->show)
out << ppd->RealName << " ";
}
- tvi.hItem = TreeView_GetNextSibling(hwndProto, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hwndProto, tvi.hItem);
}
- plSets->DisabledProtoList=out.str();
+ plSets->DisabledProtoList = out.str();
}
break;
case IDC_PROTO:
switch (((LPNMHDR)lParam)->code) {
- case TVN_DELETEITEMA:
- {
- NMTREEVIEWA * pnmtv = (NMTREEVIEWA *) lParam;
- if (pnmtv && pnmtv->itemOld.lParam)
- mir_free((ProtocolData*)pnmtv->itemOld.lParam);
- }
- break;
+ case TVN_DELETEITEMA:
+ {
+ NMTREEVIEWA * pnmtv = (NMTREEVIEWA *)lParam;
+ if (pnmtv && pnmtv->itemOld.lParam)
+ mir_free((ProtocolData*)pnmtv->itemOld.lParam);
+ }
+ break;
case NM_CLICK:
- {
- TVHITTESTINFO hti;
- hti.pt.x=(short)LOWORD(GetMessagePos());
- hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt);
- if ( TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti )) {
- if ( hti.flags & TVHT_ONITEMICON ) {
- TVITEMA tvi;
- tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
- tvi.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi);
-
- ProtocolData *pData = ( ProtocolData* )tvi.lParam;
- if ( pData->enabled ) {
- tvi.iImage = tvi.iSelectedImage = !tvi.iImage;
- pData->show = tvi.iImage;
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi);
- SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0);
- } } } } }
+ {
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
+ if (hti.flags & TVHT_ONITEMICON) {
+ TVITEMA tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvi.hItem = hti.hItem;
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+
+ ProtocolData *pData = (ProtocolData*)tvi.lParam;
+ if (pData->enabled) {
+ tvi.iImage = tvi.iSelectedImage = !tvi.iImage;
+ pData->show = tvi.iImage;
+ TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+ SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0);
+ }
+ }
+ } }
+ }
break;
}
break;
diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp index 063bf1d2bd..32c0b095f5 100644 --- a/plugins/StopSpamPlus/src/options.cpp +++ b/plugins/StopSpamPlus/src/options.cpp @@ -8,57 +8,57 @@ char const * questCountSetting = "QuestionCount"; INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
- {
- SetDlgItemText(hwnd, ID_DESCRIPTION, pluginDescription);
- TranslateDialogDefault(hwnd);
- SetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, plSets->MaxQuestCount.Get(), FALSE);
- CheckDlgButton(hwnd, ID_INFTALKPROT, plSets->InfTalkProtection.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_ADDPERMANENT, plSets->AddPermanent.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_HANDLEAUTHREQ, plSets->HandleAuthReq.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_NOTCASESENS, plSets->AnswNotCaseSens.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_REMOVE_TMP_ALL, plSets->RemTmpAll.Get() ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, ID_HISTORY_LOG, plSets->HistLog.Get() ? BST_CHECKED : BST_UNCHECKED);
- }
- return TRUE;
+ {
+ SetDlgItemText(hwnd, ID_DESCRIPTION, pluginDescription);
+ TranslateDialogDefault(hwnd);
+ SetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, plSets->MaxQuestCount.Get(), FALSE);
+ CheckDlgButton(hwnd, ID_INFTALKPROT, plSets->InfTalkProtection.Get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_ADDPERMANENT, plSets->AddPermanent.Get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_HANDLEAUTHREQ, plSets->HandleAuthReq.Get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_NOTCASESENS, plSets->AnswNotCaseSens.Get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_REMOVE_TMP_ALL, plSets->RemTmpAll.Get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, ID_HISTORY_LOG, plSets->HistLog.Get() ? BST_CHECKED : BST_UNCHECKED);
+ }
+ return TRUE;
case WM_COMMAND:{
switch (LOWORD(wParam))
{
case ID_MAXQUESTCOUNT:
- {
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return FALSE;
- break;
- }
- case ID_DESCRIPTION:
- {
+ {
+ if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
return FALSE;
- }
+ break;
+ }
+ case ID_DESCRIPTION:
+ {
+ return FALSE;
+ }
}
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
+ }
+ break;
case WM_NOTIFY:
+ {
+ NMHDR* nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code)
+ {
+ case PSN_APPLY:
{
- NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code)
- {
- case PSN_APPLY:
- {
- plSets->MaxQuestCount=GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, NULL, FALSE);
- plSets->InfTalkProtection=(BST_CHECKED == IsDlgButtonChecked(hwnd, ID_INFTALKPROT));
- plSets->AddPermanent=(BST_CHECKED == IsDlgButtonChecked(hwnd, ID_ADDPERMANENT));
- plSets->HandleAuthReq=(BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HANDLEAUTHREQ));
- plSets->AnswNotCaseSens=(BST_CHECKED == IsDlgButtonChecked(hwnd, ID_NOTCASESENS));
- plSets->RemTmpAll=(BST_CHECKED == IsDlgButtonChecked(hwnd, ID_REMOVE_TMP_ALL));
- plSets->HistLog=(BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HISTORY_LOG));
- }
- return TRUE;
- }
+ plSets->MaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, NULL, FALSE);
+ plSets->InfTalkProtection = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_INFTALKPROT));
+ plSets->AddPermanent = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_ADDPERMANENT));
+ plSets->HandleAuthReq = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HANDLEAUTHREQ));
+ plSets->AnswNotCaseSens = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_NOTCASESENS));
+ plSets->RemTmpAll = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_REMOVE_TMP_ALL));
+ plSets->HistLog = (BST_CHECKED == IsDlgButtonChecked(hwnd, ID_HISTORY_LOG));
+ }
+ return TRUE;
}
- break;
+ }
+ break;
}
return FALSE;
}
@@ -66,66 +66,66 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwnd);
- SetDlgItemString(hwnd, ID_QUESTION, plSets->Question.Get());
- SetDlgItemString(hwnd, ID_ANSWER, plSets->Answer.Get());
- SetDlgItemString(hwnd, ID_CONGRATULATION, plSets->Congratulation.Get());
- SetDlgItemString(hwnd, ID_AUTHREPL, plSets->AuthRepl.Get());
- SetDlgItemString(hwnd, ID_DIVIDER, plSets->AnswSplitString.Get());
- variables_skin_helpbutton(hwnd, IDC_VARS);
- ServiceExists(MS_VARS_FORMATSTRING)?EnableWindow(GetDlgItem(hwnd, IDC_VARS),1):EnableWindow(GetDlgItem(hwnd, IDC_VARS),0);
- }
- return TRUE;
+ {
+ TranslateDialogDefault(hwnd);
+ SetDlgItemString(hwnd, ID_QUESTION, plSets->Question.Get());
+ SetDlgItemString(hwnd, ID_ANSWER, plSets->Answer.Get());
+ SetDlgItemString(hwnd, ID_CONGRATULATION, plSets->Congratulation.Get());
+ SetDlgItemString(hwnd, ID_AUTHREPL, plSets->AuthRepl.Get());
+ SetDlgItemString(hwnd, ID_DIVIDER, plSets->AnswSplitString.Get());
+ variables_skin_helpbutton(hwnd, IDC_VARS);
+ ServiceExists(MS_VARS_FORMATSTRING) ? EnableWindow(GetDlgItem(hwnd, IDC_VARS), 1) : EnableWindow(GetDlgItem(hwnd, IDC_VARS), 0);
+ }
+ return TRUE;
case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
{
- switch(LOWORD(wParam))
- {
- case ID_QUESTION:
- case ID_ANSWER:
- case ID_AUTHREPL:
- case ID_CONGRATULATION:
- case ID_DIVIDER:
- {
- if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
- return FALSE;
- break;
- }
- case ID_RESTOREDEFAULTS:
- SetDlgItemString(hwnd, ID_QUESTION, plSets->Question.GetDefault());
- SetDlgItemString(hwnd, ID_ANSWER, plSets->Answer.GetDefault());
- SetDlgItemString(hwnd, ID_CONGRATULATION, plSets->Congratulation.GetDefault());
- SetDlgItemString(hwnd, ID_AUTHREPL, plSets->AuthRepl.GetDefault());
- SetDlgItemString(hwnd, ID_DIVIDER, plSets->AnswSplitString.GetDefault());
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- return TRUE;
- case IDC_VARS:
- variables_showhelp(hwnd, msg, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
- return TRUE;
- }
+ case ID_QUESTION:
+ case ID_ANSWER:
+ case ID_AUTHREPL:
+ case ID_CONGRATULATION:
+ case ID_DIVIDER:
+ {
+ if (EN_CHANGE != HIWORD(wParam) || (HWND)lParam != GetFocus())
+ return FALSE;
+ break;
+ }
+ case ID_RESTOREDEFAULTS:
+ SetDlgItemString(hwnd, ID_QUESTION, plSets->Question.GetDefault());
+ SetDlgItemString(hwnd, ID_ANSWER, plSets->Answer.GetDefault());
+ SetDlgItemString(hwnd, ID_CONGRATULATION, plSets->Congratulation.GetDefault());
+ SetDlgItemString(hwnd, ID_AUTHREPL, plSets->AuthRepl.GetDefault());
+ SetDlgItemString(hwnd, ID_DIVIDER, plSets->AnswSplitString.GetDefault());
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ return TRUE;
+ case IDC_VARS:
+ variables_showhelp(hwnd, msg, VHF_FULLDLG | VHF_SETLASTSUBJECT, NULL, NULL);
+ return TRUE;
}
- break;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ break;
case WM_NOTIFY:
+ {
+ NMHDR* nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code)
{
- NMHDR* nmhdr = (NMHDR*)lParam;
- switch (nmhdr->code)
- {
- case PSN_APPLY:
- {
- plSets->Question=GetDlgItemString(hwnd, ID_QUESTION);
- plSets->Answer=GetDlgItemString(hwnd, ID_ANSWER);
- plSets->AuthRepl=GetDlgItemString(hwnd, ID_AUTHREPL);
- plSets->Congratulation=GetDlgItemString(hwnd, ID_CONGRATULATION);
- plSets->AnswSplitString=GetDlgItemString(hwnd, ID_DIVIDER);
- }
- return TRUE;
- }
+ case PSN_APPLY:
+ {
+ plSets->Question = GetDlgItemString(hwnd, ID_QUESTION);
+ plSets->Answer = GetDlgItemString(hwnd, ID_ANSWER);
+ plSets->AuthRepl = GetDlgItemString(hwnd, ID_AUTHREPL);
+ plSets->Congratulation = GetDlgItemString(hwnd, ID_CONGRATULATION);
+ plSets->AnswSplitString = GetDlgItemString(hwnd, ID_DIVIDER);
+ }
+ return TRUE;
}
- break;
+ }
+ break;
}
return FALSE;
}
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 9e9145f2b6..63fc504c18 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -21,11 +21,11 @@ INT_PTR IsContactPassed(WPARAM hContact, LPARAM /*lParam*/) return CS_NOTPASSED;
}
-INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam)
+INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam)
{
- for (MCONTACT hContact = db_find_first(); hContact; ) {
+ for (MCONTACT hContact = db_find_first(); hContact;) {
MCONTACT hNext = db_find_next(hContact);
- ptrT szGroup( db_get_tsa( hContact, "CList", "Group"));
+ ptrT szGroup(db_get_tsa(hContact, "CList", "Group"));
if (db_get_b(hContact, "CList", "NotOnList", 0) || (szGroup != NULL && (_tcsstr(szGroup, _T("Not In List")) || _tcsstr(szGroup, TranslateT("Not In List"))))) {
char *szProto = GetContactProto(hContact);
@@ -36,43 +36,42 @@ INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam) int status = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (status == ID_STATUS_OFFLINE || IsStatusConnecting(status))
// Set a flag so we remember to delete the contact when the protocol goes online the next time
- db_set_b( hContact, "CList", "Delete", 1 );
+ db_set_b(hContact, "CList", "Delete", 1);
else
- CallService(MS_DB_CONTACT_DELETE, hContact, 0 );
+ CallService(MS_DB_CONTACT_DELETE, hContact, 0);
}
}
}
hContact = hNext;
}
-
+
int hGroup = 1;
char *group_name;
do {
group_name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0);
if (group_name != NULL && strstr(group_name, "Not In List")) {
BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
- if ( ConfirmDelete )
- db_set_b( NULL, "CList", "ConfirmDelete", 0 );
+ if (ConfirmDelete)
+ db_set_b(NULL, "CList", "ConfirmDelete", 0);
- CallService(MS_CLIST_GROUPDELETE, (WPARAM)hGroup, 0 );
- if ( ConfirmDelete )
- db_set_b( NULL, "CList", "ConfirmDelete", ConfirmDelete );
+ CallService(MS_CLIST_GROUPDELETE, (WPARAM)hGroup, 0);
+ if (ConfirmDelete)
+ db_set_b(NULL, "CList", "ConfirmDelete", ConfirmDelete);
break;
}
hGroup++;
- }
- while( group_name );
+ } while (group_name);
if (!lParam)
MessageBox(NULL, TranslateT("Complete"), TranslateT(pluginName), MB_ICONINFORMATION);
return 0;
}
-int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam)
+int OnSystemModulesLoaded(WPARAM, LPARAM)
{
UnhookEvent(hLoadHook);
if (plSets->RemTmpAll.Get())
- RemoveTempContacts(0,1);
+ RemoveTempContacts(0, 1);
return 0;
}
diff --git a/plugins/StopSpamPlus/src/settings.cpp b/plugins/StopSpamPlus/src/settings.cpp index bb061256cb..0dce70de52 100644 --- a/plugins/StopSpamPlus/src/settings.cpp +++ b/plugins/StopSpamPlus/src/settings.cpp @@ -25,7 +25,7 @@ std::string db_usage::DBGetPluginSetting(std::string const &name, std::string co bool db_usage::DBGetPluginSetting(std::string const &name, bool const &defValue)
{
- return(0 != db_get_b(NULL, pluginName, name.c_str(), defValue?1:0));
+ return(0 != db_get_b(NULL, pluginName, name.c_str(), defValue ? 1 : 0));
}
DWORD db_usage::DBGetPluginSetting(std::string const &name, DWORD const &defValue)
@@ -48,12 +48,12 @@ void db_usage::DBSetPluginSetting(std::string const &name, std::string const &va void db_usage::DBSetPluginSetting(std::string const &name, bool const &value)
{
- db_set_b(NULL, pluginName, name.c_str(), value?1:0);
+ db_set_b(NULL, pluginName, name.c_str(), value ? 1 : 0);
}
void db_usage::DBSetPluginSetting(std::string const &name, DWORD const &value)
{
- db_set_dw(NULL, pluginName, name.c_str(),value);
+ db_set_dw(NULL, pluginName, name.c_str(), value);
}
Settings *plSets;
diff --git a/plugins/StopSpamPlus/src/stopspam.cpp b/plugins/StopSpamPlus/src/stopspam.cpp index 0a5d5b046f..4e561f32f0 100644 --- a/plugins/StopSpamPlus/src/stopspam.cpp +++ b/plugins/StopSpamPlus/src/stopspam.cpp @@ -18,18 +18,18 @@ PLUGININFOEX pluginInfoEx = { __AUTHORWEB,
UNICODE_AWARE,
// {553811EE-DEB6-48B8-8902-A8A00C1FD679}
- {0x553811ee, 0xdeb6, 0x48b8, {0x89, 0x2, 0xa8, 0xa0, 0xc, 0x1f, 0xd6, 0x79}}
+ { 0x553811ee, 0xdeb6, 0x48b8, { 0x89, 0x2, 0xa8, 0xa0, 0xc, 0x1f, 0xd6, 0x79 } }
};
HINSTANCE hInst;
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
@@ -39,7 +39,7 @@ extern "C" int __declspec(dllexport) Load(void) {
mir_getLP(&pluginInfoEx);
- plSets=new Settings;
+ plSets = new Settings;
hFunc = CreateServiceFunction(MS_STOPSPAM_CONTACTPASSED, IsContactPassed);
@@ -51,7 +51,7 @@ extern "C" int __declspec(dllexport) Load(void) CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -0x7FFFFFFF;
mi.flags = CMIF_TCHAR;
- mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
+ mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
mi.ptszName = LPGENT("Remove Temporary Contacts");
mi.pszService = pluginName"/RemoveTempContacts";
Menu_AddMainMenuItem(&mi);
@@ -63,7 +63,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
miranda::EventHooker::UnhookAll();
-
+
if (hFunc)
{
DestroyServiceFunction(hFunc);
@@ -75,6 +75,6 @@ extern "C" int __declspec(dllexport) Unload(void) hFunc = 0;
}
delete plSets;
-
+
return 0;
}
\ No newline at end of file diff --git a/plugins/StopSpamPlus/src/utils.cpp b/plugins/StopSpamPlus/src/utils.cpp index b8dd8371e5..2e83400e19 100644 --- a/plugins/StopSpamPlus/src/utils.cpp +++ b/plugins/StopSpamPlus/src/utils.cpp @@ -8,14 +8,14 @@ tstring &GetDlgItemString(HWND hwnd, int id) GetWindowText(h, buf, len + 1);
static tstring s;
s = buf;
- delete []buf;
+ delete[]buf;
return s;
}
bool IsExistMyMessage(MCONTACT hContact)
{
MEVENT hDbEvent = db_event_first(hContact);
- while(hDbEvent){
+ while (hDbEvent) {
DBEVENTINFO dbei = { sizeof(dbei) };
if (db_event_get(hDbEvent, &dbei))
break;
@@ -64,11 +64,11 @@ tstring variables_parse(tstring const &tstrFormat, MCONTACT hContact){ tstring trim(const tstring &tstr, const tstring& trimChars)
{
- size_t s = tstr.find_first_not_of(trimChars);
- size_t e = tstr.find_last_not_of (trimChars);
+ size_t s = tstr.find_first_not_of(trimChars);
+ size_t e = tstr.find_last_not_of(trimChars);
- if ((tstring::npos == s) || ( tstring::npos == e))
- return _T("");
- else
- return tstr.substr(s, e - s + 1);
+ if ((tstring::npos == s) || (tstring::npos == e))
+ return _T("");
+ else
+ return tstr.substr(s, e - s + 1);
}
\ No newline at end of file diff --git a/plugins/StopSpamPlus/stopspam_12.vcxproj b/plugins/StopSpamPlus/stopspam_12.vcxproj index e78ef6e021..b5481a63c4 100644 --- a/plugins/StopSpamPlus/stopspam_12.vcxproj +++ b/plugins/StopSpamPlus/stopspam_12.vcxproj @@ -81,7 +81,7 @@ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>headers.h</PrecompiledHeaderFile>
@@ -109,7 +109,7 @@ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>headers.h</PrecompiledHeaderFile>
@@ -136,7 +136,7 @@ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>headers.h</PrecompiledHeaderFile>
@@ -161,7 +161,7 @@ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>headers.h</PrecompiledHeaderFile>
</ClCompile>
|