mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
Implement /TIME support (#228)
This commit is contained in:
parent
a76bd8c5b2
commit
94aee8f05c
@ -1,9 +1,11 @@
|
||||
"""
|
||||
handlers.py - Implements miscellaneous IRC command handlers (WHOIS, services login, etc.)
|
||||
"""
|
||||
import time
|
||||
|
||||
from pylinkirc import utils, conf
|
||||
from pylinkirc.log import log
|
||||
|
||||
def handle_whois(irc, source, command, args):
|
||||
"""Handle WHOIS queries."""
|
||||
target = args['target']
|
||||
@ -146,3 +148,9 @@ def handle_version(irc, source, command, args):
|
||||
fullversion = irc.version()
|
||||
irc.proto.numeric(irc.sid, 351, source, fullversion)
|
||||
utils.add_hook(handle_version, 'VERSION')
|
||||
|
||||
def handle_time(irc, source, command, args):
|
||||
"""Handles requests for the PyLink server time."""
|
||||
timestring = time.ctime()
|
||||
irc.proto.numeric(irc.sid, 391, source, '%s :%s' % (irc.hostname(), timestring))
|
||||
utils.add_hook(handle_time, 'TIME')
|
||||
|
@ -82,3 +82,7 @@ class IRCS2SProtocol(Protocol):
|
||||
# <- ABAAB Q :Killed (GL_ (bangbang))
|
||||
self.removeClient(numeric)
|
||||
return {'text': args[0]}
|
||||
|
||||
def handle_time(self, numeric, command, args):
|
||||
"""Handles incoming /TIME requests."""
|
||||
return {'target': args[0]}
|
||||
|
Loading…
Reference in New Issue
Block a user