Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3783822
D1591.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D1591.diff
View Options
diff --git a/Wearg/ServersLog.tcl b/Wearg/ServersLog.tcl
--- a/Wearg/ServersLog.tcl
+++ b/Wearg/ServersLog.tcl
@@ -12,6 +12,10 @@
regexp "^\\\[(.*)\\\] (.*)" $text match component entry
+ if {![could_be_a_component $component]} {
+ return 0
+ }
+
if {[is_known_component $component]} {
set callback [get_putbymode_chan_callback $chan $nick]
handle_send_to_servers_log [resolve_nick $nick] $chan $text $callback
@@ -45,6 +49,27 @@
return 0
}
+proc could_be_a_component {candidate} {
+ set firstCharacter [string index $candidate 0]
+
+ # Dates and numeric sequences are ignored
+ if {[string is digit $firstCharacter]} {
+ return 0
+ }
+
+ if {$firstCharacter == " "} {
+ return 0
+ }
+
+ foreach component [registry get serverslog.knownnotcomponents] {
+ if {$candidate == $component} {
+ return 0
+ }
+ }
+
+ return 1
+}
+
proc handle_send_to_servers_log {emitter source arg callback} {
global network
diff --git a/tests/ServersLog.test b/tests/ServersLog.test
--- a/tests/ServersLog.test
+++ b/tests/ServersLog.test
@@ -18,6 +18,10 @@
return "Alpha Beta"
}
+ if {$command == "get" && $key == "serverslog.knownnotcomponents"} {
+ return "{GSoC Mentors}"
+ }
+
error "Unexpected registry call: $command $key $value"
}
@@ -41,6 +45,26 @@
is_known_component Gamma
} -result 0
+test could_be_a_component_with_date {} -body {
+ could_be_a_component "15-Apr-2018 21:37:42 UTC"
+} -result 0
+
+test could_be_a_component_with_time {} -body {
+ could_be_a_component "1905495.738522"
+} -result 0
+
+test could_be_a_component_with_time_in_log {} -body {
+ could_be_a_component " 0.528573"
+} -result 0
+
+test could_be_a_component_with_server_name {} -body {
+ could_be_a_component "Ysul"
+} -result 1
+
+test could_be_a_component_with_mailing_list_prefix {} -body {
+ could_be_a_component "GSoC Mentors"
+} -result 0
+
###
### Cleanup
###
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 04:31 (19 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2265884
Default Alt Text
D1591.diff (1 KB)
Attached To
Mode
D1591: Ignore false positives log requests
Attached
Detach File
Event Timeline
Log In to Comment