Beispiel #1
0
 def on_finish(message_list):
     result = Message()
     result.control = True
     result.secondary = True
     result.recipient = None
     result.sender = None
     result.envelope = True
     result.topic = 'mail:new'
     result.data = message_list
     result.immediate = True
     self.simargl.message_received(self, result)
Beispiel #2
0
 def worker(message):
     result = []
     with self.db.context_session() as session:
         query = session.query(UserSubscriptions).filter(
             UserSubscriptions.object_id == message.data['object_id'])
         for o in query:
             msg = Message()
             msg.sender = message.sender
             msg.recipient = o.person_id
             msg.secondary = True
             msg.immediate = True
             msg.topic = 'mail:new'
             msg.ctrl = True
             data = data_from_message(message, str(o.person_id))
             data['folder'] = 'system'
             msg.data = data
             result.append(msg)
     return result
 def errand_delete_notify(self, message):
     notify_message = Message()
     notify_message.topic = 'errand:notify'
     notify_message.sender = None
     notify_message.recipient = message.recipient
     notify_message.data = {
         'subject': u'Поручение удалено',
         'id': message.data['errand_id']
     }
     return self.simargl.inject_message(notify_message)
 def errand_exec_notify(self, message):
     notify_message = Message()
     notify_message.topic = 'errand:notify'
     notify_message.sender = None
     notify_message.recipient = message.recipient
     notify_message.data = {
         'subject': u'Изменение отметки об исполнении поручения',
         'id': message.data['errand_id']
     }
     return self.simargl.inject_message(notify_message)
 def on_finish(errand_create_message):
     notify_message = Message()
     notify_message.topic = 'errand:notify'
     notify_message.sender = None
     notify_message.recipient = errand_create_message.recipient
     notify_message.data = {
         'subject': u'Новое поручение',
         'id': errand_create_message.data['errand_id']
     }
     return self.simargl.inject_message(notify_message)
Beispiel #6
0
 def on_finish(new_mail_result):
     if isinstance(new_mail_result, dict):
         message = Message()
         message.topic = 'mail:notify'
         message.sender = None
         message.recipient = new_mail_result['recipient_id']
         message.data = {
             'subject': u'Новое письмо',
             'id': new_mail_result['usermail_id']
         }
         self.simargl.inject_message(message)
Beispiel #7
0
 def as_message(self):
     message = Message()
     message.topic = 'mail'
     message.sender = self.sender_id
     message.recipient = self.recipient_id
     message.tags = set()
     message.data = {
         'subject': self.subject,
         'text': self.text,
         'datetime': self.datetime,
         'read': self.read,
         'mark': self.mark,
         'parent_id': self.parent_id,
         'folder': self.folder,
     }
     return message