~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlms/__init__.py

  • Committer: Holger Rapp
  • Date: 2009-02-26 22:38:49 UTC
  • Revision ID: sirver@kallisto.local-20090226223849-1563ij0uuw0lz0zu
First version of widelands online help

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