kameloso.plugins.webtitle

The Webtitle plugin catches URLs pasted in a channel, follows them and reports back the title of the web page that was linked to.

It has no bot commands; everything is done by automatically scanning channel and private query messages for things that look like links.

Members

Classes

TitleFetchException
class TitleFetchException

A normal Exception but with an HTTP status code attached.

WebtitlePlugin
class WebtitlePlugin

The Webtitle plugin catches HTTP URL links in messages, connects to their servers and and streams the web page itself, looking for the web page's title. This is then reported to the originating channel or personal query.

Functions

decodeEntities
auto decodeEntities(string line)

Removes unwanted characters from a string, and decodes HTML entities in it (like — and  ).

lookupURLs
void lookupURLs(WebtitlePlugin plugin, IRCEvent event, string[] urls)

Looks up the URLs in the passed string[] urls by spawning a worker thread to do all the work.

onEndOfMotd
void onEndOfMotd(WebtitlePlugin plugin, IRCEvent event)

Starts the persistent querier worker thread on end of MOTD.

onMessage
void onMessage(WebtitlePlugin plugin, IRCEvent event)

Parses a message to see if the message contains one or more URLs. Merely passes the event on to onMessageImpl.

onMessageImpl
void onMessageImpl(WebtitlePlugin plugin, IRCEvent event)

Parses a message to see if the message contains one or more URLs. Implementation function.

parseResponseIntoTitleLookupResult
auto parseResponseIntoTitleLookupResult(Response res)

Parses a requests Response into a TitleLookupResult.

persistentQuerier
void persistentQuerier(MutexedAA!(TitleLookupResult[int]) lookupBucket, string caBundleFile)

Persistent querier worker thread function.

rewriteDirectImgurURL
auto rewriteDirectImgurURL(string url)

Takes a direct imgur link (one that points to an image) and rewrites it to instead point to the image's page.

sendHTTPRequest
TitleLookupResult sendHTTPRequest(WebtitlePlugin plugin, string url, bool recursing, int id, string caller)

Issues an HTTP request by sending the details to the persistent querier thread, then returns the results after they become available in the shared associative array.

sendHTTPRequestImpl
auto sendHTTPRequestImpl(string url, string caBundleFile)

Fetches the contents of a URL, parses it into a TitleLookupResult and returns it.

setup
void setup(WebtitlePlugin plugin)

Initialises the lookup bucket, else its internal Mutex will be null and cause a segfault when trying to lock it.

teardown
void teardown(WebtitlePlugin plugin)

Stops the persistent querier worker threads.

waitForLookupResults
auto waitForLookupResults(WebtitlePlugin plugin, int id)

Given an int id, monitors the lookupBucket until a value with that key becomes available, delaying itself in between checks.

Static variables

descriptionExemptions
auto descriptionExemptions;

Hostnames explicitly exempt from having their descriptions included after the titles.

Structs

TitleLookupResult
struct TitleLookupResult

A record of a URL lookup.

WebtitleSettings
struct WebtitleSettings

All Webtitle settings, gathered in a struct.

See Also

Meta