3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00
Commit Graph

97 Commits

Author SHA1 Message Date
James Lu
dc1d9602e9 utils: add a simple P10 UID generator (#87)
Reference: https://github.com/evilnet/nefarious2/blob/a29b631/doc/p10.txt#L85-L92
2016-04-05 18:45:00 -07:00
James Lu
e2edc68fe8 utils: check explicitly for "pos is None", as 0 is a falsey value too
Without this, the UID generator would refuse to change the left-most character of the UID, as it is position 0.
2016-04-05 18:44:00 -07:00
James Lu
cb8ea473df utils: modularize UID generators 2016-04-05 18:05:52 -07:00
James Lu
305db9f754 utils: also don't crash in applyModes for bad mode targets 2016-03-26 18:14:53 -07:00
James Lu
e70dfb0811 Merge branch 'master' into devel 2016-03-26 17:58:18 -07:00
James Lu
2169a9be28 utils: actually abort when mode target is invalid 2016-03-26 17:58:03 -07:00
James Lu
00552a41a7 Move detailed version string generation to utils
New function: utils.fullVersion(irc)
2016-03-26 11:33:47 -07:00
James Lu
03b53aee59 Merge branch 'staging' into devel 2016-03-25 15:03:05 -07:00
James Lu
0fd093644c utils: don't crash when mode target is invalid 2016-03-23 18:04:12 -07:00
James Lu
d84cfbcda1 utils: simplify prefix modes handling in applyModes 2016-03-19 17:47:23 -07:00
James Lu
8135f3a735 core: Depluralize prefixmodes mappings (#168)
This is an API breaking change. I really don't know why I made these keys plural to start, since it only made things more complicated. Prefix modes are not pluralized in the list of supported modes of each IRCd.
2016-03-19 17:25:04 -07:00
James Lu
544d6e1041 utils: add KeyedDefaultdict
This is a subclass of defaultdict allowing the key to be passed to the default factory.
2016-03-19 17:01:16 -07:00
James Lu
14388d932f utils.getHostmask: add option to return IP address 2016-03-05 09:52:00 -08:00
James Lu
0430e1dae7 utils.getHostmask: option to return hostmask with real host, use placeholders w/o spaces in them 2015-12-31 18:09:52 -08:00
James Lu
eac934c237 classes: sort code, move nickToUid, clientToServer, isInternalClient, isInternalServer into the Irc class
The following BREAKING changes are made:
utils.nickToUid(irc, nick) -> irc.nickToUid(nick)
utils.isInternalClient(irc, uid) -> irc.isInternalClient(uid)
utils.isInternalServer(irc, uid) -> irc.isInternalServer(uid)
utils.clientToServer(irc, uid) -> utils.getServer(uid)
2015-12-31 17:28:47 -08:00
James Lu
11adee9d78 Yet another documentation refresh (#113) 2015-12-26 14:45:28 -08:00
James Lu
9a81a2ba1f Rename utils.getProtoModule => utils.getProtocolModule 2015-12-24 17:33:49 -08:00
James Lu
31c47b50f3 utils: fix irc.users changing size during lookup 2015-12-11 18:43:58 -08:00
James Lu
e4fb64aeba Document more parts of the core - comments are cool right 2015-12-06 17:40:13 -08:00
James Lu
561af2e037 utils/relay: add and use getDatabaseName to fetch an instance-specific DB name 2015-12-06 17:13:47 -08:00
James Lu
197532c1be core: Replace imp (deprecated) with importlib, reword some docs & remove unneeded imports 2015-11-22 20:14:47 -08:00
James Lu
b3ab604b88 utils: return the bound function in add_cmd/add_hook
TODO: allow utils.add_cmd/add_hook to be called as a decorator WITH a name argument
2015-10-23 18:47:11 -07:00
James Lu
c0eab152e4 utils: fix error handling in parseModes 2015-10-08 20:59:31 -07:00
James Lu
b8fe622cc8 utils: don't allow hostmasks/banmasks to have # in them 2015-10-08 17:25:49 -07:00
James Lu
e84a2d1025 Modularize our import hacks, make Irc() take a conf object again 2015-09-28 19:12:45 -07:00
James Lu
bbedd38703 world: rename command_hooks=>hooks, bot_commands=>commands 2015-09-27 10:53:25 -07:00
James Lu
5afa621654 utils.parseModes: add missing string formatting 2015-09-25 20:25:41 -07:00
James Lu
da3251cce2 utils.parseModes: check to make sure target channel/user exists 2015-09-25 20:25:30 -07:00
James Lu
e92f35018f TS6SIDGenerator: take an IRC object, and skip any SIDs that are currently in use 2015-09-20 18:32:43 -07:00
James Lu
069cd62865 core: allow marking spawned clients as manipulatable or protected
This flag determines whether the client should be manipulated by commands like bots.py's MODE/QUIT/JOIN commands, or protected from them (services).
2015-09-17 19:01:54 -07:00
James Lu
48573b6033 utils.parseModes: autoconvert nicks->UIDs for prefix modes, skipping if the target doesn't exist. 2015-09-14 17:57:20 -07:00
James Lu
b0b9138720 Merge branch 'master' into devel 2015-09-14 17:56:53 -07:00
James Lu
2e0a5e52e2 utils.parseModes: fix IndexError on empty query 2015-09-14 17:56:33 -07:00
James Lu
9cd176b846 utils.reverseModes: don't reverse prefix/list modes that were never set
Charybdis/TS6 doesn't check this IRCd-side, so we don't want people to abuse this by say, overriding -b *!*@* in a relay channel and having the PyLink client set +b *!*@* in response,
2015-09-13 14:05:07 -07:00
James Lu
9a139212dd relay/utils: make mode reversals work with mode changes that affect op statuses. 2015-09-13 13:48:14 -07:00
James Lu
dab29cfc19 utils: add a proper reverseModes() with tests
Closes #107.
2015-09-12 22:31:20 -07:00
James Lu
f23cff845c utils: Documentation and cleanup 2015-09-12 22:31:19 -07:00
James Lu
62e7cc4fca move utils.msg() => classes.Irc.msg()
New function gets an extra (optional) "source" argument for specifying a sender UID. It's also shorter since no IRC object has to be passed to utils.
2015-09-06 22:23:44 -07:00
James Lu
57da0aa3b3 Classify all our protocol modules - why didn't I do this earlier 2015-09-05 18:00:57 -07:00
James Lu
0b590d6ab3 relay/protocols: use utils.toLower() for channel names, respecting IRCd casemappings
Closes #102.
2015-09-01 22:01:22 -07:00
James Lu
e1e31f64ad Allow multiple plugins to bind to one command name!
They will get called in a list, one after the other. The "help" command is able to distinguish with this too.
2015-08-29 19:25:07 -07:00
James Lu
973aba6de7 Move utils' global variables to world.py 2015-08-29 09:39:33 -07:00
James Lu
ad5fc97e21 Many fixes to test API, utils.reverseModes stub 2015-08-28 19:28:06 -07:00
James Lu
3d621b00df Move checkAuthenticated() to utils, and give it and isOper() toggles for allowing oper/PyLink logins 2015-08-25 20:47:21 -07:00
James Lu
579838e1ba utils.applyModes: be more error tolerant? 2015-08-15 20:02:07 -07:00
James Lu
880b59c2c1 utils.isOper: check for both umode +o and login status
Also, make commands.status show this isOper result.
2015-08-02 19:41:40 -07:00
James Lu
0977268070 utils.parseModes: don't error if prefix isn't given, assume + 2015-07-23 15:04:57 -07:00
James Lu
a8b16d9724 utils.parseModes: fix handling of mode "-k *" on TS6
Charybdis allows unsetting +k without actually knowing the key by faking the argument when unsetting as a single "*". We'd need to know the real argument of the +k being removed, in order to remove the mode pair from the mode list.
2015-07-23 13:24:18 -07:00
James Lu
254ccea0a3 remove some debugging cruft and unused imports 2015-07-23 11:46:45 -07:00
James Lu
a7f977aa3b Add whois handlers for channel lists, user modes, and signon time, and relay user information
New API: utils.whois_handlers allows one to add functions taking (irc, target) and returning (irc numeric, reply text)

Closes #72.
2015-07-23 00:01:51 -07:00