summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-02-28 13:35:22 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-02-28 13:35:22 +0000
commita0c7844f40b5f5b7f7948d095218889594e2f0ca (patch)
tree1e1e47807c5acfac9774af28b9fc77d5c5cff346
parentbce04f5be6d0e881b21e8fd43fb12a6045756ebd (diff)
WhenWasIt:
- minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@12288 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/WhenWasIt/src/WhenWasIt.cpp64
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp3
-rw-r--r--plugins/WhenWasIt/src/hooked_events.cpp73
-rw-r--r--plugins/WhenWasIt/src/notifiers.cpp20
-rw-r--r--plugins/WhenWasIt/src/services.cpp4
5 files changed, 82 insertions, 82 deletions
diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp
index d5d3217807..178c880b64 100644
--- a/plugins/WhenWasIt/src/WhenWasIt.cpp
+++ b/plugins/WhenWasIt/src/WhenWasIt.cpp
@@ -27,6 +27,14 @@ HWND hUpcomingDlg = NULL;
HANDLE hAddBirthdayWndsList = NULL;
int hLangpack;
+HANDLE hmCheckBirthdays = NULL;
+HANDLE hmBirthdayList = NULL;
+HANDLE hmRefreshDetails = NULL;
+HANDLE hmAddChangeBirthday = NULL;
+HANDLE hmImportBirthdays = NULL;
+HANDLE hmExportBirthdays = NULL;
+
+
CommonData commonData = {0};
CLIST_INTERFACE *pcli;
@@ -71,9 +79,63 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvents();
hAddBirthdayWndsList = WindowList_Create();
+
+ CLISTMENUITEM cl = { sizeof(cl) };
+ cl.position = 10000000;
+ cl.pszPopupName = LPGEN("Birthdays (When Was It)");
+
+ cl.pszService = MS_WWI_CHECK_BIRTHDAYS;
+ cl.icolibItem = hCheckMenu;
+ cl.pszName = LPGEN("Check for birthdays");
+ hmCheckBirthdays = Menu_AddMainMenuItem(&cl);
- Log("%s", "Leaving function " __FUNCTION__);
+ 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;
+ cl.pszName = LPGEN("Add/change user &birthday");
+ hmAddChangeBirthday = Menu_AddContactMenuItem(&cl);
+
+ // Register hotkeys
+ HOTKEYDESC hotkey = { sizeof(hotkey) };
+ hotkey.pszSection = LPGEN("Birthdays");
+
+ hotkey.pszName = "wwi_birthday_list";
+ 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;
}
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index 84cf9ea991..f8b0c66fa6 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -880,7 +880,8 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
{
const int MAX_SIZE = 512;
TCHAR buffer[MAX_SIZE];
- mir_sntprintf(buffer, SIZEOF(buffer), (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), --timeout);
+ 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)
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp
index 71be90da7a..24858892f9 100644
--- a/plugins/WhenWasIt/src/hooked_events.cpp
+++ b/plugins/WhenWasIt/src/hooked_events.cpp
@@ -24,20 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define EXCLUDE_HIDDEN 1
#define EXCLUDE_IGNORED 2
-
-HANDLE hmCheckBirthdays = NULL;
-HANDLE hmBirthdayList = NULL;
-HANDLE hmRefreshDetails = NULL;
-HANDLE hmAddChangeBirthday = NULL;
-HANDLE hmImportBirthdays = NULL;
-HANDLE hmExportBirthdays = NULL;
-
UINT_PTR hCheckTimer = NULL;
UINT_PTR hDateChangeTimer = NULL;
int currentDay;
-static int OnTopToolBarModuleLoaded(WPARAM wParam, LPARAM lParam)
+static int OnTopToolBarModuleLoaded(WPARAM, LPARAM)
{
TTBButton ttb = { sizeof(ttb) };
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
@@ -48,7 +40,7 @@ static int OnTopToolBarModuleLoaded(WPARAM wParam, LPARAM lParam)
return 0;
}
-static int OnOptionsInitialise(WPARAM wParam, LPARAM lParam)
+static int OnOptionsInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
@@ -73,67 +65,12 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
-int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
+int OnModulesLoaded(WPARAM, LPARAM)
{
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded);
- SkinAddNewSoundExT(BIRTHDAY_NEAR_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday near"));
- SkinAddNewSoundExT(BIRTHDAY_TODAY_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday today"));
-
UpdateTimers();
-
- CLISTMENUITEM cl = { sizeof(cl) };
- cl.position = 10000000;
- cl.pszPopupName = LPGEN("Birthdays (When Was It)");
-
- cl.pszService = MS_WWI_CHECK_BIRTHDAYS;
- 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;
- cl.pszName = LPGEN("Add/change user &birthday");
- hmAddChangeBirthday = Menu_AddContactMenuItem(&cl);
-
- // Register hotkeys
- HOTKEYDESC hotkey = { sizeof(hotkey) };
- hotkey.pszSection = LPGEN("Birthdays");
-
- hotkey.pszName = "wwi_birthday_list";
- 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);
-
return 0;
}
@@ -215,9 +152,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, (TIMERPROC) OnCheckTimer);
+ hCheckTimer = SetTimer(NULL, 0, interval, OnCheckTimer);
if ( !hDateChangeTimer)
- hDateChangeTimer = SetTimer(NULL, 0, 1000 * DATE_CHANGE_CHECK_INTERVAL, (TIMERPROC) OnDateChangeTimer);
+ hDateChangeTimer = SetTimer(NULL, 0, 1000 * DATE_CHANGE_CHECK_INTERVAL, OnDateChangeTimer);
return 0;
}
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp
index 336970b224..e3fcdbd1db 100644
--- a/plugins/WhenWasIt/src/notifiers.cpp
+++ b/plugins/WhenWasIt/src/notifiers.cpp
@@ -35,8 +35,8 @@ void PopupNotifyNoBirthdays()
FillPopupData(pd, -1);
pd.lchIcon = GetDTBIcon(-1);
- _tcscpy(pd.lptzContactName, TranslateT("WhenWasIt"));
- _tcscpy(pd.lptzText, TranslateT("No upcoming birthdays."));
+ _tcsncpy(pd.lptzContactName, TranslateT("WhenWasIt"), MAX_CONTACTNAME -1);
+ _tcsncpy(pd.lptzText, TranslateT("No upcoming birthdays."), MAX_SECONDLINE -1);
PUAddPopupT(&pd);
}
@@ -81,7 +81,7 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
pd.PluginWindowProc = DlgProcPopup;
pd.lchIcon = GetDTBIcon(dtb);
- mir_sntprintf(pd.lptzContactName, SIZEOF(pd.lptzContactName), TranslateT("Birthday - %s"), name);
+ mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
TCHAR *sex;
switch (toupper(gender)) {
case _T('M'):
@@ -96,12 +96,12 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
}
if (age > 0) {
if (dtb > 0)
- mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s will be %d years old."), text, sex, age);
+ mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s will be %d years old."), text, sex, age);
else
- mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
+ mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
}
else
- mir_tstrncpy(pd.lptzText, text, mir_tstrlen(text));
+ mir_tstrncpy(pd.lptzText, text, MAX_SECONDLINE-1);
PUAddPopupT(&pd);
@@ -125,7 +125,7 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
pd.PluginWindowProc = DlgProcPopup;
pd.lchIcon = GetDTBIcon(dab);
- mir_sntprintf(pd.lptzContactName, SIZEOF(pd.lptzContactName), TranslateT("Birthday - %s"), name);
+ mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME, TranslateT("Birthday - %s"), name);
TCHAR *sex;
switch (toupper(gender)) {
case _T('M'):
@@ -140,12 +140,12 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
}
if (age > 0){
if (dab > 0)
- mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
+ mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
else
- mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
+ mir_sntprintf(pd.lptzText, MAX_SECONDLINE, TranslateT("%s\n%s just turned %d."), text, sex, age);
}
else
- mir_tstrncpy(pd.lptzText, text, mir_tstrlen(text));
+ mir_tstrncpy(pd.lptzText, text, MAX_SECONDLINE-1);
PUAddPopupT(&pd);
return 0;
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index 4fde49d657..bf8fa46ff5 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -180,8 +180,8 @@ void ShowPopupMessage(TCHAR *title, TCHAR *message, HANDLE icon)
{
POPUPDATAT pd = {0};
pd.lchIcon = Skin_GetIconByHandle(icon);
- _tcscpy(pd.lptzContactName, title);
- _tcscpy(pd.lptzText, message);
+ _tcsncpy(pd.lptzContactName, title, MAX_CONTACTNAME - 1);
+ _tcsncpy(pd.lptzText, message, MAX_SECONDLINE - 1);
pd.colorText = commonData.foreground;
pd.colorBack = commonData.background;
PUAddPopupT(&pd);