Commit 1ad64ce5 authored by elfangor's avatar elfangor Committed by Romain Bignon

first commit "find game"

parent d935a5eb
......@@ -36,12 +36,20 @@ from random import choice
from optparse import OptionParser
class Logger(list):
score = list() #TODO
def log_message(self, nickname):
self.append((datetime.datetime.now().strftime('%H:%M:%S'), nickname))
class Channel(object):
def __init__(self, server, name):
self.server = server
self.name = name
self.members = set()
self.topic = ""
self.logger = Logger()
def add_member(self, client):
self.members.add(client)
......@@ -171,6 +179,7 @@ class Client(object):
def message_channel(self, channel, command, message, include_self=False):
line = ":%s %s %s" % (channel.anon_prefix, command, message)
channel.logger.log_message(self.nickname)
for client in channel.members:
if client != self or include_self:
client.message(line)
......@@ -437,6 +446,23 @@ class Client(object):
self.reply("401 %s %s :No such nick"
% (self.nickname, args[0]))
@check_registered
def on_kick(self, args):
if len(args) < 2:
self.reply_461("KICK")
return
channelname = args[0]
timestamp = args[1]
nickname = args[2]
channel = self.channels.get(irc_lower(channelname))
if not channel:
self.reply("442 %s :You're not on that channel" % channelname)
if (timestamp, nickname) in channel.logger:
self.message_channel(channel, "PRIVMSG", "%s :%s has found %s" % (channel.name, self.nickname, nickname), True)
else:
self.reply("Failed!")
class Server(object):
def __init__(self, options):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment