コード例 #1
0
 def get_utc(self):
     """
     Return the time in UTC as a datetime object.
     """
     value = self._get_sub_text('utc')
     if value == '':
         return xep_0082.parse(xep_0082.datetime())
     return xep_0082.parse('%sZ' % value)
コード例 #2
0
ファイル: stanza.py プロジェクト: 2M1R/SleekXMPP
 def get_utc(self):
     """
     Return the time in UTC as a datetime object.
     """
     value = self._get_sub_text('utc')
     if value == '':
         return xep_0082.parse(xep_0082.datetime())
     return xep_0082.parse('%sZ' % value)
コード例 #3
0
ファイル: stanza.py プロジェクト: calendar42/SleekXMPP
 def get_timestamp(self):
     """
     Return the value of the <timestamp> element as a DateTime.
     """
     p = self._get_sub_text('timestamp')
     if not p:
         return None
     else:
         return xep_0082.datetime(p)
コード例 #4
0
 def get_timestamp(self):
     """
     Return the value of the <timestamp> element as a DateTime.
     """
     p = self._get_sub_text('timestamp')
     if not p:
         return None
     else:
         return xep_0082.datetime(p)
コード例 #5
0
ファイル: stanza.py プロジェクト: calendar42/SleekXMPP
    def set_timestamp(self, timestamp):
        """
        Set the value of the <timestamp> element.

        Arguments:
            timestamp -- UTC timestamp specifying the moment when
                         the reading was taken
        """
        self._set_sub_text('timestamp', text=str(xep_0082.datetime(timestamp)))
        return self
コード例 #6
0
    def set_timestamp(self, timestamp):
        """
        Set the value of the <timestamp> element.

        Arguments:
            timestamp -- UTC timestamp specifying the moment when
                         the reading was taken
        """
        self._set_sub_text('timestamp', text=str(xep_0082.datetime(timestamp)))
        return self
コード例 #7
0
ファイル: time.py プロジェクト: taoGit/SleekXMPP
    def plugin_init(self):
        """Start the XEP-0203 plugin."""
        self.tz_offset = self.config.get('tz_offset', 0)

        # As a default, respond to time requests with the
        # local time returned by XEP-0082. However, a
        # custom function can be supplied which accepts
        # the JID of the entity to query for the time.
        self.local_time = self.config.get('local_time', None)
        if not self.local_time:
            self.local_time = lambda x: xep_0082.datetime(offset=self.tz_offset
                                                          )

        self.xmpp.registerHandler(
            Callback('Entity Time', StanzaPath('iq/entity_time'),
                     self._handle_time_request))
        register_stanza_plugin(Iq, stanza.EntityTime)

        self.xmpp['xep_0030'].add_feature('urn:xmpp:time')
コード例 #8
0
ファイル: time.py プロジェクト: PADGETS-EU/padgets-repo
    def plugin_init(self):
        """Start the XEP-0203 plugin."""
        self.tz_offset = self.config.get('tz_offset', 0)

        # As a default, respond to time requests with the
        # local time returned by XEP-0082. However, a
        # custom function can be supplied which accepts
        # the JID of the entity to query for the time.
        self.local_time = self.config.get('local_time', None)
        if not self.local_time:
            self.local_time = lambda x: xep_0082.datetime(offset=self.tz_offset)

        self.xmpp.registerHandler(
            Callback('Entity Time',
                 StanzaPath('iq/entity_time'),
                 self._handle_time_request))
        register_stanza_plugin(Iq, stanza.EntityTime)

        self.xmpp['xep_0030'].add_feature('urn:xmpp:time')
コード例 #9
0
ファイル: time.py プロジェクト: AmiZya/emesene
 def default_local_time(jid):
     return xep_0082.datetime(offset=self.tz_offset)
コード例 #10
0
ファイル: time.py プロジェクト: sie249aa/ThingPot
 def default_local_time(jid):
     return xep_0082.datetime(offset=self.tz_offset)