mirror of
https://github.com/openmax-server/server.git
synced 2026-05-22 19:41:41 +03:00
fix(chat history): фикс
This commit is contained in:
@@ -34,12 +34,14 @@ class Tools:
|
|||||||
# id, cid, chatId, time, type, sender, text, attaches, elements,
|
# id, cid, chatId, time, type, sender, text, attaches, elements,
|
||||||
# link, reactionInfo, updateTime, status, options
|
# link, reactionInfo, updateTime, status, options
|
||||||
# Список вытащен дизассемблированием Q() через dexdump.
|
# Список вытащен дизассемблированием Q() через dexdump.
|
||||||
|
# type — int-enum для разновидности сообщения (0 = обычное text);
|
||||||
|
# status — int-enum (1 = ACTIVE/доставлено, 0 часто означает REMOVED).
|
||||||
message = {
|
message = {
|
||||||
"id": row.get("id") if protocol_type == "mobile" else str(row.get("id")),
|
"id": row.get("id") if protocol_type == "mobile" else str(row.get("id")),
|
||||||
"cid": int(row.get("cid") or 0),
|
"cid": int(row.get("cid") or 0),
|
||||||
"chatId": int(row.get("chat_id") or 0),
|
"chatId": int(row.get("chat_id") or 0),
|
||||||
"time": int(row.get("time")),
|
"time": int(row.get("time")),
|
||||||
"type": row.get("type") or "USER", # ENUM: USER/CHANNEL/CHANNEL_ADMIN/GROUP
|
"type": row.get("type") or "USER", # ENUM-строка: USER/CHANNEL/CHANNEL_ADMIN/GROUP
|
||||||
"sender": row.get("sender"),
|
"sender": row.get("sender"),
|
||||||
"text": row.get("text") or "",
|
"text": row.get("text") or "",
|
||||||
"attaches": attaches if isinstance(attaches, list) else [],
|
"attaches": attaches if isinstance(attaches, list) else [],
|
||||||
@@ -47,7 +49,7 @@ class Tools:
|
|||||||
"reactionInfo": {},
|
"reactionInfo": {},
|
||||||
"link": {},
|
"link": {},
|
||||||
"updateTime": int(row.get("update_time") or row.get("time") or 0),
|
"updateTime": int(row.get("update_time") or row.get("time") or 0),
|
||||||
"status": int(row.get("status") or 0),
|
"status": int(row.get("status") or 1), # 1 = ACTIVE
|
||||||
"options": int(row.get("options") or 0),
|
"options": int(row.get("options") or 0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,14 +93,9 @@ class HistoryProcessors(BaseProcessor):
|
|||||||
"total": len(messages), # всего в этой пачке
|
"total": len(messages), # всего в этой пачке
|
||||||
}
|
}
|
||||||
|
|
||||||
# Собираем пакет.
|
# Собираем пакет
|
||||||
# MAX 26.15.x: в switch-парсере cwb.c() (диспатч по полю u4d.d=short opcode)
|
|
||||||
# обработчик CHAT_HISTORY (создание a23) висит на #int 51, а не 49.
|
|
||||||
# opcode 49 в этом switch вообще отсутствует — пакет с ним игнорируется.
|
|
||||||
# Поэтому отвечаем opcode=51 несмотря на то, что в нашем opcodes.py
|
|
||||||
# CHAT_HISTORY=49 (это для роутинга запросов, а не для ответов).
|
|
||||||
packet = self.proto.pack_packet(
|
packet = self.proto.pack_packet(
|
||||||
cmd=self.proto.CMD_OK, seq=seq, opcode=51, payload=payload
|
cmd=self.proto.CMD_OK, seq=seq, opcode=self.opcodes.CHAT_HISTORY, payload=payload
|
||||||
)
|
)
|
||||||
|
|
||||||
# Отправялем
|
# Отправялем
|
||||||
|
|||||||
@@ -223,9 +223,7 @@ class OnemeMobile:
|
|||||||
writer,
|
writer,
|
||||||
userId,
|
userId,
|
||||||
)
|
)
|
||||||
case 49 | 51:
|
case self.opcodes.CHAT_HISTORY:
|
||||||
# MAX 26.15.x шлёт CHAT_HISTORY на opcode 51 (раньше был CHAT_MEDIA),
|
|
||||||
# некоторые билды ещё шлют 49. Поддерживаем оба.
|
|
||||||
await self.auth_required(
|
await self.auth_required(
|
||||||
userPhone,
|
userPhone,
|
||||||
self.processors.chat_history,
|
self.processors.chat_history,
|
||||||
|
|||||||
Reference in New Issue
Block a user