def _consume_message(self, res_obj, sock): assert (sock is not None) attr = res_obj.headers.get_field_value from_uri = attr("F") logger.info("Get message from: %s" % from_uri) msg = rm_markups(to_unicode_obj(res_obj.body)) if from_uri != SERVICE_PROVIDER_URI: i_send_ack(res_obj, sock) contact = self.user.group_agent.get_contact_by_uri(from_uri) if not contact: """ This message send you before him delete you from his buddy list. """ name = u"陌生人 (飞信号: %s) " % get_sid_from_uri(from_uri) else: name = contact.get_display_name() else: name = to_unicode_obj("系统信息") self.goto_or_create_tab_after_received_msg(from_uri) chat_history_model = self.chat_history[from_uri] self.chat_win.append_to_chat_history(chat_history_model, name, msg, OTHER_LOG_TPL)
def _consume_invitation(self, res_obj, sock): assert (sock is not None) """ TODO: ignore invitation will prevent from hide detecting. """ i_send_ack(res_obj, sock) attr = res_obj.headers.get_field_value from_uri = attr("F") conv = Conversation(from_uri) convs = self.user.get_conversations() convs[from_uri] = conv get_sock_for_recv_msg_thread = IThread(get_sock_for_recv_msg, user = self.user, res_obj = res_obj, debug = True) conv.get_sock_for_recv_msg_thread = get_sock_for_recv_msg_thread self.connect(conv.get_sock_for_recv_msg_thread, QtCore.SIGNAL("thread_finished()"), self.recv_msg_t_finished) conv.get_sock_for_recv_msg_thread.start()
def _consume_invitation(self, res_obj, sock): assert (sock is not None) """ TODO: ignore invitation will prevent from hide detecting. """ i_send_ack(res_obj, sock) attr = res_obj.headers.get_field_value from_uri = attr("F") conv = Conversation(from_uri) convs = self.user.get_conversations() convs[from_uri] = conv get_sock_for_recv_msg_thread = IThread(get_sock_for_recv_msg, user=self.user, res_obj=res_obj, debug=True) conv.get_sock_for_recv_msg_thread = get_sock_for_recv_msg_thread self.connect(conv.get_sock_for_recv_msg_thread, QtCore.SIGNAL("thread_finished()"), self.recv_msg_t_finished) conv.get_sock_for_recv_msg_thread.start()