diff --git a/control_service/remotecontrolservie.cpp b/control_service/remotecontrolservie.cpp index 85a6538..977f0dc 100644 --- a/control_service/remotecontrolservie.cpp +++ b/control_service/remotecontrolservie.cpp @@ -25,7 +25,6 @@ bool RemoteControlServie::execCmd(QString cmd) { if (!cmd.startsWith(prefix)) continue ; - qDebug() << cmd << prefix; cmd.remove(0, prefix.length()); find = true; break; diff --git a/notification/messageview.cpp b/notification/messageview.cpp index 7b09435..902e296 100644 --- a/notification/messageview.cpp +++ b/notification/messageview.cpp @@ -751,7 +751,7 @@ void MessageView::showMenu() MyJson params; params.insert("message_id", msg.messageId); json.insert("params", params); - json.insert("echo", "delete_msg"); + json.insert("echo", "msg_recall_friend:" + snum(msg.friendId) + "_" + snum(msg.messageId)); emit sig->sendSocketText(json.toBa()); }); } @@ -839,6 +839,7 @@ QSize MessageView::sizeHint() const void MessageView::setTextColor(QColor c) { + this->textColor = c; QPalette pa(this->palette()); pa.setColor(QPalette::Foreground, c); pa.setColor(QPalette::Text, c); @@ -855,6 +856,8 @@ void MessageView::markDeleted() text.append(" "); text.append("[已撤回]"); setText(text); - setTextColor(Qt::gray); + + textColor.setAlpha(128); + setTextColor(textColor); } diff --git a/notification/messageview.h b/notification/messageview.h index dde8332..c9934f2 100644 --- a/notification/messageview.h +++ b/notification/messageview.h @@ -44,6 +44,7 @@ public slots: private: MsgBean msg; int fixedWidth = 0; + QColor textColor = Qt::black; QString filePath; QPixmap filePixmap; diff --git a/notification/notificationcard.cpp b/notification/notificationcard.cpp index 8f982de..59b6d9a 100644 --- a/notification/notificationcard.cpp +++ b/notification/notificationcard.cpp @@ -255,7 +255,6 @@ bool NotificationCard::append(const MsgBean &msg) if (msg.isPrivate()) { - qDebug() << "-------------------卡片消息撤回"; appendPrivateMsg(msg); } else diff --git a/web_service/cqhttpservice.cpp b/web_service/cqhttpservice.cpp index 898937b..5bdf31d 100644 --- a/web_service/cqhttpservice.cpp +++ b/web_service/cqhttpservice.cpp @@ -248,6 +248,20 @@ void CqhttpService::parseEchoMessage(const MyJson &json) qInfo() << "加载群成员:" << groupId << members.size(); emit sig->groupMembersLoaded(groupId); } + else if (echo.startsWith("msg_recall_friend")) + { + QRegularExpression re("^msg_recall_friend:(\\d+)_(-?\\w+)$"); + QRegularExpressionMatch match; + if (echo.indexOf(re, 0, &match) == -1) + { + qWarning() << "无法识别的撤回echo:" << echo; + return ; + } + qint64 friendId = match.captured(1).toLongLong(); + qint64 messageId = match.captured(2).toLongLong(); + MsgBean msg = MsgBean().recall(messageId, friendId, ac->myId); + emit signalMessage(msg); + } else { qWarning() << "未处理类型的返回:" << json; diff --git a/web_service/msgbean.h b/web_service/msgbean.h index 9131b21..8769b0a 100644 --- a/web_service/msgbean.h +++ b/web_service/msgbean.h @@ -4,6 +4,7 @@ #include #include #include +#include struct FriendInfo { @@ -82,11 +83,14 @@ struct MsgBean qint64 timestamp = 0; // 创建时间(毫秒级) MsgBean() - {} + { + qRegisterMetaType("MsgBean"); + } MsgBean(qint64 senderId, QString nickname, QString message, qint64 messageId, QString subType) : senderId(senderId), nickname(nickname), message(message), rawMessage(message), messageId(messageId), subType(subType) { + qRegisterMetaType("MsgBean"); if (nickname.isEmpty()) nickname = QString::number(senderId); timestamp = QDateTime::currentMSecsSinceEpoch(); @@ -95,6 +99,7 @@ struct MsgBean MsgBean(qint64 senderId, QString nickname) : senderId(senderId), nickname(nickname) { + qRegisterMetaType("MsgBean"); if (nickname.isEmpty()) nickname = QString::number(senderId); timestamp = QDateTime::currentMSecsSinceEpoch();