Commit 9625d0d5 authored by Svetlana Tkachenko's avatar Svetlana Tkachenko
Browse files

Support loaded'' without arguments (for issue #18)

parent 37ab5b7f
......@@ -41,6 +41,16 @@ class PluginLoader(object):
self.server.doMessage(channel, user + ": Available plugins: " + " ".join(list(sys.modules["irc"].plugins.pList.keys())))
return
elif cmd == "loaded": ########
loadedPl = [] ########
for item in (sys.modules["irc"].plugins.pList.keys()): ########
if self.server.pluginManager.loadedPlugin(item): ########
loadedPl.append(str(item)) ########
sortedPl = sorted(loadedPl) ######## ADDED
joinedPl = " | ".join(sortedPl) ######## old: joinedPl = " | ".join(loadedPl)
self.server.doMessage(channel, "Loaded plugins: " + joinedPl) ########
return
if len(args) < 1:
self.server.doMessage(channel, user + ": Not enough arguments.")
return
......@@ -84,13 +94,14 @@ class PluginLoader(object):
else:
self.server.doMessage(channel, user + ": No such plugin " + arg)
elif cmd == "loaded":
if self.server.pluginManager.loadedPlugin(args[0]):
self.server.doMessage(channel, user + ": Plugin " + args[0] + " is loaded")
else:
if self.server.pluginManager.pluginExists(args[0]):
self.server.doMessage(channel, user + ": Plugin " + args[0] + " is not loaded")
else:
self.server.doMessage(channel, user + ": Plugin " + args[0] + " does not exist")
# elif cmd == "loaded":
# if self.server.pluginManager.loadedPlugin(args[0]):
# self.server.doMessage(channel, user + ": Plugin " + args[0] + " is loaded")
# else:
# if self.server.pluginManager.pluginExists(args[0]):
# self.server.doMessage(channel, user + ": Plugin " + args[0] + " is not loaded")
# else:
# self.server.doMessage(channel, user + ": Plugin " + args[0] + " does not exist")
else:
self.server.doMessage(channel, user + ": You are not authorized to use this function. ")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment