| |
- add_cmd(func, name=None)
- Binds an IRC command function to the given command name.
- add_hook(func, command)
- Binds a hook function to the given command name.
- applyModes(irc, target, changedmodes)
- Takes a list of parsed IRC modes, and applies them on the given target.
The target can be either a channel or a user; this is handled automatically.
- checkAuthenticated(irc, uid, allowAuthed=True, allowOper=True)
- Checks whether the given user has operator status on PyLink, raising
NotAuthenticatedError and logging the access denial if not.
- getDatabaseName(dbname)
- Returns a database filename with the given base DB name appropriate for the
current PyLink instance.
This returns '<dbname>.db' if the running config name is PyLink's default
(config.yml), and '<dbname>-<config name>.db' for anything else. For example,
if this is called from an instance running as './pylink testing.yml', it
would return '<dbname>-testing.db'.
- getHostmask(irc, user, realhost=False, ip=False)
- Returns the hostmask of the given user, if present. If the realhost option
is given, return the real host of the user instead of the displayed host.
If the ip option is given, return the IP address of the user (this overrides
realhost).
- getProtocolModule(protoname)
- Imports and returns the protocol module requested.
- isChannel(s)
- Returns whether the string given is a valid channel name.
- isHostmask(text)
- Returns whether the given text is a valid hostmask.
- isManipulatableClient(irc, uid)
- Returns whether the given user is marked as an internal, manipulatable
client. Usually, automatically spawned services clients should have this
set True to prevent interactions with opers (like mode changes) from
causing desyncs.
- isNick(s, nicklen=None)
- Returns whether the string given is a valid nick.
- isOper(irc, uid, allowAuthed=True, allowOper=True)
- Returns whether the given user has operator status on PyLink. This can be achieved
by either identifying to PyLink as admin (if allowAuthed is True),
or having user mode +o set (if allowOper is True). At least one of
allowAuthed or allowOper must be True for this to give any meaningful
results.
- isServerName(s)
- Returns whether the string given is a valid IRC server name.
- joinModes(modes)
- Takes a list of (mode, arg) tuples in parseModes() format, and
joins them into a string.
See testJoinModes in tests/test_utils.py for some examples.
- loadModuleFromFolder(name, folder)
- Imports and returns a module, if existing, from a specific folder.
- parseModes(irc, target, args)
- Parses a modestring list into a list of (mode, argument) tuples.
['+mitl-o', '3', 'person'] => [('+m', None), ('+i', None), ('+t', None), ('+l', '3'), ('-o', 'person')]
- reverseModes(irc, target, modes, oldobj=None)
- Reverses/Inverts the mode string or mode list given.
Optionally, an oldobj argument can be given to look at an earlier state of
a channel/user object, e.g. for checking the op status of a mode setter
before their modes are processed and added to the channel state.
This function allows both mode strings or mode lists. Example uses:
"+mi-lk test => "-mi+lk test"
"mi-k test => "-mi+k test"
[('+m', None), ('+r', None), ('+l', '3'), ('-o', 'person')
=> {('-m', None), ('-r', None), ('-l', None), ('+o', 'person')})
{('s', None), ('+o', 'whoever') => {('-s', None), ('-o', 'whoever')})
- toLower(irc, text)
- Returns a lowercase representation of text based on the IRC object's
casemapping (rfc1459 or ascii).
|