From 48364a19c2ec536eb5fb4288d690052202db5084 Mon Sep 17 00:00:00 2001 From: "String.Empty" Date: Mon, 10 Aug 2020 23:57:11 +0800 Subject: [PATCH] fix GroupMemberInfo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 允许邀请者视为拥有群权限 优化群成员是否获取成功的检查 --- Dice/BlackListManager.cpp | 17 +++++++++++------ Dice/Dice.cpp | 8 +++++++- Dice/DiceEvent.cpp | 2 +- Dice/ManagerSystem.cpp | 4 ++++ Dice/ManagerSystem.h | 5 +++-- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Dice/BlackListManager.cpp b/Dice/BlackListManager.cpp index db138b59..f6280633 100644 --- a/Dice/BlackListManager.cpp +++ b/Dice/BlackListManager.cpp @@ -46,22 +46,27 @@ void checkGroupWithBlackQQ(const DDBlackMark& mark, long long llQQ) string strNotice; for (auto& [id, grp] : ChatList) { - if (grp.isset("") || grp.isset("") || !grp.isGroup)continue; - if (getGroupMemberInfo(id, llQQ).QQID == llQQ) + if (grp.isset("") || grp.isset("δ") || grp.isset("") || grp.isset("ЭЧ") || !grp.isGroup)continue; + if (GroupMemberInfo member = getGroupMemberInfo(id, llQQ); member.QQID == llQQ) { strNotice = printGroup(id); - if (grp.isset("")) + if (grp.isset("ЭЧ")) { + strNotice += "ȺЭЧ"; + } + else if (grp.isset("")) { if (mark.isSource(console.DiceMaid) && !mark.isType("local"))sendGroupMsg(id, mark.warning()); strNotice += "Ⱥ"; } - else if (getGroupMemberInfo(id, llQQ).permissions < getGroupMemberInfo(id, getLoginQQ()).permissions) - { + else if (GroupMemberInfo self = getGroupMemberInfo(id, console.DiceMaid); !self.permissions) { + continue; + } + else if (member.permissions < self.permissions) { if (mark.isSource(console.DiceMaid && !mark.isType("local")))AddMsgToQueue( mark.warning(), id, msgtype::Group); strNotice += "ԷȺȨ޽ϵ"; } - else if (getGroupMemberInfo(id, llQQ).permissions > getGroupMemberInfo(id, getLoginQQ()).permissions) + else if (member.permissions > self.permissions) { sendGroupMsg(id, mark.warning()); grp.leave("Ա" + printQQ(llQQ) + "\n" + GlobalMsg["strSelfName"] + "ԤȺ"); diff --git a/Dice/Dice.cpp b/Dice/Dice.cpp index d71848ec..5c1944bd 100644 --- a/Dice/Dice.cpp +++ b/Dice/Dice.cpp @@ -474,7 +474,13 @@ bool eve_GroupAdd(Chat& grp) if (ChatList.size() == 1 && !console.isMasterMode)sendGroupMsg(grp.ID, msgInit); } GroupInfo ginf(grp.ID); - grp.Name = ginf.strGroupName; + //ȺϢǷȡɹ + if (ginf.llGroup) { + grp.Name = ginf.strGroupName; + } + else { + ginf.llGroup = grp.ID; + } if (grp.boolConf.empty() && ginf.nGroupSize > 499) { grp.set("ЭЧ"); } diff --git a/Dice/DiceEvent.cpp b/Dice/DiceEvent.cpp index 0d190b6b..50654112 100644 --- a/Dice/DiceEvent.cpp +++ b/Dice/DiceEvent.cpp @@ -754,7 +754,7 @@ int FromMsg::DiceReply() strVar["nick"] = getName(fromQQ, fromGroup); getPCName(*this); strVar["at"] = intT ? "[CQ:at,qq=" + to_string(fromQQ) + "]" : strVar["nick"]; - isAuth = trusted > 3 || intT != GroupT || getGroupMemberInfo(fromGroup, fromQQ).permissions > 1 || pGrp->inviter == fromQQ; + isAuth = trusted > 3 || intT != GroupT || getGroupMemberInfo(fromGroup, fromQQ).permissions != 1 || pGrp->inviter == fromQQ; //ָƥ if (strLowerMessage.substr(intMsgCnt, 9) == "authorize") { diff --git a/Dice/ManagerSystem.cpp b/Dice/ManagerSystem.cpp index c47dbaf5..4b8d5748 100644 --- a/Dice/ManagerSystem.cpp +++ b/Dice/ManagerSystem.cpp @@ -144,6 +144,10 @@ Chat& Chat::id(long long grp) { return *this; } +bool Chat::is_except()const { + return boolConf.count("") || boolConf.count("ЭЧ"); +} + int groupset(long long id, string st) { if (!ChatList.count(id))return -1; diff --git a/Dice/ManagerSystem.h b/Dice/ManagerSystem.h index e912f1b0..9c9c9f8f 100644 --- a/Dice/ManagerSystem.h +++ b/Dice/ManagerSystem.h @@ -251,8 +251,7 @@ class Chat else CQ::sendDiscussMsg(ID, msg); Sleep(500); } - if (isGroup)CQ::setGroupLeave(ID); - else CQ::setDiscussLeave(ID); + isGroup ? CQ::setGroupLeave(ID) : CQ::setDiscussLeave(ID); set(""); } @@ -261,6 +260,8 @@ class Chat return boolConf.count(key) || intConf.count(key) || strConf.count(key); } + bool is_except()const; + void setConf(const string& key, int val) { intConf[key] = val;