Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
brownan committed Oct 6, 2012
2 parents c902a29 + 4c89e63 commit e544455
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 deletions.
3 changes: 3 additions & 0 deletions abbott/entrypt.py
Expand Up @@ -7,6 +7,9 @@
import sys

def main():
if len(sys.argv) < 2:
print "Usage: %s <config dir>" % sys.argv[0]
sys.exit(1)
transportobj = transport.Transport()
boss = pluginbase.PluginBoss(sys.argv[1], transportobj)

Expand Down
19 changes: 18 additions & 1 deletion abbott/pluginbase.py
Expand Up @@ -3,6 +3,7 @@
import UserDict
import os
import os.path
import sys

from twisted.internet import defer

Expand All @@ -16,7 +17,7 @@ def __init__(self, jsonfile):
"""Initialize a config from a json file."""
self._jsonfile = jsonfile
with open(jsonfile, 'r') as inp:
self.data= json.load(inp)
self.data = json.load(inp)

def save(self):
with open(self._jsonfile+"~", 'w') as out:
Expand All @@ -38,6 +39,12 @@ def __init__(self, config, transport):
self._filename = os.path.join(config, "config.json")

self.loaded_plugins = {}

if not os.path.exists(self._configdir):
os.mkdir(self._configdir)
elif not os.path.isdir(self._configdir):
print("The config parameter should be a directory. Please make the necessary adjustments")
sys.exit(1)

try:
self._load()
Expand Down Expand Up @@ -91,8 +98,15 @@ def _seed_defaults(self):
'irc.IRCBotPlugin',
'irc.IRCController',
'ircutil.ReplyInserter',
# whois and names probably aren't necessary unless
# you're also running the ircadmin plugins, but just
# in case, it can't hurt.
'ircutil.IRCWhois',
'ircutil.Names',
'auth.Auth',
'plugincontroller.PluginController',
'corecontrol.CoreControl',
'corecontrol.Help',
],
},
'plugin_config': {
Expand All @@ -112,6 +126,9 @@ def _seed_defaults(self):
},
},
},
'command': {
"prefix": None,
},
}
self.save()

Expand Down
32 changes: 16 additions & 16 deletions abbott/plugins/ircutil.py
Expand Up @@ -44,14 +44,14 @@ def start(self):

self.listen_for_event("irc.on_unknown")

self.install_command(
cmdname="whois",
argmatch=r"(?P<nick>[^ ]+)",
callback=self.do_whois,
cmdusage="<nick>",
helptext="Does a whois and prints the results. This command is meant for debugging.",
permission="irc.whois",
)
#self.install_command(
# cmdname="whois",
# argmatch=r"(?P<nick>[^ ]+)",
# callback=self.do_whois,
# cmdusage="<nick>",
# helptext="Does a whois and prints the results. This command is meant for debugging.",
# permission="irc.whois",
# )

# nick of the current whois that is coming in on the wire right this
# moment
Expand Down Expand Up @@ -142,14 +142,14 @@ def start(self):

self.listen_for_event("irc.on_unknown")

self.install_command(
cmdname="names",
argmatch=r"(?P<channel>\S+)?$",
cmdusage="[channel]",
callback=self.do_names,
helptext="Does an IRC NAMES command and replies with the result",
permission="irc.names",
)
#self.install_command(
# cmdname="names",
# argmatch=r"(?P<channel>\S+)?$",
# cmdusage="[channel]",
# callback=self.do_names,
# helptext="Does an IRC NAMES command and replies with the result",
# permission="irc.names",
# )

self.currentinfo = []
self.pending = defaultdict(set)
Expand Down

0 comments on commit e544455

Please sign in to comment.