From 2fdfc5220f3f05130b72f89e30104f129f5e0f1f Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 25 Nov 2015 18:24:34 +0100 Subject: [PATCH] plugin XEP-0277: minor fixes for publisher attribute --- src/plugins/plugin_xep_0277.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/plugin_xep_0277.py b/src/plugins/plugin_xep_0277.py index 9017f00b..d3220059 100755 --- a/src/plugins/plugin_xep_0277.py +++ b/src/plugins/plugin_xep_0277.py @@ -271,12 +271,12 @@ class XEP_0277(object): log.warning(u"Unmanaged link element: rel={rel} title={title} href={href}".format(rel=rel, title=title, href=href)) # author - publisher = item_elt.getAttribute("publisher") try: author_elt = entry_elt.elements(NS_ATOM, 'author').next() except StopIteration: log.debug(u"Can't find author element in item {}".format(id_)) else: + publisher = item_elt.getAttribute("publisher") # name try: name_elt = author_elt.elements(NS_ATOM, 'name').next() @@ -302,7 +302,7 @@ class XEP_0277(object): if not publisher: log.debug(u"No publisher attribute, we can't verify author jid") microblog_data['author_jid_verified'] = C.BOOL_FALSE - elif publisher.split("/")[0] == uri.split("/")[0]: + elif jid.JID(publisher).userhostJID() == jid.JID(uri).userhostJID(): microblog_data['author_jid_verified'] = C.BOOL_TRUE else: log.warning(u"item atom:uri differ from publisher attribute, spoofing attempt ? atom:uri = {} publisher = {}".format(uri, item_elt.getAttribute("publisher")))