def fileUploadStart(session_id, chat_id, filename): username = getUserForSession(session_id) if not username: return 'error:not_logged_in' chat_session = getUserChat(chat_id, username) if not chat_session: return 'error:invalid_chat_id' file_type, icon = livewire_util.getFileTypeNIcon(filename) chat_session.addMessage('__temp__', 'System', livewire_util.listToString(['file_upload_start', username, file_type]))
def buzzUser(session_id, chat_id, receiver): sender = getUserForSession(session_id) if not sender: return 'error:not_logged_in' chat_session = getUserChat(chat_id, sender) if not chat_session: return 'error:invalid_chat_id' #need to send private message chat_session.addMessage('__temp__', 'System', livewire_util.listToString(['[BUZZ]', sender, receiver]), receiver)
def addFile(session_id, chat_id, filename, file_url, file_type, file_size, thumbnail, html_preview): username = getUserForSession(session_id) if not username: return 'error:not_logged_in' chat_session = getUserChat(chat_id, username) if chat_session: chat_session.addFile(username, filename, file_url, file_type, file_size, thumbnail, html_preview) icon = livewire_util.getIcon(file_type) chat_session.addMessage('__temp__', 'System', livewire_util.listToString(['file_uploaded', username, filename, file_type, file_size, file_url, icon])) return 'success' else: return 'error:invalid_chat_id'