1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 
13 #ifndef __FP_API_H__
14 #define __FP_API_H__
15 
16 #include <nn/fp/fp_Types.h>
17 
18 namespace nn { namespace fp {
19 
20 /*!
21 @ingroup  nn_fp
22 @defgroup nn_fp_api  Friend Presence (FP) API
23 @brief  A list of Friend Presence (FP) library members. (Includes only C++ API members.)
24     @{
25 */
26 
27 //! @name  Initializing and Finalizing the Library
28 //! @{
29 
30 /*!
31 @brief  Initializes the friend presence library and makes the presence features available for use.
32 
33 @return  Returns the result.
34 */
35 nn::Result Initialize(void);
36 
37 /*!
38 @brief  Finalizes the friend presence library.
39 
40 This call succeeds even if the library is not initialized.
41 
42 @return  Returns the result.
43 */
44 nn::Result Finalize(void);
45 
46 /*!
47 @brief  Checks whether the friend presence library is initialized.
48 
49 @return  Returns <tt>true</tt> if the library is initialized, and <tt>false</tt> otherwise.
50 */
51 bool IsInitialized(void);
52 
53 //! @}
54 //! @name  Connection Management
55 //! @{
56 
57 /*!
58 @brief  Logs in to the friend server.
59 
60 You must establish a network connection before calling this function.
61 
62 This function succeeds even if it is called when the local user has already logged in. @n
63 In such cases, the asynchronous processing instantly completes successfully, but <tt>@ref NOTIFICATION_ONLINE</tt> is not issued.
64 
65 The local user is guaranteed to be online when the asynchronous processing succeeds.
66 
67 @note
68 If an application is run using something other than <tt>caferun</tt> (such as the launcher or the friend list viewer), the system might already have completed login before the application starts.
69 
70 For this reason, avoid using only <tt>@ref NOTIFICATION_ONLINE</tt> to determine whether the user is online.
71 
72 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
73 @param[in] pContext  Specifies the callback parameters.
74 
75 @return  Returns the result.
76 */
77 nn::Result LoginAsync(AsyncCallback pCallback, void* pContext);
78 
79 /*!
80 @brief  Logs out from the friend server.
81 
82 This function withdraws the login request for the application. @n
83 Because the system may have sent a login request, there is no guarantee of an offline state even if this function succeeds.
84 
85 If the connection with the server is lost for some reason, although it transitions to the offline state implicitly, the login request remains.
86 
87 This function succeeds even if it is called when the local user has already logged out.
88 
89 @return  Returns the result.
90 */
91 nn::Result Logout(void);
92 
93 /*!
94 @brief  Checks the login status of the local user.
95 
96 Check whether the local user is online after calling the <tt>@ref LoginAsync</tt> function.
97 
98 @return  Returns <tt>true</tt> if the local user is logged in; and returns <tt>false</tt> otherwise. @n
99 The local user is guaranteed to be logged in if this function returns <tt>true</tt>, but it is not necessarily offline if this function returns <tt>false</tt>. The function may return <tt>false</tt> when the system has sent a login request.
100 */
101 bool HasLoggedIn(void);
102 
103 /*!
104 @brief  Checks the online status.
105 
106 Check whether the local user is online, and whether the <tt>@ref LoginAsync</tt> function has been called.
107 
108 @return  Returns <tt>true</tt> if online, and <tt>false</tt> otherwise.
109 */
110 bool IsOnline(void);
111 
112 //! @}
113 //! @name  Getting Information About the Local User
114 //! @{
115 
116 /*!
117 @brief  Gets the local principal ID.
118 
119 @return  Returns the local principal ID. @n
120 If offline, it returns <tt>@ref FP_INVALID_PRINCIPAL_ID</tt>.
121 */
122 PrincipalId GetMyPrincipalId(void);
123 
124 /*!
125 @brief  Gets the local account ID.
126 
127 If offline, it returns an empty account ID in the buffer. @n
128 The function still returns success in this case.
129 
130 @param[out] accountId  Buffer for storing the account ID of the local user.
131 
132 @return  Returns the result.
133 */
134 nn::Result GetMyAccountId(char accountId[FP_ACCOUNT_ID_SIZE]);
135 
136 /*!
137 @brief  Gets the local Mii character display name.
138 
139 If offline, it returns an empty display name in the buffer. @n
140 The function still returns success in this case.
141 
142 Mii character display names sometimes include characters that the application does not support. @n
143 When that happens, you must handle it without adversely affecting the screen display or hindering the application's progress.
144 
145 For more details, see the Nicknames and Creator Names section in the Wii U Guidelines.
146 
147 @param[out] screenName  A buffer storing the Mii character display name of the local user.
148 
149 @return  Returns the result.
150 */
151 nn::Result GetMyScreenName(char16 screenName[FP_MII_SCREEN_NAME_SIZE]);
152 
153 /*!
154 @brief  Gets local Mii data.
155 
156 If offline, it returns empty Mii data in the buffer. @n
157 The function still returns success in this case.
158 
159 To use the obtained Mii character data, the separate Mii Face Library is required.
160 
161 @param[out] pMiiData  A buffer used to store the local Mii.
162 
163 @return  Returns the result.
164 */
165 nn::Result GetMyMii(FFLStoreData* pMiiData);
166 
167 /*!
168 @brief  Gets the local profile.
169 
170 If offline, it returns an empty profile in the buffer. @n
171 The function still returns success in this case.
172 
173 @param[out] pProfile  A buffer used to store the local profile.
174 
175 @return  Returns the result.
176 */
177 nn::Result GetMyProfile(Profile* pProfile);
178 
179 /*!
180 @brief  Gets the local preferences.
181 
182 If offline, it returns empty preferences in the buffer. @n
183 The function still returns success in this case.
184 
185 @param[out] pPreference  A buffer used to store the local preferences.
186 
187 @return  Returns the result.
188 */
189 nn::Result GetMyPreference(Preference* pPreference);
190 
191 /*!
192 @brief  Gets the local presence information.
193 
194 @param[out] pMyPresence  Specifies a buffer that stores the local presence.
195 
196 @return  Returns the result.
197 */
198 nn::Result GetMyPresence(MyPresence* pMyPresence);
199 
200 /*!
201 @brief  Confirms whether the initial settings sequence has completed.
202 
203 If the initial settings sequence has not completed, the friend list update function fails. @n
204 Also, this flag may be changed when a <tt>@ref NOTIFICATION_PREFERENCE</tt> notification arrives.
205 
206 @return  Returns <tt>true</tt> if the initial setting sequence has completed; returns <tt>false</tt> if it has not. @n
207 If offline, it returns <tt>false</tt>.
208 */
209 bool IsPreferenceValid(void);
210 
211 /*!
212 @brief  Checks whether the sending of friend requests is allowed.
213 
214 When this flag is <tt>false</tt>, the function for sending friend requests fails. @n
215 Also, this flag may be changed when a <tt>@ref NOTIFICATION_PREFERENCE</tt> notification arrives.
216 
217 @return  Returns <tt>true</tt> if the sending of friend requests is allowed, and <tt>false</tt> otherwise. @n
218 If offline, it returns <tt>false</tt>.
219 */
220 bool IsFriendRequestAllowed(void);
221 
222 //! @}
223 //! @name  Getting Friend List Information
224 //! @{
225 
226 /*!
227 @brief  Gets the friend list.
228 
229 If offline, the friend list is empty. @n
230 The function still returns success in this case.
231 
232 This function gets only the users that have established friend relationships.
233 
234 Get the number of friends by setting <var>pList</var> to <tt>NULL</tt> or <var>size</var> to <tt>0</tt>.
235 
236 @param[out] pList  Specifies a buffer for storing the friend list.
237 @param[out] pNum  Specifies a buffer for storing the number of items actually retrieved.
238 @param[in] offset  Specifies the index of the first item to retrieve.
239 @param[in] size  Specifies the number of elements in the friend list.
240 
241 @return  Returns the result.
242 */
243 nn::Result GetFriendList(PrincipalId* pList, size_t* pNum, size_t offset, size_t size);
244 
245 /*!
246 @brief  Gets the friend list.
247 
248 If offline, the friend list is empty. @n
249 The function still returns success in this case.
250 
251 This function includes users who have not yet established friend relationships, such as those who are tentatively registered or who have requests pending. @n
252 Only account IDs and Mii character information can be obtained for these users.
253 
254 It can be used to determine whether a user has already been added to a list before adding friends or sending friend requests.
255 
256 To get just the users with whom friend relationships have been established, use the <tt>@ref GetFriendList</tt> function.
257 
258 You can get the number of users on the friend list by setting <var>pList</var> to <tt>NULL</tt> or <var>size</var> to <tt>0</tt>.
259 
260 @param[out] pList  Specifies a buffer for storing the friend list.
261 @param[out] pNum  Specifies a buffer for storing the number of items actually retrieved.
262 @param[in] offset  Specifies the index of the first item to retrieve.
263 @param[in] size  Specifies the number of elements in the friend list.
264 
265 @return  Returns the result.
266 */
267 nn::Result GetFriendListAll(PrincipalId* pList, size_t* pNum, size_t offset, size_t size);
268 
269 /*!
270 @brief  Gets a list of friend account IDs.
271 
272 Returns an empty account ID in the buffer if there is no friend corresponding to the principal ID passed in as a parameter. @n
273 The function still returns success in this case.
274 
275 @param[out] pAidList  Specifies a buffer for storing the account ID.
276 @param[in] pPidList  Specifies a list of principal IDs.
277 @param[in] size  Specifies the number of elements in the principal ID list.
278 
279 @return  Returns the result.
280 */
281 nn::Result GetFriendAccountId(char (*pAidList)[FP_ACCOUNT_ID_SIZE], const PrincipalId* pPidList, size_t size);
282 
283 /*!
284 @brief  Gets a list of friends' Mii character display names.
285 
286 By calling this function, you can get the name of a friend's Mii character directly without using the Mii Face Library.
287 
288 If the name of the friend's Mii character contains profanity, the name is replaced with question marks ("???").
289 
290 Returns an empty display name in the buffer if there is no friend corresponding to the principal ID passed in as a parameter. @n
291 The function still returns success in this case.
292 
293 Mii character display names sometimes include characters that the application does not support. @n
294 When that happens, you must handle it without adversely affecting the screen display or hindering the application's progress.
295 
296 For more details, see the Nicknames and Creator Names section in the Wii U Guidelines.
297 
298 @param[out] pNameList  Specifies a buffer that stores the display names of the friends' Mii characters.
299 @param[in] pPidList  Specifies a list of principal IDs.
300 @param[in] size  Specifies the number of elements in the principal ID list.
301 @param[in] replaceForeignCharacters  Specifies whether to replace non-ASCII characters with question marks ("?") if the local font region differs from the region of the friend.
302 @param[out] pFontList  Specifies a buffer that stores the friends' font regions. @n
303 Specify <tt>NULL</tt> if not needed.
304 
305 @return  Returns the result.
306 */
307 nn::Result GetFriendScreenName(char16 (*pNameList)[FP_MII_SCREEN_NAME_SIZE], const PrincipalId* pPidList, size_t size, bool replaceForeignCharacters = true, u8* pFontList = NULL);
308 
309 /*!
310 @brief  Gets a list of friends' Mii data.
311 
312 Returns empty Mii character data if there is no friend corresponding to the principal ID passed in as a parameter. @n
313 The function still returns success in this case.
314 
315 To use the obtained Mii character data, the separate Mii Face Library is required.
316 
317 @param[out] pMiiDataList  Specifies a buffer for storing Mii data.
318 @param[in] pPidList  Specifies a list of principal IDs.
319 @param[in] size  Specifies the number of elements in the principal ID list.
320 
321 @return  Returns the result.
322 */
323 nn::Result GetFriendMii(FFLStoreData* pMiiDataList, const PrincipalId* pPidList, size_t size);
324 
325 /*!
326 @brief  Gets a list of profiles of friends.
327 
328 Returns empty profile information if there is no friend corresponding to the principal ID passed in as a parameter. @n
329 The function still returns success in this case.
330 
331 @param[out] pProfileList  Specifies a buffer for storing profile information.
332 @param[in] pPidList  Specifies a list of principal IDs.
333 @param[in] size  Specifies the number of elements in the principal ID list.
334 
335 @return  Returns the result.
336 */
337 nn::Result GetFriendProfile(Profile* pProfileList, const PrincipalId* pPidList, size_t size);
338 
339 /*!
340 @brief  Gets a list of friend approval times.
341 
342 Puts an empty time in the buffer if there is no friend corresponding to the principal ID passed in as a parameter. @n
343 The function still returns success in this case.
344 
345 @param[out] pTimeList  Specifies a buffer for storing times.
346 @param[in] pPidList  Specifies a list of principal IDs.
347 @param[in] size  Specifies the number of elements in the principal ID list.
348 
349 @return  Returns the result.
350 */
351 nn::Result GetFriendApprovalTime(DateTime* pTimeList, const PrincipalId* pPidList, size_t size);
352 
353 /*!
354 @brief  Gets a list of friend sort times.
355 
356 Gets the time a friend relationship was established for friends in an established relationship, the expiration date for those in a pending request state, and the registration time for those in a temporary registration state.
357 
358 Puts an empty time in the buffer if there is no friend corresponding to the principal ID passed in as a parameter. @n
359 The function still returns success in this case.
360 
361 @param[out] pTimeList  Specifies a buffer for storing times.
362 @param[in] pPidList  Specifies a list of principal IDs.
363 @param[in] size  Specifies the number of elements in the principal ID list.
364 
365 @return  Returns the result.
366 */
367 nn::Result GetFriendSortTime(DateTime* pTimeList, const PrincipalId* pPidList, size_t size);
368 
369 /*!
370 @brief  Gets a list of friends' presence information.
371 
372 The function cannot get the game mode of a friend who has specified a different join-in game ID.
373 
374 Returns an empty presence information object if there is no friend corresponding to the principal ID passed in as a parameter. @n
375 The function still returns success in this case.
376 
377 @param[out] pPresenceList  Specifies a buffer that stores the friends' presence information.
378 @param[in] pPidList  Specifies a list of principal IDs.
379 @param[in] size  Specifies the number of elements in the principal ID list.
380 
381 @return  Returns the result.
382 */
383 nn::Result GetFriendPresence(FriendPresence* pPresenceList, const PrincipalId* pPidList, size_t size);
384 
385 /*!
386 @brief  Gets a list of friend relationships.
387 
388 Returns <tt>@ref RELATIONSHIP_INVALID</tt> in the buffer if there is no friend corresponding to the principal ID passed in as a parameter. @n
389 The function still returns success in this case.
390 
391 @param[out] pRelationList  A buffer for storing relationship information.
392 @param[in] pPidList  Specifies a list of principal IDs.
393 @param[in] size  Specifies the number of elements in the principal ID list.
394 
395 @return  Returns the result.
396 */
397 nn::Result GetFriendRelationship(u8* pRelationList, const PrincipalId* pPidList, size_t size);
398 
399 //! @}
400 //! @name  Getting Blacklist Information
401 //! @{
402 
403 /*!
404 @brief  Gets the blacklist.
405 
406 If offline, the blacklist is empty. @n
407 The function still returns success in this case.
408 
409 You can get the number of users on the blacklist by setting <var>pList</var> to <tt>NULL</tt> or <var>size</var> to <tt>0</tt>.
410 
411 @param[out] pList  Specifies a buffer for storing the blacklist.
412 @param[out] pNum  Specifies a buffer for storing the number of items actually retrieved.
413 @param[in] offset  Specifies the index of the first item to retrieve.
414 @param[in] size  The number of elements in the blacklist.
415 
416 @return  Returns the result.
417 */
418 nn::Result GetBlackList(PrincipalId* pList, size_t* pNum, size_t offset, size_t size);
419 
420 /*!
421 @brief  Gets a list of the account IDs for users who have been added to the blacklist.
422 
423 Returns an empty account ID in the buffer if there is no user corresponding to the principal ID passed in as a parameter. @n
424 The function still returns success in this case.
425 
426 @param[out] pAidList  Specifies a buffer for storing the account ID.
427 @param[in] pPidList  Specifies a list of principal IDs.
428 @param[in] size  Specifies the number of elements in the principal ID list.
429 
430 @return  Returns the result.
431 */
432 nn::Result GetBlackListAccountId(char (*pAidList)[FP_ACCOUNT_ID_SIZE], const PrincipalId* pPidList, size_t size);
433 
434 /*!
435 @brief  Gets a list of the times when added to the blacklist.
436 
437 Returns an empty time in the buffer if there is no user corresponding to the principal ID passed in as a parameter. @n
438 The function still returns success in this case.
439 
440 @param[out] pTimeList  Specifies a buffer for storing times.
441 @param[in] pPidList  Specifies a list of principal IDs.
442 @param[in] size  Specifies the number of elements in the principal ID list.
443 
444 @return  Returns the result.
445 */
446 nn::Result GetBlackListAdditionalTime(DateTime* pTimeList, const PrincipalId* pPidList, size_t size);
447 
448 //! @}
449 //! @name  Getting Request List Information
450 //! @{
451 
452 /*!
453 @brief  Gets the request list.
454 
455 If offline, the request list is empty. @n
456 The function still returns success in this case.
457 
458 You can get the number of users on the request list by setting <tt>pList</tt> to <tt>NULL</tt> or <tt>size</tt> to <tt>0</tt>.
459 
460 @param[out] pList  Specifies a buffer for storing the request list.
461 @param[out] pNum  Specifies a buffer for storing the number of items actually retrieved.
462 @param[in] offset  Specifies the index of the first item to retrieve.
463 @param[in] size  Specifies the number of elements in the request list.
464 
465 @return  Returns the result.
466 */
467 nn::Result GetFriendRequestList(PrincipalId* pList, size_t* pNum, size_t offset, size_t size);
468 
469 /*!
470 @brief  Gets a list of the account IDs for users who have been added to the request list.
471 
472 Returns an empty account ID in the buffer if there is no user corresponding to the principal ID passed in as a parameter. @n
473 The function still returns success in this case.
474 
475 @param[out] pAidList  Specifies a buffer for storing the account ID.
476 @param[in] pPidList  Specifies a list of principal IDs.
477 @param[in] size  Specifies the number of elements in the principal ID list.
478 
479 @return  Returns the result.
480 */
481 nn::Result GetFriendRequestAccountId(char (*pAidList)[FP_ACCOUNT_ID_SIZE], const PrincipalId* pPidList, size_t size);
482 
483 /*!
484 @brief  Gets a list of the message IDs for messages that have been sent by users added to the request list.
485 
486 Returns an empty message ID in the buffer if there is no user corresponding to the principal ID passed in as a parameter. @n
487 The function still returns success in this case.
488 
489 @param[out] pMidList  Specifies a buffer for storing the message ID.
490 @param[in] pPidList  Specifies a list of principal IDs.
491 @param[in] size  Specifies the number of elements in the principal ID list.
492 
493 @return  Returns the result.
494 */
495 nn::Result GetFriendRequestMessageId(MessageId* pMidList, const PrincipalId* pPidList, size_t size);
496 
497 //! @}
498 //! @name  Updating Information About the Local User
499 //! @{
500 
501 /*!
502 @brief  Updates the game mode.
503 
504 Game mode information configured in this function is sent to friends when you are online, and is reflected in their friend lists.
505 
506 The friend list determines which games can be joined according to fixed logic based on this game mode parameter. @n
507 Note that a friend list may erroneously display that join-in is possible if an inappropriate parameter is specified.
508 
509 Set the game mode to the user's online group participation status or application-defined data. @n
510 Parameters set here are shared among applications for which the same join-in game ID is specified. @n
511 This function does not update join-in game IDs.
512 
513 @param[in] pGameMode  Specifies the game mode.
514 @param[in] description  Specifies a string description of the game mode. @n
515 Use UTF-16BE for the encoding.
516 
517 @return  Returns the result.
518 */
519 nn::Result UpdateGameMode(const GameMode* pGameMode, const char16 description[FP_MODE_DESCRIPTION_SIZE], u32 dummy = 0);
520 
521 /*!
522 @brief  Updates the game mode description string.
523 
524 The string set by this function is sent to friends and is displayed in their friend lists when you are online. @n
525 Use "\\n" for newlines.
526 
527 @param[in] description  Specifies a string description of the game mode. @n
528 Use UTF-16BE for the encoding.
529 
530 @return  Returns the result.
531 */
532 nn::Result UpdateGameModeDescription(const char16 description[FP_MODE_DESCRIPTION_SIZE]);
533 
534 //! @}
535 //! @name  Updating the Friend List
536 //! @{
537 
538 /*!
539 @brief  Adds a friend to the friend list.
540 
541 This function adds a friend to the friend list by specifying the principal ID.
542 
543 When this function succeeds, the new friend is in a tentatively registered state. @n
544 If the other person has already tentatively registered the local user or has sent a friend request to the local user, this function establishes a friend relationship.
545 
546 This function cannot be used when offline.
547 
548 @param[in] principalId  Specifies the principal ID.
549 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
550 @param[in] pContext  Specifies the callback parameters.
551 
552 @return  Returns the result.
553 */
554 nn::Result AddFriendAsync(PrincipalId principalId, AsyncCallback pCallback, void* pContext);
555 
556 /*!
557 @brief  Adds a friend to the friend list.
558 
559 This function adds a friend to the friend list by specifying the account ID.
560 
561 When this function succeeds, the new friend is in a tentatively registered state. @n
562 If the other person has already tentatively registered the local user or has sent a friend request to the local user, this function establishes a friend relationship.
563 
564 This function cannot be used when offline.
565 
566 @param[in] accountId  Specifies the account ID.
567 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
568 @param[in] pContext  Specifies the callback parameters.
569 
570 @return  Returns the result.
571 */
572 nn::Result AddFriendAsync(const char accountId[FP_ACCOUNT_ID_SIZE], AsyncCallback pCallback, void* pContext);
573 
574 /*!
575 @brief  Sends a friend request.
576 
577 When this function succeeds, the new friend is in a request state. @n
578 If the other person has already tentatively registered the local user or has sent a friend request to the local user, this function establishes a friend relationship.
579 
580 If the user is already a friend, the function returns <tt>@ref ResultFpdFriendAlreadyAdded</tt>. If the user has been tentatively added, the function changes the status to "request pending," and if the status is "request pending," the function updates the request.
581 
582 This function cannot be used when offline.
583 
584 @param[in] principalId  Specifies the principal ID of the other user.
585 @param[in] inGameNameLanguage  Specifies the language code for displaying the character's name in the game. @n
586 If <tt>@ref LANGUAGE_INVALID</tt> is specified, the system's language code is used.
587 @param[in] inGameName  Specifies the display name of the user's in-game character. @n
588 Use UTF-16BE for the encoding.
589 @param[in] messageLanguage  Specifies the language code of the request message. @n
590 If <tt>@ref LANGUAGE_INVALID</tt> is specified, the system's language code is used.
591 @param[in] message  Specifies the request message. @n
592 Use UTF-16BE for the encoding.
593 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
594 @param[in] pContext  Specifies the callback parameters.
595 
596 @return  Returns the result.
597 
598 */
599 nn::Result AddFriendRequestAsync(PrincipalId principalId, u8 inGameNameLanguage, const char16 inGameName[FP_IN_GAME_SCREEN_NAME_SIZE],
600     u8 messageLanguage, const char16 message[FP_REQUEST_MESSAGE_SIZE], AsyncCallback pCallback, void* pContext);
601 
602 //! @}
603 //! @name  Updating the Blacklist
604 //! @{
605 
606 /*!
607 @brief  Adds users to the blacklist.
608 
609 If the blacklist is already full, the earliest user is discarded to make way for the new registration. @n
610 When adding a user who is already in the blacklist, this function updates the time stamp for when that user was added. <br />
611 
612 This function cannot be used when offline.
613 
614 @param[in] principalId  Specifies the principal ID of the user to add to the blacklist.
615 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
616 @param[in] pContext  Specifies the callback parameters.
617 
618 @return  Returns the result.
619 */
620 nn::Result AddBlackListAsync(PrincipalId principalId, AsyncCallback pCallback, void* pContext);
621 
622 //! @}
623 //! @name  Updating the Request List
624 //! @{
625 
626 /*!
627 @brief  Accepts a friend request that has been received.
628 
629 If this function succeeds, the user is added to the friend list and the request is deleted from the request list.
630 
631 This function cannot be used when offline.
632 
633 @param[in] messageId  Specifies the message ID.
634 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
635 @param[in] pContext  Specifies the callback parameters.
636 
637 @return  Returns the result.
638 */
639 nn::Result AcceptFriendRequestAsync(MessageId messageId, AsyncCallback pCallback, void* pContext);
640 
641 /*!
642 @brief  Deletes a friend request that has been received.
643 
644 If this function succeeds, the user is removed from the request list.
645 
646 This function cannot be used when offline.
647 
648 @param[in] messageId  Specifies the message ID.
649 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
650 @param[in] pContext  Specifies the callback parameters.
651 
652 @return  Returns the result.
653 */
654 nn::Result DeleteFriendRequestAsync(MessageId messageId, AsyncCallback pCallback, void* pContext);
655 
656 /*!
657 @brief  Rejects a friend request that has been received.
658 
659 If this function succeeds, the user is removed from the request list and added to the blacklist. @n
660 If this user is already on the blacklist, the time he or she was added is updated.
661 
662 This function cannot be used when offline.
663 
664 @param[in] messageId  Specifies the message ID.
665 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
666 @param[in] pContext  Specifies the callback parameters.
667 
668 @return  Returns the result.
669 */
670 nn::Result DenyFriendRequestAsync(MessageId messageId, AsyncCallback pCallback, void* pContext);
671 
672 //! @}
673 //! @name  Updating the Player History
674 //! @{
675 
676 /*!
677 @brief  Adds to the Player History.
678 
679 This function cannot be used if there have been no connections to the account server after the application starts. @n
680 In such cases, the function returns <tt>@ref ResultNetworkClockInvalid</tt>.
681 
682 The number of records that can be added at the same time is <tt>@ref FP_RECENT_PLAY_RECORD_LIST_SIZE</tt>.
683 
684 If <tt>RecentPlayRecord::myLanguage</tt> is set to <tt>@ref LANGUAGE_INVALID</tt>, the system's language code is used.
685 
686 @note
687 The data added with this function is saved to a file during the finalization process for an application or the system.
688 Press the POWER Button on the console to make the system perform the finalization process.
689 
690 Note that the data is not saved when there is a forced exit, such as with <tt>cafestop</tt> or a power failure.
691 
692 @param[in] pList  Specifies the Player History list. @n
693 Use UTF-16BE for the encoding of in-game display names.
694 @param[in] size  Specifies the number of elements in the Player History list.
695 
696 @return  Returns the result.
697 */
698 nn::Result AddRecentPlayRecord(const RecentPlayRecord* pList, size_t size);
699 
700 //! @}
701 //! @name  Viewing Data
702 //! @{
703 
704 /*!
705 @brief  Gets the friend request receipt blocking setting for the user linked to the specified principal ID.
706 
707 You can use this function to check whether a recipient's friend request blocking setting is set to on before sending a friend request.
708 
709 The number of block friend request settings that can be retrieved at the same time is <tt>@ref FP_REFERENCE_DATA_SIZE</tt>.
710 
711 This function cannot be used when offline.
712 
713 @param[out] pSettingList  Specifies a buffer for storing the user's block-request settings.
714 @param[in] pPidList  Specifies a list of principal IDs.
715 @param[in] size  Specifies the number of elements in the principal ID list.
716 @param[in] pCallback  Specifies a callback for completion of asynchronous operation.
717 @param[in] pContext  Specifies the callback parameters.
718 
719 @return  Returns the result.
720 */
721 nn::Result GetRequestBlockSettingAsync(u8* pSettingList, const PrincipalId* pPidList, size_t size, AsyncCallback pCallback, void* pContext);
722 
723 //! @}
724 //! @name  Join-In
725 //! @{
726 
727 /*!
728 @brief  Determines whether the specified friend can join in.
729 
730 @param[in] pPresence  Specifies the presence information of a friend who wishes to join in.
731 @param[in] joinGameModeMask  Specifies the join-in game-mode mask.
732 
733 @return  .. Returns <tt>true</tt> if the friend can join in, and <tt>false</tt> otherwise. @n
734 Returns <tt>false</tt> if the library has not been initialized.
735 */
736 bool IsJoinable(const FriendPresence* pPresence, u64 joinGameModeMask);
737 
738 //! @}
739 //! @name  Others
740 //! @{
741 
742 /*!
743 @brief  Sets an event handler for notifications of changes to own or a friend's status.
744 
745 @param[in] notificationMask  Specifies a bitmask for the notifications you want to receive. @n
746 Specify the notifications that you want to receive by performing a bitwise OR on <tt>@ref NotificationMask</tt> enumerators.
747 @param[in] pHandler  Specifies the notification callback.
748 @param[in] pContext  Specifies the callback parameters.
749 
750 @return  Returns the result.
751 */
752 nn::Result SetNotificationHandler(u32 notificationMask, NotificationHandler pHandler, void* pContext);
753 
754 /*!
755 @brief  Converts a processing result into an error code.
756 
757 @param[in] result  Specifies the <tt>result</tt>.
758 
759 @return  Returns the error code. @n
760 Returns <tt>0</tt> if the results do not require an error code to be displayed, or if the results other than the Friend Presence Library are specified.
761 */
762 u32 ResultToErrorCode(nn::Result result);
763 
764 //! @}
765 
766 //! @}
767 
768 }}
769 
770 #endif // __FP_API_H__
771