Changeset

3343:2e65160187a4

mod_bob: Simplify check_cid using string.match. (thanks Zash!)
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 28 Sep 2018 16:31:36 +0200 (2018-09-28)
parents 3342:3aa5419e3576
children 3344:0ce475235ae1
files mod_bob/mod_bob.lua
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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)