Commit 18c9fd5a authored by Philipp Hörist's avatar Philipp Hörist

DiscoInfo: Add timestamp attribute

parent 0c33075e
......@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see <>.
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,
def parse_disco_items(stanza):
......@@ -119,13 +119,13 @@ DiscoItem = namedtuple('DiscoItem', 'jid name node')
DiscoItem.__new__.__defaults__ = (None, None)
class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms')):
class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms timestamp')):
__slots__ = []
def __new__(cls, stanza, identities, features, dataforms):
def __new__(cls, stanza, identities, features, dataforms, timestamp=None):
return super(DiscoInfo, cls).__new__(cls, stanza, identities,
features, dataforms)
features, dataforms, timestamp)
def get_caps_hash(self):
......@@ -203,7 +203,7 @@ class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms'))
def muc_room_name(self):
return self._get_form_value(NS_MUC_INFO, 'muc#roomconfig_roomname')
return self._get_form_value(NS_MUC_INFO, 'muc#roomconfig_roomname')
def muc_description(self):
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment