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

397 Commits

Author SHA1 Message Date
James Lu
d79f1766b6 classes, coremods: migrate to irc.is_* 2017-08-28 20:13:25 -07:00
James Lu
e39b4e9c69 Move utils.is* methods into PyLinkNetworkCoreWithUtils (#476) 2017-08-28 20:07:31 -07:00
James Lu
2a7594e56e Move PUIDGenerator->classes, IncrementalUIDGenerator->ircs2s_common (#476) 2017-08-28 19:42:24 -07:00
James Lu
b1159400f1 Move DeprecatedAttributesObject, CamelCaseToSnakeCase to structures (#476) 2017-08-28 19:36:55 -07:00
James Lu
0907f05296 Condense (deep)copy definitions into structures.CopyWrapper 2017-08-25 17:05:53 -07:00
James Lu
8c0f19422f core: Add irc argument to User and Server classes
Also, add a __deepcopy__ override to channel because we cannot clone IRCNetwork objects (locks cannot be pickled).
2017-08-25 13:53:45 -07:00
James Lu
96a202acce core: make User.channels use IRCCaseInsensitiveSet
Closes #515. This is an API breaking change!
2017-08-25 13:26:34 -07:00
James Lu
80766e051e core: define two (joined) versions of the channels index
Closes #509.

PyLinkNetworkCore.channels is split into the following:
- irc._channels which implicitly creates channels on access (mostly used in protocol modules)
- irc.channels which does not (recommended for use by plugins)
2017-08-25 02:12:08 -07:00
James Lu
c6ca89b48a Fill in the rest of the extbans list for inspircd & unreal (#498) 2017-08-23 21:47:43 -07:00
James Lu
de1a6379df Add (experimental) support for matching extbans (#498) 2017-08-23 21:18:57 -07:00
James Lu
d28006ae62 Move ProtocolError to utils, and link the copy in classes to it 2017-08-21 22:21:09 -07:00
James Lu
3e150d8514 Break up classes.ChannelState into structures.(IRC)CaseInsensitiveDict 2017-08-21 21:50:44 -07:00
James Lu
7aa836efa6 Concisify match_host CIDR logging again
We're replacing the glob, not the target's host.
2017-08-16 00:03:57 -07:00
James Lu
761d3ef500 Fix wrong logging for CIDR ranges in match_host 2017-08-15 21:26:18 -07:00
James Lu
9113b34b46 NetworkCore: return the server in get_server if the arg was a server 2017-08-11 13:13:50 -07:00
James Lu
e0e929492e match_host: implicitly convert string masks such as "user1" to "$pylinkacc:user1"
This keeps it in line with other services packages and is way nicer to read.
2017-08-07 16:31:17 -07:00
James Lu
a070ec5c32 PyLinkNetworkCore: add stubs for disconnect() and connect() 2017-08-06 21:49:52 -07:00
James Lu
d3f635901b classes: reorganize methods in NetworkCore 2017-08-06 21:49:41 -07:00
James Lu
a72f710a69 Add regex variants to checkban and massban 2017-08-06 20:02:20 -07:00
James Lu
d12f12ae22 Add a 'massban' command
Closes #174.
2017-08-06 19:21:55 -07:00
James Lu
c8a9163f57 ChannelState: add __repr__ 2017-08-06 18:09:37 -07:00
James Lu
c9c0e0a85b ChannelState: add copy and __contains__ methods 2017-08-06 18:04:46 -07:00
James Lu
cbb3c88e11 NetworkCoreWithUtils: add new match_all() method 2017-08-06 17:55:43 -07:00
James Lu
32249ace3e Store channels case-insensitively in a new classes.ChannelState
Closes #372.
2017-08-06 17:52:52 -07:00
James Lu
9ae851e1fc classes: rename NetworkCore.aborted to _aborted 2017-08-05 22:16:52 -07:00
James Lu
8d15d05711 IRCNetwork: use disconnect() to kill networks if parsing a command errors
This is more standard, as aborted is solely an internal value.
2017-08-05 22:14:44 -07:00
James Lu
f4da1fc94c Merge branch 'master' into devel
Conflicts:
	VERSION
	classes.py
	docs/faq.md
	example-conf.yml
	protocols/p10.py
	pylink
	world.py
2017-08-05 22:11:22 -07:00
James Lu
7db811f2dd protocols: declare quiet extban support where applicable 2017-08-05 21:52:34 -07:00
James Lu
a0a295f7d2 Set Irc.aborted earlier in the disconnect loop
This prevents plugins from getting really confused as we remove things.
2017-08-03 10:22:57 -07:00
James Lu
0d5afd266f Irc: stop extraneous queue threads when removing from world.networkobjects 2017-08-03 10:15:29 -07:00
James Lu
981e6c508f Move _check_nick_collision to NetworkCoreWithUtils
This is useful for networks that emulate IRC as well, to prevent clashes between real clients and virtual ones.
2017-07-31 20:58:02 +08:00
James Lu
47f3977554 Move NetworkCore.parse_protocol_command to IRCNetwork.parse_irc_command
Also add a stub for handle_events.
2017-07-31 11:09:08 +08:00
James Lu
eae1425975 NetworkCore: remove nonexistent cmode +r from mode type definitions 2017-07-31 00:43:19 +08:00
James Lu
c7c29f35e5 core: make message cutoff optional, and disable for inspircd
Closes #490.
2017-07-16 21:01:55 -07:00
James Lu
b88830ba25 classes: migrate to conf.conf['pylink'] 2017-07-14 05:50:19 -07:00
James Lu
880d0975db Merge branch 'type-to-isinstance' of https://github.com/cooper/PyLink into devel 2017-07-14 05:22:37 -07:00
James Lu
716ffd389b classes: mark reply_lock, init_vars as private 2017-07-14 05:22:05 -07:00
James Lu
fa4d831e44 NetworkCore: remove outdated, now misleading constructor description 2017-07-12 23:16:03 -07:00
James Lu
2e7fed84c1 IRCNetwork: mark connection_thread, pingTimer, socket, and queue as private 2017-07-12 22:56:30 -07:00
James Lu
2ef7df01e7 IRCNetwork: don't try to close the socket if none was ever initialized 2017-07-12 22:50:16 -07:00
James Lu
db778debb8 Fix error logging for validate_server_conf (#472) 2017-07-12 22:44:48 -07:00
James Lu
69bafedcca IRCNetwork: use a less confusing error than "No data received" 2017-07-12 22:22:08 -07:00
James Lu
0e3d733a72 NetworkCore: set self.aborted to True as early as possible when launching a disconnect
This should prevent spurious "No data received" errors from popping up when using the 'disconnect' command.
2017-07-12 22:22:08 -07:00
James Lu
f85bdb3d8b IRCNetwork: suppress logging connection errors when PyLink is shutting down 2017-07-12 22:22:08 -07:00
Mitchell Cooper
7ab0e8f105 use isinstance() instead of type() where appropriate #410 2017-07-12 17:29:34 -04:00
James Lu
1a8dcdfa3a NetworkCore: use the new validate_server_conf name 2017-07-11 02:22:01 -07:00
James Lu
b7466327db protocols: move S2S_BUFSIZE definition into a class variable 2017-07-07 20:14:26 -07:00
James Lu
1172ca7387 IRCNetwork: use \r\n as separator instead of \n
CRLF is the standard way of doing this per RFC1459
2017-07-07 20:14:26 -07:00
James Lu
51fb269d0d IRCNetwork: don't attempt to send more than 510 bytes per message
Some IRCds like ngIRCd will SQUIT you if you try to do so, though most just ignore this kind of overflow.
2017-07-07 20:14:23 -07:00
James Lu
3bcf0092e9 NetworkCoreWithUtils: wrap irc.to_lower in a lru_cache 2017-07-07 14:40:27 -07:00
James Lu
6636a19a2b ngircd: implement handler for METADATA 2017-07-06 22:15:56 -07:00
James Lu
9132556fd9 PyLinkNetworkCore: fix __repr__ definition 2017-07-04 23:32:41 -07:00
James Lu
970b38719d core: rename ping() to _ping_uplink(), and drop the unused source/target arguments 2017-07-04 22:09:50 -07:00
James Lu
640e903dd6 Move _get_SID/_get_UID to IRCCommonProtocol 2017-07-02 22:36:47 -07:00
James Lu
bbc4dec8dd NetworkCoreWithUtils: shortcut _get_SID/UID if the target already exists 2017-07-02 22:35:39 -07:00
James Lu
e866e9eb7b NetworkCore: demote "stopping connect loop" messages to DEBUG 2017-07-02 22:26:28 -07:00
James Lu
06ef421578 classes: clean up references to deprecated classes/methods 2017-06-30 21:49:29 -07:00
James Lu
a73300e864 classes.Channel: migrate to snake case 2017-06-30 21:34:08 -07:00
James Lu
0c7fb861f1 classes, relay, ircs2s_c: tweak/remove various debug statements 2017-06-29 23:19:21 -07:00
James Lu
67347935b5 ircs2s_common: add missing ProtocolError import 2017-06-29 21:55:33 -07:00
James Lu
56275c5a3b NetworkCore: rename removeClient -> _remove_client (no migration stub) 2017-06-27 16:21:30 -07:00
James Lu
5e7529dae4 Move some functions back into NetworkCore
Things like is_internal_client() are specific to the way we track users, so it doesn't make much sense to override these per protocol. It can *still* be done though, but there's little point...
2017-06-27 16:17:28 -07:00
James Lu
56f1c9e919 NetworkCore: fix irc.protoname definition 2017-06-27 16:15:37 -07:00
James Lu
ad2d5a5ae0 Move ts_lock definition into PyLinkNetworkCoreWithUtils 2017-06-27 16:12:45 -07:00
James Lu
928dbf80bb Move more IRC-specific attributes into IRCNetwork.init_vars() 2017-06-27 16:05:58 -07:00
James Lu
62784a63e4 IRCNetwork: error when attempting to start multiple connection threads for a network 2017-06-27 15:58:55 -07:00
James Lu
c3cdf63253 Move some IRC-specific attributes to IRCNetwork 2017-06-27 15:58:38 -07:00
James Lu
fb34392fca IRCNetwork: mark schedule_ping, process_queue as private 2017-06-27 02:53:09 -07:00
James Lu
710a276c45 IRCNetwork: rename run() -> _run_irc(), this is a private function 2017-06-27 01:44:26 -07:00
James Lu
7814914a05 classes, protocols: convert self.irc usage to self 2017-06-25 02:09:52 -07:00
James Lu
eef7a73ce9 classes: migrate self.proto calls to self 2017-06-25 02:09:41 -07:00
James Lu
d0209f720a Rewrite network intitialization bits
- Move protocols.connect -> protocols.post_connect to fix namespace conflict
- Starting an IRC connection is now explicit (via irc.connect instead of __init__)
2017-06-25 01:12:58 -07:00
James Lu
df18e318a8 WIP: merge IRCNetwork and Protocol classes together
Eventually, the goal is to have both of these hotswappable with inheritance, so this distinction becomes moot.
2017-06-24 23:27:24 -07:00
James Lu
7ca98eb965 Split IRC-specific code from classes.Protocol into a new IRCCommonProtocol (#454) 2017-06-16 17:13:26 -07:00
James Lu
37d8e8ad43 Irc: break protocol-agnostic [dis]connect code into _pre/_post functions (#371) 2017-06-16 16:53:23 -07:00
James Lu
2a978c498e Rename PyLinkIRCNetwork -> IRCNetwork
The "PyLink" prefix is sort of redundant here...
2017-06-15 21:55:08 -07:00
James Lu
c4f6d626d5 Drop Irc prefix from IrcServer/User/Channel classes 2017-06-15 21:54:40 -07:00
James Lu
d98d522387 Move Irc.runline => PyLinkNetworkCore.parse_protocol_command 2017-06-15 21:45:04 -07:00
James Lu
47e36a9249 classes: break Irc into three classes: PyLinkNetworkCore, PyLinkNetworkCoreWithUtils, PyLinkIRCNetwork (aliased to Irc) 2017-06-15 21:38:52 -07:00
James Lu
d4fae02540 Irc: migrate functions to camel case 2017-06-02 23:17:14 -07:00
James Lu
f97db31533 Irc: show the current encoding setting in fullVersion() 2017-06-02 08:46:55 -07:00
James Lu
3a934ef5b8 Merge branch 'wip/configurable-encoding' into devel 2017-06-02 07:32:07 -07:00
James Lu
b9aee6ae85 Irc: only apply encoding settings on connect
Changing the encoding after a connection has been established is somewhat dangerous, because it's possible to corrupt channel/user state if characters in the old encoding are no longer valid.

Also, mark this option as experimental.
2017-06-02 07:31:49 -07:00
James Lu
1ff027152a Irc: remove outdated cert/keyfile comment 2017-05-28 20:09:26 -07:00
James Lu
2737b6bbfc Irc: simplify _send() code and replace unencodable characters 2017-05-27 02:21:12 -07:00
James Lu
1246edaf2c Irc: initial work on encoding support (#101) 2017-05-27 01:27:09 -07:00
James Lu
ead20f5be9 Irc: log full tracebacks when disconnecting due to an error 2017-05-16 16:30:03 -07:00
James Lu
fd3236ddb7 Irc: fix another CPU loop on 'disconnect' 2017-05-12 19:52:40 -07:00
James Lu
daa6593534 Irc: block when the queue is empty instead of needlessly polling it
Rework Irc.processQueue() to block when the queue is full, and abort if the item "None" is sent to it.
To make sure that the None isn't caught by a full queue or pushed back by other elements, this modifies queue.Queue's underlying deque instance directly.

Closes #459.
2017-05-12 17:55:24 -07:00
James Lu
06d49f4433 Revert "Irc: only disconnect the write portion of the socket"
This reverts commit f4babc6f28.
2017-05-12 17:19:16 -07:00
James Lu
7daef0000b Irc: break out of processQueue properly when a network disconnects 2017-05-09 23:31:20 -07:00
James Lu
701f01fa4f Irc: reword error message from last commit to be more concise 2017-05-09 18:19:35 -07:00
James Lu
bac6dc36b4 Irc: log socket.send() errors with a proper traceback 2017-05-09 18:06:51 -07:00
James Lu
4ca8667669 Irc: fix 62aea23879 (lowercase queue) 2017-05-07 17:34:04 -07:00
James Lu
62aea23879 Irc: fix throttle_time not actually blocking for the defined amount of time
Passing the timeout to queue.Queue.get is invalid because it'll only block if there ISN'T any text to send.
2017-05-07 17:31:31 -07:00
James Lu
15ed251ed7 Irc: refuse to queue send data if aborted is set 2017-05-07 13:46:25 -07:00
James Lu
de67fe0d37 Irc: log socket shutdown errors to debug 2017-05-07 13:46:15 -07:00
James Lu
f4babc6f28 Irc: only disconnect the write portion of the socket
Per https://docs.python.org/3/howto/sockets.html#disconnecting
2017-05-07 13:46:06 -07:00
James Lu
5d629f7331 matchHost: extend negation via "!" to regular hostmasks as well as exttargets 2017-05-04 19:04:03 -07:00
James Lu
6d96dd21ac updateTS: remove usage of mutable as function default argument
This may subtly break things: https://docs.quantifiedcode.com/python-anti-patterns/correctness/mutable_default_value_as_argument.html
2017-04-09 14:45:12 -07:00