3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-28 05:29:25 +01:00
Commit Graph

2350 Commits

Author SHA1 Message Date
James Lu
a177a58ae7 pr/insp: fix some bugs in spawnClient 2015-07-07 17:46:56 -07:00
James Lu
7fb60c1ffa pr/inspircd: finish off handlers (add KNOCK, INVITE, NOTICE)
Closes #18.
Closes #31.
2015-07-07 15:31:12 -07:00
James Lu
098b29ae2d Correction: it is legal for a server name to end with '.', but it can't start with it 2015-07-07 14:31:47 -07:00
James Lu
cfc840ebb3 Actually implement 'nick', 'ident', and 'loglevel' config options 2015-07-07 12:14:55 -07:00
James Lu
087a4e7e5c Drop "prefix" config entry, it's not being used
Closes #26. Plugins can implement their own fantasy-style triggers via message hooks, so I'm not sure this really needs a place in the core.
2015-07-07 12:03:30 -07:00
James Lu
7f6c8b0e52 pr/inspircd: enforce minimum protocol version of 1202
We're using InspIRCd 2.0+ specific features (SAVE, CAPAB CHAN/USERMODES), so this is required.
Source: https://wiki.inspircd.org/List_of_protocol_changes_between_versions#Version_1202
2015-07-07 10:55:14 -07:00
James Lu
4cc7781f0d pr/insp: send oldnick in handle_nick hook
Since hooks are only called after processing is done by the protocol module, plugins would have no way of knowing what the old nick of the user was.
2015-07-06 19:44:55 -07:00
James Lu
d833be5f4b pr/insp: smarter spawnClient() with kwargs; implement conf['bot']['prefix']
Red #26.
2015-07-06 19:42:09 -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
fe1f90bcd1 FakeIRC: swap arrows in debug output
This is for more consistency with the real protocol debug output:

-> is protocol OUTBOUND - irc.send()
<- is protocol INBOUND - irc.run()
2015-07-06 12:54:30 -07:00
James Lu
b3f369aa81 tests for utils.joinModes so I don't break it in the future 2015-07-06 12:38:45 -07:00
James Lu
74339d1038 Fix joinModes, and use it in protocol/inspircd's joinClient
In short, PyLink should be sending FJOINs to channels with the modes that it already has (or what we believe it has). This prevents clearing mode lists when PyLink's channel TS is slightly earlier than the IRCd's.
2015-07-06 12:28:10 -07:00
James Lu
170620c410 applyModes: remove old modepairs when setting non-list modes that require params
Closes #30.
2015-07-05 23:15:17 -07:00
James Lu
48c3b4b2e9 applyModes: chop off the +/- part of each mode tuple when storing mode lists
Also update these tests accordingly.
2015-07-05 23:00:14 -07:00
James Lu
f1e26b6c55 Fix tests for FakeIRC and update comment style 2015-07-05 22:59:55 -07:00
James Lu
2cbd6fd851 Tests for FMODE/FJOIN, and bugfixes 2015-07-05 19:19:49 -07:00
James Lu
87781abc82 Logging format tweaks 2015-07-05 16:46:57 -07:00
James Lu
211decd2aa everything: Improve logging 2015-07-05 13:44:48 -07:00
James Lu
54dff7a15a Convert print() calls to log calls, Round 1 2015-07-05 13:29:18 -07:00
James Lu
f06bcc7928 Merge commit 'bd755e137ffa034007a77d75fbd00d21e759163e' into wip/logger-module
Conflicts:
	proto.py
2015-07-05 13:22:17 -07:00
James Lu
bd755e137f pr/inspircd: fix a typo in removeClient 2015-07-05 13:07:18 -07:00
James Lu
bd03e00c74 applyModes: ignore unsupported prefix modes (e.g. InspIRCd's +yY) 2015-07-05 12:53:53 -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
d62a413c50 fix last commit 2015-07-05 12:40:34 -07:00
James Lu
2ecaab1586 pr/inspircd: catch KeyError only in the function lookup, not the function call!
This suppressed KeyErrors in execution... BAD
2015-07-05 12:38:55 -07:00
James Lu
dafeff6324 Add channel mode handling (more testing needed)
Closes #28.
2015-07-05 00:20:45 -07:00
James Lu
8b93b78d13 Support modes with arguments in our modestring parsers
Closes #27.
2015-07-04 23:49:28 -07:00
James Lu
3749e642f2 pr/inspircd: fix typo in handle_mode 2015-07-04 23:47:27 -07:00
James Lu
3e86cbdd33 Better protocol capability negotiation
Respect our uplink's supported c/umodes, NICKLEN, and max channel name lengths.
2015-07-04 23:12:00 -07:00
James Lu
35346d7990 pr/inspircd: part messages are optional... 2015-07-04 19:08:58 -07:00
James Lu
d23d34e316 Refactor hooks to send parsed arguments instead of raw args
ref #18.

- Command handlers that support hooks will now return parsed args, which are then sent to the hooks
- Hook commands are now stored in uppercase letters, consistent with the IRC spec
2015-07-04 19:00:29 -07:00
James Lu
b6f489fa9c add tests for KILL, KICK, UID, and SERVER handlers
todo: rewrite the MODE handling so it doesn't suck, and test those too
2015-07-04 12:34:33 -07:00
James Lu
8ea62c31de tests for spawnServer and SQUIT, make server name case-insensitive 2015-07-04 11:57:21 -07:00
James Lu
942f97352d test kick/nickClient; make kickClient update channel userlist... 2015-07-03 23:48:28 -07:00
James Lu
18528c9cab add tests for spawn/quit/join/partClient 2015-07-03 23:32:41 -07:00
James Lu
d6341109be inspircd: bug fixes found by testing
- Lowercase all channel names consistently, to prevent duplicates
- Store uidgen as an attribute of Irc, so each Irc instance gets its own set of UID generators
- Raise an error in handle_part of the user doesn't exist in the channel.
2015-07-03 23:31:57 -07:00
James Lu
0bfe2b2a21 test_proto_inspircd: fix 'python3 -m unittest' compat 2015-07-03 18:26:13 -07:00
James Lu
8ad68023d6 Add tests for pr/inspircd, a common FakeIRC class, and tests for that too 2015-07-03 18:07:47 -07:00
James Lu
fed107b12b main.py: don't assign self.socket twice 2015-07-03 18:07:32 -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
0f4d3df757 inspircd.py: spawnServer tweaks
- Send ENDBURST from the server, not its uplink
- Check to make sure SID is 3 characters long...
2015-07-03 17:10:32 -07:00
James Lu
991e86a8cb unittests! wow! 2015-07-03 17:05:44 -07:00
James Lu
072cc72602 defaultdict for channels, fix user tracking in {join|part}Client, isInternal* to utils
- collections.defaultdict for simpler channel handling
- proto/inspircd: fix join/partClient not updating the channel's user list
- move isInternal* to utils
2015-06-23 19:29:53 -07:00
James Lu
6370ad492f Add basic command hooks (ref #18) 2015-06-23 19:08:43 -07:00
James Lu
28e7b52ef4 utils.TS6UIDGenerator: initialize SID variable once per instance 2015-06-22 16:51:42 -07:00
James Lu
f37af68e3f utils: tweak TS6UIDGenerator again
Only increment the UID table after we fetch the UID, so that the initial value (AAAAAA) gets used too.
2015-06-21 18:11:17 -07:00
James Lu
6a69ed0459 proto/inspircd: handle RSQUIT for removing PyLink leaves 2015-06-21 17:07:31 -07:00
James Lu
ab1a946364 proto/inspircd: fix ping reply syntax
Although InspIRCd doesn't seem to care, the correct PONG syntax is:

-> :<our sid> PONG <our sid> <their sid>,

and not

-> :<our sid> PONG <our sid>,

which was used prior to this commit.
2015-06-21 15:04:19 -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