def handle_message(self, conv_event, user, set_unread, insert_mode="bottom"): message = get_message_html(conv_event.segments) pyotherside.send('add-conversation-message', self.conv.id_, { "text": message, "attachments": [{'url': cache.get_image_cached(a) if settings.get('cache_images') else a} for a in conv_event.attachments], "user_is_self": user.is_self, "username": user.full_name, "time": get_message_timestr(conv_event.timestamp) }, insert_mode)
def handle_message(self, conv_event, user, set_unread, insert_mode="bottom"): html = get_message_html(conv_event.segments) text = get_message_plain_text(conv_event.segments) pyotherside.send('add-conversation-message', self.conv.id_, model.get_message_model_data( type="chat/message", html=html, text=text, attachments=[{'url': cache.get_image_cached(a) if settings.get('cache_images') else a} for a in conv_event.attachments], user_is_self=user.is_self, username=user.full_name, user_photo="https:" + user.photo_url if user.photo_url else None, time=get_message_timestr(conv_event.timestamp) ), insert_mode) self.set_title()
def handle_message(self, conv_event, user, set_unread, insert_mode="bottom"): message = get_message_html(conv_event.segments) pyotherside.send( 'add-conversation-message', self.conv.id_, { "text": message, "attachments": [{ 'url': cache.get_image_cached(a) if settings.get('cache_images') else a } for a in conv_event.attachments], "user_is_self": user.is_self, "username": user.full_name, "time": get_message_timestr(conv_event.timestamp) }, insert_mode)
def cache_get_image(url): return cache.get_image_cached(url)