Guest User

Untitled

a guest
Jun 24th, 2018
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. class Connection:
  2. def __init__(self, username, password):
  3. # connect to the server
  4. self.username = username
  5. self.password = password
  6.  
  7. def pingpong(self):
  8. # manage ping pongs etc
  9.  
  10. def message(self, message, channel):
  11. # send message
  12.  
  13. class Web:
  14. def __init__(self):
  15. self.connections = []
  16.  
  17. def new_user(self, username, password):
  18. if not any(c.username == username for c in self.connections):
  19. self.connections.append(Connection(username, password))
  20.  
  21. def message(self, username, password, message, channel):
  22. for c in self.connections:
  23. if username == c.username and password == c.password:
  24. c.message(message, channel)
  25. else:
  26. raise "Invalid Login"
Add Comment
Please, Sign In to add comment