View Single Post
Old 10-13-2013, 12:56 PM   #37
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
implemented exact-only matching, corner-case cleanup, and reduced logging noise.

Code:
+	    if str == nil then
+       		return nil
+ 		end
+
+	if not stringStartsWith(str, "L:") then
+
+-- Debug 		llog.info("WindowManager", "bad-client-name", "winName=" .. tostring(str), "report-untidy")
+		
+-- exact matches only, Ditch the system stuff, this prevents thing like "Gtkboard" matching "kb"
+		
+		if (str == "kb") or (str == "webreader") or (str ==  "pillowd") then
+       	return nil
+
+	       else
+
+-- we made it this far - let tidy up likely corner cases
+-- tidy up spaces and other potentially magic characters
+			str = string.gsub(str, "%s+", "-")
+			str = string.gsub(str, "%%+", "-")
+			str = string.gsub(str, "%^+", "-")
+			str = string.gsub(str, "%$+", "-")
+			str = string.gsub(str, "%(+", "-")
+			str = string.gsub(str, "%)+", "-")
+			str = string.gsub(str, "%[+", "-")
+			str = string.gsub(str, "%]+", "-")
+			str = string.gsub(str, "%*+", "-")
+			str = string.gsub(str, "%?+", "-")
+			str = string.gsub(str, "%++", "-")
+			str = string.gsub(str, "%_+", "-")
+			str = string.gsub(str, "%/+", "-")
+			str = string.gsub(str, "%:+", "-")
+
+-- Debug	 		llog.info("WindowManager", "good-client-name", "winName=" .. tostring(str), "post-tidy")
+	        	str = "L:A_N:application_ID:" .. tostring(str) .. "_O:R_PC:N"
+-- Debug			llog.info("WindowManager", "title", tostring(str) , " ✔")
     end
+end
twobob is offline   Reply With Quote