diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-05 16:54:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-05 16:54:27 +0000 |
commit | b665a90f50f09435aef5bc3b5b9da710e4558690 (patch) | |
tree | 3053606dcddc1b15f73e7af1fb2507afbf20f052 /protocols | |
parent | 6c01981a8452577f3751298c7cdbe59b3ae81d51 (diff) |
various menu items quirks, simplifications & optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@4319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
26 files changed, 202 insertions, 312 deletions
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 2aeb05fed5..f20de16ff5 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -85,8 +85,8 @@ void ReleaseIconEx(const char* name, bool big) void WindowSetIcon(HWND hWnd, const char* name)
{
- SendMessage(hWnd, WM_SETICON, ICON_BIG, ( LPARAM )LoadIconEx( name, true ));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, ( LPARAM )LoadIconEx( name ));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx( name, true ));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx( name ));
}
void WindowFreeIcon(HWND hWnd)
@@ -224,24 +224,14 @@ int CAimProto::OnPreBuildContactMenu(WPARAM wParam,LPARAM /*lParam*/) bool isChatRoom = getByte(hContact, "ChatRoom", 0) != 0;
//see if we should add the html away message context menu items
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- if (getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) != ID_STATUS_AWAY || isChatRoom)
- mi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hHTMLAwayContextMenuItem,(LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_NOTONLINE;
- if (getBuddyId(hContact, 1) || state == 0 || isChatRoom)
- mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hAddToServerListContextMenuItem,(LPARAM)&mi);
+ Menu_ShowItem(hHTMLAwayContextMenuItem, getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_AWAY && !isChatRoom);
+ Menu_ShowItem(hAddToServerListContextMenuItem, !getBuddyId(hContact, 1) && state != 0 && !isChatRoom);
DBVARIANT dbv;
- if (!getString(hContact, AIM_KEY_SN, &dbv))
- {
+ if (!getString(hContact, AIM_KEY_SN, &dbv)) {
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_FLAGS;
- switch(pd_mode)
- {
+ switch(pd_mode) {
case 1:
mi.pszName = LPGEN("&Block");
break;
@@ -264,7 +254,7 @@ int CAimProto::OnPreBuildContactMenu(WPARAM wParam,LPARAM /*lParam*/) break;
}
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hBlockContextMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(hBlockContextMenuItem, &mi);
DBFreeVariant(&dbv);
}
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 7ce279371b..c71e8df0bc 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -203,7 +203,7 @@ int FacebookProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam) hRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi);
} else {
if ( m_hMenuRoot )
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 );
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)m_hMenuRoot, 0);
m_hMenuRoot = NULL;
}
@@ -266,7 +266,7 @@ void FacebookProto::ToggleStatusMenuItems( BOOL bEnable ) CLISTMENUITEM clmi = {sizeof(clmi)};
clmi.flags = CMIM_FLAGS | (( bEnable ) ? 0 : CMIF_GRAYED);
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRoot, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hStatusMind, ( LPARAM )&clmi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuServicesRoot, ( LPARAM )&clmi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuRoot, ( LPARAM )&clmi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hStatusMind, ( LPARAM )&clmi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuServicesRoot, ( LPARAM )&clmi );
}
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 57dcf2a2da..548aaecce0 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -238,12 +238,12 @@ static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- if ( db_get_dw(hContact, gg->m_szModuleName, GG_KEY_UIN, 0) == db_get_b(NULL, gg->m_szModuleName, GG_KEY_UIN, 0) ||
- db_get_b(hContact, gg->m_szModuleName, "ChatRoom", 0) ||
- db_get_b(hContact, "CList", "NotOnList", 0))
+ if ( db_get_dw(hContact, gg->m_szModuleName, GG_KEY_UIN, 0) == db_get_b(NULL, gg->m_szModuleName, GG_KEY_UIN, 0)
+ || db_get_b(hContact, gg->m_szModuleName, "ChatRoom", 0)
+ || db_get_b(hContact, "CList", "NotOnList", 0))
mi.flags |= CMIF_HIDDEN;
mi.ptszName = db_get_b(hContact, gg->m_szModuleName, GG_KEY_BLOCK, 0) ? LPGENT("&Unblock") : LPGENT("&Block");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gg->hBlockMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(gg->hBlockMenuItem, &mi);
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index d462f420f3..baf396ad37 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -279,14 +279,12 @@ struct GGPROTO : public PROTO_INTERFACE HANDLE netlib;
HGENMENU hMenuRoot;
HGENMENU hMainMenu[7];
- HANDLE hPrebuildMenuHook;
- HANDLE hBlockMenuItem;
- HANDLE hImageMenuItem;
- HANDLE hInstanceMenuItem;
- HANDLE hAvatarsFolder;
- HANDLE hImagesFolder;
- HWND hwndSessionsDlg;
- HANDLE hPopupNotify, hPopupError;
+ HGENMENU hBlockMenuItem, hImageMenuItem, hInstanceMenuItem;
+ HANDLE hPrebuildMenuHook;
+ HANDLE hAvatarsFolder;
+ HANDLE hImagesFolder;
+ HWND hwndSessionsDlg;
+ HANDLE hPopupNotify, hPopupError;
};
typedef struct
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 7cc0c37215..0da199062d 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -74,12 +74,9 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam) mi.flags |= CMIM_ICON;
mi.hIcon = LoadSkinnedProtoIcon(gg->m_szModuleName, gg->m_iStatus);
}
- else {
- mi.flags |= CMIF_HIDDEN;
- mi.hIcon = NULL;
- }
+ else mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gginst->hInstanceMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(gginst->hInstanceMenuItem, &mi);
if (mi.hIcon)
Skin_ReleaseIcon(mi.hIcon);
}
@@ -156,14 +153,12 @@ void gg_links_destroy() void GGPROTO::links_instance_init()
{
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- {
- TMO_MenuItem tmi = {0};
- tmi.cbSize = sizeof(tmi);
+ if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
+ TMO_MenuItem tmi = { sizeof(tmi) };
tmi.flags = CMIF_TCHAR;
tmi.ownerdata = this;
tmi.position = list_count(g_Instances);
tmi.ptszName = m_tszUserName;
- hInstanceMenuItem = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&tmi);
+ hInstanceMenuItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&tmi);
}
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 3108066951..bd6021e292 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2332,9 +2332,9 @@ void CIrcProto::OnIrcDisconnected() 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 );
+ 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,9 +2362,9 @@ bool CIrcProto::DoOnConnect( const CIrcMessage* ) 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 );
+ 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/input.cpp b/protocols/IRCG/src/input.cpp index c564b7844c..eafeae75fb 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -587,7 +587,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac DoUserhostWithReason(2, S.c_str(), true, one.c_str());
} }
- CallService( MS_MSG_SENDMESSAGE, ( WPARAM )hContact2, 0 );
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact2, 0);
}
if ( !two.IsEmpty()) {
@@ -661,7 +661,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac } }
if ( three.IsEmpty())
- CallService( MS_FILE_SENDFILE, ( WPARAM )hContact, 0 );
+ CallService(MS_FILE_SENDFILE, (WPARAM)hContact, 0);
else {
CMString temp = GetWordAddress(text.c_str(), 3);
TCHAR* pp[2];
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 1f13b5159f..e6fd017765 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -206,7 +206,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) FindLocalIP(con); // get the local ip used for filetransfers etc
if ( info.m_iSSL > 0 ) {
- if ( !CallService( MS_NETLIB_STARTSSL, ( WPARAM ) con, 0 ) && info.m_iSSL == 2 ) {
+ if ( !CallService(MS_NETLIB_STARTSSL, (WPARAM)con, 0) && info.m_iSSL == 2) {
Netlib_CloseHandle( con );
con = NULL;
m_info.Reset();
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 42aeddb16e..95df8741a2 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -160,7 +160,7 @@ CIrcProto::~CIrcProto() DeleteCriticalSection( &m_gchook );
if (hMenuRoot)
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )hMenuRoot, 0 );
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
mir_free( m_alias );
@@ -1035,7 +1035,7 @@ int __cdecl CIrcProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.ptszName = m_tszUserName;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&mi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuRoot, ( LPARAM )&mi );
}
break;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 36f211655f..d05b07df1a 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -765,7 +765,7 @@ void CConnectPrefsDlg::OnApply() mi.flags = CMIM_FLAGS;
if ( !m_proto->m_useServer )
mi.flags |= CMIF_GRAYED;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_proto->hMenuServer, ( LPARAM )&mi );
+ 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 b65c92f728..c8204ac5d6 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -44,7 +44,7 @@ void CIrcProto::InitMainMenus(void) }
else {
if (hMenuRoot)
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )hMenuRoot, 0 );
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
hMenuRoot = NULL;
}
@@ -129,15 +129,12 @@ static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam) int IrcPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- 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 );
+ Menu_ShowItem(hUMenuChanSettings, false);
+ Menu_ShowItem(hUMenuWhois, false);
+ Menu_ShowItem(hUMenuDisconnect, false);
+ Menu_ShowItem(hUMenuIgnore, false);
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuPreBuild(wParam, lParam) : 0;
}
@@ -1006,53 +1003,44 @@ int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM) int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM)
{
DBVARIANT dbv;
- HANDLE hContact = ( HANDLE )wParam;
- if ( !hContact )
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact == NULL)
return 0;
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
-
char *szProto = GetContactProto(hContact);
- 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
- 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) ;
+ if (szProto && !lstrcmpiA(szProto, m_szModuleName)) {
+ bool bIsOnline = getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE;
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi );
+ // context menu for chatrooms
+ if (getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM)
+ Menu_ShowItem(hUMenuChanSettings, true);
- mi.flags = CMIM_FLAGS;
- if ( bDcc ) {
- // for DCC contact
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi );
- }
+ // context menu for contact
+ else if ( !getTString( hContact, "Default", &dbv )) {
+ Menu_ShowItem(hUMenuChanSettings, false);
+
+ // for DCC contact
+ BYTE bDcc = getByte( hContact, "DCC", 0) ;
+ if (bDcc)
+ Menu_ShowItem(hUMenuDisconnect, true);
else {
// for normal contact
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- if ( !IsConnected())
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi );
+ Menu_ShowItem(hUMenuWhois, IsConnected());
+ bool bEnabled = true;
if (bIsOnline) {
DBVARIANT dbv3;
if ( !getString( hContact, "Host", &dbv3)) {
if (dbv3.pszVal[0] == 0)
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- DBFreeVariant( &dbv3 );
+ bEnabled = false;
+ DBFreeVariant(&dbv3);
}
}
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi );
+ Menu_ShowItem(hUMenuIgnore, bEnabled);
}
DBFreeVariant( &dbv );
- } }
+ }
+ }
return 0;
}
@@ -1245,5 +1233,5 @@ void CIrcProto::DoNetlibLog( const char* fmt, ... ) mir_vsnprintf( str, 32000, fmt, vararg );
va_end( vararg );
- CallService( MS_NETLIB_LOG, ( WPARAM )hNetlib, ( LPARAM )str );
+ CallService( MS_NETLIB_LOG, (WPARAM)hNetlib, ( LPARAM )str );
}
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index ad8a16fec7..c20ceebc1c 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -87,7 +87,7 @@ void CWhoisDlg::OnInitDialog() GetObject( hFont, sizeof( lf ), &lf );
lf.lfWeight = FW_BOLD;
hFont = CreateFontIndirect( &lf );
- m_AwayTime.SendMsg( WM_SETFONT, ( WPARAM )hFont, 0 );
+ m_AwayTime.SendMsg(WM_SETFONT, (WPARAM)hFont, 0);
CCoolIrcDlg::OnInitDialog();
diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp index 6c3a3ffa89..05d0d8f442 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.cpp +++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp @@ -45,7 +45,7 @@ static void InitComboBox(HWND hwndCombo, const FieldNamesItem *names) else {
int ctryCount;
struct CountryListEntry *countries;
- CallService( MS_UTILS_GETCOUNTRYLIST, ( WPARAM )&ctryCount, ( LPARAM )&countries );
+ CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&ctryCount, (LPARAM)&countries);
for (i = 0; i < ctryCount; i++) {
if (countries[i].id != 0xFFFF && countries[i].id != 0)
iItem = ComboBoxAddStringUtf(hwndCombo, LPGEN(countries[i].szName), countries[i].id);
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index a038d9f792..a62b1da5f7 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -29,8 +29,8 @@ #include <m_skin.h>
-HANDLE g_hContactMenuItems[6];
-HANDLE g_hContactMenuSvc[6];
+HGENMENU g_hContactMenuItems[6];
+HANDLE g_hContactMenuSvc[6];
static int sttCompareProtocols(const CIcqProto *p1, const CIcqProto *p2)
{
@@ -88,24 +88,14 @@ static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam) return (ppro) ? ppro->OpenWebProfile(wParam, lParam) : 0;
}
-static void sttEnableMenuItem( HANDLE hMenuItem, bool bEnable )
-{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if ( !bEnable )
- clmi.flags |= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuItem, ( LPARAM )&clmi );
-}
-
static int IcqPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REQUEST], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_GRANT], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REVOKE], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], FALSE);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REQUEST], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REVOKE], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], FALSE);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_OPEN_PROFILE], FALSE);
CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnPreBuildContactMenu(wParam, lParam) : 0;
@@ -121,58 +111,58 @@ void g_MenuInit(void) // Contact menu initialization
char str[MAXMODULELABELLENGTH], *pszDest = str + 3;
- strcpy( str, "ICQ" );
+ strcpy(str, "ICQ");
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = str;
mi.flags = CMIF_ICONFROMICOLIB;
// "Request authorization"
+ strcpy(pszDest, MS_REQ_AUTH); CreateServiceFunction(str, IcqMenuHandleRequestAuth );
+
mi.pszName = LPGEN("Request authorization");
mi.position = 1000030000;
mi.icolibItem = g_IconsList[ISI_AUTH_REQUEST].hIcolib;
- strcpy(pszDest, MS_REQ_AUTH);
g_hContactMenuItems[ICMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_AUTH_REQUEST] = CreateServiceFunction( str, IcqMenuHandleRequestAuth );
-
+
// "Grant authorization"
+ strcpy(pszDest, MS_GRANT_AUTH); CreateServiceFunction(str, IcqMenuHandleGrantAuth);
+
mi.pszName = LPGEN("Grant authorization");
mi.position = 1000029999;
mi.icolibItem = g_IconsList[ISI_AUTH_GRANT].hIcolib;
- strcpy(pszDest, MS_GRANT_AUTH);
g_hContactMenuItems[ICMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_AUTH_GRANT] = CreateServiceFunction(mi.pszService, IcqMenuHandleGrantAuth);
-
+
// "Revoke authorization"
+ strcpy(pszDest, MS_REVOKE_AUTH); CreateServiceFunction(str, IcqMenuHandleRevokeAuth);
+
mi.pszName = LPGEN("Revoke authorization");
mi.position = 1000029998;
mi.icolibItem = g_IconsList[ISI_AUTH_REVOKE].hIcolib;
- strcpy(pszDest, MS_REVOKE_AUTH);
g_hContactMenuItems[ICMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_AUTH_REVOKE] = CreateServiceFunction(mi.pszService, IcqMenuHandleRevokeAuth);
-
+
// "Add to server list"
+ strcpy(pszDest, MS_ICQ_ADDSERVCONTACT); CreateServiceFunction(str, IcqMenuHandleAddServContact);
+
mi.pszName = LPGEN("Add to server list");
mi.position = -2049999999;
mi.icolibItem = g_IconsList[ISI_ADD_TO_SERVLIST].hIcolib;
- strcpy(pszDest, MS_ICQ_ADDSERVCONTACT);
g_hContactMenuItems[ICMI_ADD_TO_SERVLIST] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_ADD_TO_SERVLIST] = CreateServiceFunction(mi.pszService, IcqMenuHandleAddServContact);
-
+
// "Show custom status details"
- mi.pszName = LPGEN("Show custom status details");
+ strcpy(pszDest, MS_XSTATUS_SHOWDETAILS); CreateServiceFunction(str, IcqMenuHandleXStatusDetails);
+
+ mi.pszName = LPGEN("Show custom status details");
mi.position = -2000004999;
mi.flags = 0;
- strcpy(pszDest, MS_XSTATUS_SHOWDETAILS);
g_hContactMenuItems[ICMI_XSTATUS_DETAILS] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_XSTATUS_DETAILS] = CreateServiceFunction(mi.pszService, IcqMenuHandleXStatusDetails);
-
+
// "Open ICQ profile"
+ strcpy(pszDest, MS_OPEN_PROFILE); CreateServiceFunction(str, IcqMenuHandleOpenProfile);
+
mi.pszName = LPGEN("Open ICQ profile");
mi.position = 1000029997;
- strcpy(pszDest, MS_OPEN_PROFILE);
g_hContactMenuItems[ICMI_OPEN_PROFILE] = Menu_AddContactMenuItem(&mi);
- g_hContactMenuSvc[ICMI_OPEN_PROFILE] = CreateServiceFunction(mi.pszService, IcqMenuHandleOpenProfile);
}
void g_MenuUninit(void)
@@ -183,13 +173,6 @@ void g_MenuUninit(void) CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], 0);
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_XSTATUS_DETAILS], 0);
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_OPEN_PROFILE], 0);
-
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_REQUEST]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_GRANT]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_REVOKE]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_ADD_TO_SERVLIST]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_XSTATUS_DETAILS]);
- DestroyServiceFunction(g_hContactMenuSvc[ICMI_OPEN_PROFILE]);
}
@@ -209,37 +192,34 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM) if (hContact == NULL)
return 0;
- if (icqOnline())
- {
+ if (icqOnline()) {
BOOL bCtrlPressed = (GetKeyState(VK_CONTROL)&0x8000 ) != 0;
DWORD dwUin = getContactUin(hContact);
-
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REQUEST],
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REQUEST],
dwUin && (bCtrlPressed || (getSettingByte((HANDLE)wParam, "Auth", 0) && getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0))));
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getSettingByte((HANDLE)wParam, "Grant", 0)));
- sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REVOKE],
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getSettingByte((HANDLE)wParam, "Grant", 0)));
+ Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REVOKE],
dwUin && (bCtrlPressed || (getSettingByte(NULL, "PrivacyItems", 0) && !getSettingByte((HANDLE)wParam, "Grant", 0))));
- sttEnableMenuItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST],
+ Menu_ShowItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST],
m_bSsiEnabled && !getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) &&
!getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0) &&
!db_get_b(hContact, "CList", "NotOnList", 0));
}
- sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact) != 0);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact) != 0);
BYTE bXStatus = getContactXStatus((HANDLE)wParam);
- sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0);
+ Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0);
if (bXStatus && !m_bHideXStatusUI) {
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_ICON;
-
if (bXStatus > 0 && bXStatus <= XSTATUS_COUNT)
clmi.hIcon = getXStatusIcon(bXStatus, LR_SHARED);
else
clmi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_XSTATUS_DETAILS], (LPARAM)&clmi);
+ Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], &clmi);
}
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index fb35b0a227..561fe3e60b 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -813,8 +813,7 @@ struct CIcqProto : public PROTO_INTERFACE HANDLE hHookExtraIconsRebuild;
HANDLE hHookStatusBuild;
HANDLE hHookExtraIconsApply;
-
- HANDLE hXStatusItems[XSTATUS_COUNT + 1];
+ HGENMENU hXStatusItems[XSTATUS_COUNT + 1];
void InitXStatusItems(BOOL bAllowStatus);
BYTE getContactXStatus(HANDLE hContact);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index e9461d24bb..dc1efbdacf 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -32,8 +32,6 @@ #include "m_extraicons.h"
#include "..\icons_pack\src\resource.h"
-void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow);
-
static HANDLE hXStatusIcons[XSTATUS_COUNT];
static int hXStatusCListIcons[XSTATUS_COUNT];
static BOOL bXStatusCListIconsValid[XSTATUS_COUNT];
@@ -882,9 +880,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) mi.pszContactOwner = m_szModuleName;
hXStatusItems[i] = Menu_AddStatusMenuItem(&mi);
-
- // CMIF_HIDDEN does not work for adding services
- CListShowMenuItem(hXStatusItems[i], !(m_bHideXStatusUI || m_bHideXStatusMenu));
+ Menu_ShowItem(hXStatusItems[i], !(m_bHideXStatusUI || m_bHideXStatusMenu));
}
}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index d943b29ee8..0cf65d5eb7 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -148,17 +148,6 @@ extern "C" int __declspec(dllexport) Unload(void) /////////////////////////////////////////////////////////////////////////////////////////
// OnPrebuildContactMenu event
-void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow)
-{
- CLISTMENUITEM mi = { sizeof(mi) };
- if (bShow)
- mi.flags = CMIM_FLAGS;
- else
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi);
-}
-
static void CListSetMenuItemIcon(HANDLE hMenuItem, HICON hIcon)
{
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index d70d2c5241..f6f404c4e0 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -162,30 +162,20 @@ static INT_PTR JabberMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPAR return(ppro) ? ppro->OnMenuHandleDirectPresence(wParam, lParam, lRes) : 0;
}
-static void sttEnableMenuItem(HANDLE hMenuItem, BOOL bEnable)
-{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if ( !bEnable)
- clmi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi);
-}
-
static int JabberPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- sttEnableMenuItem(g_hMenuRequestAuth, FALSE);
- sttEnableMenuItem(g_hMenuGrantAuth, FALSE);
- sttEnableMenuItem(g_hMenuRevokeAuth, FALSE);
- sttEnableMenuItem(g_hMenuCommands, FALSE);
- sttEnableMenuItem(g_hMenuSendNote, FALSE);
- sttEnableMenuItem(g_hMenuConvert, FALSE);
- sttEnableMenuItem(g_hMenuRosterAdd, FALSE);
- sttEnableMenuItem(g_hMenuLogin, FALSE);
- sttEnableMenuItem(g_hMenuRefresh, FALSE);
- sttEnableMenuItem(g_hMenuAddBookmark, FALSE);
- sttEnableMenuItem(g_hMenuResourcesRoot, FALSE);
- sttEnableMenuItem(g_hMenuDirectPresence[0], FALSE);
+ Menu_ShowItem(g_hMenuRequestAuth, FALSE);
+ Menu_ShowItem(g_hMenuGrantAuth, FALSE);
+ Menu_ShowItem(g_hMenuRevokeAuth, FALSE);
+ Menu_ShowItem(g_hMenuCommands, FALSE);
+ Menu_ShowItem(g_hMenuSendNote, FALSE);
+ Menu_ShowItem(g_hMenuConvert, FALSE);
+ Menu_ShowItem(g_hMenuRosterAdd, FALSE);
+ Menu_ShowItem(g_hMenuLogin, FALSE);
+ Menu_ShowItem(g_hMenuRefresh, FALSE);
+ Menu_ShowItem(g_hMenuAddBookmark, FALSE);
+ Menu_ShowItem(g_hMenuResourcesRoot, FALSE);
+ Menu_ShowItem(g_hMenuDirectPresence[0], FALSE);
CJabberProto* ppro = JabberGetInstanceByHContact((HANDLE)wParam);
return(ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0;
@@ -367,6 +357,7 @@ void g_MenuUninit(void) int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
{
+ DBVARIANT dbv;
HANDLE hContact;
if ((hContact=(HANDLE)wParam) == NULL)
return 0;
@@ -375,74 +366,72 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) BYTE bIsTransport = (BYTE)JGetByte(hContact, "IsTransport", 0);
if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
- DBVARIANT dbv;
if ( !JGetStringT(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid", &dbv)) {
db_free(&dbv);
- sttEnableMenuItem(g_hMenuConvert, TRUE);
+ Menu_ShowItem(g_hMenuConvert, TRUE);
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);
- } }
+ Menu_ModifyItem(g_hMenuConvert, &clmi);
+ }
+ }
if ( !m_bJabberOnline)
return 0;
- sttEnableMenuItem(g_hMenuDirectPresence[0], TRUE);
- for (int i = 0; i < SIZEOF(PresenceModeArray); i++)
- {
+ Menu_ShowItem(g_hMenuDirectPresence[0], TRUE);
+ for (int i = 0; i < SIZEOF(PresenceModeArray); i++) {
CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_ICON|CMIM_FLAGS;
+ 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);
+ Menu_ModifyItem(g_hMenuDirectPresence[i+1], &clmi);
}
if (bIsChatRoom) {
- DBVARIANT dbv;
if ( !JGetStringT(hContact, "ChatRoomID", &dbv)) {
- sttEnableMenuItem(g_hMenuRosterAdd, FALSE);
+ Menu_ShowItem(g_hMenuRosterAdd, FALSE);
if (ListGetItemPtr(LIST_BOOKMARK, dbv.ptszVal) == NULL)
if (m_ThreadInfo && m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)
- sttEnableMenuItem(g_hMenuAddBookmark, TRUE);
+ Menu_ShowItem(g_hMenuAddBookmark, TRUE);
db_free(&dbv);
- } }
+ }
+ }
if (bIsChatRoom == GCW_CHATROOM)
return 0;
if (bIsTransport) {
- sttEnableMenuItem(g_hMenuLogin, TRUE);
- sttEnableMenuItem(g_hMenuRefresh, TRUE);
+ Menu_ShowItem(g_hMenuLogin, TRUE);
+ Menu_ShowItem(g_hMenuRefresh, TRUE);
}
- DBVARIANT dbv;
if ( !JGetStringT(hContact, "jid", &dbv)) {
JabberCapsBits jcb = GetTotalJidCapabilites(dbv.ptszVal);
JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_ROSTER, dbv.ptszVal);
db_free(&dbv);
if (item != NULL) {
BOOL bCtrlPressed = (GetKeyState(VK_CONTROL)&0x8000) != 0;
- sttEnableMenuItem(g_hMenuRequestAuth, item->subscription == SUB_FROM || item->subscription == SUB_NONE || bCtrlPressed);
- sttEnableMenuItem(g_hMenuGrantAuth, bCtrlPressed);
- sttEnableMenuItem(g_hMenuRevokeAuth, item->subscription == SUB_FROM || item->subscription == SUB_BOTH || bCtrlPressed);
- sttEnableMenuItem(g_hMenuCommands, ((jcb & JABBER_CAPS_COMMANDS) != 0) || bCtrlPressed);
- sttEnableMenuItem(g_hMenuSendNote, TRUE);
+ Menu_ShowItem(g_hMenuRequestAuth, item->subscription == SUB_FROM || item->subscription == SUB_NONE || bCtrlPressed);
+ Menu_ShowItem(g_hMenuGrantAuth, bCtrlPressed);
+ Menu_ShowItem(g_hMenuRevokeAuth, item->subscription == SUB_FROM || item->subscription == SUB_BOTH || bCtrlPressed);
+ Menu_ShowItem(g_hMenuCommands, ((jcb & JABBER_CAPS_COMMANDS) != 0) || bCtrlPressed);
+ Menu_ShowItem(g_hMenuSendNote, TRUE);
if (item->resourceCount >= 1) {
- sttEnableMenuItem(g_hMenuResourcesRoot, TRUE);
+ Menu_ShowItem(g_hMenuResourcesRoot, TRUE);
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ICON|CMIM_FLAGS;
mi.icolibItem = m_hProtoIcon;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesRoot, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesActive, (LPARAM)&mi);
+ Menu_ModifyItem(g_hMenuResourcesRoot, &mi);
+ Menu_ModifyItem(g_hMenuResourcesActive, &mi);
int nMenuResourceItemsNew = m_nMenuResourceItems;
if (m_nMenuResourceItems < item->resourceCount) {
- m_phMenuResourceItems = (HANDLE *)mir_realloc(m_phMenuResourceItems, item->resourceCount * sizeof(HANDLE));
+ m_phMenuResourceItems = (HGENMENU*)mir_realloc(m_phMenuResourceItems, item->resourceCount * sizeof(HGENMENU));
nMenuResourceItemsNew = item->resourceCount;
}
@@ -482,19 +471,17 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, item->resource[i].status, GSMDF_TCHAR),
item->resource[i].priority);
clmi.ptszName = szTmp;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_phMenuResourceItems[i], (LPARAM)&clmi);
+ Menu_ModifyItem(m_phMenuResourceItems[i], &clmi);
DestroyIcon(clmi.hIcon);
}
- else sttEnableMenuItem(m_phMenuResourceItems[i], FALSE);
+ else Menu_ShowItem(m_phMenuResourceItems[i], FALSE);
}
- 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 | ((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(g_hMenuResourcesActive, &mi);
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB |
- ((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hMenuResourcesServer, (LPARAM)&mi);
+ mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | ((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(g_hMenuResourcesServer, &mi);
m_nMenuResourceItems = nMenuResourceItemsNew;
}
@@ -878,7 +865,7 @@ void CJabberProto::UpdatePriorityMenu(short priority) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR | CMIM_NAME;
mi.ptszName = szName;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPriorityRoot, (LPARAM)&mi);
+ Menu_ModifyItem(m_hMenuPriorityRoot, &mi);
m_priorityMenuVal = priority;
m_priorityMenuValSet = true;
@@ -896,7 +883,7 @@ void CJabberProto::GlobalMenuInit() tmi.ownerdata = this;
tmi.position = iChooserMenuPos++;
tmi.ptszName = m_tszUserName;
- m_hChooseMenuItem = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, (LPARAM)&tmi);
+ m_hChooseMenuItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, (LPARAM)&tmi);
//////////////////////////////////////////////////////////////////////////////////////
// Hotkeys
@@ -1005,30 +992,26 @@ void CJabberProto::CheckMenuItems() if ( !m_menuItemsStatus)
clmi.flags |= CMIF_GRAYED;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuChangePassword, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuGroupchat, (LPARAM)&clmi);
+ Menu_ModifyItem(m_hMenuChangePassword, &clmi);
+ Menu_ModifyItem(m_hMenuGroupchat, &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPrivacyLists, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuRosterControl, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuServiceDiscovery, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDMyTransports, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDTransports, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuSDConferences, (LPARAM)&clmi);
+ Menu_ModifyItem(m_hMenuPrivacyLists, &clmi);
+ Menu_ModifyItem(m_hMenuRosterControl, &clmi);
+ Menu_ModifyItem(m_hMenuServiceDiscovery, &clmi);
+ Menu_ModifyItem(m_hMenuSDMyTransports, &clmi);
+ Menu_ModifyItem(m_hMenuSDTransports, &clmi);
+ Menu_ModifyItem(m_hMenuSDConferences, &clmi);
- clmi.flags = CMIM_FLAGS | ((m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) ? 0 : CMIF_HIDDEN);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuBookmarks, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuNotes, (LPARAM)&clmi);
+ bool bEnabled = m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE);
+ Menu_ShowItem(m_hMenuNotes, bEnabled);
+ Menu_ShowItem(m_hMenuBookmarks, bEnabled);
- clmi.flags = CMIM_FLAGS | ((m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVACY_LISTS)) ? 0 : CMIF_HIDDEN);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hPrivacyMenuRoot, (LPARAM)&clmi);
+ Menu_ShowItem(m_hPrivacyMenuRoot, m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVACY_LISTS));
- clmi.flags = CMIM_FLAGS | (m_menuItemsStatus ? 0 : CMIF_HIDDEN);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuPriorityRoot, (LPARAM)&clmi);
+ Menu_ShowItem(m_hMenuPriorityRoot, m_menuItemsStatus != 0);
- if ( !m_bPepSupported)
- clmi.flags |= CMIF_HIDDEN;
for (int i=0; i < m_pepServices.getCount(); i++)
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_pepServices[i].GetMenu(), (LPARAM)&clmi);
+ Menu_ShowItem(m_pepServices[i].GetMenu(), m_bPepSupported);
JabberUpdateDialogs(m_menuItemsStatus);
}
@@ -1273,7 +1256,7 @@ CJabberProto *JabberChooseInstance(bool bIsLink) }
else clmi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)ppro->m_hChooseMenuItem, (LPARAM)&clmi);
+ Menu_ModifyItem(ppro->m_hChooseMenuItem, &clmi);
}
if (nItems > 1) {
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 19a4745d34..b4083314e9 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1589,7 +1589,7 @@ int __cdecl CJabberProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARA CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
clmi.ptszName = m_tszUserName;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuRoot, (LPARAM)&clmi);
+ Menu_ModifyItem(m_hMenuRoot, &clmi);
}
break;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 90ef79398a..ea534109d1 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -346,7 +346,7 @@ struct CJabberProto : public PROTO_INTERFACE DWORD m_dwSDLastRefresh;
DWORD m_dwSDLastAutoDisco;
- HANDLE m_hChooseMenuItem;
+ HGENMENU m_hChooseMenuItem;
int m_privacyMenuServiceAllocated;
TFilterInfo m_filterInfo;
@@ -1005,8 +1005,8 @@ private: BOOL m_menuItemsStatus;
LIST<void> m_hPrivacyMenuItems;
- int m_nMenuResourceItems;
- HANDLE* m_phMenuResourceItems;
+ int m_nMenuResourceItems;
+ HGENMENU *m_phMenuResourceItems;
};
extern LIST<CJabberProto> g_Instances;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 95d1b60946..5427401826 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -481,7 +481,6 @@ void CPepGuiService::RebuildMenu() mi.pszService = szService;
mi.position = 200010;
mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB | CMIF_HIDDEN | CMIF_ROOTHANDLE;
-
mi.icolibItem = m_hIcolibItem;
mi.ptszName = m_szText ? m_szText : _T("<advanced status slot>");
m_hMenuItem = Menu_AddProtoMenuItem(&mi);
@@ -510,7 +509,7 @@ void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, TCHAR *text) mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB | CMIM_ICON | CMIM_NAME;
mi.icolibItem = m_hIcolibItem;
mi.ptszName = m_szText ? m_szText : _T("<advanced status slot>");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(m_hMenuItem, &mi);
}
int CPepGuiService::OnMenuItemClick(WPARAM, LPARAM)
diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h index dbbd95c678..2fc8cb77ab 100644 --- a/protocols/JabberG/src/jabber_xstatus.h +++ b/protocols/JabberG/src/jabber_xstatus.h @@ -34,7 +34,7 @@ public: CPepService(CJabberProto *proto, char *name, TCHAR *node);
virtual ~CPepService();
- HANDLE GetMenu() { return m_hMenuItem; }
+ HGENMENU GetMenu() { return m_hMenuItem; }
TCHAR *GetNode() { return m_node; }
virtual void ProcessItems(const TCHAR *from, HXML items) = 0;
@@ -51,7 +51,7 @@ protected: CJabberProto *m_proto;
char *m_name;
TCHAR *m_node;
- HANDLE m_hMenuItem;
+ HGENMENU m_hMenuItem;
int m_wasPublished;
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index aa8c3cb5ab..24038dfad1 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -23,12 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "msn_global.h"
#include "msn_proto.h"
-static HGENMENU
- hBlockMenuItem,
- hLiveSpaceMenuItem,
- hNetmeetingMenuItem,
- hChatInviteMenuItem,
- hOpenInboxMenuItem;
+static HGENMENU hBlockMenuItem, hLiveSpaceMenuItem, hNetmeetingMenuItem, hChatInviteMenuItem, hOpenInboxMenuItem;
+
HANDLE hNetMeeting, hBlockCom, hSendHotMail, hInviteChat, hViewProfile;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -147,24 +143,20 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) bool isMe = MSN_IsMeByContact(hContact, szEmail);
if (szEmail[0]) {
int listId = Lists_GetMask(szEmail);
-
bool noChat = !(listId & LIST_FL) || isMe || getByte(hContact, "ChatRoom", 0);
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB;
- if (noChat) mi.flags |= CMIF_HIDDEN;
+ mi.flags = CMIM_NAME;
mi.pszName = (char*)((listId & LIST_BL) ? "&Unblock" : "&Block");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hBlockMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(hBlockMenuItem, &mi);
+ Menu_ShowItem(hBlockMenuItem, !noChat);
- mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB;
- if (!emailEnabled) mi.flags |= CMIF_HIDDEN;
mi.pszName = isMe ? LPGEN("Open &Hotmail Inbox") : LPGEN("Send &Hotmail E-mail");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hOpenInboxMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(hOpenInboxMenuItem, &mi);
+ Menu_ShowItem(hOpenInboxMenuItem, emailEnabled);
- mi.flags = CMIM_FLAGS | CMIF_ICONFROMICOLIB | CMIF_NOTOFFLINE;
- if (noChat) mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hNetmeetingMenuItem, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hChatInviteMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hNetmeetingMenuItem, !noChat);
+ Menu_ShowItem(hChatInviteMenuItem, !noChat);
}
return 0;
@@ -365,15 +357,12 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable) if (!bEnable)
mi.flags |= CMIF_GRAYED;
- for (unsigned i=0; i < SIZEOF(menuItemsMain); i++)
+ for (int i=0; i < SIZEOF(menuItemsMain); i++)
if (menuItemsMain[i] != NULL)
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[i], (LPARAM)&mi);
+ Menu_ModifyItem(menuItemsMain[i], &mi);
- if (bEnable) {
- mi.flags = CMIM_FLAGS;
- if (!emailEnabled) mi.flags |= CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)menuItemsMain[1], (LPARAM)&mi);
- }
+ if (bEnable)
+ Menu_ShowItem(menuItemsMain[1], emailEnabled);
}
//////////////////////////////////////////////////////////////////////////////////////
@@ -415,28 +404,17 @@ static INT_PTR MsnMenuSendHotmail(WPARAM wParam, LPARAM lParam) return (ppro) ? ppro->MsnSendHotmail(wParam, lParam) : 0;
}
-static void sttEnableMenuItem(HANDLE hMenuItem, bool bEnable)
-{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if (!bEnable)
- clmi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi);
-}
-
static int MSN_OnPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
CMsnProto* ppro = GetProtoInstanceByHContact((HANDLE)wParam);
if (ppro)
ppro->OnPrebuildContactMenu(wParam, lParam);
- else
- {
- sttEnableMenuItem(hBlockMenuItem, false);
- sttEnableMenuItem(hLiveSpaceMenuItem, false);
- sttEnableMenuItem(hNetmeetingMenuItem, false);
- sttEnableMenuItem(hChatInviteMenuItem, false);
- sttEnableMenuItem(hOpenInboxMenuItem, false);
+ else {
+ Menu_ShowItem(hBlockMenuItem, false);
+ Menu_ShowItem(hLiveSpaceMenuItem, false);
+ Menu_ShowItem(hNetmeetingMenuItem, false);
+ Menu_ShowItem(hChatInviteMenuItem, false);
+ Menu_ShowItem(hOpenInboxMenuItem, false);
}
return 0;
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index e28d9f08fd..6aed26d1a0 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -391,8 +391,8 @@ void CYahooProto::MenuMainInit( void ) hRoot = mainMenuRoot = Menu_AddProtoMenuItem(&mi);
}
else {
- if ( mainMenuRoot )
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )mainMenuRoot, 0);
+ if (mainMenuRoot)
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)mainMenuRoot, 0);
mainMenuRoot = NULL;
}
@@ -498,25 +498,20 @@ void CYahooProto::MenuContactInit( void ) void CYahooProto::MenuUninit( void )
{
if ( mainMenuRoot )
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )mainMenuRoot, 0);
+ CallService( MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)mainMenuRoot, 0);
- CallService( MS_CLIST_REMOVECONTACTMENUITEM, ( WPARAM )hShowProfileMenuItem, 0);
+ CallService( MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hShowProfileMenuItem, 0);
}
int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
{
const HANDLE hContact = (HANDLE)wParam;
- if (!IsMyContact(hContact)) {
+ if (!IsMyContact(hContact)) {
DebugLog("[OnPrebuildContactMenu] Not a Yahoo Contact!!!");
return 0;
}
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
- if (GetWord( hContact, "yprotoid", 0) != 0)
- mi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowProfileMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hShowProfileMenuItem, GetWord(hContact, "yprotoid", 0) == 0);
return 0;
}
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index bfbc5e61e8..864fedd128 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -61,7 +61,7 @@ int CYahooProto::DebugLog( const char *fmt, ... ) va_end( vararg );
- return CallService( MS_NETLIB_LOG, ( WPARAM )m_hNetlibUser, (LPARAM)str );
+ return CallService(MS_NETLIB_LOG, (WPARAM)m_hNetlibUser, (LPARAM)str);
}
extern HANDLE g_hNetlibUser;
@@ -78,7 +78,7 @@ int DebugLog( const char *fmt, ... ) va_end( vararg );
- return CallService( MS_NETLIB_LOG, ( WPARAM )g_hNetlibUser, (LPARAM)str );
+ return CallService(MS_NETLIB_LOG, (WPARAM)g_hNetlibUser, (LPARAM)str);
}
int CYahooProto::GetByte( const char* valueName, int parDefltValue )
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 29eadd3304..ada93c72db 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -329,8 +329,8 @@ HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int //not already there: add
LOG(("[add_buddy] Adding buddy id: %s (Nick: %s), flags: %lu", yid, yahoo_name, flags));
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_ADD, 0, 0);
- CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hContact,(LPARAM)m_szModuleName );
+ hContact = (HANDLE)CallService( MS_DB_CONTACT_ADD, 0, 0);
+ CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact,(LPARAM)m_szModuleName);
SetString( hContact, YAHOO_LOGINID, yid );
Set_Protocol( hContact, protocol );
|