Closed Heufneutje closed 10 years ago
This should be ready now.
Since you store users in the subscribe lists and then just leave them and hope for the best, you'll end up with lots of disconnected users in the list. Instead, you should do one of the following:
option 3: use a weakref.WeakSet(), which is like a set() but will automatically drop members when they're no longer referenced anywhere else.
Eg.
x = object() s = WeakSet([x]) print len(s) 1 del x print len(s) 0
edit: ugh, why is the markdown so broken just on this one comment
Can we guarantee the reference is gone when a user disconnects though? And yes, I'll change it so that only a local user gets added to the subscribe list. That should prevent them from getting the same notice from every single server.
Well you'd still have to check if the user is still connected before sending them anything. But that case would be rare, and you won't need to manually delete things.
Added a check to make sure only local users get added to the subscribed list and implemented ekimekim's idea of using a WeakSet.
This implements the server notice mechanism. It adds umode +s which acts as a listmode and keeps track of what users are subscribed to what events. It supports using multiple mode parameters using commas and can list what events the user is subscribed to. Oper permissions are split into different permissions for each event with a "servernotice-all" wildcard permission. It also implements the following snomasks: