Example #1
0
File: chat.py Project: 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)
Example #2
0
File: chat.py Project: 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)
Example #3
0
File: chat.py Project: 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)
Example #4
0
File: chat.py Project: 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)
Example #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)
Example #6
0
File: chat.py Project: 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]
     ]
Example #7
0
File: chat.py Project: 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()
Example #8
0
 def get(self):
     template_values = {
         'users': User.all(),
     }
     self.Render("users.html", template_values)
Example #9
0
File: chat.py Project: 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()
Example #10
0
File: chat.py Project: 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]]