# Path: grazyna/irc/exc.py
# class NoSuchNickError(Exception):
#     nick = None
#     
#     def __init__(self, nick):
#         self.nick = nick
# 
#     def __repr__(self):
#         return 'NoSuchNickError(%s)' % self.nick
# 
#     def __str__(self):
#         return repr(self)
# 
#     def __eq__(self, other):
#         return self.nick == other.nick
# 
# Path: grazyna/irc/models.py
# class User(object):
#     """User class - has nick, realname, and host"""
#     nick = ""
#     host = ""
#     realname = ""
# 
#     def __init__(self, prefix):
#         try:
#             self.nick, _, name_host = prefix.partition('!')
#             self.realname, _, self.host = name_host.partition('@')
#         except:
#             pass
# 
#     @property
#     def prefix(self):
#         return "%s@%s" % (self.realname, self.host)
# 
#     def __repr__(self):
#         return "User('%s!%s')" % (self.nick, self.prefix)
# 
#     def __eq__(self, other):
#         if not isinstance(other, type(self)):
#             return False
# 
#         return (
#             self.nick == other.nick
#             and self.realname == other.realname
#             and self.host == other.host
#         )


from functools import wraps
from datetime import datetime
from asyncio import async
from grazyna.irc.exc import NoSuchNickError
from grazyna.irc.models import User
import os.path
import asyncio
        command = self.command.lower()
        command = self.NUMERIC_COMMANDS.get(command, command)
        method = getattr(self, 'command_%s' % command, None)

        if method is not None:
            method()

    def get_from_whois(self, pop=False):
        nick = self.data[3]
        heap = self.protocol.whois_heap
        return heap.get(nick) if not pop else heap.pop(nick, None)

    def log(self, channel, msg):
        str_datetime = datetime.now().strftime("%d-%m-%Y %H:%M:%S")
        if channel not in self.log_files:
            self.log_files[channel] = open(
                os.path.join(self.config.get('main', 'dir_log'), channel), "at"
            )
        file_log = self.log_files[channel]
        file_log.write('[%s] %s\r\n' % (str_datetime, msg))
        file_log.flush()

    def command_join(self):
        channel = self.data[2]
        self.log(channel, '%s(%s)::JOIN' % (self.user.nick, self.user.prefix))

    def command_ping(self):
        self.protocol.send('PONG', self.data[1])

    def command_pong(self):

# Path: grazyna/irc/exc.py
# class NoSuchNickError(Exception):
#     nick = None
#     
#     def __init__(self, nick):
#         self.nick = nick
# 
#     def __repr__(self):
#         return 'NoSuchNickError(%s)' % self.nick
# 
#     def __str__(self):
#         return repr(self)
# 
#     def __eq__(self, other):
#         return self.nick == other.nick
# 
# Path: grazyna/irc/models.py
# class User(object):
#     """User class - has nick, realname, and host"""
#     nick = ""
#     host = ""
#     realname = ""
# 
#     def __init__(self, prefix):
#         try:
#             self.nick, _, name_host = prefix.partition('!')
#             self.realname, _, self.host = name_host.partition('@')
#         except:
#             pass
# 
#     @property
#     def prefix(self):
#         return "%s@%s" % (self.realname, self.host)
# 
#     def __repr__(self):
#         return "User('%s!%s')" % (self.nick, self.prefix)
# 
#     def __eq__(self, other):
#         if not isinstance(other, type(self)):
#             return False
# 
#         return (
#             self.nick == other.nick
#             and self.realname == other.realname
#             and self.host == other.host
#         )


# Path: grazyna/irc/message_controller.py
from functools import wraps
from datetime import datetime
from asyncio import async
from grazyna.irc.exc import NoSuchNickError
from grazyna.irc.models import User
import os.path
import asyncio

        command = self.command.lower()
        command = self.NUMERIC_COMMANDS.get(command, command)
        method = getattr(self, 'command_%s' % command, None)

        if method is not None:
            method()

    def get_from_whois(self, pop=False):
        nick = self.data[3]
        heap = self.protocol.whois_heap
        return heap.get(nick) if not pop else heap.pop(nick, None)

    def log(self, channel, msg):
        str_datetime = datetime.now().strftime("%d-%m-%Y %H:%M:%S")
        if channel not in self.log_files:
            self.log_files[channel] = open(
                os.path.join(self.config.get('main', 'dir_log'), channel), "at"
            )
        file_log = self.log_files[channel]
        file_log.write('[%s] %s\r\n' % (str_datetime, msg))
        file_log.flush()

    def command_join(self):
        channel = self.data[2]
        self.log(channel, '%s(%s)::JOIN' % (self.user.nick, self.user.prefix))

    def command_ping(self):
        self.protocol.send('PONG', self.data[1])

    def command_pong(self):

        self.protocol.ping_counter = 0