# HG changeset patch # User Matthew Wild # Date 1323495987 0 # Node ID 4e2dfd73265e6ff3c79775a768cf2453af32130a Initial commit diff -r 000000000000 -r 4e2dfd73265e bridge.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bridge.lua Sat Dec 10 05:46:27 2011 +0000 @@ -0,0 +1,32 @@ +local module_name; + +local verse = require "verse".init("component"); + +local conn = verse.new(); + +local origin = { + send = function (stanza) + conn:send(stanza); + end; +}; + +local module_env = {}; + +function handle_connect() + local _log = logger.init(module_name); + module_env.module = setmetatable({ + name = module_name; + path = module_path + host = conn.host; + _log = _log; + log = function (self, ...) return _log(...); end; + }, { __index = api }); +end + +function handle_stanza(stanza) + +end + +conn:hook("stanza", handle_stanza); + +conn:connect_component("localhost"); diff -r 000000000000 -r 4e2dfd73265e module_api.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/module_api.lua Sat Dec 10 05:46:27 2011 +0000 @@ -0,0 +1,23 @@ +function api:get_name() + return self.name; +end + +function api:get_host() + return self.host; +end + +function api:get_host_type() + return "component"; +end + +function api:set_global() +end + +function api:fire_event(event, ...) + return self.stream:event("bridge/"..event, ...); +end + +function api:hook(event, handler, priority) + return self.stream:hook("bridge/"..event, handler, priority); +end +