aboutsummaryrefslogtreecommitdiffstats
path: root/src/irc/ctcp.lua
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2007-09-04 15:08:37 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2007-09-04 15:08:37 -0500
commitafc85f7e9b75e0c7e7f4f87fc6b2bd5448e880d5 (patch)
tree502c0210f4af2b6c93abcaf54e8299eec36cafef /src/irc/ctcp.lua
parent7b7a24c3f27b74e95c24e62917bcc4ba8478196d (diff)
downloadluairc-afc85f7e9b75e0c7e7f4f87fc6b2bd5448e880d5.tar.gz
luairc-afc85f7e9b75e0c7e7f4f87fc6b2bd5448e880d5.zip
start changing things over from testing for type (string/table) to find ctcp messages to making things more explicit. this fixes _ctcp_split.
Diffstat (limited to 'src/irc/ctcp.lua')
-rw-r--r--src/irc/ctcp.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/irc/ctcp.lua b/src/irc/ctcp.lua
index 1866122..5848416 100644
--- a/src/irc/ctcp.lua
+++ b/src/irc/ctcp.lua
@@ -71,13 +71,17 @@ end
-- }}}
-- _ctcp_split {{{
--- TODO: again with this string/table thing... it's ugly!
--
-- Splits a low level dequoted string into normal text and unquoted CTCP
-- messages.
-- @param str Low level dequoted string
--- @return Array, where string values correspond to plain text, and table
--- values have t[1] as the CTCP message
+-- @return Array of tables, with each entry in the array corresponding to one
+-- part of the split message. These tables will have these fields:
+-- <ul>
+-- <li><i>str:</i> The text of the split section</li>
+-- <li><i>ctcp:</i> True if the section was a CTCP message, false
+-- otherwise</li>
+-- </ul>
function _ctcp_split(str)
local ret = {}
local iter = 1
@@ -93,11 +97,11 @@ function _ctcp_split(str)
end
if plain_string ~= "" then
- table.insert(ret, plain_string)
+ table.insert(ret, {str = plain_string, ctcp = false})
end
if not s then break end
if ctcp_string ~= "" then
- table.insert(ret, {_ctcp_dequote(ctcp_string)})
+ table.insert(ret, {str = _ctcp_dequote(ctcp_string), ctcp = true})
end
iter = e + 1