Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Connection:
- def __init__(self, username, password):
- # connect to the server
- self.username = username
- self.password = password
- def pingpong(self):
- # manage ping pongs etc
- def message(self, message, channel):
- # send message
- class Web:
- def __init__(self):
- self.connections = []
- def new_user(self, username, password):
- if not any(c.username == username for c in self.connections):
- self.connections.append(Connection(username, password))
- def message(self, username, password, message, channel):
- for c in self.connections:
- if username == c.username and password == c.password:
- c.message(message, channel)
- else:
- raise "Invalid Login"
Add Comment
Please, Sign In to add comment