Merge pull request #376 from Digital-Lemon/testing

Network: Added @uptime && Irc.startedAt attribute
This commit is contained in:
Valentin Lorentz 2012-07-05 02:34:26 -07:00
commit c31b6ed5c6
2 changed files with 13 additions and 0 deletions

View File

@ -317,6 +317,18 @@ class Network(callbacks.Plugin):
irc.reply(otherIrc.driver.__class__.__module__[8:])
driver = wrap(driver, ['networkIrc'])
@internationalizeDocstring
def uptime(self, irc, msg, args, otherIrc):
"""[<network>]
Returns the time duration since the connection was established.
"""
network = otherIrc.network
now = time.time()
started = otherIrc.startedAt
irc.reply(_("I've been connected to %s for %s.") %
(network, utils.timeElapsed(now - started)))
uptime = wrap(uptime, ['networkIrc'])
Class = Network

View File

@ -615,6 +615,7 @@ class Irc(IrcCommandDispatcher):
self.zombie = False
world.ircs.append(self)
self.network = network
self.startedAt = time.time()
self.callbacks = callbacks
self.state = IrcState()
self.queue = IrcMsgQueue()