Topic Masking Guide

Topic masks allow you to force topics to follow a set pattern. To effectively use C's topic masking feature, you'll need a firm understanding of "wildcards", which we'll discuss in the next section of this guide.

Wildcards
The great Wikipedia defines a wildcard as a character that may be substituted for any of a defined subset of all possible characters. In other words, the wildcard acts as a place holder. It'll be substituted for any other character or several characters. C supports two wildcards:


 * * - (asterisk) - substitutes for zero or more characters
 * ? - (question mark) - substitutes for one character

These two wildcards operate in the same fashion as they did in DOS or UNIX, if you have used them in either of these environments. Likewise, if you have ever used wildcards in channel bans or exemptions, same concept.

To keep things simple, we will only use the asterisk "*" wildcard in this guide.

Example
In Linux, to delete a file, you might execute the following command:

The above command would delete all files called "notes", regardless of extension. Thus, notes.png, notes.txt, notes.pdf, notes.doc, etc. would all be deleted; therefore, the asterisk (*) wildcard essentially means anything, notes.anything.

Setting your channel topic
Now that we understand wildcards, let's apply them to topic masking. We'll start with an example.

We want to set the following topic in the channel #darenet:

 

However, we also want to be able to update what follows "NEWS:" without having to retype everything that comes before it every time we change the topic with exciting new information. Topic masking makes this easy! In other words, we want to be able to do something like:

 .topic Happy Holidays!
 * C changes topic to Welcome to the DareNET lobby! NEWS: Happy Holidays!

You'll notice only the part after "NEWS:" changed from our original topic, which was replaced with what NiTeMaRe typed. This method of topic alteration is what we call topic masking. Cool, right? So how did we achieve this? By taking advantage of wildcards -- the asterisk (*) wildcard to be exact.

Using C's SET TOPICMASK command, we set the following topic mask:

 

Notice that we used the asterisk (*) wildcard after "NEWS:". This tells C to allow anything here, substituting it with whatever we supply with the TOPIC command.

Topic snarfing
There is one small "gotcha" to be aware of. By default, C will ignore the topic mask when channel owner's change the topic, replacing the entire topic. You can prevent this by telling C you do not want to override the topic mask by changing the channel's TOPICSNARF level to one higher than your own, such as 501.

To do this, use C's SET TOPICSNARF command. For example:

'''

Now C will honor the topic mask whenever you change the channel topic.

Confused?
If you still aren't quite sure how topic masking works after reading this guide, that's okay. Stop by #help where we'll be more than happy to answer any questions you may have.