47 Commits

Author SHA1 Message Date
Vgr E. Barry
2bf715637c Remove old users iteration and rename new one
Nothing used neither the old or new versions, but keeping the new one in anyway
2017-08-29 19:32:17 -04:00
Vgr E. Barry
5d14327380 make stuff prettier i guess 2017-08-21 14:16:04 -04:00
skizzerz
a3839b25d6 Fix midgame joining in mael
copy/deepcopy didn't know what to do with user objects due to custom
__new__. Since __new__ returns an existing user if possible anyway, just
have copy/deepcopy return the same user instance that is being copied.
2017-08-18 17:45:47 -05:00
skizzerz
24f82d3cd5 Fix BotUser.lower 2017-05-16 11:05:37 -05:00
skizzerz
c9faa8bb7a Fix BotUser.with_host breaking things when called during registration
If with_host() is called before we fully know our ident and host, we'll
set the host but keep ident as None, which breaks everything down the
line. I could've fixed this in general in users._add, but that would
require more extensive changes than this patch (aka may break other
things).
2017-05-15 20:35:47 -05:00
Vgr E. Barry
3f9f06613a Fix pingif preferences not being properly saved 2017-04-22 07:46:09 -04:00
Vgr E. Barry
64eb34a61a Properly handle the bot's host change 2017-04-07 16:52:35 -04:00
skizzerz
8c8823ebfe Don't remove users if they're playing
Instead mark them as a ghost, and remove them at end of game should they
still be gone.
2017-02-28 21:17:51 -06:00
jacob1
bc6375cf24 fix users.match_hostmask only working on full hostmasks
fixes admins list in botconfig.py when DISABLE_ACCOUNTS is true
2017-02-24 23:49:56 -05:00
skizzerz
47705fbb2c ACME® Commit Message Kit
Thank you for purchasing the ACME® Commit Message Kit! We specialize in
providing the finest commit message kits. Should you find your kit not
up to your satisfaction, contact your Customer Support Representative
for a full refund.

To use this kit, please assemble the following components into your
desired commit message. Using ACME® BottomlessBits® technology, you can
use each component in the kit as many times as you'd like!

Components:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;'"/
2017-02-08 14:43:52 -05:00
jacob1
4c67a5b438 fix user references staying around due to !pingif pinger
also remove ugly hack since we don't need it anymore
2017-02-02 22:08:04 -05:00
Vgr E. Barry
48e1f06b33 Be more aggressive when trying to figure out why there are duplicates 2017-02-02 20:59:37 -05:00
Vgr E. Barry
5842b41097 Add some hacky debugging aid for when a User lingers around 2017-01-28 00:40:12 -05:00
Vgr E. Barry
26fec0f5a0 Make sure fake users always get "sent" the simple messages 2017-01-17 13:44:52 -05:00
Vgr E. Barry
fea04471ca Properly lowercase host everywhere 2017-01-13 16:17:03 -05:00
Vgr E. Barry
fb7bf56579 Fix proper lowercasing, take 2 2017-01-13 12:13:32 -05:00
Vgr E. Barry
2cd410ace8 Fix lowercasing a hostname to not use IRC lowercasing 2017-01-13 12:05:16 -05:00
Vgr E. Barry
96c36a13b6 Fix lowercasing a BotUser instance 2017-01-13 11:59:47 -05:00
Vgr E. Barry
f941f23e91 Update some docstrings in users.py 2017-01-12 13:55:07 -05:00
Vgr E. Barry
fb6aa40170 Please stand away from water sources when short-circuiting 2017-01-11 22:54:19 -05:00
Vgr E. Barry
53cd5dc616 Add a users.complete_match function, taking and returning Users 2016-12-19 13:29:02 -05:00
Vgr E. Barry
081f909260 Use proper __class__ cell for super 2016-12-19 13:10:06 -05:00
Vgr E. Barry
e7eabba791 More easily create fake users 2016-12-19 13:09:57 -05:00
Vgr E. Barry
9014d5c35c Make comparing contexts easier 2016-12-19 13:09:12 -05:00
Vgr E. Barry
59e7c13a0b Move equals from users to context 2016-12-19 13:08:18 -05:00
Vgr E. Barry
33563da1eb Fix users.get(..., allow_multiple=True) to always return a list 2016-12-14 20:04:36 -05:00
Ryan Schmidt
9f4b1a243d Merge pull request #274 from lykoss/cmd-old-api
Add a backwards-compatibility handler for commands
2016-12-08 16:35:19 -07:00
Vgr E. Barry
e8338d1ef6 Add the new command API + converted commands
Converted commands mostly use some backwards-compatibility hack. Please don't mind it, I'll eventually get to it.
2016-11-28 20:19:48 -05:00
Vgr E. Barry
5f50096d08 Delay error in users.get until after the end of the loop
This was originally done so that we wouldn't need to iterate through the (presumably large) set of users. However, when this raises, we have no idea which users actually match the criterias. By waiting until after, the traceback will actually print off the list of all potential users.
2016-11-24 16:29:58 -05:00
Vgr E. Barry
ea3acbfb2a Allow implicit replacement of users without a ident and a host
This takes a different code path because of slightly different conditions; in the first case, the ident and host are both known, and so the instance is hashable. Being hashable, it can be checked for set containment, and exactly one instance in that set will be equal (since the hash is based off of the ident and host, and the comparisons check for all non-None attributes, two instances cannot possibly be equal while having a different hash).

In the second case (the new one), however, at least the ident or the host is missing, and so the hash cannot be calculated. This means that two instances may compare equal and hash to different values (since only non-None attributes are compared), so we need to run through the entire set no matter what to make sure that one - and only one - instance in that set compares equal with the new one. We can't know in advance whether or not there is an instance that compares equal to the new one in that set, nor can we know if there are multiple instances that are going to compare equal.

The two code paths are separated so that the difference in functionality is obvious (and this commit description, as well as the comment in the code, should help with that), and that the distinction remains clear.
2016-11-21 21:44:34 -05:00
Vgr E. Barry
ea51642240 Allow users.get(..., allow_multiple=True) to return an empty list 2016-11-21 21:12:27 -05:00
Vgr E. Barry
d590e7b727 Fix servers setting modes and !fsync breaking the bot 2016-11-21 10:29:14 -05:00
Vgr E. Barry
e922bb220e Move the message queuing to IRCContext 2016-11-20 08:25:45 -05:00
Vgr E. Barry
6d9017a4bd Improve context creation and lowercasing 2016-11-20 08:24:50 -05:00
Vgr E. Barry
9a71b34488 Improve message sending to properly split on the end of lines 2016-11-18 17:27:33 -05:00
Vgr E. Barry
885889495a Properly handle the bot's nick being already in use 2016-11-16 16:18:37 -05:00
Vgr E. Barry
3f806620e4 _ 2016-11-15 20:38:29 -05:00
Vgr E. Barry
360204bf43 Massively improve user handling
This changes how users are handled, making it less likely to encounter duplicate users; in normal circumstances, duplicates shouldn't happen.
2016-11-15 19:54:42 -05:00
Vgr E. Barry
e161325d01 Remove 'channels' from the user interface
We don't use it, as the only places where we'd need to, it's only one channel, and the surrounding code needs to add the user to the channel and vice-versa, so that's pretty pointless.
2016-11-10 10:44:38 -05:00
Vgr E. Barry
a39ded6053 Improve handling of fake contexts 2016-11-06 17:27:09 -05:00
Vgr E. Barry
2244ed4370 Fix wrong function calls in user functions 2016-11-03 12:04:26 -04:00
Vgr E. Barry
62abf6dae8 Fix small issues with fake nicks and channels 2016-11-02 23:35:13 -04:00
Vgr E. Barry
49208db148 Make backwards-compatible users.add return the new "user" 2016-11-02 16:15:16 -04:00
Vgr E. Barry
12eab068be Change the user handling calls in wolfgame.py 2016-10-31 20:44:10 -04:00
Vgr E. Barry
349433c9ab Do a direct lookup for hostmasks for stasis. 2016-10-27 09:13:07 -04:00
Vgr E. Barry
2877abea55 Update as per @skizzerz's comments 2016-10-26 20:06:29 -04:00
Vgr E. Barry
5ec273c6e0 New IRCContext, Channel and User classes
Right now these don't do anything, but in the future they will be how
we'll do channel and user handling.
2016-10-25 18:20:31 -04:00