# HG changeset patch # User Emmanuel Gil Peyrot # Date 1538145096 -7200 # Node ID 2e65160187a4723574f25b2bbc435e5fe50d9492 # Parent 3aa5419e3576611db9c880fff7e9f6d64e4e528d mod_bob: Simplify check_cid using string.match. (thanks Zash!) diff -r 3aa5419e3576 -r 2e65160187a4 mod_bob/mod_bob.lua --- a/mod_bob/mod_bob.lua Fri Sep 28 16:12:18 2018 +0200 +++ b/mod_bob/mod_bob.lua Fri Sep 28 16:31:36 2018 +0200 @@ -12,11 +12,7 @@ local in_flight = {}; local function check_cid(src) - -- TODO: figure out why ^ can’t be used at the beginning of the pattern. - for cid in src:gmatch("cid:(%w+%+%w+@bob%.xmpp%.org)$") do - return cid; - end - return nil; + return src:match("^cid:(%w+%+%w+@bob%.xmpp%.org)$"); end local function handle_data_carrier(tag)