import
time
from
typing
import
Optional,
Any
class
ChatRevokeMgr:
def
__init__(
self
):
self
.global_state
=
self
.get_global_state()
def
get_global_state(
self
)
-
>
Any
:
return
{
"allow_operation"
:
True
}
def
ProcessAndSaveRevokedMessage(
self
, a1:
Any
, a2:
Any
)
-
> Optional[
int
]:
result
=
self
.sub_181B5CA40()
if
not
result.get(
"allow_operation"
):
return
result
v5
=
a1.get(
"type"
)
v84
=
False
if
v5
and
a2.get(
"message_type"
)
=
=
10000
:
self
.sub_182627590(
2
,
"ChatRevokeMgr::SaveRevokeSysMsg"
,
"original msg is sys msg"
)
return
None
if
not
a2.get(
"timestamp"
):
a2[
"timestamp"
]
=
a1.get(
"timestamp"
)
a2[
"status"
] &
=
0x80
if
v5:
self
.sub_181C21660(a2)
else
:
a2[
"sender"
]
=
a1.get(
"sender"
)
a2[
"status"
] &
=
8
v6
=
a1.get(
"content"
)
if
not
v6:
v6
=
"default_content"
self
.sub_18262DED0(a2, v6, a1.get(
"content_length"
))
a2[
"status"
] &
=
0x100
if
a2.get(
"message_id"
):
v7
=
a2.get(
"message_type"
)
if
v7
=
=
1
:
v84
=
True
v8
=
0
elif
v7
=
=
49
:
v9
=
self
.sub_181B601E0()
v10
=
self
.sub_1825040B0(a2)
self
.sub_1820E2B90(v9, v10)
v11
=
self
.sub_181C24E20()
v12
=
self
.sub_1825040B0(a2)
self
.sub_1822B6260(v11, v12)
v8
=
0
else
:
if
not
a2.get(
"is_processed"
):
self
.sub_1825026B0(a2, a2)
a2[
"is_processed"
]
=
True
self
.sub_18262D800(a1, a2)
v8
=
2
v13
=
True
if
v13
and
a2.get(
"message_type"
)
=
=
49
and
a2.get(
"sub_type"
)
=
=
2
:
v14
=
self
.sub_181B601E0()
self
.sub_1820F0A90(v14, a2)
self
.sub_181D8C330(a2)
v15
=
self
.sub_181B601E0()
v16
=
self
.sub_1825040B0(a2)
v86
=
v16
v17
=
v15.get(
"storage_handle"
)
v18
=
v17.get(
"next"
)
v19
=
v17
while
not
v18.get(
"is_processed"
):
if
v18.get(
"message_id"
) >
=
v16:
v19
=
v18
v18
=
v18.get(
"next"
)
else
:
v18
=
v18.get(
"prev"
)
if
v19 !
=
v17:
self
.sub_1825F9FB0(v19,
0
, v17)
self
.sub_181DBA390(v17, v86)
v21
=
a1.get(
"sender_type"
)
v22
=
self
.sub_18262D800(a1, a2)
v23
=
self
.sub_182502BD0(a2)
v24
=
bool
(a2.get(
"message_id"
))
self
.sub_181C22A90(a2, v24, v23, v22, v21)
v25
=
v8 |
4
if
a2.get(
"message_id"
):
self
.sub_181BF8B80(a2, a2)
v26
=
a2.get(
"content"
)
if
not
v26:
v26
=
"default_content"
self
.sub_18262DED0(a2, v26,
len
(v26))
a2[
"message_type"
]
=
10000
a2[
"status"
]
=
0
v27
=
a2.get(
"sub_type"
)
if
not
v27:
self
.sub_182502CF0(a2)
v27
=
a2.get(
"sub_type"
)
if
v27 !
=
57
:
if
not
v27:
self
.sub_182502CF0(a2)
v27
=
a2.get(
"sub_type"
)
if
v27 !
=
1
:
a2[
"sub_type"
]
=
0
if
not
a2.get(
"timestamp"
):
self
.sub_181B8E930()
v28
=
self
.sub_182651830()
if
self
.global_state.get(
"time_offset"
):
v28
-
=
self
.global_state.get(
"time_offset"
)
a2[
"timestamp"
]
=
v28
a2[
"status"
] &
=
128
if
a2.get(
"sequence_id"
) <
=
0
:
self
.sub_181B8E930()
if
a1.get(
"timestamp"
):
v29
=
a1.get(
"timestamp"
)
else
:
v29
=
self
.sub_182651830()
if
self
.global_state.get(
"time_offset"
):
v29
-
=
self
.global_state.get(
"time_offset"
)
a2[
"sequence_id"
]
=
1000
*
v29
self
.sub_182627590(
2
,
"ChatRevokeMgr::SaveRevokeSysMsg"
,
"Regen rv msg sortseq id"
)
a2[
"sub_type"
]
=
2
a2[
"status"
] &
=
64
self
.sub_181B8E930()
if
v5:
v32
=
self
.sub_18213CC90(a2)
if
v32:
v32.process(a2,
1
)
v86
=
"new_content"
v33
=
self
.sub_181C20DA0(v86)
v34
=
v33.get(
"next"
)
if
v34
=
=
v33.get(
"prev"
):
self
.sub_181BEC420(v33, v34, a2)
else
:
self
.sub_181B7CD20(v34, a2)
v33[
"next"
]
+
=
1104
else
:
self
.sub_182147800(a2, a2)
v86
=
"new_content"
v33
=
self
.sub_181C20DA0(v86)
v34
=
v33.get(
"next"
)
if
v34
=
=
v33.get(
"prev"
):
self
.sub_181BEC420(v33, v34, a2)
else
:
self
.sub_181B7CD20(v34, a2)
v33[
"next"
]
+
=
1104
v35
=
self
.sub_1823865C0()
self
.sub_1823878F0(v35, {
"log_id"
:
965
,
"message"
: a2})
if
v84:
v36
=
self
.sub_181C1CB20()
v37
=
self
.sub_181C280C0(v36,
"default_content"
)
v86
=
"new_content"
self
.sub_181B7CD20(v86, a2)
v82
=
"new_content"
v38
=
"new_content"
v49
=
v38
self
.sub_181B7CD20(v38, a2)
v82
=
v38
self
.sub_181B5CAC0(v86)
self
.sub_18265F3D0(v86, v37,
0
)
v39
=
a2.get(
"sub_type"
)
if
not
v39:
self
.sub_182502CF0(a2)
v39
=
a2.get(
"sub_type"
)
self
.sub_182627590(
2
,
"ChatRevokeMgr::SaveRevokeSysMsg"
,
"has msg"
)
v41
=
self
.sub_181B5CA40()
self
.sub_18262DB20(a2, v41)
if
not
a2.get(
"is_processed"
):
self
.sub_1825026B0(a2, a2)
a2[
"is_processed"
]
=
True
self
.sub_18262D800(a1, a2)
v42
=
v25 |
8
v43
=
a2.get(
"content"
)
if
not
v43:
v43
=
"default_content"
v44
=
a2.get(
"content"
)
if
v44:
if
v43:
if
len
(v44) >
0
:
v45
=
v44.find(v43)
if
v45 >
=
0
:
v85
=
"new_content"
self
.sub_18262D800(a1, a2)
v46
=
v42 |
0x11
v86
=
v46
v47
=
self
.sub_182389C70(v85, a2)
if
v46 &
1
:
if
a2.get(
"content"
):
a2[
"content"
]
=
None
a2[
"content_length"
]
=
0
v48
=
self
.sub_1823865C0()
self
.sub_1823878F0(v48, {
"log_id"
:
858
,
"message"
: a2})
if
v44:
a2[
"content"
]
=
None
if
a2.get(
"content"
):
a2[
"content"
]
=
None
if
a2.get(
"content"
):
a2[
"content"
]
=
None
return
None
a1
=
{
"type"
:
1
,
"timestamp"
:
1633024800
,
"sender"
:
"user1"
,
"content"
:
"Hello, World!"
,
"content_length"
:
13
}
a2
=
{
"message_type"
:
1
,
"timestamp"
:
0
,
"status"
:
0
,
"message_id"
:
12345
,
"sub_type"
:
0
,
"sequence_id"
:
0
,
"is_processed"
:
False
}
mgr
=
ChatRevokeMgr()
mgr.ProcessAndSaveRevokedMessage(a1, a2)