diff options
Diffstat (limited to 'protocols/Steam/src/steam_menus.cpp')
-rw-r--r-- | protocols/Steam/src/steam_menus.cpp | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index 6ed3f211fa..c5bc24e395 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -1,15 +1,7 @@ #include "stdafx.h"
-int CSteamProto::hChooserMenu;
HGENMENU CSteamProto::contactMenuItems[CMI_MAX];
-template<int(__cdecl CSteamProto::*Service)(WPARAM, LPARAM)>
-INT_PTR GlobalService(WPARAM hContact, LPARAM lParam)
-{
- CSteamProto *ppro = CMPlugin::getInstance((MCONTACT)hContact);
- return ppro ? (ppro->*Service)(hContact, lParam) : 0;
-}
-
INT_PTR CSteamProto::AuthRequestCommand(WPARAM hContact, LPARAM)
{
ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, 0);
@@ -18,35 +10,23 @@ INT_PTR CSteamProto::AuthRequestCommand(WPARAM hContact, LPARAM) INT_PTR CSteamProto::AuthRevokeCommand(WPARAM hContact, LPARAM)
{
- ptrA token(getStringA("TokenSecret"));
- ptrA sessionId(getStringA("SessionID"));
- ptrA steamId(getStringA(DBKEY_STEAM_ID));
- char *who = getStringA(hContact, DBKEY_STEAM_ID);
- SendRequest(new RemoveFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendRemoved, who);
+ SendUserRemoveRequest(hContact);
return 0;
}
-int CSteamProto::BlockCommand(WPARAM hContact, LPARAM)
+INT_PTR CSteamProto::BlockCommand(WPARAM hContact, LPARAM)
{
- ptrA token(getStringA("TokenSecret"));
- ptrA sessionId(getStringA("SessionID"));
- ptrA steamId(getStringA(DBKEY_STEAM_ID));
- char *who = getStringA(hContact, DBKEY_STEAM_ID);
- SendRequest(new BlockFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendBlocked, who);
+ SendUserIgnoreRequest(hContact, true);
return 0;
}
-int CSteamProto::UnblockCommand(WPARAM hContact, LPARAM)
+INT_PTR CSteamProto::UnblockCommand(WPARAM hContact, LPARAM)
{
- ptrA token(getStringA("TokenSecret"));
- ptrA sessionId(getStringA("SessionID"));
- ptrA steamId(getStringA(DBKEY_STEAM_ID));
- char *who = getStringA(hContact, DBKEY_STEAM_ID);
- SendRequest(new UnblockFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendUnblocked, who);
+ SendUserIgnoreRequest(hContact, false);
return 0;
}
-int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM)
+INT_PTR CSteamProto::JoinGameCommand(WPARAM hContact, LPARAM)
{
char url[MAX_PATH];
uint32_t gameId = getDword(hContact, "GameID", 0);
@@ -55,11 +35,18 @@ int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM) return 0;
}
+INT_PTR CSteamProto::JoinChatCommand(WPARAM hContact, LPARAM)
+{
+ CChatRoomJoinChatRoomGroupRequest request;
+ request.chat_group_id = GetId(hContact, DBKEY_GROUP_ID); request.has_chat_group_id = true;
+ // request.chat_id = getDword(hContact, DBKEY_CHAT_ID); request.has_chat_id = true;
+ WSSendService(JoinChatRoomGroup, request);
+ return 0;
+}
+
INT_PTR CSteamProto::OpenBlockListCommand(WPARAM, LPARAM)
{
- ptrA token(getStringA("TokenSecret"));
- ptrA steamId(getStringA(DBKEY_STEAM_ID));
- SendRequest(new GetFriendListRequest(token, steamId, "ignoredfriend"), &CSteamProto::OnGotBlockList);
+ // SendRequest(new GetFriendListRequest(m_szAccessToken, m_iSteamId, "ignoredfriend"), &CSteamProto::OnGotBlockList);
return 0;
}
@@ -73,16 +60,22 @@ int CSteamProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
- bool authNeeded = getBool(hContact, "Auth", 0);
- Menu_ShowItem(GetMenuItem(PROTO_MENU_REQ_AUTH), authNeeded || ctrlPressed);
- Menu_ShowItem(GetMenuItem(PROTO_MENU_REVOKE_AUTH), !authNeeded || ctrlPressed);
+ if (!Contact::IsGroupChat(hContact)) {
+ bool authNeeded = getBool(hContact, "Auth");
+ Menu_ShowItem(GetMenuItem(PROTO_MENU_REQ_AUTH), authNeeded || ctrlPressed);
+ Menu_ShowItem(GetMenuItem(PROTO_MENU_REVOKE_AUTH), !authNeeded || ctrlPressed);
+ }
- bool isBlocked = getBool(hContact, "Block", 0);
+ bool isBlocked = getBool(hContact, "Block");
Menu_ShowItem(contactMenuItems[CMI_BLOCK], !isBlocked || ctrlPressed);
Menu_ShowItem(contactMenuItems[CMI_UNBLOCK], isBlocked || ctrlPressed);
- uint32_t gameId = getDword(hContact, "GameID", 0);
+ uint32_t gameId = getDword(hContact, "GameID");
Menu_ShowItem(contactMenuItems[CMI_JOIN_GAME], gameId || ctrlPressed);
+
+ int chatType = getByte(hContact, "ChatRoom");
+ int64_t chatId = GetId(hContact, DBKEY_CHAT_ID);
+ Menu_ShowItem(contactMenuItems[CMI_JOIN_CHAT], chatId && chatType == GCW_SERVER);
return 0;
}
@@ -111,26 +104,21 @@ void CSteamProto::OnInitStatusMenu() void CSteamProto::InitMenus()
{
- hChooserMenu = Menu_AddObject("SteamAccountChooser", LPGEN("Steam menu chooser"), nullptr, "Steam/MenuChoose");
-
- //////////////////////////////////////////////////////////////////////////////////////
- // Contact menu initialization
CMenuItem mi(&g_plugin);
- mi.flags = CMIF_UNICODE;
- // "Block"
+ // Block
SET_UID(mi, 0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32);
- mi.pszService = MODULE "/Block";
- mi.name.w = LPGENW("Block");
+ mi.pszService = MODULENAME "/Block";
+ mi.name.a = LPGEN("Block");
mi.position = -201001001 + CMI_BLOCK;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_OFF);
contactMenuItems[CMI_BLOCK] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::BlockCommand>);
- // "Unblock"
+ // Unblock
SET_UID(mi, 0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32);
- mi.pszService = MODULE "/Unblock";
- mi.name.w = LPGENW("Unblock");
+ mi.pszService = MODULENAME "/Unblock";
+ mi.name.a = LPGEN("Unblock");
mi.position = -201001001 + CMI_UNBLOCK;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_ON);
contactMenuItems[CMI_UNBLOCK] = Menu_AddContactMenuItem(&mi);
@@ -138,14 +126,23 @@ void CSteamProto::InitMenus() mi.flags |= CMIF_NOTOFFLINE;
- // "Join to game"
+ // Join to game
SET_UID(mi, 0x1a6aaab7, 0xba31, 0x4b47, 0x8e, 0xce, 0xf8, 0x8e, 0xf4, 0x62, 0x4f, 0xd7);
- mi.pszService = MODULE "/JoinToGame";
- mi.name.w = LPGENW("Join to game");
+ mi.pszService = MODULENAME "/JoinGame";
+ mi.name.a = LPGEN("Join the game");
mi.position = -200001000 + CMI_JOIN_GAME;
mi.hIcolibItem = nullptr;
contactMenuItems[CMI_JOIN_GAME] = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::JoinToGameCommand>);
+ CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::JoinGameCommand>);
+
+ // Join clan's chat
+ SET_UID(mi, 0x4da0c3d3, 0x6fca, 0x42ba, 0xac, 0x72, 0x5c, 0xc9, 0x42, 0x5a, 0x70, 0x4e);
+ mi.pszService = MODULENAME "/JoinChat";
+ mi.name.a = LPGEN("Join group chat");
+ mi.position = -200001002 + CMI_JOIN_GAME;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_CHAT_JOIN);
+ contactMenuItems[CMI_JOIN_CHAT] = Menu_AddContactMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::JoinChatCommand>);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSteamProto::PrebuildContactMenu);
}
|