67 |
69 |
68 function stream:hook(name, callback) |
70 function stream:hook(name, callback) |
69 return self.events.add_handler(name, callback); |
71 return self.events.add_handler(name, callback); |
70 end |
72 end |
71 |
73 |
|
74 function stream:add_plugin(name) |
|
75 if require("verse.plugins."..name) then |
|
76 local ok, err = verse.plugins[name](self); |
|
77 if ok then |
|
78 self:debug("Loaded %s plugin", name); |
|
79 else |
|
80 self:warn("Failed to load %s plugin: %s", name, err); |
|
81 end |
|
82 end |
|
83 return self; |
|
84 end |
|
85 |
72 -- Listener factory |
86 -- Listener factory |
73 function new_listener(stream) |
87 function new_listener(stream) |
74 local conn_listener = {}; |
88 local conn_listener = {}; |
75 |
89 |
76 function conn_listener.incoming(conn, data) |
90 function conn_listener.incoming(conn, data) |