From 6c6549fe3bd2e4103b917a7a9d4c7baf01f1726e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sat, 3 Nov 2012 15:28:05 +0000 Subject: Facebook: Few services in status menu git-svn-id: http://svn.miranda-ng.org/main/trunk@2164 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/proto.cpp | 28 ++++++++++++++++++++++++++++ protocols/FacebookRM/src/proto.h | 6 +++++- protocols/FacebookRM/src/theme.cpp | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index f0b9b7af90..18ada5d913 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -451,6 +451,34 @@ int FacebookProto::OnMind(WPARAM,LPARAM) return FALSE; } +int FacebookProto::CheckNewsfeeds(WPARAM, LPARAM) +{ + if (!isOffline()) { + facy.client_notify( TranslateT("Loading newsfeeds...")); + facy.feeds(); + } + return 0; +} + +int FacebookProto::CheckFriendRequests(WPARAM, LPARAM) +{ + if (!isOffline()) { + facy.client_notify( TranslateT("Checking friend requests...")); + ProcessFriendRequests(NULL); + } + return 0; +} + +int FacebookProto::RefreshBuddyList(WPARAM, LPARAM) +{ + if (!isOffline()) { + facy.client_notify( TranslateT("Refreshing buddy list...")); + facy.buddy_list(); + } + return 0; +} + + int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) { HANDLE hContact = reinterpret_cast(wParam); diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index cdeeaf03f6..0d58e3ae1e 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -111,6 +111,9 @@ public: int __cdecl RequestFriendship(WPARAM, LPARAM ); int __cdecl ApproveFriendship(WPARAM, LPARAM ); int __cdecl OnCancelFriendshipRequest(WPARAM, LPARAM ); + int __cdecl CheckNewsfeeds(WPARAM, LPARAM ); + int __cdecl CheckFriendRequests(WPARAM, LPARAM ); + int __cdecl RefreshBuddyList(WPARAM, LPARAM ); // Events int __cdecl OnModulesLoaded(WPARAM, LPARAM); @@ -183,7 +186,8 @@ public: void ToggleStatusMenuItems( BOOL bEnable ); // Handles, Locks - HGENMENU m_hMenuRoot; + HGENMENU m_hMenuRoot; + HGENMENU m_hMenuServicesRoot; HANDLE m_hStatusMind; HANDLE signon_lock_; diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 128eb72759..a223351533 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -274,6 +274,39 @@ int FacebookProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam) // TODO RM: remember and properly free in destructor? /*m_hStatusMind = */Menu_AddProtoMenuItem(&mi); + // Services... + mi.pszName = LPGEN("Services..."); + strcpy( tDest, "/Services" ); + mi.flags = CMIF_ICONFROMICOLIB | CMIF_CHILDPOPUP | ( this->isOnline() ? 0 : CMIF_GRAYED ); + mi.icolibItem = NULL; + m_hMenuServicesRoot = Menu_AddProtoMenuItem(&mi); + + CreateProtoService(m_szModuleName,"/CheckFriendRequests",&FacebookProto::CheckFriendRequests,this); + strcpy(tDest,"/CheckFriendRequests"); + mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE; + mi.pszName = LPGEN("Check Friends Requests"); + mi.icolibItem = NULL; + mi.hParentMenu = m_hMenuServicesRoot; + Menu_AddProtoMenuItem(&mi); + + CreateProtoService(m_szModuleName,"/CheckNewsfeeds",&FacebookProto::CheckNewsfeeds,this); + strcpy(tDest,"/CheckNewsfeeds"); + mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE; + mi.pszName = LPGEN("Check Newsfeeds"); + mi.pszPopupName = LPGEN("Services"); + mi.icolibItem = NULL; + mi.hParentMenu = m_hMenuServicesRoot; + Menu_AddProtoMenuItem(&mi); + + CreateProtoService(m_szModuleName,"/RefreshBuddyList",&FacebookProto::RefreshBuddyList,this); + strcpy(tDest,"/RefreshBuddyList"); + mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE; + mi.pszName = LPGEN("Refresh buddy list"); + mi.pszPopupName = LPGEN("Services"); + mi.icolibItem = NULL; + mi.hParentMenu = m_hMenuServicesRoot; + Menu_AddProtoMenuItem(&mi); + return 0; } @@ -285,4 +318,5 @@ void FacebookProto::ToggleStatusMenuItems( BOOL bEnable ) 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 ); } -- cgit v1.2.3