3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 11:39:25 +01:00
PyLink/docs/exttargets.md

4.4 KiB
Raw Blame History

Exttargets Guide

In PyLink, extended targets or exttargets replace regular hostmasks with conditional matching based on specific situations. PyLink exttargets are supported by most plugins in the place of nick!user@host masks (provided they use the IRCNetwork.match_host() API with a user object).

Exttargets were introduced in PyLink 0.9 alongside Automode, with the goal of making user/ACL matching more versatile. As of PyLink 2.0-dev, the following exttargets are supported:

Used to match users by their services account.

  • $account -> Returns True (a match) if the target is registered.
  • $account:accountname -> Returns True if the targets account name matches the one given, and the target is connected to the local network. Account names are case insensitive.
  • $account:accountname:netname -> Returns True if both the targets account name and origin network name match the ones given. Account names are case insensitive, but network names ARE case sensitive.
  • $account:*:netname -> Matches all logged in users on the given network. Globs are not supported here; only a literal *.

Used to match users in certain channels. Channel names are matched case insensitively.

  • $channel:#channel -> Returns True if the target is in the given channel.
  • $channel:#channel:PREFIXMODE -> Returns True if the target is in the given channel, and is opped. Any supported prefix mode (owner, admin, op, halfop, voice) can be used for the last part, but only one at a time.

Used to match users by IRCop status.

  • $ircop -> Returns True (a match) if the target is opered.
  • $ircop:*admin* -> Returns True if the targets is opered and their oper type matches the glob given (case insensitive).

In PyLink 1.2 and above, all targets and hostmasks can be inverted by placing a ! before the target:

  • !$account -> Matches all users not registered with services.
  • !$ircop -> Matches all non-opers.
  • !*!*@localhost -> Matches all users not connecting from localhost.
  • !*!*@*:* -> Matches all non-IPv6 users.

For users on PyLink version before 1.2, target inversion is only supported with exttargets (i.e. !$account will work, but not !*!*@localhost.

Used to match users on specific networks.

  • $network:netname -> Returns True if the target user originates from the given network (this supports and looks up the home network of Relay users).
  • $and:($ircop:*admin*+$network:ovd) -> Matches all opers on the network ovd.
  • $and:($account+$pylinkirc) -> Matches all users logged in to both services and PyLink.
  • $and:(*!*@localhost+$ircop) -> Matches all opers with the host localhost.
  • $and:(*!*@*.mibbit.com+!$ircop+!$account) -> Matches all (non-CGIIRC) Mibbit users that arent opered or logged in to services.

Used to match users on specific IRC servers.

  • $server:server.name -> Returns True (a match) if the target is connected on the given server. Server names are matched case insensitively.
  • $server:*server.glob* -> Returns True (a match) if the target is connected on a server matching the glob.
  • $server:1XY -> Returns True if the targets is connected on the server with the given SID. Note: SIDs ARE case sensitive.

Used to match users logged in to PyLink (i.e. via the identify command).

  • $pylinkacc -> Returns True if the target is logged in to PyLink.
  • $pylinkacc:accountname -> Returns True if the targets PyLink login matches the one given (case insensitive).

Used to match users with certain realnames.

  • $realname:*James*: matches anyone with “James” in their real name (case insensitive).

Used to match service bots. This exttarget takes one optional argument: a glob, which is compared case-insensitively to the target users service name if present.

  • $service: matches any PyLink service bot.
  • $service:automode: matches the Automode service bot.