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