Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Authentication module #2

Open
ghost opened this issue Dec 17, 2013 · 3 comments
Open

Authentication module #2

ghost opened this issue Dec 17, 2013 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 17, 2013

I don't know how much you would like to to have built in but a standard authentication module might be a good idea.

The one I wrote is a bit premature. I had a section in the config file for each host which contained nicks and passwords.

[irc.freenode.net]
nick = foo
nick_password = bar

[irc.geekshed.net]
nick = oof
nick_pasword = rab

The module could look something like this

class NickToolsModule(Module):
    """A KitnIRC module which automatically configures nick.  """

    @Module.handle("WELCOME")
    def register_nick(self, client, hostmask):

        _log.info("Beginning automatic nick configuration...")

        host = client.server.host
        if self.controller.config.has_option(str(host), "nick"):
            nick = self.controller.config.get(str(host), "nick")
            client.nick(nick)
        if self.controller.config.has_option(str(host), "nick_password"):
            nick_password = self.controller.config.get(str(host), "nick_password")
            client.msg("NickServ", "IDENTIFY {}".format(nick_password))

        _log.info("Automatic nick configuration complete.")
@ayust
Copy link
Owner

ayust commented Dec 17, 2013

Authentication tends to vary from server to server. While there are definitely patterns, there's no one standard; as such I've mostly been leaning towards putting authentication functionality in network-specific utility modules (e.g. kitnirc.contrib.freenode and kitnirc.contrib.foonetic).

That said, a generic "nickserv" module might not go amiss as another alternative for contrib/ - it'd cover cases where there isn't already a network-specific utility module, and while it wouldn't work for every network, it'd work for a lot of them.

@ghost
Copy link
Author

ghost commented Jan 7, 2014

If you were to implement the nickserv module how would implement the configs?

The following seams to fit with the existing code.

[nickserv]
nick@server = password

@ayust
Copy link
Owner

ayust commented Jan 8, 2014

The configs typically don't specify server, because the way they're laid out is usually for a single server (i.e. you'd have one config per network and run a separate instance of the bot per network you wanted it on). As such, it'd probably be more like...

[nickserv]
nick = BottyMcBotters
password = hunter2

nick could potentially be optional (and just result in a /msg nickserv identify no matter what the current nick was).

@ghost ghost mentioned this issue Jan 15, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant