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

446 Commits

Author SHA1 Message Date
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
James Lu
1062e47b72 classes.IrcChannel: default modes to +nt on join
This may have regressions; who knows...
2015-08-31 09:09:03 -07:00
James Lu
d270a18285 Remove unused imports 2015-08-30 12:53:30 -07:00
James Lu
549a1d1ba4 classes: IrcServer.users is now a set() 2015-08-29 12:35:06 -07:00
James Lu
adb9ef13a6 classes: fixes for the test API
- fakeirc: drop dummyhook, call hooks in run() - the protocol module doesn't do this for us anymore
- Irc: don't thread if we're in test mode (temp. hack for now)
2015-08-29 10:10:45 -07:00
James Lu
973aba6de7 Move utils' global variables to world.py 2015-08-29 09:39:33 -07:00
James Lu
b71e508acc classes.Irc no longer needs a conf argument; tweak tests again 2015-08-28 19:38:16 -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
090fa85a46 Move Irc() from main.py to classes.py
This prevents import loops (main->utils->classes->main) from the changes in the next commit.
2015-08-25 20:37:47 -07:00
James Lu
1a57dfcdc3 prs+IrcUser: add incoming (handle_away) and outgoing (awayClient) AWAY handling 2015-08-12 04:17:01 -07:00
James Lu
254ccea0a3 remove some debugging cruft and unused imports 2015-07-23 11:46:45 -07:00
James Lu
8a1f965303 Consistently use applyModes in spawnClient, so user modes are stored like ('o', None) instead of ('+o', None)
Drop the 'modes' argument in IrcUser, for this is incorrect.
2015-07-22 21:14:22 -07:00
James Lu
686467ffa6 Remove endburst toggling in spawnServer, has_bursted IrcServer flag
Neither are being used at all; they're essentially dead code.
2015-07-22 20:39:38 -07:00
James Lu
b1e409ff3e relay: unbreak topic handling (closes #68)
Introducing a new .topicset attributing in IrcChannel denoting whether we've received a TOPIC for this channel from the uplink yet.
2015-07-20 13:18:04 -07:00
James Lu
a51cfcb7b2 Fix fakeirc and tests for relay (#56) 2015-07-17 22:52:55 -07:00
James Lu
d97fce8205 IrcUser & pr/insp: Implement user channel tracking 2015-07-16 12:20:40 -07:00
James Lu
67f5bbba4b add a utils.started threaded trigger, so plugins can ACTUALLY wait until all Irc objects have been initialized to do their work 2015-07-13 16:07:55 -07:00
James Lu
ffec80ee45 tests/: update for new multi-net config format 2015-07-09 18:42:38 -07:00
James Lu
8576778ddc Make the 'bot' conf block available in Irc() as irc.botdata
Protocol modules shouldn't read conf directly, so that we can override the config in testing.
2015-07-08 13:56:17 -07:00
James Lu
8f75c5363c Move all the FakeIRC stuff to classes.py, update FakeIRC with the ability to get hook data 2015-07-07 18:07:20 -07:00
James Lu
33d23893f8 pr/inspircd: update channel TS when receiving remote FJOIN with lower TS 2015-07-06 19:00:20 -07:00
James Lu
8bed47e7bb pr/inspircd: handlers for FTOPIC and TOPIC (ref #31); make handle_nick return 'newnick' instead of 'target' as arg 2015-07-06 15:33:23 -07:00
James Lu
b22f674785 Support prefix modes (+qaohv); refactor applyModes to apply in place; add removeuser() to IrcChannel
Closes #16.
2015-07-05 12:48:39 -07:00
James Lu
dafeff6324 Add channel mode handling (more testing needed)
Closes #28.
2015-07-05 00:20:45 -07:00
James Lu
0c8a30323a proto/inspircd: raise ProtocolError instead of calling sys.exit on errors 2015-07-03 18:07:01 -07:00
James Lu
c686523a6e Add pseudoserver spawning, adapting _sendFromServer and spawnClient accordingly.
Now you can spawn multiple servers for a multi-server botnet!

Also, create proto.isInternalServer() / utils.isServerName() checkers.

Closes #22.
2015-06-21 15:03:58 -07:00
James Lu
aeb53a14e3 Make IrcUser.modes a set 2015-06-20 20:58:25 -07:00
James Lu
379f442a14 Add basic user mode tracking (Closes #10) 2015-06-20 20:36:35 -07:00
James Lu
70480b8830 Make IrcChannel.users a set and add part handling
This should be everything needed for basic channel enumeration: closes #13.
2015-06-07 09:43:13 -07:00
James Lu
4b9e7b1937 Fix #17 (netsplit quits)
copy() all the things! Also purge empty channels on quit.
2015-06-07 09:33:35 -07:00
James Lu
6680942424 More code and broken shenanigans
- plugins/commands.py: add admin-only eval command
- add IrcChannel class and basic channel (FJOIN/QUIT) handling
- Move SQUIT/QUIT handling code to a shared removeClient function
    - Unfortunately, this causes a regression where the users and channels indexes aren't purged on a netsplit :(
2015-06-06 23:06:33 -07:00
James Lu
c33d5922c6 Turn spawn pseudoclient and JOIN into its own functions, and move IrcUser/IrcServer to its own module
These classes are protocol independent, so we may as well split them for future protocol modules.
2015-06-06 22:17:45 -07:00