# HG changeset patch # User Kim Alvefur # Date 1355657342 -3600 # Node ID 3126026052691f176d5f9dea2859b0e899754555 # Parent 3a17fc0127b1299d056aab1f65db46ea77a279a2 mod_vjud: Do case-insensitive matching diff -r 3a17fc0127b1 -r 312602605269 mod_vjud/mod_vjud.lua --- a/mod_vjud/mod_vjud.lua Sun Dec 16 12:35:43 2012 +0100 +++ b/mod_vjud/mod_vjud.lua Sun Dec 16 12:29:02 2012 +0100 @@ -6,6 +6,8 @@ local jid_split = require "util.jid".prepped_split; local vcard = module:require "vcard"; local rawget, rawset = rawget, rawset; +local s_lower = string.lower; +local s_find = string.find; local st = require "util.stanza"; local template = require "util.template"; @@ -116,11 +118,11 @@ else for username in pairs(opted_in) do local vCard = get_user_vcard(username); - if vCard and ( - (vCard.N and vCard.N[2] == first) or - (vCard.N and vCard.N[1] == last) or - (vCard.NICKNAME and vCard.NICKNAME[1] == nick) or - (vCard.EMAIL and vCard.EMAIL[1] == email)) then + if vCard + and ((first and vCard.N and s_find(s_lower(vCard.N[2]), first, nil, true)) + or (last and vCard.N and s_find(s_lower(vCard.N[1]), last, nil, true)) + or (nick and vCard.NICKNAME and s_find(s_lower(vCard.NICKNAME[1]), nick, nil, true)) + or (email and vCard.EMAIL and s_find(s_lower(vCard.EMAIL[1]), email, nil, true))) then reply:add_child(item_template.apply{ jid = username..at_host; first = vCard.N and vCard.N[2] or nil;