]> git.lizzy.rs Git - luairc.git/blobdiff - src/irc/message.lua
add debug output to dcc transfers
[luairc.git] / src / irc / message.lua
index 27698d802ca39e487d7d6b6e747f2ae31695ea6c..e05e87e6e2eae31fe25b655bacc7bd2b5fe0f803 100644 (file)
@@ -1,3 +1,5 @@
+---
+-- Implementation of IRC server message parsing
 -- initialization {{{
 local base =      _G
 local constants = require 'irc.constants'
@@ -9,13 +11,30 @@ local string =    require 'string'
 local table =     require 'table'
 -- }}}
 
+---
+-- This module contains parsing functions for IRC server messages.
 module 'irc.message'
 
--- local functions {{{
--- parse() - parse a server command {{{
-function parse(str)
+-- internal functions {{{
+-- _parse {{{
+--
+-- Parse a server command.
+-- @param str Command to parse
+-- @return Table containing the parsed message. It contains:
+--         <ul>
+--         <li><i>from:</i>    The source of this message, in full usermask
+--                             form (nick!user@host) for messages originating
+--                             from users, and as a hostname for messages from
+--                             servers</li>
+--         <li><i>command:</i> The command sent, in name form if possible,
+--                             otherwise as a numeric code</li>
+--         <li><i>args:</i>    Array of strings corresponding to the arguments
+--                             to the received command</li>
+--
+--         </ul>
+function _parse(str)
     -- low-level ctcp quoting {{{
-    str = ctcp.low_dequote(str)
+    str = ctcp._low_dequote(str)
     -- }}}
     -- parse the from field, if it exists (leading :) {{{
     local from = ""
@@ -33,12 +52,12 @@ function parse(str)
         if constants.replies[base.tonumber(command)] then
             command = constants.replies[base.tonumber(command)]
         else
-            irc_debug.warn("Unknown server reply: " .. command)
+            irc_debug._warn("Unknown server reply: " .. command)
         end
     end
     -- }}}
     -- get the args {{{
-    local args = misc.split(argstr, " ", ":")
+    local args = misc._split(argstr, " ", ":")
     -- the first arg in a reply is always your nick
     if reply then table.remove(args, 1) end
     -- }}}