3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-12 13:19:49 +01:00
Commit Graph

203 Commits

Author SHA1 Message Date
James Lu
95b58fc2c4 utils: abstract protocol/plugin import prefixes, and implement filtering by plugin in 'list'
Closes #369.
2016-12-16 19:25:41 -08:00
James Lu
03766b9f89 ServiceBot: implement docstring rewrapping per #307.
Closes #307.
2016-12-05 23:33:03 -08:00
James Lu
f5633329f8 utils: drop loadModuleFromFolder; it is unused since bcc84b8618 2016-12-04 23:35:16 -08:00
Ken Spencer
a1bbb4fdb9 utils: style points! WOOOO 2016-11-18 23:10:45 -08:00
Ken Spencer
fdd4135632 utils: add error() to use classes.py's irc.error() 2016-11-18 23:10:45 -08:00
James Lu
438838f81d ServiceBot: handle autojoin additions even if bots haven't spawned yet 2016-09-24 12:33:57 -07:00
James Lu
a040c3c7d2 ServiceBot: modularize join() for explicit channel joining (#326) 2016-09-23 23:43:07 -07:00
James Lu
9e7d0a50ca Revert "ServiceBot: fall back to a space in 'help' when stripped text is empty"
This reverts commit 7a3c8ab637.
2016-08-27 09:49:59 -07:00
James Lu
06cbbbb019 ServiceBot: display the NotAuthorizedError argument raw 2016-08-25 00:58:19 -07:00
James Lu
5908776a86 API CHANGE: Rename NotAuthenticatedError -> NotAuthorizedError 2016-08-25 00:43:44 -07:00
James Lu
7d2b22630d ServiceBot: display custom error messages for NotAuthenticatedError 2016-08-25 00:41:53 -07:00
James Lu
3126560fb9 ServiceBot: use newline-agnostic str.splitlines() to split up docstrings 2016-08-02 12:38:15 -07:00
James Lu
7a3c8ab637 ServiceBot: fall back to a space in 'help' when stripped text is empty
This makes sure things like newlines actually show when displaying docstrings. Closes #306.
2016-08-02 12:32:06 -07:00
James Lu
87c558537f unreal: refactor to use utils.PUIDGenerator
Closes #238.
2016-07-28 21:59:56 -07:00
James Lu
0d563eaa57 control/utils: unload the PyLink service bot on shutdown 2016-07-26 16:26:01 -07:00
James Lu
da9ab6ac90 Merge branch 'master' into devel 2016-07-23 20:57:26 -07:00
James Lu
e56c9640dc ServiceBot: remove request/remove stubs for now 2016-07-23 19:57:05 -07:00
James Lu
c6ed06ba61 utils: new splitHostmask function 2016-07-20 23:55:34 -07:00
James Lu
c52d542ed8 Initial Clientbot stub, with very rudimentary user handling (#144) 2016-07-20 23:55:34 -07:00
James Lu
ba53d63d37 ServiceBot: make sure all the defaultdict(set) instances are SEPARATE
Bit of a Python oddity here - If you initialize a class like defaultdict in a class constructor, the same instance is used for all instances of the class?

This fixes all service bots joining the same channel, when they really shouldn't be.
2016-07-07 22:56:05 -07:00
James Lu
4f26a29196 utils: unregisterService should be case insensitive 2016-07-07 22:41:39 -07:00
James Lu
bcc84b8618 core: remove references to plugins/protocols_folder (#259) 2016-07-02 23:58:21 -07:00
James Lu
d34ab6db8b ServiceBot: show an "End of help" line after featured command listing 2016-06-30 18:55:37 -07:00
James Lu
d2b5fd7b6e ServiceBot: implement short form help for featured command lists
Suggestion from @cooper.
2016-06-30 18:52:35 -07:00
James Lu
5c90cbe01f ServiceBot: always show featured commands list in private, to prevent channel floods 2016-06-30 18:37:14 -07:00
James Lu
02405c36b5 core, fantasy: redo handling of noticed and/or private replies
New behaviour for command responses in general: FANTASY commands reply in channel as PRIVMSG, while all commands sent in PM reply as private notices.

- The old irc.called_by is now irc.called_in (PLACE last command was called)
- irc.called_by is now used to store the CALLER of the last command
- notice=True/False toggle is dropped from ServiceBot.call_cmd()
- New private=True/False option added to ServiceBot.reply() and irc.reply(), which controls whether replies should be sent privately or not.
2016-06-30 18:22:45 -07:00
James Lu
0922f7cefc ServiceBot: sort featured commands list 2016-06-30 18:05:12 -07:00
James Lu
e730909a46 utils: pass featured argument to ServiceBot in add_cmd() 2016-06-30 17:57:40 -07:00
James Lu
7210161ece ServiceBot: use a shared function for showing command help 2016-06-30 17:39:53 -07:00
James Lu
a9f8b05419 ServiceBot: support service descriptions, featured commands
Closes #256. Closes #255.
2016-06-30 17:30:44 -07:00
James Lu
b90c69eead ServiceBot: actually, make extra_channels network specific 2016-06-25 14:21:13 -07:00
James Lu
ceed9346c0 ServiceBot: allow configuring extra channels that bots will join 2016-06-25 14:14:19 -07:00
James Lu
cb633cfba5 Default config file location is now pylink.yml 2016-06-21 10:59:03 -07:00
James Lu
481d70eff8 New import paths for properly installed pylinkirc 2016-06-20 18:18:54 -07:00
James Lu
fa3d230ac9 IncrementalUIDGenerator: normalize SID to strings 2016-06-16 21:55:32 -07:00
James Lu
d362063e8a ServiceBot: ignore invalid commands beginning with \x01 (CTCP) 2016-06-15 11:26:30 -07:00
James Lu
77fa3573a1 ServiceBot: remove defaults for nick and ident
This fallback is handled by coreplugin already.
2016-06-11 10:54:07 -07:00
James Lu
2877d7af4c ServiceBot.call_cmd: support notice and called_by keys 2016-05-15 11:25:47 -07:00
James Lu
5122aa8f9a utils: add unregisterService 2016-05-14 14:52:12 -07:00
James Lu
8f14e02f10 utils: return the ServiceBot instance in registerService 2016-05-14 14:23:52 -07:00
James Lu
6440922759 ServiceBot: disable request/remove commands by default
These are stubs at the moment, but still.
2016-05-14 14:15:46 -07:00
James Lu
32bc5f120b core: migrate the main client to ServiceBot (#216)
- irc.spawnMain is dropped. Clients are now spawned in the endburst loop, after protocol negotiation completes. This allows PyLink to spawn clients with hideoper, etc., closing #194.
- utils.add_cmd and irc.callCommand are now just wrappers around world.services['pylink'].add_cmd and call_cmd respectively.
- coreplugin registers the main client while it is loaded up, before any commands are added.
2016-05-14 13:29:23 -07:00
James Lu
118d76fd5a core: allow defining service bots with custom nicks/idents 2016-05-14 12:52:32 -07:00
James Lu
5b3059c85d ServiceBot: fill in 'help' and 'list' commands (#216) 2016-05-14 12:22:00 -07:00
James Lu
924172291f ServiceBot: work out basic command handling
This copies callCommand from the IRC object into ServiceBot.call_cmd. The former will be removed once the main PyLink client is migrated to a service bot.
2016-05-14 10:17:40 -07:00
James Lu
0c7faed213 Move NotAuthenticatedError class back into utils
This is needed because ServiceBot exists in utils, and utils cannot import classes without a bad import loop happening.
2016-05-14 10:05:18 -07:00
James Lu
7d11f8c7e0 Begin work on service bot abstraction (#216)
- State-keeping is done by coreplugin
- utils.registerService() introduced
- new PYLINK_NEW_SERVICE hook introduced
2016-05-14 09:55:46 -07:00
James Lu
beae4eea9e core: rename utils.fullVersion -> irc.version (#199) 2016-04-30 17:00:28 -07:00
James Lu
3bb1208e74 core: move toLower to Irc (#199) 2016-04-30 16:57:38 -07:00
James Lu
2fe2e9c8c4 core: move isOper, checkAuthenticated to Irc (#199) 2016-04-30 16:54:11 -07:00
James Lu
78f8a2fc8d core: move isManipulatableClient, getHostmask to Irc 2016-04-30 16:44:37 -07:00
James Lu
064cb9b6aa core: move reverseModes, joinModes into Irc 2016-04-30 16:33:46 -07:00
James Lu
f1351bb3f5 utils: introduce deprecation warnings for applyModes and parseModes 2016-04-24 21:44:34 -07:00
James Lu
84822fb1d6 Move applyModes, parseModes into Irc, suppressing deprecation warnings for now (#199) 2016-04-24 21:44:27 -07:00
James Lu
7f46e1c35c Separate KeyedDefaultdict into new structures module (#199) 2016-04-24 21:11:36 -07:00
James Lu
2c60aa6395 Separate UID/SID generators into various protocol modules (#199) 2016-04-24 21:08:07 -07:00
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