diff options
Diffstat (limited to 'plugins/ContactsPlus')
-rw-r--r-- | plugins/ContactsPlus/contacts_11.vcxproj | 22 | ||||
-rw-r--r-- | plugins/ContactsPlus/contacts_11.vcxproj.filters | 14 | ||||
-rw-r--r-- | plugins/ContactsPlus/res/Version.rc | 38 | ||||
-rw-r--r-- | plugins/ContactsPlus/res/contacts.rc | 146 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/Version.h | 14 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/contacts.h | 20 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/main.cpp | 26 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/receive.cpp | 2 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/utils.cpp | 198 |
9 files changed, 200 insertions, 280 deletions
diff --git a/plugins/ContactsPlus/contacts_11.vcxproj b/plugins/ContactsPlus/contacts_11.vcxproj index f64d0046bb..a49f46dc36 100644 --- a/plugins/ContactsPlus/contacts_11.vcxproj +++ b/plugins/ContactsPlus/contacts_11.vcxproj @@ -67,8 +67,8 @@ <FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>Full</Optimization>
<WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CONTACTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>contacts.h</PrecompiledHeaderFile>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
@@ -98,8 +98,8 @@ <FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>Full</Optimization>
<WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;CONTACTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>contacts.h</PrecompiledHeaderFile>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
@@ -130,8 +130,8 @@ <WarningLevel>Level3</WarningLevel>
<MinimalRebuild>true</MinimalRebuild>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CONTACTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>contacts.h</PrecompiledHeaderFile>
@@ -157,8 +157,8 @@ <FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;CONTACTS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -189,14 +189,20 @@ <ClCompile Include="src\utils.cpp" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="res\resource.h" />
<ClInclude Include="src\contacts.h" />
<ClInclude Include="src\receive.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\send.h" />
<ClInclude Include="src\utils.h" />
+ <ClInclude Include="src\Version.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\contacts.rc" />
+ <ResourceCompile Include="res\Version.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="res\SendContacts.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/plugins/ContactsPlus/contacts_11.vcxproj.filters b/plugins/ContactsPlus/contacts_11.vcxproj.filters index 58f0006c24..f832de9c7e 100644 --- a/plugins/ContactsPlus/contacts_11.vcxproj.filters +++ b/plugins/ContactsPlus/contacts_11.vcxproj.filters @@ -50,10 +50,24 @@ <ClInclude Include="src\utils.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\Version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="res\resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\contacts.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
+ <ResourceCompile Include="res\Version.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="res\SendContacts.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/plugins/ContactsPlus/res/Version.rc b/plugins/ContactsPlus/res/Version.rc new file mode 100644 index 0000000000..5bfbab4754 --- /dev/null +++ b/plugins/ContactsPlus/res/Version.rc @@ -0,0 +1,38 @@ +// Microsoft Visual C++ generated resource script.
+//
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+#include "afxres.h"
+#include "..\src\version.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __FILEVERSION_STRING
+ PRODUCTVERSION __FILEVERSION_STRING
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "FileDescription", __DESCRIPTION
+ VALUE "InternalName", __PLUGIN_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ VALUE "OriginalFilename", __FILENAME
+ VALUE "ProductName", __PLUGIN_NAME
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/plugins/ContactsPlus/res/contacts.rc b/plugins/ContactsPlus/res/contacts.rc index b4c974d043..8cea647c0e 100644 --- a/plugins/ContactsPlus/res/contacts.rc +++ b/plugins/ContactsPlus/res/contacts.rc @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
//
#include "..\src\resource.h"
#include "winres.h"
@@ -18,75 +18,53 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL //
IDD_SEND DIALOGEX 0, 0, 308, 242
-STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_VISIBLE | WS_CAPTION |
- WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Send contacts"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,5,7,
- 12,12
+ CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,5,7,12,12
LTEXT "",IDC_NAME,19,7,118,9,SS_NOPREFIX | SS_CENTERIMAGE
- CONTROL "&A",IDC_ADD,"MButtonClass",WS_TABSTOP,231,5,16,14,
- 0x18000000L
- CONTROL "6",IDC_USERMENU,"MButtonClass",WS_TABSTOP,249,5,16,14,
- 0x18000000L
- CONTROL "&D",IDC_DETAILS,"MButtonClass",WS_TABSTOP,267,5,16,14,
- 0x18000000L
- CONTROL "&H",IDC_HISTORY,"MButtonClass",WS_TABSTOP,285,5,16,14,
- 0x18000000L
- CONTROL "Choose contacts to be send:",IDC_STATIC,"Static",
- SS_SIMPLE | WS_GROUP,5,20,300,10,WS_EX_TRANSPARENT
+ CONTROL "&A",IDC_ADD,"MButtonClass",WS_TABSTOP,231,5,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "6",IDC_USERMENU,"MButtonClass",WS_TABSTOP,249,5,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "&D",IDC_DETAILS,"MButtonClass",WS_TABSTOP,267,5,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "&H",IDC_HISTORY,"MButtonClass",WS_TABSTOP,285,5,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "Choose contacts to be send:",IDC_STATIC,"Static",SS_SIMPLE | WS_GROUP,5,20,300,10,WS_EX_TRANSPARENT
DEFPUSHBUTTON "&Send",IDOK,195,220,50,14
PUSHBUTTON "Cancel",IDCANCEL,249,220,50,14
- CONTROL "",IDC_LIST,"CListControl",WS_TABSTOP | 0x3da,5,30,298,
- 185,WS_EX_CLIENTEDGE
+ CONTROL "",IDC_LIST,"CListControl",WS_TABSTOP | 0x3da,5,30,298,185,WS_EX_CLIENTEDGE
PUSHBUTTON "&Select All",ID_SELECTALL,5,220,50,14
END
IDD_RECEIVE DIALOGEX 0, 0, 320, 225
-STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER |
- WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
- WS_SYSMENU | WS_THICKFRAME
+STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Received contacts"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,5,7,
- 12,12
+ CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,5,7,12,12
LTEXT "",IDC_NAME,19,7,118,9,SS_NOPREFIX | SS_CENTERIMAGE
- CONTROL "&A",IDC_ADD,"MButtonClass",WS_TABSTOP,243,5,16,14,
- 0x18000000L
- CONTROL "6",IDC_USERMENU,"MButtonClass",WS_TABSTOP,261,5,16,14,
- 0x18000000L
- CONTROL "&D",IDC_DETAILS,"MButtonClass",WS_TABSTOP,279,5,16,14,
- 0x18000000L
- CONTROL "&H",IDC_HISTORY,"MButtonClass",WS_TABSTOP,297,5,16,14,
- 0x18000000L
- CONTROL "",IDC_CONTACTS,"SysListView32",LVS_REPORT |
- LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
- WS_BORDER | WS_TABSTOP,5,22,310,178
- CONTROL "Add to &group:",IDC_ENABLEGROUPS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,7,205,80,12
- COMBOBOX IDC_GROUPS,90,205,72,140,CBS_DROPDOWNLIST | CBS_SORT |
- WS_VSCROLL | WS_TABSTOP | 0x8000
+ CONTROL "&A",IDC_ADD,"MButtonClass",WS_TABSTOP,243,5,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "6",IDC_USERMENU,"MButtonClass",WS_TABSTOP,261,5,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "&D",IDC_DETAILS,"MButtonClass",WS_TABSTOP,279,5,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "&H",IDC_HISTORY,"MButtonClass",WS_TABSTOP,297,5,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "",IDC_CONTACTS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,5,22,310,178
+ CONTROL "Add to &group:",IDC_ENABLEGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,205,80,12
+ COMBOBOX IDC_GROUPS,90,205,72,140,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP | 0x8000
PUSHBUTTON "&Add",IDOK,169,204,46,14,WS_DISABLED
PUSHBUTTON "&Details",IDDETAILS,215,204,46,14,WS_DISABLED
PUSHBUTTON "Close",IDCANCEL,261,204,52,14
END
IDD_MSGSENDERROR DIALOGEX 0, 0, 187, 97
-STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP |
- WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Contacts send error"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LTEXT "An error has occured. The protocol reported the following error:",
- IDC_STATIC,5,5,177,28
+ LTEXT "An error has occured. The protocol reported the following error:",IDC_STATIC,5,5,177,28
DEFPUSHBUTTON "Try again",IDOK,22,78,63,14
PUSHBUTTON "Cancel",IDCANCEL,104,78,61,14
- EDITTEXT IDC_ERRORTEXT,5,37,177,35,ES_MULTILINE | ES_READONLY |
- WS_VSCROLL
+ EDITTEXT IDC_ERRORTEXT,5,37,177,35,ES_MULTILINE | ES_READONLY | WS_VSCROLL
END
@@ -96,7 +74,7 @@ END //
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO MOVEABLE PURE
+GUIDELINES DESIGNINFO
BEGIN
IDD_SEND, DIALOG
BEGIN
@@ -122,70 +100,64 @@ END // Menu
//
-IDR_CONTACTMENU MENUEX DISCARDABLE
+IDR_CONTACTMENU MENUEX
BEGIN
POPUP "Popup", 0,MFT_STRING,MFS_ENABLED
BEGIN
MENUITEM "Add to List", 111,MFT_STRING,MFS_ENABLED
- MENUITEM "User Details", 113,MFT_STRING,
- MFS_ENABLED | MFS_UNCHECKED | MFS_UNHILITE | MFS_DEFAULT
+ MENUITEM "User Details", 113,MFT_STRING,MFS_ENABLED | MFS_UNCHECKED | MFS_UNHILITE | MFS_DEFAULT
MENUITEM MFT_SEPARATOR
MENUITEM "Send Message", 112,MFT_STRING,MFS_ENABLED
END
END
-#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
-// Version
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_CONTACTS ICON "SendContacts.ico"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
//
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,5,2,0
- PRODUCTVERSION 0,8,0,0
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
+1 TEXTINCLUDE
BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "Requires Miranda 0.3+; Recommended Miranda 0.4+\0"
- VALUE "CompanyName", "Jokusoftware, Dusk Horizon\0"
- VALUE "FileDescription", "Send/Receive Contacts plugin for Miranda (Unicode 2in1)\0"
- VALUE "FileVersion", "1, 5, 2, 0\0"
- VALUE "InternalName", "contacts+\0"
- VALUE "LegalCopyright", "Copyright (C) 2004-2008 Jokusoftware, Original code (C) 2002 Dominus Procellarum\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "contacts.dll\0"
- VALUE "ProductName", "Send/Receive Contacts plugin for Miranda\0"
- VALUE "ProductVersion", "0, 8, 0, 0\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
+ "..\\src\\resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include <winres.h>"
+ "\0"
END
-#endif // !_MAC
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Русский (Россия) resources
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
-// Icon
+// Generated from the TEXTINCLUDE 3 resource.
//
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_CONTACTS ICON "SendContacts.ico"
-#endif // Neutral resources
+
/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/ContactsPlus/src/Version.h b/plugins/ContactsPlus/src/Version.h new file mode 100644 index 0000000000..c7d9ab96d9 --- /dev/null +++ b/plugins/ContactsPlus/src/Version.h @@ -0,0 +1,14 @@ +#define __MAJOR_VERSION 1
+#define __MINOR_VERSION 5
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 0
+
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+
+#define __PLUGIN_NAME "Send/receive contacts"
+#define __FILENAME "Contacts.dll"
+#define __DESCRIPTION "Allows you to send and receive contacts."
+#define __AUTHOR "Joe Kucera, Todor Totev"
+#define __AUTHOREMAIL "jokusoftware@miranda-im.org"
+#define __AUTHORWEB "http://miranda-ng.org/"
+#define __COPYRIGHT "(C) 2004-2008 Joe Kucera, Original Code (C) 2002 Dominus Procellarum"
diff --git a/plugins/ContactsPlus/src/contacts.h b/plugins/ContactsPlus/src/contacts.h index 1feddfc923..4693a74d4a 100644 --- a/plugins/ContactsPlus/src/contacts.h +++ b/plugins/ContactsPlus/src/contacts.h @@ -26,24 +26,12 @@ #include <windows.h>
#include <commctrl.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <crtdbg.h>
#include <malloc.h>
#include <time.h>
-//!!this is fake - this plugin maintains backward compatibility internally
-#define MIRANDA_VER 0x0A00
-
#include "newpluginapi.h"
-#include "m_system.h"
-#include "m_protocols.h"
#include "m_protosvc.h"
#include "m_database.h"
-#include "m_utils.h"
#include "m_langpack.h"
#include "m_skin.h"
#include "m_clist.h"
@@ -53,22 +41,16 @@ #include "m_history.h"
#include "m_userinfo.h"
#include "m_button.h"
-#include "m_contacts.h"
#include "m_message.h"
-#include "statusmodes.h"
#include "win2k.h"
#include "resource.h"
-
+#include "Version.h"
#include "utils.h"
#include "send.h"
#include "receive.h"
#define MODULENAME "SendReceiveContacts"
-
#define MS_CONTACTS_SEND "ContactsTransfer/SendContacts"
#define MS_CONTACTS_RECEIVE "ContactsTransfer/ReceiveContacts"
-
-// Global Variables
-extern int g_UnicodeCore;
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index c90ca712f0..a7e3855232 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -45,17 +45,15 @@ HANDLE hHookPreBuildContactMenu = NULL; HANDLE hContactMenuItem = NULL;
-int g_UnicodeCore;
-
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
- "Send/Receive Contacts+",
- PLUGIN_MAKE_VERSION(1,5,2,0),
- "Allows you to send and receive contacts.",
- "Joe Kucera, Todor Totev",
- "jokusoftware@miranda-im.org",
- "(C) 2004-2008 Joe Kucera, Original Code (C) 2002 Dominus Procellarum",
- "http://miranda-ng.org/",
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
UNICODE_AWARE,
// {0324785E-74CE-4600-B781-851773B3EFC5}
{0x0324785E, 0x74CE, 0x4600, {0xB7, 0x81, 0x85, 0x17, 0x73, 0xB3, 0xEF, 0xC5}}
@@ -94,8 +92,7 @@ static int HookDBEventAdded(WPARAM wParam, LPARAM lParam) _snprintfT(caToolTip, 64, "%s %s", SRCTranslateT("Contacts received from", tmp), (TCHAR*)GetContactDisplayNameT(hContact));
cle.ptszTooltip = caToolTip;
- if (g_UnicodeCore)
- cle.flags |= CLEF_UNICODE;
+ cle.flags |= CLEF_UNICODE;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
return 0; //continue processing by other hooks
@@ -171,8 +168,7 @@ static int HookModulesLoaded(WPARAM wParam, LPARAM lParam) mi.ptszName = SRCTranslateT("Contacts", tmp);
mi.position = -2000009990; //position in menu
mi.flags = CMIF_KEEPUNTRANSLATED;
- if (g_UnicodeCore)
- mi.flags |= CMIF_UNICODE;
+ mi.flags |= CMIF_UNICODE;
mi.pszService = MS_CONTACTS_SEND;
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS));
hContactMenuItem = Menu_AddContactMenuItem(&mi);
@@ -251,9 +247,7 @@ extern "C" __declspec(dllexport) int Load(void) InitCommonControls();
InitI18N();
- g_UnicodeCore = true;
-
- //init hooks
+ //init hooks
hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, HookModulesLoaded);
hHookDBEventAdded = HookEvent(ME_DB_EVENT_ADDED, HookDBEventAdded);
hHookContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, HookContactDeleted);
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index d590a3b37b..bd963013ee 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -115,7 +115,7 @@ static void RebuildGroupCombo(HWND hwndDlg) {
itoa(groupId, caGroupId, 10);
TCHAR* szGroup = DBGetContactSettingStringT(NULL, "CListGroups", caGroupId, NULL);
- int nPrefix = g_UnicodeCore ? sizeof(WCHAR) : sizeof(char);
+ int nPrefix = sizeof(WCHAR);
if (!szGroup) break;
int nIndex = SendMessageT(hGroupsCombo, CB_ADDSTRING, 0, (LPARAM)szGroup + nPrefix);
SendMessageT(hGroupsCombo, CB_SETITEMDATA, nIndex, groupId+1);
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index c51aa9e37f..2fc25c280e 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -63,7 +63,7 @@ void __fastcall SAFE_FREE(void** p) TCHAR *GetContactDisplayNameT(HANDLE hContact)
{
- return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, g_UnicodeCore ? GCDNF_UNICODE : 0);
+ return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_UNICODE);
}
char *GetContactUID(HANDLE hContact, int bTchar)
@@ -112,7 +112,7 @@ char *GetContactUID(HANDLE hContact, int bTchar) TCHAR* MirandaStatusToStringT(int mirandaStatus)
{
- return (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, mirandaStatus, g_UnicodeCore ? GSMDF_UNICODE : 0);
+ return (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, mirandaStatus, GSMDF_UNICODE);
}
int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSetting, DBVARIANT *dbv)
@@ -126,39 +126,21 @@ int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSe TCHAR* DBGetContactSettingStringT(HANDLE hContact, const char *szModule, const char* szSetting, TCHAR* szDef)
{
- DBVARIANT dbv = {DBVT_DELETED};
- TCHAR* szRes;
+ DBVARIANT dbv = {DBVT_DELETED};
+ TCHAR* szRes;
- if (g_UnicodeCore)
- {
- if (DBGetContactSettingWString(hContact, szModule, szSetting, &dbv))
- return strdupT(szDef);
+ if (DBGetContactSettingWString(hContact, szModule, szSetting, &dbv))
+ return strdupT(szDef);
- szRes = strdupT(dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- else
- {
- if (DBGetContactSettingT(hContact, szModule, szSetting, &dbv))
- return strdupT(szDef);
+ szRes = strdupT(dbv.ptszVal);
+ DBFreeVariant(&dbv);
- if (dbv.type == DBVT_ASCIIZ)
- szRes = ansi_to_tchar(dbv.pszVal);
- else if (dbv.type == DBVT_UTF8)
- szRes = utf8_to_tchar((unsigned char*)dbv.pszVal);
- else
- szRes = strdupT(szDef);
- DBFreeVariant(&dbv);
- }
- return szRes;
+ return szRes;
}
int DBWriteContactSettingStringT(HANDLE hContact, const char *szModule, const char* szSetting, TCHAR* szValue)
{
- if (g_UnicodeCore)
- return DBWriteContactSettingWString(hContact, szModule, szSetting, (WCHAR*)szValue);
- else
- return DBWriteContactSettingString(hContact, szModule, szSetting, (char*)szValue);
+ return DBWriteContactSettingWString(hContact, szModule, szSetting, (WCHAR*)szValue);
}
@@ -270,42 +252,23 @@ void EnableDlgItem(HWND hwndDlg, UINT control, int state) LRESULT SendMessageT(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
- if (g_UnicodeCore)
- return SendMessageW(hWnd, Msg, wParam, lParam);
- else
- return SendMessageA(hWnd, Msg, wParam, lParam);
+ return SendMessageW(hWnd, Msg, wParam, lParam);
}
TCHAR* GetWindowTextT(HWND hWnd)
{
- if (g_UnicodeCore)
- {
- int len = GetWindowTextLengthW(hWnd) + 1;
- WCHAR* txt = (WCHAR*)malloc(len * sizeof(WCHAR));
- if (txt) {
- txt[0] = 0;
- GetWindowTextW(hWnd, txt, len);
- }
- return (TCHAR*)txt;
- }
- else
- {
- int len = GetWindowTextLengthA(hWnd) + 1;
- char* txt = (char*)malloc(len * sizeof(char));
- if (txt) {
- txt[0] = 0;
- GetWindowTextA(hWnd, txt, len);
- }
- return (TCHAR*)txt;
- }
+ int len = GetWindowTextLengthW(hWnd) + 1;
+ WCHAR* txt = (WCHAR*)malloc(len * sizeof(WCHAR));
+ if (txt) {
+ txt[0] = 0;
+ GetWindowTextW(hWnd, txt, len);
+ }
+ return (TCHAR*)txt;
}
BOOL SetWindowTextT(HWND hWnd, TCHAR* lpString)
{
- if (g_UnicodeCore)
- return SetWindowTextW(hWnd, (WCHAR*)lpString);
- else
- return SetWindowTextA(hWnd, lpString);
+ return SetWindowTextW(hWnd, (WCHAR*)lpString);
}
TCHAR* GetDlgItemTextT(HWND hDlg, int nIDDlgItem)
@@ -320,15 +283,12 @@ BOOL SetDlgItemTextT(HWND hDlg, int nIDDlgItem, TCHAR* lpString) HWND CreateDialogParamT(HINSTANCE hInstance, const char* szTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
{
- if (g_UnicodeCore)
- return CreateDialogParamW(hInstance, (LPCWSTR)szTemplate, hWndParent, lpDialogFunc, dwInitParam);
- else
- return CreateDialogParamA(hInstance, szTemplate, hWndParent, lpDialogFunc, dwInitParam);
+ return CreateDialogParamW(hInstance, (LPCWSTR)szTemplate, hWndParent, lpDialogFunc, dwInitParam);
}
int ListView_InsertColumnT(HWND hwnd, int iCol, const LPLVCOLUMN pcol)
{
- return SendMessageT(hwnd, g_UnicodeCore ? LVM_INSERTCOLUMNW : LVM_INSERTCOLUMNA, (WPARAM)iCol, (LPARAM)pcol);
+ return SendMessageT(hwnd, LVM_INSERTCOLUMNW, (WPARAM)iCol, (LPARAM)pcol);
}
void ListView_SetItemTextT(HWND hwnd, int i, int iSubItem, TCHAR* pszText)
@@ -337,102 +297,67 @@ void ListView_SetItemTextT(HWND hwnd, int i, int iSubItem, TCHAR* pszText) lvi.iSubItem = iSubItem;
lvi.pszText = pszText;
- SendMessageT(hwnd, g_UnicodeCore ? LVM_SETITEMTEXTW : LVM_SETITEMTEXTA, (WPARAM)i, (LPARAM)&lvi);
+ SendMessageT(hwnd, LVM_SETITEMTEXTW, (WPARAM)i, (LPARAM)&lvi);
}
size_t __fastcall strlenT(const TCHAR *string)
{
- if (string)
- {
- if (g_UnicodeCore)
- return wcslen((WCHAR*)string);
- else
- return strlen((char*)string);
- }
- return 0;
+ if (string)
+ return wcslen((WCHAR*)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;
+ if (string)
+ return (TCHAR*)wcsdup((WCHAR*)string);
+ return NULL;
}
int __fastcall strcmpT(const TCHAR *string1, const TCHAR *string2)
{
- if (!string1 || !string2) return 1;
+ if (!string1 || !string2) return 1;
- if (g_UnicodeCore)
- return wcscmp((WCHAR*)string1, (WCHAR*)string2);
- else
- return strcmp((char*)string1, (char*)string2);
+ return wcscmp((WCHAR*)string1, (WCHAR*)string2);
}
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;
+ if (src)
+ return (TCHAR*)wcscpy((WCHAR*)dest, (WCHAR*)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;
+ if (src)
+ return (TCHAR*)wcsncpy((WCHAR*)dest, (WCHAR*)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;
+ if (src)
+ return (TCHAR*)wcscat((WCHAR*)dest, (WCHAR*)src);
+ return dest;
}
int _snprintfT(TCHAR *buffer, size_t count, const char* fmt, ...)
{
- va_list va;
- int len;
+ va_list va;
+ int len;
- va_start(va, fmt);
- if (g_UnicodeCore)
- {
- TCHAR* wfmt = ansi_to_tchar(fmt);
+ va_start(va, fmt);
+ TCHAR* wfmt = ansi_to_tchar(fmt);
- len = _vsnwprintf((WCHAR*)buffer, count-1, (WCHAR*)wfmt, va);
- ((WCHAR*)buffer)[count-1] = 0;
- SAFE_FREE((void**)&wfmt);
- }
- else
- {
- len = _vsnprintf((char*)buffer, count-1, fmt, va);
- ((char*)buffer)[count-1] = 0;
- }
- va_end(va);
- return len;
+ len = _vsnwprintf((WCHAR*)buffer, count-1, (WCHAR*)wfmt, va);
+ ((WCHAR*)buffer)[count-1] = 0;
+ SAFE_FREE((void**)&wfmt);
+
+ va_end(va);
+ return len;
}
TCHAR* __fastcall SRCTranslateT(const char* src, const WCHAR* unibuf)
@@ -444,8 +369,6 @@ TCHAR* __fastcall SRCTranslateT(const char* src, const WCHAR* unibuf) return "";
}
- if (g_UnicodeCore)
- { // we give WCHAR
WCHAR *unicode;
int wchars, err;
@@ -465,9 +388,6 @@ TCHAR* __fastcall SRCTranslateT(const char* src, const WCHAR* unibuf) if (err != wchars) return NULL; // Failure
return (TCHAR*)TranslateW(unicode);
- }
- else
- return (TCHAR*)Translate(src);
}
static BOOL bHasCP_UTF8 = FALSE;
@@ -746,8 +666,6 @@ static int utf8_decode(const unsigned char *from, char **to) TCHAR* ansi_to_tchar(const char* src, int codepage)
{
- if (g_UnicodeCore)
- {
WCHAR *unicode;
int wchars, err;
@@ -766,15 +684,10 @@ TCHAR* ansi_to_tchar(const char* src, int codepage) }
return (TCHAR*)unicode;
- }
- else
- return strdupT((TCHAR*)src);
}
char* tchar_to_ansi(const TCHAR* src)
{
- if (g_UnicodeCore)
- {
char *ansi;
int chars;
int err;
@@ -793,22 +706,9 @@ char* tchar_to_ansi(const TCHAR* src) 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 |