Changeset

298:1897dc6a07bb

util.vcard: Don't use module()
author Kim Alvefur <zash@zash.se>
date Sun, 13 May 2012 20:14:32 +0200
parents 297:447dffdaf46c
children 299:a86d83ad1fea
files util/vcard.lua
diffstat 1 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/util/vcard.lua	Fri Apr 20 04:12:49 2012 +0200
+++ b/util/vcard.lua	Sun May 13 20:14:32 2012 +0200
@@ -1,4 +1,4 @@
--- Copyright (C) 2011 Kim Alvefur
+-- Copyright (C) 2011-2012 Kim Alvefur
 -- 
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
@@ -14,7 +14,9 @@
 local type = type;
 local next, pairs, ipairs = next, pairs, ipairs;
 
-module "vcard"
+local lua_to_text, lua_to_xep54, text_to_lua, text_to_xep54, xep54_to_lua, xep54_to_text;
+--[[ TODO local from_text, to_text, from_xep54, to_xep54; --]]
+
 
 local vCard_dtd;
 
@@ -36,7 +38,7 @@
 	});
 end
 
-function text_to_xep54(data)
+local function text_to_xep54(data)
 	--[[ TODO
 	return lua_to_xep54(text_to_lua(data));
 	--]]
@@ -111,7 +113,7 @@
 	return c;
 end
 
-function text_to_lua(data) --table
+local function text_to_lua(data) --table
 	data = data
 		:gsub("\r\n","\n")
 		:gsub("\n ", "")
@@ -273,7 +275,7 @@
 		:gsub(("."):rep(75), "%0\r\n "):gsub("\r\n $","");
 end
 
-function xep54_to_text(vCard)
+local function xep54_to_text(vCard)
 	--[[ TODO
 	return lua_to_text(xep54_to_lua(vCard))
 	--]]
@@ -372,7 +374,7 @@
 	return t
 end
 
-function xep54_to_lua(vCard)
+local function xep54_to_lua(vCard)
 	if vCard.attr.xmlns ~= "vcard-temp" then
 		return false
 	end
@@ -515,4 +517,16 @@
 };
 vCard_dtd.LOGO = vCard_dtd.PHOTO;
 vCard_dtd.SOUND = vCard_dtd.PHOTO;
-return _M
+
+return {
+	text_to_xep54 = text_to_xep54;
+	text_to_lua = text_to_lua;
+	xep54_to_text = xep54_to_text;
+	xep54_to_lua = xep54_to_lua;
+	--[[ TODO
+	from_text = from_text;
+	to_text = to_text;
+	from_xep54 = from_xep54;
+	to_xep54 = to_xep54;
+	--]]
+};