Skip to content

Commit 8162e4e

Browse files
committed
聊天过滤忽略全角
1 parent f874b72 commit 8162e4e

File tree

3 files changed

+17
-23
lines changed

3 files changed

+17
-23
lines changed

Chat/lang/zhcn.jx3dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ data = {
4444
['Channels'] = "Ƶ������",
4545
[', except:'] = ", ��ȥ:",
4646
['ignore spaces'] = "���Կո�",
47+
['ignore enem'] = "����ȫ��",
4748

4849
['always show *'] = '������ʾ����',
4950
['always be white'] = '��Զ��ʾΪ��ɫ',

Chat/lang/zhtw.jx3dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ data = {
4444
['Channels'] = "頻道設置",
4545
[', except:'] = ", 除去:",
4646
['ignore spaces'] = "忽略空格",
47+
['ignore enem'] = "忽略全角",
4748

4849
['always show *'] = '總是顯示※號',
4950
['always be white'] = '永遠顯示爲白色',

Chat/src/MY_Chat.lua

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- @Date : 2016-02-5 11:35:53
55
-- @Email : admin@derzh.com
66
-- @Last modified by: Emil Zhai
7-
-- @Last modified time: 2016-09-21 15:55:42
7+
-- @Last modified time: 2016-09-21 16:50:59
88
--------------------------------------------
99
local _L = MY.LoadLangPack(MY.GetAddonInfo().szRoot .. "Chat/lang/")
1010
MY_Chat = {}
@@ -31,11 +31,11 @@ local function LoadBlockWords()
3131
MY_Chat.tBlockWords = MY.LoadLUAData('config/MY_CHAT/blockwords.$lang.jx3dat') or MY_Chat.tBlockWords
3232
for i, bw in ipairs(MY_Chat.tBlockWords) do
3333
if type(bw) == "string" then
34-
MY_Chat.tBlockWords[i] = {bw, {ALL = true}, true}
34+
MY_Chat.tBlockWords[i] = {bw, {ALL = true}, true, true}
3535
end
3636
end
3737
if nVersion == 0 then
38-
table.insert(MY_Chat.tBlockWords, {"166121867", {ALL = true}, true})
38+
table.insert(MY_Chat.tBlockWords, {"166121867", {ALL = true}, false, false})
3939
end
4040
end
4141

@@ -60,26 +60,10 @@ function MY_Chat.MatchBlockWord(szMsg, szChannel, bRichText)
6060
if szChannel then
6161
szMsg = "[" .. g_tStrings.tChannelName[szChannel] .. "]" .. szMsg
6262
end
63-
local szNoneSpaceMsg
6463
for _, bw in ipairs(MY_Chat.tBlockWords) do
65-
if bw[2].ALL ~= bw[2][szChannel] then
66-
if bw[3] then
67-
if not tNoneSpaceBlockWords[bw[1]] then
68-
tNoneSpaceBlockWords[bw[1]] = StringEnerW(tNoneSpaceBlockWords[bw[1]])
69-
tNoneSpaceBlockWords[bw[1]] = StringReplaceW(bw[1], " ", "")
70-
tNoneSpaceBlockWords[bw[1]] = StringReplaceW(bw[1], g_tStrings.STR_ONE_CHINESE_SPACE, "")
71-
end
72-
if not szNoneSpaceMsg then
73-
szNoneSpaceMsg = StringReplaceW(StringReplaceW(szMsg, " ", ""), g_tStrings.STR_ONE_CHINESE_SPACE, "")
74-
end
75-
if MY.String.SimpleMatch(szNoneSpaceMsg, tNoneSpaceBlockWords[bw[1]]) then
76-
return true
77-
end
78-
else
79-
if MY.String.SimpleMatch(szMsg, bw[1]) then
80-
return true
81-
end
82-
end
64+
if bw[2].ALL ~= bw[2][szChannel]
65+
and MY.String.SimpleMatch(szMsg, bw[1], not bw[3], not bw[4]) then
66+
return true
8367
end
8468
end
8569
end
@@ -211,6 +195,14 @@ function PS.OnPanelActive(wnd)
211195
SaveBlockWords()
212196
end,
213197
})
198+
table.insert(menu, {
199+
szOption = _L['ignore enem'],
200+
bCheck = true, bChecked = data[4],
201+
fnAction = function()
202+
data[4] = not data[4]
203+
SaveBlockWords()
204+
end,
205+
})
214206
table.insert(menu, MENU_DIVIDER)
215207
table.insert(menu, {
216208
szOption = _L['delete'],
@@ -249,7 +241,7 @@ function PS.OnPanelActive(wnd)
249241
end
250242
end
251243
-- 加入表
252-
local bw = {szText, {ALL = true, MSG_WHISPER = true, MSG_TEAM = true, MSG_PARTY = true, MSG_GUILD = true, MSG_GUILD_ALLIANCE = true}}
244+
local bw = {szText, {ALL = true, MSG_WHISPER = true, MSG_TEAM = true, MSG_PARTY = true, MSG_GUILD = true, MSG_GUILD_ALLIANCE = true}, false, false}
253245
table.insert(MY_Chat.tBlockWords, 1, bw)
254246
SaveBlockWords()
255247
-- 更新UI

0 commit comments

Comments
 (0)