From 2f3b31c24b05f6115e154b0bfdfdbfbc2a5a1a95 Mon Sep 17 00:00:00 2001 From: TurtleP Date: Fri, 2 Apr 2021 13:32:29 -0400 Subject: [PATCH] Revert "friends update" This reverts commit 17c4e2dfff229d962d0f56baf92dd9fc3f23be72. --- nx/include/switch/services/friends.h | 36 +-------------------- nx/source/services/friends.c | 47 +--------------------------- 2 files changed, 2 insertions(+), 81 deletions(-) diff --git a/nx/include/switch/services/friends.h b/nx/include/switch/services/friends.h index b7f419da..36a9a2fd 100644 --- a/nx/include/switch/services/friends.h +++ b/nx/include/switch/services/friends.h @@ -11,14 +11,6 @@ #include "../services/acc.h" #include "../sf/service.h" -typedef enum { - FriendServiceType_User = 0, ///< Initializes friend:u - FriendServiceType_V = 1, ///< Initializes friend:v - FriendServiceType_M = 2, ///< Initializes friend:m - FriendServiceType_S = 3, ///< Initializes friend:s - FriendServiceType_Application = 4 ///< Initializes friend:a -} FriendServiceType; - /// InAppScreenName typedef struct { char name[0x40]; ///< UTF-8 string, NUL-terminated. @@ -40,33 +32,6 @@ typedef struct { u64 id; ///< Id. } FriendsFriendInvitationGroupId; -/// FriendsUserSetting -typedef struct { - AccountUid uid; - u32 presence_permission; - u32 play_log_permission; - u64 friend_request_reception; // maybe u32? - char friend_code[0x20]; - u64 friend_code_next_issuable_time; // or u64? I think sizeof(time_t) == 8 - char extra[0x7C8]; -} FriendUserSetting; - -/// Initialize friends -Result friendsInitialize(FriendServiceType service_type); - -/// Exit friends -void friendsExit(); - -/// Gets the Service object for the actual friends service session. -Service * friendsGetServiceSession(); - -/** - * @brief Gets the \ref FriendUserSetting details - * @param[in] uid \ref User AccountUid. - * @param[out] user_setting \ref FriendUserSetting - */ -Result friendsGetUserSetting(AccountUid uid, FriendUserSetting * user_setting); - /** * @brief Gets an Event which is signaled when data is available with \ref friendsTryPopFriendInvitationNotificationInfo. * @note This is a wrapper for \ref appletGetFriendInvitationStorageChannelEvent, see that for the usage requirements. @@ -86,3 +51,4 @@ NX_INLINE Result friendsGetFriendInvitationNotificationEvent(Event *out_event) { * @param[out] out_size Size of the data which was written into the output buffer. Optional, can be NULL. */ Result friendsTryPopFriendInvitationNotificationInfo(AccountUid *uid, void* buffer, u64 size, u64 *out_size); + diff --git a/nx/source/services/friends.c b/nx/source/services/friends.c index c8bdc75b..4195f203 100644 --- a/nx/source/services/friends.c +++ b/nx/source/services/friends.c @@ -1,52 +1,6 @@ #include "service_guard.h" #include "services/friends.h" -static FriendServiceType g_friendsServiceType; -static Service g_friendsSrv; - -NX_GENERATE_SERVICE_GUARD_PARAMS(friends, (FriendServiceType service_type), (service_type)); - -Result _friendsInitialize(FriendServiceType service_type) { - Result rc = MAKERESULT(Module_Libnx, LibnxError_BadInput); - - g_friendsServiceType = service_type; - - switch (g_friendsServiceType) { - case FriendServiceType_User: - rc = smGetService(&g_friendsSrv, "friend:u"); - break; - case FriendServiceType_Application: - rc = smGetService(&g_friendsSrv, "friend:a"); - break; - case FriendServiceType_M: - rc = smGetService(&g_friendsSrv, "friend:m"); - break; - case FriendServiceType_V: - rc = smGetService(&g_friendsSrv, "friend:v"); - break; - case FriendServiceType_S: - rc = smGetService(&g_friendsSrv, "friend:s"); - break; - } - - return rc; -} - -void _friendsCleanup(void) { - serviceClose(&g_friendsSrv); -} - -Service* friendsGetServiceSession(void) { - return &g_friendsSrv; -} - -Result friendsGetUserSetting(AccountUid uid, FriendUserSetting * user_setting) { - return serviceDispatchIn(&g_friendsSrv, 20800, uid, - .buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out | SfBufferAttr_FixedSize }, - .buffers = { { &(*user_setting), sizeof(FriendUserSetting) } } - ); -} - Result friendsTryPopFriendInvitationNotificationInfo(AccountUid *uid, void* buffer, u64 size, u64 *out_size) { Result rc=0; AppletStorage storage; @@ -73,3 +27,4 @@ Result friendsTryPopFriendInvitationNotificationInfo(AccountUid *uid, void* buff appletStorageClose(&storage); return rc; } +