Пример #1
0
    def from_user(self, username, hostname, servername, realname, *_):
        if not self.actor.is_user():
            self.actor.user = self.user = User(None)

        if self.user.registered.user:
            return ERR_ALREADYREGISTRED(self.actor)

        self.user.username = username
        self.user.hostname = self.actor.socket.getpeername()[0]
        try:
            addr = reversename.from_address(self.user.hostname)
            self.user.hostname = str(resolver.query(addr, "PTR")[0])
        except:
            pass
        self.user.servername = config.get('server', 'servername')
        self.user.realname = realname

        self.user.registered.user = True

        if self.user.registered.nick:
            self.user.save()
            return welcome(self.actor)
Пример #2
0
 def register(self):
     self.user.nickname = self.params.nick
     self.user.registered.nick = True
     self.user.save()
     return welcome(self.actor) + [M(self.actor, 'NICK', self.params.nick)]
Пример #3
0
 def register(self):
     self.user.nickname = self.params.nick
     self.user.registered.nick = True
     self.user.save()
     return welcome(self.actor) + [M(self.actor, 'NICK', self.params.nick)]