topic_setter should be stored as a Hostmask

This commit is contained in:
jesopo 2019-09-16 18:38:46 +01:00
parent 7e67b07ada
commit 03892d0ae3
2 changed files with 4 additions and 10 deletions

View file

@ -21,8 +21,7 @@ def handle_333(events, event):
topic_setter = utils.irc.seperate_hostmask(event["line"].args[2])
topic_time = int(event["line"].args[3])
channel.set_topic_setter(topic_setter.nickname, topic_setter.username,
topic_setter.hostname)
channel.set_topic_setter(topic_setter)
channel.set_topic_time(topic_time)
events.on("received.333").call(channel=channel,
setter=topic_setter.nickname, set_at=topic_time, server=event["server"])

View file

@ -14,9 +14,7 @@ class Channel(IRCObject.Object):
self.server = server
self.bot = bot
self.topic = ""
self.topic_setter_nickname = None # type: typing.Optional[str]
self.topic_setter_username = None # type: typing.Optional[str]
self.topic_setter_hostname = None # type: typing.Optional[str]
self.topic_setter = None # type: typing.Optional[str]
self.topic_time = 0
self.users = set([]) # type: typing.Set[IRCUser.User]
self.modes = {} # type: typing.Dict[str, typing.Set]
@ -33,11 +31,8 @@ class Channel(IRCObject.Object):
def set_topic(self, topic: str):
self.topic = topic
def set_topic_setter(self, nickname: str, username: str=None,
hostname: str=None):
self.topic_setter_nickname = nickname
self.topic_setter_username = username
self.topic_setter_hostname = hostname
def set_topic_setter(self, hostmask: IRCLine.Hostmask):
self.topic_setter = hostmask
def set_topic_time(self, unix_timestamp: int):
self.topic_time = unix_timestamp