diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-06-21 17:25:31 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-06-21 17:25:31 +0000 |
commit | 13ec12177636fb42c9692664d0f48bd3be2a7fc0 (patch) | |
tree | 48a33ed40ec1e4dc9c5a8b4aa192ed1ec853c2f1 /protocols/Steam/src/steam_menus.cpp | |
parent | ee8b6d3e7acadbd3bd87a1c3cfb06e7b7af88c64 (diff) |
Steam: added block command to contact menu
git-svn-id: http://svn.miranda-ng.org/main/trunk@9545 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_menus.cpp')
-rw-r--r-- | protocols/Steam/src/steam_menus.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index be3a2ed181..f0a2e19b21 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -25,6 +25,21 @@ int CSteamProto::AuthRequestCommand(WPARAM hContact, LPARAM) return 0;
}
+int CSteamProto::BlockCommand(WPARAM hContact, LPARAM)
+{
+ ptrA token(getStringA("TokenSecret"));
+ ptrA sessionId(getStringA("SessionID"));
+ ptrA steamId(getStringA("SteamID"));
+ char *who = getStringA(hContact, "SteamID");
+
+ PushRequest(
+ new SteamWebApi::BlockFriendRequest(token, sessionId, steamId, who),
+ &CSteamProto::OnFriendBlocked,
+ who);
+
+ return 0;
+}
+
int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM)
{
char url[MAX_PATH];
@@ -49,6 +64,9 @@ int CSteamProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) bool authNeeded = getBool(hContact, "Auth", 0);
Menu_ShowItem(contactMenuItems[CMI_AUTH_REQUEST], authNeeded);
+ bool isBlocked = getBool(hContact, "Block", 0);
+ Menu_ShowItem(contactMenuItems[CMI_BLOCK], !isBlocked);
+
DWORD gameId = getDword(hContact, "GameID", 0);
Menu_ShowItem(contactMenuItems[CMI_JOIN_GAME], gameId > 0);
@@ -74,18 +92,26 @@ void CSteamProto::InitMenus() mi.cbSize = sizeof(CLISTMENUITEM);
mi.flags = CMIF_TCHAR;
- // "Join to game"
- mi.pszService = MODULE"/AuthRequest";
+ // "Request authorization"
+ mi.pszService = MODULE "/AuthRequest";
mi.ptszName = LPGENT("Request authorization");
mi.position = -201001000 + CMI_AUTH_REQUEST;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
contactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::AuthRequestCommand>);
+ // "Block"
+ mi.pszService = MODULE "/Block";
+ mi.ptszName = LPGENT("Block");
+ mi.position = -201001001 + CMI_BLOCK;
+ mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
+ contactMenuItems[CMI_BLOCK] = Menu_AddContactMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::BlockCommand>);
+
mi.flags |= CMIF_NOTOFFLINE;
// "Join to game"
- mi.pszService = MODULE"/JoinToGame";
+ mi.pszService = MODULE "/JoinToGame";
mi.ptszName = LPGENT("Join to game");
mi.position = -200001000 + CMI_JOIN_GAME;
mi.icolibItem = NULL;
|