[Tkabber-dev] r176 - trunk/plugins/antispam

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Feb 21 09:09:23 MSK 2009


Author: gebb
Date: 2009-02-21 09:09:23 +0300 (Sat, 21 Feb 2009)
New Revision: 176

Modified:
   trunk/plugins/antispam/antispam.tcl
Log:
Code cleanup.

Modified: trunk/plugins/antispam/antispam.tcl
===================================================================
--- trunk/plugins/antispam/antispam.tcl	2009-02-20 23:40:52 UTC (rev 175)
+++ trunk/plugins/antispam/antispam.tcl	2009-02-21 06:09:23 UTC (rev 176)
@@ -95,11 +95,8 @@
 #
 proc antispam::meets_rules {jid} {
 	variable options
-	if { ![regexp -nocase $options(disable_regex) $jid] \
-		&& [regexp -nocase $options(enable_regex) $jid] } {
-		return yes
-	}
-	return no
+	expr {![regexp -nocase $options(disable_regex) $jid]
+		&& [regexp -nocase $options(enable_regex) $jid]}
 }
 
 # Disables the postponing of messages and shows offline
@@ -133,11 +130,8 @@
 #
 proc antispam::postponed_msgs_exist {xlib} {
 	variable postponed_msgs
-	if { [info exists postponed_msgs($xlib)]
-		&& $postponed_msgs($xlib) ne "" } {
-		return yes
-	}
-	return no
+	expr { [info exists postponed_msgs($xlib)]
+		&& $postponed_msgs($xlib) ne ""}
 }
 
 # Shows postponed messages and clears the postponed
@@ -159,13 +153,10 @@
 
 # Checks if the specified array element exists and is true.
 #
-proc antispam::is_ {arr xlib} {
+proc antispam::is_ {arr x} {
 	variable $arr
-	upvar 0 ${arr}($xlib) el
-	if { [info exists el] && $el } {
-		return yes
-	}
-	return no
+	upvar 0 ${arr}($x) el
+	expr {[info exists el] && $el}
 }
 
 # Blocks messages from unknown JIDs
@@ -185,12 +176,12 @@
 			"PROCESS: message from $from, type $type, body: $body, args: $args."
 	}
 	# Block chat and error messages only.
-	if {$type ne "chat" \
+	if {$type ne "chat" 
 			&& $type ne "error"} {
 		return
 	}
 	# Accept service messages.
-	if {$body eq "" \
+	if {$body eq "" 
 			&& $type eq "chat"} {
 		debugmsg antispam \
 			"ACCEPT: empty body (possible service message)."
@@ -231,8 +222,8 @@
 		return
 	}
 	# Block empty errors from specified JIDs (defined by regexp).
-	if { $type eq "error" \
-		&& $body eq "" \
+	if { $type eq "error"
+		&& $body eq ""
 		&& [regexp -nocase $options(empty_err_regex) $from] } {
 		debugmsg antispam \
 			"BLOCK_EMPTY_ERR: blocking empty error from $from."
@@ -360,7 +351,7 @@
 		}
 	}
 	# TODO: Log the subscription request.
-	if { ![meets_rules $from] \
+	if { ![meets_rules $from]
 		|| [regexp -nocase $options(password) $status] } {
 		return
 	}



More information about the Tkabber-dev mailing list