1 /*---------------------------------------------------------------------------* 2 Project: Wii Connect 24 3 File: NWC24Msg.h 4 5 Copyright (C) 2006 Nintendo All Rights Reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: NWC24Msg.h,v $ 14 Revision 1.58 2007/11/16 08:17:08 hirose_kazuki 15 Fixed argument names. 16 17 Revision 1.57 2007/11/16 08:06:27 hirose_kazuki 18 Added NWC24CheckMsgBoxSpace(). 19 20 Revision 1.56 2007/11/05 11:11:28 hirose_kazuki 21 Added definition of NWC24MSG_MAX_DESIG_TIME. 22 23 Revision 1.55 2007/09/03 02:51:30 seiki_masashi 24 Added NWC24SetSearchCondPublic(). 25 26 Revision 1.54 2007/07/12 12:02:01 hirose_kazuki 27 Changed NWC24SetSearchCondTag() to use NWC24SearchCompareMode 28 as second argument type. 29 30 Revision 1.53 2007/07/12 11:02:26 hirose_kazuki 31 Removed some functions. 32 33 Revision 1.52 2007/06/26 12:12:14 seiki_masashi 34 Added NWC24Get/SetMsgSequenceNumber. 35 36 Revision 1.51 2007/06/25 04:11:32 adachi_hiroaki 37 Changed order of arguments in NWC24GetMsgExecScript()/NWC24SetMsgExecScript(). 38 39 Revision 1.50 2007/06/21 09:58:42 adachi_hiroaki 40 Changed NWC24SetMsgExecScript()/NWC24GetMsgExecScript() to support TTL management. 41 42 Revision 1.49 2007/06/20 23:54:35 seiki_masashi 43 Changed the vf file names related to automatic replies 44 45 Revision 1.48 2007/06/16 09:50:26 hirose_kazuki 46 Added NWC24SetSearchCondTag(). 47 48 Revision 1.47 2007/05/30 07:34:30 adachi_hiroaki 49 Added NWC24_SCRIPT_STORAGE_PATH. 50 51 Revision 1.46 2007/05/29 08:04:33 hirose_kazuki 52 Minor fix. 53 54 Revision 1.45 2007/05/22 11:49:21 hatamoto_minoru 55 Added NWC24GetMsgExecScript 56 57 Revision 1.44 2007/05/18 10:53:02 hatamoto_minoru 58 Added NWC24GetScriptVfPath and NWC24_SCRIPT_BINARY_PATH. 59 60 Revision 1.43 2007/05/18 08:20:03 hatamoto_minoru 61 Added NWC24SetMsgExecScript. 62 63 Revision 1.42 2007/04/26 08:03:24 adachi_hiroaki 64 Added NWC24SetMsgDesignatedTime(). 65 66 Revision 1.41 2007/04/02 11:51:10 hirose_kazuki 67 Added NWC24MsgIconNewSign(). 68 69 Revision 1.40 2007/02/05 02:11:29 yoshioka_yasuhiro 70 Added NWC24SetMsgSubjectAndTextPublic. 71 72 Revision 1.39 2007/01/30 00:42:22 hirose_kazuki 73 Added NWC24GetMsgSize(). 74 75 Revision 1.38 2007/01/25 06:43:28 hirose_kazuki 76 Added NWC24_BASE64_ENCODED_SIZE macro. 77 78 Revision 1.37 2007/01/15 08:15:10 hirose_kazuki 79 Added NWC24GetMsgTextPtr() and NWC24GetMsgAttachedPtr(). 80 81 Revision 1.36 2006/12/05 02:13:12 hirose_kazuki 82 Added NWC24EnableLedNotification(). 83 84 Revision 1.35 2006/11/04 12:21:05 hirose_kazuki 85 Added NWC24SetMsgLedPattern(). 86 87 Revision 1.34 2006/10/30 10:05:25 seiki_masashi 88 Fixed header file error. 89 90 Revision 1.33 2006/10/30 09:17:03 seiki_masashi 91 Small fix 92 93 Revision 1.32 2006/10/29 17:31:54 seiki_masashi 94 Added NWC24MSG_AUTO_ENC_CONVERT. 95 96 Revision 1.31 2006/10/23 12:22:01 hirose_kazuki 97 Set NWC24_WORK_MEM_SIZE back to 16KB. 98 99 Revision 1.30 2006/10/19 06:28:43 hirose_kazuki 100 Added NWC24ReadMsgTextEx(). 101 102 Revision 1.29 2006/10/19 04:36:30 hirose_kazuki 103 Changed argument type of NWC24Check(). Added NWC24GetErrorCode(). 104 105 Revision 1.28 2006/10/16 08:22:28 hirose_kazuki 106 Added NWC24Check(). 107 108 Revision 1.27 2006/09/23 09:34:25 hirose_kazuki 109 Removed NWC24InitFiles(). 110 111 Revision 1.26 2006/09/22 09:03:21 hirose_kazuki 112 Added definition of NWC24MSG_MAX_ALTNAME_LEN. 113 114 Revision 1.25 2006/09/20 12:57:11 hirose_kazuki 115 Deleted NWC24InitMsgBox(), added NWC24InitFiles(). 116 117 Revision 1.24 2006/09/20 07:10:22 adachi_hiroaki 118 Changed NWC24_WORK_MEM_SIZE for download APIs. 119 120 Revision 1.23 2006/09/19 01:20:01 hirose_kazuki 121 Moved message board related APIs to "NWC24MsgBoard.h". 122 123 Revision 1.22 2006/09/18 11:45:14 hirose_kazuki 124 Added NWC24[Set|Read]MsgMBRegDate(). 125 126 Revision 1.21 2006/09/13 13:22:18 hirose_kazuki 127 Added NWC24[Set|Read]MsgMBNoReply(). 128 129 Revision 1.20 2006/09/12 11:53:26 hirose_kazuki 130 Added NWC24IsNewMsgForMenuArrived(). 131 132 Revision 1.19 2006/09/10 08:37:28 hirose_kazuki 133 Added NWC24GetMsgGroupId(). 134 135 Revision 1.18 2006/09/10 02:33:37 hirose_kazuki 136 Changed NWC24OpenMsgLib to NWC24OpenLib. NWC24CloseLib as well. 137 Old functions still exist for compatibility. 138 139 Revision 1.17 2006/09/04 06:40:36 adachi_hiroaki 140 Added NWC24CheckUserId(). 141 142 Revision 1.16 2006/09/02 12:09:02 hirose_kazuki 143 Added NWC24Msg[Get|Read]AltName(). Changed maximum size values. 144 145 Revision 1.15 2006/08/30 04:48:09 hirose_kazuki 146 Added SetMsgTag/GetMsgTag APIs and GetMsgId API. 147 148 Revision 1.14 2006/08/19 08:45:43 hirose_kazuki 149 Added initial version of search APIs. 150 151 Revision 1.13 2006/08/16 06:08:07 hirose_kazuki 152 Added NWC24CheckSendBoxVacancy(). 153 154 Revision 1.12 2006/08/09 02:22:48 hirose_kazuki 155 Added const qualifier to input string pointers. 156 157 Revision 1.11 2006/08/08 04:51:46 hirose_kazuki 158 Added NWC24GetMsgDate(). 159 160 Revision 1.10 2006/08/07 06:42:57 hirose_kazuki 161 Moved type definitions to NWC24Types.h. 162 163 Revision 1.9 2006/07/31 02:51:53 hirose_kazuki 164 Fixed misleading argument names. 165 166 Revision 1.8 2006/07/26 04:25:47 adachi_hiroaki 167 Fixed types.h. 168 169 Revision 1.7 2006/07/18 04:13:04 hirose_kazuki 170 Fixed a compile error on #endif. 171 172 Revision 1.6 2006/07/18 02:17:23 hirose_kazuki 173 Deleted NWC24SetMsgCharset(). 174 175 Revision 1.5 2006/07/15 00:37:53 hirose_kazuki 176 Added new values for NWC24MsgType. 177 178 Revision 1.4 2006/07/13 12:40:38 hirose_kazuki 179 Changed enum value definitions. Major API spec changes for alpha3. 180 181 Revision 1.3 2006/07/12 00:56:50 hirose_kazuki 182 Moved NWC24InitMsgBox() from the admin header. 183 Changed max number of 'To:' to 8. 184 Changed size of NWC24MsgObj (now 256Bytes). 185 186 Revision 1.2 2006/07/11 04:32:16 hirose_kazuki 187 Yet another repository reforming. 188 189 Revision 1.2 2006/07/06 11:02:07 hirose_kazuki 190 Added NWC24ReadMsgToAddr(), 191 renamed NWC24ReadMsgFrom() to NWC24ReadMsgFromAddr(). 192 193 Revision 1.1 2006/07/03 03:23:31 yosizaki 194 Moved from ../ppc 195 196 Revision 1.1 2006/06/29 12:43:43 hirose_kazuki 197 Moved from another repository. 198 199 Revision 1.2 2006/06/12 07:29:40 hirose 200 Added NWC24GetMsgNumTo() and NWC24GetMsgToId(). 201 202 Revision 1.1 2006/06/10 10:34:21 hirose 203 Initial check-in. 204 205 *---------------------------------------------------------------------------*/ 206 207 /*---------------------------------------------------------------------------* 208 NWC24 Message API 209 *---------------------------------------------------------------------------*/ 210 #ifndef __NWC24MSG_H__ 211 #define __NWC24MSG_H__ 212 213 #include <revolution/nwc24/NWC24Types.h> 214 215 #ifdef RVL_OS 216 #include <revolution/enc.h> 217 #endif // RVL_OS 218 219 /*---------------------------------------------------------------------------* 220 Macros 221 *---------------------------------------------------------------------------*/ 222 223 #define NWC24MSG_MAX_TO 8 224 #define NWC24MSG_MAX_ATTACH 2 225 #define NWC24MSG_MAX_ADDRSTR 256 226 227 #define NWC24MSG_MAX_ALTNAME_LEN (34+1) 228 229 #define NWC24MSG_MAX_DATASIZE 148912 230 #define NWC24MSG_MAX_BODYSIZE 203776 231 232 #define NWC24_WORK_MEM_SIZE 16384 233 234 #define NWC24_USE_MESSAGES 0x00000001 235 #define NWC24_USE_DOWNLOADS 0x00000002 236 #define NWC24_USE_SETTINGS 0x00000004 237 238 #define NWC24MSG_MAX_DESIG_TIME (60*24*10) 239 240 #ifdef ENC_CHECK_NOT_FOUND // new ENC library 241 #define NWC24MSG_AUTO_ENC_CONVERT 1 242 #endif 243 244 #define NWC24_BASE64_ENCODED_SIZE(rawSize) \ 245 (((rawSize*4+2)/3)+((rawSize/57)*2)+4) 246 247 /*---------------------------------------------------------------------------* 248 API Prototypes 249 *---------------------------------------------------------------------------*/ 250 struct OSCalendarTime; 251 252 #ifdef __cplusplus 253 extern "C" { 254 #endif 255 256 /*---------------------------------------------------------------------------* 257 Management APIs 258 *---------------------------------------------------------------------------*/ 259 int NWC24IsNewMsgArrived( void ); 260 int NWC24IsNewMsgForMenuArrived( void ); 261 262 /*---------------------------------------------------------------------------*/ 263 NWC24Err NWC24OpenLib( void* workMemory ); 264 NWC24Err NWC24CloseLib( void ); 265 266 NWC24Err NWC24Check( u32 usageType ); 267 s32 NWC24GetErrorCode( void ); 268 269 NWC24Err NWC24GetMyUserId( NWC24UserId *userId ); 270 NWC24Err NWC24CheckUserId( NWC24UserId userId ); 271 272 NWC24Err NWC24EnableLedNotification( BOOL enable ); 273 274 275 /*---------------------------------------------------------------------------*/ 276 /* For compatibility with Alpha version. Not recommended for use. */ 277 NWC24Err NWC24OpenMsgLib( void* workMemory ); 278 NWC24Err NWC24CloseMsgLib( void ); 279 280 /*---------------------------------------------------------------------------*/ 281 282 /*---------------------------------------------------------------------------* 283 Message creation APIs 284 *---------------------------------------------------------------------------*/ 285 NWC24Err NWC24InitMsgObj ( NWC24MsgObj* obj, NWC24MsgType type ); 286 287 /*---------------------------------------------------------------------------*/ 288 289 NWC24Err NWC24SetMsgToId ( NWC24MsgObj* obj, NWC24UserId userId ); 290 NWC24Err NWC24SetMsgToAddr ( NWC24MsgObj* obj, const char* addr, u32 length ); 291 292 NWC24Err NWC24SetMsgSubject ( NWC24MsgObj* obj, const char* subject, u32 size ); 293 #ifdef NWC24MSG_AUTO_ENC_CONVERT 294 NWC24Err NWC24SetMsgSubjectPublic( NWC24MsgObj* obj, const u16* subject, u32 length, 295 NWC24AutoEncodingType autoEnc, u16 altChar, 296 u8* work, u32 workSize ); 297 #endif 298 NWC24Err NWC24SetMsgText ( NWC24MsgObj* obj, const char* text, u32 size, 299 NWC24Charset charset, NWC24Encoding encoding ); 300 #ifdef NWC24MSG_AUTO_ENC_CONVERT 301 NWC24Err NWC24SetMsgTextPublic ( NWC24MsgObj* obj, const u16* text, u32 length, 302 NWC24AutoEncodingType autoEnc, u16 altChar, 303 u8* work, u32 workSize ); 304 NWC24Err NWC24SetMsgSubjectAndTextPublic( NWC24MsgObj* obj, 305 const u16* subject, u32 subjLen, 306 const u16* text, u32 textLen, 307 NWC24AutoEncodingType autoEnc, u16 altChar, 308 u8* work, u32 workSize ); 309 #endif 310 NWC24Err NWC24SetMsgAttached ( NWC24MsgObj* obj, const char* data, u32 size, NWC24MIMEType type ); 311 312 NWC24Err NWC24SetMsgAltName ( NWC24MsgObj* obj, const u16* name, u32 length ); 313 NWC24Err NWC24SetMsgTag ( NWC24MsgObj* obj, u16 tag ); 314 NWC24Err NWC24SetMsgLedPattern ( NWC24MsgObj* obj, u16 pattern ); 315 NWC24Err NWC24SetMsgIconNewSign ( NWC24MsgObj* obj, BOOL enable ); 316 NWC24Err NWC24SetMsgDesignatedTime ( NWC24MsgObj* obj, s32 elapsedTime ); 317 318 /*---------------------------------------------------------------------------* 319 Message read APIs 320 *---------------------------------------------------------------------------*/ 321 NWC24Err NWC24GetMsgType ( const NWC24MsgObj* obj, NWC24MsgType* type ); 322 NWC24Err NWC24GetMsgSize ( const NWC24MsgObj* obj, u32* size ); 323 NWC24Err NWC24GetMsgFromId ( const NWC24MsgObj* obj, NWC24UserId* userId ); 324 NWC24Err NWC24GetMsgNumTo ( const NWC24MsgObj* obj, u32* numTo ); 325 NWC24Err NWC24GetMsgSubjectSize ( const NWC24MsgObj* obj, u32* size ); 326 NWC24Err NWC24GetMsgTextSize ( const NWC24MsgObj* obj, u32* size ); 327 NWC24Err NWC24GetMsgNumAttached ( const NWC24MsgObj* obj, u32* numAttached ); 328 NWC24Err NWC24GetMsgAttachedSize( const NWC24MsgObj* obj, u32 index, u32* size ); 329 NWC24Err NWC24GetMsgAttachedType( const NWC24MsgObj* obj, u32 index, NWC24MIMEType* type ); 330 NWC24Err NWC24GetMsgDate ( const NWC24MsgObj* obj, struct OSCalendarTime* cTime ); 331 NWC24Err NWC24GetMsgTag ( const NWC24MsgObj* obj, u16* tag ); 332 333 NWC24Err NWC24GetMsgTextPtr ( const NWC24MsgObj* obj, const char** text ); 334 NWC24Err NWC24GetMsgAttachedPtr ( const NWC24MsgObj* obj, u32 index, const char** data ); 335 336 NWC24Err NWC24GetMsgId ( const NWC24MsgObj* obj, u32* msgId ); 337 NWC24Err NWC24GetMsgAppId ( const NWC24MsgObj* obj, u32* appId ); 338 NWC24Err NWC24GetMsgGroupId ( const NWC24MsgObj* obj, u16* groupId ); 339 340 /*---------------------------------------------------------------------------*/ 341 342 NWC24Err NWC24ReadMsgFromAddr ( const NWC24MsgObj* obj, char* buffer, u32 bufSize ); 343 NWC24Err NWC24ReadMsgToId ( const NWC24MsgObj* obj, u32 index, NWC24UserId* userId ); 344 NWC24Err NWC24ReadMsgToAddr ( const NWC24MsgObj* obj, u32 index, char* buffer, u32 bufSize ); 345 NWC24Err NWC24ReadMsgSubject ( const NWC24MsgObj* obj, char* buffer, u32 bufSize ); 346 #ifdef NWC24MSG_AUTO_ENC_CONVERT 347 NWC24Err NWC24ReadMsgSubjectPublic( const NWC24MsgObj* obj, u16* subject, u32* length, 348 NWC24AutoEncodingType autoEnc, u16 altChar, 349 u8* work, u32 workSize ); 350 #endif 351 NWC24Err NWC24ReadMsgText ( const NWC24MsgObj* obj, char* buffer, u32 bufSize, 352 NWC24Charset* charset, NWC24Encoding* encoding ); 353 NWC24Err NWC24ReadMsgTextEx ( const NWC24MsgObj* obj, char* buffer, u32 bufSize, 354 char* csNameBuf, u32 csNameSize ); 355 #ifdef NWC24MSG_AUTO_ENC_CONVERT 356 NWC24Err NWC24ReadMsgTextPublic ( const NWC24MsgObj* obj, u16* text, u32* length, 357 NWC24AutoEncodingType autoEnc, u16 altChar, 358 u8* work, u32 workSize ); 359 #endif 360 NWC24Err NWC24ReadMsgAttached ( const NWC24MsgObj* obj, u32 index, char* buffer, u32 bufSize ); 361 NWC24Err NWC24ReadMsgAltName ( const NWC24MsgObj* obj, u16* name, u32 length ); 362 363 /*---------------------------------------------------------------------------* 364 Message box access APIs 365 *---------------------------------------------------------------------------*/ 366 NWC24Err NWC24CommitMsg ( NWC24MsgObj* obj ); 367 368 NWC24Err NWC24GetNumMsgs ( NWC24MsgBoxId mboxId, u32* numMsgs ); 369 NWC24Err NWC24GetMsgIdList ( NWC24MsgBoxId mboxId, u32* idTable, u32 size ); 370 NWC24Err NWC24GetMsgObj ( NWC24MsgObj* obj, NWC24MsgBoxId mboxId, u32 msgId ); 371 NWC24Err NWC24DeleteMsg ( NWC24MsgBoxId mboxId, u32 msgId ); 372 373 NWC24Err NWC24CheckMsgBoxSpace ( NWC24MsgBoxId mboxId, u32 numMsgs, u32 size ); 374 375 /*---------------------------------------------------------------------------* 376 Message box search APIs 377 *---------------------------------------------------------------------------*/ 378 NWC24Err NWC24InitSearchConds ( void ); 379 380 NWC24Err NWC24SetSearchCondMsgBox ( NWC24MsgBoxId mBoxId ); 381 NWC24Err NWC24SetSearchCondForMenu ( void ); 382 NWC24Err NWC24SetSearchCondPublic ( BOOL includePublic ); 383 NWC24Err NWC24SetSearchCondFromAddrId ( NWC24UserId userId ); 384 NWC24Err NWC24SetSearchCondAppId ( u32 appId ); 385 NWC24Err NWC24SetSearchCondTag ( u16 tag, NWC24SearchCompareMode mode ); 386 387 NWC24Err NWC24SearchMsgs ( NWC24MsgObj* msgObjArray, u32 arraySize, 388 u32* numStored, u32* numRemain ); 389 390 391 /*---------------------------------------------------------------------------*/ 392 #ifdef __cplusplus 393 } 394 #endif 395 396 #endif // __NWC24MSG_H__ 397 398