3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00
Commit Graph

82 Commits

Author SHA1 Message Date
James Lu
3a53005d8c protocols: messageClient -> message, noticeClient -> notice 2016-01-16 16:44:23 -08:00
James Lu
acdd7dbb78 protocols: rename joinClient(...) -> join(...) 2016-01-16 16:36:45 -08:00
James Lu
925e11d6c4 classes.Irc: when disconnecting, suppress socket read errors in run() (#152) 2016-01-09 20:25:53 -08:00
James Lu
cf2fcf9263 classes.Irc: only allow one shutdown sequence at a time (#152) 2016-01-09 20:25:53 -08:00
James Lu
f70ca54ae4 classes: IRC object disconnect tweaks (really fixes #152)
- disconnect() was missing a socket.shutdown() cause, as socket.close() does NOT cause connections to close immediately! https://docs.python.org/3/library/socket.html#socket.socket.close
- Merge _disconnect() and disconnect(), the latter was just a wrapper with little use
2016-01-09 20:04:10 -08:00
James Lu
b1aa4c2ec5 classes: show instance type in classes.IrcUser/IrcChannel/IrcServer 2016-01-09 19:15:39 -08:00
James Lu
0c48ea6791 Merge branch 'staging' into devel
Fix #154. This everts what was done to address #152, but unclean shutdowns are not as bad as having the server fork endlessly!
2016-01-07 22:08:12 -08:00
James Lu
a385bc32d9 Revert "classes: replace threading.Timer with normal threads for schedulePing"
This reverts commit 64bb646d1e.
2016-01-05 19:35:16 -08:00
James Lu
a7104dc01c Revert "classes: actually, loop schedulePing only when connection_thread is alive"
This reverts commit 124100fcf5.
2016-01-05 19:35:15 -08:00
James Lu
6577013ada Irc: Return False instead of None when isInternalClient fails to find a match 2015-12-31 17:53:33 -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
124100fcf5 classes: actually, loop schedulePing only when connection_thread is alive
Related to #152. Probably still not perfect, but shutdowns are somewhat faster than they were before.
2015-12-29 11:36:39 -08:00
James Lu
91f75e4d93 classes: Don't require self.connected to be set for "No data received" disconnects
Previously, this would've caused an infinite loop if a socket closed (e.g. from server shutdown) while PyLink was connecting.
2015-12-29 11:23:06 -08:00
James Lu
64bb646d1e classes: replace threading.Timer with normal threads for schedulePing
Closes #152.
2015-12-29 10:58:22 -08:00
James Lu
11b8821228 classes: log raw hook data for reference 2015-12-26 16:43:40 -08:00
James Lu
01a4da5d3a classes: Fix another missing docstring 2015-12-26 14:47:23 -08:00
James Lu
fbf33e15a6 classes: in Irc.runline(), return the parsed hook args after processing 2015-12-22 10:46:54 -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
b0e66ddd6e classes: log offending hook data when a hook function errors
Closes #126.
2015-11-08 10:56:09 -08:00
James Lu
2eeba50a2a Modularize TS updating code (Closes #129) 2015-11-08 10:49:09 -08:00
James Lu
e4cfd1e1e6 Irc: log unrecognized commands to INFO too 2015-10-23 19:07:17 -07:00
James Lu
e942b411f1 classes: introduce irc.reply() 2015-10-23 18:29:01 -07:00
James Lu
f80b383d06 Irc: actually abort when handle_events errors 2015-10-09 21:35:42 -07:00
James Lu
4e2876104f Irc: require autoconnect value to be >= 1
This prevents sending a flood of connects whenever a server is unreachable.
2015-10-02 23:21:40 -07:00
James Lu
1c8ee5d84b core: support IPv6 connections 2015-10-02 23:17:57 -07:00
James Lu
7e57798f4d core: refresh various serverdata attributes on REHASH 2015-10-02 23:17:55 -07:00
James Lu
55d9eb240f classes.Irc: prettier __repr__ 2015-09-28 19:25:45 -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
97a135a6f1 classes: add special PYLINK_SELF(PRIVMSG/NOTICE) hooks for command loopback 2015-09-26 10:20:23 -07:00
James Lu
034731ab1e core: log which plugin is being called when calling hooks 2015-09-26 10:20:23 -07:00
James Lu
822544e3cc core: keep track of where last command was called & make command calling a shared function
Prerequisite for FANTASY command implementation (#111).
2015-09-26 10:20:23 -07:00
James Lu
c77d170765 Move parseArgs and removeClient into the base Protocol class
These aren't really TS6-specific, and can be useful anywhere.
2015-09-24 18:03:30 -07:00
James Lu
19c4c2ce3f classes: split up run() into run() and runline()
This helps the debugging process, by allowing us to also inject lines directly into the protocol module.
2015-09-19 10:31:43 -07:00
James Lu
fb91ff8ea3 Remove allow_abcd attributes from protocols (not needed anymore) 2015-09-17 19:07:37 -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
b87e34efa2 Slightly more consistent logging format... 2015-09-16 21:32:27 -07:00
James Lu
7ced47e9b3 bots: don't allow setting umode +o on InspIRCd users (forbidden and causes desync) 2015-09-14 18:09:39 -07:00
James Lu
c5b6658200 bots: more validation in "MODE" to prevent bad things from happening
This adds a new "allow_forceset_usermodes" attribute to protocol modules, which determines whether the IRCd allows us to force usermode changes on other servers' clients.

Also, make sure our target is a valid nick/UID/channel, and that the parsed modes are not empty!
2015-09-14 17:46:20 -07:00
James Lu
fd16a42708 Irc: log the offending line when an error is caught in handle_events 2015-09-13 17:58:59 -07:00
James Lu
a28715c2c6 IrcChannel: allow .deepcopy() 2015-09-13 13:47:04 -07:00
James Lu
46fab1cab7 classes.FakeProto: store UIDs as strings 2015-09-12 22:26:38 -07:00
James Lu
3a8d3d146c protocols: make "uidgen" a protocol instance attribute 2015-09-12 16:02:51 -07:00
James Lu
df42a81191 classes/protocols: store server descriptions internally
Closes #106.
2015-09-12 12:07:59 -07:00
James Lu
3217f726f8 Fix those test cases again. 2015-09-06 23:39:10 -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
eac81de176 Irc: add internal support for aborting connections
New "aborted" threading event, which can be set to True in order to stop the existing run() loop

Autoconnect confirmed to work with this.
2015-09-02 22:06:18 -07:00
James Lu
5480ae14c4 classes: Remove "opertype" IrcUser() argument
This is useless and should've never been here, oops.
2015-08-31 14:11:12 -07:00
James Lu
f9b4457ced Decorate relay clients, etc. with custom OPERTYPEs
New PyLink internal hook: PYLINK_CLIENT_OPERED, called (supposedly) when a client opers up.
2015-08-31 13:31:20 -07:00