//
// GameLevelManager::deleteUserMessages from 0x3d1b4c to 0x3d1d58 (524 bytes)
//
// 3 xrefs:
// > GJMessageCell::FLAlert_Clicked @ 0x33a012
// > GJMessagePopup::FLAlert_Clicked @ 0x4ae49c
// > MessagesProfilePage::deleteSelected @ 0x4c0d9a
//
// 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
//
bool GameLevelManager::deleteUserMessages(GameLevelManager *a1, GJUserMessage *a2, cocos2d::CCArray *a3, bool a4)
{
_BOOL4 v5; // r10
GameLevelManager *v8; // r0
int m_messageID; // r1
char *v10; // r0
bool v11; // r4
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // r4
cocos2d::CCNode *v13; // r0
cocos2d::CCString *v14; // r0
const char *CString; // r0
cocos2d::CCString *v16; // r0
char *v17; // r0
cocos2d::CCString *v18; // r0
char *v19; // r0
unsigned int i; // r9
int v21; // r11
cocos2d::CCString *v22; // r0
char *v23; // r0
std::string v25; // [sp+20h] [bp-1Ch] BYREF
char *v26; // [sp+24h] [bp-18h] BYREF
char *v27; // [sp+28h] [bp-14h] BYREF
const char *v28; // [sp+2Ch] [bp-10h] BYREF
char *v29; // [sp+30h] [bp-Ch] BYREF
v5 = a4;
sub_776584((int)&v25, (char *)&unk_939830);
if ( !a3 )
{
if ( !a2 )
goto LABEL_9;
goto LABEL_5;
}
if ( cocos2d::CCArray::count(a3) == 1 )
{
a2 = (GJUserMessage *)cocos2d::CCArray::objectAtIndex(a3, 0);
if ( !a2 )
{
LABEL_9:
v11 = 0;
goto LABEL_20;
}
a3 = nullptr;
goto LABEL_5;
}
if ( a2 )
{
LABEL_5:
v8 = a1;
m_messageID = a2->m_messageID;
goto LABEL_8;
}
v8 = a1;
m_messageID = -1;
LABEL_8:
v10 = (char *)GameLevelManager::getDeleteMessageKey(v8, m_messageID, v5);
sub_7753D4((int)&v25, v10);
if ( cocos2d::CCDictionary::objectForKey(a1->m_friendReqAndUserBlocks, &v25) )
goto LABEL_9;
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
v13 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject((int)m_friendReqAndUserBlocks, v13);
GameLevelManager::getBasePostString((GameLevelManager *)&v26);
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_54 + 3,
"mfd",
"2893",
103,
98,
&aO1i2r3e45s7t89[10]);
CString = cocos2d::CCString::getCString(v14);
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"&secret=%s", CString);
v17 = (char *)cocos2d::CCString::getCString(v16);
sub_774544((int)&v26, v17);
if ( v5 )
sub_774544((int)&v26, "&isSender=1");
if ( a2 )
{
sub_774544((int)&v26, "&messageID=");
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)a2->m_messageID);
v19 = (char *)cocos2d::CCString::getCString(v18);
sub_774544((int)&v26, v19);
}
else
{
sub_774544((int)&v26, "&messages=");
for ( i = 0; i < cocos2d::CCArray::count(a3); ++i )
{
v21 = cocos2d::CCArray::objectAtIndex(a3, i);
if ( i )
sub_774544((int)&v26, ",");
v22 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
*(const char **)(v21 + 264));
v23 = (char *)cocos2d::CCString::getCString(v22);
sub_774544((int)&v26, v23);
}
}
sub_776584((int)&v27, "https://www.boomlings.com/database/deleteGJMessages20.php");
sub_776584((int)&v28, v26);
sub_775C20(&v29);
GameLevelManager::ProcessHttpRequest(a1, &v27, &v28, &v29, 39);
sub_774008(&v29);
sub_774008(&v28);
sub_774008(&v27);
sub_774008(&v26);
v11 = 1;
LABEL_20:
sub_774008(&v25);
return v11;
}