Add URI for Service Discovery (XEP-0030);
Remove scheme "xmpp" from local@hostname (was xmpp:local@hostname); Add more notes to the README document.
This commit is contained in:
parent
0d2e55fa14
commit
16338fabb2
2 changed files with 23 additions and 10 deletions
22
fasi.py
22
fasi.py
|
@ -94,7 +94,7 @@ class HttpInstance:
|
|||
title = node_name
|
||||
link_href = 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name)
|
||||
link_text = 'Subscribe'
|
||||
xmpp_uri = 'xmpp:{}?;node={}'.format(jid_bare, node_name)
|
||||
xmpp_uri = '{}?;node={}'.format(jid_bare, node_name)
|
||||
|
||||
# Start an XMPP instance and retrieve information
|
||||
xmpp_instance = XmppInstance(jabber_id, password, jid_bare)
|
||||
|
@ -328,23 +328,26 @@ class HttpInstance:
|
|||
message = '{}: {} (XEP-0030)'.format(jid_info['text'], jid_info['condition'])
|
||||
action = 'Connect with'
|
||||
link_text = 'Connect'
|
||||
link_href = xmpp_uri = 'xmpp:{}'.format(jid_bare)
|
||||
link_href = 'xmpp:{}'.format(jid_bare)
|
||||
xmpp_uri = jid_bare
|
||||
elif jid_kind in ('conference', 'server'):
|
||||
action = link_text = 'Discover'
|
||||
if jid_kind == 'conference':
|
||||
instance = 'conferences'
|
||||
elif jid_kind == 'server':
|
||||
instance = 'services'
|
||||
link_href = xmpp_uri = 'xmpp:{}'.format(jid_bare)
|
||||
link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare)
|
||||
view_href = '/d/' + jid_bare
|
||||
xmpp_uri = jid_bare
|
||||
elif jid_kind in ('mix', 'muc'):
|
||||
#title = 'Group Chat ' + title
|
||||
# TODO Set group chat subject as description.
|
||||
action = 'Join to'
|
||||
instance = 'participants'
|
||||
link_text = 'Join'
|
||||
link_href = xmpp_uri = 'xmpp:{}?join'.format(jid_bare)
|
||||
link_href = 'xmpp:{}?join'.format(jid_bare)
|
||||
view_href = '/v/' + jid_bare
|
||||
xmpp_uri = jid_bare
|
||||
# room_info = await XmppXep0045.get_room_data(xmpp_instance, jid_bare)
|
||||
# breakpoint()
|
||||
elif jid_kind == 'pubsub':
|
||||
|
@ -353,19 +356,22 @@ class HttpInstance:
|
|||
action = 'Subscribe to'
|
||||
instance = 'articles'
|
||||
link_text = 'Subscribe'
|
||||
link_href = xmpp_uri = 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name)
|
||||
link_href = 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name)
|
||||
view_href = '/d/{}/{}'.format(jid_bare, node_name)
|
||||
xmpp_uri = '{}?;node={}'.format(jid_bare, node_name)
|
||||
else:
|
||||
action = link_text = 'Browse'
|
||||
instance = 'nodes'
|
||||
link_href = xmpp_uri = 'xmpp:{}'.format(jid_bare)
|
||||
link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare)
|
||||
view_href = '/d/' + jid_bare
|
||||
xmpp_uri = jid_bare
|
||||
else:
|
||||
action = link_text = 'Message'
|
||||
instance = 'articles'
|
||||
link_href = xmpp_uri = 'xmpp:{}?message'.format(jid_bare)
|
||||
link_href = 'xmpp:{}?message'.format(jid_bare)
|
||||
node_name = 'urn:xmpp:microblog:0'
|
||||
view_href = '/d/{}/{}'.format(jid_bare, node_name)
|
||||
xmpp_uri = jid_bare
|
||||
|
||||
# JID item count
|
||||
count = None
|
||||
|
@ -465,7 +471,7 @@ class HttpInstance:
|
|||
xmpp_instance.disconnect()
|
||||
|
||||
# QR code
|
||||
Graphics.generate_qr_code_graphics_from_string(xmpp_uri, jid_bare)
|
||||
Graphics.generate_qr_code_graphics_from_string(link_href, jid_bare)
|
||||
|
||||
except Exception as e:
|
||||
exception = str(e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue