diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-09-24 11:48:03 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-09-24 11:48:03 +0300 |
commit | 6d88cf817136473cfb98332cb4616e3563e33971 (patch) | |
tree | cd1f732b3cb10cc91e52e3411a3595d2a80a4279 | |
parent | a2d855c24796591e73ce8f2160746716aec6516e (diff) |
replacer
-rw-r--r-- | commonheaders.h | 69 | ||||
-rw-r--r-- | constants.h | 4 | ||||
-rw-r--r-- | globals.h | 21 | ||||
-rw-r--r-- | init.cpp | 145 | ||||
-rw-r--r-- | main.cpp | 23 | ||||
-rw-r--r-- | main.h | 21 | ||||
-rw-r--r-- | messages.cpp | 97 | ||||
-rw-r--r-- | metacontacts.cpp | 71 | ||||
-rw-r--r-- | metacontacts.h | 22 | ||||
-rw-r--r-- | options.cpp | 362 | ||||
-rw-r--r-- | replacer.icproj | 28 | ||||
-rw-r--r-- | replacer.rc | 153 | ||||
-rw-r--r-- | replacer.sln | 32 | ||||
-rw-r--r-- | replacer.suo | bin | 0 -> 23552 bytes | |||
-rw-r--r-- | replacer.vcproj | 811 | ||||
-rw-r--r-- | resource.h | 38 | ||||
-rw-r--r-- | utilities.cpp | 144 | ||||
-rw-r--r-- | utilities.h | 25 |
18 files changed, 2066 insertions, 0 deletions
diff --git a/commonheaders.h b/commonheaders.h new file mode 100644 index 0000000..64b44da --- /dev/null +++ b/commonheaders.h @@ -0,0 +1,69 @@ +// Copyright © 2010 sss +// +// 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. +#ifndef COMMONHEADERS_H +#define COMMONHEADERS_H +#define MIRANDA_VER 0x0901 +#include <windows.h> +#include <locale.h> +#include <shlobj.h> +#include <io.h> +#include <errno.h> +#include <time.h> +#include <uxtheme.h> +#include <shlwapi.h> + +#include <iostream> +#include <map> +using std::map; +#include <list> +using std::list; +#include <vector> +using std::vector; +#include <string> +using std::string; +using std::wstring; +#include <fstream> +using std::wfstream; +using std::fstream; + +#include <newpluginapi.h> +#include <m_database.h> +#include <m_options.h> +#include <m_langpack.h> +#include <m_clist.h> +#include <m_clui.h> +#include <m_icolib.h> +#include <m_skin.h> +#include <m_protomod.h> +#include <m_protosvc.h> +#include <m_netlib.h> +#include <m_jabber.h> +#include <m_message.h> +#include <m_cluiframes.h> +#include <m_icolib.h> +#include "m_extraicons.h" +#include "m_metacontacts.h" +#include "resource.h" + +#include "constants.h" +#include "utilities.h" +#include "globals.h" +#include "main.h" +#include "gpg_wrapper.h" +#include "jabber_account.h" +#include "metacontacts.h" +#include "log.h" +#endif diff --git a/constants.h b/constants.h new file mode 100644 index 0000000..ee06592 --- /dev/null +++ b/constants.h @@ -0,0 +1,4 @@ +#ifndef CONSTANTS_H +#define CONSTANTS_H +#define szReplacerModuleName "Replacer" +#endif diff --git a/globals.h b/globals.h new file mode 100644 index 0000000..2f0d5a5 --- /dev/null +++ b/globals.h @@ -0,0 +1,21 @@ +// Copyright © 2010 sss, chaos.persei +// +// 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. + +#ifndef GLOBALS_H +#define GLOBALS_H +extern bool bAppendTags; +extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag; +#endif diff --git a/init.cpp b/init.cpp new file mode 100644 index 0000000..e0a9e6c --- /dev/null +++ b/init.cpp @@ -0,0 +1,145 @@ +// Copyright © 2010 sss +// +// 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 "commonheaders.h" + +//global variables +bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false; +TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL; + +list <JabberAccount*> Accounts; + +HINSTANCE hInst; +HANDLE hLoadPubKey = NULL, hToggleEncryption = NULL, hOnPreBuildContactMenu = NULL, hSendKey = NULL, g_hCLIcon = NULL; +PLUGINLINK *pluginLink; +IconExtraColumn g_IEC = {0}; +static int OnModulesLoaded(WPARAM wParam,LPARAM lParam); +extern char *date(); +MM_INTERFACE mmi = {0}; +UTF8_INTERFACE utfi = {0}; +XML_API xi = {0}; + + +#define MIID_REPLACER { 0x6587ce2, 0x3bf8, 0x4e74, { 0xa1, 0x87, 0x1e, 0xa8, 0x59, 0x6a, 0x6b, 0x5f } } + +PLUGININFOEX pluginInfo={ + sizeof(PLUGININFOEX), + 0, + PLUGIN_MAKE_VERSION(0,0,0,1), + "simple word replacer", + "who did this ? %)", + "some@mail.gnu", + "© 2010 someone", + "http://?", + 1, //unicode + 0, //doesn't replace anything built-in + MIID_REPLACER +}; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst=hinstDLL; + return TRUE; +} + + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + static char plugname[52]; + strcpy(plugname, szReplacerModuleName" ["); + strcat(plugname, date()); + strcat(plugname, " "); + strcat(plugname, __TIME__); + strcat(plugname, "]"); + pluginInfo.shortName = plugname; + return &pluginInfo; +} + +static const MUUID interfaces[] = {MIID_REPLACER, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) +{ + return interfaces; +} + +void init_vars() +{ +} + +extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) +{ + pluginLink=link; + init_vars(); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + mir_getMMI(&mmi); + mir_getUTFI(&utfi); + return 0; +} + +int AddContact(WPARAM w, LPARAM l) +{ + CallService(MS_PROTO_ADDTOCONTACT,w,(LPARAM)szReplacerModuleName); + return 0; +} + + +static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) +{ + + int RecvMsgSvc(WPARAM w, LPARAM l); + int SendMsgSvc(WPARAM w, LPARAM l); + int HookSendMsg(WPARAM w, LPARAM l); + int ReplacerOptInit(WPARAM wParam,LPARAM lParam); + + bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT); + + HookEvent(ME_OPT_INITIALISE, ReplacerOptInit); + HookEvent(ME_DB_EVENT_FILTER_ADD, HookSendMsg); + + PROTOCOLDESCRIPTOR pd = {0}; + pd.cbSize=sizeof(PROTOCOLDESCRIPTOR); + pd.szName=szReplacerModuleName; + pd.type=PROTOTYPE_ENCRYPTION; + CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); + + CreateProtoServiceFunction(szReplacerModuleName,PSR_MESSAGE,RecvMsgSvc); + CreateProtoServiceFunction(szReplacerModuleName,PSS_MESSAGE,SendMsgSvc); + CreateProtoServiceFunction(szReplacerModuleName,PSR_MESSAGE"W",RecvMsgSvc); + CreateProtoServiceFunction(szReplacerModuleName,PSS_MESSAGE"W",SendMsgSvc); + + for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) + if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)szReplacerModuleName)) + CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)szReplacerModuleName); + + HookEvent(ME_DB_CONTACT_ADDED,AddContact); + + + + return 0; +} + + +extern "C" int __declspec(dllexport) Unload(void) +{ + for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) + DBDeleteContactSetting(hContact, szReplacerModuleName, "KeyID_Prescense"); + mir_free(inopentag); + mir_free(inclosetag); + mir_free(outopentag); + mir_free(outclosetag); + if(password) + delete [] password; + return 0; +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..dcc2d04 --- /dev/null +++ b/main.cpp @@ -0,0 +1,23 @@ +// Copyright © 2010 sss +// +// 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 "commonheaders.h" + + + @@ -0,0 +1,21 @@ +// Copyright © 2010 sss +// +// 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. +#ifndef MAIN_H +#define MAIN_H + +#endif + + diff --git a/messages.cpp b/messages.cpp new file mode 100644 index 0000000..16cac57 --- /dev/null +++ b/messages.cpp @@ -0,0 +1,97 @@ +// Copyright © 2010 sss +// +// 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 "commonheaders.h" + + +wstring new_key; +HANDLE new_key_hcnt = NULL; +HANDLE new_key_hcnt_mutex = NULL; +bool _terminate = false; + +BOOL isProtoMetaContacts(HANDLE hContact); + +int RecvMsgSvc(WPARAM w, LPARAM l) +{ + CCSDATA *ccs = (CCSDATA*)l; + if (!ccs) + return CallService(MS_PROTO_CHAINRECV, w, l); + PROTORECVEVENT *pre = (PROTORECVEVENT*)(ccs->lParam); + if (!pre) + return CallService(MS_PROTO_CHAINRECV, w, l); + char *msg = pre->szMessage; + if (!msg) + return CallService(MS_PROTO_CHAINRECV, w, l); + HANDLE hContact = ccs->hContact; + if(isProtoMetaContacts(hContact)) + hContact = metaGetMostOnline(hContact); + + + return CallService(MS_PROTO_CHAINRECV, w, l); +} + +int SendMsgSvc(WPARAM w, LPARAM l) +{ + CCSDATA *ccs = (CCSDATA*)l; + if (!ccs) + return CallService(MS_PROTO_CHAINSEND, w, l); + + char *msg = (char*)(ccs->lParam); + if (!msg) + return CallService(MS_PROTO_CHAINSEND, w, l); + HANDLE hContact = ccs->hContact; + if(isProtoMetaContacts(hContact)) + hContact = metaGetMostOnline(hContact); + + return CallService(MS_PROTO_CHAINSEND, w, l); +} + +int HookSendMsg(WPARAM w, LPARAM l) +{ + HANDLE hContact = (HANDLE)w; + if(isProtoMetaContacts(hContact)) + hContact = metaGetMostOnline(hContact); + if(!DBGetContactSettingByte(hContact, szReplacerModuleName, "GPGEncryption", 0)) + return 0; + + if(bAppendTags) + { + if(!l) + return 0; + BYTE Msgs = DBGetContactSettingByte(hContact, szReplacerModuleName, "MsgsForTagging", 0); + if(!Msgs) + return 0; + DBEVENTINFO * dbei = (DBEVENTINFO*)l; + if((dbei->eventType == EVENTTYPE_MESSAGE) && (dbei->flags & DBEF_SENT)) + { + char *msg = (char*)dbei->pBlob; + TCHAR *tmp = mir_utf8decodeW(msg); + wstring str = tmp; + mir_free(tmp); + str.insert(0, outopentag); + str.append(outclosetag); + char *msg2 = mir_utf8encodeW(str.c_str()); + mir_free(dbei->pBlob); + dbei->pBlob = (PBYTE)msg2; + dbei->cbBlob = strlen(msg2)+1; + DBWriteContactSettingByte(hContact, szReplacerModuleName, "MsgsForTagging", Msgs - 1); + } + } + return 0; +} + + + diff --git a/metacontacts.cpp b/metacontacts.cpp new file mode 100644 index 0000000..6c49411 --- /dev/null +++ b/metacontacts.cpp @@ -0,0 +1,71 @@ +// Copyright © 2010 SecureIM developers (baloo and others), sss +// +// 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 "commonheaders.h" + +extern bool bMetaContacts; + +BOOL isProtoMetaContacts(HANDLE hContact) +{ + if(bMetaContacts) { + LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + if( proto && strcmp(proto,"MetaContacts")==0 ) { + return true; + } + } + return false; +} + + +BOOL metaIsDefaultSubContact(HANDLE hContact) +{ + + if(bMetaContacts) + return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0)==hContact; + return false; +} + + +HANDLE metaGetContact(HANDLE hContact) +{ + if(bMetaContacts) + return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0); + return 0; +} + + +HANDLE metaGetMostOnline(HANDLE hContact) +{ + + if(bMetaContacts) + return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0); + return 0; +} + +DWORD metaGetContactsNum(HANDLE hContact) +{ + if(bMetaContacts) + return CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, 0); + return 0; +} +HANDLE metaGetSubcontact(HANDLE hContact, int num) +{ + if(bMetaContacts) + return (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, (LPARAM)num); + return 0; +} + + diff --git a/metacontacts.h b/metacontacts.h new file mode 100644 index 0000000..8dadd81 --- /dev/null +++ b/metacontacts.h @@ -0,0 +1,22 @@ +// Copyright © 2010 sss +// +// 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. + +BOOL isProtoMetaContacts(HANDLE hContact); +BOOL metaIsDefaultSubContact(HANDLE hContact) ; +HANDLE metaGetContact(HANDLE hContact); +HANDLE metaGetMostOnline(HANDLE hContact); +DWORD metaGetContactsNum(HANDLE hContact); +HANDLE metaGetSubcontact(HANDLE hContact, int num);
\ No newline at end of file diff --git a/options.cpp b/options.cpp new file mode 100644 index 0000000..1e8bfb4 --- /dev/null +++ b/options.cpp @@ -0,0 +1,362 @@ +// Copyright © 2010 sss +// +// 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 "commonheaders.h" + +extern HINSTANCE hInst; + +static BOOL CALLBACK DlgProcReplacerOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + + +static BOOL CheckStateLoadDB(HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef) +{ + BOOL state = DBGetContactSettingByte(NULL, szReplacerModuleName, szSetting, bDef); + CheckDlgButton(hwndDlg, idCtrl, state); + return state; +} + +static BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting) +{ + BOOL state = IsDlgButtonChecked(hwndDlg, idCtrl); + DBWriteContactSettingByte(NULL, szReplacerModuleName, szSetting, (BYTE)state); + return state; +} + + +int ReplacerOptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_REPLACER); + odp.pszTitle = szReplacerModuleName; + odp.pszGroup = "Message Sessions"; + odp.pszTab = "Main"; + odp.flags=ODPF_BOLDGROUPS; + odp.pfnDlgProc = DlgProcReplacerOpts; + CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp); + + return 0; +} + +map<int, HANDLE> user_data; + +int item_num = 0; +HWND hwndList_p = NULL; +HWND hwndCurKey_p = NULL; + +void ShowLoadPublicKeyDialog(); +static BOOL CALLBACK DlgProcReplacerOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HWND hwndList=GetDlgItem(hwndDlg, IDC_USERLIST); + hwndList_p = hwndList; + hwndCurKey_p = GetDlgItem(hwndDlg, IDC_CURRENT_KEY); + LVCOLUMN col = {0}; + LVITEM item = {0}; + TCHAR *tmp = NULL; + char *tmp2 = NULL; + extern bool bIsMiranda09; + NMLISTVIEW * hdr = (NMLISTVIEW *) lParam; + switch (msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + col.pszText = _T("Contact"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 60; + ListView_InsertColumn(hwndList, 0, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = _T("Key ID"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 50; + ListView_InsertColumn(hwndList, 1, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = _T("Name"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 50; + ListView_InsertColumn(hwndList, 2, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = _T("Email"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 50; + ListView_InsertColumn(hwndList, 3, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = _T("Protocol"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 60; + ListView_InsertColumn(hwndList, 4, &col); + ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); + int i = 1, iRow = 0; +/* for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact != NULL; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) + { + if(isContactHaveKey(hContact)) + { + TCHAR *name = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); + item.mask = LVIF_TEXT; + item.iItem = i; + item.iSubItem = 0; + item.pszText = name; + iRow = ListView_InsertItem(hwndList, &item); + ListView_SetItemText(hwndList, iRow, 0, name); + TCHAR *tmp = mir_a2t((char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); + ListView_SetItemText(hwndList, iRow, 4, tmp); + mir_free(tmp); + tmp2 = UniGetContactSettingUtf(hContact, szReplacerModuleName, "KeyID", ""); + tmp = mir_a2t(tmp2); + mir_free(tmp2); + ListView_SetItemText(hwndList, iRow, 1, (_tcslen(tmp) > 1)?tmp:_T("not set")); + mir_free(tmp); + tmp2 = UniGetContactSettingUtf(hContact, szReplacerModuleName, "KeyMainName", ""); + tmp = mir_a2t(tmp2); + mir_free(tmp2); + ListView_SetItemText(hwndList, iRow, 2, (_tcslen(tmp) > 1)?tmp:_T("not set")); + mir_free(tmp); + tmp2 = UniGetContactSettingUtf(hContact, szReplacerModuleName, "KeyMainEmail", ""); + tmp = mir_a2t(tmp2); + mir_free(tmp2); + ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set")); + mir_free(tmp); + if(DBGetContactSettingByte(hContact, szReplacerModuleName, "GPGEncryption", 0)) + ListView_SetItemState(hwndList, iRow, 0x2000, 0xF000); + user_data[i] = hContact; + ZeroMemory(&item,sizeof(item)); + ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this + ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE); + i++; + } + }*/ + tmp = UniGetContactSettingUtf(NULL, szReplacerModuleName, "szLogFilePath", _T("")); + SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, (_tcslen(tmp) > 1)?tmp:_T("c:\\GPGdebug.log")); + mir_free(tmp); + CheckStateLoadDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog", 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_JABBER_API), bIsMiranda09); + { + string keyinfo = "Current private key id: "; + char *keyid = UniGetContactSettingUtf(NULL, szReplacerModuleName, "KeyID", ""); + keyinfo += (strlen(keyid) > 0)?keyid:"not set"; + mir_free(keyid); + SetDlgItemTextA(hwndDlg, IDC_CURRENT_KEY, keyinfo.c_str()); + } + if(bIsMiranda09) + CheckStateLoadDB(hwndDlg, IDC_JABBER_API, "bJabberAPI", 1); + CheckStateLoadDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers", 1); + return TRUE; + } + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_DELETE_KEY_BUTTON: +/* { //gpg execute block + TCHAR tmp2[MAX_PATH] = {0}; + TCHAR *ptmp; + char *tmp; + bool keep = false; + bool ismetacontact = false; + HANDLE meta = NULL; + HANDLE hContact = user_data[item_num+1]; + if(isProtoMetaContacts(hContact)) + { + meta = hContact; + hContact = metaGetMostOnline(hContact); + ismetacontact = true; + } + else if((meta = metaGetContact(user_data[item_num+1])) != NULL) + { + hContact = metaGetMostOnline(meta); + ismetacontact = true; + } + tmp = UniGetContactSettingUtf(hContact, szReplacerModuleName, "KeyID", ""); + for(HANDLE hcnttmp = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hcnttmp != NULL; hcnttmp = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hcnttmp, 0)) + { + if(hcnttmp != hContact) + { + char *tmp2 = UniGetContactSettingUtf(hcnttmp, szReplacerModuleName, "KeyID", ""); + if(!strcmp(tmp, tmp2)) + { + mir_free(tmp2); + keep = true; + break; + } + mir_free(tmp2); + } + } + if(!keep) + if(MessageBox(0, _T("This key not used by any contact, do you want to remove it from publick keyring ?"), _T("Key info"), MB_YESNO) == IDYES) + { + wstring cmd; + string output; + DWORD exitcode; + cmd += _T(" --batch --yes --delete-key "); + ptmp = mir_a2t(tmp); + cmd += ptmp; + mir_free(ptmp); + gpg_execution_params params; + pxResult result; + params.cmd = &cmd; + params.useless = ""; + params.out = &output; + params.code = &exitcode; + params.result = &result; + HANDLE gpg_thread = mir_forkthread(pxEexcute_thread, (void*)¶ms); + if(WaitForSingleObject(gpg_thread, 10000) == WAIT_TIMEOUT) + { + TerminateThread(gpg_thread, 0); + MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK); + } + if(result == pxNotFound) + { + MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); + mir_free(tmp); + break; + } + if(output.find("--delete-secret-keys") != string::npos) + MessageBoxA(0, "we have secret key for this public key, do not removing from GPG keyring", "info", MB_OK); + else + MessageBoxA(0, "Key removed from GPG keyring", "info", MB_OK); + } + mir_free(tmp); + if(ismetacontact) + { + if(MessageBox(0, _T("Do you want to remove key from entire metacontact (all subcontacts) ?"), _T("Metacontact detected"), MB_YESNO) == IDYES) + { + HANDLE hcnt = NULL; + int count = metaGetContactsNum(meta); + for(int i = 0; i < count; i++) + { + hcnt = metaGetSubcontact(meta, i); + if(hcnt) + { + DBDeleteContactSetting(hcnt, szReplacerModuleName, "KeyID"); + DBDeleteContactSetting(hcnt, szReplacerModuleName, "GPGPubKey"); + DBDeleteContactSetting(hcnt, szReplacerModuleName, "KeyMainName"); + DBDeleteContactSetting(hcnt, szReplacerModuleName, "KeyType"); + DBDeleteContactSetting(hcnt, szReplacerModuleName, "KeyMainEmail"); + DBDeleteContactSetting(hcnt, szReplacerModuleName, "KeyComment"); + setClistIcon(hcnt); + setSrmmIcon(hcnt); + } + } + } + else + { + DBDeleteContactSetting(hContact, szReplacerModuleName, "KeyID"); + DBDeleteContactSetting(hContact, szReplacerModuleName, "GPGPubKey"); + DBDeleteContactSetting(hContact, szReplacerModuleName, "KeyMainName"); + DBDeleteContactSetting(hContact, szReplacerModuleName, "KeyType"); + DBDeleteContactSetting(hContact, szReplacerModuleName, "KeyMainEmail"); + DBDeleteContactSetting(hContact, szReplacerModuleName, "KeyComment"); + setClistIcon(hContact); + setSrmmIcon(hContact); + } + } + else + { + DBDeleteContactSetting(user_data[item_num+1], szReplacerModuleName, "KeyID"); + DBDeleteContactSetting(user_data[item_num+1], szReplacerModuleName, "GPGPubKey"); + DBDeleteContactSetting(user_data[item_num+1], szReplacerModuleName, "KeyMainName"); + DBDeleteContactSetting(user_data[item_num+1], szReplacerModuleName, "KeyType"); + DBDeleteContactSetting(user_data[item_num+1], szReplacerModuleName, "KeyMainEmail"); + DBDeleteContactSetting(user_data[item_num+1], szReplacerModuleName, "KeyComment"); + setClistIcon(user_data[item_num+1]); + setSrmmIcon(user_data[item_num+1]); + } + } + ListView_SetItemText(hwndList, item_num, 3, _T("not set")); + ListView_SetItemText(hwndList, item_num, 2, _T("not set")); + ListView_SetItemText(hwndList, item_num, 1, _T("not set")); */ + break; + case IDC_SAVE_KEY_BUTTON: +/* { + tmp = GetFilePath(_T("Export public key"), _T("*"), _T(".asc pubkey file"), true); + if(!tmp) + { + break; + } + wstring str; + { + TCHAR *tmp = UniGetContactSettingUtf(user_data[item_num+1], szReplacerModuleName, "GPGPubKey", _T("")); + str.append(tmp); + mir_free(tmp); + } + wstring::size_type s = 0; + while((s = str.find(_T("\r"), s)) != wstring::npos) + { + str.erase(s, 1); + } + wfstream f(tmp, std::ios::out); + delete [] tmp; + f<<str.c_str(); + f.close(); + }*/ + break; + case IDC_LOG_FILE_SET: +/* { + tmp = GetFilePath(_T("Set log file"), _T("*"), _T("LOG files"), 1); + SetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp); + mir_free(tmp); + }*/ + break; + default: + break; + } + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + + case WM_NOTIFY: + { + if(hdr && IsWindowVisible(hdr->hdr.hwndFrom) && hdr->iItem != (-1)) + { + if(hdr->hdr.code == LVN_ITEMCHANGED) + { + int i = hdr->iItem; + if(ListView_GetItemState(hwndList, i, 0xF000) == 0x2000) + DBWriteContactSettingByte(user_data[i+1], szReplacerModuleName, "GPGEncryption", 1); + else + DBWriteContactSettingByte(user_data[i+1], szReplacerModuleName, "GPGEncryption", 0); + item_num = i; + } + } + switch (((LPNMHDR)lParam)->code) + { + + case PSN_APPLY: + { + extern bool bDebugLog, bJabberAPI, bFileTransfers; + bJabberAPI = CheckStateStoreDB(hwndDlg, IDC_JABBER_API, "bJabberAPI"); + return TRUE; + } + } + } + break; + } + + return FALSE; +} + + diff --git a/replacer.icproj b/replacer.icproj new file mode 100644 index 0000000..212fc64 --- /dev/null +++ b/replacer.icproj @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Intel C++ Project"
+ Version="11.1"
+ Name="replacer"
+ ProjectGUID="{9AD3350E-D58E-4128-A90D-6DC4C3775198}"
+ VCNestedProjectGUID="{F29D0C8D-141A-43CF-86B2-34A04653F8D4}"
+ VCNestedProjectFileName="replacer.vcproj">
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32">
+ <Tool
+ Name="GeneralTool"
+ InterproceduralOptimization="true"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode (static)|Win32">
+ <Tool
+ Name="CppCmplrTool"
+ Optimization="1000"
+ GlobalOptimizations="true"
+ OptimizeForWindowsApplication="true"
+ FloatingPointModel="1000"
+ UseProcessorExtensions="1"/>
+ </Configuration>
+ </Configurations>
+ <Files/>
+</VisualStudioProject>
diff --git a/replacer.rc b/replacer.rc new file mode 100644 index 0000000..0c3595b --- /dev/null +++ b/replacer.rc @@ -0,0 +1,153 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// ðóññêèé resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,0,0,7
+ PRODUCTVERSION 0,8,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "041904b0"
+ BEGIN
+ VALUE "FileDescription", "replacer"
+ VALUE "FileVersion", "0, 0, 0, 7"
+ VALUE "InternalName", "replacer"
+ VALUE "LegalCopyright", "Copyright (C) 2010 sss"
+ VALUE "OriginalFilename", "replacer"
+ VALUE "ProductName", "replacer"
+ VALUE "ProductVersion", "0, 8, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x419, 1200
+ END
+END
+
+#endif // ðóññêèé resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// àíãëèéñêèé (ÑØÀ) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPT_REPLACER DIALOGEX 0, 0, 286, 214
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x0
+BEGIN
+ LISTBOX IDC_LIST2,20,16,106,157,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ LISTBOX IDC_LIST3,152,16,108,157,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ LTEXT "List fo words for replace:",IDC_STATIC,19,8,118,8
+ LTEXT "Replace with:",IDC_STATIC,152,8,119,8
+ PUSHBUTTON "Add text",IDC_BUTTON1,19,181,50,14
+ PUSHBUTTON "Change",IDC_BUTTON2,111,181,56,14
+ PUSHBUTTON "Delete",IDC_BUTTON3,210,181,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPT_REPLACER, DIALOG
+ BEGIN
+ VERTGUIDE, 19
+ VERTGUIDE, 152
+ VERTGUIDE, 260
+ HORZGUIDE, 16
+ HORZGUIDE, 173
+ HORZGUIDE, 195
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // àíãëèéñêèé (ÑØÀ) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/replacer.sln b/replacer.sln new file mode 100644 index 0000000..78b83a1 --- /dev/null +++ b/replacer.sln @@ -0,0 +1,32 @@ +
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "replacer", "replacer.vcproj", "{F29D0C8D-141A-43CF-86B2-34A04653F8D4}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug(service)|Win32 = Debug(service)|Win32
+ Debug|Win32 = Debug|Win32
+ Release Unicode (service only)(static)|Win32 = Release Unicode (service only)(static)|Win32
+ Release Unicode (service only)|Win32 = Release Unicode (service only)|Win32
+ Release Unicode (static)|Win32 = Release Unicode (static)|Win32
+ Release Unicode|Win32 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Debug(service)|Win32.ActiveCfg = Debug(service)|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Debug(service)|Win32.Build.0 = Debug(service)|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Debug|Win32.Build.0 = Debug|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Release Unicode (service only)(static)|Win32.ActiveCfg = Release Unicode (service only)(static)|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Release Unicode (service only)(static)|Win32.Build.0 = Release Unicode (service only)(static)|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Release Unicode (service only)|Win32.ActiveCfg = Release Unicode (service only)|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Release Unicode (service only)|Win32.Build.0 = Release Unicode (service only)|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Release Unicode (static)|Win32.ActiveCfg = Release Unicode (static)|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Release Unicode (static)|Win32.Build.0 = Release Unicode (static)|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {F29D0C8D-141A-43CF-86B2-34A04653F8D4}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/replacer.suo b/replacer.suo Binary files differnew file mode 100644 index 0000000..ea67d2e --- /dev/null +++ b/replacer.suo diff --git a/replacer.vcproj b/replacer.vcproj new file mode 100644 index 0000000..68c8254 --- /dev/null +++ b/replacer.vcproj @@ -0,0 +1,811 @@ +<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="replacer"
+ ProjectGUID="{F29D0C8D-141A-43CF-86B2-34A04653F8D4}"
+ RootNamespace="replacer"
+ TargetFrameworkVersion="0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release Unicode/testplug.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="2"
+ OmitFramePointers="true"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="X:\install\git\miranda\mim_plugs;"X:\install\git\miranda\miranda-im\miranda\include";../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_UNICODE"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ EnableEnhancedInstructionSet="1"
+ FloatingPointModel="0"
+ PrecompiledHeaderFile=".\Release Unicode/testplug.pch"
+ AssemblerListingLocation=".\Release Unicode/"
+ ObjectFile=".\Release Unicode/"
+ ProgramDataBaseFileName=".\Release Unicode/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libgpgme-11.lib libgcrypt-11.lib libksba-8.lib"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="X:\install\git\miranda\mim_plugs\lib"
+ GenerateDebugInformation="true"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release Unicode/testplug.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release Unicode/testplug.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/testplug.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""X:\install\git\miranda\miranda-im\miranda\include";X:\install\git\miranda\mim_plugs;../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile="c:\temp\replacer.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="shlwapi.lib"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ ProgramDatabaseFile="./$(TargetName).pdb"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/testplug.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/testplug.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode (static)|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release Unicode (static)/testplug.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="2"
+ OmitFramePointers="true"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories=""X:\install\git\miranda\miranda-im\miranda\include";X:\install\git\miranda\mim_plugs;../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_UNICODE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ EnableEnhancedInstructionSet="1"
+ FloatingPointModel="0"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile="c:\temp\replacer.pch"
+ AssemblerListingLocation=".\Release Unicode (static)/"
+ ObjectFile=".\Release Unicode (static)/"
+ ProgramDataBaseFileName=".\Release Unicode (static)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="shlwapi.lib"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="false"
+ SubSystem="0"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release Unicode (static)/testplug.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release Unicode (static)/testplug.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode (service only)(static)|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release Unicode (static)/testplug.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="2"
+ OmitFramePointers="true"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ EnableEnhancedInstructionSet="1"
+ FloatingPointModel="0"
+ PrecompiledHeaderFile=".\Release Unicode (static)/testplug.pch"
+ AssemblerListingLocation=".\Release Unicode (static)/"
+ ObjectFile=".\Release Unicode (static)/"
+ ProgramDataBaseFileName=".\Release Unicode (static)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release Unicode (static)/testplug.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release Unicode (static)/testplug.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode (service only)|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release Unicode (static)/testplug.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="2"
+ OmitFramePointers="true"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ EnableEnhancedInstructionSet="1"
+ FloatingPointModel="0"
+ PrecompiledHeaderFile=".\Release Unicode (static)/testplug.pch"
+ AssemblerListingLocation=".\Release Unicode (static)/"
+ ObjectFile=".\Release Unicode (static)/"
+ ProgramDataBaseFileName=".\Release Unicode (static)/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release Unicode (static)/testplug.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release Unicode (static)/testplug.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug(service)|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/testplug.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;_CRT_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/testplug.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/testplug.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/testplug.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath=".\init.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ PrecompiledHeaderThrough="commonheaders.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode (static)|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile="c:\temp\replacer.pch"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\main.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode (static)|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile="c:\temp\replacer.pch"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\messages.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode (static)|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile="c:\temp\replacer.pch"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\metacontacts.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode (static)|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile="c:\temp\replacer.pch"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\options.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode (static)|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile="c:\temp\replacer.pch"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\utilities.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode (static)|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ PrecompiledHeaderFile="c:\temp\replacer.pch"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\commonheaders.h"
+ >
+ </File>
+ <File
+ RelativePath=".\constants.h"
+ >
+ </File>
+ <File
+ RelativePath=".\globals.h"
+ >
+ </File>
+ <File
+ RelativePath=".\main.h"
+ >
+ </File>
+ <File
+ RelativePath=".\metacontacts.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\utilities.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\replacer.rc"
+ >
+ </File>
+ <File
+ RelativePath=".\icons\secured.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\icons\unsecured.ico"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..c78e00b --- /dev/null +++ b/resource.h @@ -0,0 +1,38 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by replacer.rc
+//
+#define IDD_OPT_GPG 104
+#define IDD_OPT_REPLACER 104
+#define IDI_SECURED 112
+#define IDI_UNSECURED 113
+#define IDC_USERLIST 1020
+#define IDC_LOAD_KEY_BUTTON 1022
+#define ID_LOD_FROM_FILE 1024
+#define IDC_EDIT1 1025
+#define IDC_LOG_FILE_EDIT 1025
+#define IDC_BUTTON1 1026
+#define IDC_SAVE_KEY_BUTTON 1026
+#define IDC_DELETE_KEY_BUTTON 1027
+#define IDC_SELECT_KEY 1033
+#define IDC_BUTTON2 1046
+#define IDC_LOG_FILE_SET 1046
+#define IDC_DEBUG_LOG 1048
+#define IDC_JABBER_API 1049
+#define IDC_CURRENT_KEY 1054
+#define IDC_FILE_TRANSFERS 1061
+#define IDC_LIST1 1062
+#define IDC_LIST2 1063
+#define IDC_LIST3 1064
+#define IDC_BUTTON3 1065
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 114
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1066
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/utilities.cpp b/utilities.cpp new file mode 100644 index 0000000..3ab2e28 --- /dev/null +++ b/utilities.cpp @@ -0,0 +1,144 @@ +// Copyright © 2010 sss +// +// 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 "commonheaders.h" + + +TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef) +{ + DBVARIANT dbv = {DBVT_DELETED}; + TCHAR* szRes; + if (DBGetContactSettingTString(hContact, szModule, szSetting, &dbv)) + return _tcsdup(szDef); + if(dbv.pszVal) + szRes = _tcsdup(dbv.ptszVal); + DBFreeVariant(&dbv); + return szRes; +} + +char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, char* szDef) +{ + DBVARIANT dbv = {DBVT_DELETED}; + char* szRes; + if (DBGetContactSettingString(hContact, szModule, szSetting, &dbv)) + return _strdup(szDef); + if(dbv.pszVal) + szRes = _strdup(dbv.pszVal); + DBFreeVariant(&dbv); + return szRes; +} + + +char *date() +{ + setlocale( LC_ALL, "C" ); + static char d[11]; + char *tmp = __DATE__, m[4], mn[3] = "01"; + m[0]=tmp[0]; + m[1]=tmp[1]; + m[2]=tmp[2]; + if(strstr(m,"Jan")) + strcpy(mn,"01"); + else if(strstr(m,"Feb")) + strcpy(mn,"02"); + else if(strstr(m,"Mar")) + strcpy(mn,"03"); + else if(strstr(m,"Apr")) + strcpy(mn,"04"); + else if(strstr(m,"May")) + strcpy(mn,"05"); + else if(strstr(m,"Jun")) + strcpy(mn,"06"); + else if(strstr(m,"Jul")) + strcpy(mn,"07"); + else if(strstr(m,"Aug")) + strcpy(mn,"08"); + else if(strstr(m,"Sep")) + strcpy(mn,"09"); + else if(strstr(m,"Oct")) + strcpy(mn,"10"); + else if(strstr(m,"Nov")) + strcpy(mn,"11"); + else if(strstr(m,"Dec")) + strcpy(mn,"12"); + d[0]=tmp[7]; + d[1]=tmp[8]; + d[2]=tmp[9]; + d[3]=tmp[10]; + d[4]='.'; + d[5]=mn[0]; + d[6]=mn[1]; + d[7]='.'; + if (tmp[4] == ' ') + d[8] = '0'; + else + d[8]=tmp[4]; + d[9]=tmp[5]; + return d; +} + + +void HistoryLog(HANDLE hContact, char *data, int event_type, int flags) +{ + DBEVENTINFO Event = {0}; + Event.cbSize = sizeof(Event); + Event.szModule = szReplacerModuleName; + Event.eventType = event_type; + Event.flags = flags, DBEF_UTF; + Event.timestamp = (DWORD)time(NULL); + Event.cbBlob = strlen(data)+1; + Event.pBlob = (PBYTE)_strdup(data); + CallService(MS_DB_EVENT_ADD, (WPARAM)(HANDLE)hContact,(LPARAM)&Event); +} + +static int ControlAddStringUtf(HWND ctrl, DWORD msg, const TCHAR *szString) +{ + int item = -1; + item = SendMessage(ctrl, msg, 0, (LPARAM)szString); + return item; +} + +int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data) +{ + int item = ControlAddStringUtf(hCombo, CB_ADDSTRING, szString); + SendMessage(hCombo, CB_SETITEMDATA, item, data); + + return item; +} + + + + +#define NEWTSTR_MALLOC(A) (A==NULL)?NULL:strcpy((char*)mir_alloc(sizeof(char)*(strlen(A)+1)),A)
+
+const bool StriStr(const char *str, const char *substr)
+{
+ bool i = false;
+ char *str_up = NEWTSTR_MALLOC(str);
+ char *substr_up = NEWTSTR_MALLOC(substr);
+
+ CharUpperBuffA(str_up, strlen(str_up));
+ CharUpperBuffA(substr_up, strlen(substr_up));
+
+ if(strstr (str_up, substr_up))
+ i = true;
+
+ mir_free(str_up);
+ mir_free(substr_up);
+
+ return i;
+}
diff --git a/utilities.h b/utilities.h new file mode 100644 index 0000000..eaeb646 --- /dev/null +++ b/utilities.h @@ -0,0 +1,25 @@ +// Copyright © 2010 sss +// +// 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. + +#ifndef UTILITIES_H +#define UTILITIES_H +TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef); +char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, char* szDef); +void HistoryLog(HANDLE hContact, char *data, int event_type, int flags); +int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data); +const bool StriStr(const char *str, const char *substr); + +#endif |