From aa72085db73e62be8195bab2d97a4036c87d197e Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Tue, 22 Sep 2026 05:19:04 +0000 Subject: [PATCH 1/2] Match NWC24 message object --- configure.py | 2 +- libs/RevoEX/src/nwc24/NWC24MsgObj.c | 44 ++++++++++++++--------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/configure.py b/configure.py index d11ff4b0..69bef74e 100644 --- a/configure.py +++ b/configure.py @@ -1073,7 +1073,7 @@ config.libs = [ Object(Matching, "nwc24/NWC24Config.c"), Object(Matching, "nwc24/NWC24Utils.c"), Object(NonMatching, "nwc24/NWC24Manage.c"), - Object(NonMatching, "nwc24/NWC24MsgObj.c"), + Object(Matching, "nwc24/NWC24MsgObj.c"), Object(NonMatching, "nwc24/NWC24MBoxCtrl.c"), Object(NonMatching, "nwc24/NWC24Mime.c"), Object(Matching, "nwc24/NWC24Stream.c"), diff --git a/libs/RevoEX/src/nwc24/NWC24MsgObj.c b/libs/RevoEX/src/nwc24/NWC24MsgObj.c index 4d79b580..1c9c07bd 100644 --- a/libs/RevoEX/src/nwc24/NWC24MsgObj.c +++ b/libs/RevoEX/src/nwc24/NWC24MsgObj.c @@ -382,28 +382,6 @@ NWC24Err NWC24GetMsgType(const NWC24MsgObj* msg, NWC24MsgType* type) { return NWC24_OK; } -NWC24Err NWC24GetMsgAppId(const NWC24MsgObj* msg, u32* appId) { - const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; - *appId = msgObj->appId; - return NWC24_OK; -} - -NWC24Err NWC24GetMsgGroupId(const NWC24MsgObj* msg, u16* groupId) { - const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; - *groupId = msgObj->groupId; - return NWC24_OK; -} - -NWC24Err NWC24GetMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach) { - const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; - u8 numAttached = msgObj->numAttached; - *numAttach = numAttached; - if (numAttached > NWC24_MSG_ATTACHMENT_MAX) { - return NWC24_ERR_BROKEN; - } - return NWC24_OK; -} - NWC24Err NWC24GetMsgSubjectSize(const NWC24MsgObj* msg, u32* subjectSize) { const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; u32 size = msgObj->subject.size; @@ -431,6 +409,16 @@ NWC24Err NWC24GetMsgTextSize(const NWC24MsgObj* msg, u32* textSize) { return NWC24_OK; } +NWC24Err NWC24GetMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach) { + const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; + u8 numAttached = msgObj->numAttached; + *numAttach = numAttached; + if (numAttached > NWC24_MSG_ATTACHMENT_MAX) { + return NWC24_ERR_BROKEN; + } + return NWC24_OK; +} + NWC24Err NWC24GetMsgAttachedSize(const NWC24MsgObj* msg, u32 attachIndex, u32* attachSize) { const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; @@ -463,6 +451,18 @@ NWC24Err NWC24GetMsgAttachedType(const NWC24MsgObj* msg, u32 attachIndex, NWC24M return NWC24_OK; } +NWC24Err NWC24GetMsgAppId(const NWC24MsgObj* msg, u32* appId) { + const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; + *appId = msgObj->appId; + return NWC24_OK; +} + +NWC24Err NWC24GetMsgGroupId(const NWC24MsgObj* msg, u16* groupId) { + const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; + *groupId = msgObj->groupId; + return NWC24_OK; +} + NWC24Err NWC24GetMsgFromId(const NWC24MsgObj* msg, NWC24UserId* fromId) { const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg; -- 2.49.1 From c6ae812dd3ba7c4bc9610a53f959bf027aa3ced1 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Tue, 22 Sep 2026 05:24:38 +0000 Subject: [PATCH 2/2] Match NWC24 friend list --- libs/RevoEX/src/nwc24/NWC24FriendList.c | 134 ++++++++++++------------ 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/libs/RevoEX/src/nwc24/NWC24FriendList.c b/libs/RevoEX/src/nwc24/NWC24FriendList.c index 8ed58b0e..009e647b 100644 --- a/libs/RevoEX/src/nwc24/NWC24FriendList.c +++ b/libs/RevoEX/src/nwc24/NWC24FriendList.c @@ -18,10 +18,16 @@ enum { #define FRIEND_LIST_MAGIC 'WcFl' #define FRIEND_LIST_VERSION 2 -static const char* FLFilePath = "/shared2/wc24/nwc24fl.bin"; +const char lbl_8166E160[26] __attribute__((section(".data"), aligned(8))) = "/shared2/wc24/nwc24fl.bin"; +void* const lbl_8166E160_pad __attribute__((section(".data"))) = (void*)0; +static const char* FLFilePath = lbl_8166E160; +const u32 FLFilePath_pad __attribute__((section(".sdata"), aligned(1))) = 0; + +const char g_SpecialsChars[16] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' }; static NWC24Err GetCachedFLHeader(NWC24FLHeader** header); static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength); +static inline NWC24Err CheckFriendInfo(const NWC24FriendInfo* friendInfo); static u32 GetUnkFlag(u32 index) { NWC24Err result; @@ -127,7 +133,7 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { return NWC24_ERR_ALIGNMENT; } - result = NWC24CheckFriendInfo(friendInfo); + result = CheckFriendInfo(friendInfo); if (result != NWC24_OK) { return result; } @@ -219,63 +225,6 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { return result; } -NWC24Err NWC24DeleteFriendInfo(u32 index) { - NWC24Err result; - NWC24Err resultWrite; - - NWC24FLHeader* header; - NWC24FriendInfo* tmpFriendInfo; - - NWC24File file; - u32 fileOffset; - - if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { - return NWC24_ERR_LIB_NOT_OPENED; - } - - result = GetCachedFLHeader(&header); - if (result != NWC24_OK) { - return result; - } - - if (index >= header->infoCount) { - return NWC24_ERR_INVALID_VALUE; - } - - if (header->friendIds[index] == 0) { - return NWC24_ERR_NULL; - } - - tmpFriendInfo = (NWC24FriendInfo*)nwc24Work->mainWork; - Mail_memset(tmpFriendInfo, 0, sizeof(NWC24FriendInfo)); - - result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_RW); - if (result != NWC24_OK) { - return result; - } - - fileOffset = (index * sizeof(NWC24FriendInfo)) + sizeof(NWC24FLHeader); - NWC24FSeek(&file, fileOffset, NWC24_SEEK_BEG); - - resultWrite = NWC24FWrite(tmpFriendInfo, sizeof(NWC24FriendInfo), &file); - if (resultWrite == NWC24_OK) { - header->friendIds[index] = 0; - header->registeredCount--; - result = SetUnkFlag(index, 0); - if (result == NWC24_OK) { - NWC24FSeek(&file, 0, NWC24_SEEK_BEG); - resultWrite = NWC24FWrite(header, sizeof(NWC24FLHeader), &file); - } - } - - result = NWC24FClose(&file); - if (resultWrite != NWC24_OK) { - result = resultWrite; - } - - return result; -} - NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { NWC24Err result; NWC24Err resultFile; @@ -296,7 +245,7 @@ NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { return NWC24_ERR_ALIGNMENT; } - result = NWC24CheckFriendInfo(friendInfo); + result = CheckFriendInfo(friendInfo); if (result != NWC24_OK) { return result; } @@ -358,6 +307,63 @@ out: return result; } +NWC24Err NWC24DeleteFriendInfo(u32 index) { + NWC24Err result; + NWC24Err resultWrite; + + NWC24FLHeader* header; + NWC24FriendInfo* tmpFriendInfo; + + NWC24File file; + u32 fileOffset; + + if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { + return NWC24_ERR_LIB_NOT_OPENED; + } + + result = GetCachedFLHeader(&header); + if (result != NWC24_OK) { + return result; + } + + if (index >= header->infoCount) { + return NWC24_ERR_INVALID_VALUE; + } + + if (header->friendIds[index] == 0) { + return NWC24_ERR_NULL; + } + + tmpFriendInfo = (NWC24FriendInfo*)nwc24Work->mainWork; + Mail_memset(tmpFriendInfo, 0, sizeof(NWC24FriendInfo)); + + result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_RW); + if (result != NWC24_OK) { + return result; + } + + fileOffset = (index * sizeof(NWC24FriendInfo)) + sizeof(NWC24FLHeader); + NWC24FSeek(&file, fileOffset, NWC24_SEEK_BEG); + + resultWrite = NWC24FWrite(tmpFriendInfo, sizeof(NWC24FriendInfo), &file); + if (resultWrite == NWC24_OK) { + header->friendIds[index] = 0; + header->registeredCount--; + result = SetUnkFlag(index, 0); + if (result == NWC24_OK) { + NWC24FSeek(&file, 0, NWC24_SEEK_BEG); + resultWrite = NWC24FWrite(header, sizeof(NWC24FLHeader), &file); + } + } + + result = NWC24FClose(&file); + if (resultWrite != NWC24_OK) { + result = resultWrite; + } + + return result; +} + NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2) { NWC24Err result; NWC24Err resultFile; @@ -750,7 +756,7 @@ static NWC24Err GetCachedFLHeader(NWC24FLHeader** header) { return NWC24_OK; } -NWC24Err NWC24CheckFriendInfo(const NWC24FriendInfo* friendInfo) { +static inline NWC24Err CheckFriendInfo(const NWC24FriendInfo* friendInfo) { NWC24Err result; if (friendInfo == NULL) { @@ -775,8 +781,6 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) { int len; BOOL readingDomain; - static const char specials[] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' }; - // Check parameters if (addr == NULL) { return NWC24_ERR_NULL; @@ -812,8 +816,8 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) { } // If the character is special, invalid! - for (j = 0; j < sizeof(specials); j++) { - if (ch == specials[j]) { + for (j = 0; j < 11; j++) { + if (ch == g_SpecialsChars[j]) { return NWC24_ERR_FORMAT; } } -- 2.49.1