diff --git a/RelayNext/README.md b/RelayNext/README.md index ee7ae71..0b39458 100644 --- a/RelayNext/README.md +++ b/RelayNext/README.md @@ -31,8 +31,17 @@ The `list` command will list all relays defined. ### Removing/clearing relays -The `unset` command removes a relay name, while the `clear` command clears all relays. The `remove` command removes individual channels from a relay, deleting it completely when the amount of channels is less than 2. +Once a relay is created, you can remove the relays (or channels within them) using the `remove` command. There is also a `clear` command which clears all relays. +To remove channels from an existing relay: + +* `relaynext remove Your-relay-name #channel1@networkone #blah@networktwo` + +Or, to delete an entire relay: + +* `relaynext remove Your-relay-name` + +Relays require at least two channels to relay between. When the last two channels are removed, the relay is automatically deleted. ## Configuration ### Relaying non-PRIVMSG events diff --git a/RelayNext/plugin.py b/RelayNext/plugin.py index 795b26c..bda1b4a 100644 --- a/RelayNext/plugin.py +++ b/RelayNext/plugin.py @@ -440,21 +440,23 @@ class RelayNext(callbacks.Plugin): many('somethingWithoutSpaces')]) def remove(self, irc, msg, args, rid, relays): - """ + """ [] Removes from relay . is a space separated list of #channel@network combinations, where is the name of your network. is the name of your relay, which can be a - number, string, etc. + number, string, etc. If is not given, removes the entire + relay. """ try: current_relays = self.db[rid] except KeyError: irc.error("No such relay '%s' exists." % rid, Raise=True) - if type(relays) == list: - relays = list(map(str.lower, relays)) - else: - relays = [relays.lower()] + if not relays: + del self.db[rid] + irc.replySuccess() + return + relays = list(map(str.lower, relays)) self.checkRelays(irc, relays) for relay in relays: current_relays.discard(relay) @@ -462,20 +464,7 @@ class RelayNext(callbacks.Plugin): del self.db[rid] irc.replySuccess() remove = wrap(remove, ['admin', 'somethingWithoutSpaces', - many('somethingWithoutSpaces')]) - - def unset(self, irc, msg, args, rid): - """ - - Removes relay . - """ - try: - del self.db[rid] - except KeyError: - irc.error("No such relay '%s' exists." % rid, Raise=True) - else: - irc.replySuccess() - unset = wrap(unset, ['admin', 'somethingWithoutSpaces']) + any('somethingWithoutSpaces')]) def list(self, irc, msg, args): """takes no arguments.