新增撤回消息显示

This commit is contained in:
shuaikangzhou 2023-12-07 20:54:28 +08:00
parent 9f980fdac1
commit 26c752a710
3 changed files with 10 additions and 10 deletions

View File

@ -110,7 +110,7 @@ class Msg:
from MSG from MSG
where StrTalker = ? and localId < ? where StrTalker = ? and localId < ?
order by CreateTime desc order by CreateTime desc
limit 10 limit 20
''' '''
result = None result = None
if not self.open_flag: if not self.open_flag:

View File

@ -903,15 +903,6 @@ const chatMessages = [
f'''{{ type:{type_}, text: '{str_content}',is_send:{is_send},avatar_path:'{avatar}'}},''' f'''{{ type:{type_}, text: '{str_content}',is_send:{is_send},avatar_path:'{avatar}'}},'''
) )
elif type_ == 3: elif type_ == 3:
import re
pattern1 = r'<msg><img length="\d+" hdlength="0" /><commenturl></commenturl></msg>'
pattern2 = r'<msg><img /></msg>'
match = re.search(pattern1, str_content)
if match:
continue
match = re.search(pattern2, str_content)
if match:
continue
image_path = hard_link_db.get_image(content=str_content, thumb=False) image_path = hard_link_db.get_image(content=str_content, thumb=False)
image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image') image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
image_path = image_path.replace('\\', '/') image_path = image_path.replace('\\', '/')
@ -923,6 +914,11 @@ const chatMessages = [
f.write( f.write(
f'''{{ type:{type_}, text: '{image_path}',is_send:{is_send},avatar_path:'{avatar}'}},''' f'''{{ type:{type_}, text: '{image_path}',is_send:{is_send},avatar_path:'{avatar}'}},'''
) )
elif type_ == 10000:
str_content = escape_js_and_html(str_content.lstrip('<revokemsg>').rstrip('</revokemsg>'))
f.write(
f'''{{ type:0, text: '{str_content}',is_send:{is_send},avatar_path:''}},'''
)
html_end = ''' html_end = '''
]; ];
function renderMessages(messages) { function renderMessages(messages) {

View File

@ -129,6 +129,10 @@ class ChatInfo(QWidget):
is_send is_send
) )
self.chat_window.add_message_item(bubble_message, 0) self.chat_window.add_message_item(bubble_message, 0)
elif type_ == 10000:
str_content = str_content.lstrip('<revokemsg>').rstrip('</revokemsg>')
message = Notice(str_content )
self.chat_window.add_message_item(message, 0)
except: except:
print(message) print(message)
traceback.print_exc() traceback.print_exc()