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

191 Commits

Author SHA1 Message Date
James Lu
fbeb3a3747 protocols: fix ts actually defaulting to None in sjoin() 2016-06-25 13:56:24 -07:00
James Lu
9ea6769c54 parseModes: allow type str as modestring 2016-06-25 13:08:49 -07:00
James Lu
5e16eeea41 updateTS: skip applying modes if there aren't any 2016-06-25 12:54:56 -07:00
James Lu
f009a739bc Merge remote-tracking branch 'origin/master' into devel 2016-06-25 11:36:55 -07:00
James Lu
51f1506f90 updateTS: remove mentions of 'outbound' variable from logging 2016-06-25 11:34:14 -07:00
James Lu
4c00479d78 Irc: lower ping frequency & timeout to 90/180
180*3 seconds is equivalent to 9 minutes. That's a long time for a dead network to stay connected.
2016-06-24 18:14:03 -07:00
James Lu
167963ddc4 updateTS: fix handling for outbound modes
Outgoing and incoming modes should be handled the same way - we're only dealing with a "received TS" which could originate from PyLink (sjoin() in protocols) OR the uplink.
2016-06-24 13:24:44 -07:00
James Lu
7f829ba0ec updateTS: apply TS on channel regardless of whether mode changes pass 2016-06-24 13:15:26 -07:00
James Lu
f2b139c828 core: make inbound SJOINs also respect the updateTS() rules 2016-06-22 22:28:15 -07:00
James Lu
6b8e80cd5b core/protocols: add modes option in sjoin(), TS6 BMASK, and mode TS rules in updateTS()
Closes #249.
Closes #250.
2016-06-22 21:34:16 -07:00
James Lu
dd08c01791 Irc: default pingTimer to None before starting connections
(cherry picked from commit 42ec6f2502)
2016-06-21 20:34:48 -07:00
James Lu
42ec6f2502 Irc: default pingTimer to None before starting connections 2016-06-21 10:54:07 -07:00
James Lu
481d70eff8 New import paths for properly installed pylinkirc 2016-06-20 18:18:54 -07:00
James Lu
f555a484f9 Irc: unconditionally call disconnect() on errors or ping timeouts
This prevents duplicated ping timer threads from spawning, I think...
2016-06-15 10:55:47 -07:00
James Lu
b1a5f864d8 Irc: resolve hostnames when connecting
Cloeses #158.
2016-06-11 11:29:11 -07:00
James Lu
eeca570cc4 classes: make pingfreq consistent, bump timeouts 2016-06-06 07:34:48 -07:00
James Lu
553415f6f7 classes: higher default pingfreq (90) 2016-05-25 16:19:35 -07:00
James Lu
2e1163fdb8 Irc: introduce isServiceBot checker 2016-05-14 16:17:12 -07:00
Daniel Oaks
c3e4cfa2de games: Create BotClient class, use bot_clients instead of games_user 2016-05-14 14:53:19 -07:00
James Lu
32bc5f120b core: migrate the main client to ServiceBot (#216)
- irc.spawnMain is dropped. Clients are now spawned in the endburst loop, after protocol negotiation completes. This allows PyLink to spawn clients with hideoper, etc., closing #194.
- utils.add_cmd and irc.callCommand are now just wrappers around world.services['pylink'].add_cmd and call_cmd respectively.
- coreplugin registers the main client while it is loaded up, before any commands are added.
2016-05-14 13:29:23 -07:00
James Lu
9236f7e095 Irc: fix NameError caused by 0c7faed 2016-05-14 12:19:38 -07:00
James Lu
123e72d162 Merge branch 'devel' into wip/services 2016-05-14 11:58:49 -07:00
James Lu
33034b23f1 Irc.applyModes: assume modes are being added if no +/- is given 2016-05-14 11:58:22 -07:00
James Lu
0c7faed213 Move NotAuthenticatedError class back into utils
This is needed because ServiceBot exists in utils, and utils cannot import classes without a bad import loop happening.
2016-05-14 10:05:18 -07:00
James Lu
beae4eea9e core: rename utils.fullVersion -> irc.version (#199) 2016-04-30 17:00:28 -07:00
James Lu
3bb1208e74 core: move toLower to Irc (#199) 2016-04-30 16:57:38 -07:00
James Lu
2fe2e9c8c4 core: move isOper, checkAuthenticated to Irc (#199) 2016-04-30 16:54:11 -07:00
James Lu
78f8a2fc8d core: move isManipulatableClient, getHostmask to Irc 2016-04-30 16:44:37 -07:00
James Lu
064cb9b6aa core: move reverseModes, joinModes into Irc 2016-04-30 16:33:46 -07:00
James Lu
bd0874a484 Merge branch 'wip/split-utils' into devel 2016-04-29 23:32:52 -07:00
James Lu
3b04d1abdc Irc: raise connection failure log levels to error 2016-04-25 19:14:34 -07:00
James Lu
84822fb1d6 Move applyModes, parseModes into Irc, suppressing deprecation warnings for now (#199) 2016-04-24 21:44:27 -07:00
James Lu
7f46e1c35c Separate KeyedDefaultdict into new structures module (#199) 2016-04-24 21:11:36 -07:00
James Lu
534242ef29 Irc: fix disconnect logic in ping timeouts
Call disconnect() in the event of a ping timeout. Curse these extra indents!
2016-04-18 18:14:42 -07:00
James Lu
0f0ae8fc2f Protocol: remove desync warning in getUid 2016-04-15 11:37:53 -07:00
James Lu
3a00e46b48 Move getSid/getUid into classes.Protocol 2016-04-10 19:00:44 -07:00
James Lu
99d861861d Let's use a default pingfreq value that makes sense...
Change this from 30 seconds to 180. Even for semi-important servers, 30 seconds between PING requests is a bit overkill.
2016-04-07 18:45:42 -07:00
James Lu
16779aa5ce classes: remove lower() call when storing netname
An hour of debugging protocol/unreal and it turns out the issue was not there, but this.
2016-04-02 12:11:35 -07:00
James Lu
3e7255e4b2 classes: remove ts6-specific hack in Protocol.removeClient 2016-04-01 22:55:03 -07:00
James Lu
44083ccd5e core: Store opertype info in all IrcUser objects
This allows plugins to define custom opertypes for their clients, and still have them show in WHOIS queries.
2016-03-26 12:55:23 -07:00
James Lu
fbd8659a7d classes: spawn PyLink clients with a custom opertype 2016-03-26 12:49:10 -07:00
James Lu
45c2abdae7 Irc: run initVars() on connect too
2b16f25b61 is wrong; it caused reconnects to fail with disconnect loops.
2016-03-25 17:14:16 -07:00
James Lu
b2b04c8e75 classes: really ignore errors when shutting down sockets 2016-03-25 17:03:25 -07:00
James Lu
03b53aee59 Merge branch 'staging' into devel 2016-03-25 15:03:05 -07:00
James Lu
2b16f25b61 classes.Irc: clear state on disconnect, not on connect
Possible fix for #183 - when networks disconnect, their server index wasn't cleared properly, causing errors from servers already existing to be thrown when the same server name is spawned again.
2016-03-25 15:00:15 -07:00
James Lu
1930739aad Revert "Irc: don't call initVars() on IRC object initialization"
This reverts commit 5a68dc1bc5.
2016-03-25 14:54:29 -07:00
James Lu
f5f0df52ce classes: raise KeyError, not return KeyError... 2016-03-19 18:00:44 -07:00
James Lu
e948db5c7b classes: support looking at older versions of prefix modes mappings 2016-03-19 17:54:18 -07:00
James Lu
e8b0018585 classes: Implement IrcChannel.is(Voice|Halfop|Op)Plus (#168) 2016-03-19 17:37:38 -07:00
James Lu
ed333a6d1b classes: implement IrcChannel.isOp, isVoice, getPrefixmodes, etc
Ref #168.
2016-03-19 17:32:32 -07:00
James Lu
8135f3a735 core: Depluralize prefixmodes mappings (#168)
This is an API breaking change. I really don't know why I made these keys plural to start, since it only made things more complicated. Prefix modes are not pluralized in the list of supported modes of each IRCd.
2016-03-19 17:25:04 -07:00
James Lu
1d4350c4fd classes: provide IrcChannel objects with their own name using KeyedDefaultdict
Closes #171.
2016-03-19 17:01:39 -07:00
James Lu
b6889fb097 irc: fix spacing in certificate fingerprint logging 2016-03-07 20:30:24 -08:00
James Lu
cf15bed58d classes: add services_account field in IrcUser (#25), default 'identified' attribute to empty string instead of None 2016-02-07 18:11:09 -08:00
James Lu
0d4655c381 core: support multiple channel loggers with DIFFERENT log levels & fix example conf (#83) 2016-01-30 23:35:51 -08:00
James Lu
669e889e6f Support configurable SSL fingerprint hash types (Closes #157) 2016-01-30 23:04:13 -08:00
James Lu
14efb27fe8 Initial experimental support for logging to channels (#83)
Doesn't support rehashing and all that yet.
2016-01-23 13:52:37 -08:00
James Lu
5a68dc1bc5 Irc: don't call initVars() on IRC object initialization
This is already done in connect(), so it isn't really necessary to populate these variables when first connect hasn't happened yet.
2016-01-23 13:52:37 -08:00
James Lu
812a866a4e protocols: rename pingServer -> ping 2016-01-16 17:11:23 -08:00
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