Module:UserLinks/extra

---------------------------------------------------------------------------------- This module holds extra link functions for use with [[Module:UserLinks]].---- It is intended for experimenting with new link functions that will eventually-- be added to the main module code.---- Since this module is transcluded in only a small number of pages, changes-- should cause little server overhead and should propagate quickly.---- Link functions using the same link code as a function in the main module will-- be ignored; please give your function a unique code.---------------------------------------------------------------------------------- Load shared helper functionslocal mShared = require('Module:UserLinks/shared')local raiseError = mShared.raiseErrorlocal makeWikitextError = mShared.makeWikitextErrorlocal makeWikilink = mShared.makeWikilinklocal makeUrlLink = mShared.makeUrlLinklocal makeFullUrlLink = mShared.makeFullUrlLinklocal message = mShared.messagelocal linkFunctions = {}function linkFunctions.coibot(snippets)-- COIBot reportreturn makeWikilink(nil,4,'WikiProject Spam/UserReports/' .. snippets.username,'COIBot')endfunction linkFunctions.ggl(snippets)-- Google search for the usernamereturn makeUrlLink({host = 'www.google.com',path = '/search',query = {q = snippets.username},},'Google')endfunction linkFunctions.http(snippets)-- To see if an IP is serving a web pagelocal host = snippets.usernameif not host:match('^%d+%.%d+%.%d+%.%d+$') thenif host:match('^[%x:]+$') then-- It's IPv6, use RFC 3986 IP-Literal syntaxhost = '[' .. host .. ']'else-- It's neither IPv4 nor IPv6, return nothingreturn ''endendreturn makeUrlLink({protocol = 'http',host = host},'http')endfunction linkFunctions.msg(snippets)-- New message on user talk pagereturn makeFullUrlLink(snippets.interwiki,3,snippets.username,{action = 'edit',section = 'new',},'message')endfunction linkFunctions.rbl(snippets)-- Realtime blacklistsreturn makeUrlLink({protocol = 'https',host = 'www.robtex.com',path = '/ip-lookup/' .. snippets.username .. '#dnsbl',},'RBLs')endfunction linkFunctions.rdns(snippets)-- Reverse DNS lookupreturn makeUrlLink({protocol = 'https',host = 'www.dnswatch.info',path = '/dns/dnslookup',query = {la = 'en',host = snippets.username,submit = 'Resolve'}},'RDNS')endfunction linkFunctions.sbx(snippets)-- User sandboxreturn makeWikilink(snippets.interwiki,2,snippets.username .. '/sandbox','sandbox')endfunction linkFunctions.sfs(snippets)-- StopForumSpamreturn makeUrlLink({protocol = 'https',host = 'www.stopforumspam.com',path = '/search/' .. snippets.username,},'StopForumSpam')endfunction linkFunctions.sul2(snippets)-- Global contribs, Luxo's toolreturn makeUrlLink({host = 'tools.wmflabs.org',path = '/guc/index.php',query = {user = snippets.username,lang = snippets.toolLang}},'global contribs')endfunction linkFunctions.uc(snippets)-- User creationreturn makeWikilink(snippets.interwiki,-1,'Log/newusers/' .. snippets.username,'user creation')endfunction linkFunctions.whois(snippets)-- WHOIS information for IPsreturn makeUrlLink({protocol = 'https',host = 'tools.wmflabs.org',path = '/whois/gateway.py',query = {lookup = 'true',ip = snippets.username,},},'WHOIS')endfunction linkFunctions.wlh(snippets)-- Links to user page (what links here)return makeWikilink(snippets.interwiki,-1,'WhatLinksHere/'.. mw.site.namespaces[2].name.. ':'.. snippets.username,'links to user page')endfunction linkFunctions.cr(snippets)-- Change rightsreturn makeWikilink(snippets.interwiki,-1,'UserRights/' .. snippets.username,'change rights')endreturn {linkFunctions = linkFunctions}