Browse Source

small cleanup

Paul Klumpp 12 years ago
parent
commit
e0cbfb03d9
1 changed files with 6 additions and 7 deletions
  1. 6 7
      connection.rb

+ 6 - 7
connection.rb

@@ -9,6 +9,7 @@ require 'digest/md5'
 # normal users have ROLE broadcast. Roles are defined on a per-user basis .. in a config.
 
 $version = "0.11big_yadda"
+$debug = 0
 
 $role_commands = Hash[
 	"everyone" => ["PING", "WHO", "C", "PART"], 
@@ -120,7 +121,7 @@ def consuming()
 
 				#from:#{$user}: #{cmd} #{payload}
 				
-				#put_log "msg #{message}"
+				#put_log "message #{message}"
 				
 				message =~ /^([!fromto]+):([a-zA-Z\._]+): (.+)$/
 				if not $& == nil
@@ -172,9 +173,9 @@ def consuming()
 					
 				end
 
-			else
+			else # of check_allow_processing
 				put_debug "RECEIVED from myself. Ignoring."
-			end
+			end # of check_allow_processing
 
 			rescue
 				put_debug "hum?"
@@ -291,7 +292,7 @@ end
 
 def main
 	
-	raise "ARGV[0] must be a userstring - no numbers!" unless ARGV[0] =~ /^[a-zA-Z_\.]+$/
+	raise "ARGV[0] must be a userstring - no numbers!" unless ARGV[0] =~ /^[a-zA-Z\._]+$/
 	
 	$user = "%s" % [ARGV[0]]
 	
@@ -303,8 +304,6 @@ def main
 	$my_roles = $user_roles[$user]
 	$my_cmds = $my_roles.collect {|v| $role_commands[v]}.flatten
 
-	$debug = 0
-	
 	$broadcasts = Hash.new
 	
 	put_log "HELLO Hi user '#{$user}'! How are you? I'm #{$version}"
@@ -342,7 +341,7 @@ def main
 			end
 			# now we have the cmd .. or not ;)
 			
-		  if inputmessage =~ /^[a-zA-Z_]+ (.+)/
+		  if inputmessage =~ /^[A-Z_]+ (.+)/
 				payload = $1
 			end
 			# now we can use payload