summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-28 21:45:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-28 21:45:37 +0000
commit30707c980d1560b358dbf2671a4d2a26a1e8173c (patch)
tree74aee5adaaac976e1398274ca64c5461a60f1feb /protocols/JabberG
parent335ec43a4bfdcbbd0b2257037f1f3e0553d89076 (diff)
various menu initialization quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp44
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp6
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp3
3 files changed, 19 insertions, 34 deletions
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 1a490f1eb9..95c0ee8b36 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -166,8 +166,7 @@ static INT_PTR JabberMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPAR
static void sttEnableMenuItem(HANDLE hMenuItem, BOOL bEnable)
{
- CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_FLAGS;
if ( !bEnable)
clmi.flags |= CMIF_HIDDEN;
@@ -219,8 +218,7 @@ void g_MenuInit(void)
//////////////////////////////////////////////////////////////////////////////////////
// Contact menu initialization
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM mi = { sizeof(mi) };
// "Request authorization"
mi.pszName = LPGEN("Request authorization");
@@ -389,9 +387,9 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
DBVARIANT dbv;
if ( !JGetStringT(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv)) {
db_free(&dbv);
- CLISTMENUITEM clmi = { 0 };
sttEnableMenuItem(g_hMenuConvert, TRUE);
- clmi.cbSize = sizeof(clmi);
+
+ CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.pszName = bIsChatRoom ? (char *)LPGEN("&Convert to Contact") : (char *)LPGEN("&Convert to Chat Room");
clmi.flags = CMIM_NAME | CMIM_FLAGS;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuConvert, (LPARAM)&clmi);
@@ -403,8 +401,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
sttEnableMenuItem(g_hMenuDirectPresence[0], TRUE);
for (int i = 0; i < SIZEOF(PresenceModeArray); ++i)
{
- CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_ICON|CMIM_FLAGS;
clmi.hIcon = (HICON)LoadSkinnedProtoIcon(m_szModuleName, PresenceModeArray[i].mode);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuDirectPresence[i+1], (LPARAM)&clmi);
@@ -446,8 +443,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
if (item->resourceCount >= 1) {
sttEnableMenuItem(g_hMenuResourcesRoot, TRUE);
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ICON|CMIM_FLAGS;
mi.icolibItem = GetIconHandle(IDI_JABBER);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesRoot, (LPARAM)&mi);
@@ -464,7 +460,6 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
size_t nModuleNameLength = strlen(text);
char* tDest = text + nModuleNameLength;
- mi.cbSize = sizeof(CLISTMENUITEM);
mi.flags = CMIF_CHILDPOPUP;
mi.position = 0;
mi.icolibItem = GetIconHandle(IDI_REQUEST);
@@ -482,8 +477,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
m_phMenuResourceItems[i] = Menu_AddContactMenuItem(&mi);
}
if (i < item->resourceCount) {
- CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME|CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_TCHAR;
if ((item->resourceMode == RSMODE_MANUAL) && (item->manualResource == i))
clmi.flags |= CMIF_CHECKED;
@@ -503,14 +497,11 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
else sttEnableMenuItem(m_phMenuResourceItems[i], FALSE);
}
- ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof(CLISTMENUITEM);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_ICONFROMICOLIB |
+ mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB |
((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesActive, (LPARAM)&mi);
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_ICONFROMICOLIB |
+ mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB |
((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesServer, (LPARAM)&mi);
@@ -699,12 +690,11 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM wParam, LPARAM)
void CJabberProto::MenuInit()
{
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(CLISTMENUITEM);
-
char text[ 200 ];
strcpy(text, m_szModuleName);
char* tDest = text + strlen(text);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = text;
HGENMENU hJabberRoot = MO_GetProtoRootMenu(m_szModuleName);
@@ -894,11 +884,11 @@ void CJabberProto::UpdatePriorityMenu(short priority)
return;
TCHAR szName[128];
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
+ mir_sntprintf(szName, SIZEOF(szName), TranslateT("Resource priority [%d]"), (int)priority);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR | CMIM_NAME;
mi.ptszName = szName;
- mir_sntprintf(szName, SIZEOF(szName), TranslateT("Resource priority [%d]"), (int)priority);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPriorityRoot, (LPARAM)&mi);
m_priorityMenuVal = priority;
@@ -1024,8 +1014,7 @@ void CJabberProto::EnableMenuItems(BOOL bEnable)
void CJabberProto::CheckMenuItems()
{
- CLISTMENUITEM clmi = { 0 };
- clmi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_FLAGS;
if ( !m_menuItemsStatus)
clmi.flags |= CMIF_GRAYED;
@@ -1280,8 +1269,7 @@ CJabberProto *JabberChooseInstance(bool bIsLink)
return g_Instances[i];
}
- CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof(CLISTMENUITEM);
+ CLISTMENUITEM clmi = { sizeof(clmi) };
int nItems = 0, lastItemId = 0;
for (int i = 0; i < g_Instances.getCount(); ++i) {
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 15a10b143b..c2ec58912e 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -2250,8 +2250,7 @@ INT_PTR __cdecl CJabberProto::menuSetPrivacyList(WPARAM, LPARAM, LPARAM iList)
void CJabberProto::BuildPrivacyMenu()
{
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 200005;
mi.pszContactOwner = m_szModuleName;
mi.icolibItem = GetIconHandle(IDI_AGENTS);
@@ -2285,8 +2284,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld)
i = 0;
char srvFce[MAX_PATH + 64], *svcName = srvFce+strlen(m_szModuleName);
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 2000040000;
mi.flags = CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.hParentMenu = m_hPrivacyMenuRoot;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 0e4417f961..e7e19cf2e2 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -475,8 +475,7 @@ void CPepGuiService::RebuildMenu()
char szService[128];
mir_snprintf(szService, SIZEOF(szService), "%s/AdvStatusSet/%s", m_proto->m_szModuleName, m_name);
- CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.hParentMenu = hJabberRoot;
mi.pszService = szService;
mi.position = 200010;