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---- ----------------------------------------
99local _L = MY .LoadLangPack (MY .GetAddonInfo ().szRoot .. " Chat/lang/" )
1010MY_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
4040end
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
8569end
@@ -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