web/friendsLa: Updated for using AccountUid. Renamed webConfigSetUserID to webConfigSetUid, and renamed WebArgType_UserID to WebArgType_Uid.

This commit is contained in:
yellows8 2019-10-08 17:44:53 -04:00
parent 95f91c431c
commit 929990b7c8
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
4 changed files with 44 additions and 39 deletions

View File

@ -6,6 +6,7 @@
*/ */
#pragma once #pragma once
#include "../types.h" #include "../types.h"
#include "../services/acc.h"
#include "../services/friends.h" #include "../services/friends.h"
/// Arg type values used with \ref FriendsLaArg. /// Arg type values used with \ref FriendsLaArg.
@ -25,7 +26,7 @@ typedef enum {
typedef struct { typedef struct {
u32 type; ///< \ref FriendsLaArgType u32 type; ///< \ref FriendsLaArgType
u32 pad; ///< Padding. u32 pad; ///< Padding.
union { u128 userID; } PACKED; ///< Account userID. AccountUid userID; ///< \ref AccountUid
u64 networkServiceAccountId; ///< NetworkServiceAccountId for the other account. u64 networkServiceAccountId; ///< NetworkServiceAccountId for the other account.
FriendsInAppScreenName first_inAppScreenName; ///< First InAppScreenName. FriendsInAppScreenName first_inAppScreenName; ///< First InAppScreenName.
FriendsInAppScreenName second_inAppScreenName; ///< Second InAppScreenName. FriendsInAppScreenName second_inAppScreenName; ///< Second InAppScreenName.
@ -33,61 +34,61 @@ typedef struct {
/** /**
* @brief Launches the applet with ::FriendsLaArgType_ShowFriendList, the specified input, and playStartupSound=false. * @brief Launches the applet with ::FriendsLaArgType_ShowFriendList, the specified input, and playStartupSound=false.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
*/ */
Result friendsLaShowFriendList(u128 userID); Result friendsLaShowFriendList(AccountUid *userID);
/** /**
* @brief Launches the applet with ::FriendsLaArgType_ShowUserDetailInfo, the specified input, and playStartupSound=false. * @brief Launches the applet with ::FriendsLaArgType_ShowUserDetailInfo, the specified input, and playStartupSound=false.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
* @param[in] networkServiceAccountId NetworkServiceAccountId for the user to show UserDetailInfo for. * @param[in] networkServiceAccountId NetworkServiceAccountId for the user to show UserDetailInfo for.
* @param[in] first_inAppScreenName First \ref FriendsInAppScreenName. * @param[in] first_inAppScreenName First \ref FriendsInAppScreenName.
* @param[in] second_inAppScreenName Second \ref FriendsInAppScreenName. * @param[in] second_inAppScreenName Second \ref FriendsInAppScreenName.
*/ */
Result friendsLaShowUserDetailInfo(u128 userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName); Result friendsLaShowUserDetailInfo(AccountUid *userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName);
/** /**
* @brief Launches the applet with ::FriendsLaArgType_StartSendingFriendRequest, the specified input, and playStartupSound=false. On success, this will load the output Result from the output storage. * @brief Launches the applet with ::FriendsLaArgType_StartSendingFriendRequest, the specified input, and playStartupSound=false. On success, this will load the output Result from the output storage.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
* @param[in] networkServiceAccountId NetworkServiceAccountId to send the friend request to. * @param[in] networkServiceAccountId NetworkServiceAccountId to send the friend request to.
* @param[in] first_inAppScreenName First \ref FriendsInAppScreenName. * @param[in] first_inAppScreenName First \ref FriendsInAppScreenName.
* @param[in] second_inAppScreenName Second \ref FriendsInAppScreenName. * @param[in] second_inAppScreenName Second \ref FriendsInAppScreenName.
*/ */
Result friendsLaStartSendingFriendRequest(u128 userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName); Result friendsLaStartSendingFriendRequest(AccountUid *userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName);
/** /**
* @brief Launches the applet with ::FriendsLaArgType_ShowMethodsOfSendingFriendRequest, the specified input, and playStartupSound=false. * @brief Launches the applet with ::FriendsLaArgType_ShowMethodsOfSendingFriendRequest, the specified input, and playStartupSound=false.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
*/ */
Result friendsLaShowMethodsOfSendingFriendRequest(u128 userID); Result friendsLaShowMethodsOfSendingFriendRequest(AccountUid *userID);
/** /**
* @brief Launches the applet with ::FriendsLaArgType_StartFacedFriendRequest, the specified input, and playStartupSound=false. * @brief Launches the applet with ::FriendsLaArgType_StartFacedFriendRequest, the specified input, and playStartupSound=false.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
*/ */
Result friendsLaStartFacedFriendRequest(u128 userID); Result friendsLaStartFacedFriendRequest(AccountUid *userID);
/** /**
* @brief Launches the applet with ::FriendsLaArgType_ShowReceivedFriendRequestList, the specified input, and playStartupSound=false. * @brief Launches the applet with ::FriendsLaArgType_ShowReceivedFriendRequestList, the specified input, and playStartupSound=false.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
*/ */
Result friendsLaShowReceivedFriendRequestList(u128 userID); Result friendsLaShowReceivedFriendRequestList(AccountUid *userID);
/** /**
* @brief Launches the applet with ::FriendsLaArgType_ShowBlockedUserList, the specified input, and playStartupSound=false. * @brief Launches the applet with ::FriendsLaArgType_ShowBlockedUserList, the specified input, and playStartupSound=false.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
*/ */
Result friendsLaShowBlockedUserList(u128 userID); Result friendsLaShowBlockedUserList(AccountUid *userID);
/** /**
* @brief Launches the applet with ::FriendsLaArgType_ShowMyProfile, the specified input, and playStartupSound=false. * @brief Launches the applet with ::FriendsLaArgType_ShowMyProfile, the specified input, and playStartupSound=false.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
*/ */
Result friendsLaShowMyProfile(u128 userID); Result friendsLaShowMyProfile(AccountUid *userID);
/** /**
* @brief Same as \ref friendsLaShowMyProfile except with playStartupSound=true. * @brief Same as \ref friendsLaShowMyProfile except with playStartupSound=true.
* @param[in] userID Account userID. * @param[in] userID \ref AccountUid
*/ */
Result friendsLaShowMyProfileForHomeMenu(u128 userID); Result friendsLaShowMyProfileForHomeMenu(AccountUid *userID);

View File

@ -8,6 +8,7 @@
#include "../types.h" #include "../types.h"
#include "../services/applet.h" #include "../services/applet.h"
#include "../services/caps.h" #include "../services/caps.h"
#include "../services/acc.h"
/// This indicates the type of web-applet. /// This indicates the type of web-applet.
typedef enum { typedef enum {
@ -126,7 +127,7 @@ typedef enum {
WebArgType_NewsFlag = 0xB, ///< [1.0.0+] u8 bool WebArgType_NewsFlag = 0xB, ///< [1.0.0+] u8 bool
WebArgType_UnknownC = 0xC, ///< [1.0.0+] u8 WebArgType_UnknownC = 0xC, ///< [1.0.0+] u8
WebArgType_UnknownD = 0xD, ///< [1.0.0+] u8 WebArgType_UnknownD = 0xD, ///< [1.0.0+] u8
WebArgType_UserID = 0xE, ///< [1.0.0+] u128 userID, controls which user-specific savedata to mount. WebArgType_Uid = 0xE, ///< [1.0.0+] \ref AccountUid, controls which user-specific savedata to mount.
WebArgType_AlbumEntry0 = 0xF, ///< [1.0.0+] Share-applet caps AlbumEntry, entry 0. WebArgType_AlbumEntry0 = 0xF, ///< [1.0.0+] Share-applet caps AlbumEntry, entry 0.
WebArgType_ScreenShot = 0x10, ///< [1.0.0+] u8 bool WebArgType_ScreenShot = 0x10, ///< [1.0.0+] u8 bool
WebArgType_EcClientCert = 0x11, ///< [1.0.0+] u8 bool WebArgType_EcClientCert = 0x11, ///< [1.0.0+] u8 bool
@ -344,9 +345,9 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
* @note Only available with config created by \ref webPageCreate, \ref webLobbyCreate, or with Share-applet. * @note Only available with config created by \ref webPageCreate, \ref webLobbyCreate, or with Share-applet.
* @note Used automatically by \ref webShareCreate and \ref webLobbyCreate with userID=0. * @note Used automatically by \ref webShareCreate and \ref webLobbyCreate with userID=0.
* @param config WebCommonConfig object. * @param config WebCommonConfig object.
* @param userID Account userID * @param uid \ref AccountUid
*/ */
Result webConfigSetUserID(WebCommonConfig* config, u128 userID); Result webConfigSetUid(WebCommonConfig* config, AccountUid *uid);
/** /**
* @brief Sets the Share CapsAlbumEntry. * @brief Sets the Share CapsAlbumEntry.

View File

@ -1,6 +1,7 @@
#include <string.h> #include <string.h>
#include "types.h" #include "types.h"
#include "result.h" #include "result.h"
#include "services/acc.h"
#include "services/applet.h" #include "services/applet.h"
#include "applets/libapplet.h" #include "applets/libapplet.h"
#include "applets/friends_la.h" #include "applets/friends_la.h"
@ -25,51 +26,51 @@ static Result _friendsLaShow(const FriendsLaArg *arg, bool playStartupSound) {
return rc; return rc;
} }
static Result _friendsLaShowSimple(FriendsLaArgType type, u128 userID, bool playStartupSound) { static Result _friendsLaShowSimple(FriendsLaArgType type, AccountUid *userID, bool playStartupSound) {
FriendsLaArg arg = {.type = type, .userID = userID}; FriendsLaArg arg = {.type = type, .userID = *userID};
return _friendsLaShow(&arg, playStartupSound); return _friendsLaShow(&arg, playStartupSound);
} }
static Result _friendsLaShowAll(FriendsLaArgType type, u128 userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName, bool playStartupSound) { static Result _friendsLaShowAll(FriendsLaArgType type, AccountUid *userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName, bool playStartupSound) {
FriendsLaArg arg = {.type = type, .userID = userID, .networkServiceAccountId = networkServiceAccountId, .first_inAppScreenName = *first_inAppScreenName, .second_inAppScreenName = *second_inAppScreenName}; FriendsLaArg arg = {.type = type, .userID = *userID, .networkServiceAccountId = networkServiceAccountId, .first_inAppScreenName = *first_inAppScreenName, .second_inAppScreenName = *second_inAppScreenName};
return _friendsLaShow(&arg, playStartupSound); return _friendsLaShow(&arg, playStartupSound);
} }
Result friendsLaShowFriendList(u128 userID) { Result friendsLaShowFriendList(AccountUid *userID) {
return _friendsLaShowSimple(FriendsLaArgType_ShowFriendList, userID, false); return _friendsLaShowSimple(FriendsLaArgType_ShowFriendList, userID, false);
} }
Result friendsLaShowUserDetailInfo(u128 userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName) { Result friendsLaShowUserDetailInfo(AccountUid *userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName) {
return _friendsLaShowAll(FriendsLaArgType_ShowUserDetailInfo, userID, networkServiceAccountId, first_inAppScreenName, second_inAppScreenName, false); return _friendsLaShowAll(FriendsLaArgType_ShowUserDetailInfo, userID, networkServiceAccountId, first_inAppScreenName, second_inAppScreenName, false);
} }
Result friendsLaStartSendingFriendRequest(u128 userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName) { Result friendsLaStartSendingFriendRequest(AccountUid *userID, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName) {
return _friendsLaShowAll(FriendsLaArgType_StartSendingFriendRequest, userID, networkServiceAccountId, first_inAppScreenName, second_inAppScreenName, false); return _friendsLaShowAll(FriendsLaArgType_StartSendingFriendRequest, userID, networkServiceAccountId, first_inAppScreenName, second_inAppScreenName, false);
} }
Result friendsLaShowMethodsOfSendingFriendRequest(u128 userID) { Result friendsLaShowMethodsOfSendingFriendRequest(AccountUid *userID) {
return _friendsLaShowSimple(FriendsLaArgType_ShowMethodsOfSendingFriendRequest, userID, false); return _friendsLaShowSimple(FriendsLaArgType_ShowMethodsOfSendingFriendRequest, userID, false);
} }
Result friendsLaStartFacedFriendRequest(u128 userID) { Result friendsLaStartFacedFriendRequest(AccountUid *userID) {
return _friendsLaShowSimple(FriendsLaArgType_StartFacedFriendRequest, userID, false); return _friendsLaShowSimple(FriendsLaArgType_StartFacedFriendRequest, userID, false);
} }
Result friendsLaShowReceivedFriendRequestList(u128 userID) { Result friendsLaShowReceivedFriendRequestList(AccountUid *userID) {
return _friendsLaShowSimple(FriendsLaArgType_ShowReceivedFriendRequestList, userID, false); return _friendsLaShowSimple(FriendsLaArgType_ShowReceivedFriendRequestList, userID, false);
} }
Result friendsLaShowBlockedUserList(u128 userID) { Result friendsLaShowBlockedUserList(AccountUid *userID) {
return _friendsLaShowSimple(FriendsLaArgType_ShowBlockedUserList, userID, false); return _friendsLaShowSimple(FriendsLaArgType_ShowBlockedUserList, userID, false);
} }
Result friendsLaShowMyProfile(u128 userID) { Result friendsLaShowMyProfile(AccountUid *userID) {
return _friendsLaShowSimple(FriendsLaArgType_ShowMyProfile, userID, false); return _friendsLaShowSimple(FriendsLaArgType_ShowMyProfile, userID, false);
} }
Result friendsLaShowMyProfileForHomeMenu(u128 userID) { Result friendsLaShowMyProfileForHomeMenu(AccountUid *userID) {
return _friendsLaShowSimple(FriendsLaArgType_ShowMyProfile, userID, true); return _friendsLaShowSimple(FriendsLaArgType_ShowMyProfile, userID, true);
} }

View File

@ -350,11 +350,12 @@ Result webOfflineCreate(WebCommonConfig* config, WebDocumentKind docKind, u64 ti
Result webShareCreate(WebCommonConfig* config, WebShareStartPage page) { Result webShareCreate(WebCommonConfig* config, WebShareStartPage page) {
Result rc=0; Result rc=0;
AccountUid uid={0};
_webArgInitialize(config, AppletId_loginShare, WebShimKind_Share); _webArgInitialize(config, AppletId_loginShare, WebShimKind_Share);
rc = webConfigSetLeftStickMode(config, WebLeftStickMode_Cursor); rc = webConfigSetLeftStickMode(config, WebLeftStickMode_Cursor);
if (R_SUCCEEDED(rc)) rc = webConfigSetUserID(config, 0); if (R_SUCCEEDED(rc)) rc = webConfigSetUid(config, &uid);
if (R_SUCCEEDED(rc)) rc = webConfigSetDisplayUrlKind(config, true); if (R_SUCCEEDED(rc)) rc = webConfigSetDisplayUrlKind(config, true);
if (R_SUCCEEDED(rc)) rc = _webConfigSetU8(config, WebArgType_Unknown14, 1); if (R_SUCCEEDED(rc)) rc = _webConfigSetU8(config, WebArgType_Unknown14, 1);
@ -368,6 +369,7 @@ Result webShareCreate(WebCommonConfig* config, WebShareStartPage page) {
Result webLobbyCreate(WebCommonConfig* config) { Result webLobbyCreate(WebCommonConfig* config) {
Result rc=0; Result rc=0;
AccountUid uid={0};
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
_webArgInitialize(config, AppletId_loginShare, WebShimKind_Lobby); _webArgInitialize(config, AppletId_loginShare, WebShimKind_Lobby);
@ -375,7 +377,7 @@ Result webLobbyCreate(WebCommonConfig* config) {
rc = webConfigSetLeftStickMode(config, WebLeftStickMode_Cursor); rc = webConfigSetLeftStickMode(config, WebLeftStickMode_Cursor);
if (R_SUCCEEDED(rc) && config->version >= 0x30000) rc = webConfigSetPointer(config, false); // Added to user-process init with [3.0.0+]. if (R_SUCCEEDED(rc) && config->version >= 0x30000) rc = webConfigSetPointer(config, false); // Added to user-process init with [3.0.0+].
if (R_SUCCEEDED(rc)) rc = webConfigSetUserID(config, 0); if (R_SUCCEEDED(rc)) rc = webConfigSetUid(config, &uid);
if (R_SUCCEEDED(rc)) rc = _webConfigSetU8(config, WebArgType_Unknown14, 1); if (R_SUCCEEDED(rc)) rc = _webConfigSetU8(config, WebArgType_Unknown14, 1);
if (R_SUCCEEDED(rc)) rc = _webConfigSetU8(config, WebArgType_Unknown15, 1); if (R_SUCCEEDED(rc)) rc = _webConfigSetU8(config, WebArgType_Unknown15, 1);
@ -402,10 +404,10 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist) {
return _webConfigSetString(config, WebArgType_Whitelist, whitelist, 0x1000); return _webConfigSetString(config, WebArgType_Whitelist, whitelist, 0x1000);
} }
Result webConfigSetUserID(WebCommonConfig* config, u128 userID) { Result webConfigSetUid(WebCommonConfig* config, AccountUid *uid) {
WebShimKind shim = _webGetShimKind(config); WebShimKind shim = _webGetShimKind(config);
if (shim != WebShimKind_Share && shim != WebShimKind_Web && shim != WebShimKind_Lobby) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (shim != WebShimKind_Share && shim != WebShimKind_Web && shim != WebShimKind_Lobby) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _webTLVSet(config, WebArgType_UserID, &userID, sizeof(userID)); return _webTLVSet(config, WebArgType_Uid, uid, sizeof(*uid));
} }
static Result _webConfigSetAlbumEntryTLV(WebCommonConfig* config, WebArgType type, const CapsAlbumEntry *entry) { static Result _webConfigSetAlbumEntryTLV(WebCommonConfig* config, WebArgType type, const CapsAlbumEntry *entry) {