Initial commit default tip

Sat, 10 Dec 2011 05:46:27 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 10 Dec 2011 05:46:27 +0000
changeset 0
4e2dfd73265e

Initial commit

bridge.lua file | annotate | diff | comparison | revisions
module_api.lua file | annotate | diff | comparison | revisions
--- /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");
--- /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
+

mercurial