mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-03 01:52:14 +02:00
parent
17c4e2dfff
commit
2f3b31c24b
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user