diff options
author | Philipp Hörist <philipp@hoerist.com> | 2019-08-16 18:19:37 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2019-08-16 18:39:56 +0300 |
commit | 18c9fd5a0cc115dedaa201288c1d7e4bbba265aa (patch) | |
tree | 0c3999db19b8461a6a9530477e5bfdbe5106f0de /nbxmpp/modules | |
parent | 0c33075e34bba64aab83ab0c03588586711d5d40 (diff) |
DiscoInfo: Add timestamp attribute
Diffstat (limited to 'nbxmpp/modules')
-rw-r--r-- | nbxmpp/modules/discovery.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nbxmpp/modules/discovery.py b/nbxmpp/modules/discovery.py index 47510b6..c849afd 100644 --- a/nbxmpp/modules/discovery.py +++ b/nbxmpp/modules/discovery.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program; If not, see <http://www.gnu.org/licenses/>. +import time import logging from nbxmpp.protocol import Iq @@ -63,11 +64,14 @@ class Discovery: return parse_disco_items(stanza) -def parse_disco_info(stanza): +def parse_disco_info(stanza, timestamp=None): idenities = [] features = [] dataforms = [] + if timestamp is None: + timestamp = time.time() + query = stanza.getQuery() for node in query.getTags('identity'): attrs = node.getAttrs() @@ -92,7 +96,8 @@ def parse_disco_info(stanza): return DiscoInfo(stanza=stanza, identities=idenities, features=features, - dataforms=dataforms) + dataforms=dataforms, + timestamp=timestamp) def parse_disco_items(stanza): |