aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2007-09-04 15:44:39 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2007-09-04 15:44:39 -0500
commit861fd354eabf4482d3554c3c307c23c09caf31be (patch)
tree47055be89bb20151f098f09809c8d551832299a2
parentafc85f7e9b75e0c7e7f4f87fc6b2bd5448e880d5 (diff)
downloadluairc-861fd354eabf4482d3554c3c307c23c09caf31be.tar.gz
luairc-861fd354eabf4482d3554c3c307c23c09caf31be.zip
make low_quote and ctcp_quote take multiple arguments, so they look cleaner
-rw-r--r--src/irc/ctcp.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/irc/ctcp.lua b/src/irc/ctcp.lua
index 5848416..c77cae8 100644
--- a/src/irc/ctcp.lua
+++ b/src/irc/ctcp.lua
@@ -15,9 +15,10 @@ module "irc.ctcp"
--
-- Applies low level quoting to a string (escaping characters which are illegal
-- to appear in an IRC packet).
--- @param str String to quote
+-- @param ... Strings to quote together, space separated
-- @return Quoted string
-function _low_quote(str)
+function _low_quote(...)
+ local str = table.concat({...}, " ")
return str:gsub("[%z\n\r\020]", {["\000"] = "\0200",
["\n"] = "\020n",
["\r"] = "\020r",
@@ -45,9 +46,10 @@ end
--
-- Applies CTCP quoting to a block of text which has been identified as CTCP
-- data (by the calling program).
--- @param str String to apply CTCP quoting to
+-- @param ... Strings to apply CTCP quoting to together, space separated
-- @return String with CTCP quoting applied
-function _ctcp_quote(str)
+function _ctcp_quote(...)
+ local str = table.concat({...}, " ")
local ret = str:gsub("[\001\\]", {["\001"] = "\\a",
["\\"] = "\\\\"})
return "\001" .. ret .. "\001"