//
// GameLevelManager::deleteUserMessages from 0x14015b4b0 to 0x14015b911 (1121 bytes)
//
// 4 xrefs:
// > GJMessageCell::FLAlert_Clicked @ 0x1400be1f6
// > GJMessagePopup::FLAlert_Clicked @ 0x140298f05
// > MessagesProfilePage::deleteSelected @ 0x1403377ef
// > ??> @ 0x1406caa34
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=4
bool GameLevelManager::deleteUserMessages(GameLevelManager *a1, GJUserMessage *a2, cocos2d::CCArray *a3, bool a4)
{
BOOL v4; // r14d
cocos2d::CCArray *v5; // rsi
cocos2d::CCString *v8; // rax
char *CString; // rax
size_t v10; // rbx
size_t v11; // r8
cocos2d::CCString *v12; // rax
__int64 v13; // rax
__int64 v14; // rcx
cocos2d::CCString *v15; // rax
const char *v16; // rax
cocos2d::CCString *v17; // rax
char *v18; // rax
size_t v19; // r8
cocos2d::CCString *v20; // rax
char *v21; // rax
size_t v22; // r8
__int64 v23; // rdx
__int64 v24; // rcx
__int64 v25; // r8
__int64 v26; // r9
unsigned int i; // edi
struct cocos2d::CCObject *v28; // r14
cocos2d::CCString *v29; // rax
char *v30; // rax
size_t v31; // r8
void **v32; // r14
unsigned __int64 v33; // rsi
__int64 v34; // rdi
_QWORD *v35; // rdx
bool v36; // bl
__int128 v38; // [rsp+40h] [rbp-99h] BYREF
unsigned __int64 v39; // [rsp+50h] [rbp-89h]
__int64 v40; // [rsp+58h] [rbp-81h]
__int128 v41; // [rsp+60h] [rbp-79h] BYREF
__int64 v42; // [rsp+70h] [rbp-69h]
__int64 v43; // [rsp+78h] [rbp-61h]
__int128 v44; // [rsp+80h] [rbp-59h] BYREF
__int64 v45; // [rsp+90h] [rbp-49h]
__int64 v46; // [rsp+98h] [rbp-41h]
__int128 *v47; // [rsp+A0h] [rbp-39h]
__int128 *v48; // [rsp+A8h] [rbp-31h]
void *Src[2]; // [rsp+B8h] [rbp-21h] BYREF
unsigned __int64 v50; // [rsp+C8h] [rbp-11h]
unsigned __int64 v51; // [rsp+D0h] [rbp-9h]
_QWORD v52[4]; // [rsp+D8h] [rbp-1h] BYREF
v4 = a4;
v5 = a3;
*(_OWORD *)Src = 0;
v50 = 0;
v51 = 15;
LOBYTE(Src[0]) = 0;
if ( a3 && cocos2d::CCArray::count(a3) == 1 )
{
a2 = (GJUserMessage *)cocos2d::CCArray::objectAtIndex(v5, 0);
v5 = nullptr;
}
if ( a2 )
{
v8 = cocos2d::CCString::createWithFormat("delMsg_%i_%i", a2->m_messageID, v4);
CString = (char *)cocos2d::CCString::getCString(v8);
v10 = -1;
v11 = -1;
do
++v11;
while ( CString[v11] );
}
else
{
if ( !v5 )
{
LABEL_40:
v36 = 0;
goto LABEL_41;
}
v10 = -1;
v12 = cocos2d::CCString::createWithFormat("delMsg_%i_%i", -1, v4);
CString = (char *)cocos2d::CCString::getCString(v12);
v11 = -1;
do
++v11;
while ( CString[v11] );
}
sub_14003CCE0(Src, CString, v11);
if ( cocos2d::CCDictionary::objectForKey(a1->m_friendReqAndUserBlocks, Src) )
goto LABEL_40;
v13 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject(a1->m_friendReqAndUserBlocks, v13, Src);
GameLevelManager::getBasePostString(v14, v52);
v15 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, (const char *)&word_140531E88);
v16 = cocos2d::CCString::getCString(v15);
v17 = cocos2d::CCString::createWithFormat("&secret=%s", v16);
v18 = (char *)cocos2d::CCString::getCString(v17);
v19 = -1;
do
++v19;
while ( v18[v19] );
sub_140041270(v52, v18, v19);
if ( v4 )
sub_140041270(v52, "&isSender=1", 0xBu);
if ( a2 )
{
sub_140041270(v52, "&messageID=", 0xBu);
v20 = cocos2d::CCString::createWithFormat("%i", a2->m_messageID);
v21 = (char *)cocos2d::CCString::getCString(v20);
v22 = -1;
do
++v22;
while ( v21[v22] );
sub_140041270(v52, v21, v22);
}
else
{
sub_140041270(v52, "&messages=", 0xAu);
for ( i = 0; i < cocos2d::CCArray::count(v5); ++i )
{
v28 = cocos2d::CCArray::objectAtIndex(v5, i);
if ( i )
sub_140041270(v52, ",", 1u);
v29 = cocos2d::CCString::createWithFormat("%i", v28[5].m_unknown2);
v30 = (char *)cocos2d::CCString::getCString(v29);
v31 = -1;
do
++v31;
while ( v30[v31] );
sub_140041270(v52, v30, v31);
}
}
v47 = &v38;
v48 = &v44;
v38 = 0;
v39 = 0;
v40 = 0;
v32 = Src;
if ( v51 > 0xF )
v32 = (void **)Src[0];
v33 = v50;
v34 = 0x7FFFFFFFFFFFFFFFLL;
if ( v50 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v24, v23, v25, v26);
v40 = 15;
if ( v50 > 0xF )
{
if ( (v50 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v34 = v50 | 0xF;
if ( (v50 | 0xF) < 0x16 )
v34 = 22;
}
*(_QWORD *)&v38 = sub_14003AA10(v34 + 1);
v39 = v33;
v40 = v34;
memcpy((void *)v38, v32, v33 + 1);
}
else
{
v39 = v50;
v38 = *(_OWORD *)v32;
}
v35 = v52;
if ( v52[3] > 0xFu )
v35 = (_QWORD *)v52[0];
v44 = 0;
v45 = 0;
v46 = 0;
do
++v10;
while ( *((_BYTE *)v35 + v10) );
sub_14003A930(&v44, v35, v10);
v41 = 0;
v42 = 0;
v43 = 15;
*(_QWORD *)&v41 = sub_14003AA10(0x40u);
v42 = 57;
v43 = 63;
strcpy((char *)v41, "https://www.boomlings.com/database/deleteGJMessages20.php");
GameLevelManager::ProcessHttpRequest(a1, (__int64)&v41, (const char *)&v44, (const char *)&v38, 39);
v36 = 1;
sub_14003A830((__int64)v52);
LABEL_41:
sub_14003A830((__int64)Src);
return v36;
}