summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-05-11 15:20:06 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-05-11 15:20:06 +0000
commita9197f5d5921263a042979b0d14fc2c61e411320 (patch)
tree3bcc91deb4c5238025f41aa24af58a378d066e6e /plugins
parent6f8c7b4f1bf939c43e2fe124a01e9bec2b672616 (diff)
minus CreateThread
git-svn-id: http://svn.miranda-ng.org/main/trunk@13543 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/WhenWasIt/src/WhenWasIt.cpp40
-rw-r--r--plugins/WhenWasIt/src/birthdays.cpp10
-rw-r--r--plugins/WhenWasIt/src/birthdays.h62
-rw-r--r--plugins/WhenWasIt/src/date_utils.cpp38
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp515
-rw-r--r--plugins/WhenWasIt/src/events.cpp4
-rw-r--r--plugins/WhenWasIt/src/hooked_events.cpp12
-rw-r--r--plugins/WhenWasIt/src/icons.cpp6
-rw-r--r--plugins/WhenWasIt/src/icons.h3
-rw-r--r--plugins/WhenWasIt/src/notifiers.cpp48
-rw-r--r--plugins/WhenWasIt/src/services.cpp37
-rw-r--r--plugins/WhenWasIt/src/utils.cpp48
12 files changed, 407 insertions, 416 deletions
diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp
index 178c880b64..dd7984dd90 100644
--- a/plugins/WhenWasIt/src/WhenWasIt.cpp
+++ b/plugins/WhenWasIt/src/WhenWasIt.cpp
@@ -35,7 +35,7 @@ HANDLE hmImportBirthdays = NULL;
HANDLE hmExportBirthdays = NULL;
-CommonData commonData = {0};
+CommonData commonData = { 0 };
CLIST_INTERFACE *pcli;
@@ -50,10 +50,10 @@ PLUGININFOEX pluginInfo = {
__AUTHORWEB,
UNICODE_AWARE,
// {2FF96C84-B0B5-470E-BBF9-907B9F3F5D2F}
- {0x2ff96c84, 0xb0b5, 0x470e, {0xbb, 0xf9, 0x90, 0x7b, 0x9f, 0x3f, 0x5d, 0x2f}}
+ { 0x2ff96c84, 0xb0b5, 0x470e, { 0xbb, 0xf9, 0x90, 0x7b, 0x9f, 0x3f, 0x5d, 0x2f } }
};
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
}
@@ -69,15 +69,15 @@ extern "C" int __declspec(dllexport) Load(void)
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_DATE_CLASSES;
InitCommonControlsEx(&icex);
-
+
AddIcons();
Log("%s", "Creating service functions ...");
InitServices();
- Log("%s", "Hooking events ...");
+ Log("%s", "Hooking events ...");
HookEvents();
-
+
hAddBirthdayWndsList = WindowList_Create();
CLISTMENUITEM cl = { sizeof(cl) };
@@ -88,29 +88,29 @@ extern "C" int __declspec(dllexport) Load(void)
cl.icolibItem = hCheckMenu;
cl.pszName = LPGEN("Check for birthdays");
hmCheckBirthdays = Menu_AddMainMenuItem(&cl);
-
+
cl.pszService = MS_WWI_LIST_SHOW;
cl.pszName = LPGEN("Birthday list");
cl.icolibItem = hListMenu;
hmBirthdayList = Menu_AddMainMenuItem(&cl);
-
+
cl.pszService = MS_WWI_REFRESH_USERDETAILS;
cl.position = 10100000;
cl.pszName = LPGEN("Refresh user details");
cl.icolibItem = hRefreshUserDetails;
hmRefreshDetails = Menu_AddMainMenuItem(&cl);
-
+
cl.pszService = MS_WWI_IMPORT_BIRTHDAYS;
cl.position = 10200000;
cl.pszName = LPGEN("Import birthdays");
cl.icolibItem = hImportBirthdays;
hmImportBirthdays = Menu_AddMainMenuItem(&cl);
-
+
cl.pszService = MS_WWI_EXPORT_BIRTHDAYS;
cl.pszName = LPGEN("Export birthdays");
cl.icolibItem = hExportBirthdays;
hmExportBirthdays = Menu_AddMainMenuItem(&cl);
-
+
cl.pszService = MS_WWI_ADD_BIRTHDAY;
cl.position = 10000000;
cl.icolibItem = hAddBirthdayContact;
@@ -125,16 +125,16 @@ extern "C" int __declspec(dllexport) Load(void)
hotkey.pszDescription = LPGEN("Birthday list");
hotkey.pszService = MS_WWI_LIST_SHOW;
Hotkey_Register(&hotkey);
-
+
hotkey.pszName = "wwi_check_birthdays";
hotkey.pszDescription = LPGEN("Check for birthdays");
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"));
-
+
Log("%s", "Leaving function " __FUNCTION__);
return 0;
}
@@ -142,22 +142,22 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload()
{
Log("%s", "Entering function " __FUNCTION__);
-
+
if (hBirthdaysDlg)
SendMessage(hBirthdaysDlg, WM_CLOSE, 0, 0);
-
+
if (hUpcomingDlg)
SendMessage(hUpcomingDlg, WM_CLOSE, 0, 0);
-
+
WindowList_Broadcast(hAddBirthdayWndsList, WM_CLOSE, 0, 0);
WindowList_Destroy(hAddBirthdayWndsList);
Log("%s", "Killing timers ...");
KillTimers();
-
+
Log("%s", "Unhooking events ...");
UnhookEvents();
-
+
Log("%s", "Destroying service functions ...");
DestroyServices();
diff --git a/plugins/WhenWasIt/src/birthdays.cpp b/plugins/WhenWasIt/src/birthdays.cpp
index ccea05193f..cf8e4c65ed 100644
--- a/plugins/WhenWasIt/src/birthdays.cpp
+++ b/plugins/WhenWasIt/src/birthdays.cpp
@@ -28,7 +28,7 @@ CBirthdays::CBirthdays(int initialSize)
size = 0;
birthdays = NULL;
advancedIcon = CLIST_ICON;
-
+
Realloc(initialSize);
}
@@ -79,14 +79,14 @@ void CBirthdays::EnsureCapacity()
void CBirthdays::Realloc(int increaseCapacity)
{
size += increaseCapacity;
- birthdays = (PBirthdayContact *) realloc(birthdays, size * sizeof(PBirthdayContact));
+ birthdays = (PBirthdayContact *)realloc(birthdays, size * sizeof(PBirthdayContact));
}
int CBirthdays::Add(MCONTACT hContact, HANDLE hClistIcon)
{
- if ( !Contains(hContact)) {
+ if (!Contains(hContact)) {
EnsureCapacity();
- TBirthdayContact *item = (TBirthdayContact *) malloc(sizeof(TBirthdayContact));
+ TBirthdayContact *item = (TBirthdayContact *)malloc(sizeof(TBirthdayContact));
item->hContact = hContact;
item->hClistIcon = hClistIcon;
birthdays[count++] = item;
@@ -109,7 +109,7 @@ int CBirthdays::Remove(int index)
int CBirthdays::Remove(MCONTACT hContact)
{
- return Remove( Index(hContact));
+ return Remove(Index(hContact));
}
int CBirthdays::Contains(MCONTACT hContact) const
diff --git a/plugins/WhenWasIt/src/birthdays.h b/plugins/WhenWasIt/src/birthdays.h
index 8336feaaf8..c1f8085fd6 100644
--- a/plugins/WhenWasIt/src/birthdays.h
+++ b/plugins/WhenWasIt/src/birthdays.h
@@ -30,37 +30,37 @@ typedef TBirthdayContact *PBirthdayContact;
class CBirthdays
{
- protected:
- int count;
- int size;
- PBirthdayContact *birthdays;
- int advancedIcon;
-
- void Realloc(int increaseCapacity);
- void EnsureCapacity();
-
- void ClearItem(int index);
-
- public:
- CBirthdays(int initialSize = 10);
- ~CBirthdays();
-
- int Add(MCONTACT hContact, HANDLE hClistIcon);
- int Remove(int index);
- int Remove(MCONTACT hContact);
- void Clear();
- void Destroy();
-
- int Index(MCONTACT hContact) const;
- int Contains(MCONTACT hContact) const;
-
- void SetAdvancedIconIndex(int advIcon);
- int GetAdvancedIconIndex() const;
-
- HANDLE GetClistIcon(MCONTACT hContact) const;
-
- int Count() const;
- int Size() const;
+protected:
+ int count;
+ int size;
+ PBirthdayContact *birthdays;
+ int advancedIcon;
+
+ void Realloc(int increaseCapacity);
+ void EnsureCapacity();
+
+ void ClearItem(int index);
+
+public:
+ CBirthdays(int initialSize = 10);
+ ~CBirthdays();
+
+ int Add(MCONTACT hContact, HANDLE hClistIcon);
+ int Remove(int index);
+ int Remove(MCONTACT hContact);
+ void Clear();
+ void Destroy();
+
+ int Index(MCONTACT hContact) const;
+ int Contains(MCONTACT hContact) const;
+
+ void SetAdvancedIconIndex(int advIcon);
+ int GetAdvancedIconIndex() const;
+
+ HANDLE GetClistIcon(MCONTACT hContact) const;
+
+ int Count() const;
+ int Size() const;
};
extern CBirthdays &birthdays;
diff --git a/plugins/WhenWasIt/src/date_utils.cpp b/plugins/WhenWasIt/src/date_utils.cpp
index 41ab186044..4e0cabacc2 100644
--- a/plugins/WhenWasIt/src/date_utils.cpp
+++ b/plugins/WhenWasIt/src/date_utils.cpp
@@ -38,32 +38,32 @@ int GetContactDOB(MCONTACT hContact, int &year, int &month, int &day)
year = db_get_w(hContact, "UserInfo", "DOBy", 0);
month = db_get_b(hContact, "UserInfo", "DOBm", 0);
day = db_get_b(hContact, "UserInfo", "DOBd", 0);
- if ( IsDOBValid(year, month, day))
+ if (IsDOBValid(year, month, day))
return DOB_USERINFO;
char *szProto = GetContactProto(hContact);
year = db_get_w(hContact, szProto, "BirthYear", 0);
month = db_get_b(hContact, szProto, "BirthMonth", 0);
day = db_get_b(hContact, szProto, "BirthDay", 0);
- if ( IsDOBValid(year, month, day))
+ if (IsDOBValid(year, month, day))
return DOB_PROTOCOL;
year = db_get_w(hContact, "BirthDay", "BirthYear", 0);
month = db_get_b(hContact, "BirthDay", "BirthMonth", 0);
day = db_get_b(hContact, "BirthDay", "BirthDay", 0);
- if ( IsDOBValid(year, month, day))
+ if (IsDOBValid(year, month, day))
return DOB_BIRTHDAYREMINDER;
year = db_get_w(hContact, "mBirthday", "BirthYear", 0);
month = db_get_b(hContact, "mBirthday", "BirthMonth", 0);
day = db_get_b(hContact, "mBirthday", "BirthDay", 0);
- if ( IsDOBValid(year, month, day))
+ if (IsDOBValid(year, month, day))
return DOB_MBIRTHDAY;
year = db_get_dw(hContact, "micqBirthday", "BirthYear", 0);
month = db_get_dw(hContact, "micqBirthday", "BirthMonth", 0);
day = db_get_dw(hContact, "micqBirthday", "BirthDay", 0);
- if ( IsDOBValid(year, month, day))
+ if (IsDOBValid(year, month, day))
return DOB_MICQBIRTHDAY;
return DOB_UNKNOWN;
@@ -76,9 +76,9 @@ int GetContactAge(MCONTACT hContact)
time(&tNow);
struct tm *now = localtime(&tNow);
GetContactDOB(hContact, year, month, day);
- if (year == 0)
- return 0;
- else
+ if (year == 0)
+ return 0;
+ else
return (now->tm_year + 1900) - year;
}
@@ -102,7 +102,7 @@ unsigned int GetDaysDifference(time_t time1, time_t time2)
double diff = difftime(time1, time2);
if (errno == 0) {
diff = diff / (60 * 60 * 24);
- int days = (int) floor(diff);
+ int days = (int)floor(diff);
if (days < 0) {
struct tm *date = gmtime(&time1);
int leap = 0;
@@ -123,22 +123,22 @@ int GetDaysDifferenceAfter(time_t time1, time_t time2)
if (errno == 0)
{
diff = diff / (60 * 60 * 24);
- int days = (int) floor(diff);
+ int days = (int)floor(diff);
if (days > 0)
{
return -1;
}
-
+
return -days;
}
-
+
return -1;
}
unsigned int DaysToBirthday(time_t now, int ctYear, int ctMonth, int ctDay)
{
- if ( IsDOBValid(ctYear, ctMonth, ctDay)) {
- struct tm ct = {0};
+ if (IsDOBValid(ctYear, ctMonth, ctDay)) {
+ struct tm ct = { 0 };
struct tm *tmp = gmtime(&now);
ct.tm_year = tmp->tm_year;
ct.tm_mon = ctMonth - 1;
@@ -151,8 +151,8 @@ unsigned int DaysToBirthday(time_t now, int ctYear, int ctMonth, int ctDay)
int DaysAfterBirthday(time_t now, int ctYear, int ctMonth, int ctDay)
{
- if ( IsDOBValid(ctYear, ctMonth, ctDay)) {
- struct tm ct = {0};
+ if (IsDOBValid(ctYear, ctMonth, ctDay)) {
+ struct tm ct = { 0 };
struct tm *tmp = gmtime(&now);
ct.tm_year = tmp->tm_year;
ct.tm_mon = ctMonth - 1;
@@ -195,7 +195,7 @@ int SaveBirthday(MCONTACT hContact, int year, int month, int day, int mode)
char *sMonth, *sdMonth, *sd2Month;
char *sDay, *sdDay, *sd2Day;
char *protocol = GetContactProto(hContact);
-
+
switch (mode) {
case SAVE_MODE_MBIRTHDAY:
FillmBirthday(sModule, sYear, sMonth, sDay);
@@ -235,11 +235,11 @@ int SaveBirthday(MCONTACT hContact, int year, int month, int day, int mode)
db_unset(hContact, sdModule, sdYear);
db_unset(hContact, sdModule, sdMonth);
db_unset(hContact, sdModule, sdDay);
-
+
db_unset(hContact, sd2Module, sd2Year);
db_unset(hContact, sd2Module, sd2Month);
db_unset(hContact, sd2Module, sd2Day);
-
+
db_unset(hContact, "BirthDay", "BirthYear");
db_unset(hContact, "BirthDay", "BirthMonth");
db_unset(hContact, "BirthDay", "BirthDay");
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index 85752f8fb5..c07570e24b 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -29,16 +29,16 @@ 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 TCHAR *szShowAgeMode[] = { LPGENT("Upcoming age"), LPGENT("Current age") };
const int cShowAgeMode = sizeof(szShowAgeMode) / sizeof(szShowAgeMode[0]);
-const TCHAR *szSaveModule[] = { LPGENT("UserInfo module"), LPGENT("Protocol module"), LPGENT("mBirthday module")};
+const TCHAR *szSaveModule[] = { LPGENT("UserInfo module"), LPGENT("Protocol module"), LPGENT("mBirthday module") };
const int cSaveModule = sizeof(szSaveModule) / sizeof(szSaveModule[0]);
-const TCHAR *szPopupClick[] = { LPGENT("Nothing"), LPGENT("Dismiss"), LPGENT("Message window")};
+const TCHAR *szPopupClick[] = { LPGENT("Nothing"), LPGENT("Dismiss"), LPGENT("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 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 int cNotifyFor = sizeof(szNotifyFor) / sizeof(szNotifyFor[0]);
#define MIN_BIRTHDAYS_WIDTH 200
@@ -50,7 +50,7 @@ void CreateToolTip(HWND target, TCHAR* 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);
if (hwndToolTip) {
- TOOLINFO ti = {0};
+ TOOLINFO ti = { 0 };
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_TRANSPARENT | TTF_SUBCLASS;
ti.hwnd = target;
@@ -58,7 +58,7 @@ void CreateToolTip(HWND target, TCHAR* tooltip, LPARAM width)
ti.hinst = NULL;
ti.lpszText = tooltip;
GetClientRect(target, &ti.rect);
- SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM) &ti );
+ SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, width);
SendMessage(hwndToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 20000);
}
@@ -75,7 +75,7 @@ int EnablePopupsGroup(HWND hWnd, int enable)
EnableWindow(GetDlgItem(hWnd, IDC_PREVIEW), enable);
EnableWindow(GetDlgItem(hWnd, IDC_LEFT_CLICK), enable);
EnableWindow(GetDlgItem(hWnd, IDC_RIGHT_CLICK), enable);
-
+
return enable;
}
@@ -90,7 +90,7 @@ int EnableDialogGroup(HWND hWnd, int enable)
{
EnableWindow(GetDlgItem(hWnd, IDC_DLG_TIMEOUT), enable);
EnableWindow(GetDlgItem(hWnd, IDC_OPENINBACKGROUND), enable);
-
+
return enable;
}
@@ -99,27 +99,27 @@ int AddInfoToComboBoxes(HWND hWnd)
int i;
for (i = 0; i < cShowAgeMode; i++)
- SendDlgItemMessage(hWnd, IDC_AGE_COMBOBOX, CB_ADDSTRING, 0, (LPARAM) TranslateTS(szShowAgeMode[i]));
+ SendDlgItemMessage(hWnd, IDC_AGE_COMBOBOX, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szShowAgeMode[i]));
for (i = 0; i < cSaveModule; i++)
- SendDlgItemMessage(hWnd, IDC_DEFAULT_MODULE, CB_ADDSTRING, 0, (LPARAM) TranslateTS(szSaveModule[i]));
+ SendDlgItemMessage(hWnd, IDC_DEFAULT_MODULE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSaveModule[i]));
for (i = 0; i < cPopupClick; i++) {
- SendDlgItemMessage(hWnd, IDC_LEFT_CLICK, CB_ADDSTRING, 0, (LPARAM) TranslateTS(szPopupClick[i]));
- SendDlgItemMessage(hWnd, IDC_RIGHT_CLICK, CB_ADDSTRING, 0, (LPARAM) TranslateTS(szPopupClick[i]));
+ SendDlgItemMessage(hWnd, IDC_LEFT_CLICK, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szPopupClick[i]));
+ SendDlgItemMessage(hWnd, IDC_RIGHT_CLICK, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szPopupClick[i]));
}
for (i = 0; i < cNotifyFor; i++)
- SendDlgItemMessage(hWnd, IDC_NOTIFYFOR, CB_ADDSTRING, 0, (LPARAM) TranslateTS(szNotifyFor[i]));
+ SendDlgItemMessage(hWnd, IDC_NOTIFYFOR, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szNotifyFor[i]));
return i;
}
-SIZE GetControlTextSize(HWND hCtrl)
+SIZE GetControlTextSize(HWND hCtrl)
{
HDC hDC = GetDC(hCtrl);
- HFONT font = (HFONT) SendMessage(hCtrl, WM_GETFONT, 0, 0);
- HFONT oldFont = (HFONT) SelectObject(hDC, font);
+ HFONT font = (HFONT)SendMessage(hCtrl, WM_GETFONT, 0, 0);
+ HFONT oldFont = (HFONT)SelectObject(hDC, font);
const size_t maxSize = 2048;
TCHAR buffer[maxSize];
SIZE size;
@@ -150,10 +150,10 @@ TCHAR *strtrim(TCHAR *str)
memmove(str, str + i, len - i + 1);
len -= i;
}
-
- while ((len > 0) && (str[--len] == _T(' ')))
+
+ while ((len > 0) && (str[--len] == _T(' ')))
str[len] = 0;
-
+
return str;
}
@@ -162,76 +162,76 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
static int bInitializing = 0;
switch (msg) {
case WM_INITDIALOG:
- {
- bInitializing = 1;
-
- SIZE oldPopupsSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_POPUPS));
- SIZE oldClistIconSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_CLISTICON));
- SIZE oldDialogSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_DIALOG));
+ {
+ bInitializing = 1;
- TranslateDialogDefault(hWnd);
+ SIZE oldPopupsSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_POPUPS));
+ SIZE oldClistIconSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_CLISTICON));
+ SIZE oldDialogSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_DIALOG));
- EnlargeControl(GetDlgItem(hWnd, IDC_USE_POPUPS), GetDlgItem(hWnd, IDC_POPUPS_STATIC), oldPopupsSize);
- EnlargeControl(GetDlgItem(hWnd, IDC_USE_CLISTICON), GetDlgItem(hWnd, IDC_CLIST_STATIC), oldClistIconSize);
- EnlargeControl(GetDlgItem(hWnd, IDC_USE_DIALOG), GetDlgItem(hWnd, IDC_DIALOG_STATIC), oldDialogSize);
+ TranslateDialogDefault(hWnd);
- AddInfoToComboBoxes(hWnd);
+ EnlargeControl(GetDlgItem(hWnd, IDC_USE_POPUPS), GetDlgItem(hWnd, IDC_POPUPS_STATIC), oldPopupsSize);
+ EnlargeControl(GetDlgItem(hWnd, IDC_USE_CLISTICON), GetDlgItem(hWnd, IDC_CLIST_STATIC), oldClistIconSize);
+ EnlargeControl(GetDlgItem(hWnd, IDC_USE_DIALOG), GetDlgItem(hWnd, IDC_DIALOG_STATIC), oldDialogSize);
- SendDlgItemMessage(hWnd, IDC_FOREGROUND, CPM_SETDEFAULTCOLOUR, 0, FOREGROUND_COLOR);
- SendDlgItemMessage(hWnd, IDC_BACKGROUND, CPM_SETDEFAULTCOLOUR, 0, BACKGROUND_COLOR);
+ AddInfoToComboBoxes(hWnd);
- SendDlgItemMessage(hWnd, IDC_FOREGROUND, CPM_SETCOLOUR, 0, commonData.foreground);
- SendDlgItemMessage(hWnd, IDC_BACKGROUND, CPM_SETCOLOUR, 0, commonData.background);
+ SendDlgItemMessage(hWnd, IDC_FOREGROUND, CPM_SETDEFAULTCOLOUR, 0, FOREGROUND_COLOR);
+ SendDlgItemMessage(hWnd, IDC_BACKGROUND, CPM_SETDEFAULTCOLOUR, 0, BACKGROUND_COLOR);
- SendDlgItemMessage(hWnd, IDC_DEFAULT_MODULE, CB_SETCURSEL, commonData.cDefaultModule, 0);
- SendDlgItemMessage(hWnd, IDC_LEFT_CLICK, CB_SETCURSEL, commonData.lPopupClick, 0);
- SendDlgItemMessage(hWnd, IDC_RIGHT_CLICK, CB_SETCURSEL, commonData.rPopupClick, 0);
- SendDlgItemMessage(hWnd, IDC_NOTIFYFOR, CB_SETCURSEL, commonData.notifyFor, 0);
+ SendDlgItemMessage(hWnd, IDC_FOREGROUND, CPM_SETCOLOUR, 0, commonData.foreground);
+ SendDlgItemMessage(hWnd, IDC_BACKGROUND, CPM_SETCOLOUR, 0, commonData.background);
- CreateToolTip(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), TranslateT("Set popup delay when notifying of upcoming birthdays.\nFormat: default delay [ | delay for birthdays occurring today]"), 400);
+ SendDlgItemMessage(hWnd, IDC_DEFAULT_MODULE, CB_SETCURSEL, commonData.cDefaultModule, 0);
+ SendDlgItemMessage(hWnd, IDC_LEFT_CLICK, CB_SETCURSEL, commonData.lPopupClick, 0);
+ SendDlgItemMessage(hWnd, IDC_RIGHT_CLICK, CB_SETCURSEL, commonData.rPopupClick, 0);
+ SendDlgItemMessage(hWnd, IDC_NOTIFYFOR, CB_SETCURSEL, commonData.notifyFor, 0);
- TCHAR buffer[1024];
- _itot(commonData.daysInAdvance, buffer, 10);
- SetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer);
- _itot(commonData.checkInterval, buffer, 10);
- SetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
- SetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer);
- _itot(commonData.cSoundNearDays, buffer, 10);
- SetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer);
- _itot(commonData.cDlgTimeout, buffer, 10);
- SetDlgItemText(hWnd, IDC_DLG_TIMEOUT, buffer);
- _itot(commonData.daysAfter, buffer, 10);
- SetDlgItemText(hWnd, IDC_DAYS_AFTER, buffer);
+ CreateToolTip(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), TranslateT("Set popup delay when notifying of upcoming birthdays.\nFormat: default delay [ | delay for birthdays occurring today]"), 400);
- CheckDlgButton(hWnd, IDC_OPENINBACKGROUND, (commonData.bOpenInBackground) ? BST_CHECKED : BST_UNCHECKED);
+ TCHAR buffer[1024];
+ _itot(commonData.daysInAdvance, buffer, 10);
+ SetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer);
+ _itot(commonData.checkInterval, buffer, 10);
+ SetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
+ SetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer);
+ _itot(commonData.cSoundNearDays, buffer, 10);
+ SetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer);
+ _itot(commonData.cDlgTimeout, buffer, 10);
+ SetDlgItemText(hWnd, IDC_DLG_TIMEOUT, buffer);
+ _itot(commonData.daysAfter, buffer, 10);
+ SetDlgItemText(hWnd, IDC_DAYS_AFTER, buffer);
- CheckDlgButton(hWnd, IDC_NOBIRTHDAYS_POPUP, (commonData.bNoBirthdaysPopup) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hWnd, IDC_AGE_COMBOBOX, CB_SETCURSEL, commonData.cShowAgeMode, 0);
+ CheckDlgButton(hWnd, IDC_OPENINBACKGROUND, (commonData.bOpenInBackground) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_IGNORE_SUBCONTACTS, (commonData.bIgnoreSubcontacts) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_NOBIRTHDAYS_POPUP, (commonData.bNoBirthdaysPopup) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hWnd, IDC_AGE_COMBOBOX, CB_SETCURSEL, commonData.cShowAgeMode, 0);
- CheckDlgButton(hWnd, IDC_ONCE_PER_DAY, (commonData.bOncePerDay) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), !commonData.bOncePerDay);
+ CheckDlgButton(hWnd, IDC_IGNORE_SUBCONTACTS, (commonData.bIgnoreSubcontacts) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_USE_DIALOG, (commonData.bUseDialog) ? BST_CHECKED : BST_UNCHECKED);
- EnableDialogGroup(hWnd, commonData.bUseDialog);
+ CheckDlgButton(hWnd, IDC_ONCE_PER_DAY, (commonData.bOncePerDay) ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), !commonData.bOncePerDay);
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
- CheckDlgButton(hWnd, IDC_USE_POPUPS, commonData.bUsePopups ? BST_CHECKED : BST_UNCHECKED);
- EnablePopupsGroup(hWnd, commonData.bUsePopups);
- }
- else {
- EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), FALSE);
- EnablePopupsGroup(hWnd, FALSE);
- }
+ CheckDlgButton(hWnd, IDC_USE_DIALOG, (commonData.bUseDialog) ? BST_CHECKED : BST_UNCHECKED);
+ EnableDialogGroup(hWnd, commonData.bUseDialog);
- CheckDlgButton(hWnd, IDC_USE_CLISTICON, BST_CHECKED);
- EnableWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), FALSE);
- EnableClistGroup(hWnd, FALSE);
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ CheckDlgButton(hWnd, IDC_USE_POPUPS, commonData.bUsePopups ? BST_CHECKED : BST_UNCHECKED);
+ EnablePopupsGroup(hWnd, commonData.bUsePopups);
}
- bInitializing = 0;
- return TRUE;
+ else {
+ EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), FALSE);
+ EnablePopupsGroup(hWnd, FALSE);
+ }
+
+ CheckDlgButton(hWnd, IDC_USE_CLISTICON, BST_CHECKED);
+ EnableWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), FALSE);
+ EnableClistGroup(hWnd, FALSE);
+ }
+ bInitializing = 0;
+ return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
@@ -272,21 +272,21 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
break;
case IDC_PREVIEW:
- {
- MCONTACT hContact = db_find_first();
- int dtb = rand() % 11; //0..10
- int age = rand() % 50 + 1; //1..50
- PopupNotifyBirthday(hContact, dtb, age);
- break;
- }
+ {
+ MCONTACT hContact = db_find_first();
+ int dtb = rand() % 11; //0..10
+ int age = rand() % 50 + 1; //1..50
+ PopupNotifyBirthday(hContact, dtb, age);
+ break;
+ }
}
break;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
+ case PSN_APPLY:
commonData.foreground = SendDlgItemMessage(hWnd, IDC_FOREGROUND, CPM_GETCOLOUR, 0, 0);
commonData.background = SendDlgItemMessage(hWnd, IDC_BACKGROUND, CPM_GETCOLOUR, 0, 0);
commonData.popupTimeout = POPUP_TIMEOUT;
@@ -319,7 +319,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
GetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer, SIZEOF(buffer));
commonData.checkInterval = _ttol(buffer);
- if ( !commonData.checkInterval) { commonData.checkInterval = CHECK_INTERVAL; }
+ if (!commonData.checkInterval) { commonData.checkInterval = CHECK_INTERVAL; }
GetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer, SIZEOF(buffer));
TCHAR *pos;
@@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
{
MCONTACT hContact = lParam;
WindowList_Add(hAddBirthdayWndsList, hWnd, hContact);
- Utils_RestoreWindowPositionNoSize(hWnd,hContact,ModuleName,"BirthdayWnd");
+ Utils_RestoreWindowPositionNoSize(hWnd, hContact, ModuleName, "BirthdayWnd");
}
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(hAddBirthdayContact, 1));
{
@@ -413,65 +413,65 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
break;
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;
- char *szProto = GetContactProto(hContact);
-
- TCHAR buffer[2048];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
- SetWindowText(hWnd, buffer);
-
- HWND hDate = GetDlgItem(hWnd, IDC_DATE);
-
- int year, month, day;
- int loc = GetContactDOB(hContact, year, month, day);
- if (IsDOBValid(year, month, day)) {
- SYSTEMTIME st = { 0 };
- st.wDay = day;
- st.wMonth = month;
- st.wYear = year;
- DateTime_SetSystemtime(hDate, GDT_VALID, &st);
- }
- else DateTime_SetSystemtime(hDate, GDT_NONE, NULL);
+ {
+ 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;
+ char *szProto = GetContactProto(hContact);
- switch (loc) {
- case DOB_MBIRTHDAY:
- DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_MBIRTHDAY);
- szCurrentModuleTooltip = _T("mBirthday");
- break;
+ TCHAR buffer[2048];
+ mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
+ SetWindowText(hWnd, buffer);
+
+ HWND hDate = GetDlgItem(hWnd, IDC_DATE);
+
+ int year, month, day;
+ int loc = GetContactDOB(hContact, year, month, day);
+ if (IsDOBValid(year, month, day)) {
+ SYSTEMTIME st = { 0 };
+ st.wDay = day;
+ st.wMonth = month;
+ st.wYear = year;
+ DateTime_SetSystemtime(hDate, GDT_VALID, &st);
+ }
+ else DateTime_SetSystemtime(hDate, GDT_NONE, NULL);
- case DOB_PROTOCOL:
- DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_PROTOCOL);
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("%S protocol"), szProto);
- szCurrentModuleTooltip = buffer;
- break;
+ switch (loc) {
+ case DOB_MBIRTHDAY:
+ DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_MBIRTHDAY);
+ szCurrentModuleTooltip = _T("mBirthday");
+ break;
- case DOB_BIRTHDAYREMINDER:
- DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_BIRTHDAYREMINDER);
- szCurrentModuleTooltip = _T("Birthday Reminder");
- break;
+ case DOB_PROTOCOL:
+ DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_PROTOCOL);
+ mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("%S protocol"), szProto);
+ szCurrentModuleTooltip = buffer;
+ break;
- case DOB_USERINFO:
- DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_USERINFO);
- szCurrentModuleTooltip = _T("UserInfo");
- break;
+ case DOB_BIRTHDAYREMINDER:
+ DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_BIRTHDAYREMINDER);
+ szCurrentModuleTooltip = _T("Birthday Reminder");
+ break;
- case DOB_MICQBIRTHDAY:
- DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_MICQBIRTHDAY);
- szCurrentModuleTooltip = _T("mICQBirthday");
- break;
+ case DOB_USERINFO:
+ DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_USERINFO);
+ szCurrentModuleTooltip = _T("UserInfo");
+ break;
- default:
- szCurrentModuleTooltip = NULL;
- break;
- }
+ case DOB_MICQBIRTHDAY:
+ DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_MICQBIRTHDAY);
+ szCurrentModuleTooltip = _T("mICQBirthday");
+ break;
- CreateToolTip(GetDlgItem(hWnd, IDC_COMPATIBILITY), szTooltipText, 500);
- if (szCurrentModuleTooltip)
- CreateToolTip(hDate, szCurrentModuleTooltip, 400);
+ default:
+ szCurrentModuleTooltip = NULL;
+ break;
}
- break;
+
+ CreateToolTip(GetDlgItem(hWnd, IDC_COMPATIBILITY), szTooltipText, 500);
+ if (szCurrentModuleTooltip)
+ CreateToolTip(hDate, szCurrentModuleTooltip, 400);
+ }
+ break;
case WM_DESTROY:
RefreshContactListIcons(hContact); //the birthday might be changed, refresh icon.
@@ -764,42 +764,42 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
break;
case WWIM_UPDATE_BIRTHDAY:
- {
- MCONTACT hContact = wParam;
- HWND hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
- LVFINDINFO fi = { 0 };
-
- fi.flags = LVFI_PARAM;
- fi.lParam = (LPARAM)hContact;
- int idx = ListView_FindItem(hList, -1, &fi);
- if (-1 == idx)
- UpdateBirthdayEntry(hList, hContact, ListView_GetItemCount(hList), IsDlgButtonChecked(hWnd, IDC_SHOW_ALL), commonData.cShowAgeMode, 1);
- else
- UpdateBirthdayEntry(hList, hContact, idx, IsDlgButtonChecked(hWnd, IDC_SHOW_ALL), commonData.cShowAgeMode, 0);
- SetBirthdaysCount(hWnd);
- }
- break;
+ {
+ MCONTACT hContact = wParam;
+ HWND hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
+ LVFINDINFO fi = { 0 };
+
+ fi.flags = LVFI_PARAM;
+ fi.lParam = (LPARAM)hContact;
+ int idx = ListView_FindItem(hList, -1, &fi);
+ if (-1 == idx)
+ UpdateBirthdayEntry(hList, hContact, ListView_GetItemCount(hList), IsDlgButtonChecked(hWnd, IDC_SHOW_ALL), commonData.cShowAgeMode, 1);
+ else
+ UpdateBirthdayEntry(hList, hContact, idx, IsDlgButtonChecked(hWnd, IDC_SHOW_ALL), commonData.cShowAgeMode, 0);
+ SetBirthdaysCount(hWnd);
+ }
+ break;
case WM_WINDOWPOSCHANGING:
- {
- HDWP hdWnds = BeginDeferWindowPos(2);
- RECT rParent;
- WINDOWPOS *wndPos = (WINDOWPOS *)lParam;
- GetWindowRect(hWnd, &rParent);
+ {
+ HDWP hdWnds = BeginDeferWindowPos(2);
+ RECT rParent;
+ WINDOWPOS *wndPos = (WINDOWPOS *)lParam;
+ GetWindowRect(hWnd, &rParent);
- if (wndPos->cx < MIN_BIRTHDAYS_WIDTH)
- wndPos->cx = MIN_BIRTHDAYS_WIDTH;
+ if (wndPos->cx < MIN_BIRTHDAYS_WIDTH)
+ wndPos->cx = MIN_BIRTHDAYS_WIDTH;
- if (wndPos->cy < MIN_BIRTHDAYS_HEIGHT)
- wndPos->cy = MIN_BIRTHDAYS_HEIGHT;
+ if (wndPos->cy < MIN_BIRTHDAYS_HEIGHT)
+ wndPos->cy = MIN_BIRTHDAYS_HEIGHT;
- AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_CLOSE), &rParent, wndPos, ANCHOR_RIGHT | ANCHOR_BOTTOM);
- AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_SHOW_ALL), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM);
- AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST), &rParent, wndPos, ANCHOR_ALL);
+ AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_CLOSE), &rParent, wndPos, ANCHOR_RIGHT | ANCHOR_BOTTOM);
+ AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_SHOW_ALL), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM);
+ AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST), &rParent, wndPos, ANCHOR_ALL);
- EndDeferWindowPos(hdWnds);
- }
- break;
+ EndDeferWindowPos(hdWnds);
+ }
+ break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
@@ -849,84 +849,84 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hWnd);
- timeout = commonData.cDlgTimeout;
- SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(hListMenu));
- HWND hList = GetDlgItem(hWnd, IDC_UPCOMING_LIST);
-
- mir_subclassWindow(hList, BirthdaysListSubclassProc);
- ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
-
- LVCOLUMN col;
- col.mask = LVCF_TEXT | LVCF_WIDTH;
- col.pszText = TranslateT("Contact");
- col.cx = 300;
- ListView_InsertColumn(hList, 0, &col);
- col.pszText = TranslateT("Age");
- col.cx = 45;
- ListView_InsertColumn(hList, 1, &col);
- col.pszText = TranslateT("DTB");
- col.cx = 45;
- ListView_InsertColumn(hList, 2, &col);
-
- ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
-
- if (timeout > 0)
- SetTimer(hWnd, UPCOMING_TIMER_ID, 1000, NULL);
- Utils_RestoreWindowPosition(hWnd, NULL, ModuleName, "BirthdayListUpcoming");
- }
- return TRUE;
+ {
+ TranslateDialogDefault(hWnd);
+ timeout = commonData.cDlgTimeout;
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(hListMenu));
+ HWND hList = GetDlgItem(hWnd, IDC_UPCOMING_LIST);
+
+ mir_subclassWindow(hList, BirthdaysListSubclassProc);
+ ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
+
+ LVCOLUMN col;
+ col.mask = LVCF_TEXT | LVCF_WIDTH;
+ col.pszText = TranslateT("Contact");
+ col.cx = 300;
+ ListView_InsertColumn(hList, 0, &col);
+ col.pszText = TranslateT("Age");
+ col.cx = 45;
+ ListView_InsertColumn(hList, 1, &col);
+ col.pszText = TranslateT("DTB");
+ col.cx = 45;
+ ListView_InsertColumn(hList, 2, &col);
+
+ ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
+
+ if (timeout > 0)
+ SetTimer(hWnd, UPCOMING_TIMER_ID, 1000, NULL);
+ Utils_RestoreWindowPosition(hWnd, NULL, ModuleName, "BirthdayListUpcoming");
+ }
+ return TRUE;
case WM_TIMER:
- {
- const int MAX_SIZE = 512;
- TCHAR buffer[MAX_SIZE];
- timeout--;
- mir_sntprintf(buffer, SIZEOF(buffer), (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
- SetDlgItemText(hWnd, IDC_CLOSE, buffer);
-
- if (timeout <= 0)
- SendMessage(hWnd, WM_CLOSE, 0, 0);
- }
- break;
+ {
+ const int MAX_SIZE = 512;
+ TCHAR buffer[MAX_SIZE];
+ timeout--;
+ mir_sntprintf(buffer, SIZEOF(buffer), (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
+ SetDlgItemText(hWnd, IDC_CLOSE, buffer);
+
+ if (timeout <= 0)
+ SendMessage(hWnd, WM_CLOSE, 0, 0);
+ }
+ break;
case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WWIM_ADD_UPCOMING_BIRTHDAY:
- {
- PUpcomingBirthday data = (PUpcomingBirthday)wParam;
-
- HWND hList = GetDlgItem(hWnd, IDC_UPCOMING_LIST);
- LVITEM item = { 0 };
- LVFINDINFO fi = { 0 };
-
- fi.flags = LVFI_PARAM;
- fi.lParam = (LPARAM)data->hContact;
- if (-1 != ListView_FindItem(hList, -1, &fi))
- return 0; /* Allready in list. */
-
- int index = ListView_GetItemCount(hList);
- item.iItem = index;
- item.mask = LVIF_PARAM | LVIF_TEXT;
- item.lParam = (LPARAM)data->hContact;
- item.pszText = data->message;
- ListView_InsertItem(hList, &item);
-
- TCHAR buffer[512];
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), data->age);
- ListView_SetItemText(hList, index, 1, buffer);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), data->dtb);
- ListView_SetItemText(hList, index, 2, buffer);
+ {
+ PUpcomingBirthday data = (PUpcomingBirthday)wParam;
- BirthdaysSortParams params = { 0 };
- params.hList = hList;
- params.column = 2;
- ListView_SortItemsEx(hList, BirthdaysCompare, (LPARAM)&params);
- }
- break;
+ HWND hList = GetDlgItem(hWnd, IDC_UPCOMING_LIST);
+ LVITEM item = { 0 };
+ LVFINDINFO fi = { 0 };
+
+ fi.flags = LVFI_PARAM;
+ fi.lParam = (LPARAM)data->hContact;
+ if (-1 != ListView_FindItem(hList, -1, &fi))
+ return 0; /* Allready in list. */
+
+ int index = ListView_GetItemCount(hList);
+ item.iItem = index;
+ item.mask = LVIF_PARAM | LVIF_TEXT;
+ item.lParam = (LPARAM)data->hContact;
+ item.pszText = data->message;
+ ListView_InsertItem(hList, &item);
+
+ TCHAR buffer[512];
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), data->age);
+ ListView_SetItemText(hList, index, 1, buffer);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), data->dtb);
+ ListView_SetItemText(hList, index, 2, buffer);
+
+ BirthdaysSortParams params = { 0 };
+ params.hList = hList;
+ params.column = 2;
+ ListView_SortItemsEx(hList, BirthdaysCompare, (LPARAM)&params);
+ }
+ break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
@@ -937,27 +937,27 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
break;
case WM_GETMINMAXINFO:
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 400;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 400;
((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 160;
- ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 600;
+ ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 600;
((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = 530;
break;
case WM_SIZE:
- {
- int cx, cy;
- RECT rcWin;
- HWND hList = GetDlgItem(hWnd, IDC_UPCOMING_LIST);
- GetWindowRect(hWnd, &rcWin);
-
- cx = rcWin.right - rcWin.left;
- cy = rcWin.bottom - rcWin.top;
- SetWindowPos(hList, NULL, 0, 0, (cx - 30), (cy - 80), (SWP_NOZORDER | SWP_NOMOVE));
- ListView_SetColumnWidth(hList, 0, (cx - 150));
- SetWindowPos(GetDlgItem(hWnd, IDC_CLOSE), NULL, ((cx / 2) - 95), (cy - 67), 0, 0, SWP_NOSIZE);
- RedrawWindow(hWnd, NULL, NULL, (RDW_FRAME | RDW_INVALIDATE));
- }
- break;
+ {
+ int cx, cy;
+ RECT rcWin;
+ HWND hList = GetDlgItem(hWnd, IDC_UPCOMING_LIST);
+ GetWindowRect(hWnd, &rcWin);
+
+ cx = rcWin.right - rcWin.left;
+ cy = rcWin.bottom - rcWin.top;
+ SetWindowPos(hList, NULL, 0, 0, (cx - 30), (cy - 80), (SWP_NOZORDER | SWP_NOMOVE));
+ ListView_SetColumnWidth(hList, 0, (cx - 150));
+ SetWindowPos(GetDlgItem(hWnd, IDC_CLOSE), NULL, ((cx / 2) - 95), (cy - 67), 0, 0, SWP_NOSIZE);
+ RedrawWindow(hWnd, NULL, NULL, (RDW_FRAME | RDW_INVALIDATE));
+ }
+ break;
case WM_DESTROY:
hUpcomingDlg = NULL;
@@ -970,25 +970,22 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
return 0;
}
-DWORD WINAPI OpenMessageWindowThread(void *data)
+void __cdecl OpenMessageWindowThread(void *data)
{
MCONTACT hContact = (MCONTACT)data;
CallServiceSync(MS_MSG_SENDMESSAGE, hContact, 0);
CallServiceSync("SRMsg/LaunchMessageWindow", hContact, 0);
- return 0;
}
int HandlePopupClick(HWND hWnd, int action)
{
switch (action) {
case 2: //OPEN MESSAGE WINDOW
- {
- MCONTACT hContact = (MCONTACT)PUGetContact(hWnd);
- if (hContact) {
- DWORD threadID;
- HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, (void*)hContact, 0, &threadID);
- }
- }//fallthrough
+ {
+ MCONTACT hContact = (MCONTACT)PUGetContact(hWnd);
+ if (hContact)
+ HANDLE thread = mir_forkthread(OpenMessageWindowThread, (void*)hContact);
+ }//fallthrough
case 1: //DISMISS
PUDeletePopup(hWnd);
diff --git a/plugins/WhenWasIt/src/events.cpp b/plugins/WhenWasIt/src/events.cpp
index 27e35e73eb..794f748596 100644
--- a/plugins/WhenWasIt/src/events.cpp
+++ b/plugins/WhenWasIt/src/events.cpp
@@ -25,13 +25,13 @@ HANDLE heContactSendMessage;
int CreateEvents()
{
heContactSendMessage = CreateHookableEvent(ME_WWI_SENDMESSAGE);
-
+
return 0;
}
int DestroyEvents()
{
DestroyHookableEvent(heContactSendMessage);
-
+
return 0;
} \ No newline at end of file
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp
index 3f078ea11d..84519887e3 100644
--- a/plugins/WhenWasIt/src/hooked_events.cpp
+++ b/plugins/WhenWasIt/src/hooked_events.cpp
@@ -49,7 +49,7 @@ static int OnOptionsInitialise(WPARAM wParam, LPARAM)
odp.ptszTitle = LPGENT("Birthdays");
odp.ptszGroup = LPGENT("Contacts");
odp.groupPosition = 910000000;
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = DlgProcOptions;
Options_AddPage(wParam, &odp);
return 0;
@@ -57,11 +57,11 @@ static int OnOptionsInitialise(WPARAM wParam, LPARAM)
static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
- DBCONTACTWRITESETTING *dw = (DBCONTACTWRITESETTING *) lParam;
+ DBCONTACTWRITESETTING *dw = (DBCONTACTWRITESETTING *)lParam;
DBVARIANT dv = dw->value;
if ((strcmp(dw->szModule, DUMMY_MODULE) == 0) && (strcmp(dw->szSetting, DUMMY_SETTING) == 0))
RefreshContactListIcons(hContact);
-
+
return 0;
}
@@ -69,7 +69,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
{
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded);
-
+
UpdateTimers();
return 0;
}
@@ -153,9 +153,9 @@ int UpdateTimers()
long interval = db_get_dw(NULL, ModuleName, "Interval", CHECK_INTERVAL);
interval *= 1000 * 60 * 60; //go from miliseconds to hours
hCheckTimer = SetTimer(NULL, 0, interval, OnCheckTimer);
- if ( !hDateChangeTimer)
+ if (!hDateChangeTimer)
hDateChangeTimer = SetTimer(NULL, 0, 1000 * DATE_CHANGE_CHECK_INTERVAL, OnDateChangeTimer);
-
+
return 0;
}
diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp
index 3a9d670b8a..e3dac6f51f 100644
--- a/plugins/WhenWasIt/src/icons.cpp
+++ b/plugins/WhenWasIt/src/icons.cpp
@@ -24,10 +24,10 @@ HANDLE hCheckMenu, hListMenu, hAddBirthdayContact, hRefreshUserDetails;
HANDLE hImportBirthdays, hExportBirthdays;
const int cDTB = 10;
-HANDLE hDTB[cDTB] = {NULL};
+HANDLE hDTB[cDTB] = { NULL };
HANDLE hDTBMore = NULL;
-HANDLE hWWIExtraIcons = (HANDLE) -1;
+HANDLE hWWIExtraIcons = (HANDLE)-1;
static HANDLE AddIcon(char *name, char *description, TCHAR *tszPath, int iDefaultIdx)
{
@@ -62,7 +62,7 @@ int AddIcons()
for (int i = 2; i < cDTB; i++) {
mir_snprintf(name, SIZEOF(name), "DTB%d", i);
mir_snprintf(description, SIZEOF(description), Translate("%d days to birthday"), i);
- hDTB[i] = AddIcon(name, description, tszPath, IDI_DTB0+i);
+ hDTB[i] = AddIcon(name, description, tszPath, IDI_DTB0 + i);
}
mir_snprintf(description, SIZEOF(description), Translate("More than %d days to birthday"), cDTB - 1);
hDTBMore = AddIcon("DTBMore", description, tszPath, IDI_DTBMORE);
diff --git a/plugins/WhenWasIt/src/icons.h b/plugins/WhenWasIt/src/icons.h
index d5c3320926..df3766b2ad 100644
--- a/plugins/WhenWasIt/src/icons.h
+++ b/plugins/WhenWasIt/src/icons.h
@@ -39,7 +39,8 @@ int AddIcons();
HANDLE GetDTBIconHandle(int dtb);
__forceinline HICON GetDTBIcon(int dtb)
-{ return Skin_GetIconByHandle( GetDTBIconHandle(dtb));
+{
+ return Skin_GetIconByHandle(GetDTBIconHandle(dtb));
}
#endif //M_WWI_ICONS_H \ No newline at end of file
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp
index e3fcdbd1db..79c518246d 100644
--- a/plugins/WhenWasIt/src/notifiers.cpp
+++ b/plugins/WhenWasIt/src/notifiers.cpp
@@ -31,12 +31,12 @@ void FillPopupData(POPUPDATAT &pd, int dtb)
void PopupNotifyNoBirthdays()
{
- POPUPDATAT pd = {0};
+ POPUPDATAT pd = { 0 };
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);
+ _tcsncpy(pd.lptzContactName, TranslateT("WhenWasIt"), MAX_CONTACTNAME - 1);
+ _tcsncpy(pd.lptzText, TranslateT("No upcoming birthdays."), MAX_SECONDLINE - 1);
PUAddPopupT(&pd);
}
@@ -48,7 +48,7 @@ TCHAR *BuildDTBText(int dtb, TCHAR *name, TCHAR *text, int size)
mir_sntprintf(text, size, TranslateT("%s has birthday tomorrow."), name);
else
mir_sntprintf(text, size, TranslateT("%s has birthday today."), name);
-
+
return text;
}
@@ -60,7 +60,7 @@ TCHAR *BuildDABText(int dab, TCHAR *name, TCHAR *text, int size)
mir_sntprintf(text, size, TranslateT("%s had birthday yesterday."), name);
else
mir_sntprintf(text, size, TranslateT("%s has birthday today (Should not happen, please report)."), name);
-
+
return text;
}
@@ -74,13 +74,13 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
TCHAR text[1024];
BuildDTBText(dtb, name, text, SIZEOF(text));
int gender = GetContactGender(hContact);
-
- POPUPDATAT pd = {0};
+
+ POPUPDATAT pd = { 0 };
FillPopupData(pd, dtb);
pd.lchContact = hContact;
pd.PluginWindowProc = DlgProcPopup;
pd.lchIcon = GetDTBIcon(dtb);
-
+
mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
TCHAR *sex;
switch (toupper(gender)) {
@@ -101,8 +101,8 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
}
else
- mir_tstrncpy(pd.lptzText, text, MAX_SECONDLINE-1);
-
+ mir_tstrncpy(pd.lptzText, text, MAX_SECONDLINE - 1);
+
PUAddPopupT(&pd);
return 0;
@@ -118,17 +118,17 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
TCHAR text[1024];
BuildDABText(dab, name, text, SIZEOF(text));
int gender = GetContactGender(hContact);
-
- POPUPDATAT pd = {0};
+
+ POPUPDATAT pd = { 0 };
FillPopupData(pd, dab);
pd.lchContact = hContact;
pd.PluginWindowProc = DlgProcPopup;
pd.lchIcon = GetDTBIcon(dab);
-
+
mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
TCHAR *sex;
switch (toupper(gender)) {
- case _T('M'):
+ case _T('M'):
sex = TranslateT("He");
break;
case _T('F'):
@@ -144,8 +144,8 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
else
mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
}
- else
- mir_tstrncpy(pd.lptzText, text, MAX_SECONDLINE-1);
+ else
+ mir_tstrncpy(pd.lptzText, text, MAX_SECONDLINE - 1);
PUAddPopupT(&pd);
return 0;
@@ -162,14 +162,14 @@ int DialogNotifyBirthday(MCONTACT hContact, int dtb, int age)
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
}
- TUpcomingBirthday data = {0};
+ TUpcomingBirthday data = { 0 };
data.name = name;
data.message = text;
data.dtb = dtb;
data.hContact = hContact;
data.age = age;
-
- SendMessage(hUpcomingDlg, WWIM_ADD_UPCOMING_BIRTHDAY, (WPARAM) &data, NULL);
+
+ SendMessage(hUpcomingDlg, WWIM_ADD_UPCOMING_BIRTHDAY, (WPARAM)&data, NULL);
return 0;
}
@@ -179,19 +179,19 @@ int DialogNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
TCHAR text[1024];
BuildDABText(dab, name, text, SIZEOF(text));
- if ( !hUpcomingDlg) {
+ if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
}
-
- TUpcomingBirthday data = {0};
+
+ TUpcomingBirthday data = { 0 };
data.name = name;
data.message = text;
data.dtb = -dab;
data.hContact = hContact;
data.age = age;
-
- SendMessage(hUpcomingDlg, WWIM_ADD_UPCOMING_BIRTHDAY, (WPARAM) &data, NULL);
+
+ SendMessage(hUpcomingDlg, WWIM_ADD_UPCOMING_BIRTHDAY, (WPARAM)&data, NULL);
return 0;
}
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index bf8fa46ff5..4b77d61724 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -160,7 +160,7 @@ INT_PTR CheckBirthdaysService(WPARAM wParam, LPARAM lParam)
INT_PTR ShowListService(WPARAM wParam, LPARAM lParam)
{
- if ( !hBirthdaysDlg)
+ if (!hBirthdaysDlg)
hBirthdaysDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_BIRTHDAYS), NULL, DlgProcBirthdays);
ShowWindow(hBirthdaysDlg, SW_SHOW);
@@ -171,14 +171,14 @@ INT_PTR AddBirthdayService(WPARAM hContact, LPARAM lParam)
{
HWND hWnd = WindowList_Find(hAddBirthdayWndsList, hContact);
if (!hWnd)
- hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), NULL, DlgProcAddBirthday, (LPARAM) hContact);
+ hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), NULL, DlgProcAddBirthday, (LPARAM)hContact);
return ShowWindow(hWnd, SW_SHOW);
}
void ShowPopupMessage(TCHAR *title, TCHAR *message, HANDLE icon)
{
- POPUPDATAT pd = {0};
+ POPUPDATAT pd = { 0 };
pd.lchIcon = Skin_GetIconByHandle(icon);
_tcsncpy(pd.lptzContactName, title, MAX_CONTACTNAME - 1);
_tcsncpy(pd.lptzText, message, MAX_SECONDLINE - 1);
@@ -187,7 +187,7 @@ void ShowPopupMessage(TCHAR *title, TCHAR *message, HANDLE icon)
PUAddPopupT(&pd);
}
-DWORD WINAPI RefreshUserDetailsWorkerThread(LPVOID param)
+void __cdecl RefreshUserDetailsWorkerThread(void *param)
{
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Starting to refresh user details"), hRefreshUserDetails);
int delay = db_get_w(NULL, ModuleName, "UpdateDelay", REFRESH_DETAILS_DELAY);
@@ -201,18 +201,11 @@ DWORD WINAPI RefreshUserDetailsWorkerThread(LPVOID param)
Sleep(delay); //sleep for a few seconds between requests
}
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done refreshing user details"), hRefreshUserDetails);
- return 0;
}
INT_PTR RefreshUserDetailsService(WPARAM wParam, LPARAM lParam)
{
- DWORD threadID;
- HANDLE result = CreateThread(NULL, 0, RefreshUserDetailsWorkerThread, NULL, 0, &threadID);
- if ( !result) {
- TCHAR buffer[1024];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Could not create worker thread. Error#%d - threadID %d"), GetLastError(), threadID);
- MessageBox(0, buffer, TranslateT("Error"), MB_OK | MB_ICONERROR);
- }
+ HANDLE result = mir_forkthread(RefreshUserDetailsWorkerThread, 0);
if ((result != NULL) && (result != INVALID_HANDLE_VALUE))
CloseHandle(result);
@@ -222,8 +215,8 @@ INT_PTR RefreshUserDetailsService(WPARAM wParam, LPARAM lParam)
INT_PTR ImportBirthdaysService(WPARAM wParam, LPARAM lParam)
{
- TCHAR fileName[1024] = {0};
- OPENFILENAME of = {0};
+ TCHAR fileName[1024] = { 0 };
+ OPENFILENAME of = { 0 };
of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
TCHAR filter[MAX_PATH];
@@ -234,7 +227,7 @@ INT_PTR ImportBirthdaysService(WPARAM wParam, LPARAM lParam)
of.lpstrTitle = TranslateT("Please select a file to import birthdays from...");
of.Flags = OFN_FILEMUSTEXIST;
- if ( GetOpenFileName(&of)) {
+ if (GetOpenFileName(&of)) {
TCHAR buffer[2048];
mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Importing birthdays from file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hImportBirthdays);
@@ -247,8 +240,8 @@ INT_PTR ImportBirthdaysService(WPARAM wParam, LPARAM lParam)
INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam)
{
- TCHAR fileName[1024]= {0};
- OPENFILENAME of = {0};
+ TCHAR fileName[1024] = { 0 };
+ OPENFILENAME of = { 0 };
of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
TCHAR filter[MAX_PATH];
@@ -258,10 +251,10 @@ INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam)
of.nMaxFile = SIZEOF(fileName);
of.lpstrTitle = TranslateT("Please select a file to export birthdays to...");
- if ( GetSaveFileName(&of)) {
+ if (GetSaveFileName(&of)) {
TCHAR buffer[2048];
TCHAR *fn = _tcsrchr(fileName, _T('\\')) + 1;
- if ( !_tcschr(fn, _T('.')))
+ if (!_tcschr(fn, _T('.')))
_tcscat(fileName, _T(BIRTHDAY_EXTENSION));
mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Exporting birthdays to file: %s"), fileName);
@@ -276,7 +269,7 @@ INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam)
int DoImport(TCHAR *fileName)
{
FILE *fin = _tfopen(fileName, _T("rt"));
- if ( !fin) {
+ if (!fin) {
MessageBox(0, TranslateT("Could not open file to import birthdays"), TranslateT("Error"), MB_OK | MB_ICONERROR);
return 1;
}
@@ -325,7 +318,7 @@ int DoImport(TCHAR *fileName)
int DoExport(TCHAR *fileName)
{
FILE *fout = _tfopen(fileName, _T("wt"));
- if ( !fout) {
+ if (!fout) {
MessageBox(0, TranslateT("Could not open file to export birthdays"), TranslateT("Error"), MB_OK | MB_ICONERROR);
return 1;
}
@@ -336,7 +329,7 @@ int DoExport(TCHAR *fileName)
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)) {
+ if (IsDOBValid(year, month, day)) {
char *szProto = GetContactProto(hContact);
TCHAR *szHandle = GetContactID(hContact, szProto);
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp
index 11f10e26e6..56db42471e 100644
--- a/plugins/WhenWasIt/src/utils.cpp
+++ b/plugins/WhenWasIt/src/utils.cpp
@@ -31,30 +31,30 @@ int LogInit()
int Log(char *format, ...)
{
- #ifdef _DEBUG
- char str[4096];
- va_list vararg;
- int tBytes;
- FILE *fout = fopen(LOG_FILE, "at");
- if (!fout)
- return -1;
-
- time_t tNow = time(NULL);
- struct tm *now = localtime(&tNow);
- strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now);
- fputs(str, fout);
- va_start(vararg, format);
-
- tBytes = mir_vsnprintf(str, sizeof(str), format, vararg);
- if (tBytes > 0)
- str[tBytes] = 0;
-
- va_end(vararg);
- if (str[strlen(str) - 1] != '\n')
- strcat(str, "\n");
- fputs(str, fout);
- fclose(fout);
- #endif
+#ifdef _DEBUG
+ char str[4096];
+ va_list vararg;
+ int tBytes;
+ FILE *fout = fopen(LOG_FILE, "at");
+ if (!fout)
+ return -1;
+
+ time_t tNow = time(NULL);
+ struct tm *now = localtime(&tNow);
+ strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now);
+ fputs(str, fout);
+ va_start(vararg, format);
+
+ tBytes = mir_vsnprintf(str, sizeof(str), format, vararg);
+ if (tBytes > 0)
+ str[tBytes] = 0;
+
+ va_end(vararg);
+ if (str[strlen(str) - 1] != '\n')
+ strcat(str, "\n");
+ fputs(str, fout);
+ fclose(fout);
+#endif
return 0;
}