mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-26 16:01:33 +00:00
Add contact's status if present (Android)
This commit is contained in:
@@ -22,6 +22,7 @@ class ChatStore():
|
|||||||
self.my_avatar = None
|
self.my_avatar = None
|
||||||
self.their_avatar = None
|
self.their_avatar = None
|
||||||
self.their_avatar_thumb = None
|
self.their_avatar_thumb = None
|
||||||
|
self.status = None
|
||||||
|
|
||||||
def add_message(self, id, message):
|
def add_message(self, id, message):
|
||||||
if not isinstance(message, Message):
|
if not isinstance(message, Message):
|
||||||
@@ -40,6 +41,7 @@ class ChatStore():
|
|||||||
'my_avatar': self.my_avatar,
|
'my_avatar': self.my_avatar,
|
||||||
'their_avatar': self.their_avatar,
|
'their_avatar': self.their_avatar,
|
||||||
'their_avatar_thumb': self.their_avatar_thumb,
|
'their_avatar_thumb': self.their_avatar_thumb,
|
||||||
|
'status': self.status,
|
||||||
'messages': serialized_msgs
|
'messages': serialized_msgs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,10 +155,12 @@ def contacts(db, data):
|
|||||||
total_row_number = c.fetchone()[0]
|
total_row_number = c.fetchone()[0]
|
||||||
print(f"Processing contacts...({total_row_number})")
|
print(f"Processing contacts...({total_row_number})")
|
||||||
|
|
||||||
c.execute("""SELECT jid, COALESCE(display_name, wa_name) as display_name FROM wa_contacts; """)
|
c.execute("""SELECT jid, COALESCE(display_name, wa_name) as display_name, status FROM wa_contacts; """)
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
while row is not None:
|
while row is not None:
|
||||||
data[row["jid"]] = ChatStore(Device.ANDROID, row["display_name"])
|
data[row["jid"]] = ChatStore(Device.ANDROID, row["display_name"])
|
||||||
|
if row["status"] is not None:
|
||||||
|
data[row["jid"]].status = row["status"]
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
|
|
||||||
|
|
||||||
@@ -702,7 +704,8 @@ def create_html(
|
|||||||
f"{safe_file_name}-{current_page + 1}.html",
|
f"{safe_file_name}-{current_page + 1}.html",
|
||||||
chat.my_avatar,
|
chat.my_avatar,
|
||||||
chat.their_avatar,
|
chat.their_avatar,
|
||||||
chat.their_avatar_thumb
|
chat.their_avatar_thumb,
|
||||||
|
chat.status
|
||||||
)
|
)
|
||||||
render_box = [message]
|
render_box = [message]
|
||||||
current_size = 0
|
current_size = 0
|
||||||
@@ -723,7 +726,8 @@ def create_html(
|
|||||||
False,
|
False,
|
||||||
chat.my_avatar,
|
chat.my_avatar,
|
||||||
chat.their_avatar,
|
chat.their_avatar,
|
||||||
chat.their_avatar_thumb
|
chat.their_avatar_thumb,
|
||||||
|
chat.status
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
render_box.append(message)
|
render_box.append(message)
|
||||||
@@ -739,7 +743,8 @@ def create_html(
|
|||||||
False,
|
False,
|
||||||
chat.my_avatar,
|
chat.my_avatar,
|
||||||
chat.their_avatar,
|
chat.their_avatar,
|
||||||
chat.their_avatar_thumb
|
chat.their_avatar_thumb,
|
||||||
|
chat.status
|
||||||
)
|
)
|
||||||
if current % 10 == 0:
|
if current % 10 == 0:
|
||||||
print(f"Generating chats...({current}/{total_row_number})", end="\r")
|
print(f"Generating chats...({current}/{total_row_number})", end="\r")
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ def rendering(
|
|||||||
next,
|
next,
|
||||||
my_avatar,
|
my_avatar,
|
||||||
their_avatar,
|
their_avatar,
|
||||||
their_avatar_thumb
|
their_avatar_thumb,
|
||||||
|
status
|
||||||
):
|
):
|
||||||
if their_avatar_thumb is None and their_avatar is not None:
|
if their_avatar_thumb is None and their_avatar is not None:
|
||||||
their_avatar_thumb = their_avatar
|
their_avatar_thumb = their_avatar
|
||||||
@@ -84,7 +85,8 @@ def rendering(
|
|||||||
their_avatar=their_avatar,
|
their_avatar=their_avatar,
|
||||||
their_avatar_thumb=their_avatar_thumb,
|
their_avatar_thumb=their_avatar_thumb,
|
||||||
w3css=w3css,
|
w3css=w3css,
|
||||||
next=next
|
next=next,
|
||||||
|
status=status,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,13 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="w3-center w3-top">Chat history with {{ name }}</header>
|
<header class="w3-center w3-top">
|
||||||
|
Chat history with {{ name }}
|
||||||
|
{% if status is not none %}
|
||||||
|
<br>
|
||||||
|
<span class="w3-small">{{ status }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</header>
|
||||||
<article class="w3-container">
|
<article class="w3-container">
|
||||||
<div class="table">
|
<div class="table">
|
||||||
{% set last = {'last': 946688461.001} %}
|
{% set last = {'last': 946688461.001} %}
|
||||||
|
|||||||
Reference in New Issue
Block a user