Exemplo n.º 1
0
Arquivo: chat.py Projeto: PEZ/MooTalk
 def clean_chat_from_non_users(self):
     import logging
     for email in self.participants:
         try: 
             User.all().filter('address =', email).fetch(1)[0]
         except IndexError:
             logging.error("Cleaning away non user %s from chat %s" % (email, self.title))
             self.remove_participant(email)
Exemplo n.º 2
0
Arquivo: chat.py Projeto: PEZ/MooTalk
 def clean_chat_from_non_users(self):
     import logging
     for email in self.participants:
         try:
             User.all().filter('address =', email).fetch(1)[0]
         except IndexError:
             logging.error("Cleaning away non user %s from chat %s" %
                           (email, self.title))
             self.remove_participant(email)
Exemplo n.º 3
0
Arquivo: chat.py Projeto: PEZ/MooTalk
 def add_participant(self, address):
     """
     Adds a user to a chat and also sends an invitation to the user to authorize the channel.
     """
     if address in [u.address for u in User.all()]:
         db.run_in_transaction(self._add_participantTx, address)
         xmpp.send_invite(address, self.jid)
Exemplo n.º 4
0
Arquivo: chat.py Projeto: PEZ/MooTalk
 def add_participant(self, address):
     """
     Adds a user to a chat and also sends an invitation to the user to authorize the channel.
     """
     if address in [u.address for u in User.all()]:
         db.run_in_transaction(self._add_participantTx, address)
         xmpp.send_invite(address, self.jid)
Exemplo n.º 5
0
 def get(self, _key_or_title):
     chat = self._get_chat(_key_or_title)
     if chat != None:
         chat.clean_chat_from_non_users()
         template_values = {
             'chat': chat,
             'users': User.all()
         }
         self.Render("chat.html", template_values)
Exemplo n.º 6
0
Arquivo: chat.py Projeto: PEZ/MooTalk
 def non_users(self):
     return [
         u for u in User.all()
         if not self.title in [c.title for c in u.chats]
     ]
Exemplo n.º 7
0
Arquivo: chat.py Projeto: PEZ/MooTalk
 def remove_listener(self, address):
     if address not in self.non_listeners and address in [
             u.address for u in User.all()
     ]:
         self.non_listeners.append(address)
         self.put()
Exemplo n.º 8
0
 def get(self):
     template_values = {
         'users': User.all(),
     }
     self.Render("users.html", template_values)
Exemplo n.º 9
0
Arquivo: chat.py Projeto: PEZ/MooTalk
 def remove_listener(self, address):
     if address not in self.non_listeners and address in [u.address for u in User.all()]:
         self.non_listeners.append(address)
         self.put()
Exemplo n.º 10
0
Arquivo: chat.py Projeto: PEZ/MooTalk
 def non_users(self):         
     return [u for u in User.all() if not self.title in [c.title for c in u.chats]]