Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0277.py @ 2160:e67e8cd24141
core (tools/common): data objects first draft:
this module aims is to help manipulate complex data from bridge, mainly for the template system.
It is in common and not only in frontends as it may be used in some case by backend, if it needs to use template system in the future.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 21 Feb 2017 21:01:40 +0100 |
parents | a543eda2c923 |
children | 6a2fa651d7fa |
comparison
equal
deleted
inserted
replaced
2159:5734b0994cf0 | 2160:e67e8cd24141 |
---|---|
606 def parseCommentUrl(self, node_url): | 606 def parseCommentUrl(self, node_url): |
607 """Parse a XMPP URI | 607 """Parse a XMPP URI |
608 | 608 |
609 Determine the fields comments_service and comments_node of a microblog data | 609 Determine the fields comments_service and comments_node of a microblog data |
610 from the href attribute of an entry's link element. For example this input: | 610 from the href attribute of an entry's link element. For example this input: |
611 xmpp:sat-pubsub.libervia.org?;node=urn%3Axmpp%3Acomments%3A_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn%3Axmpp%3Agroupblog%3Asouliane%40libervia.org | 611 xmpp:sat-pubsub.example.net?;node=urn%3Axmpp%3Acomments%3A_af43b363-3259-4b2a-ba4c-1bc33aa87634__urn%3Axmpp%3Agroupblog%3Asomebody%40example.net |
612 will return (JID(u'sat-pubsub.libervia.org'), 'urn:xmpp:comments:_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn:xmpp:groupblog:souliane@libervia.org') | 612 will return(JID(u'sat-pubsub.example.net'), 'urn:xmpp:comments:_af43b363-3259-4b2a-ba4c-1bc33aa87634__urn:xmpp:groupblog:somebody@example.net') |
613 @return: a tuple (JID, str) | 613 @return (tuple[jid.JID, unicode]): service and node |
614 """ | 614 """ |
615 parsed_url = urlparse.urlparse(node_url, 'xmpp') | 615 parsed_url = urlparse.urlparse(node_url, 'xmpp') |
616 service = jid.JID(parsed_url.path) | 616 service = jid.JID(parsed_url.path) |
617 parsed_queries = urlparse.parse_qs(parsed_url.query.encode('utf-8')) | 617 parsed_queries = urlparse.parse_qs(parsed_url.query.encode('utf-8')) |
618 node = parsed_queries.get('node', [''])[0].decode('utf-8') | 618 node = parsed_queries.get('node', [''])[0].decode('utf-8') |