Python : Fix data retrieval from group chat.
This commit is contained in:
parent
7dda347ebc
commit
7a01c43a57
1 changed files with 21 additions and 3 deletions
24
fasi.py
24
fasi.py
|
@ -101,6 +101,9 @@ class HttpInstance:
|
|||
jid_bare = jid
|
||||
note = 'Jabber ID appears to be malformed'
|
||||
|
||||
if jid_bare == jabber_id:
|
||||
raise HTTPException(status_code=403, detail='access-denied')
|
||||
|
||||
#try:
|
||||
if True:
|
||||
exception = jid_vcard = messages_10 = note = node_title = \
|
||||
|
@ -224,6 +227,9 @@ class HttpInstance:
|
|||
jid_bare = jid
|
||||
note = 'Jabber ID appears to be malformed'
|
||||
|
||||
if jid_bare == jabber_id:
|
||||
raise HTTPException(status_code=403, detail='access-denied')
|
||||
|
||||
#try:
|
||||
if True:
|
||||
entries = []
|
||||
|
@ -401,6 +407,9 @@ class HttpInstance:
|
|||
jid_bare = jid
|
||||
note = 'Jabber ID appears to be malformed'
|
||||
|
||||
if jid_bare == jabber_id:
|
||||
raise HTTPException(status_code=403, detail='access-denied')
|
||||
|
||||
#try:
|
||||
if True:
|
||||
exception = note = selection = services_sorted = None
|
||||
|
@ -526,6 +535,9 @@ class HttpInstance:
|
|||
jid_bare = jid
|
||||
note = 'Jabber ID appears to be malformed'
|
||||
|
||||
if jid_bare == jabber_id:
|
||||
raise HTTPException(status_code=403, detail='access-denied')
|
||||
|
||||
#try:
|
||||
if True:
|
||||
action = count = exception = instance = jid_vcard = \
|
||||
|
@ -707,6 +719,12 @@ class HttpInstance:
|
|||
response.headers['Content-Type'] = 'application/xhtml+xml'
|
||||
return response
|
||||
|
||||
@self.app.exception_handler(403)
|
||||
def not_found_exception_handler(request: Request, exc: HTTPException):
|
||||
action = 'Warning'
|
||||
title = 'Access Denied'
|
||||
return result_get(request, action, title)
|
||||
|
||||
@self.app.exception_handler(404)
|
||||
def not_found_exception_handler(request: Request, exc: HTTPException):
|
||||
action = 'Warning'
|
||||
|
@ -886,8 +904,8 @@ class FileUtilities:
|
|||
# TODO Create configurations for group chat preview
|
||||
room_info_muc = await XmppXep0045.get_room_information(
|
||||
xmpp_instance, jid_bare, alias, maxstanzas=50)
|
||||
# NOTE Don not mix error messages with node titles and descriptions etc.
|
||||
if isinstance(room_info_muc['iq'], stanza.iq.Iq):
|
||||
# NOTE Do not mix error messages with node titles and descriptions etc.
|
||||
if isinstance(room_info_muc['iq'], tuple):
|
||||
iq = room_info_muc['iq']
|
||||
for message in iq[3]:
|
||||
messages.append({
|
||||
|
@ -1427,7 +1445,7 @@ class XmppXep0045:
|
|||
#presence_options = {"pfrom" : jid_from},
|
||||
#seconds=seconds,
|
||||
#since=since,
|
||||
timeout=5
|
||||
timeout=10
|
||||
)
|
||||
except TimeoutError as e:
|
||||
#raise HTTPException(status_code=504, detail='request-timeout-reached')
|
||||
|
|
Loading…
Reference in a new issue