Correct extraction of information from vCard4 Over XMPP (XEP-0292).

Thank you to Marvin W.
This commit is contained in:
Schimon Jehudah, Adv. 2024-10-31 15:35:02 +02:00
parent 373b7b1f05
commit 10215d7fca
2 changed files with 18 additions and 10 deletions

View file

@ -29,7 +29,7 @@ resources = [
title = "aTalk"
about = """
XMPP/Jabber client with encrypted instant messaging and video calls.
#
An encrypted instant messaging with video call and GPS features for Divest OS.
"""
android = "https://f-droid.org/packages/org.atalk.android/"
@ -53,6 +53,9 @@ and a few enhancements.
apple = "https://beagle.im/#about"
properties = ["chat", "desktop", "graphical", "omemo"]
resources = [
{ url = "https://apps.apple.com/us/app/beagleim-by-tigase-inc/id1445349494", txt = "macOS package" },
{ url = "xmpp:tigase@muc.tigase.org?join", txt = "Support group chat (MUC)" },
{ url = "xmpp:tigase@mix.tigase.im?join", txt = "Support group chat (MIX)" },
{ url = "https://beagle.im", txt = "Project homepage" },
]
@ -216,6 +219,7 @@ properties = ["chat", "featured", "graphical", "mobile"]
resources = [
{ url = "bhackers:Convo", txt = "Install via the BananaHackers store" },
{ url = "https://store.bananahackers.net/#Convo", txt = "BananaHackers store package" },
{ url = "https://liberapay.com/convo", txt = "Liberapay profile" },
{ url = "xmpp:convo@chat.disroot.org?join", txt = "Support group chat" },
{ url = "https://git.disroot.org/badrihippo/convo", txt = "Project repository" },
]
@ -325,6 +329,7 @@ properties = ["adhoc", "admin", "chat", "desktop", "featured", "graphical", "ome
resources = [
{ url = "https://flathub.org/apps/org.gajim.Gajim", txt = "Flathub package" },
{ url = "https://apps.microsoft.com/detail/9pggf6hd43f9?hl=en-us&gl=US", txt = "Windows package" },
{ url = "https://liberapay.com/Gajim", txt = "Liberapay profile" },
{ url = "xmpp:gajim@conference.gajim.org?join", txt = "Support group chat" },
{ url = "https://gajim.org", txt = "Project homepage" },
]
@ -705,6 +710,7 @@ windows = "https://psi-im.org"
properties = ["adhoc", "admin", "chat", "desktop", "graphical", "omemo", "openpgp", "otr", "plugin"]
resources = [
{ url = "https://github.com/psi-im/psi", txt = "Project repository" },
{ url = "https://liberapay.com/Psi", txt = "Liberapay profile" },
{ url = "xmpp:psi-dev@conference.jabber.ru?join", txt = "Support group chat" },
{ url = "https://psi-im.org", txt = "Project homepage" },
]
@ -725,6 +731,7 @@ windows = "https://psi-plus.com/wiki/en:downloads#ms_windows"
properties = ["adhoc", "admin", "chat", "desktop", "featured", "graphical", "haikudepot", "omemo", "openpgp", "otr", "plugin"]
resources = [
{ url = "https://github.com/psi-plus/main", txt = "Project repository" },
{ url = "https://liberapay.com/Psi", txt = "Liberapay profile" },
{ url = "xmpp:psi-dev@conference.jabber.ru?join", txt = "Support group chat" },
{ url = "https://psi-plus.com", txt = "Project homepage" },
]
@ -768,6 +775,8 @@ apple = "https://siskin.im/#about"
properties = ["chat", "graphical", "mobile", "omemo"]
resources = [
{ url = "https://itunes.apple.com/us/app/tigase-messenger/id1153516838", txt = "iOS package" },
{ url = "xmpp:tigase@muc.tigase.org?join", txt = "Support group chat (MUC)" },
{ url = "xmpp:tigase@mix.tigase.im?join", txt = "Support group chat (MIX)" },
{ url = "https://siskin.im", txt = "Project homepage" },
]
@ -845,6 +854,8 @@ It provides an easy way to talk and share moments with your friends.
android = "https://stork.im/#about"
properties = ["chat", "graphical", "mobile", "omemo"]
resources = [
{ url = "xmpp:tigase@muc.tigase.org?join", txt = "Support group chat (MUC)" },
{ url = "xmpp:tigase@mix.tigase.im?join", txt = "Support group chat (MIX)" },
{ url = "https://stork.im", txt = "Project homepage" },
]

15
fasi.py
View file

@ -1563,16 +1563,13 @@ class Syndication:
'peertube' : [],
}
for res in extra_resources:
try:
count = len(xml_data.findall(namespace + 'group[@name="' + res + '"]/' + namespace + 'x-ablabel'))
except:
breakpoint()
for p in range(count):
position = str(p + 1)
print(res, position)
for i in xml_data.find(namespace + 'group[@name="' + res + '"]/' + namespace + 'x-ablabel[' + position + ']'):
#for element in xml_data.findall(namespace + 'group[contains(@name, "{}")]'.format(res)):
#for element in xml_data.findall(namespace + 'group[strats-with(@name, "{}")]'.format(res)):
matching_elements = [group for group in xml_data.findall(namespace + "group") if res in group.get('name', '')]
for element in matching_elements:
for i in element.find(namespace + 'x-ablabel'):
txt = i.text
for i in xml_data.find(namespace + 'group[@name="' + res + '"]/' + namespace + 'url[' + position + ']'):
for i in element.find(namespace + 'url'):
uri = i.text
extra_resources[res].append({'label' : txt, 'uri' : uri})
vcard[res] = extra_resources[res]