From 3234474db8b36b1a644d8686c5a54d261748769f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 27 Jun 2015 12:54:43 +0000 Subject: fix for the protocols' menus git-svn-id: http://svn.miranda-ng.org/main/trunk@14411 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/proto.cpp | 4 ---- protocols/FacebookRM/src/theme.cpp | 45 ++++++++++++++++---------------------- 2 files changed, 19 insertions(+), 30 deletions(-) (limited to 'protocols/FacebookRM/src') diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 13d816fac3..df22c38441 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -67,10 +67,6 @@ FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) : CreateProtoService(PS_JOINCHAT, &FacebookProto::OnJoinChat); CreateProtoService(PS_LEAVECHAT, &FacebookProto::OnLeaveChat); - CreateProtoService("/Mind", &FacebookProto::OnMind); - CreateProtoService("/VisitProfile", &FacebookProto::VisitProfile); - CreateProtoService("/VisitNotifications", &FacebookProto::VisitNotifications); - HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &FacebookProto::OnBuildStatusMenu); HookProtoEvent(ME_OPT_INITIALISE, &FacebookProto::OnOptionsInit); HookProtoEvent(ME_IDLE_CHANGED, &FacebookProto::OnIdleChanged); diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index ecb6403495..88e8d3ded4 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -208,13 +208,6 @@ int FacebookProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) { - char text[200]; - mir_strncpy(text, m_szModuleName, 100); - char *tDest = text + mir_strlen(text); - - CLISTMENUITEM mi = { 0 }; - mi.pszService = text; - HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { CLISTMENUITEM miRoot = { 0 }; @@ -231,49 +224,49 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) } } + CLISTMENUITEM mi = { 0 }; mi.flags = (this->isOnline() ? 0 : CMIF_GRAYED); mi.position = 201001; mi.hParentMenu = hRoot; - //CreateProtoService(m_szModuleName,"/Mind",&FacebookProto::OnMind,this); - mir_strcpy(tDest, "/Mind"); + mi.pszService = "/Mind"; + CreateProtoService(mi.pszService, &FacebookProto::OnMind); mi.name.a = LPGEN("Share status..."); mi.icolibItem = GetIconHandle("mind"); - m_hStatusMind = Menu_AddProtoMenuItem(&mi); + m_hStatusMind = Menu_AddProtoMenuItem(&mi, m_szModuleName); - //CreateProtoService("/VisitProfile",&FacebookProto::VisitProfile); - mir_strcpy(tDest, "/VisitProfile"); + mi.pszService = "/VisitProfile"; + CreateProtoService(mi.pszService, &FacebookProto::VisitProfile); mi.name.a = LPGEN("Visit profile"); mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL); - // TODO RM: remember and properly free in destructor? - /*m_hStatusMind = */Menu_AddProtoMenuItem(&mi); + Menu_AddProtoMenuItem(&mi, m_szModuleName); - //CreateProtoService("/VisitNotifications", &FacebookProto::VisitNotifications); - mir_strcpy(tDest, "/VisitNotifications"); + mi.pszService = "/VisitNotifications"; + CreateProtoService(mi.pszService, &FacebookProto::VisitNotifications); mi.name.a = LPGEN("Visit notifications"); mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL); - Menu_AddProtoMenuItem(&mi); + Menu_AddProtoMenuItem(&mi, m_szModuleName); // Services... mi.hParentMenu = m_hMenuServicesRoot = Menu_CreateRoot(MO_PROTO, LPGENT("Services..."), mi.position, Skin_GetIconHandle(SKINICON_OTHER_HELP)); - CreateProtoService("/RefreshBuddyList", &FacebookProto::RefreshBuddyList); - mir_strcpy(tDest, "/RefreshBuddyList"); + mi.pszService = "/RefreshBuddyList"; + CreateProtoService(mi.pszService, &FacebookProto::RefreshBuddyList); mi.name.a = LPGEN("Refresh Buddy List"); mi.icolibItem = GetIconHandle("friendship"); - Menu_AddProtoMenuItem(&mi); + Menu_AddProtoMenuItem(&mi, m_szModuleName); - CreateProtoService("/CheckFriendRequests", &FacebookProto::CheckFriendRequests); - mir_strcpy(tDest, "/CheckFriendRequests"); + mi.pszService = "/CheckFriendRequests"; + CreateProtoService(mi.pszService, &FacebookProto::CheckFriendRequests); mi.name.a = LPGEN("Check Friends Requests"); mi.icolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST); - Menu_AddProtoMenuItem(&mi); + Menu_AddProtoMenuItem(&mi, m_szModuleName); - CreateProtoService("/CheckNewsfeeds", &FacebookProto::CheckNewsfeeds); - mir_strcpy(tDest, "/CheckNewsfeeds"); + mi.pszService = "/CheckNewsfeeds"; + CreateProtoService(mi.pszService, &FacebookProto::CheckNewsfeeds); mi.name.a = LPGEN("Check Newsfeeds"); mi.icolibItem = GetIconHandle("newsfeed"); - Menu_AddProtoMenuItem(&mi); + Menu_AddProtoMenuItem(&mi, m_szModuleName); return 0; } -- cgit v1.2.3