]> git.lizzy.rs Git - luairc.git/commitdiff
make low_quote and ctcp_quote take multiple arguments, so they look cleaner
authorjluehrs2 <jluehrs2@uiuc.edu>
Tue, 4 Sep 2007 20:44:39 +0000 (15:44 -0500)
committerjluehrs2 <jluehrs2@uiuc.edu>
Tue, 4 Sep 2007 20:44:39 +0000 (15:44 -0500)
src/irc/ctcp.lua

index 5848416411cf8a4c79837dcecebeb932510cbe5a..c77cae84ac768f3601f643ddeecd04bf5c7cd265 100644 (file)
@@ -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"