diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-27 19:58:31 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-27 19:58:31 +0000 |
commit | 2cf996df8be948a86a9e3d856b91f30bcc9ce50a (patch) | |
tree | c2198b8f3f72eb58ef814d1fa3937ec239fad9a8 | |
parent | 3b0c1d088b26331fe171699abf3669c99cc5b0f1 (diff) |
NewEventNotify:
plusified + unicode
try to make it better :)
git-svn-id: http://svn.miranda-ng.org/main/trunk@657 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/NewEventNotify/main.cpp | 180 | ||||
-rw-r--r-- | plugins/NewEventNotify/menuitem.cpp | 31 | ||||
-rw-r--r-- | plugins/NewEventNotify/neweventnotify.h | 64 | ||||
-rw-r--r-- | plugins/NewEventNotify/neweventnotify.vcxproj | 137 | ||||
-rw-r--r-- | plugins/NewEventNotify/neweventnotify.vcxproj.filters | 11 | ||||
-rw-r--r-- | plugins/NewEventNotify/options.cpp | 99 | ||||
-rw-r--r-- | plugins/NewEventNotify/popup.cpp | 400 | ||||
-rw-r--r-- | plugins/NewEventNotify/utils.cpp | 543 |
8 files changed, 386 insertions, 1079 deletions
diff --git a/plugins/NewEventNotify/main.cpp b/plugins/NewEventNotify/main.cpp index 1822c74828..db28bf7fa0 100644 --- a/plugins/NewEventNotify/main.cpp +++ b/plugins/NewEventNotify/main.cpp @@ -23,35 +23,16 @@ */
#include "neweventnotify.h"
-#include <m_skin.h>
-#include <m_clist.h>
-#include <m_system.h>
-#include <m_protocols.h>
-//needed for ICQEVENTTYPE_* (Webpager & Emailexpress)
-#include <m_protosvc.h>
-//needed for reply instead of read
-#include <m_message.h>
-#include <m_metacontacts.h>
-#include <m_popup.h>
-
-#include <m_options.h>
-
-#include <string.h>
-#include <time.h>
int g_IsSrmmServiceAvail = 0;
int g_IsSrmmWindowAPI = 0;
-int g_UnicodeCore = 0;
-
extern PLUGIN_DATA* PopUpList[20];
//---------------------------
//---Some global variables for the plugin
-
HINSTANCE hInst;
PLUGIN_OPTIONS pluginOptions;
-
int hLangpack;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -64,7 +45,7 @@ PLUGININFOEX pluginInfo = { "jokusoftware@miranda-im.org",
"GNU GPL",
"http://addons.miranda-im.org/details.php?action=viewfile&id=3637",
- 0,
+ UNICODE_AWARE,
0,
{0x3503D584, 0x6234, 0x4BEF, {0xA5, 0x53, 0x6C, 0x1B, 0x9C, 0xD4, 0x71, 0xF2 } } // {3503D584-6234-4BEF-A553-6C1B9CD471F2}
};
@@ -83,17 +64,17 @@ int HookedNewEvent(WPARAM wParam, LPARAM lParam) //wParam: contact-handle
//lParam: dbevent-handle
{
- HANDLE hContact = (HANDLE)wParam;
- DBEVENTINFO dbe = {0};
- PLUGIN_DATA* pdata;
- DBEVENTTYPEDESCR* pei;
+ HANDLE hContact = (HANDLE)wParam;
+ DBEVENTINFO dbe = {0};
+ PLUGIN_DATA* pdata;
+ DBEVENTTYPEDESCR* pei;
- //are popups currently enabled?
- if (pluginOptions.bDisable)
- return 0;
+ //are popups currently enabled?
+ if (pluginOptions.bDisable)
+ return 0;
- //get DBEVENTINFO without pBlob
- dbe.cbSize = sizeof(dbe);
+ //get DBEVENTINFO without pBlob
+ dbe.cbSize = sizeof(dbe);
CallService(MS_DB_EVENT_GET, (WPARAM)lParam, (LPARAM)&dbe);
// Nightwish (no popups for RSS contacts at all...)
@@ -113,48 +94,46 @@ int HookedNewEvent(WPARAM wParam, LPARAM lParam) if (dbe.eventType == 25368)
return 0;
- //custom database event types
- if (ServiceExists(MS_DB_EVENT_GETTYPE))
- {
- pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbe.szModule, (LPARAM)dbe.eventType);
- if (pei && pei->cbSize >= DBEVENTTYPEDESCR_SIZE)
- { // ignore events according to flags
- if (pei->flags & DETF_NONOTIFY)
- return 0;
+ //custom database event types
+ if (ServiceExists(MS_DB_EVENT_GETTYPE))
+ {
+ pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbe.szModule, (LPARAM)dbe.eventType);
+ if (pei && pei->cbSize >= DBEVENTTYPEDESCR_SIZE && pei->flags & DETF_NONOTIFY)
+ // ignore events according to flags
+ return 0;
}
- }
//if event was allready read don't show it
if (pluginOptions.bReadCheck && (dbe.flags & DBEF_READ))
return 0;
//is it an event sent by the user? -> don't show
- if (dbe.flags & DBEF_SENT)
- {
- if (pluginOptions.bHideSend && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1)
- { // JK, only message event, do not influence others
- pdata = PopUpList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)];
- PopupAct(pdata->hWnd, MASK_DISMISS, pdata); // JK, only dismiss, i.e. do not kill event (e.g. file transfer)
+ if (dbe.flags & DBEF_SENT)
+ {
+ if (pluginOptions.bHideSend && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1)
+ { // JK, only message event, do not influence others
+ pdata = PopUpList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)];
+ PopupAct(pdata->hWnd, MASK_DISMISS, pdata); // JK, only dismiss, i.e. do not kill event (e.g. file transfer)
}
- return 0;
+ return 0;
}
- //which status do we have, are we allowed to post popups?
- //UNDER CONSTRUCTION!!!
- CallService(MS_CLIST_GETSTATUSMODE, 0, 0); /// TODO: JK: ????
+ //which status do we have, are we allowed to post popups?
+ //UNDER CONSTRUCTION!!!
+ CallService(MS_CLIST_GETSTATUSMODE, 0, 0); /// TODO: JK: ????
if (dbe.eventType == EVENTTYPE_MESSAGE && (pluginOptions.bMsgWindowCheck && hContact && CheckMsgWnd(hContact)))
return 0;
//is another popup for this contact already present? -> merge message popups if enabled
if (dbe.eventType == EVENTTYPE_MESSAGE && (pluginOptions.bMergePopup && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1))
- { // JK, only merge with message events, do not mess with others
+ { // JK, only merge with message events, do not mess with others
PopupUpdate(hContact, (HANDLE)lParam);
}
else
{ //now finally show a popup
PopupShow(&pluginOptions, hContact, (HANDLE)lParam, (UINT)dbe.eventType);
}
- return 0;
+ return 0;
}
//---Called when all the modules are loaded
@@ -181,72 +160,46 @@ int HookedInit(WPARAM wParam, LPARAM lParam) //---Called when an options dialog has to be created
int HookedOptions(WPARAM wParam, LPARAM lParam)
{
- OptionsAdd(hInst, wParam);
+ OptionsAdd(hInst, wParam);
- return 0;
+ return 0;
}
//---------------------------
//---Exported Functions
-PLUGININFOEX* handleMirandaPluginInfo(DWORD mirandaVersion)
-{
- if (mirandaVersion >= PLUGIN_MAKE_VERSION(0, 3, 3, 0))
- { // Are we running under Unicode Windows version ?
- if ((GetVersion() & 0x80000000) == 0)
- {
- pluginInfo.flags = 1; // UNICODE_AWARE
- }
- return &pluginInfo;
- }
- else
- return NULL;
-}
-
-__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- pluginInfo.cbSize = sizeof(PLUGININFOEX);
-
- return handleMirandaPluginInfo(mirandaVersion);
+ return &pluginInfo;
}
static const MUUID interfaces[] = {MIID_EVENTNOTIFY, MIID_LAST};
-__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
return interfaces;
}
-int __declspec(dllexport) Load(void)
+extern "C" __declspec(dllexport) int Load(void)
{
+ hHookedInit = HookEvent(ME_SYSTEM_MODULESLOADED, HookedInit);
+ hHookedOpt = HookEvent(ME_OPT_INITIALISE, HookedOptions);
- hHookedInit = HookEvent(ME_SYSTEM_MODULESLOADED, HookedInit);
- hHookedOpt = HookEvent(ME_OPT_INITIALISE, HookedOptions);
- mir_getLP(&pluginInfo);
-
- InitI18N();
-
- { // Are we running under unicode Miranda core ?
- char szVer[MAX_PATH];
+ mir_getLP(&pluginInfo);
- CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVer);
- _strlwr(szVer); // make sure it is lowercase
- g_UnicodeCore = (strstr(szVer, "unicode") != NULL);
- }
+ OptionsInit(&pluginOptions);
+ pluginOptions.hInst = hInst;
- OptionsInit(&pluginOptions);
- pluginOptions.hInst = hInst;
-
- if (pluginOptions.bMenuitem)
- MenuitemInit(!pluginOptions.bDisable);
+ if (pluginOptions.bMenuitem)
+ MenuitemInit(!pluginOptions.bDisable);
return 0;
}
-int __declspec(dllexport) Unload(void)
+extern "C" __declspec(dllexport) int Unload(void)
{
- UnhookEvent(hHookedNewEvent);
- UnhookEvent(hHookedOpt);
- UnhookEvent(hHookedInit);
+ UnhookEvent(hHookedNewEvent);
+ UnhookEvent(hHookedOpt);
+ UnhookEvent(hHookedInit);
return 0;
}
@@ -286,38 +239,35 @@ int CheckMsgWnd(HANDLE hContact) else
return 0;
}
- /*else
+ else
{ // old way: find it by using the window class & title
- TCHAR *newtitle = _T("");
- TCHAR *szStatus, *contactName;
+ TCHAR newtitle[256];
char *szProto;
+ TCHAR *contactName, *szStatus;
- szProto= (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact,0);
- contactName= (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact,0);
- szStatus= (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto ? DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE,0);
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ contactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto?DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE):ID_STATUS_OFFLINE, GSMDF_TCHAR);
- // vj: This code was added by preeze and it does not work:
- // vlko: it maybe work with other plugins
- _sntprintf(newtitle,sizeof(newtitle),_T("%s (%s)"),contactName,szStatus);
- if(FindWindowA("TMsgWindow",(char *)newtitle))
+ // vj: This code was added by preeze and it does not work:
+ // vlko: it maybe work with other plugins
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s)"), contactName, szStatus);
+ if(FindWindow(_T("TMsgWindow"), newtitle))
return 2;
- _sntprintf(newtitle,sizeof(newtitle),_T("[%s (%s)]"),contactName,szStatus);
- if(FindWindowA("TfrmContainer",(char *)newtitle))
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("[%s (%s)]"), contactName, szStatus);
+ if(FindWindow(_T("TfrmContainer"), newtitle))
return 1;
- // vj: I have restored this code from original plugin's source: (NewEventNotify 0.0.4)
- _sntprintf(newtitle,sizeof(newtitle),_T("%s (%s): %s"),contactName,szStatus,Translate("Message Session"));
- if(FindWindowA("#32770",(char *)newtitle)) // JK, this works for old SRMMs (1.0.4.x) and for mine SRMMJ
+ // vj: I have restored this code from original plugin's source: (NewEventNotify 0.0.4)
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message Session"));
+ if(FindWindow(_T("#32770"), newtitle)) // JK, this works for old SRMMs (1.0.4.x) and for mine SRMMJ
return 1;
- _sntprintf(newtitle,sizeof(newtitle),_T("%s (%s): %s"),contactName,szStatus,Translate("Message Received"));
- if(FindWindowA("#32770",(char *)newtitle))
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message Received"));
+ if(FindWindow(_T("#32770"), newtitle))
return 2;
return 0;
- }*/
- return 1;
-}
-
-
+ }
+}
\ No newline at end of file diff --git a/plugins/NewEventNotify/menuitem.cpp b/plugins/NewEventNotify/menuitem.cpp index eac66a59aa..c569b76180 100644 --- a/plugins/NewEventNotify/menuitem.cpp +++ b/plugins/NewEventNotify/menuitem.cpp @@ -23,8 +23,6 @@ */
#include "neweventnotify.h"
-#include <m_clist.h>
-
CLISTMENUITEM menuitem;
HANDLE hMenuitemNotify;
@@ -32,24 +30,23 @@ BOOL bNotify; static INT_PTR MenuitemNotifyCmd(WPARAM wParam,LPARAM lParam)
{
- bNotify = !bNotify;
- MenuitemUpdate(bNotify);
+ bNotify = !bNotify;
+ MenuitemUpdate(bNotify);
- //write changes to options->bDisable and into database
- Opt_DisableNEN(!bNotify);
- return 0;
+ //write changes to options->bDisable and into database
+ Opt_DisableNEN(!bNotify);
+ return 0;
}
int MenuitemUpdate(BOOL bStatus)
{
- WCHAR tmp[MAX_PATH];
-
//menuitem.flags = CMIM_FLAGS | (bStatus ? CMIF_CHECKED : 0);
menuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(bStatus ? IDI_ENABLED : IDI_DISABLED));
- menuitem.ptszName = NENTranslateT(bStatus ? MENUITEM_DISABLE : MENUITEM_ENABLE, tmp);
- menuitem.flags = CMIM_ICON | CMIM_NAME | CMIF_KEEPUNTRANSLATED;
- if (g_UnicodeCore)
- menuitem.flags |= CMIF_UNICODE;
+ if (bStatus)
+ menuitem.ptszName = TranslateT(MENUITEM_DISABLE);
+ else
+ menuitem.ptszName = TranslateT(MENUITEM_ENABLE);
+ menuitem.flags = CMIM_ICON | CMIM_NAME | CMIF_KEEPUNTRANSLATED | CMIF_TCHAR;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuitemNotify, (LPARAM)&menuitem);
return 0;
@@ -57,19 +54,15 @@ int MenuitemUpdate(BOOL bStatus) int MenuitemInit(BOOL bStatus)
{
- WCHAR tmp[MAX_PATH];
-
CreateServiceFunction(MS_NEN_MENUNOTIFY, MenuitemNotifyCmd);
ZeroMemory(&menuitem, sizeof(menuitem));
menuitem.cbSize = sizeof(CLISTMENUITEM);
menuitem.position = 1;
menuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED));
- menuitem.ptszPopupName = NENTranslateT("PopUps", tmp);
+ menuitem.ptszPopupName = TranslateT("PopUps");
menuitem.pszService = MS_NEN_MENUNOTIFY;
- menuitem.flags = CMIF_KEEPUNTRANSLATED;
- if (g_UnicodeCore)
- menuitem.flags |= CMIF_UNICODE;
+ menuitem.flags = CMIF_KEEPUNTRANSLATED | CMIF_TCHAR;
hMenuitemNotify = Menu_AddContactMenuItem(&menuitem);
bNotify = bStatus;
diff --git a/plugins/NewEventNotify/neweventnotify.h b/plugins/NewEventNotify/neweventnotify.h index b70ecbb38a..df3a7d97a9 100644 --- a/plugins/NewEventNotify/neweventnotify.h +++ b/plugins/NewEventNotify/neweventnotify.h @@ -28,14 +28,32 @@ #define _CRT_NONSTDC_NO_DEPRECATE
#include <stdio.h>
+#include <stddef.h>
#include <windows.h>
#include <commctrl.h>
-#include "resource.h"
+#include <string.h>
+#include <time.h>
+#include <malloc.h>
+
+#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
#include <m_langpack.h>
#include <m_contacts.h>
#include <m_popup.h>
+#include <m_skin.h>
+#include <m_clist.h>
+#include <m_system.h>
+#include <m_protocols.h>
+#include <m_protosvc.h>
+#include <m_message.h>
+#include <m_options.h>
+#include <m_icq.h>
+#include <m_utils.h>
+
+#include <m_metacontacts.h>
+
+#include "resource.h"
//VERY_PUBLIC Begin ... will be moved to m_neweventnotify.h
#define MS_NEN_MENUNOTIFY "NewEventNotify/MenuitemNotifyCommand"
@@ -118,15 +136,15 @@ //---------------------------
//---Translateable Strings
-#define POPUP_COMMENT_MESSAGE _T("Message")
-#define POPUP_COMMENT_URL _T("URL")
-#define POPUP_COMMENT_FILE _T("File")
-#define POPUP_COMMENT_CONTACTS _T("Contacts")
-#define POPUP_COMMENT_ADDED _T("You were added!")
-#define POPUP_COMMENT_AUTH _T("Requests your authorisation")
-#define POPUP_COMMENT_WEBPAGER _T("ICQ Web pager")
-#define POPUP_COMMENT_EMAILEXP _T("ICQ Email express")
-#define POPUP_COMMENT_OTHER _T("Unknown Event")
+#define POPUP_COMMENT_MESSAGE "Message"
+#define POPUP_COMMENT_URL "URL"
+#define POPUP_COMMENT_FILE "File"
+#define POPUP_COMMENT_CONTACTS "Contacts"
+#define POPUP_COMMENT_ADDED "You were added!"
+#define POPUP_COMMENT_AUTH "Requests your authorisation"
+#define POPUP_COMMENT_WEBPAGER "ICQ Web pager"
+#define POPUP_COMMENT_EMAILEXP "ICQ Email express"
+#define POPUP_COMMENT_OTHER "Unknown Event"
#define OPTIONS_GROUP "PopUps"
#define OPTIONS_TITLE "Event Notify"
@@ -201,10 +219,6 @@ typedef struct PLUGIN_DATA_struct { } PLUGIN_DATA;
//---------------------------
-//---Global Variables
-extern int g_UnicodeCore;
-
-//---------------------------
//---External Procedure Definitions
int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UINT eventType);
@@ -220,25 +234,3 @@ int NumberPopupData(HANDLE hContact, int eventType); int CheckMsgWnd(HANDLE hContact);
extern HINSTANCE hInst;
-
-// utils.c
-BOOL __fastcall NENGetSettingBool(char* szSetting, BOOL bDef);
-int __fastcall NENWriteSettingBool(char* szSetting, BOOL bValue);
-
-size_t __fastcall strlennull(const char *string);
-
-size_t __fastcall strlenT(const TCHAR *string);
-TCHAR* __fastcall strdupT(const TCHAR *string);
-TCHAR* __fastcall strcpyT(TCHAR* dest, const TCHAR* src);
-TCHAR* __fastcall strncpyT(TCHAR* dest, const TCHAR* src, size_t len);
-TCHAR* __fastcall strcatT(TCHAR* dest, const TCHAR* src);
-int _snprintfT(TCHAR *buffer, size_t count, const char* fmt, ...);
-
-
-TCHAR* __fastcall NENTranslateT(const char* src, const WCHAR* unibuf);
-
-void InitI18N(void);
-TCHAR* ansi_to_tchar(const char* string);
-char* tchar_to_ansi(const TCHAR* src);
-TCHAR* utf8_to_tchar(const unsigned char* utf);
-
diff --git a/plugins/NewEventNotify/neweventnotify.vcxproj b/plugins/NewEventNotify/neweventnotify.vcxproj index 53cbda27a5..d2e776cd08 100644 --- a/plugins/NewEventNotify/neweventnotify.vcxproj +++ b/plugins/NewEventNotify/neweventnotify.vcxproj @@ -25,24 +25,20 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -50,213 +46,134 @@ </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>$(SolutionDir)$(Configuration)\Plugins\</OutDir>
- <IntDir>$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <OutDir>$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
- <IntDir>$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <OutDir>$(SolutionDir)$(Configuration)\Plugins\</OutDir>
- <IntDir>$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
- <LinkIncremental>
- </LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <OutDir>$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
- <IntDir>$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
- <LinkIncremental>false</LinkIncremental>
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <InlineFunctionExpansion>Default</InlineFunctionExpansion>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<MinimalRebuild>true</MinimalRebuild>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NEWEVENTNOTIFY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <BrowseInformation>true</BrowseInformation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
- <Midl>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <TypeLibraryName>.\Debug\neweventnotify.tlb</TypeLibraryName>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <TargetEnvironment>Win32</TargetEnvironment>
- </Midl>
<ResourceCompile>
- <Culture>0x0415</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <IgnoreStandardIncludePath>
- </IgnoreStandardIncludePath>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- </Bscmake>
<Link>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
+ <SubSystem>Windows</SubSystem>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <RandomizedBaseAddress>true</RandomizedBaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <InlineFunctionExpansion>Default</InlineFunctionExpansion>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;NEWEVENTNOTIFY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <BrowseInformation>true</BrowseInformation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
- <Midl>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <TypeLibraryName>.\Debug\neweventnotify.tlb</TypeLibraryName>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- </Midl>
<ResourceCompile>
- <Culture>0x0415</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <IgnoreStandardIncludePath>
- </IgnoreStandardIncludePath>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- </Bscmake>
<Link>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
- <FunctionLevelLinking>false</FunctionLevelLinking>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>Full</Optimization>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NEWEVENTNOTIFY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
- <Midl>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <TypeLibraryName>.\Release\neweventnotify.tlb</TypeLibraryName>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <TargetEnvironment>Win32</TargetEnvironment>
- </Midl>
<ResourceCompile>
- <Culture>0x0415</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <IgnoreStandardIncludePath>
- </IgnoreStandardIncludePath>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- </Bscmake>
<Link>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>true</RandomizedBaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>Full</Optimization>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;NEWEVENTNOTIFY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
</ClCompile>
- <Midl>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <TypeLibraryName>.\Release\neweventnotify.tlb</TypeLibraryName>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- </Midl>
<ResourceCompile>
- <Culture>0x0415</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <IgnoreStandardIncludePath>
- </IgnoreStandardIncludePath>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- </Bscmake>
<Link>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="main.c" />
- <ClCompile Include="menuitem.c" />
- <ClCompile Include="options.c" />
- <ClCompile Include="popup.c" />
- <ClCompile Include="utils.c" />
+ <ClCompile Include="main.cpp" />
+ <ClCompile Include="menuitem.cpp" />
+ <ClCompile Include="options.cpp" />
+ <ClCompile Include="popup.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="neweventnotify.h" />
diff --git a/plugins/NewEventNotify/neweventnotify.vcxproj.filters b/plugins/NewEventNotify/neweventnotify.vcxproj.filters index 2d5c4ce16b..8e60643dca 100644 --- a/plugins/NewEventNotify/neweventnotify.vcxproj.filters +++ b/plugins/NewEventNotify/neweventnotify.vcxproj.filters @@ -15,19 +15,16 @@ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="main.c">
+ <ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="menuitem.c">
+ <ClCompile Include="menuitem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="options.c">
+ <ClCompile Include="options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="popup.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="utils.c">
+ <ClCompile Include="popup.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/plugins/NewEventNotify/options.cpp b/plugins/NewEventNotify/options.cpp index 24ecc24485..834fb07474 100644 --- a/plugins/NewEventNotify/options.cpp +++ b/plugins/NewEventNotify/options.cpp @@ -23,21 +23,19 @@ */
#include "neweventnotify.h"
-#include <m_options.h>
-#include <m_utils.h>
PLUGIN_OPTIONS* options;
BOOL bWmNotify;
int OptionsRead(void)
{
- options->bDisable = NENGetSettingBool(OPT_DISABLE, FALSE);
- options->bPreview = NENGetSettingBool(OPT_PREVIEW, TRUE);
- options->bMenuitem = NENGetSettingBool(OPT_MENUITEM, FALSE);
- options->bDefaultColorMsg = NENGetSettingBool(OPT_COLDEFAULT_MESSAGE, FALSE);
- options->bDefaultColorUrl = NENGetSettingBool(OPT_COLDEFAULT_URL, FALSE);
- options->bDefaultColorFile = NENGetSettingBool(OPT_COLDEFAULT_FILE, FALSE);
- options->bDefaultColorOthers = NENGetSettingBool(OPT_COLDEFAULT_OTHERS, FALSE);
+ options->bDisable = DBGetContactSettingByte(NULL, MODULE, OPT_DISABLE, FALSE);
+ options->bPreview = DBGetContactSettingByte(NULL, MODULE, OPT_PREVIEW, TRUE);
+ options->bMenuitem = DBGetContactSettingByte(NULL, MODULE, OPT_MENUITEM, FALSE);
+ options->bDefaultColorMsg = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, FALSE);
+ options->bDefaultColorUrl = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_URL, FALSE);
+ options->bDefaultColorFile = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_FILE, FALSE);
+ options->bDefaultColorOthers = DBGetContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_OTHERS, FALSE);
options->colBackMsg = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
options->colTextMsg = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
options->colBackUrl = (COLORREF)DBGetContactSettingDword(NULL, MODULE, OPT_COLBACK_URL, DEFAULT_COLBACK);
@@ -50,34 +48,34 @@ int OptionsRead(void) options->maskActL = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
options->maskActR = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
options->maskActTE = (UINT)DBGetContactSettingByte(NULL, MODULE, OPT_MASKACTTE, DEFAULT_MASKACTE);
- options->bMsgWindowCheck = NENGetSettingBool(OPT_MSGWINDOWCHECK, TRUE);
- options->bMsgReplyWindow = NENGetSettingBool(OPT_MSGREPLYWINDOW, FALSE);
- options->bMergePopup = NENGetSettingBool(OPT_MERGEPOPUP, TRUE);
+ options->bMsgWindowCheck = DBGetContactSettingByte(NULL, MODULE, OPT_MSGWINDOWCHECK, TRUE);
+ options->bMsgReplyWindow = DBGetContactSettingByte(NULL, MODULE, OPT_MSGREPLYWINDOW, FALSE);
+ options->bMergePopup = DBGetContactSettingByte(NULL, MODULE, OPT_MERGEPOPUP, TRUE);
options->iDelayMsg = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
options->iDelayUrl = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_URL, DEFAULT_DELAY);
options->iDelayFile = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_FILE, DEFAULT_DELAY);
options->iDelayOthers = (int)DBGetContactSettingDword(NULL, MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
options->iDelayDefault = (int)DBGetContactSettingRangedWord(NULL, "PopUp", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- options->bShowDate = NENGetSettingBool(OPT_SHOW_DATE, TRUE);
- options->bShowTime = NENGetSettingBool(OPT_SHOW_TIME, TRUE);
- options->bShowHeaders = NENGetSettingBool(OPT_SHOW_HEADERS, TRUE);
+ options->bShowDate = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_DATE, TRUE);
+ options->bShowTime = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_TIME, TRUE);
+ options->bShowHeaders = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_HEADERS, TRUE);
options->iNumberMsg = (BYTE)DBGetContactSettingByte(NULL, MODULE, OPT_NUMBER_MSG, TRUE);
- options->bShowON = NENGetSettingBool(OPT_SHOW_ON, TRUE);
- options->bHideSend = NENGetSettingBool(OPT_HIDESEND, TRUE);
- options->bNoRSS = NENGetSettingBool(OPT_NORSS, FALSE);
- options->bReadCheck = NENGetSettingBool(OPT_READCHECK, FALSE);
+ options->bShowON = DBGetContactSettingByte(NULL, MODULE, OPT_SHOW_ON, TRUE);
+ options->bHideSend = DBGetContactSettingByte(NULL, MODULE, OPT_HIDESEND, TRUE);
+ options->bNoRSS = DBGetContactSettingByte(NULL, MODULE, OPT_NORSS, FALSE);
+ options->bReadCheck = DBGetContactSettingByte(NULL, MODULE, OPT_READCHECK, FALSE);
return 0;
}
int OptionsWrite(void)
{
- NENWriteSettingBool(OPT_DISABLE, options->bDisable);
- NENWriteSettingBool(OPT_PREVIEW, options->bPreview);
- NENWriteSettingBool(OPT_MENUITEM, options->bMenuitem);
- NENWriteSettingBool(OPT_COLDEFAULT_MESSAGE, options->bDefaultColorMsg);
- NENWriteSettingBool(OPT_COLDEFAULT_URL, options->bDefaultColorUrl);
- NENWriteSettingBool(OPT_COLDEFAULT_FILE, options->bDefaultColorFile);
- NENWriteSettingBool(OPT_COLDEFAULT_OTHERS, options->bDefaultColorOthers);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_DISABLE, options->bDisable);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_PREVIEW, options->bPreview);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_MENUITEM, options->bMenuitem);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, options->bDefaultColorMsg);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_URL, options->bDefaultColorUrl);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_FILE, options->bDefaultColorFile);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_COLDEFAULT_OTHERS, options->bDefaultColorOthers);
DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_MESSAGE, (DWORD)options->colBackMsg);
DBWriteContactSettingDword(NULL, MODULE, OPT_COLTEXT_MESSAGE, (DWORD)options->colTextMsg);
DBWriteContactSettingDword(NULL, MODULE, OPT_COLBACK_URL, (DWORD)options->colBackUrl);
@@ -90,21 +88,21 @@ int OptionsWrite(void) DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTL, (BYTE)options->maskActL);
DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTR, (BYTE)options->maskActR);
DBWriteContactSettingByte(NULL, MODULE, OPT_MASKACTTE, (BYTE)options->maskActTE);
- NENWriteSettingBool(OPT_MSGWINDOWCHECK, options->bMsgWindowCheck);
- NENWriteSettingBool(OPT_MSGREPLYWINDOW, options->bMsgReplyWindow);
- NENWriteSettingBool(OPT_MERGEPOPUP, options->bMergePopup);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_MSGWINDOWCHECK, options->bMsgWindowCheck);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_MSGREPLYWINDOW, options->bMsgReplyWindow);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_MERGEPOPUP, options->bMergePopup);
DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_MESSAGE, (DWORD)options->iDelayMsg);
DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_URL, (DWORD)options->iDelayUrl);
DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_FILE, (DWORD)options->iDelayFile);
DBWriteContactSettingDword(NULL, MODULE, OPT_DELAY_OTHERS, (DWORD)options->iDelayOthers);
- NENWriteSettingBool(OPT_SHOW_DATE, options->bShowDate);
- NENWriteSettingBool(OPT_SHOW_TIME, options->bShowTime);
- NENWriteSettingBool(OPT_SHOW_HEADERS, options->bShowHeaders);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_DATE, options->bShowDate);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_TIME, options->bShowTime);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_HEADERS, options->bShowHeaders);
DBWriteContactSettingByte(NULL, MODULE, OPT_NUMBER_MSG, (BYTE)options->iNumberMsg);
- NENWriteSettingBool(OPT_SHOW_ON, options->bShowON);
- NENWriteSettingBool(OPT_HIDESEND, options->bHideSend);
- NENWriteSettingBool(OPT_NORSS, options->bNoRSS);
- NENWriteSettingBool(OPT_READCHECK, options->bReadCheck);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_SHOW_ON, options->bShowON);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_HIDESEND, options->bHideSend);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_NORSS, options->bNoRSS);
+ DBWriteContactSettingByte(NULL, MODULE, OPT_READCHECK, options->bReadCheck);
return 0;
}
@@ -299,25 +297,18 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L int OptionsAdd(HINSTANCE hInst, WPARAM addInfo)
{
OPTIONSDIALOGPAGE odp;
- WCHAR wsTitle[MAX_PATH];
- WCHAR wsGroup[MAX_PATH];
+ if (ServiceExists(MS_POPUP_ADDPOPUP)) {
+ odp.cbSize = sizeof(odp);
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
+ odp.ptszTitle = TranslateT(OPTIONS_TITLE);
+ odp.ptszGroup = TranslateT(OPTIONS_GROUP);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ odp.pfnDlgProc = OptionsDlgProc;
+ Options_AddPage( addInfo, &odp);
+ }
-// if (ServiceExists(MS_POPUP_ADDPOPUP)) {
-// do we need this dialog if popup.dll is not there???
-
- odp.cbSize = sizeof(odp);
-// odp.position = 100000000;
- odp.hInstance = hInst;
- odp.pszTemplate = (char *)MAKEINTRESOURCE(IDD_OPT);
- odp.ptszTitle = NENTranslateT(OPTIONS_TITLE, wsTitle);
- odp.ptszGroup = NENTranslateT(OPTIONS_GROUP, wsGroup);
-// odp.groupPosition = 910000000;
- odp.flags = ODPF_BOLDGROUPS;
- if (g_UnicodeCore) odp.flags |= ODPF_UNICODE;
- odp.pfnDlgProc = OptionsDlgProc;
- Options_AddPage( addInfo, &odp);
-
- return 0;
+ return 0;
}
int OptionsInit(PLUGIN_OPTIONS* pluginOptions)
diff --git a/plugins/NewEventNotify/popup.cpp b/plugins/NewEventNotify/popup.cpp index 966b0630fe..0e99912324 100644 --- a/plugins/NewEventNotify/popup.cpp +++ b/plugins/NewEventNotify/popup.cpp @@ -23,20 +23,6 @@ */
#include "neweventnotify.h"
-#include <m_skin.h>
-#include <m_clist.h>
-#include <m_system.h>
-#include <m_protocols.h>
-//needed for ICQEVENTTYPE_* (Webpager & Emailexpress)
-#include <m_protosvc.h>
-#include <m_icq.h>
-//needed for reply instead of read
-#include <m_message.h>
-#include <m_popup.h>
-#include <string.h>
-#include <time.h>
-
-#define SIZEOF(X) (sizeof(X)/(g_UnicodeCore?sizeof(WCHAR):sizeof(char)))
extern int g_IsServiceAvail;
@@ -99,12 +85,12 @@ static void FreePopupEventData(PLUGIN_DATA* pdata) if (eventData->next)
{
eventData = eventData->next;
- mir_free(eventData->prev);
+ free(eventData->prev);
eventData->prev = NULL;
}
else
{
- mir_free(eventData);
+ free(eventData);
eventData = NULL;
}
}
@@ -195,7 +181,7 @@ static BOOL CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM break;
case UM_FREEPLUGINDATA:
PopupCount--;
- mir_free(pdata);
+ free(pdata);
return TRUE;
case UM_INITPOPUP:
pdata->hWnd = hWnd;
@@ -226,99 +212,100 @@ static BOOL CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM default:
break;
}
- if (g_UnicodeCore)
- return DefWindowProcW(hWnd, message, wParam, lParam);
- else
- return DefWindowProcA(hWnd, message, wParam, lParam);
-}
-
-static TCHAR* event_to_tchar(char* pBlob, DWORD flags)
-{
-// if (flags & DBEF_UTF)
-// return utf8_to_tchar(pBlob);
-// else
- return ansi_to_tchar(pBlob);
+ return DefWindowProc(hWnd, message, wParam, lParam);
}
static TCHAR* GetEventPreview(DBEVENTINFO *dbei)
{
- TCHAR* comment1 = NULL;
- TCHAR* comment2 = NULL;
- TCHAR* commentFix = NULL;
+ TCHAR* comment1 = NULL;
+ TCHAR* comment2 = NULL;
+ TCHAR* commentFix = NULL;
- //now get text
- switch (dbei->eventType)
- {
- case EVENTTYPE_MESSAGE:
- {
- if (dbei->pBlob)
- {
- if (dbei->flags & DBEF_UTF)
- { // utf-8 in blob
- comment1 = utf8_to_tchar(dbei->pBlob);
- }
- else if (dbei->cbBlob == (strlennull((char *)dbei->pBlob)+1)*(sizeof(WCHAR)+1))
- { // wchar in blob (the old hack)
- if (g_UnicodeCore)
- comment1 = strdupT((TCHAR*)(dbei->pBlob + strlennull((char *)dbei->pBlob) + 1));
- else
- comment1 = strdupT((TCHAR*)dbei->pBlob);
- }
- else
- comment1 = (TCHAR *)(dbei->pBlob);
- }
- commentFix = POPUP_COMMENT_MESSAGE;
- break;
- }
+ //now get text
+ switch (dbei->eventType)
+ {
+ case EVENTTYPE_MESSAGE:
+ {
+ if (dbei->pBlob)
+ {
+ if (dbei->flags & DBEF_UTF)
+ { // utf-8 in blob
+ char* com = mir_utf8encodeT((TCHAR*)dbei->pBlob);
+ comment1 = _A2T(com);
+ mir_free(com);
+ }
+ else if (dbei->cbBlob == (_tcslen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1))
+ { // wchar in blob (the old hack)
+ comment1 = mir_tstrdup((TCHAR*)dbei->pBlob);
+ }
+ else
+ comment1 = _A2T((char *)dbei->pBlob);
+ }
+ commentFix = _T(POPUP_COMMENT_MESSAGE);
+ break;
+ }
case EVENTTYPE_URL:
- // url
- if (dbei->pBlob) comment2 = (TCHAR *)(dbei->pBlob);
- // comment
- if (dbei->pBlob) comment1 = (TCHAR *)(dbei->pBlob + strlennull((char *)dbei->pBlob) + 1);
- commentFix = POPUP_COMMENT_URL;
+ // url
+ if (dbei->pBlob) comment2 = _A2T((char *)dbei->pBlob);
+ // comment
+ if (dbei->pBlob) comment1 = _A2T((char *)dbei->pBlob + strlen((char *)dbei->pBlob) + 1);
+ commentFix = _T(POPUP_COMMENT_URL);
break;
case EVENTTYPE_FILE:
- // filenames
- if (dbei->pBlob) comment2 = event_to_tchar((char *)dbei->pBlob + 4, dbei->flags);
- // description
- if (dbei->pBlob) comment1 = event_to_tchar((char *)dbei->pBlob + strlennull((char *)dbei->pBlob + 4) + 1, dbei->flags);
- commentFix = POPUP_COMMENT_FILE;
+ // filenames
+ if (dbei->pBlob)
+ {
+ if (dbei->flags & DBEF_UTF)
+ {
+ char* com = mir_utf8encode((char*)dbei->pBlob + 4);
+ comment2 = _A2T(com);
+ mir_free(com);
+ }
+ else
+ comment2 = _A2T((char*)dbei->pBlob + 4);
+ }
+ // description
+ if (dbei->pBlob)
+ {
+ if (dbei->flags & DBEF_UTF)
+ {
+ char* com = mir_utf8encode((char *)dbei->pBlob + strlen((char *)dbei->pBlob + 4) + 1);
+ comment1 = _A2T(com);
+ mir_free(com);
+ }
+ else
+ comment1 = _A2T((char *)dbei->pBlob + strlen((char *)dbei->pBlob + 4) + 1);
+ }
+ commentFix = _T(POPUP_COMMENT_FILE);
break;
-//blob format is:
-//ASCIIZ nick
-//ASCIIZ UID
- case EVENTTYPE_CONTACTS:
- if (dbei->pBlob)
- { // count contacts in event
- char* pcBlob = (char *)dbei->pBlob;
- char* pcEnd = (char *)dbei->pBlob + dbei->cbBlob;
- int nContacts;
- TCHAR szBuf[512];
- WCHAR szTmp[512];
-
- for (nContacts = 1; ; nContacts++)
- { // Nick
- pcBlob += strlennull(pcBlob) + 1;
- // UIN
- pcBlob += strlennull(pcBlob) + 1;
- // check for end of contacts
- if (pcBlob >= pcEnd)
- break;
- }
- if (g_UnicodeCore)
- {
- _sntprintf((WCHAR*)szBuf, SIZEOF(szBuf), (WCHAR*)NENTranslateT("Received %d contacts.", szTmp), nContacts);
- ((WCHAR*)szBuf)[255] = 0;
- }
- else
- _snprintfT(szBuf, SIZEOF(szBuf), (char *)NENTranslateT("Received %d contacts.", szTmp), nContacts);
- comment1 = strdupT(szBuf);
- }
- commentFix = POPUP_COMMENT_CONTACTS;
- break;
+ //blob format is:
+ //ASCIIZ nick
+ //ASCIIZ UID
+ case EVENTTYPE_CONTACTS:
+ if (dbei->pBlob)
+ { // count contacts in event
+ char* pcBlob = (char *)dbei->pBlob;
+ char* pcEnd = (char *)(dbei->pBlob + dbei->cbBlob);
+ int nContacts;
+ TCHAR szBuf[512];
+
+ for (nContacts = 1; ; nContacts++)
+ { // Nick
+ pcBlob += strlen(pcBlob) + 1;
+ // UIN
+ pcBlob += strlen(pcBlob) + 1;
+ // check for end of contacts
+ if (pcBlob >= pcEnd)
+ break;
+ }
+ mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("Received %d contacts."), nContacts);
+ comment1 = mir_tstrdup(szBuf);
+ }
+ commentFix = _T(POPUP_COMMENT_CONTACTS);
+ break;
//blob format is:
//DWORD numeric uin (ICQ only afaik)
@@ -330,61 +317,93 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) case EVENTTYPE_ADDED:
if (dbei->pBlob)
{
- TCHAR szUin[16];
+ char szUin[16];
TCHAR szBuf[2048];
TCHAR* szNick = NULL;
- TCHAR *pszNick = (TCHAR *)dbei->pBlob + 8;
- TCHAR *pszFirst = pszNick + strlennull((char *)pszNick) + 1;
- TCHAR *pszLast = pszFirst + strlennull((char *)pszFirst) + 1;
- TCHAR *pszEmail = pszLast + strlennull((char *)pszLast) + 1;
-
- _sntprintf(szUin, 16, _T("%d"), *((DWORD*)dbei->pBlob));
- if (strlennull((char *)pszNick) > 0)
- szNick = pszNick;
- else if (strlennull((char *)pszEmail) > 0)
- szNick = pszEmail;
+ char *pszNick = (char *)dbei->pBlob + 8;
+ char *pszFirst = pszNick + strlen(pszNick) + 1;
+ char *pszLast = pszFirst + strlen(pszFirst) + 1;
+ char *pszEmail = pszLast + strlen(pszLast) + 1;
+
+ _snprintf(szUin, 16, "%d", *((DWORD*)dbei->pBlob));
+ if (strlen(pszNick) > 0)
+ {
+ if (dbei->flags & DBEF_UTF)
+ {
+ char *nick = mir_utf8encode(pszNick);
+ szNick = _A2T(nick);
+ mir_free(nick);
+ }
+ else
+ szNick = _A2T(pszNick);
+ }
+ else if (strlen(pszEmail) > 0)
+ {
+ if (dbei->flags & DBEF_UTF)
+ {
+ char *nick = mir_utf8encode(pszEmail);
+ szNick = _A2T(nick);
+ mir_free(nick);
+ }
+ else
+ szNick = _A2T(pszEmail);
+ }
else if (*((DWORD*)dbei->pBlob) > 0)
- szNick = szUin;
+ szNick = _A2T(szUin);
if (szNick)
{
- strcpyT(szBuf, szNick);
- strcatT(szBuf, NENTranslateT(" added you to the contact list", (WCHAR*)szBuf + strlenT(szBuf) + 1));
- mir_free(szNick);
- comment1 = strdupT(szBuf);
+ _tcscpy(szBuf, szNick);
+ _tcscat(szBuf, TranslateT(" added you to the contact list"));
+ free(szNick);
+ comment1 = mir_tstrdup(szBuf);
}
}
- commentFix = POPUP_COMMENT_ADDED;
+ commentFix = _T(POPUP_COMMENT_ADDED);
break;
case EVENTTYPE_AUTHREQUEST:
if (dbei->pBlob)
{
- TCHAR szUin[16];
+ char szUin[16];
TCHAR szBuf[2048];
TCHAR* szNick = NULL;
- TCHAR *pszNick = (TCHAR *)dbei->pBlob + 8;
- TCHAR *pszFirst = pszNick + strlennull((char *)pszNick) + 1;
- TCHAR *pszLast = pszFirst + strlennull((char *)pszFirst) + 1;
- TCHAR *pszEmail = pszLast + strlennull((char *)pszLast) + 1;
-
- _snwprintf(szUin, 16, _T("%d"), *((DWORD*)dbei->pBlob));
- if (strlennull((char *)pszNick) > 0)
- szNick = pszNick;
- else if (strlennull((char *)pszEmail) > 0)
- szNick = pszEmail;
+ char *pszNick = (char *)dbei->pBlob + 8;
+ char *pszFirst = pszNick + strlen(pszNick) + 1;
+ char *pszLast = pszFirst + strlen(pszFirst) + 1;
+ char *pszEmail = pszLast + strlen(pszLast) + 1;
+
+ _snprintf(szUin, 16, "%d", *((DWORD*)dbei->pBlob));
+ if (strlen(pszNick) > 0)
+ if (dbei->flags & DBEF_UTF)
+ {
+ char *nick = mir_utf8encode(pszNick);
+ szNick = _A2T(nick);
+ mir_free(nick);
+ }
+ else
+ szNick = _A2T(pszNick);
+ else if (strlen(pszEmail) > 0)
+ if (dbei->flags & DBEF_UTF)
+ {
+ char *nick = mir_utf8encode(pszEmail);
+ szNick = _A2T(nick);
+ mir_free(nick);
+ }
+ else
+ szNick = _A2T(pszEmail);
else if (*((DWORD*)dbei->pBlob) > 0)
- szNick = szUin;
+ szNick = _A2T(szUin);
if (szNick)
{
- strcpyT(szBuf, szNick);
- strcatT(szBuf, NENTranslateT(" requested authorization", (WCHAR*)szBuf + strlenT(szBuf) + 1));
- mir_free(szNick);
- comment1 = strdupT(szBuf);
+ _tcscpy(szBuf, szNick);
+ _tcscat(szBuf, TranslateT(" requested authorization"));
+ free(szNick);
+ comment1 = mir_tstrdup(szBuf);
}
}
- commentFix = POPUP_COMMENT_AUTH;
+ commentFix = _T(POPUP_COMMENT_AUTH);
break;
//blob format is:
@@ -392,9 +411,9 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) //ASCIIZ from name
//ASCIIZ from e-mail
case ICQEVENTTYPE_WEBPAGER:
- if (dbei->pBlob) comment1 = (TCHAR *)(dbei->pBlob);
+ if (dbei->pBlob) comment1 = _A2T((const char *)dbei->pBlob);
// if (dbei->pBlob) comment1 = dbei->pBlob + strlennull(comment2) + 1;
- commentFix = POPUP_COMMENT_WEBPAGER;
+ commentFix = _T(POPUP_COMMENT_WEBPAGER);
break;
//blob format is:
@@ -402,59 +421,55 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) //ASCIIZ from name
//ASCIIZ from e-mail
case ICQEVENTTYPE_EMAILEXPRESS:
- if (dbei->pBlob) comment1 = (TCHAR *)(dbei->pBlob);
+ if (dbei->pBlob) comment1 = _A2T((const char *)dbei->pBlob);
// if (dbei->pBlob) comment1 = dbei->pBlob + strlennull(comment2) + 1;
- commentFix = POPUP_COMMENT_EMAILEXP;
+ commentFix = _T(POPUP_COMMENT_EMAILEXP);
break;
default:
{
if (ServiceExists(MS_DB_EVENT_GETTYPE))
{
- DBEVENTTYPEDESCR *pei = (DBEVENTTYPEDESCR *)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
- if ((pei && pei->cbSize) >= DBEVENTTYPEDESCR_SIZE)
+ DBEVENTTYPEDESCR* pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ if (pei && pei->cbSize >= DBEVENTTYPEDESCR_SIZE_V1)
{ // support for custom database event types
if (dbei->pBlob)
{ // preview requested
- DBEVENTGETTEXT svc = {dbei, g_UnicodeCore ? DBVT_WCHAR : DBVT_ASCIIZ, CP_ACP};
- char *pet = (char *)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&svc);
+ DBEVENTGETTEXT svc = {dbei, DBVT_TCHAR, CP_ACP};
+ TCHAR *pet = (TCHAR*)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&svc);
if (pet)
{ // we've got event text, move to our memory space
- comment1 = strdupT((TCHAR *)pet);
- mir_free(&pet);
+ comment1 = mir_tstrdup(pet);
+ mir_free(pet);
}
}
- commentFix = (TCHAR *)pei->descr;
+ commentFix = _A2T(pei->descr);
}
else
- commentFix = POPUP_COMMENT_OTHER;
-
- break;
- }
- // else
- // commentFix = POPUP_COMMENT_OTHER;
-
+ commentFix = _T(POPUP_COMMENT_OTHER);
+ }
+ else
+ commentFix = _T(POPUP_COMMENT_OTHER);
+ break;
}
}
- if (strlenT(comment1) > 0)
+ if (_tcslen(comment1) > 0)
{
- mir_free(comment2);
+ free(comment2);
return comment1;
}
- if (strlenT(comment2) > 0)
+ if (_tcslen(comment2) > 0)
{
- mir_free(comment1);
+ free(comment1);
return comment2;
}
- mir_free(comment1);
- mir_free(comment2);
+ free(comment1);
+ free(comment2);
{
- WCHAR tmp[MAX_PATH];
-
- return strdupT(NENTranslateT((char *)commentFix, tmp));
+ return TranslateTS(commentFix);
}
}
@@ -465,7 +480,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN PLUGIN_DATA* pdata;
DBEVENTINFO dbe = {0};
EVENT_DATA_EX* eventData;
- char* sampleEvent;
+ TCHAR* sampleEvent;
long iSeconds;
//there has to be a maximum number of popups shown at the same time
@@ -485,7 +500,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN pudw.colorBack = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colBackMsg;
pudw.colorText = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colTextMsg;
iSeconds = pluginOptions->iDelayMsg;
- sampleEvent = LPGEN("This is a sample message event :-)");
+ sampleEvent = TranslateT("This is a sample message event :-)");
break;
case EVENTTYPE_URL:
if (!(pluginOptions->maskNotify&MASK_URL)) return 1;
@@ -493,7 +508,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN pudw.colorBack = pluginOptions->bDefaultColorUrl ? 0 : pluginOptions->colBackUrl;
pudw.colorText = pluginOptions->bDefaultColorUrl ? 0 : pluginOptions->colTextUrl;
iSeconds = pluginOptions->iDelayUrl;
- sampleEvent = LPGEN("This is a sample URL event ;-)");
+ sampleEvent = TranslateT("This is a sample URL event ;-)");
break;
case EVENTTYPE_FILE:
if (!(pluginOptions->maskNotify&MASK_FILE)) return 1;
@@ -501,7 +516,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN pudw.colorBack = pluginOptions->bDefaultColorFile ? 0 : pluginOptions->colBackFile;
pudw.colorText = pluginOptions->bDefaultColorFile ? 0 : pluginOptions->colTextFile;
iSeconds = pluginOptions->iDelayFile;
- sampleEvent = LPGEN("This is a sample file event :-D");
+ sampleEvent = TranslateT("This is a sample file event :-D");
break;
default:
if (!(pluginOptions->maskNotify&MASK_OTHER)) return 1;
@@ -509,7 +524,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN pudw.colorBack = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colBackOthers;
pudw.colorText = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colTextOthers;
iSeconds = pluginOptions->iDelayOthers;
- sampleEvent = LPGEN("This is a sample other event ;-D");
+ sampleEvent = TranslateT("This is a sample other event ;-D");
break;
}
@@ -552,17 +567,17 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN // if hContact is NULL, && hEvent is NULL then popup is only Test
if ((hContact == NULL) && (hEvent == NULL))
{
- strncpyT((TCHAR*)pudw.lptzContactName, NENTranslateT("Plugin Test", pudw.lpwzContactName), MAX_CONTACTNAME);
- strncpyT((TCHAR*)pudw.lptzText, NENTranslateT((char *)sampleEvent, pudw.lpwzText), MAX_SECONDLINE);
+ _tcsncpy((TCHAR*)pudw.lptzContactName, TranslateT("Plugin Test"), MAX_CONTACTNAME);
+ _tcsncpy((TCHAR*)pudw.lptzText, TranslateTS(sampleEvent), MAX_SECONDLINE);
}
else
{ // get the needed event data
TCHAR* szEventPreview;
- strncpyT((TCHAR*)pudw.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, g_UnicodeCore ? GCDNF_UNICODE : 0), MAX_CONTACTNAME);
+ _tcsncpy((TCHAR*)pudw.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR), MAX_CONTACTNAME);
szEventPreview = GetEventPreview(&dbe);
- strncpyT((TCHAR*)pudw.lptzText, szEventPreview, MAX_SECONDLINE);
- mir_free(szEventPreview);
+ _tcsncpy((TCHAR*)pudw.lptzText, szEventPreview, MAX_SECONDLINE);
+ free(szEventPreview);
}
PopupCount++;
@@ -570,13 +585,13 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN PopUpList[NumberPopupData(NULL, -1)] = pdata;
// send data to popup plugin
- if (g_UnicodeCore && ServiceExists(MS_POPUP_ADDPOPUPW))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT))
{
pdata->isUnicode = 1;
- if (CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pudw, 0) < 0)
+ if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pudw, 0) < 0)
{ // popup creation failed, release popupdata
FreePopupEventData(pdata);
- mir_free(pdata);
+ free(pdata);
}
}
else // convert to ansi
@@ -592,27 +607,27 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN {
char* szAnsi;
- szAnsi = tchar_to_ansi((TCHAR*)pudw.lptzContactName);
+ szAnsi = _T2A((TCHAR*)pudw.lptzContactName);
if (szAnsi)
strncpy(puda.lpzContactName, szAnsi, MAX_CONTACTNAME);
else
strcpy(puda.lpzContactName, "");
- mir_free(szAnsi);
- szAnsi = tchar_to_ansi((TCHAR*)pudw.lptzText);
+ free(szAnsi);
+ szAnsi = _T2A((TCHAR*)pudw.lptzText);
if (szAnsi)
strncpy(puda.lpzText, szAnsi, MAX_SECONDLINE);
else
strcpy(puda.lpzText, "");
- mir_free(szAnsi);
+ free(szAnsi);
}
if (CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&puda, 0) < 0)
{ // popup creation failed, release popupdata
FreePopupEventData(pdata);
- mir_free(pdata);
+ free(pdata);
}
}
if (dbe.pBlob)
- mir_free(dbe.pBlob);
+ free(dbe.pBlob);
return 0;
}
@@ -636,7 +651,7 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) {
pdata->countEvent++;
- pdata->lastEventData->next = malloc(sizeof(EVENT_DATA_EX));
+ pdata->lastEventData->next = (EVENT_DATA_EX *)malloc(sizeof(EVENT_DATA_EX));
pdata->lastEventData->next->prev = pdata->lastEventData;
pdata->lastEventData = pdata->lastEventData->next;
pdata->lastEventData->hEvent = hEvent;
@@ -651,16 +666,14 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) if (pdata->pluginOptions->bShowHeaders)
{
- WCHAR tmp[MAX_PATH];
-
- _snprintfT(lpzText, SIZEOF(lpzText), "[b]%s %d[/b]\n", NENTranslateT("Number of new message: ", tmp), pdata->countEvent);
+ mir_sntprintf(lpzText, SIZEOF(lpzText), _T("[b]%s %d[/b]\n"), TranslateT("Number of new message: "), pdata->countEvent);
}
doReverse = pdata->pluginOptions->bShowON;
if ((pdata->firstShowEventData != pdata->firstEventData && doReverse) ||
(pdata->firstShowEventData != pdata->lastEventData && !doReverse))
- _snprintfT(lpzText, SIZEOF(lpzText), "%s...\n", lpzText);
+ mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s...\n"), lpzText);
//take the active event as starting one
@@ -698,20 +711,17 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) strncpy(formatTime, "%Y.%m.%d ", sizeof(formatTime));
if (pdata->pluginOptions->bShowTime)
strncat(formatTime, "%H:%M", sizeof(formatTime));
- strftime(timestamp,sizeof(timestamp), formatTime, localtime((time_t *)&dbe.timestamp));
- if (g_UnicodeCore)
- _snprintfT(lpzText, SIZEOF(lpzText), "%s[b][i]%S[/i][/b]\n", lpzText, timestamp);
- else
- _snprintfT(lpzText, SIZEOF(lpzText), "%s[b][i]%s[/i][/b]\n", lpzText, timestamp);
+ strftime(timestamp,sizeof(timestamp), formatTime, localtime((const time_t *)&dbe.timestamp));
+ mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s[b][i]%s[/i][/b]\n"), lpzText, timestamp);
}
{ // prepare event preview
TCHAR* szEventPreview = GetEventPreview(&dbe);
- _snprintfT(lpzText, SIZEOF(lpzText), "%s%s", lpzText, szEventPreview);
- mir_free(szEventPreview);
+ mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s%s"), lpzText, szEventPreview);
+ free(szEventPreview);
}
if (dbe.pBlob)
- mir_free(dbe.pBlob);
+ free(dbe.pBlob);
if (doReverse)
{
if ((iEvent >= pdata->pluginOptions->iNumberMsg && pdata->pluginOptions->iNumberMsg) || !eventData->next)
@@ -723,11 +733,11 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) break;
}
- _snprintfT(lpzText, SIZEOF(lpzText), "%s\n", lpzText);
+ mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s\n"), lpzText);
}
if ((doReverse && eventData->next) || (!doReverse && eventData->prev))
{
- _snprintfT(lpzText, SIZEOF(lpzText), "%s\n...", lpzText);
+ mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s\n..."), lpzText);
}
if (pdata->isUnicode)
{
@@ -735,9 +745,9 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) }
else
{
- char* szAnsi = tchar_to_ansi(lpzText);
+ char* szAnsi = _T2A(lpzText);
CallService(MS_POPUP_CHANGETEXT, (WPARAM)pdata->hWnd, (LPARAM)szAnsi);
- mir_free(szAnsi);
+ free(szAnsi);
}
return 0;
}
diff --git a/plugins/NewEventNotify/utils.cpp b/plugins/NewEventNotify/utils.cpp deleted file mode 100644 index 750bb9b4ff..0000000000 --- a/plugins/NewEventNotify/utils.cpp +++ /dev/null @@ -1,543 +0,0 @@ -/*
- Name: NewEventNotify - Plugin for Miranda IM
- File: utils.c - Utility functions for Unicode support & other tiny stuff
- Version: 2.2.0
- Description: Notifies you when you receive a message
- Author: Joe @ Whale, <jokusoftware@miranda-im.org>
- Date: 05.07.07 13:04
- Copyright: (C) 2007-2008 Joe @ Whale
-
- 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 "neweventnotify.h"
-
-
-BOOL __fastcall NENGetSettingBool(char* szSetting, BOOL bDef)
-{
- return (BOOL)DBGetContactSettingByte(NULL, MODULE, szSetting, bDef);
-}
-
-int __fastcall NENWriteSettingBool(char* szSetting, BOOL bValue)
-{
- return DBWriteContactSettingByte(NULL, MODULE, szSetting, (BYTE)bValue);
-}
-
-/* a strlen() that likes NULL */
-size_t __fastcall strlennull(const char *string)
-{
- if (string)
- return strlen(string);
-
- return 0;
-}
-
-size_t __fastcall strlenT(const TCHAR *string)
-{
- if (string)
- {
- if (g_UnicodeCore)
- return wcslen((WCHAR*)string);
- else
- return strlen((char*)string);
- }
- return 0;
-}
-
-TCHAR* __fastcall strdupT(const TCHAR *string)
-{
- if (string)
- {
- if (g_UnicodeCore)
- return (TCHAR*)wcsdup((WCHAR*)string);
- else
- return (TCHAR*)strdup((char*)string);
- }
- return NULL;
-}
-
-TCHAR* __fastcall strcpyT(TCHAR* dest, const TCHAR* src)
-{
- if (src)
- {
- if (g_UnicodeCore)
- return (TCHAR*)wcscpy((WCHAR*)dest, (WCHAR*)src);
- else
- return (TCHAR*)strcpy((char*)dest, (char*)src);
- }
- return dest;
-}
-
-TCHAR* __fastcall strncpyT(TCHAR* dest, const TCHAR* src, size_t len)
-{
- if (src)
- {
- if (g_UnicodeCore)
- return (TCHAR*)wcsncpy((WCHAR*)dest, (WCHAR*)src, len);
- else
- return (TCHAR*)strncpy((char*)dest, (char*)src, len);
- }
- return dest;
-}
-
-TCHAR* __fastcall strcatT(TCHAR* dest, const TCHAR* src)
-{
- if (src)
- {
- if (g_UnicodeCore)
- return (TCHAR*)wcscat((WCHAR*)dest, (WCHAR*)src);
- else
- return (TCHAR*)strcat((char*)dest, (char*)src);
- }
- return dest;
-}
-
-int _snprintfT(TCHAR *buffer, size_t count, const char* fmt, ...)
-{
- va_list va;
- int len;
-
- va_start(va, fmt);
- if (g_UnicodeCore)
- {
- TCHAR* wfmt = ansi_to_tchar(fmt);
-
- len = _vsnwprintf((WCHAR*)buffer, count-1, (WCHAR*)wfmt, va);
- ((WCHAR*)buffer)[count-1] = 0;
- free(wfmt);
- }
- else
- {
- len = _vsnprintf((char*)buffer, count-1, fmt, va);
- ((char*)buffer)[count-1] = 0;
- }
- va_end(va);
- return len;
-}
-
-TCHAR* __fastcall NENTranslateT(const char* src, const WCHAR* unibuf)
-{ // this takes Ascii strings only!!!
- char* szRes = NULL;
-
- if (!strlennull(src))
- { // for the case of empty strings
- return _T("");
- }
-
- if (g_UnicodeCore)
- { // we give WCHAR
- WCHAR *unicode;
- int wchars, err;
-
- wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, src,
- strlennull(src), NULL, 0);
-
- if (wchars == 0) return NULL; // Failure
-
- unicode = (WCHAR*)unibuf;
- if (!unicode)
- unicode = (WCHAR*)malloc((wchars + 1) * sizeof(WCHAR));
-
- unicode[wchars] = 0;
-
- err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, src,
- strlennull(src), unicode, wchars);
- if (err != wchars) return NULL; // Failure
-
- return (TCHAR*)TranslateW(unicode);
- }
- else
- return (TCHAR*)Translate(src);
-}
-
-static BOOL bHasCP_UTF8 = FALSE;
-
-
-void InitI18N(void)
-{
- CPINFO CPInfo;
-
-
- bHasCP_UTF8 = GetCPInfo(CP_UTF8, &CPInfo);
-}
-
-
-// Scans a string encoded in UTF-8 to verify that it contains
-// only valid sequences. It will return 1 if the string contains
-// only legitimate encoding sequences; otherwise it will return 0;
-// From 'Secure Programming Cookbook', John Viega & Matt Messier, 2003
-int UTF8_IsValid(const unsigned char* pszInput)
-{
- int nb, i;
- const unsigned char* c = pszInput;
-
- if (!pszInput) return 0;
-
- for (c = pszInput; *c; c += (nb + 1))
- {
- if (!(*c & 0x80))
- nb = 0;
- else if ((*c & 0xc0) == 0x80) return 0;
- else if ((*c & 0xe0) == 0xc0) nb = 1;
- else if ((*c & 0xf0) == 0xe0) nb = 2;
- else if ((*c & 0xf8) == 0xf0) nb = 3;
- else if ((*c & 0xfc) == 0xf8) nb = 4;
- else if ((*c & 0xfe) == 0xfc) nb = 5;
-
- for (i = 1; i<=nb; i++) // we this forward, do not cross end of string
- if ((*(c + i) & 0xc0) != 0x80)
- return 0;
- }
-
- return 1;
-}
-
-
-/*
- * The following UTF8 routines are
- *
- * Copyright (C) 2001 Peter Harris <peter.harris@hummingbird.com>
- * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
- *
- * under a GPL license
- *
- * --------------------------------------------------------------
- * Convert a string between UTF-8 and the locale's charset.
- * Invalid bytes are replaced by '#', and characters that are
- * not available in the target encoding are replaced by '?'.
- *
- * If the locale's charset is not set explicitly then it is
- * obtained using nl_langinfo(CODESET), where available, the
- * environment variable CHARSET, or assumed to be US-ASCII.
- *
- * Return value of conversion functions:
- *
- * -1 : memory allocation failed
- * 0 : data was converted exactly
- * 1 : valid data was converted approximately (using '?')
- * 2 : input was invalid (but still converted, using '#')
- * 3 : unknown encoding (but still converted, using '?')
- */
-
-
-
-/*
- * Convert a string between UTF-8 and the locale's charset.
- */
-unsigned char *make_utf8_string(const wchar_t *unicode)
-{
- int size = 0;
- int index = 0;
- int out_index = 0;
- unsigned char* out;
- unsigned short c;
-
- if (!unicode) return NULL;
-
- /* first calculate the size of the target string */
- c = unicode[index++];
- while (c)
- {
- if (c < 0x0080)
- size += 1;
- else if (c < 0x0800)
- size += 2;
- else
- size += 3;
- c = unicode[index++];
- }
-
- out = (unsigned char*)malloc(size + 1);
- if (out == NULL)
- return NULL;
- index = 0;
-
- c = unicode[index++];
- while (c)
- {
- if (c < 0x080)
- {
- out[out_index++] = (unsigned char)c;
- }
- else if (c < 0x800)
- {
- out[out_index++] = 0xc0 | (c >> 6);
- out[out_index++] = 0x80 | (c & 0x3f);
- }
- else
- {
- out[out_index++] = 0xe0 | (c >> 12);
- out[out_index++] = 0x80 | ((c >> 6) & 0x3f);
- out[out_index++] = 0x80 | (c & 0x3f);
- }
- c = unicode[index++];
- }
- out[out_index] = 0x00;
-
- return out;
-}
-
-
-
-WCHAR *make_unicode_string(const unsigned char *utf8)
-{
- int size = 0, index = 0, out_index = 0;
- wchar_t *out;
- unsigned char c;
-
- if (!utf8) return NULL;
-
- /* first calculate the size of the target string */
- c = utf8[index++];
- while (c)
- {
- if ((c & 0x80) == 0)
- {
- index += 0;
- }
- else if ((c & 0xe0) == 0xe0)
- {
- index += 2;
- }
- else
- {
- index += 1;
- }
- size += 1;
- c = utf8[index++];
- }
-
- out = (wchar_t*)malloc((size + 1) * sizeof(wchar_t));
- if (out == NULL)
- return NULL;
- index = 0;
-
- c = utf8[index++];
- while (c)
- {
- if((c & 0x80) == 0)
- {
- out[out_index++] = c;
- }
- else if((c & 0xe0) == 0xe0)
- {
- out[out_index] = (c & 0x1F) << 12;
- c = utf8[index++];
- out[out_index] |= (c & 0x3F) << 6;
- c = utf8[index++];
- out[out_index++] |= (c & 0x3F);
- }
- else
- {
- out[out_index] = (c & 0x3F) << 6;
- c = utf8[index++];
- out[out_index++] |= (c & 0x3F);
- }
- c = utf8[index++];
- }
- out[out_index] = 0;
-
- return out;
-}
-
-
-
-int utf8_encode(const char *from, char **to)
-{
- wchar_t *unicode;
- int wchars, err;
-
-
- wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from,
- strlennull(from), NULL, 0);
-
- if (wchars == 0)
- {
-// fprintf(stderr, "Unicode translation error %d\n", GetLastError());
- return -1;
- }
-
- unicode = (wchar_t*)mir_alloc((wchars + 1) * sizeof(unsigned short));
- unicode[wchars] = 0;
-
- err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from,
- strlennull(from), unicode, wchars);
- if(err != wchars)
- {
-// fprintf(stderr, "Unicode translation error %d\n", GetLastError());
- return -1;
- }
-
- /* On NT-based windows systems, we could use WideCharToMultiByte(), but
- * MS doesn't actually have a consistent API across win32.
- */
- *to = make_utf8_string(unicode);
-
- return 0;
-}
-
-
-
-// Returns 0 on error, 1 on success
-int utf8_decode(const char *from, char **to)
-{
- int nResult = 0;
-
-// _ASSERTE(!(*to)); // You passed a non-zero pointer, make sure it doesnt point to unfreed memory
-
- // Validate the string
- if (!UTF8_IsValid(from))
- return 0;
-
- // Use the native conversion routines when available
- if (bHasCP_UTF8)
- {
- WCHAR *wszTemp = NULL;
- int inlen = strlennull(from);
-
- wszTemp = (WCHAR *)mir_alloc(sizeof(WCHAR) * (inlen + 1));
-
- // Convert the UTF-8 string to UCS
- if (MultiByteToWideChar(CP_UTF8, 0, from, -1, wszTemp, inlen + 1))
- {
- // Convert the UCS string to local ANSI codepage
- *to = (char*)malloc(inlen+1);
- if (WideCharToMultiByte(CP_ACP, 0, wszTemp, -1, *to, inlen+1, NULL, NULL))
- {
- nResult = 1;
- }
- else
- {
- free(*to);
- }
- }
- }
- else
- {
- wchar_t *unicode;
- int chars;
- int err;
-
- unicode = make_unicode_string(from);
- if (unicode == NULL)
- {
-// fprintf(stderr, "Out of memory processing string from UTF8 to UNICODE16\n");
- return 0;
- }
-
- chars = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, NULL, 0, NULL, NULL);
-
- if(chars == 0)
- {
-// fprintf(stderr, "Unicode translation error %d\n", GetLastError());
- free(unicode);
- return 0;
- }
-
- *to = (char*)malloc((chars + 1)*sizeof(unsigned char));
- if(*to == NULL)
- {
-// fprintf(stderr, "Out of memory processing string to local charset\n");
- free(unicode);
- return 0;
- }
-
- err = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, *to, chars, NULL, NULL);
- if (err != chars)
- {
-// fprintf(stderr, "Unicode translation error %d\n", GetLastError());
- free(unicode);
- free(*to);
- return 0;
- }
-
- free(unicode);
-
- nResult = 1;
- }
-
- return nResult;
-}
-
-
-
-TCHAR* ansi_to_tchar(const char* src)
-{
- if (g_UnicodeCore)
- {
- WCHAR *unicode;
- int wchars, err;
-
- wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, src, strlennull(src), NULL, 0);
-
- if (wchars == 0) return NULL; // Failure
-
- unicode = (WCHAR*)malloc((wchars + 1) * sizeof(WCHAR));
- unicode[wchars] = 0;
-
- err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, src, strlennull(src), unicode, wchars);
- if (err != wchars)
- {
- free(unicode);
- return NULL; // Failure
- }
-
- return (TCHAR*)unicode;
- }
- else
- return strdupT((TCHAR*)src);
-}
-
-char* tchar_to_ansi(const TCHAR* src)
-{
- if (g_UnicodeCore)
- {
- char *ansi;
- int chars;
- int err;
-
- chars = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, (WCHAR*)src, -1, NULL, 0, NULL, NULL);
-
- if (chars == 0) return NULL; // Failure
-
- ansi = (char*)malloc((chars + 1)*sizeof(char));
- if (ansi == NULL) return NULL; // Failure
-
- err = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, (WCHAR*)src, -1, ansi, chars, NULL, NULL);
- if (err != chars)
- {
- free(ansi);
- return NULL;
- }
- return ansi;
- }
- else
- return (char*)strdupT(src);
-}
-
-TCHAR* utf8_to_tchar(const unsigned char* utf)
-{
- if (g_UnicodeCore)
- return (TCHAR*)make_unicode_string(utf);
- else
- {
- char* szAnsi = NULL;
-
- if (utf8_decode(utf, &szAnsi))
- return (TCHAR*)szAnsi;
- else
- return NULL; // Failure
- }
-}
\ No newline at end of file |