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): 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 = { jid_vcard = {
'name' : '', 'name' : '',
'note' : '', 'note' : '',
@ -748,14 +748,10 @@ class FileUtilities:
# Group chat messages # Group chat messages
print('Group chat messages') print('Group chat messages')
messages = [] messages = []
if jid_kind == 'muc muc': #FIXME if jid_kind == 'muc':
print(jid_bare)
print(jid_kind)
print(alias)
action = 'Join' action = 'Join'
# TODO Create configurations for group chat preview # TODO Create configurations for group chat preview
room_info_muc = await XmppXep0045.get_room_information(xmpp_instance, jid_bare, alias) # maxstanzas=50 room_info_muc = await XmppXep0045.get_room_information(xmpp_instance, jid_bare, alias, maxstanzas=50)
breakpoint()
if not room_info_muc: if not room_info_muc:
action = 'Warning' action = 'Warning'
node_title = jid_info['condition'] node_title = jid_info['condition']
@ -773,7 +769,12 @@ class FileUtilities:
node_note = room_info_muc['text'] node_note = room_info_muc['text']
services = services_sorted = None services = services_sorted = None
else: 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() messages.reverse()
subject = room_info_muc['iq'][1]['subject'] subject = room_info_muc['iq'][1]['subject']
#title = title or node_name #title = title or node_name

View file

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