free, distributed and user-friendly IRC client with Twitter, and XMPP/Jabber support for Linux, Windows and macOS based on GNOME / GTK+

Smuxi Message Patterns


TL;DR: check the bug tracker example here. In case you don't grok the example, continue reading the intro.

Everybody knows text can be boring because it is all just text. Nothing can sidetrack you except reading that bare text. Text often has recurring patterns from which something useful and interactive can be created. For example, someone writes:

Hey meebey, do you know RFC2812?

RFCs are a recurring pattern with a distinct number behind it and are real references to something in the internet (collection of protocol specifications).

So I would usually fire up a browser tab, copy/paste or type RFC2812 into my favorite search engine and click the first hit. Then I'd reply to the question afterwards. But with Smuxi's message patters, it turns RFC2812 into a link on which you can simply click to launch the relevant document.

Wow this is very cool, but isn't this already happening with http URLs and email addresses? Exactly! Why shouldn't more information be used to create useful things from it? Smuxi message patterns allow you to define text patterns that are transformed into clickable links. This can be used for RFCs, CVEs, bug report numbers (#XXX), git commit hashes and much more. Make good use of your creativity!

By default Smuxi comes with built-in message patterns for:

If you know more general patterns useful for others, please submit them.

Define a Message Pattern

As message patterns are an advanced feature of Smuxi they are only exposed using the the internal settings interface, which is the /config command.

First you need to create/assign a new ID for your pattern, you can search for existing IDs using this command:

/config get MessagePatterns

Now pick an unused number from that output. The pattern ID is the number after MessagePatterns/.

Decide which pattern you want to match for. This has to be a valid regex (regular expression). If you do not know what a regex is, you will have to ask someone or learn regex. This a useful website to create and test your regex before you add it to Smuxi. Now you can add that regex with the free ID obtained from above like this:

/config set MessagePatterns/0/MessagePartPattern=#([0-9]+)

0 is the free ID, which is the first one you can see when there are no patterns yet.

MessagePartPattern is your regex: #([0-9]+) which will match text of any number with any length that start with a #. This is typically used for bug report numbers.

Next we need to tell what do we want to do with that matched text, typically we want to convert it into a link thus we set:

/config set MessagePatterns/0/MessagePartType=url

Important: you have to use 0 as ID here again, because MessagePartType is a parameter for the same message pattern as above!

So we told it to match #([0-9]+) and convert that into a link, but to where? This is done using LinkFormat like this:

/config set MessagePatterns/0/LinkFormat={1}

Any valid URI would work in LinkFormat, but you need to pass the captured value from the regex, which is the number in this case (0-9 after the #). {0} is the matched text and {1} the captured value inside the ()s.

Now you should be able to send or receive a message containing #1234 for example and it should convert into a link for you. To make this change persistent you must save it using this command:

/config save

If you restart Smuxi now it will still remember your added pattern. Have fun!


Bug Report / Ticket Numbers

To turn #XXXX into a link for yor favorite bug tracker you could do that like this:

/config set MessagePatterns/0/MessagePartPattern=#([0-9]+)
/config set MessagePatterns/0/MessagePartType=url
/config set MessagePatterns/0/LinkFormat={1}
/config save

UTF-8 Smileys

Turn text smileys like ":)" into ☺ with this:

/config set MessagePatterns/0/MessagePartPattern=:\)
/config set MessagePatterns/0/TextFormat=☺
/config save

Examples in Smuxi

You can find many examples in Smuxi's source code here.