Python : Group chat preview has been restored.

This commit is contained in:
Schimon Jehudah, Adv. 2024-10-16 00:14:34 +03:00
parent 8ef7685d0f
commit cb6b87544e
2 changed files with 11 additions and 10 deletions

17
fasi.py
View file

@ -637,7 +637,7 @@ class FileUtilities:
async def cache_jid_data(jabber_id, password, jid_bare, node_name=None, item_id=None, alias=None):
count = iq_disco_items_list = iq_disco_items_items_list = title = ''
count = iq_disco_items_list = iq_disco_items_items_list = node_title = title = ''
jid_vcard = {
'name' : '',
'note' : '',
@ -748,14 +748,10 @@ class FileUtilities:
# Group chat messages
print('Group chat messages')
messages = []
if jid_kind == 'muc muc': #FIXME
print(jid_bare)
print(jid_kind)
print(alias)
if jid_kind == 'muc':
action = 'Join'
# TODO Create configurations for group chat preview
room_info_muc = await XmppXep0045.get_room_information(xmpp_instance, jid_bare, alias) # maxstanzas=50
breakpoint()
room_info_muc = await XmppXep0045.get_room_information(xmpp_instance, jid_bare, alias, maxstanzas=50)
if not room_info_muc:
action = 'Warning'
node_title = jid_info['condition']
@ -773,7 +769,12 @@ class FileUtilities:
node_note = room_info_muc['text']
services = services_sorted = None
else:
messages = room_info_muc['iq'][3]
for message in room_info_muc['iq'][3]:
messages.append({
'id' : message['id'],
'alias' : message['mucnick'],
'body' : message['body'],
'timestamp' : message['delay']['stamp'].__str__()})
messages.reverse()
subject = room_info_muc['iq'][1]['subject']
#title = title or node_name

View file

@ -64,9 +64,9 @@
{% for message in messages %}
<div class="entry"
id="{{message['id']}}">
<strong>{{message['mucnick']}}</strong>
<strong>{{message['alias']}}</strong>
<div class="summary">{{message['body']}}</div>
<div class="date">{{message['delay']['stamp'].__str__()}}</div>
<div class="date">{{message['timestamp']}}</div>
<!--
% if reactions %
<div class="reactions">