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

330 Commits

Author SHA1 Message Date
James Lu
eef97ac035 protocols: consolidate killServer / killClient into kill() 2016-01-16 17:03:22 -08:00
James Lu
ee65ac60e1 protocols: rename sjoinServer(...) -> sjoin(...) 2016-01-16 16:53:46 -08:00
James Lu
9a61e64dfc protocols: squitServer(...) -> squit(...) 2016-01-16 16:53:06 -08:00
James Lu
196282db86 protocols: numericServer(...) -> numeric(...) 2016-01-16 16:47:35 -08:00
James Lu
108be5e25e protocols: rename knockClient -> knock 2016-01-16 16:41:17 -08:00
James Lu
20cb65e668 protocols: rename awayClient -> away 2016-01-16 16:40:36 -08:00
James Lu
b4e5c57a35 protocols: rename inviteClient(...) -> invite(...) 2016-01-16 16:38:27 -08:00
James Lu
acdd7dbb78 protocols: rename joinClient(...) -> join(...) 2016-01-16 16:36:45 -08:00
James Lu
48203ff321 protocols: reword error text 2016-01-09 17:44:18 -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
741fed9acd protocols: allow changing remote users' hosts in updateClient
Closes #142.
2015-12-30 15:54:09 -08:00
James Lu
bf7522697a Rename PYLINK_CLIENT_OPERED hook -> CLIENT_OPERED
To be consistent, any PYLINK_* hooks should internal hooks sent out by PyLink itself. CLIENT_OPERED, on the other hand, requires protocol modules to send it and thus, shouldn't be labeled as a PYLINK_* hook.
2015-12-26 15:41:22 -08:00
James Lu
11adee9d78 Yet another documentation refresh (#113) 2015-12-26 14:45:28 -08:00
James Lu
3c51231ce8 inspircd: re-add RSQUIT handler (closes #150) 2015-12-24 19:52:52 -08:00
James Lu
349cff36e1 protocols: in TOPIC hooks, send the topic as keyword "text" instead of keyword "topic"
This is just to be more consistent, as other hooks usually use "text" for text fields.
2015-12-18 22:05:10 -08:00
James Lu
d60a48bb11 protocols: actually update away status in awayClient
"Oops, I forgot to do this."
2015-12-17 21:50:50 -08:00
James Lu
09bb2976f8 inspircd: Remove a couple of overzealous find+replaces 2015-12-17 21:19:40 -08:00
James Lu
6b14a885bc protocols: add support for endburst_delay in spawnServer (#128) 2015-12-17 21:18:11 -08:00
James Lu
2008df047c Fix logic in last commit
ts has to be set to orig_ts if missing, otherwise a later comparison would try to check for None <= some int, which would error
2015-11-08 15:14:03 -08:00
James Lu
2eeba50a2a Modularize TS updating code (Closes #129) 2015-11-08 10:49:09 -08:00
James Lu
c5b3441f6a inspircd: alias SVSTOPIC to FTOPIC (reported by @siniStar7boy)
SVSTOPIC is used by services to set topics when m_topiclock (server side topic locking) is enabled on the IRCd. Unfortunately, usage of this isn't documented anywehere......
Basically, this makes PyLink treat it as a regular server topic change (FTOPIC), since the arguments are the same anyways.
2015-10-31 19:15:03 -07:00
James Lu
181c40d9fe inspircd: fix another "find all, replace" mistake 2015-10-08 21:06:35 -07:00
James Lu
8bde21f1e6 inspircd: remove clients from state when killing own clients
Closes #115.
2015-10-08 20:13:37 -07:00
James Lu
f015fe5e25 Documentation updates, finish off pmodule-spec.md (#113) 2015-09-24 18:36:54 -07:00
James Lu
3351aafc79 inspircd: fix wrong arguments in numericServer() stub 2015-09-24 18:13:11 -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
f38958995c Store opertypes with spaces instead of underscores, and only change them back when sending OPERTYPE
Another "Janus sucks" commit - it should be always using underscores when sending OPERTYPE, but it doesn't...
2015-09-20 11:25:45 -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
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
6476aefb5f Merge branch 'master' into devel
Conflicts:
	protocols/inspircd.py
2015-09-14 16:55:35 -07:00
James Lu
1f95774131 inspircd: add proper fallback value for OPERTYPE? 2015-09-13 17:04:17 -07:00
James Lu
c82a0a771c protocols: return an "oldchan" IrcChannel object with the previous state of a channel when processing channel mode changes
This allows plugins to check for op statuses, etc. before the mode change is processed.
2015-09-13 13:47:18 -07:00
James Lu
17282aa049 protocols: fix typo and ts6._sendModes when input is a set() 2015-09-12 23:35:20 -07:00
James Lu
3a8d3d146c protocols: make "uidgen" a protocol instance attribute 2015-09-12 16:02:51 -07:00
James Lu
0cbdefcab1 ts6/inspircd: fix TS6SIDGenerator not actually incrementing...
It was being replaced on every call... It was only supposed to do that if sidgen hadn't been set yet!
2015-09-12 12:08:02 -07:00
James Lu
df42a81191 classes/protocols: store server descriptions internally
Closes #106.
2015-09-12 12:07:59 -07:00
James Lu
29065fdd04 protocols/: remove unused imports & various documentation improvements 2015-09-08 19:51:14 -07:00
James Lu
983acd5adc Move MODE handling back from ts6_common->inspircd, now that ts6.py does different handling 2015-09-08 19:50:46 -07:00
James Lu
6c503b3603 Fix typos and other stupid mistakes... 2015-09-06 23:18:27 -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
3b7d81d62a inspircd: fix typo in comment 2015-09-05 14:28:18 -07:00
James Lu
9f2d8a1b01 Document the sources of protocols/inspircd & ts6_common 2015-09-05 14:25:11 -07:00
James Lu
72cfe04904 protocols: respect serverdesc config options in spawnServer 2015-09-04 18:59:57 -07:00
James Lu
759f6c4492 protocols/: add outgoing squitServer() 2015-09-04 18:55:39 -07:00
James Lu
167f5cd0cf Move shared stuff into a ts6_common library
Closes #78.
2015-09-04 11:24:40 -07:00
James Lu
1be4034681 Make TS6 command parsing a shared library (#78) 2015-09-03 12:59:50 -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
26e102f01a Show oper types on WHOIS 2015-08-31 14:52:56 -07:00
James Lu
531ebbba0a Merge branch 'master' into devel 2015-08-31 13:33:30 -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
c8e7b72065 protocols: lowercase channel names in PRIVMSG handling
Merge NOTICE and PRIVMSG handlers together; they're essentially the same thing.
2015-08-31 11:45:00 -07:00
James Lu
4a964b1595 Merge branch 'master' into devel 2015-08-31 10:58:47 -07:00
James Lu
37eecd7d69 pr/inspircd: use OPERTYPE to oper up clients correctly, and handle the metadata accordingly 2015-08-31 10:31:50 -07:00
James Lu
7620cd7433 pr/inspircd: fix compatibility with channel mode +q (~)
InspIRCd's defaults use "founder" as the mode name for cmode +q, not "owner". My config was different, so I overlooked this.
2015-08-30 23:16:39 -07:00
James Lu
549a1d1ba4 classes: IrcServer.users is now a set() 2015-08-29 12:35:06 -07:00
James Lu
80bebe3827 protocols: also validate TS on incoming SJOIN 2015-08-26 14:59:05 -07:00
James Lu
977b69b8e9 protocols/: Fix args parsing when the sender UID == the last argument
args.index() would return 0 instead of the index of the current argument.
2015-08-26 14:57:46 -07:00
James Lu
05be3e6c17 pr/: add prefixmodes in sjoinServer if TS <= theirs
The old comparison of our TS < theirs was wrong, because modes are merged (not dropped) when two channels of the same TS join.
2015-08-24 18:37:39 -07:00
James Lu
694e7b87f6 various: make the server description configurable
Two options for this: bot::serverdesc, and server::<network>::serverdesc, with the latter taking precedence if present.
2015-08-24 18:14:35 -07:00
James Lu
1d245bf001 protoocols.sjoinServer: only add prefix modes to channel state if our TS < theirs 2015-08-20 01:32:30 -07:00
James Lu
61d95c19cc protocols: delete empty non-permanent channels 2015-08-15 23:29:40 -07:00
James Lu
c99a6a7b9d protocols: update topic in channel state when sending outbound TOPIC 2015-08-15 22:34:40 -07:00
James Lu
4352a68357 Check for TS changes on SJOIN (both incoming and outgoing)
Restore relay to the devel branch; TS bursts shouldn't be handled there, but in the protocol modules.

TODO: fix prefixmodes being cleared after BURST, and never being reset?
2015-08-15 19:53:09 -07:00
James Lu
0d41e35d9c Merge branch 'devel' into wip/handle-ts-bursts
Conflicts:
	plugins/relay.py
2015-08-15 19:28:49 -07:00
James Lu
13e4baba8b inspircd: also strip listmodes in joinClient (#58) 2015-08-14 08:47:23 -07:00
James Lu
7d912bbb28 pr/insp: Strip out listmodes in FJOIN
They should always be sent separately according to the protocol documentation: https://wiki.inspircd.org/InspIRCd_Spanning_Tree_1.2/FJOIN

Closes #58.
2015-08-12 07:05:05 -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
bf3116d704 First attempt at handling channel TS @ burst (#93)
Doesn't quite work yet, more testing needed.
2015-08-05 06:14:34 -07:00
James Lu
8a134aadc5 Remove duplicate assignment of irc.uidgen 2015-08-03 19:44:11 -07:00
James Lu
e5eb58ee73 inspircd: use parse_as instead of forcibly mapping ENCAP to KNOCK 2015-08-03 05:00:32 -07:00
James Lu
e354ada838 relay: fix nick collision loop on SAVE + when both tagged UID and untagged UID exist on one net
This fixes a clash when for example: both 42XAAAAAA and _42XAAAAAA exist on a network, and PyLink tries to relay both nicks as _42XAAAAAA/network.

Also, this adds an oldnick argument to the SAVE protocol handler, which is then used by relay.normalizeNick to check whether the original pre-SAVE nick is also in use, in the event of nick collisions.
2015-07-25 18:27:30 -07:00
James Lu
a4da9b5324 protocol/relay: fix handling of KILLs sent to non-relay users 2015-07-24 18:26:31 -07:00
James Lu
007a1d9389 Merge branch 'master' into devel 2015-07-24 11:09:53 -07:00
James Lu
01220b3024 correction: InspIRCd uses RFC1459 case mapping by default 2015-07-24 10:59:04 -07:00
James Lu
868b4503e6 protocols: Fix #81 - that was easy!
Split data by only one space at a time, not as many spaces as possible. Thanks to @nathan0.
2015-07-23 19:09:19 -07:00
James Lu
58a8d7134c Fix handling of inbound CHG* 2015-07-23 11:02:32 -07:00
James Lu
8799e1ccc8 spawnClient: add ts as opt. argument; relay: spawn pseudoclients w/ TS of original user 2015-07-23 00:11:24 -07:00
James Lu
d52fba37b8 add numericServer for sending raw numerics from servers, and WHOIS handling in coreplugin
Basic WHOIS handling (user information, server information, IRCop access) are sent. #72

TODO: send channel lists, an extra note for relay clients, user modes, and idle time
2015-07-22 21:15:34 -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
35cdfbf7e6 Declare IRCd casemapping in protocol modules, and respect these in utils.nickToUid
This adds a new utils.toLower(irc, text) function which returns the lowercased version of <text> based on <irc>'s declared case mapping.

Closes #75.
2015-07-22 20:31:45 -07:00
James Lu
ea7681502f fix some bugs, introduce others 2015-07-21 17:33:36 -07:00
James Lu
9b8ef0a45d make relay and ts6 a bit less, well, buggy 2015-07-21 12:44:01 -07:00
James Lu
72be5ca79c inspircd: make handle_part return a list of channels, not just one
Some IRCds, like TS6, allow sending multiple channels (as a comma-separated list) in PART.

Update relay accordingly.
2015-07-20 19:52:52 -07:00
James Lu
3494d4f794 inspircd: remove RSQUIT handler
Events like this shouldn't be handled at the protocol level, ever. There's little point in adding this globally, since plugins should be able to choose what happens when they receive an SQUIT.
2015-07-20 18:05:42 -07:00
James Lu
a10a18d9cc Irc: make prefixmodes a dict mapping chars to their prefixes
This is needed by TS6 support (#40), which send the characters (@+) instead of modes
2015-07-20 16:48:59 -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
fe9c317f2c inspircd: make channel user tracking more fault tolerant (in sjoinServer / handle_part) 2015-07-19 23:46:19 -07:00
James Lu
bf444f3f6a pr/insp: Servers should use FTOPIC, not TOPIC to send topics 2015-07-19 17:27:53 -07:00
James Lu
0cb9065d53 pr/insp: coerse 'reginvite' named mode to 'regonly' 2015-07-19 16:53:51 -07:00
James Lu
0540e10d50 relay: don't add bans that don't match nick!user@host
Closes #55.
2015-07-19 16:53:51 -07:00
James Lu
a51cfcb7b2 Fix fakeirc and tests for relay (#56) 2015-07-17 22:52:55 -07:00
James Lu
fdea348cbe move hook calling out of pr/insp and into Irc 2015-07-17 16:09:50 -07:00
James Lu
95853924ad Revert "protocols/: thread calls to each event hook to prevent blocking globally"
This reverts commit 99fd6060a7, which caused a bunch of race conditions in relay :/

Ref #59.
2015-07-17 15:13:57 -07:00
James Lu
f41e1a2eb5 Fixes for connection handling?
XXX: using SQUIT on the PyLink server doesn't respect autoconnect delays; why?
2015-07-17 15:08:24 -07:00
James Lu
99fd6060a7 protocols/: thread calls to each event hook to prevent blocking globally
Closes #59.
2015-07-17 14:35:02 -07:00
James Lu
9bef93c341 More stuff for PINGing uplink and autoreconnect (#42 #59 #57)
Doesn't quite work yet; still blocks everything on disconnect for some reason...
2015-07-17 13:41:14 -07:00
James Lu
0aa2f98705 Move client spawning, command / KILL / KICK handling outside the protocol module
New plugin 'coreplugin' takes care of command/KILL/KICK handling, while client spawning is moved into Irc.spawnMain() and is used by the former.

Closes #33.
2015-07-16 21:52:44 -07:00
James Lu
73c625a429 pr/insp: don't raise KeyError when removing channel from user fails 2015-07-16 16:48:54 -07:00
James Lu
d97fce8205 IrcUser & pr/insp: Implement user channel tracking 2015-07-16 12:20:40 -07:00
James Lu
f9d82153bb pr/insp: map FIDENT/FHOST/FNAME hooks to their CHG* counterparts 2015-07-15 23:23:46 -07:00
James Lu
e413a21e68 pr/insp: send the list of affected users in handle_squit 2015-07-15 19:08:49 -07:00
James Lu
798476c850 pr/insp: don't crash when a server sends TOPIC 2015-07-15 19:08:36 -07:00
James Lu
6e37e1c05d make Irc.connected a threaded event object, setting it to True ONLY when we receive server capabilities from our uplink
The previous behavior set this to True as soon as we ran connect(), but this caused problems because the default capabilities (i.e. nicklen)
that Irc() initializes won't match the real value of the network.
2015-07-15 13:49:12 -07:00
James Lu
67190d8329 pr/insp: send the user data of the kileld user in handle_kill 2015-07-14 23:23:35 -07:00
James Lu
ef0436c906 inspircd: merge _sendFromUser and _sendFromServer into _send
They do exactly the same thing, just with different variable names. Keeping two of these is useless...

(why didn't I notice this earlier?)
2015-07-14 22:33:56 -07:00
James Lu
8942c2fa08 pr/insp: add kickServer 2015-07-14 22:32:05 -07:00
James Lu
79a1ac9006 pr/insp: fix sjoinServer not updating the internal modes list 2015-07-14 18:23:15 -07:00
James Lu
994b2961ee pr/insp: call endburst AFTER the server object is initialized...
derp
2015-07-14 12:03:22 -07:00
James Lu
59295f921b relay: part users on DELINK/DESTROY 2015-07-13 23:29:20 -07:00
James Lu
c11dc769cf pr/insp: allow explicitly specifying ts in mode* 2015-07-13 22:42:33 -07:00
James Lu
a7a5688e69 pr/insp: add sjoinClient(), make auto-endburst optional for spawnServer 2015-07-13 16:06:58 -07:00
James Lu
45cef19eaa Make plugins global, not per IRC instance 2015-07-12 23:28:34 -07:00
James Lu
d19cabf16c pr/insp: save irc.max{nick|chan}len correctly as integers 2015-07-12 14:00:52 -07:00
James Lu
c655d975a6 pr/insp: remove isNick check in spawnClient 2015-07-12 14:00:33 -07:00
James Lu
f8a7bc6033 pr/insp: use TS6SIDGenerator in spawnServer if no SID is explicitly given 2015-07-11 20:21:10 -07:00
James Lu
eae0aa5aa8 pr/insp: Add missing killServer/killClient functions 2015-07-09 19:05:37 -07:00
James Lu
08a187aee6 pr/insp: add updateClient() and FIDENT/FHOST/FNAME handlers
updateClient: Changes the <field> field of <target> PyLink PseudoClient <client numeric>.
2015-07-09 17:04:24 -07:00
James Lu
96c3ea2d82 pr/insp: add topic/invite/knockClient commands
Closes #34.
2015-07-09 16:32:29 -07:00
James Lu
c8f12f2ab1 move messaging functions to protocol (#35)
Closes #36.
2015-07-09 16:23:20 -07:00
James Lu
f01269287e pr/insp: remove checks for valid nick/channel; they're done in plugins now 2015-07-08 23:00:50 -07:00
James Lu
20772e5429 inspircd.nickClient: allow nick 0 to equal the target user's UID 2015-07-08 21:17:34 -07:00
James Lu
049b7f5049 pr/insp: add modeServer, modeClient commands
Closes #32.
2015-07-08 18:23:32 -07:00
James Lu
cbfabb2ba1 pr/insp: add OPERTYPE command handler
This is sent by InspIRCd for oper ups; there is no MODE command for it.
2015-07-08 18:03:08 -07:00
James Lu
b92a9ce950 pr/insp: fix handle_mode setting modes on the wrong client 2015-07-08 15:10:09 -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
2d4d8dd247 tests and stuff 2015-07-08 13:35:20 -07:00
James Lu
85e6a1aea2 pr/insp: more tests for hooks, etc 2015-07-07 20:59:35 -07:00
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
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
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
f1e26b6c55 Fix tests for FakeIRC and update comment style 2015-07-05 22:59:55 -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
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
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
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
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
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
James Lu
ce249dfe33 uhhh.... let's clear our variables properly 2015-06-20 21:06:45 -07:00
James Lu
aeb53a14e3 Make IrcUser.modes a set 2015-06-20 20:58:25 -07:00
James Lu
d3257f9314 Don't hardcode client usermodes in spawnClient
Still a bit of a WIP here...
2015-06-20 20:54:01 -07:00
James Lu
379f442a14 Add basic user mode tracking (Closes #10) 2015-06-20 20:36:35 -07:00
James Lu
f352166d25 proto/insp: use the client's TS in WHOIS IDLE replies
Use the client's TS, not the global IRC start time. Everything else for client timestamp tracking is basically done, at least for this protocol handler. Closes #11.
2015-06-19 13:18:22 -07:00
James Lu
55a5d08378 Use a WORKING TS6 UID generator, adapted from InspIRCd source
Closes #21.
2015-06-19 10:43:42 -07:00
James Lu
f7244ee6b7 Add basic nick and channel checking (ref #20) 2015-06-16 20:46:01 -07:00
James Lu
f40cb7954a Allow dynamic protocol loading again, and make proto an attribute of Irc()
This should remove the need for plugins, etc. to import proto directly,
which wouldn't work because of dynamic naming.
2015-06-16 20:05:41 -07:00
James Lu
9b4fb50f25 Today's code dump, featuring:
- PLUGIN SUPPORT and COMMAND HANDLING, wow!!!!!!!
- Restructuring of files so that there's only one protocol module (anything else is too much to maintain for now)
- Split protocol things into utils.py
- Bugfixes: don't go into an endless loop of text spamming when the remote host closes the connection!
2015-04-24 22:37:07 -07:00
James Lu
80a2ce1d0a more things 2015-04-17 22:11:49 -07:00
James Lu
c074d58052 Change of plans, we're now just a regular pseudoservice
- Remove multinet support
- Update config.yml.example
2015-04-17 19:55:48 -07:00
James Lu
b1a989c971 add a make-next-uid function and rename pylink-main.py -> main.py
The "I really hate Python imports" update.
2015-04-03 18:45:18 -07:00
James Lu
7a62a655a3 never mind - use multiprocessing, add auto-reconnect, and some more handlers 2015-04-03 12:35:55 -07:00
James Lu
324551e185 rewrite in asyncio and other refactoring to support multinet - doesn't work yet! 2015-04-03 00:17:03 -07:00
James Lu
f3e736b6fb Add an inspircd protocol module - still a WIP 2015-03-19 16:21:49 -07:00