summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/AvatarHistory/AvatarHistory_10.vcxproj2
-rw-r--r--plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters6
-rw-r--r--plugins/AvatarHistory/AvatarHistory_11.vcxproj2
-rw-r--r--plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters6
-rw-r--r--plugins/AvatarHistory/src/AvatarDlg.cpp3
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.cpp6
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.h46
-rw-r--r--plugins/AvatarHistory/src/options.cpp11
-rw-r--r--plugins/AvatarHistory/src/popup.cpp11
-rw-r--r--plugins/AvatarHistory/src/popup.h22
-rw-r--r--plugins/AvatarHistory/src/utils.cpp16
11 files changed, 46 insertions, 85 deletions
diff --git a/plugins/AvatarHistory/AvatarHistory_10.vcxproj b/plugins/AvatarHistory/AvatarHistory_10.vcxproj
index 639d158fc3..0a40846aeb 100644
--- a/plugins/AvatarHistory/AvatarHistory_10.vcxproj
+++ b/plugins/AvatarHistory/AvatarHistory_10.vcxproj
@@ -203,8 +203,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\AvatarHistory.h" />
- <ClInclude Include="..\utils\mir_buffer.h" />
- <ClInclude Include="..\utils\mir_memory.h" />
<ClInclude Include="..\utils\mir_options.h" />
<ClInclude Include="src\popup.h" />
<ClInclude Include="src\resource.h" />
diff --git a/plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters b/plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters
index 3402336acd..1f951efcaf 100644
--- a/plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters
+++ b/plugins/AvatarHistory/AvatarHistory_10.vcxproj.filters
@@ -44,12 +44,6 @@
<ClInclude Include="src\AvatarHistory.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\utils\mir_buffer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\utils\mir_memory.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\utils\mir_options.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/AvatarHistory/AvatarHistory_11.vcxproj b/plugins/AvatarHistory/AvatarHistory_11.vcxproj
index 0f27d9cef4..e02022e925 100644
--- a/plugins/AvatarHistory/AvatarHistory_11.vcxproj
+++ b/plugins/AvatarHistory/AvatarHistory_11.vcxproj
@@ -207,8 +207,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\AvatarHistory.h" />
- <ClInclude Include="..\utils\mir_buffer.h" />
- <ClInclude Include="..\utils\mir_memory.h" />
<ClInclude Include="..\utils\mir_options.h" />
<ClInclude Include="src\popup.h" />
<ClInclude Include="src\resource.h" />
diff --git a/plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters b/plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters
index 3402336acd..1f951efcaf 100644
--- a/plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters
+++ b/plugins/AvatarHistory/AvatarHistory_11.vcxproj.filters
@@ -44,12 +44,6 @@
<ClInclude Include="src\AvatarHistory.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\utils\mir_buffer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\utils\mir_memory.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\utils\mir_options.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index 8e1d256892..d71bbc1880 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -20,7 +20,6 @@ Avatar History Plugin
#include "AvatarHistory.h"
-extern HINSTANCE hInst;
HANDLE hMenu = NULL;
DWORD WINAPI AvatarDialogThread(LPVOID param);
static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
@@ -86,7 +85,7 @@ int OpenAvatarDialog(HANDLE hContact, char* fn)
}
else
{
- MultiByteToWideChar(CP_ACP, 0, fn, -1, avdlg->fn, MAX_REGS(avdlg->fn));
+ MultiByteToWideChar(CP_ACP, 0, fn, -1, avdlg->fn, SIZEOF(avdlg->fn));
}
CloseHandle(CreateThread(NULL, 0, AvatarDialogThread, (LPVOID)avdlg, 0, &dwId));
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp
index 5248c3f1a1..4087b1fec5 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.cpp
+++ b/plugins/AvatarHistory/src/AvatarHistory.cpp
@@ -181,7 +181,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
TCHAR *file = GetCachedAvatar(proto, hash);
if (file != NULL) {
- lstrcpyn(history_filename, file, MAX_REGS(history_filename));
+ lstrcpyn(history_filename, file, SIZEOF(history_filename));
mir_free(file);
}
else {
@@ -190,7 +190,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
else
GetProtocolFolder(history_filename, proto);
- mir_sntprintf(history_filename, MAX_REGS(history_filename),
+ mir_sntprintf(history_filename, SIZEOF(history_filename),
_T("%s\\%s"), history_filename, hash);
if (CopyImageFile(avatar->filename, history_filename))
@@ -242,7 +242,7 @@ static int PreShutdown(WPARAM wParam, LPARAM lParam)
static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- mir_sntprintf(basedir, MAX_REGS(basedir), _T("%s\\Avatars History"), profilePath);
+ mir_sntprintf(basedir, SIZEOF(basedir), _T("%s\\Avatars History"), profilePath);
hFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatar History"),
PROFILE_PATHT _T("\\") CURRENT_PROFILET _T("\\Avatars History"));
diff --git a/plugins/AvatarHistory/src/AvatarHistory.h b/plugins/AvatarHistory/src/AvatarHistory.h
index 504549f28b..af3986890a 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.h
+++ b/plugins/AvatarHistory/src/AvatarHistory.h
@@ -1,12 +1,7 @@
#define _CRT_SECURE_NO_WARNINGS
-#define MIRANDA_VER 0x0A00
-#include <tchar.h>
+
#include <windows.h>
-#include <stdio.h>
#include <time.h>
-#include <strsafe.h>
-#include <commctrl.h> //for ImageList_*
-#include <prsht.h>
#include <ShObjIdl.h>
#include <ShlGuid.h>
@@ -15,12 +10,10 @@
#include <m_skin.h>
#include <m_avatars.h>
#include <m_database.h>
-#include <m_system.h>
#include <m_protosvc.h>
#include <m_contacts.h>
#include <m_popup.h>
#include <m_options.h>
-#include <m_utils.h>
#include <m_langpack.h>
#include <m_history.h>
#include <m_imgsrvc.h>
@@ -29,16 +22,22 @@
#include <m_folders.h>
#include <m_metacontacts.h>
-#include "m_avatarhist.h"
+#include <m_avatarhist.h>
+
+#include "../utils/mir_options.h"
#include "resource.h"
#include "Version.h"
+#include "popup.h"
// Globals
extern HINSTANCE hInst;
extern HANDLE hMenu;
extern DWORD mirVer;
extern HANDLE hAvatarWindowsList;
+extern Options opts;
+extern HANDLE hFolder;
+extern TCHAR basedir[];
#define MODULE_NAME "AvatarHistory"
@@ -79,8 +78,6 @@ void ConvertToFilename(TCHAR *str, size_t size);
void CreateOldStyleShortcut(HANDLE hContact, TCHAR *history_filename);
BOOL CreateShortcut(TCHAR *file, TCHAR *shortcut);
-#define MAX_REGS(_A_) ( sizeof(_A_) / sizeof(_A_[0]) )
-
#define POPUP_ACTION_DONOTHING 0
#define POPUP_ACTION_CLOSEPOPUP 1
#define POPUP_ACTION_OPENAVATARHISTORY 2
@@ -89,30 +86,3 @@ BOOL CreateShortcut(TCHAR *file, TCHAR *shortcut);
#define POPUP_DELAY_DEFAULT 0
#define POPUP_DELAY_CUSTOM 1
#define POPUP_DELAY_PERMANENT 2
-
-
-struct Options {
- // Log
- BOOL log_per_contact_folders;
- BOOL log_keep_same_folder;
- BOOL log_store_as_hash;
-
- // Popup
- BOOL popup_show_changed;
- TCHAR popup_changed[1024];
- BOOL popup_show_removed;
- TCHAR popup_removed[1024];
- WORD popup_delay_type;
- WORD popup_timeout;
- BYTE popup_use_win_colors;
- BYTE popup_use_default_colors;
- COLORREF popup_bkg_color;
- COLORREF popup_text_color;
- WORD popup_left_click_action;
- WORD popup_right_click_action;
-};
-
-extern Options opts;
-
-
-#include "popup.h"
diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp
index a8d605e1f5..73940baeee 100644
--- a/plugins/AvatarHistory/src/options.cpp
+++ b/plugins/AvatarHistory/src/options.cpp
@@ -19,7 +19,6 @@ Avatar History Plugin
*/
#include "AvatarHistory.h"
-#include "../utils/mir_options.h"
Options opts;
@@ -51,7 +50,7 @@ static OptPageControl popupsControls[] = {
static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- return SaveOptsDlgProc(optionsControls, MAX_REGS(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(optionsControls, SIZEOF(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
// Popup options dialog procedure /////////////////////////////////////////////////////////////////
@@ -101,7 +100,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show contact history"));
// Needs to be called here in this case
- SaveOptsDlgProc(popupsControls, MAX_REGS(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ SaveOptsDlgProc(popupsControls, SIZEOF(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
PopupsEnableDisableCtrls(hwndDlg);
return TRUE;
@@ -140,7 +139,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
}
}
- return SaveOptsDlgProc(popupsControls, MAX_REGS(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(popupsControls, SIZEOF(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
// Functions //////////////////////////////////////////////////////////////////////////////////////
@@ -170,8 +169,8 @@ int OptInit(WPARAM wParam, LPARAM lParam)
void LoadOptions()
{
- LoadOpts(optionsControls, MAX_REGS(optionsControls), MODULE_NAME);
- LoadOpts(popupsControls, MAX_REGS(popupsControls), MODULE_NAME);
+ LoadOpts(optionsControls, SIZEOF(optionsControls), MODULE_NAME);
+ LoadOpts(popupsControls, SIZEOF(popupsControls), MODULE_NAME);
opts.log_per_contact_folders = db_get_b(NULL, MODULE_NAME, "LogPerContactFolders", 0);
opts.log_keep_same_folder = db_get_b(NULL, MODULE_NAME, "LogKeepSameFolder", 0);
diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp
index 8338eabcf4..ee46cfb67b 100644
--- a/plugins/AvatarHistory/src/popup.cpp
+++ b/plugins/AvatarHistory/src/popup.cpp
@@ -17,11 +17,8 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
#include "AvatarHistory.h"
-
-
// Prototypes /////////////////////////////////////////////////////////////////////////////////////
#define WMU_ACTION (WM_USER + 1)
@@ -108,13 +105,13 @@ void ShowPopupEx(HANDLE hContact, const TCHAR *title, const TCHAR *description,
((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon;
if (title != NULL)
- lstrcpyn(ppd.lptzContactName, title, MAX_REGS(ppd.lptzContactName));
+ lstrcpyn(ppd.lptzContactName, title, SIZEOF(ppd.lptzContactName));
else if (hContact != NULL)
- lstrcpyn(ppd.lptzContactName, (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR),
- MAX_REGS(ppd.lptzContactName));
+ lstrcpyn(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR),
+ SIZEOF(ppd.lptzContactName));
if (description != NULL)
- lstrcpyn(ppd.lptzText, description, MAX_REGS(ppd.lptzText));
+ lstrcpyn(ppd.lptzText, description, SIZEOF(ppd.lptzText));
if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST)
{
diff --git a/plugins/AvatarHistory/src/popup.h b/plugins/AvatarHistory/src/popup.h
index 2944ba0895..706d5824e3 100644
--- a/plugins/AvatarHistory/src/popup.h
+++ b/plugins/AvatarHistory/src/popup.h
@@ -21,8 +21,26 @@ Boston, MA 02111-1307, USA.
#ifndef __POPUP_H__
# define __POPUP_H__
-#include <windows.h>
-
+struct Options {
+ // Log
+ BOOL log_per_contact_folders;
+ BOOL log_keep_same_folder;
+ BOOL log_store_as_hash;
+
+ // Popup
+ BOOL popup_show_changed;
+ TCHAR popup_changed[1024];
+ BOOL popup_show_removed;
+ TCHAR popup_removed[1024];
+ WORD popup_delay_type;
+ WORD popup_timeout;
+ BYTE popup_use_win_colors;
+ BYTE popup_use_default_colors;
+ COLORREF popup_bkg_color;
+ COLORREF popup_text_color;
+ WORD popup_left_click_action;
+ WORD popup_right_click_action;
+};
// Initializations needed by popups
void InitPopups();
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp
index 69122d6621..a745603a15 100644
--- a/plugins/AvatarHistory/src/utils.cpp
+++ b/plugins/AvatarHistory/src/utils.cpp
@@ -24,9 +24,6 @@ Avatar History Plugin
#include "AvatarHistory.h"
-extern HANDLE hFolder;
-extern TCHAR basedir[];
-
BOOL ProtocolEnabled(const char *proto)
{
if (proto == NULL)
@@ -102,10 +99,7 @@ void ErrorExit(HANDLE hContact,LPTSTR lpszFunction)
lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
(lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 40) * sizeof(TCHAR));
- StringCchPrintf((LPTSTR)lpDisplayBuf,
- LocalSize(lpDisplayBuf) / sizeof(TCHAR),
- TEXT("%s failed with error %d: %s"),
- lpszFunction, dw, lpMsgBuf);
+ mir_sntprintf((TCHAR*)lpDisplayBuf, lstrlen((TCHAR*)lpDisplayBuf), _T("%s failed with error %d: %s"), lpszFunction, dw, lpMsgBuf);
ShowDebugPopup(hContact,TEXT("Error"), (LPCTSTR)lpDisplayBuf);
LocalFree(lpMsgBuf);
@@ -184,7 +178,7 @@ TCHAR* GetContactFolder(TCHAR *fn, HANDLE hContact)
char *proto = GetContactProto(hContact);
GetProtocolFolder(fn, proto);
- GetUIDFromHContact(hContact, uin, MAX_REGS(uin));
+ GetUIDFromHContact(hContact, uin, SIZEOF(uin));
mir_sntprintf(fn, MAX_PATH, _T("%s\\%s"), fn, uin);
if (!CreateDirectory(fn, NULL))
ErrorExit(hContact,_T("CreateDirectory"));
@@ -219,7 +213,7 @@ void CreateOldStyleShortcut(HANDLE hContact, TCHAR *history_filename)
GetOldStyleAvatarName(shortcut, hContact);
- mir_sntprintf(shortcut, MAX_REGS(shortcut), _T("%s.%s.lnk"), shortcut,
+ mir_sntprintf(shortcut, SIZEOF(shortcut), _T("%s.%s.lnk"), shortcut,
GetExtension(history_filename));
if (!CreateShortcut(history_filename, shortcut))
@@ -254,7 +248,7 @@ TCHAR * GetCachedAvatar(char *proto, TCHAR *hash)
else
GetProtocolFolder(file, proto);
- mir_sntprintf(search, MAX_REGS(search), _T("%s\\%s.*"), file, hash);
+ mir_sntprintf(search, SIZEOF(search), _T("%s\\%s.*"), file, hash);
WIN32_FIND_DATA finddata;
HANDLE hFind = FindFirstFile(search, &finddata);
@@ -271,7 +265,7 @@ TCHAR * GetCachedAvatar(char *proto, TCHAR *hash)
|| !lstrcmpi(&finddata.cFileName[len-4], _T(".jpg"))
|| !lstrcmpi(&finddata.cFileName[len-5], _T(".jpeg"))))
{
- mir_sntprintf(file, MAX_REGS(file), _T("%s\\%s"), file, finddata.cFileName);
+ mir_sntprintf(file, SIZEOF(file), _T("%s\\%s"), file, finddata.cFileName);
ret = mir_tstrdup(file);
break;
}