From 30707c980d1560b358dbf2671a4d2a26a1e8173c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 21:45:37 +0000 Subject: various menu initialization quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IRCG/src/commandmonitor.cpp | 22 ++++++++-------- protocols/IRCG/src/ircproto.cpp | 9 +++---- protocols/IRCG/src/options.cpp | 10 +++----- protocols/IRCG/src/services.cpp | 48 ++++++++++++++++------------------- 4 files changed, 40 insertions(+), 49 deletions(-) (limited to 'protocols/IRCG/src') diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index b176a01f00..83bbd9689e 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2331,12 +2331,11 @@ void CIrcProto::OnIrcDisconnected() memcpy( m_nick, m_pNick, sizeof( m_nick )); setTString( "Nick", m_pNick ); - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS | CMIF_GRAYED; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_GRAYED; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&mi ); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -2362,12 +2361,11 @@ bool CIrcProto::DoOnConnect( const CIrcMessage* ) bPerformDone = true; nickflag = true; - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&mi ); int Temp = m_iStatus; m_iStatus = ID_STATUS_ONLINE; diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index eb40452d47..3331c9aa93 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -1058,11 +1058,10 @@ int __cdecl CIrcProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM case EV_PROTO_ONRENAME: if ( hMenuRoot ) { - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; - clmi.ptszName = m_tszUserName; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&clmi ); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.ptszName = m_tszUserName; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&mi ); } break; diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 25fcc1a971..1bde54a395 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -797,13 +797,11 @@ void CConnectPrefsDlg::OnApply() m_proto->m_oldStyleModes = m_oldStyle.GetState(); m_proto->m_useServer = m_useServer.GetState(); - CLISTMENUITEM clmi; - memset( &clmi, 0, sizeof( clmi )); - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS; if ( !m_proto->m_useServer ) - clmi.flags |= CMIF_GRAYED; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_proto->hMenuServer, ( LPARAM )&clmi ); + mi.flags |= CMIF_GRAYED; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_proto->hMenuServer, ( LPARAM )&mi ); m_proto->m_joinOnInvite = m_autoJoin.GetState(); m_proto->m_hideServerWindow = !m_showServer.GetState(); diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 78aa938026..e1987e9e0f 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -28,8 +28,7 @@ void CIrcProto::InitMainMenus(void) char temp[ MAXMODULELABELLENGTH ]; char *d = temp + sprintf( temp, m_szModuleName ); - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof( mi ); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = temp; if ( bChatInstalled ) { @@ -130,14 +129,13 @@ static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam) int IrcPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) { - CLISTMENUITEM clmi = {0}; - clmi.cbSize = sizeof(CLISTMENUITEM); - clmi.flags = CMIM_FLAGS | CMIF_HIDDEN; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIF_HIDDEN; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&clmi ); - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi ); CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam); return (ppro) ? ppro->OnMenuPreBuild(wParam, lParam) : 0; @@ -148,8 +146,7 @@ void InitContactMenus(void) char temp[MAXMODULELABELLENGTH]; char *d = temp + sprintf(temp, "IRC"); - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.pszService = temp; mi.flags = CMIF_ICONFROMICOLIB; @@ -1014,47 +1011,46 @@ int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM) if ( !hContact ) return 0; - CLISTMENUITEM clmi = { 0 }; - clmi.cbSize = sizeof( clmi ); - clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON; + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON; char *szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) wParam, 0); if ( szProto && !lstrcmpiA(szProto, m_szModuleName)) { bool bIsOnline = getWord(hContact, "Status", ID_STATUS_OFFLINE)== ID_STATUS_OFFLINE ? false : true; if ( getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM) { // context menu for chatrooms - clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&clmi ); + mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi ); } else if ( !getTString( hContact, "Default", &dbv )) { // context menu for contact BYTE bDcc = getByte( hContact, "DCC", 0) ; - clmi.flags = CMIM_FLAGS | CMIF_HIDDEN; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&clmi ); + mi.flags = CMIM_FLAGS | CMIF_HIDDEN; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi ); - clmi.flags = CMIM_FLAGS; + mi.flags = CMIM_FLAGS; if ( bDcc ) { // for DCC contact - clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&clmi ); + mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi ); } else { // for normal contact - clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; + mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE; if ( !IsConnected()) - clmi.flags = CMIM_FLAGS | CMIF_HIDDEN; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&clmi ); + mi.flags = CMIM_FLAGS | CMIF_HIDDEN; + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi ); if (bIsOnline) { DBVARIANT dbv3; if ( !getString( hContact, "Host", &dbv3)) { if (dbv3.pszVal[0] == 0) - clmi.flags = CMIM_FLAGS | CMIF_HIDDEN; + mi.flags = CMIM_FLAGS | CMIF_HIDDEN; DBFreeVariant( &dbv3 ); } } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&clmi ); + CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi ); } DBFreeVariant( &dbv ); } } -- cgit v1.2.3