diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2007-09-04 21:58:27 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2007-09-04 21:58:27 -0500 |
commit | 16a65213dcafa306f3d901762d36751a3f456979 (patch) | |
tree | fa06dcc28b49fef1ff687886f7d4aabcdcaa1f36 /src | |
parent | 9e7fab4e4c1bd7b179b3fd72a40b1d9c3a669e3b (diff) | |
download | luairc-16a65213dcafa306f3d901762d36751a3f456979.tar.gz luairc-16a65213dcafa306f3d901762d36751a3f456979.zip |
convert parse_user to an internal function, since apparently that's how i've been using it
Diffstat (limited to 'src')
-rw-r--r-- | src/irc.lua | 4 | ||||
-rw-r--r-- | src/irc/misc.lua | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/irc.lua b/src/irc.lua index b63a08c..49a11d3 100644 --- a/src/irc.lua +++ b/src/irc.lua @@ -103,7 +103,7 @@ local function incoming_message(sock) local msg = message._parse(raw_msg) misc._try_call_warn("Unhandled server message: " .. msg.command, handlers["on_" .. msg.command:lower()], - (misc.parse_user(msg.from)), base.unpack(msg.args)) + (misc._parse_user(msg.from)), base.unpack(msg.args)) return true end -- }}} @@ -207,7 +207,7 @@ function handlers.on_topic(from, chan, new_topic) base.assert(serverinfo.channels[chan], "Received topic message for unknown channel: " .. chan) serverinfo.channels[chan]._topic.text = new_topic - serverinfo.channels[chan]._topic.user = (misc.parse_user(from)) + serverinfo.channels[chan]._topic.user = from serverinfo.channels[chan]._topic.time = os.time() if serverinfo.channels[chan].join_complete then callback("topic_change", serverinfo.channels[chan]) diff --git a/src/irc/misc.lua b/src/irc/misc.lua index bf4a671..92c3ac4 100644 --- a/src/irc/misc.lua +++ b/src/irc/misc.lua @@ -273,17 +273,15 @@ function _value_iter(state, arg, pred) return val end -- }}} --- }}} --- public functions {{{ --- parse_user {{{ ---- +-- _parse_user {{{ +-- -- Gets the various parts of a full username. -- @param user A usermask (i.e. returned in the from field of a callback) -- @return nick -- @return username (if it exists) -- @return hostname (if it exists) -function parse_user(user) +function _parse_user(user) local found, bang, nick = user:find("^([^!]*)!") if found then user = user:sub(bang + 1) |