Rules How-To

Rules allows you to set actions (called Then actions) that Foo IRC should perform when it receives a new IRC events from the IRC server if that message meets certain criteria (called When constraints).

FAQs

How to create a new rule?

Tap the Rules item on the Dashboard pane. On the Rules pane, click the "Add" button. In the New Rule popup, type in a name for the rule then tap the "OK" button.

On the When pane, select "New..." in the list at the top of the page. Under the Edit section, use the When Rule Type box to select the type of a constraint that you want on the rule. Once you have added multiple constraints, you can select them in the list and move them up or down to change the order they are performed (top is first).

When Constraint Types

Event - Set criteria for the type of IRC event. (e.g. JOIN, PRIVMSG, NOTICE, MODE, etc.)
From Channel - Set criteria for the name of the channel that the IRC event came from.
From Server - Set criteria for the server hostname or saved server name of the server that the IRC event came from.
From User - Set criteria for the nickname of the user that triggered the IRC event.
Is In Notify List - Set criteria for whether the user who trigger the event is in the notify list.
Message - Set criteria for the message the user sent or set. For example, this will look at the text of a private message, notice message, kick message, or changed topic.
Text Matches - Set criteria for a given text. Most useful with Rule Variables.
View is Active: Set criteria that the channel, private message, or server view (depending on the event type) is currently in view and the app is not running in the background.
With Target User/Parameters: Set criteria for the user that a privmsg or notice was sent to, the user that is the target for an op mode change or ban, or the parameters of a mode change.

Once a type is chosen, the area below the When Rule Type box will change textboxes or toggles for you to specify parameters for the constraint. Once you finished setting your parameters, tap the "Save" button. Repeat this step if you want to add more constraints. Afterward, tap the "Next" button.

The Then pane, which is displayed after the When page, follows the same setup of the When pane. Choose the actions that the client should perform by selecting the Then Rule Type and setting the parameters for the actions to perform. Once everything is saved, tap the "Done" button to return to the Rules pane.

Then Action Types

Execute - Runs Auto Action commands.
Hide - Prevent the IRC event from being displayed in the UI.
Highlight - Highlights the event text if it is displayed in a message view
Notify - Create a toast notification or display a inline notification in the IRC View.
Play Sound - Plays a double beep sound.
Replace Message - Replace the message in the IRC event before it is displayed in the UI with another using regex replace.
Run Rule - Runs a specified rule.
Send Command - Send an raw IRC command to the server.
Set Variable - Set a custom variable that can be used in Rules. See Custom Variables.
Vibrate - Vibrates the device (if supported).

Rule Variables

Many open text boxes in When constraints and Then actions can contain special variables which contain information about yourself. A special variable is in the form of a word surrounded by '%' characters, and can be put anywhere in the message you send. If the variable is invalid or if there is no value for that variable, the variable will be removed from the text.

Event Variables

%MyNickname% - The nickname that you are currently using on the IRC server.
%SourceNickname% - The nickname of the user that triggered the IRC event.
%Channel% - The name of the channel the IRC event was sent to.
%Event% - The type of IRC event triggered.
%IrcCommand% - The full text of the IRC event received by the client.
%Server% - The hostname of the server that the event occurred on.
%ServerName% - The saved server name or the reported server name of the server that the event occured on.
%Message% - The message the use sent or set. For example, this will look at the text of a private message, notice message, kick message, or changed topic.
%Mode% - The mode that was set in a MODE IRC event.
%Ctcp% - The type of CTCP command sent.
%Target% - The user that a privmsg or notice was sent to, the user that is the target of an op mode change or ban, or the parameters for a mode change.

Custom Variables

Custom variables can be used to hold any text desired and are accessible anywhere rule variables are. These can be set by the Set Variable Then or by Auto Actions using the built-in Rules action group.

To access a custom variable, the variable name needs to be prefixed with source of the variable (global, event, or server) and colon. For example: %global:YourCustomVariableName%

global - The variable is stored in the global scope.
server - The variable is stored specifically for the server running the rule.
event - The variable is only accessible to the Whens and Thens responding to the current event.