summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r--plugins/UserInfoEx/src/mir_menuitems.cpp24
-rw-r--r--plugins/UserInfoEx/src/svc_email.cpp18
-rw-r--r--plugins/UserInfoEx/src/svc_homepage.cpp14
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp8
4 files changed, 18 insertions, 46 deletions
diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp
index 9f140fb4b7..e7fdbeaaf5 100644
--- a/plugins/UserInfoEx/src/mir_menuitems.cpp
+++ b/plugins/UserInfoEx/src/mir_menuitems.cpp
@@ -80,7 +80,6 @@ VOID RebuildContact()
{
int flag = 0;
BYTE item = 0;
- CLISTMENUITEM mi;
HGENMENU mhRoot = HGENMENU_ROOT;
HGENMENU mhExIm = HGENMENU_ROOT;
@@ -98,10 +97,9 @@ VOID RebuildContact()
// delete all MenuItems and set all bytes 0 to avoid problems
RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem));
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
// support new genmenu style
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTHANDLE;
mi.hParentMenu = HGENMENU_ROOT;
@@ -182,7 +180,6 @@ VOID RebuildMain()
{
int flag = 0;
BYTE item = 0;
- CLISTMENUITEM mi;
HGENMENU mhRoot = HGENMENU_ROOT;
HGENMENU mhExIm = HGENMENU_ROOT;
@@ -197,10 +194,9 @@ VOID RebuildMain()
// delete all MenuItems and set all bytes 0 to avoid problems
RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem));
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
// support new genmenu style
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTHANDLE;
mi.hParentMenu = HGENMENU_ROOT;
@@ -321,7 +317,6 @@ VOID RebuildGroup()
{
int flag = 0;
BYTE item = 0;
- CLISTMENUITEM mi;
GroupMenuParam gmp = {0};
HGENMENU mhRoot = HGENMENU_ROOT;
@@ -337,12 +332,12 @@ VOID RebuildGroup()
// delete all MenuItems and set all bytes 0 to avoid problems
RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem));
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
// create service name main (prevent to generate {(Null)/Ex-/Import Group} in db) and set pointer to end it
char text[ 200 ];
strcpy( text, "UserInfo");
+
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = text;
char* tDest = text + strlen( text );
@@ -419,7 +414,6 @@ VOID RebuildSubGroup()
{
int flag = 0;
BYTE item = 0;
- CLISTMENUITEM mi;
GroupMenuParam gmp = {0};
HGENMENU mhRoot = HGENMENU_ROOT;
@@ -435,12 +429,12 @@ VOID RebuildSubGroup()
// delete all MenuItems and set all bytes 0 to avoid problems
RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem));
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
// create service name main (prevent to generate {(Null)/Ex-/Import Group} in db) and set pointer to end it
char text[ 200 ];
strcpy( text, "UserInfo");
+
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = text;
char* tDest = text + strlen( text );
@@ -529,7 +523,6 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam)
BYTE i = 0, item = 0;
TCHAR sztName[MAXSETTING];
PROTOACCOUNT* pAccountName = NULL;
- CLISTMENUITEM mi;
mProtoCount = pcli->menuProtoCount;
@@ -556,15 +549,12 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam)
DB::Setting::WriteByte(SET_MI_ACCOUNT, flag);
}
-
// loop for all account names
for (i = 0; i < mProtoCount; i++) {
// set all bytes 0 to avoid problems
item = 0;
mhRoot = 0;
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
mhRoot = pcli->menuProtos[i].pMenu;
if ( mhRoot == NULL )
@@ -574,6 +564,8 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam)
// create service name main (account module name) and set pointer to end it
char text[ 200 ];
strcpy( text, pcli->menuProtos[i].szProto);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = text;
char* tDest = text + strlen( text );
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp
index 563d0dabf4..ea4741414d 100644
--- a/plugins/UserInfoEx/src/svc_email.cpp
+++ b/plugins/UserInfoEx/src/svc_email.cpp
@@ -180,22 +180,15 @@ static INT OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw
**/
static INT OnPreBuildMenu(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM mi;
- LPSTR val;
-
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS;
- val = Get((HANDLE)wParam);
+ LPSTR val = Get((HANDLE)wParam);
if (val)
- {
mir_free(val);
- }
else
- {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- }
+
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ghMenuItem, (LPARAM)&mi);
return 0;
}
@@ -220,11 +213,8 @@ VOID SvcEMailRebuildMenu()
if (!ghMenuItem)
{
- CLISTMENUITEM mi;
-
// insert contact menuitem
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -2000010000;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_EMAIL);
mi.pszName = "&E-mail";
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp
index 7364653d56..456ef87711 100644
--- a/plugins/UserInfoEx/src/svc_homepage.cpp
+++ b/plugins/UserInfoEx/src/svc_homepage.cpp
@@ -142,11 +142,9 @@ static INT OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw
**/
static INT OnPreBuildMenu(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM mi;
LPSTR val;
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS;
val = Get((HANDLE)wParam);
@@ -154,10 +152,8 @@ static INT OnPreBuildMenu(WPARAM wParam, LPARAM lParam)
{
MIR_FREE(val);
}
- else
- {
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- }
+ else mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
+
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ghMenuItem, (LPARAM)&mi);
return 0;
}
@@ -181,9 +177,7 @@ VOID SvcHomepageRebuildMenu()
if (!ghMenuItem) {
// insert contact menuitem
- CLISTMENUITEM mi = { 0 };
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -2000010000;
mi.hIcon = IcoLib_GetIcon(ICO_BTN_GOTO);
mi.pszName = "&Homepage";
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index 1a14ec0bea..2945b118c4 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -623,9 +623,7 @@ class CContactUpdater : public CContactQueue
// reset menu
if (hMenuItemRefresh)
{
- CLISTMENUITEM clmi;
-
- clmi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME|CMIM_ICON;
clmi.pszName = LPGEN("Refresh Contact Details");
clmi.hIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
@@ -751,9 +749,7 @@ public:
// if there are contacts in the queue, change the main menu item to indicate it is meant for canceling.
if (hMenuItemRefresh && Size() > 0)
{
- CLISTMENUITEM clmi;
-
- clmi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME|CMIM_ICON;
clmi.pszName = LPGEN("Abort Refreshing Contact Details");
clmi.hIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);