changeset 91:6f4bfd8e9447

urllog: Reorder code and make it simpler by removing duplicate checks.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 12 Sep 2011 17:20:53 +0300
parents a9a4456eb213
children f6f4595856ff
files urllog.tcl
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/urllog.tcl	Mon Sep 12 17:20:16 2011 +0300
+++ b/urllog.tcl	Mon Sep 12 17:20:53 2011 +0300
@@ -430,18 +430,15 @@
 
   set urlStr [string map $urllog_httprep $urlStr]
 
+  ### Does the URL already exist?
+  if {![urllog_exists $urlStr $urlNick $urlHost $urlChan]} {
+    return 1
+  }
 
   ### Do we perform additional optional checks?
-  if {$urllog_check == 0 || [string range $urlStr 0 4] != "http:"} {
+  if {$urllog_check == 0 || [string range $urlStr 0 3] != "http"} {
     # No optional checks, just add the URL, if it does not exist already
-    if {[urllog_exists $urlStr $urlNick $urlHost $urlChan]} {
-      urllog_addurl $urlStr $urlNick $urlHost $urlChan ""
-    }
-    return 1
-  }
-  
-  ### Does the URL already exist?
-  if {![urllog_exists $urlStr $urlNick $urlHost $urlChan]} {
+    urllog_addurl $urlStr $urlNick $urlHost $urlChan ""
     return 1
   }