summaryrefslogtreecommitdiff
path: root/src/modules/clist
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/clist')
-rw-r--r--src/modules/clist/clistmod.cpp2
-rw-r--r--src/modules/clist/clistsettings.cpp13
-rw-r--r--src/modules/clist/clui.cpp4
-rw-r--r--src/modules/clist/genmenu.cpp89
4 files changed, 63 insertions, 45 deletions
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp
index 5a2346748c..22e7fbb493 100644
--- a/src/modules/clist/clistmod.cpp
+++ b/src/modules/clist/clistmod.cpp
@@ -392,7 +392,7 @@ int fnShowHide(WPARAM, LPARAM)
//this forces the window onto the visible screen
GetWindowRect(cli.hwndContactList, &rcWindow);
- if (Utils_AssertInsideScreen(&rcWindow) == 1) {
+ if (AssertInsideScreen(rcWindow) == 1) {
MoveWindow(cli.hwndContactList, rcWindow.left, rcWindow.top,
rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
}
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp
index b07344462f..5d748b175f 100644
--- a/src/modules/clist/clistsettings.cpp
+++ b/src/modules/clist/clistsettings.cpp
@@ -153,7 +153,7 @@ INT_PTR GetContactDisplayName(WPARAM hContact, LPARAM lParam)
else if (lParam != GCDNF_NOMYHANDLE) {
cacheEntry = cli.pfnGetCacheEntry(hContact);
if (cacheEntry->tszName) {
- strncpy(retVal, _T2A(cacheEntry->tszName), SIZEOF(retVal));
+ strncpy_s(retVal, _T2A(cacheEntry->tszName), _TRUNCATE);
return (INT_PTR)retVal;
}
}
@@ -166,7 +166,7 @@ INT_PTR GetContactDisplayName(WPARAM hContact, LPARAM lParam)
ci.dwFlag = ((lParam == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR;
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
- strncpy(retVal, _T2A(ci.pszVal), SIZEOF(retVal));
+ strncpy_s(retVal, _T2A(ci.pszVal), _TRUNCATE);
if (cacheEntry == NULL) {
mir_free(ci.pszVal);
return (INT_PTR)mir_strdup(retVal);
@@ -212,20 +212,21 @@ int ContactDeleted(WPARAM wParam, LPARAM)
int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- DBVARIANT dbv;
// Early exit
if (hContact == NULL)
return 0;
+ DBVARIANT dbv;
dbv.pszVal = NULL;
if (!db_get(hContact, "Protocol", "p", &dbv)) {
if (!strcmp(cws->szModule, dbv.pszVal)) {
cli.pfnInvalidateDisplayNameCacheEntry(hContact);
if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName")
- || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
- CallService(MS_CLUI_CONTACTRENAMED, hContact, 0);
- }
+ || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail"))
+ {
+ CallService(MS_CLUI_CONTACTRENAMED, hContact, 0);
+ }
else if (!strcmp(cws->szSetting, "Status")) {
if (!db_get_b(hContact, "CList", "Hidden", 0)) {
if (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) {
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp
index 8c03793121..74afdda313 100644
--- a/src/modules/clist/clui.cpp
+++ b/src/modules/clist/clui.cpp
@@ -291,7 +291,7 @@ int LoadCLUIModule(void)
pos.right = pos.left + (int)db_get_dw(NULL, "CList", "Width", 108);
pos.bottom = pos.top + (int)db_get_dw(NULL, "CList", "Height", 310);
- Utils_AssertInsideScreen(&pos);
+ AssertInsideScreen(pos);
cli.hwndContactList = CreateWindowEx(
(db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW),
@@ -750,7 +750,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
{
RECT rc;
GetWindowRect(hwnd, &rc);
- if (Utils_AssertInsideScreen(&rc) == 1)
+ if (AssertInsideScreen(rc) == 1)
MoveWindow(hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
}
return DefWindowProc(hwnd, msg, wParam, lParam);
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 9391a8693d..d3a9728510 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -109,8 +109,9 @@ PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem parent, pfnWalkFunc func, v
}
///////////////////////////////////////////////////////////////////////////////
-//wparam = 0
-//lparam = LPMEASUREITEMSTRUCT
+// wparam = 0
+// lparam = LPMEASUREITEMSTRUCT
+
int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis)
{
if (!bIsGenMenuInited)
@@ -136,8 +137,9 @@ int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis)
}
///////////////////////////////////////////////////////////////////////////////
-//wparam = 0
-//lparam = LPDRAWITEMSTRUCT
+// wparam = 0
+// lparam = LPDRAWITEMSTRUCT
+
int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis)
{
if (!bIsGenMenuInited)
@@ -190,7 +192,9 @@ int MO_RemoveAllObjects()
return 0;
}
-//wparam = MenuObjectHandle
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuObjectHandle
+
INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM)
{
if (!bIsGenMenuInited)
@@ -206,8 +210,10 @@ INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM)
return 0;
}
-//wparam = MenuObjectHandle
-//lparam = vKey
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuObjectHandle
+// lparam = vKey
+
INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey)
{
if (!bIsGenMenuInited)
@@ -255,8 +261,9 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam)
return NULL;
}
-//wparam = MenuItemHandle
-//lparam = PMO_MenuItem
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuItemHandle
+// lparam = PMO_MenuItem
INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam)
{
PMO_MenuItem mi = (PMO_MenuItem)lParam;
@@ -290,8 +297,10 @@ INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM)
return (pimi) ? (INT_PTR)MO_RecursiveWalkMenu(pimi, FindDefaultItem, NULL) : NULL;
}
-//wparam MenuItemHandle
-//lparam PMO_MenuItem
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam MenuItemHandle
+// lparam PMO_MenuItem
+
int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi)
{
int oldflags;
@@ -349,9 +358,11 @@ int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi)
return 0;
}
-//wparam MenuItemHandle
-//return ownerdata useful to free ownerdata before delete menu item,
-//NULL on error.
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam MenuItemHandle
+// return ownerdata useful to free ownerdata before delete menu item,
+// NULL on error.
+
INT_PTR MO_MenuItemGetOwnerData(WPARAM wParam, LPARAM)
{
if (!bIsGenMenuInited)
@@ -381,7 +392,8 @@ PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU wParam)
return result;
}
-//LOWORD(wparam) menuident
+/////////////////////////////////////////////////////////////////////////////////////////
+// LOWORD(wparam) menuident
static int FindMenuByCommand(PMO_IntMenuItem pimi, void* pCommand)
{
@@ -495,9 +507,11 @@ int MO_SetOptionsMenuObject(HANDLE handle, int setting, INT_PTR value)
return res;
}
-//wparam = LPCSTR szDisplayName;
-//lparam = PMenuParam;
-//result = MenuObjectHandle
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = LPCSTR szDisplayName;
+// lparam = PMenuParam;
+// result = MenuObjectHandle
+
INT_PTR MO_CreateNewMenuObject(WPARAM wParam, LPARAM lParam)
{
TMenuParam *pmp = (TMenuParam *)lParam;
@@ -517,8 +531,9 @@ INT_PTR MO_CreateNewMenuObject(WPARAM wParam, LPARAM lParam)
return p->id;
}
-//wparam = MenuItemHandle
-//lparam = 0
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuItemHandle
+// lparam = 0
static int FreeMenuItem(TMO_IntMenuItem* pimi, void*)
{
@@ -612,15 +627,17 @@ static int GetNextObjectMenuItemId()
return NextObjectMenuItemId++;
}
-//wparam = MenuObjectHandle
-//lparam = PMO_MenuItem
-//return MenuItemHandle
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuObjectHandle
+// lparam = PMO_MenuItem
+// return MenuItemHandle
+
PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
{
if (!bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem))
return NULL;
- //old mode
+ // old mode
if (!(pmi->flags & CMIF_ROOTHANDLE))
return MO_AddOldNewMenuItem(menuobjecthandle, pmi);
@@ -674,8 +691,9 @@ PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
return p;
}
-//wparam = MenuObjectHandle
-//lparam = PMO_MenuItem
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuObjectHandle
+// lparam = PMO_MenuItem
int FindRoot(PMO_IntMenuItem pimi, void* param)
{
@@ -703,7 +721,7 @@ PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
//is item with popup or not
if (pmi->root == 0) {
- //yes, this without popup
+ // yes, this without popup
pmi->root = NULL; //first level
}
else { // no, search for needed root and create it if need
@@ -717,22 +735,22 @@ PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
mir_free(tszRoot);
if (oldroot == NULL) {
- //not found, creating root
+ // not found, creating root
TMO_MenuItem tmi = *pmi;
tmi.flags |= CMIF_ROOTHANDLE;
tmi.ownerdata = 0;
tmi.root = NULL;
- //copy pszPopupName
+ // copy pszPopupName
tmi.ptszName = (TCHAR*)pmi->root;
if ((oldroot = MO_AddNewMenuItem(menuobjecthandle, &tmi)) != NULL)
MO_SetOptionsMenuItem(oldroot, OPT_MENUITEMSETUNIQNAME, (INT_PTR)pmi->root);
}
pmi->root = oldroot;
- //popup will be created in next commands
+ // popup will be created in next commands
}
pmi->flags |= CMIF_ROOTHANDLE;
- //add popup(root allready exists)
+ // add popup(root allready exists)
return MO_AddNewMenuItem(menuobjecthandle, pmi);
}
@@ -786,12 +804,12 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l
if (pimi == NULL)
return;
- //check for separator before
+ // check for separator before
if (uItem) {
UINT fType = GetMenuItemTypeData(hMenu, uItem-1, p);
if (p != NULL && fType != MFT_SEPARATOR) {
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) {
- //but might be supposed to be after the next one instead
+ // but might be supposed to be after the next one instead
if (!(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR))
InsertSeparator(hMenu, uItem);
uItem++;
@@ -799,7 +817,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l
}
}
- //check for separator after
+ // check for separator after
if (uItem < GetMenuItemCount(hMenu)) {
UINT fType = GetMenuItemTypeData(hMenu, uItem, p);
if (p != NULL && fType != MFT_SEPARATOR)
@@ -1030,7 +1048,6 @@ int OnIconLibChanges(WPARAM, LPARAM)
}
/////////////////////////////////////////////////////////////////////////////////////////
-//
static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
{
@@ -1084,7 +1101,7 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
int RegisterAllIconsInIconLib()
{
- //register all icons
+ // register all icons
for (int mo=0; mo < g_menus.getCount(); mo++) {
if ((int)hStatusMenuObject == g_menus[mo]->id) //skip status menu
continue;