]>
jfr.im git - irc/evilnet/x3.git/blob - src/plugins/__init__.py
abf4a5af081476d6ca81a44a20c6c0b251326d07
5 def server_link(self
, server
):
8 def new_user(self
, user
):
11 def nick_change(self
, user
, oldnick
):
14 def del_user(self
, user
, killer
, why
):
17 def topic(self
, who
, chan
, old_topic
):
20 def load_path(path
, prefix
):
23 for entry
in os
.listdir(path
):
24 if os
.path
.isfile(os
.path
.join(path
, entry
)):
25 if os
.path
.splitext(entry
)[1] != '.py':
28 if entry
.startswith('.') or entry
.startswith('__'):
32 args
= imp
.find_module(os
.path
.splitext(entry
)[0], [path
])
37 mod
= imp
.load_module(prefix
+ os
.path
.splitext(entry
)[0], *args
)
43 if os
.path
.isdir(os
.path
.join(path
, entry
)):
44 mods
.extend(load_path(os
.path
.join(path
, entry
), prefix
+ entry
+ '.'))
49 mods
= load_path(os
.path
.dirname(__file__
), 'plugins.')
52 # for some reason this returns multiple instances of the same plugin types
53 candidates
= Plugin
.__subclasses
__()
54 for plg
in candidates
:
55 if plg
.__name
__ not in plugins
:
56 plugins
[plg
.__name
__] = plg()
58 return plugins
.values()