~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlms/__init__.py

  • Committer: kaputtnik
  • Date: 2019-05-30 18:20:02 UTC
  • mto: This revision was merged to the branch mainline in revision 540.
  • Revision ID: kaputtnik-20190530182002-g7l91m1xo28clghv
adjusted README; first commit on the new server

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# encoding: utf-8
3
 
 
4
 
from twisted.internet.protocol import Factory
5
 
 
6
 
from protocol import MSProtocol
7
 
 
8
 
__all__ = ["MetaServer"]
9
 
 
10
 
class MetaServer(Factory):
11
 
    def __init__(self, db):
12
 
        self.users = {}
13
 
        self.games = {}
14
 
        self.users_wanting_to_relogin = {}
15
 
        self.db = db
16
 
        self.motd = ""
17
 
 
18
 
    def buildProtocol(self, addr):
19
 
        return MSProtocol(self)
20
 
 
21
 
    def broadcast(self, *args):
22
 
        """Send a message to all connected clients"""
23
 
        for con in self.users.values():
24
 
            if not con.active:
25
 
                continue
26
 
            con.send(*args)
27