plugins/resolvejid.lua

Sat, 23 Jan 2016 15:16:36 +0100

author
Kim Alvefur <zash@zash.se>
date
Sat, 23 Jan 2016 15:16:36 +0100
changeset 135
87e58c58a08d
parent 105
4234c8789cc6
permissions
-rw-r--r--

plugins.ietf: Include a link in reply if an RFC number was given but no match found

function riddim.plugins.resolvejid(bot)
	function bot:resolvejid(jid, room)
		local nows = jid:match"%S+"
		local trimd = jid:match"^%s*(.-)%s*$"
		if room then
			local occupant = room.occupants[jid]
			or room.occupants[trimd]
			or room.occupants[nows]
			if occupant then return occupant.jid end
		end
		return nows
	end
end

mercurial