summaryrefslogtreecommitdiff
path: root/plugins/WhenWasIt
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
commit6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch)
tree2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/WhenWasIt
parenta61c8728b379057fe7f0a0d86fe0b037598229dd (diff)
less TCHARs:
- TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/WhenWasIt')
-rw-r--r--plugins/WhenWasIt/src/WhenWasIt.cpp6
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp86
-rw-r--r--plugins/WhenWasIt/src/hooked_events.cpp4
-rw-r--r--plugins/WhenWasIt/src/icons.cpp6
-rw-r--r--plugins/WhenWasIt/src/notifiers.cpp36
-rw-r--r--plugins/WhenWasIt/src/notifiers.h4
-rw-r--r--plugins/WhenWasIt/src/services.cpp68
-rw-r--r--plugins/WhenWasIt/src/services.h10
-rw-r--r--plugins/WhenWasIt/src/utils.cpp12
-rw-r--r--plugins/WhenWasIt/src/utils.h8
10 files changed, 118 insertions, 122 deletions
diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp
index 52a0b587b7..cb5da2f666 100644
--- a/plugins/WhenWasIt/src/WhenWasIt.cpp
+++ b/plugins/WhenWasIt/src/WhenWasIt.cpp
@@ -74,7 +74,7 @@ extern "C" int __declspec(dllexport) Load(void)
CMenuItem mi;
mi.position = 10000000;
- mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Birthdays (When Was It)"), mi.position);
+ mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Birthdays (When Was It)"), mi.position);
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "95D842AE-FCCE-43C9-87E3-C28546B7E00E");
SET_UID(mi, 0x4efbd640, 0xabbd, 0x470e, 0x9a, 0xa, 0x64, 0x76, 0x1a, 0x74, 0xf3, 0x24);
@@ -131,8 +131,8 @@ extern "C" int __declspec(dllexport) Load(void)
hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS;
Hotkey_Register(&hotkey);
- SkinAddNewSoundExT(BIRTHDAY_NEAR_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday near"));
- SkinAddNewSoundExT(BIRTHDAY_TODAY_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday today"));
+ SkinAddNewSoundExT(BIRTHDAY_NEAR_SOUND, LPGENW("WhenWasIt"), LPGENW("Birthday near"));
+ SkinAddNewSoundExT(BIRTHDAY_TODAY_SOUND, LPGENW("WhenWasIt"), LPGENW("Birthday today"));
Log("%s", "Leaving function " __FUNCTION__);
return 0;
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index d3658eb3a8..3b269468c9 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -29,23 +29,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define UPCOMING_TIMER_ID 1002
-const TCHAR *szShowAgeMode[] = { LPGENT("Upcoming age"), LPGENT("Current age") };
+const wchar_t *szShowAgeMode[] = { LPGENW("Upcoming age"), LPGENW("Current age") };
const int cShowAgeMode = sizeof(szShowAgeMode) / sizeof(szShowAgeMode[0]);
-const TCHAR *szSaveModule[] = { LPGENT("UserInfo module"), LPGENT("Protocol module"), LPGENT("mBirthday module") };
+const wchar_t *szSaveModule[] = { LPGENW("UserInfo module"), LPGENW("Protocol module"), LPGENW("mBirthday module") };
const int cSaveModule = sizeof(szSaveModule) / sizeof(szSaveModule[0]);
-const TCHAR *szPopupClick[] = { LPGENT("Nothing"), LPGENT("Dismiss"), LPGENT("Message window") };
+const wchar_t *szPopupClick[] = { LPGENW("Nothing"), LPGENW("Dismiss"), LPGENW("Message window") };
const int cPopupClick = sizeof(szPopupClick) / sizeof(szPopupClick[0]);
-const TCHAR *szNotifyFor[] = { LPGENT("All contacts"), LPGENT("All contacts except hidden ones"), LPGENT("All contacts except ignored ones"), LPGENT("All contacts except hidden and ignored ones") };
+const wchar_t *szNotifyFor[] = { LPGENW("All contacts"), LPGENW("All contacts except hidden ones"), LPGENW("All contacts except ignored ones"), LPGENW("All contacts except hidden and ignored ones") };
const int cNotifyFor = sizeof(szNotifyFor) / sizeof(szNotifyFor[0]);
#define MIN_BIRTHDAYS_WIDTH 200
#define MIN_BIRTHDAYS_HEIGHT 200
#include "commctrl.h"
-void CreateToolTip(HWND target, TCHAR* tooltip, LPARAM width)
+void CreateToolTip(HWND target, wchar_t* tooltip, LPARAM width)
{
HWND hwndToolTip = CreateWindow(TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, target, NULL, NULL, NULL);
@@ -121,7 +121,7 @@ SIZE GetControlTextSize(HWND hCtrl)
HFONT font = (HFONT)SendMessage(hCtrl, WM_GETFONT, 0, 0);
HFONT oldFont = (HFONT)SelectObject(hDC, font);
const size_t maxSize = 2048;
- TCHAR buffer[maxSize];
+ wchar_t buffer[maxSize];
SIZE size;
GetWindowText(hCtrl, buffer, _countof(buffer));
GetTextExtentPoint32(hDC, buffer, (int)mir_tstrlen(buffer), &size);
@@ -141,17 +141,17 @@ int EnlargeControl(HWND hCtrl, HWND, SIZE oldSize)
return 0;
}
-TCHAR *strtrim(TCHAR *str)
+wchar_t *strtrim(wchar_t *str)
{
size_t i = 0;
size_t len = mir_tstrlen(str);
- while ((i < len) && (str[i] == _T(' '))) { i++; }
+ while ((i < len) && (str[i] == ' ')) { i++; }
if (i) {
memmove(str, str + i, len - i + 1);
len -= i;
}
- while ((len > 0) && (str[--len] == _T(' ')))
+ while ((len > 0) && (str[--len] == ' '))
str[len] = 0;
return str;
@@ -190,18 +190,18 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
CreateToolTip(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), TranslateT("Set popup delay when notifying of upcoming birthdays.\nFormat: default delay [ | delay for birthdays occurring today]"), 400);
- TCHAR buffer[1024];
- _itot(commonData.daysInAdvance, buffer, 10);
+ wchar_t buffer[1024];
+ _itow(commonData.daysInAdvance, buffer, 10);
SetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer);
- _itot(commonData.checkInterval, buffer, 10);
+ _itow(commonData.checkInterval, buffer, 10);
SetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer);
mir_sntprintf(buffer, L"%d|%d", commonData.popupTimeout, commonData.popupTimeoutToday);
SetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer);
- _itot(commonData.cSoundNearDays, buffer, 10);
+ _itow(commonData.cSoundNearDays, buffer, 10);
SetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer);
- _itot(commonData.cDlgTimeout, buffer, 10);
+ _itow(commonData.cDlgTimeout, buffer, 10);
SetDlgItemText(hWnd, IDC_DLG_TIMEOUT, buffer);
- _itot(commonData.daysAfter, buffer, 10);
+ _itow(commonData.daysAfter, buffer, 10);
SetDlgItemText(hWnd, IDC_DAYS_AFTER, buffer);
CheckDlgButton(hWnd, IDC_OPENINBACKGROUND, (commonData.bOpenInBackground) ? BST_CHECKED : BST_UNCHECKED);
@@ -304,47 +304,47 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
commonData.bOpenInBackground = IsDlgButtonChecked(hWnd, IDC_OPENINBACKGROUND);
{
const int maxSize = 1024;
- TCHAR buffer[maxSize];
+ wchar_t buffer[maxSize];
GetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer, _countof(buffer));
- TCHAR *stop = NULL;
- commonData.daysInAdvance = _tcstol(buffer, &stop, 10);
+ wchar_t *stop = NULL;
+ commonData.daysInAdvance = wcstol(buffer, &stop, 10);
if (*stop) { commonData.daysInAdvance = DAYS_TO_NOTIFY; }
GetDlgItemText(hWnd, IDC_DAYS_AFTER, buffer, _countof(buffer));
- commonData.daysAfter = _tcstol(buffer, &stop, 10);
+ commonData.daysAfter = wcstol(buffer, &stop, 10);
if (*stop) { commonData.daysAfter = DAYS_TO_NOTIFY_AFTER; }
GetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer, _countof(buffer));
- commonData.checkInterval = _ttol(buffer);
+ commonData.checkInterval = _wtol(buffer);
if (!commonData.checkInterval) { commonData.checkInterval = CHECK_INTERVAL; }
GetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer, _countof(buffer));
- TCHAR *pos;
- pos = _tcschr(buffer, _T('|'));
+ wchar_t *pos;
+ pos = wcschr(buffer, '|');
if (pos) {
- TCHAR tmp[128];
+ wchar_t tmp[128];
*pos = 0;
mir_tstrcpy(tmp, buffer);
strtrim(tmp);
- commonData.popupTimeout = _ttol(tmp);
+ commonData.popupTimeout = _wtol(tmp);
mir_tstrcpy(tmp, pos + 1);
strtrim(tmp);
- commonData.popupTimeoutToday = _ttol(tmp);
+ commonData.popupTimeoutToday = _wtol(tmp);
}
- else commonData.popupTimeout = commonData.popupTimeoutToday = _ttol(buffer);
+ else commonData.popupTimeout = commonData.popupTimeoutToday = _wtol(buffer);
GetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer, _countof(buffer));
- //cSoundNearDays = _ttol(buffer);
- commonData.cSoundNearDays = _tcstol(buffer, &stop, 10);
+ //cSoundNearDays = _wtol(buffer);
+ commonData.cSoundNearDays = wcstol(buffer, &stop, 10);
if (*stop) { commonData.cSoundNearDays = BIRTHDAY_NEAR_DEFAULT_DAYS; }
GetDlgItemText(hWnd, IDC_DLG_TIMEOUT, buffer, _countof(buffer));
- commonData.cDlgTimeout = _tcstol(buffer, &stop, 10);
+ commonData.cDlgTimeout = wcstol(buffer, &stop, 10);
if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
db_set_b(NULL, ModuleName, "IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
@@ -412,11 +412,11 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case WM_SHOWWINDOW:
{
- TCHAR *szTooltipText = TranslateT("Please select the module where you want the date of birth to be saved.\r\n\"UserInfo\" is the default location.\r\nUse \"Protocol module\" to make the data visible in User Details.\n\"mBirthday module\" uses the same module as mBirthday plugin.");
- TCHAR *szCurrentModuleTooltip = NULL;
+ wchar_t *szTooltipText = TranslateT("Please select the module where you want the date of birth to be saved.\r\n\"UserInfo\" is the default location.\r\nUse \"Protocol module\" to make the data visible in User Details.\n\"mBirthday module\" uses the same module as mBirthday plugin.");
+ wchar_t *szCurrentModuleTooltip = NULL;
char *szProto = GetContactProto(hContact);
- TCHAR buffer[2048];
+ wchar_t buffer[2048];
mir_sntprintf(buffer, TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
SetWindowText(hWnd, buffer);
@@ -516,7 +516,7 @@ void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOW
#define NA TranslateT("N/A")
-TCHAR* GetBirthdayModule(int module, MCONTACT)
+wchar_t* GetBirthdayModule(int module, MCONTACT)
{
switch (module) {
case DOB_MBIRTHDAY: return L"mBirthday";
@@ -540,8 +540,8 @@ INT_PTR CALLBACK BirthdaysCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam
{
BirthdaysSortParams params = *(BirthdaysSortParams *)myParam;
const int maxSize = 1024;
- TCHAR text1[maxSize];
- TCHAR text2[maxSize];
+ wchar_t text1[maxSize];
+ wchar_t text2[maxSize];
long value1, value2;
ListView_GetItemText(params.hList, (int)lParam1, params.column, text1, _countof(text1));
ListView_GetItemText(params.hList, (int)lParam2, params.column, text2, _countof(text2));
@@ -549,9 +549,9 @@ INT_PTR CALLBACK BirthdaysCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam
int res = 0;
if ((params.column == 2) || (params.column == 4)) {
- TCHAR *err1, *err2;
- value1 = _tcstol(text1, &err1, 10);
- value2 = _tcstol(text2, &err2, 10);
+ wchar_t *err1, *err2;
+ value1 = wcstol(text1, &err1, 10);
+ value2 = wcstol(text2, &err2, 10);
if ((err1[0]) || (err2[0]))
res = (err1[0]) ? 1 : -1;
@@ -592,7 +592,7 @@ int UpdateBirthdayEntry(HWND hList, MCONTACT hContact, int entry, int bShowAll,
char *szProto = GetContactProto(hContact);
PROTOACCOUNT *pAcc = Proto_GetAccount(szProto);
- TCHAR *ptszAccName = (pAcc == NULL) ? TranslateT("Unknown") : pAcc->tszAccountName;
+ wchar_t *ptszAccName = (pAcc == NULL) ? TranslateT("Unknown") : pAcc->tszAccountName;
LVITEM item = { 0 };
item.mask = LVIF_TEXT | LVIF_PARAM;
@@ -607,7 +607,7 @@ int UpdateBirthdayEntry(HWND hList, MCONTACT hContact, int entry, int bShowAll,
ListView_SetItemText(hList, entry, 1, pcli->pfnGetContactDisplayName(hContact, 0));
- TCHAR buffer[2048];
+ wchar_t buffer[2048];
if ((dtb <= 366) && (dtb >= 0))
mir_sntprintf(buffer, L"%d", dtb);
else
@@ -693,7 +693,7 @@ static LRESULT CALLBACK BirthdaysListSubclassProc(HWND hWnd, UINT msg, WPARAM wP
void SetBirthdaysCount(HWND hWnd)
{
int count = ListView_GetItemCount((GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST)));
- TCHAR title[512];
+ wchar_t title[512];
mir_sntprintf(title, TranslateT("Birthday list (%d)"), count);
SetWindowText(hWnd, title);
}
@@ -879,7 +879,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
case WM_TIMER:
{
const int MAX_SIZE = 512;
- TCHAR buffer[MAX_SIZE];
+ wchar_t buffer[MAX_SIZE];
timeout--;
mir_sntprintf(buffer, (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
SetDlgItemText(hWnd, IDC_CLOSE, buffer);
@@ -913,7 +913,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
item.pszText = data->message;
ListView_InsertItem(hList, &item);
- TCHAR buffer[512];
+ wchar_t buffer[512];
mir_sntprintf(buffer, L"%d", data->age);
ListView_SetItemText(hList, index, 1, buffer);
mir_sntprintf(buffer, L"%d", data->dtb);
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp
index 63f54e866f..d263f72196 100644
--- a/plugins/WhenWasIt/src/hooked_events.cpp
+++ b/plugins/WhenWasIt/src/hooked_events.cpp
@@ -46,8 +46,8 @@ static int OnOptionsInitialise(WPARAM wParam, LPARAM)
odp.position = 100000000;
odp.hInstance = hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_WWI);
- odp.ptszTitle = LPGENT("Birthdays");
- odp.ptszGroup = LPGENT("Contacts");
+ odp.pwszTitle = LPGENW("Birthdays");
+ odp.pwszGroup = LPGENW("Contacts");
odp.groupPosition = 910000000;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = DlgProcOptions;
diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp
index 131d97ed06..5526639a3e 100644
--- a/plugins/WhenWasIt/src/icons.cpp
+++ b/plugins/WhenWasIt/src/icons.cpp
@@ -29,21 +29,21 @@ HANDLE hDTBMore = NULL;
HANDLE hWWIExtraIcons = (HANDLE)-1;
-static HANDLE AddIcon(char *name, char *description, TCHAR *tszPath, int iDefaultIdx)
+static HANDLE AddIcon(char *name, char *description, wchar_t *tszPath, int iDefaultIdx)
{
SKINICONDESC sid = { 0 };
sid.flags = SIDF_PATH_TCHAR;
sid.section.a = LPGEN("WhenWasIt");
sid.description.a = description;
sid.pszName = name;
- sid.defaultFile.t = tszPath;
+ sid.defaultFile.w = tszPath;
sid.iDefaultIndex = -iDefaultIdx;
return IcoLib_AddIcon(&sid);
}
int AddIcons()
{
- TCHAR tszPath[MAX_PATH];
+ wchar_t tszPath[MAX_PATH];
GetModuleFileName(hInstance, tszPath, _countof(tszPath));
hCheckMenu = AddIcon("MenuCheck", LPGEN("Check birthdays menu item"), tszPath, IDI_CHECK);
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp
index 4844dcece1..f7eeb0c150 100644
--- a/plugins/WhenWasIt/src/notifiers.cpp
+++ b/plugins/WhenWasIt/src/notifiers.cpp
@@ -35,12 +35,12 @@ void PopupNotifyNoBirthdays()
FillPopupData(pd, -1);
pd.lchIcon = GetDTBIcon(-1);
- _tcsncpy(pd.lptzContactName, TranslateT("WhenWasIt"), MAX_CONTACTNAME - 1);
- _tcsncpy(pd.lptzText, TranslateT("No upcoming birthdays."), MAX_SECONDLINE - 1);
+ wcsncpy(pd.lptzContactName, TranslateT("WhenWasIt"), MAX_CONTACTNAME - 1);
+ wcsncpy(pd.lptzText, TranslateT("No upcoming birthdays."), MAX_SECONDLINE - 1);
PUAddPopupT(&pd);
}
-TCHAR *BuildDTBText(int dtb, TCHAR *name, TCHAR *text, int size)
+wchar_t *BuildDTBText(int dtb, wchar_t *name, wchar_t *text, int size)
{
if (dtb > 1)
mir_sntprintf(text, size, TranslateT("%s has birthday in %d days."), name, dtb);
@@ -52,7 +52,7 @@ TCHAR *BuildDTBText(int dtb, TCHAR *name, TCHAR *text, int size)
return text;
}
-TCHAR *BuildDABText(int dab, TCHAR *name, TCHAR *text, int size)
+wchar_t *BuildDABText(int dab, wchar_t *name, wchar_t *text, int size)
{
if (dab > 1)
mir_sntprintf(text, size, TranslateT("%s had birthday %d days ago."), name, dab);
@@ -69,9 +69,9 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
if (commonData.bIgnoreSubcontacts && db_mc_isSub(hContact))
return 0;
- TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *name = pcli->pfnGetContactDisplayName(hContact, 0);
- TCHAR text[1024];
+ wchar_t text[1024];
BuildDTBText(dtb, name, text, _countof(text));
int gender = GetContactGender(hContact);
@@ -82,12 +82,12 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
pd.lchIcon = GetDTBIcon(dtb);
mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
- TCHAR *sex;
+ wchar_t *sex;
switch (toupper(gender)) {
- case _T('M'):
+ case 'M':
sex = TranslateT("He");
break;
- case _T('F'):
+ case 'F':
sex = TranslateT("She");
break;
default:
@@ -113,9 +113,9 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
if (commonData.bIgnoreSubcontacts && db_mc_isSub(hContact))
return 0;
- TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *name = pcli->pfnGetContactDisplayName(hContact, 0);
- TCHAR text[1024];
+ wchar_t text[1024];
BuildDABText(dab, name, text, _countof(text));
int gender = GetContactGender(hContact);
@@ -126,12 +126,12 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
pd.lchIcon = GetDTBIcon(dab);
mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
- TCHAR *sex;
+ wchar_t *sex;
switch (toupper(gender)) {
- case _T('M'):
+ case 'M':
sex = TranslateT("He");
break;
- case _T('F'):
+ case 'F':
sex = TranslateT("She");
break;
default:
@@ -153,9 +153,9 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
int DialogNotifyBirthday(MCONTACT hContact, int dtb, int age)
{
- TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *name = pcli->pfnGetContactDisplayName(hContact, 0);
- TCHAR text[1024];
+ wchar_t text[1024];
BuildDTBText(dtb, name, text, _countof(text));
if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
@@ -175,9 +175,9 @@ int DialogNotifyBirthday(MCONTACT hContact, int dtb, int age)
int DialogNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
{
- TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
+ wchar_t *name = pcli->pfnGetContactDisplayName(hContact, 0);
- TCHAR text[1024];
+ wchar_t text[1024];
BuildDABText(dab, name, text, _countof(text));
if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
diff --git a/plugins/WhenWasIt/src/notifiers.h b/plugins/WhenWasIt/src/notifiers.h
index 7fbeb682c3..58c9e81dfd 100644
--- a/plugins/WhenWasIt/src/notifiers.h
+++ b/plugins/WhenWasIt/src/notifiers.h
@@ -31,8 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct TUpcomingBirthday{
MCONTACT hContact;
- TCHAR *name;
- TCHAR *message;
+ wchar_t *name;
+ wchar_t *message;
int dtb;
int age;
};
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index 8eeaf21b6a..a40f104f13 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -176,12 +176,12 @@ INT_PTR AddBirthdayService(WPARAM hContact, LPARAM)
return ShowWindow(hWnd, SW_SHOW);
}
-void ShowPopupMessage(const TCHAR *title, const TCHAR *message, HANDLE icon)
+void ShowPopupMessage(const wchar_t *title, const wchar_t *message, HANDLE icon)
{
POPUPDATAT pd = { 0 };
pd.lchIcon = IcoLib_GetIconByHandle(icon);
- _tcsncpy_s(pd.lptzContactName, title, _TRUNCATE);
- _tcsncpy_s(pd.lptzText, message, _TRUNCATE);
+ wcsncpy_s(pd.lptzContactName, title, _TRUNCATE);
+ wcsncpy_s(pd.lptzText, message, _TRUNCATE);
pd.colorText = commonData.foreground;
pd.colorBack = commonData.background;
PUAddPopupT(&pd);
@@ -212,12 +212,12 @@ INT_PTR RefreshUserDetailsService(WPARAM, LPARAM)
INT_PTR ImportBirthdaysService(WPARAM, LPARAM)
{
- TCHAR fileName[1024] = { 0 };
+ wchar_t fileName[1024] = { 0 };
OPENFILENAME of = { 0 };
of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
- TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*" _T(BIRTHDAY_EXTENSION) L")%c*" _T(BIRTHDAY_EXTENSION) L"%c", TranslateT("Birthdays files"), 0, 0);
+ wchar_t filter[MAX_PATH];
+ mir_sntprintf(filter, L"%s (*" BIRTHDAY_EXTENSION L")%c*" BIRTHDAY_EXTENSION L"%c", TranslateT("Birthdays files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
of.nMaxFile = _countof(fileName);
@@ -225,7 +225,7 @@ INT_PTR ImportBirthdaysService(WPARAM, LPARAM)
of.Flags = OFN_FILEMUSTEXIST;
if (GetOpenFileName(&of)) {
- TCHAR buffer[2048];
+ wchar_t buffer[2048];
mir_sntprintf(buffer, TranslateT("Importing birthdays from file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hImportBirthdays);
DoImport(fileName);
@@ -237,22 +237,22 @@ INT_PTR ImportBirthdaysService(WPARAM, LPARAM)
INT_PTR ExportBirthdaysService(WPARAM, LPARAM)
{
- TCHAR fileName[1024] = { 0 };
+ wchar_t fileName[1024] = { 0 };
OPENFILENAME of = { 0 };
of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
- TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, L"%s (*" _T(BIRTHDAY_EXTENSION) L")%c*" _T(BIRTHDAY_EXTENSION) L"%c%s (*.*)%c*.*%c", TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
+ wchar_t filter[MAX_PATH];
+ mir_sntprintf(filter, L"%s (*" BIRTHDAY_EXTENSION L")%c*" BIRTHDAY_EXTENSION L"%c%s (*.*)%c*.*%c", TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
of.nMaxFile = _countof(fileName);
of.lpstrTitle = TranslateT("Please select a file to export birthdays to...");
if (GetSaveFileName(&of)) {
- TCHAR buffer[2048];
- TCHAR *fn = _tcsrchr(fileName, _T('\\')) + 1;
- if (!_tcschr(fn, _T('.')))
- mir_tstrcat(fileName, _T(BIRTHDAY_EXTENSION));
+ wchar_t buffer[2048];
+ wchar_t *fn = wcsrchr(fileName, '\\') + 1;
+ if (!wcschr(fn, '.'))
+ mir_tstrcat(fileName, BIRTHDAY_EXTENSION);
mir_sntprintf(buffer, TranslateT("Exporting birthdays to file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hExportBirthdays);
@@ -263,9 +263,9 @@ INT_PTR ExportBirthdaysService(WPARAM, LPARAM)
return 0;
}
-int DoImport(TCHAR *fileName)
+int DoImport(wchar_t *fileName)
{
- FILE *fin = _tfopen(fileName, L"rt");
+ FILE *fin = _wfopen(fileName, L"rt");
if (!fin) {
MessageBox(0, TranslateT("Could not open file to import birthdays"), TranslateT("Error"), MB_OK | MB_ICONERROR);
return 1;
@@ -274,32 +274,32 @@ int DoImport(TCHAR *fileName)
int mode = commonData.cDefaultModule;
while (!feof(fin)) {
- TCHAR buffer[4096];
- _fgetts(buffer, _countof(buffer), fin);
- if (buffer[0] == _T(COMMENT_CHAR))
+ wchar_t buffer[4096];
+ fgetws(buffer, _countof(buffer), fin);
+ if (buffer[0] == COMMENT_CHAR)
continue;
- TCHAR *delAccount = _tcsstr(buffer, L" : ");
+ wchar_t *delAccount = wcsstr(buffer, L" : ");
if (delAccount) {
int tmp = delAccount[0];
- delAccount[0] = _T('\0');
- TCHAR *delProto = _tcsrchr(buffer, _T('@'));
+ delAccount[0] = '\0';
+ wchar_t *delProto = wcsrchr(buffer, '@');
if (delProto) {
- delProto[0] = _T('\0');
+ delProto[0] = '\0';
- TCHAR *szHandle = buffer;
- TCHAR *szProto = delProto + 1;
+ wchar_t *szHandle = buffer;
+ wchar_t *szProto = delProto + 1;
MCONTACT hContact = GetContactFromID(szHandle, szProto);
if (hContact) {
delProto[0] = tmp;
delAccount[0] = tmp;
int year, month, day;
- _stscanf(delAccount, L" : %02d/%02d/%04d", &day, &month, &year);
+ swscanf(delAccount, L" : %02d/%02d/%04d", &day, &month, &year);
SaveBirthday(hContact, year, month, day, mode);
}
else {
- CMString msg(FORMAT, TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
+ CMString msg(FORMAT, TranslateT("Could not find UID '%s [%S]' in current database, skipping"), szHandle, szProto);
ShowPopupMessage(TranslateT("Warning"), msg, hImportBirthdays);
}
}
@@ -310,26 +310,26 @@ int DoImport(TCHAR *fileName)
return 0;
}
-int DoExport(TCHAR *fileName)
+int DoExport(wchar_t *fileName)
{
- FILE *fout = _tfopen(fileName, L"wt");
+ FILE *fout = _wfopen(fileName, L"wt");
if (!fout) {
MessageBox(0, TranslateT("Could not open file to export birthdays"), TranslateT("Error"), MB_OK | MB_ICONERROR);
return 1;
}
- _ftprintf(fout, L"%c%s", _T(COMMENT_CHAR), TranslateT("Please do not edit this file by hand. Use the export function of WhenWasIt plugin.\n"));
- _ftprintf(fout, L"%c%s", _T(COMMENT_CHAR), TranslateT("Warning! Please do not mix Unicode and Ansi exported birthday files. You should use the same version (Ansi/Unicode) of WhenWasIt that was used to export the info.\n"));
- _ftprintf(fout, L"%c%s", _T(COMMENT_CHAR), TranslateT("This file was exported with a Unicode version of WhenWasIt. Please only use a Unicode version of the plugin to import the birthdays.\n"));
+ fwprintf(fout, L"%c%s", COMMENT_CHAR, TranslateT("Please do not edit this file by hand. Use the export function of WhenWasIt plugin.\n"));
+ fwprintf(fout, L"%c%s", COMMENT_CHAR, TranslateT("Warning! Please do not mix Unicode and Ansi exported birthday files. You should use the same version (Ansi/Unicode) of WhenWasIt that was used to export the info.\n"));
+ fwprintf(fout, L"%c%s", COMMENT_CHAR, TranslateT("This file was exported with a Unicode version of WhenWasIt. Please only use a Unicode version of the plugin to import the birthdays.\n"));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
int year, month, day;
GetContactDOB(hContact, year, month, day);
if (IsDOBValid(year, month, day)) {
char *szProto = GetContactProto(hContact);
- TCHAR *szHandle = GetContactID(hContact, szProto);
+ wchar_t *szHandle = GetContactID(hContact, szProto);
if ((szHandle) && (mir_strlen(szProto) > 0))
- _ftprintf(fout, _T(BIRTHDAYS_EXPORT_FORMAT), szHandle, szProto, day, month, year);
+ fwprintf(fout, L"%s@%S : %02d/%02d/%04d\n", szHandle, szProto, day, month, year);
if (szHandle)
free(szHandle);
diff --git a/plugins/WhenWasIt/src/services.h b/plugins/WhenWasIt/src/services.h
index d4c19194a1..25d1c453b8 100644
--- a/plugins/WhenWasIt/src/services.h
+++ b/plugins/WhenWasIt/src/services.h
@@ -30,11 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define REFRESH_DETAILS_DELAY 3000
-
-#define BIRTHDAY_EXTENSION ".bdaysW"
-#define BIRTHDAYS_EXPORT_FORMAT "%s@%S : %02d/%02d/%04d\n"
-#define NOTFOUND_FORMAT LPGEN("Could not find UID '%s [%S]' in current database, skipping")
-
+#define BIRTHDAY_EXTENSION L".bdaysW"
extern int bShouldCheckBirthdays;
extern int bBirthdayFound;
@@ -45,8 +41,8 @@ int DestroyServices();
int NotifyContactBirthday(MCONTACT hContact, time_t now, int daysInAdvance);
int NotifyMissedContactBirthday(MCONTACT hContact, time_t now, int daysAfter);
-int DoExport(TCHAR *fileName);
-int DoImport(TCHAR *fileName);
+int DoExport(wchar_t *fileName);
+int DoImport(wchar_t *fileName);
INT_PTR CheckBirthdaysService(WPARAM wParam, LPARAM lParam);
INT_PTR ShowListService(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp
index 9667b1bc37..6c0c253a12 100644
--- a/plugins/WhenWasIt/src/utils.cpp
+++ b/plugins/WhenWasIt/src/utils.cpp
@@ -138,22 +138,22 @@ int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, si
return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, size);
}
-TCHAR* GetContactID(MCONTACT hContact)
+wchar_t* GetContactID(MCONTACT hContact)
{
return GetContactID(hContact, NULL);
}
-TCHAR* GetContactID(MCONTACT hContact, char *szProto)
+wchar_t* GetContactID(MCONTACT hContact, char *szProto)
{
ptrT res(Contact_GetInfo(CNF_UNIQUEID, hContact, szProto));
- return (res) ? _tcsdup(res) : NULL;
+ return (res) ? wcsdup(res) : NULL;
}
-MCONTACT GetContactFromID(TCHAR *szID, char *szProto)
+MCONTACT GetContactFromID(wchar_t *szID, char *szProto)
{
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *m_szProto = GetContactProto(hContact);
- TCHAR *szHandle = GetContactID(hContact, szProto);
+ wchar_t *szHandle = GetContactID(hContact, szProto);
if (szHandle) {
bool found = (!mir_tstrcmpi(szHandle, szID) && !_stricmp(szProto, m_szProto));
free(szHandle);
@@ -164,7 +164,7 @@ MCONTACT GetContactFromID(TCHAR *szID, char *szProto)
return NULL;
}
-MCONTACT GetContactFromID(TCHAR *szID, wchar_t *szProto)
+MCONTACT GetContactFromID(wchar_t *szID, wchar_t *szProto)
{
char protocol[1024];
WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL);
diff --git a/plugins/WhenWasIt/src/utils.h b/plugins/WhenWasIt/src/utils.h
index a90f9a83f3..b432c623c1 100644
--- a/plugins/WhenWasIt/src/utils.h
+++ b/plugins/WhenWasIt/src/utils.h
@@ -44,9 +44,9 @@ RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos,
int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, int size);
-TCHAR* GetContactID(MCONTACT hContact);
-TCHAR* GetContactID(MCONTACT hContact, char *szProto);
-MCONTACT GetContactFromID(TCHAR *szID, char *szProto);
-MCONTACT GetContactFromID(TCHAR *szID, wchar_t *szProto);
+wchar_t* GetContactID(MCONTACT hContact);
+wchar_t* GetContactID(MCONTACT hContact, char *szProto);
+MCONTACT GetContactFromID(wchar_t *szID, char *szProto);
+MCONTACT GetContactFromID(wchar_t *szID, wchar_t *szProto);
#endif \ No newline at end of file